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

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

Possible Reasons

Misspelling

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.

Forgetting Prefix of Rules From Plugins

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"
  }
}

.eslintrc.cjs

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](https://marketplace.visualstudio.com/items?itemName=ghmcadams.lintlens). 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).

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.

Conclusion

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