Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 85fd7bb

Browse filesBrowse files
danbevMylesBorins
authored andcommitted
tools: fix inspector-check reporting
Currently the inspector-check rule does not store the node when the usage of a require('inspector') is done. This means that it is not possible to disable this rule. For example, if you add the following to a test that uses the inspector module: //common.skipIfInspectorDisabled(); /* eslint-disable inspector-check */ This will not disable the check and there will still be a lint error reported. This commit stores the node where the require statement is done which allows for the rule to also be disabled. PR-URL: #16902 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 5c8fb6a commit 85fd7bb
Copy full SHA for 85fd7bb

File tree

Expand file treeCollapse file tree

1 file changed

+6
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-4
lines changed
Open diff view settings
Collapse file

‎tools/eslint-rules/inspector-check.js‎

Copy file name to clipboardExpand all lines: tools/eslint-rules/inspector-check.js
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ const msg = 'Please add a skipIfInspectorDisabled() call to allow this ' +
1414
'test to be skippped when Node is built \'--without-inspector\'.';
1515

1616
module.exports = function(context) {
17-
var usesInspector = false;
17+
const missingCheckNodes = [];
1818
var hasInspectorCheck = false;
1919

2020
function testInspectorUsage(context, node) {
2121
if (utils.isRequired(node, ['inspector'])) {
22-
usesInspector = true;
22+
missingCheckNodes.push(node);
2323
}
2424
}
2525

@@ -30,8 +30,10 @@ module.exports = function(context) {
3030
}
3131

3232
function reportIfMissing(context, node) {
33-
if (usesInspector && !hasInspectorCheck) {
34-
context.report(node, msg);
33+
if (!hasInspectorCheck) {
34+
missingCheckNodes.forEach((node) => {
35+
context.report(node, msg);
36+
});
3537
}
3638
}
3739

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.