-
-
Notifications
You must be signed in to change notification settings - Fork 781
fix(linter): mark isNan and isFinite as dangerous fixes in unicorn/prefer-number-properties
#10706
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
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
isNan and isFinite as dangerous fixes in unicorn/prefer-number-propertiesisNan and isFinite as dangerous fixes in unicorn/prefer-number-properties
camc314
left a comment
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.
thanks!
CodSpeed Instrumentation Performance ReportMerging #10706 will not alter performanceComparing Summary
|
|
There are some more fixes, did not really read the file 👀 EDIT: wanted to create a new function but got stuck with the param hints and my broken rust-analyzer :/ |
7e05139 to
93a7968
Compare
camc314
left a comment
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 wonder wheter it's work adding an api like
ctx.diagnostic_with_fix_kind(diagnostic, FixKind::Dangerous, | fixer | {} )
Merge activity
|
…rn/prefer-number-properties` (#10706) I merged after I read about the `parse*` functions. The `isFinite` and `isNaN` should be dangerous fixes: ``` isFinite("0"); // true; coerced to number 0 Number.isFinite("0"); // false isFinite(null); // true; coerced to number 0 Number.isFinite(null); // false ``` https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite > As opposed to the global [isNaN()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN) function, the Number.isNaN() method doesn't force-convert the parameter to a number. This makes it safe to pass values that would normally convert to [NaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) but aren't actually the same value as [NaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN). This also means that only values of the Number type that are also [NaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) return true. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
93a7968 to
0ee15cd
Compare
…rn/prefer-number-properties` (#10706) I merged after I read about the `parse*` functions. The `isFinite` and `isNaN` should be dangerous fixes: ``` isFinite("0"); // true; coerced to number 0 Number.isFinite("0"); // false isFinite(null); // true; coerced to number 0 Number.isFinite(null); // false ``` https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite > As opposed to the global [isNaN()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN) function, the Number.isNaN() method doesn't force-convert the parameter to a number. This makes it safe to pass values that would normally convert to [NaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) but aren't actually the same value as [NaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN). This also means that only values of the Number type that are also [NaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) return true. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
0ee15cd to
a88e349
Compare

I merged after I read about the
parse*functions.The
isFiniteandisNaNshould be dangerous fixes:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN