Skip to content

Commit 665b742

Browse files
aduh95danielleadams
authored andcommitted
tools: fix bug in prefer-primordials lint rule
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>
1 parent effdca8 commit 665b742

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎test/parallel/test-eslint-prefer-primordials.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ new RuleTester({
5757
{
5858
code: `
5959
const { ObjectDefineProperty, Symbol } = primordials;
60-
ObjectDefineProperty(o, Symbol.toStringTag, { value: "o" })
60+
ObjectDefineProperty(o, Symbol.toStringTag, { value: "o" });
61+
const val = Symbol.toStringTag;
62+
const { toStringTag } = Symbol;
6163
`,
6264
options: [{name: 'Symbol',ignore: ['toStringTag']}]
6365
},

‎tools/eslint-rules/prefer-primordials.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module.exports = {
114114
node,
115115
);
116116
constparentName=parent?.name;
117-
if(!isTarget(nameMap,name)&&!isTarget(nameMap,parentName)){
117+
if(!isTarget(nameMap,name)&&(!isTarget(nameMap,parentName)||isIgnored(nameMap,parentName,name))){
118118
return;
119119
}
120120

0 commit comments

Comments
 (0)