| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
This might be a bit finicky since it would catch const isNaN = Number.isNaN; isNaN(val); too? But maybe that's not a real problem... 😆 |
Sorry, something went wrong.
|
No objections, but one question and one observation. Question: What's the reason for avoiding the isNaN() global? Observation: I think this can probably be implemented using no-restricted-syntax rather than a custom rule. |
Sorry, something went wrong.
For personal reasons, I think it's more clear to use Number.isNaN. Also, several Code and Learn PRs have been submitted to move towards Number.isNaN, so I figured that people had come to consensus that it was a good idea.
Interesting -- refactored down to use no-restricted-syntax |
Sorry, something went wrong.
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.
Sorry, something went wrong.
Oh, yeah, I assumed it was a lint rule we'd want for the entire code base... |
Sorry, something went wrong.
Yeah, I think we could do that? I don't see any reason why we would be stricter about this in test than lib. |
Sorry, something went wrong.
|
Are we sure we want to necessarily encourage people to change isNaN() to Number.isNan(). They behave differently. isNaN('a string is not a nubmer'); //true
Number.isNaN('a string is not a number'); // false |
Sorry, something went wrong.
|
Number.isNaN should be the new standard way of doing this as per ES2015. There's weird coercion in isNaN. |
Sorry, something went wrong.
|
updated @apapirovski @Trott For context, I was initially hesitant to add the rule to lib/, since we are generally performance sensitive, but I don't think the change will massively alter performance. Should benchmarks be run anyways? |
Sorry, something went wrong.
|
@maclover7 Sorry to make this tedious, but this is what I'd recommend:
|
Sorry, something went wrong.
|
(And yeah, had I not said anything, first bullet point would have happened and all of this would have been avoided. Sorry!) |
Sorry, something went wrong.
There was a problem hiding this comment.
I think the typeof n !== 'number' check is redundant if Number.isNaN is being used.
Sorry, something went wrong.
There was a problem hiding this comment.
I think the typeof historySize !== 'number' check is redundant if Number.isNaN is being used.
Sorry, something went wrong.
Sorry, something went wrong.
|
Will land tomorrow unless any objections |
Sorry, something went wrong.
PR-URL: #17556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #17556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #17556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #17556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #17556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
| Back | FazBrowse Home | New Git URL |
Checklist
Affected core subsystem(s)
tools, test