Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $FlowIgnore to the suppression comments #8397

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/typing/errors/suppression_comments.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(*
Suppression comments have the following syntax:

<SUPPRESSOR> := $FlowIssue | $FlowFixMe | $FlowExpectedError
<SUPPRESSOR> := $FlowIssue | $FlowFixMe | $FlowExpectedError | $FlowIgnore

//<SUPPRESSOR>[CODE]...
*)
Expand Down Expand Up @@ -72,7 +72,7 @@ let should_suppress comment loc =
let (comment, is_suppressor) =
consume_tokens [" "; "\n"; "\t"; "\r"; "*"] comment
|> fst
|> consume_tokens ["$FlowFixMe"; "$FlowIssue"; "$FlowExpectedError"]
|> consume_tokens ["$FlowFixMe"; "$FlowIssue"; "$FlowExpectedError"; "$FlowIgnore"]
in
if not is_suppressor then
Ok None
Expand Down
10 changes: 5 additions & 5 deletions tests/suppress_default/suppress_default.exp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Error ----------------------------------------------------------------------------------------------------- test.js:28:2
Error ----------------------------------------------------------------------------------------------------- test.js:31:2

Cannot cast `3` to string because number [1] is incompatible with string [2]. [incompatible-cast]

test.js:28:2
28| (3 : string); // error
test.js:31:2
31| (3 : string); // error
^ [1]

References:
test.js:28:6
28| (3 : string); // error
test.js:31:6
31| (3 : string); // error
^^^^^^ [2]


Expand Down
3 changes: 3 additions & 0 deletions tests/suppress_default/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
/* $FlowFixMe */
(3 : string); // no error

/* $FlowIgnore */
(3 : string); // no error

/** $FlowFixMe */
(3 : string); // no error

Expand Down