diff --git a/lib/rules/use-isnan.js b/lib/rules/use-isnan.js index 8a99100b06f..50ed8c59901 100644 --- a/lib/rules/use-isnan.js +++ b/lib/rules/use-isnan.js @@ -15,7 +15,7 @@ module.exports = function (context) { return { "BinaryExpression": function (node) { - if (/^[<>]=?|^===?|^!==?$/.test(node.operator) && (node.left.name === "NaN" || node.right.name === "NaN")) { + if (/^(?:[<>]|[!=]=)=?$/.test(node.operator) && (node.left.name === "NaN" || node.right.name === "NaN")) { context.report(node, "Use the isNaN function to compare with NaN."); } }