Skip to content
Latchkey

ESLint "Definition for rule was not found" in CI

ESLint reports an error for a configured rule it cannot resolve to a definition. The rule's plugin is not installed, the name is misspelled, or the plugin dropped the rule in the installed version.

What this error means

ESLint prints "error Definition for rule 'X' was not found X" for a plugin rule like import/no-cycle or react-hooks/exhaustive-deps, failing the run.

ESLint
/home/runner/work/app/app/src/index.tsx
  0:0  error  Definition for rule 'react-hooks/exhaustive-deps' was not found  react-hooks/exhaustive-deps

Common causes

The plugin that defines the rule is not installed

The rule lives in a plugin (eslint-plugin-react-hooks, eslint-plugin-import) that is missing from the CI dependency set.

The rule was renamed or removed

A plugin upgrade renamed or dropped the rule, so the name in your config no longer maps to a definition.

How to fix it

Install the plugin and register it

  1. Identify the plugin prefix in the rule name (react-hooks/... -> eslint-plugin-react-hooks).
  2. Install the plugin and add it to plugins in the config.
  3. Re-run ESLint to confirm the rule resolves.
Terminal
npm install --save-dev eslint-plugin-react-hooks

Correct or remove a stale rule name

If the plugin renamed the rule, update the key to the new name; if it was removed, delete the entry.

How to prevent it

  • Keep every plugin that supplies a rule in devDependencies.
  • Review plugin changelogs before bumping major versions.
  • Add new rules with their plugin in the same change.

Frequently asked questions

What causes ""Definition for rule X was not found""?
The rule lives in a plugin (eslint-plugin-react-hooks, eslint-plugin-import) that is missing from the CI dependency set.
How do I fix "Definition for rule X was not found"?
Install the plugin and register it

Related guides

References

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