feat: new enforceSuppressionCode rule#489
Conversation
src/rules/enforceSuppressionCode.js
Outdated
|
|
||
| const create = (context) => { | ||
| const isMissingSuppressionCode = function (value) { | ||
| const suppressionTypes = ['$FlowFixMe', '$FlowExpectedError']; |
There was a problem hiding this comment.
What about adding there all the newly supported suppressions? See: https://flow.org/en/docs/config/options/#toc-suppress-comment-regex
Note: In version v0.127.0, the option to specify the suppression comment syntax was removed. $FlowFixMe, $FlowIssue, $FlowExpectedError, and $FlowIgnore became the only standard suppressions.
| @@ -0,0 +1,31 @@ | |||
| export default { | |||
There was a problem hiding this comment.
It would be nice to have here some examples of block comments as well, see: https://flow.org/en/docs/errors/
There was a problem hiding this comment.
Cool found issue with block comments so fixed it
|
@mrtnzlml any more thoughts on the change? |
| code: '// $FlowFixMe I am doing something evil here\nconst text = \'HELLO\';', | ||
| errors: [ | ||
| { | ||
| message: '$FlowFixMe is missing a suppression code', |
There was a problem hiding this comment.
Flow is warning with the following message when the suppression code is missing:
Suppression is missing a code. Please update this suppression to use an error code: $FlowFixMe[incompatible-cast]
I understand that this would be complicated to do in Eslint, but maybe it would be nice to explain how to fix this error? For example:
$FlowFixMe is missing a suppression error code. Please update this suppression to use an error code: $FlowFixMe[…]
What do you think? Just a nit.
There was a problem hiding this comment.
Yeah no worries, let me look into it later
There was a problem hiding this comment.
Done, agree it's heaps better
… suppression-error-code
…-plugin-flowtype into suppression-error-code
|
@gajus bump |
|
@gajus Can this be merged? |
Closes #453
cc: @christianvuerings @gajus @angelica-bocanegra