tools: add number-isnan eslint rule#17556
tools: add number-isnan eslint rule#17556maclover7 wants to merge 2 commits intonodejs:masterfrom maclover7:jm-number-isnan
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 |
apapirovski
left a comment
There was a problem hiding this comment.
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.
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.
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