diff --git a/test/parallel/test-eslint-prefer-primordials.js b/test/parallel/test-eslint-prefer-primordials.js index 30c8cd25355c5a..ba44e88cf9c4ec 100644 --- a/test/parallel/test-eslint-prefer-primordials.js +++ b/test/parallel/test-eslint-prefer-primordials.js @@ -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'] }] }, diff --git a/tools/eslint-rules/prefer-primordials.js b/tools/eslint-rules/prefer-primordials.js index 9afdfa41c00ac9..f8f5cb60c36a63 100644 --- a/tools/eslint-rules/prefer-primordials.js +++ b/tools/eslint-rules/prefer-primordials.js @@ -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; }