r/reactjs • u/SpiritualDinner628 • 10h ago
Upgrading to ESLint 10 with eslint-plugin-react: why it passes locally and fails in CI, and a fix
If you've tried ESLint 10 with eslint-plugin-react, jsx-a11y or import, you've probably hit ERESOLVE or getFilename is not a function. None of the three has released ESLint 10 support yet.
What I found:
npm install -D eslint@10in an existing project only warns, so it looks fine.npm ciin CI then fails.- The crash comes from
settings.react.version: "detect"calling a function ESLint 10 remove
The manual fix is an npm overrides entry per plugin plus wrapping your config in fixupConfigRules from u/eslint/compat (details in the README).
I wrote a CLI that does it and proves your lint output didn't change: npx eslint-unstick --fix.
Repo: https://github.com/Raj-json/eslint-unstick. Feedback from real projects is very welcome, especially where it fails.
3
u/power78 9h ago
Forget eslint. Biome and oxlint are the future. Way, way faster.
1
u/Weak_Particular_5799 6h ago
fwiw on ESLint 10.16 with eslint-plugin-react 7.37.5, just pinning
settings.react.versionto a real number ("19.2") instead of "detect" got the whole recommended config running for me, no compat wrapper. fixupConfigRules was only needed for a few non-recommended rules like jsx-tag-spacing, jsx-filename-extension and jsx-one-expression-per-line, those still crash.1
u/allaboutzaid 4h ago
This is the kind of thing that worries me about upgrading tooling on my small projects — it passing locally and only failing in CI is exactly the trap I'd fall into, since my lint runs in GitHub Actions too. The tip in the comments about pinning settings.react.version to a real number instead of "detect" sounds like the simpler fix for a small project — is that the route you'd take before reaching for the CLI, or does the CLI catch things the pin doesn't?
2
u/Normie_Cat 7h ago
Slop