ESLint "Could not find config file" - Flat Config (v9) Migration
ESLint v9 defaults to flat config (eslint.config.js) and no longer auto-loads .eslintrc.*. After upgrading, a project still on the legacy format fails to find a config, or rejects options that flat config moved or removed.
What this error means
After an ESLint major bump, CI fails with Could not find config file, or errors about options/keys (env, extends, --ext) that flat config handles differently. The same repo linted fine on ESLint 8.
Oops! Something went wrong! :(
ESLint: 9.0.0
Could not find config file.
# or
Invalid option '--ext' - perhaps you meant to use flat config's 'files'?Common causes
Legacy .eslintrc on ESLint v9
ESLint 9 looks for eslint.config.js (flat config) by default and ignores .eslintrc.* unless compatibility is explicitly enabled, so it reports no config found.
Flat config restructures options
Flat config replaces env, top-level extends, and the --ext flag with languageOptions, config arrays/FlatCompat, and the files field. Old options error under the new format.
How to fix it
Migrate to eslint.config.js
Author a flat config; use FlatCompat to reuse legacy shareable configs during transition.
// eslint.config.js
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
export default [
js.configs.recommended,
...tseslint.configs.recommended,
{ files: ['**/*.{ts,tsx}'], rules: { /* ... */ } },
]Replace removed CLI options
- Drop
--ext; specify extensions viafilesglobs in the config instead. - Move
envtolanguageOptions.globals(e.g. via theglobalspackage). - Convert top-level
extendsto spreading config objects/arrays.
How to prevent it
- Plan the flat-config migration before adopting ESLint v9 in CI.
- Pin the ESLint major so an upgrade is a deliberate, tested change.
- Keep one config format across local and CI to avoid drift.