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

Function fix

tools/eslint-rules/prefer-optional-chaining.js:77–88  ·  view source on GitHub ↗
(fixer)

Source from the content-addressed store, hash-verified

75 node,
76 message: 'Prefer optional chaining.',
77 fix(fixer) {
78 // Find the last valid member expression sequence
79 let last = first;
80 while (last < ops.length - 1 && isValidMemberExpressionPair(ops[last], ops[last + 1])) {
81 last++;
82 }
83
84 return fixer.replaceTextRange(
85 [ops[first].range[0], ops[last].range[1]],
86 generateOptionalChaining(ops, first, last),
87 );
88 },
89 });
90 },
91 };

Callers

nothing calls this directly

Calls 2

generateOptionalChainingFunction · 0.85

Tested by

no test coverage detected