diff options
author | Jon Moss <me@jonathanmoss.me> | 2017-12-11 17:20:39 -0500 |
---|---|---|
committer | Gibson Fahnestock <gibfahn@gmail.com> | 2018-01-24 02:45:20 +0000 |
commit | 0e37054c9620d85bab94e7db98a48c1accd0ffed (patch) | |
tree | 167ef0c5ba511bc165ae4dc3c358e132e13705d4 /tools | |
parent | 2f3d91dc58ea710ca111f8006f74b18609c3470b (diff) | |
download | node-new-0e37054c9620d85bab94e7db98a48c1accd0ffed.tar.gz |
tools: add number-isnan rule
PR-URL: https://github.com/nodejs/node/pull/17556
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/eslint-rules/number-isnan.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/eslint-rules/number-isnan.js b/tools/eslint-rules/number-isnan.js new file mode 100644 index 0000000000..885c38be8b --- /dev/null +++ b/tools/eslint-rules/number-isnan.js @@ -0,0 +1,14 @@ +'use strict'; + +const astSelector = "CallExpression[callee.name='isNaN']"; +const msg = 'Please use Number.isNaN instead of the global isNaN function'; + +module.exports = function(context) { + function report(node) { + context.report(node, msg); + } + + return { + [astSelector]: report + }; +}; |