Skip to content

Commit a0ad12b

Browse files
cjihrigcodebytere
authored andcommitted
lib,tools,test: remove custom number-isnan rule
This commit removes the custom number-isnan ESLint rule in favor of the no-restricted-syntax rule. It also applies the rule across the entire codebase, instead of just the test/ directory. PR-URL: #31211 Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent f068788 commit a0ad12b

File tree

6 files changed

+6
-40
lines changed

6 files changed

+6
-40
lines changed

.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ module.exports = {
244244
selector: "CallExpression[callee.property.name='strictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])",
245245
message: 'The first argument should be the `actual`, not the `expected` value.',
246246
},
247+
{
248+
selector: "CallExpression[callee.name='isNaN']",
249+
message: 'Use Number.isNaN() instead of the global isNaN() function.',
250+
},
247251
],
248252
/* eslint-enable max-len */
249253
'no-return-await': 'error',

lib/.eslintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ rules:
6363
message: "Please use `require('internal/errors').hideStackFrames()` instead."
6464
- selector: "AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])"
6565
message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'."
66+
- selector: "CallExpression[callee.name='isNaN']"
67+
message: "Use NumberIsNaN() primordial instead of the global isNaN() function."
6668
# Custom rules in tools/eslint-rules
6769
node-core/lowercase-name-for-primitive: error
6870
node-core/non-ascii-character: error

test/.eslintrc.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ rules:
1919
node-core/crypto-check: error
2020
node-core/eslint-check: error
2121
node-core/inspector-check: error
22-
node-core/number-isnan: error
2322
## common module is mandatory in tests
2423
node-core/required-modules:
2524
- error

test/parallel/test-eslint-number-isnan.js

-24
This file was deleted.

test/root.status

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ parallel/test-eslint-eslint-check: SLOW
3434
parallel/test-eslint-inspector-check: SLOW
3535
parallel/test-eslint-lowercase-name-for-primitive: SLOW
3636
parallel/test-eslint-no-unescaped-regexp-dot: SLOW
37-
parallel/test-eslint-number-isnan: SLOW
3837
parallel/test-eslint-prefer-assert-iferror: SLOW
3938
parallel/test-eslint-prefer-assert-methods: SLOW
4039
parallel/test-eslint-prefer-common-expectserror: SLOW

tools/eslint-rules/number-isnan.js

-14
This file was deleted.

0 commit comments

Comments
 (0)