How to fix ESLint error: Definition for rule was not found

ESLint throws the "Definition for rule was not found" error when a rule we use doesn't exist.

How to fix ESLint error: Definition for rule was not found
Photo by Michael Dziedzic / Unsplash

There could be several reasons why the rule doesn't exist. The most common ones are listed below:

Possible Reasons


You may have a typo or misspelled the name of the rule. Make a Google search +eslint +your-rule-name to find whether the rule exists.

Animation showing how to search rule in Google

Forgetting Prefix of Rules From Plugins

Error thrown by ESLint when rule was not found

When you add a rule from a plugin, you may forget to prefix the rule name with the plugin name. You need to add a plugin name at the beginning of the rule name:

  extends: ["plugin:@typescript-eslint/strict-type-checked"],
  rules: {
    "@typescript-eslint/non-nullable-type-assertion-style": "error"


Using Non-Compatible Plugins

A plugin or shared configuration you added (Plugin A) may use another plugin or shared configuration (Plugin B). Plugin B may have changed over time and could rename or remove some rules. If, for any reason, the new version of "Plugin B" is in your project and "Plugin A" still refers to an old rule, you will get the error. You either install an older version of "Plugin B" or a newer version of "Plugin A", hoping "Plugin A" is updated to use the more recent version of "Plugin B". This is the most annoying reason because it may force you to compromise.

LintLens VSCode Extension

If you are using VSCode, I suggest you install [LintLens Extension]( It adds details beside each ESLint rule in your configuration file (including plugins) located anywhere in your workspace folders (supports multiple config files and even multiple versions of ESLint and plugins).

Animation showing how LintLens is working

You can easily remember why you added a rule just by looking at the definition of it and catching if a rule does not exist even before running ESLint.

Rule not found warning in VSCode using LintLens


If none of the above fixes work for you, or I forgot to add a spot, please write it in the comments.