Skip to content

Commit

Permalink
tools: fix bug in prefer-primordials lint rule
Browse files Browse the repository at this point in the history
PR-URL: nodejs#46659
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
aduh95 authored Feb 17, 2023
1 parent 18651ad commit 0084fc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/parallel/test-eslint-prefer-primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ new RuleTester({
{
code: `
const { ObjectDefineProperty, Symbol } = primordials;
ObjectDefineProperty(o, Symbol.toStringTag, { value: "o" })
ObjectDefineProperty(o, Symbol.toStringTag, { value: "o" });
const val = Symbol.toStringTag;
const { toStringTag } = Symbol;
`,
options: [{ name: 'Symbol', ignore: ['toStringTag'] }]
},
Expand Down
2 changes: 1 addition & 1 deletion tools/eslint-rules/prefer-primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module.exports = {
node,
);
const parentName = parent?.name;
if (!isTarget(nameMap, name) && !isTarget(nameMap, parentName)) {
if (!isTarget(nameMap, name) && (!isTarget(nameMap, parentName) || isIgnored(nameMap, parentName, name))) {
return;
}

Expand Down

0 comments on commit 0084fc7

Please sign in to comment.