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

use-isnan should recommand using Number.isNaN #375

Closed
DavidBruant opened this issue Nov 12, 2013 · 5 comments
Closed

use-isnan should recommand using Number.isNaN #375

DavidBruant opened this issue Nov 12, 2013 · 5 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion rule Relates to ESLint's core rules

Comments

@DavidBruant
Copy link
Contributor

isNaN is broken. ES6 fixed it with Number.isNaN which is easily polyfilled. Maybe the rule should recommend using Number.isNaN

@nzakas
Copy link
Member

nzakas commented Nov 14, 2013

We can't assume someone is using a polyfill or ES6 at the moment, so we'd be giving advice that most people can't follow. Given that, I don't think this is actionable.

@nzakas nzakas closed this as completed Nov 14, 2013
@DavidBruant
Copy link
Contributor Author

The error message could recommend to use a polyfill for people to use.

@michaelficarra
Copy link
Member

It could tell them to use x !== x, but that will trigger no-self-compare, which does not have the exception suggested in #374.

@ilyavolodin
Copy link
Member

I honestly thing this is too situational to be a rule. In majority of the cases, isNaN works just fine, and suggesting to users to rely on third-party polyfill to do something that might works just fine for their use cases, feels like a wrong idea.

@nzakas
Copy link
Member

nzakas commented Nov 14, 2013

When Number.isNaN() is more ubiquitous, I'm happy to revisit this decision.
At this time, I don't think making a change adds enough value.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

4 participants