What rule do you want to change?
Does this change cause the rule to produce more or fewer warnings?
How will the change be implemented? (New option, new default behavior, etc.)?
Please provide some example code that this change will affect:
x === NaN; x === Number.NaN;
What does the rule currently do for this code?
What will the rule do after it's changed?
Are you willing to submit a pull request to implement this change?
- return Boolean(node) && node.type === "Identifier" && node.name === "NaN"; + return Boolean(node) && (node.type === "Identifier" && node.name === "NaN" || + node.type === "MemberExpression" && + node.object.type === "Identifier" && node.object.name === "Number" && + node.property.type === "Identifier" && node.property.name === "NaN");
The text was updated successfully, but these errors were encountered:
…14718) * Update: improve `isNaNIdentifier` to detect `Number.isNaN` (fixes #14715) * Chore: add test cases for `Number.NaN` * Docs: add more examples for `use-isnan` * Chore: improve logic and add more test cases * Docs: Update docs/rules/use-isnan.md Co-authored-by: Milos Djermanovic <firstname.lastname@example.org> Co-authored-by: Milos Djermanovic <email@example.com>