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: #46659
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
aduh95 authored and danielleadams committed Apr 3, 2023
1 parent effdca8 commit 665b742
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 665b742

Please sign in to comment.