jsx-eslint / eslint-plugin-react

React-specific linting rules for ESLint
MIT License
8.97k stars 2.77k forks source link

[Bug]: `TypeError: Failed to load plugin declared in '.eslintrc': [[GeneratorState]] is not present on O` with v7.34.0 #3703

Closed acelaya closed 6 months ago

acelaya commented 6 months ago

Is there an existing issue for this?

Description Overview

We have dependabot set-up in a couple of repositories where an attempt on updating to eslint-plugin-react: 7.34.0 resulted in the execution of eslint to produce errors like these:

TypeError: Failed to load plugin 'jsx-a11y' declared in '.eslintrc': `[[GeneratorState]]` is not present on `O`
Referenced from: /home/runner/work/frontend-shared/frontend-shared/.eslintrc
    at Object.assert (/home/runner/work/frontend-shared/frontend-shared/node_modules/es-iterator-helpers/node_modules/internal-slot/index.js:19:10)
    at GeneratorStart (/home/runner/work/frontend-shared/frontend-shared/node_modules/es-iterator-helpers/aos/GeneratorStart.js:14:7)
    at CreateIteratorFromClosure (/home/runner/work/frontend-shared/frontend-shared/node_modules/es-iterator-helpers/aos/CreateIteratorFromClosure.js:45:2)
    at Array Iterator.filter (/home/runner/work/frontend-shared/frontend-shared/node_modules/es-iterator-helpers/Iterator.prototype.filter/implementation.js:79:15)
    at Object.<anonymous> (/home/runner/work/frontend-shared/frontend-shared/node_modules/eslint-plugin-jsx-a11y/lib/util/isInteractiveElement.js:65:70)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
TypeError: Error while loading rule 'react/display-name': `[[GeneratorState]]` is not present on `O`
Occurred while linting /home/runner/work/browser-extension/browser-extension/gulpfile.js
    at Object.assert (/home/runner/work/browser-extension/browser-extension/node_modules/es-iterator-helpers/node_modules/internal-slot/index.js:18:10)
    at GeneratorStart (/home/runner/work/browser-extension/browser-extension/node_modules/es-iterator-helpers/aos/GeneratorStart.js:12:7)
    at CreateIteratorFromClosure (/home/runner/work/browser-extension/browser-extension/node_modules/es-iterator-helpers/aos/CreateIteratorFromClosure.js:42:2)
    at MapIterator.map (/home/runner/work/browser-extension/browser-extension/node_modules/es-iterator-helpers/Iterator.prototype.map/implementation.js:71:15)
    at mergeRules (/home/runner/work/browser-extension/browser-extension/node_modules/eslint-plugin-react/lib/util/Components.js:273:22)
    at Components.componentRule (/home/runner/work/browser-extension/browser-extension/node_modules/eslint-plugin-react/lib/util/Components.js:924:22)
    at createRuleListeners (/home/runner/work/browser-extension/browser-extension/node_modules/eslint/lib/linter/linter.js:895:21)
    at /home/runner/work/browser-extension/browser-extension/node_modules/eslint/lib/linter/linter.js:1066:110
    at Array.forEach (<anonymous>)
    at runRules (/home/runner/work/browser-extension/browser-extension/node_modules/eslint/lib/linter/linter.js:1003:34)

Everything works with v7.33.2

Expected Behavior

Linting keeps working when no other changes have been performed, other than updating eslint-plugin-react package.

eslint-plugin-react version

v7.34.0

eslint version

v8.57.0

node version

v20

ljharb commented 6 months ago

This is caused by yarn installing an incorrect dependency graph. Duplicate of #3627. Duplicate of #3624. and others.

acelaya commented 6 months ago

Oh, no. How did I not find those 🤦🏼

Thanks, and sorry for the noise.

ljharb commented 6 months ago

np. i suggest using npm :-)

acelaya commented 6 months ago

We are actually using yarn 3, not yarn classic. This is making me think dependabot is actually not using that version and potentially messing up our lockfiles.

ljharb commented 6 months ago

Potentially - but it’s also possible yarn 3 has the same bug ¯\_(ツ)_/¯