Skip to content

Commit

Permalink
lib,tools,test: remove custom number-isnan rule
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cjihrig committed Jan 8, 2020
1 parent a494d12 commit ba98d9a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 40 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ module.exports = {
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'])",
message: 'The first argument should be the `actual`, not the `expected` value.',
},
{
selector: "CallExpression[callee.name='isNaN']",
message: 'Use Number.isNaN() instead of the global isNaN() function.',
},
],
/* eslint-enable max-len */
'no-return-await': 'error',
Expand Down
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ rules:
message: "Please use `require('internal/errors').hideStackFrames()` instead."
- selector: "AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])"
message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'."
- selector: "CallExpression[callee.name='isNaN']"
message: "Use NumberIsNaN() primordial instead of the global isNaN() function."
# Custom rules in tools/eslint-rules
node-core/lowercase-name-for-primitive: error
node-core/non-ascii-character: error
Expand Down
1 change: 0 additions & 1 deletion test/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rules:
node-core/crypto-check: error
node-core/eslint-check: error
node-core/inspector-check: error
node-core/number-isnan: error
## common module is mandatory in tests
node-core/required-modules:
- error
Expand Down
24 changes: 0 additions & 24 deletions test/parallel/test-eslint-number-isnan.js

This file was deleted.

1 change: 0 additions & 1 deletion test/root.status
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ parallel/test-eslint-eslint-check: SLOW
parallel/test-eslint-inspector-check: SLOW
parallel/test-eslint-lowercase-name-for-primitive: SLOW
parallel/test-eslint-no-unescaped-regexp-dot: SLOW
parallel/test-eslint-number-isnan: SLOW
parallel/test-eslint-prefer-assert-iferror: SLOW
parallel/test-eslint-prefer-assert-methods: SLOW
parallel/test-eslint-prefer-common-mustnotcall: SLOW
Expand Down
14 changes: 0 additions & 14 deletions tools/eslint-rules/number-isnan.js

This file was deleted.

0 comments on commit ba98d9a

Please sign in to comment.