MCPcopy Index your code
hub / github.com/nodejs/node / create

Function create

tools/eslint-rules/inspector-check.js:20–65  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

18 fixable: 'code',
19 },
20 create(context) {
21 const missingCheckNodes = [];
22 let commonModuleNode = null;
23 let hasInspectorCheck = false;
24
25 function testInspectorUsage(context, node) {
26 if (utils.isRequired(node, ['inspector'])) {
27 missingCheckNodes.push(node);
28 }
29
30 if (utils.isCommonModule(node)) {
31 commonModuleNode = node;
32 }
33 }
34
35 function checkMemberExpression(context, node) {
36 if (utils.usesCommonProperty(node, ['skipIfInspectorDisabled'])) {
37 hasInspectorCheck = true;
38 }
39 }
40
41 function reportIfMissing(context) {
42 if (!hasInspectorCheck) {
43 missingCheckNodes.forEach((node) => {
44 context.report({
45 node,
46 message: msg,
47 fix: (fixer) => {
48 if (commonModuleNode) {
49 return fixer.insertTextAfter(
50 commonModuleNode,
51 '\ncommon.skipIfInspectorDisabled();',
52 );
53 }
54 },
55 });
56 });
57 }
58 }
59
60 return {
61 'CallExpression': (node) => testInspectorUsage(context, node),
62 'MemberExpression': (node) => checkMemberExpression(context, node),
63 'Program:exit': () => reportIfMissing(context),
64 };
65 },
66};

Callers

nothing calls this directly

Calls 3

testInspectorUsageFunction · 0.85
checkMemberExpressionFunction · 0.70
reportIfMissingFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…