Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: ESLint couldn't find the config "plugin:@typescript-eslint/recommended-type-checked" to extend from

I've looked around and can't find anything quite matching this, and none of the fixes have solved it for me. I'm relatively new to eslint, and could really use some help.

My goal is to turn on the rule "no-floating-promises" for my TypeScript project. When I add it and run lint, I get hundreds of instances of: error Definition for rule 'no-floating-promises' was not found no-floating-promises. From what I've read, it's beause I need to extend: "plugin:@typescript-eslint/recommended-type-checked"

So, I update my .eslintrc.json to add "plugin:@typescript-eslint/recommended-type-checked" to extends.

Now, when I run lint, I get:

Oops! Something went wrong! :(

ESLint: 8.45.0

ESLint couldn't find the config "plugin:@typescript-eslint/recommended-type-checked" to extend from. Please check that the name of the config is correct.

The config "plugin:@typescript-eslint/recommended-type-checked" was referenced from the config file in "/Users/[username]/gitdir/[project]/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

I'm struggling to figure out my next steps in troubleshooting this. Any direction would be appreciated!

My .eslintrc.json includes:

{
  "env": {
    "es2021": true,
    "node": true,
    "es6": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/recommended-type-checked"
  ],
  "overrides": [],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": "latest"
  },
"plugins": ["@typescript-eslint"],
...
"no-floating-promises": "warn"
}

I also tried:

  "parserOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module",
    "tsconfigRootDir": "__dirname",
    "project": ["./tsconfig.json"]
  },

to no effect.

like image 274
Praxis Avatar asked Oct 16 '25 07:10

Praxis


1 Answers

I wrote a blog post about potential solutions of this error and took the relevant part here. You should prefix the name of the rule when the rule comes from a plugin. @typescript-eslint in this case.

{
  "rules": {
-   "no-floating-promises": "warn"
+   "@typescript-eslint/no-floating-promises": "warn"
  }
}

There are two additional problems with the config you wrote. They are probably typos when writing the post because the error you mentioned is not related to them.

  1. You forgot parserOptions.project. (You fixed that in the second example). parserOptions.project is required if you extend from a configuration or use a rule that checks types because they need TypeScript for type checking. You use plugin:@typescript-eslint/recommended-type-checked. You may use a boolean when the TypeScript configuration file is named with the default tsconfig.json.
  2. You added no-floating-promises to the root. It should be in the rules.

Also, consider to use "error" instead of "warn". eslint command may not exit with an error code for "warn" (depends on command line parameters).

Below is the final config:

{
  "env": {
    "es2021": true,
    "node": true,
    "es6": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/recommended-type-checked"
  ],
  "overrides": [],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": "latest",
    "project": true
  },
  "plugins": ["@typescript-eslint"],
  "rules: {
    "@typescript-eslint/no-floating-promises": "warn"
  }
}
like image 77
ozm Avatar answered Oct 19 '25 00:10

ozm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!