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

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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
const parentName = 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy