Limits of recovering from a failed ESLint Flat Config upgrade
0 reputation · 20 Apr 2023, 17:17 UTC
Goal: Revert to legacy configuration after a Flat Config failure
When upgrading to the Flat Config system in ESLint 8+, a mis‑configured eslint.config.js can cause linting to fail or produce incorrect results. The project may still rely on a working legacy .eslintrc hierarchy, but the presence of the new file overrides it. The goal is to recover the previous state without manual rewrites or loss of plugin compatibility.
Constraints include: the project has already been built with the new config, some plugins are imported as objects, and the legacy config uses string references. There is no built‑in “undo” command in ESLint, and the migration is a breaking change that may affect CI pipelines.
Questions:
- Can ESLint automatically detect a failed
eslint.config.jsand fall back to the legacy.eslintrchierarchy? - Is there a CLI flag or environment variable that toggles between Flat Config and legacy mode at runtime?
- What minimal changes are required to restore the legacy configuration after a failed upgrade, while preserving plugin functionality?