-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
tools: add number-isnan eslint rule #17556
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
Conversation
This might be a bit finicky since it would catch |
No objections, but one question and one observation. Question: What's the reason for avoiding the Observation: I think this can probably be implemented using |
For personal reasons, I think it's more clear to use
Interesting -- refactored down to use no-restricted-syntax |
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.
Unfortunately this won't work as it overrides all the no-restricted-syntax
rules declared within .eslintrc.yaml
in the root directory.
Oh, yeah, I assumed it was a lint rule we'd want for the entire code base... |
Yeah, I think we could do that? I don't see any reason why we would be stricter about this in |
Are we sure we want to necessarily encourage people to change isNaN('a string is not a nubmer'); //true
Number.isNaN('a string is not a number'); // false |
|
updated @apapirovski @Trott For context, I was initially hesitant to add the rule to |
@maclover7 Sorry to make this tedious, but this is what I'd recommend:
|
(And yeah, had I not said anything, first bullet point would have happened and all of this would have been avoided. Sorry!) |
lib/events.js
Outdated
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.
I think the typeof n !== 'number'
check is redundant if Number.isNaN
is being used.
lib/readline.js
Outdated
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.
I think the typeof historySize !== 'number'
check is redundant if Number.isNaN
is being used.
updated @Trott, PTAL |
Will land tomorrow unless any objections |
Landed in e554bc8 |
PR-URL: #17556 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #17556 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #17556 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #17556 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #17556 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
tools, test