Disallow case NaN
, switch(NaN)
, indexOf(NaN)
, and lastIndexOf(NaN)
(use-isnan)
#1429
Labels
Milestone
case NaN
, switch(NaN)
, indexOf(NaN)
, and lastIndexOf(NaN)
(use-isnan)
#1429
https://eslint.org/docs/rules/use-isnan
This is a proposal to modify the
use-isnan
rule.Current rule setting:
Proposed rule setting:
The
switch
statement internally uses the===
comparison to match the expression's value to a case clause.Therefore, it can never match
case NaN
. Also,switch(NaN)
can never match a case clause.Set
"enforceForSwitchCase"
totrue
if you want this rule to reportcase NaN
andswitch(NaN)
inswitch
statements.Examples of incorrect code for this rule with
"enforceForSwitchCase"
option set totrue
:Examples of correct code for this rule with
"enforceForSwitchCase"
option set totrue
:The text was updated successfully, but these errors were encountered: