diff --git a/tools/eslint-rules/inspector-check.js b/tools/eslint-rules/inspector-check.js index f225b34cb6b0ca..e65dd17d768ac2 100644 --- a/tools/eslint-rules/inspector-check.js +++ b/tools/eslint-rules/inspector-check.js @@ -14,12 +14,12 @@ const msg = 'Please add a skipIfInspectorDisabled() call to allow this ' + 'test to be skippped when Node is built \'--without-inspector\'.'; module.exports = function(context) { - var usesInspector = false; + const missingCheckNodes = []; var hasInspectorCheck = false; function testInspectorUsage(context, node) { if (utils.isRequired(node, ['inspector'])) { - usesInspector = true; + missingCheckNodes.push(node); } } @@ -30,8 +30,10 @@ module.exports = function(context) { } function reportIfMissing(context, node) { - if (usesInspector && !hasInspectorCheck) { - context.report(node, msg); + if (!hasInspectorCheck) { + missingCheckNodes.forEach((node) => { + context.report(node, msg); + }); } }