Skip to content
Latchkey

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.

eslint output
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
// 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

  1. Drop --ext; specify extensions via files globs in the config instead.
  2. Move env to languageOptions.globals (e.g. via the globals package).
  3. Convert top-level extends to 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.

Frequently asked questions

What causes "flat config migration"?
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.
How do I fix flat config migration?
Author a flat config; use FlatCompat to reuse legacy shareable configs during transition.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card