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
Update: Add enforceForSwitchCase option to use-isnan #12106
Conversation
Marking as accepted as the issue #12207 is accepted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I think that it would be also good to report |
|
@mysticatea There are also something like preferring |
I'll do this behind the same option, so please don't merge this PR yet :)
I was asking for this particular rule, because in #375 was a discussion should the rule ever recommend |
This is done, and the option is now ready for a re-review. |
What is the purpose of this pull request? (put an "X" next to item)
[X] Changes an existing rule
Refs #12207
What rule do you want to change?
use-isnan
Does this change cause the rule to produce more or fewer warnings?
More if the option is set.
How will the change be implemented? (New option, new default behavior, etc.)?
New option, which might be removed in major version to be new default behavior.
Please provide some example code that this change will affect:
What does the rule currently do for this code?
Nothing.
What will the rule do after it's changed?
Report warning.
case NaN
is a possible error, basically the same asfoo === NaN
which the rule targets.What changes did you make? (Give an overview)
New option.
Is there anything you'd like reviewers to focus on?
Number.isNaN
.correct
example in docs, is there a 'better' way to solve it?switch (NaN)
?I'll submit another PR for
.indexOf()
and.lastIndexOf()
, that should be a separate option (and stay as an option) as it can cause false positives due to the limitations, so someone might want to turn these off.