MCPcopy Index your code
hub / github.com/nodejs/node / [identifierSelector]

Function [identifierSelector]

tools/eslint-rules/prefer-primordials.js:134–181  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

132 reported = new Set();
133 },
134 [identifierSelector](node) {
135 if (node.parent.type === 'Property' && node.parent.key === node) {
136 // If the identifier is the key for this property declaration, it
137 // can't be referring to a primordials member.
138 return;
139 }
140 if (reported.has(node.range[0])) {
141 return;
142 }
143 const name = node.name;
144 const parent = getDestructuringAssignmentParent(
145 context.sourceCode.getScope(node),
146 node,
147 );
148 const parentName = parent?.name;
149 if (!isTarget(nameMap, name) && (!isTarget(nameMap, parentName) || isIgnored(nameMap, parentName, name))) {
150 return;
151 }
152
153 const defs = globalScope.set.get(name)?.defs;
154 if (parentName && isTarget(nameMap, parentName)) {
155 if (defs?.[0].name.name !== 'primordials' &&
156 !reported.has(parent.range[0]) &&
157 parent.parent?.id?.type !== 'Identifier') {
158 reported.add(node.range[0]);
159 const into = renameMap.get(name);
160 context.report({
161 node,
162 messageId: 'error',
163 data: {
164 name: getReportName({ into, parentName, name }),
165 },
166 });
167 }
168 return;
169 }
170 if (defs.length === 0 || defs[0].node.init.name !== 'primordials') {
171 reported.add(node.range[0]);
172 const into = renameMap.get(name);
173 context.report({
174 node,
175 messageId: 'error',
176 data: {
177 name: getReportName({ into, parentName, name }),
178 },
179 });
180 }
181 },
182 MemberExpression(node) {
183 const obj = node.object.name;
184 const prop = node.property.name;

Callers

nothing calls this directly

Calls 8

isTargetFunction · 0.85
isIgnoredFunction · 0.85
getReportNameFunction · 0.85
hasMethod · 0.65
getMethod · 0.65
addMethod · 0.65
reportMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…