ESLint Flat Config "Could not find plugin" / "Key plugins" - Fix in CI
In ESLint flat config, plugins are imported as modules and registered in a plugins object on each config entry - there is no extends/string resolution like eslintrc. A rule referencing a plugin namespace that is not registered fails because flat config never resolves plugin names by string.
What this error means
ESLint fails with Could not find plugin "<name>", Key "rules": Key "<plugin>/<rule>": Could not find plugin, or TypeError: Cannot read properties of undefined when a rule's plugin namespace is not registered in eslint.config.js.
Error: Key "rules": Key "@typescript-eslint/no-unused-vars":
Could not find plugin "@typescript-eslint".
at eslint.config.jsCommon causes
Plugin not registered in the plugins object
Flat config does not auto-resolve plugin names. A rule like @typescript-eslint/... only works if the config entry registers '@typescript-eslint': tseslint in its plugins map.
eslintrc-style string extends in flat config
Copying extends: ['plugin:...'] or plugins: ['react'] (string form) from eslintrc into flat config does not work - flat config needs imported plugin objects.
How to fix it
Import and register the plugin object
Import the plugin and register it under plugins, then reference its rules.
// eslint.config.js
import tseslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
export default [
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: { parser: tsParser },
plugins: { '@typescript-eslint': tseslint },
rules: { '@typescript-eslint/no-unused-vars': 'error' },
},
]Replace eslintrc string extends
- Drop
extends: ["plugin:..."]; spread the plugin's exported flat config instead. - Register every plugin namespace your rules reference in
plugins. - Use
@eslint/eslintrc'sFlatCompatonly as a temporary bridge for legacy shareable configs.
How to prevent it
- Register every referenced plugin in the flat-config
pluginsobject. - Prefer plugins' exported flat configs over hand-wiring.
- Do not copy eslintrc string
extends/pluginsinto flat config.