node/tools/eslint-rules/number-isnan.js
Jon Moss 6531401cde
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>
2018-01-09 03:17:41 -05:00

14 lines
295 B
JavaScript

'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
};
};