Typescript-eslint: Error: Failed to load plugin eslint-plugin-@typescript-eslint

Created on 17 Aug 2019  路  3Comments  路  Source: typescript-eslint/typescript-eslint

Repro

.eslintrc:

{
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended"
  ],
  "plugins": ["@typescript-eslint"],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
  }
}

Run: eslint --debug /Users/wayne/Documents/dev/property-management/hello-world/graphql.js

Expected Result

No Error

Actual Result

eslint:plugins Failed to load plugin eslint-plugin-@typescript-eslint.
ESLint couldn't find the plugin "eslint-plugin-@typescript-eslint". This can happen for a couple different reasons:

1. If ESLint is installed globally, then make sure eslint-plugin-@typescript-eslint is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm i eslint-plugin-@typescript-eslint@latest --save-dev

Additional Info

Versions

| package | version |
| ---------------------------------- | ------- |
| @typescript-eslint/eslint-plugin | 2.0.0 |
| @typescript-eslint/parser | 2.0.0 |
| TypeScript | 3.5.3 |
| ESLint | 6.1.0 |
| node | 10.16.3 |
| npm | 6.9.0 |

awaiting response eslint-plugin

Most helpful comment

That was the same error for me. If I run eslint in command line I get no errors. But Visual Studio Code was throwing same errors in the output. Solution was add local local settings

{
    "eslint.enable": true,
    "eslint.workingDirectories": [
        {"mode": "auto"}
    ]
}

image

All 3 comments

Chances are your eslint version isn't correct.
Something in your tree has installed eslint v4, which doesn't support scoped packages - hence the weird error.

did you accidentally run eslint globally?
try running npx eslint or yarn eslint instead.

Thanks heaps for your help. I have no idea how it was there. I worked out that I had a global eslint installed under /usr/local/bin/eslint after typing which eslint.

That was the same error for me. If I run eslint in command line I get no errors. But Visual Studio Code was throwing same errors in the output. Solution was add local local settings

{
    "eslint.enable": true,
    "eslint.workingDirectories": [
        {"mode": "auto"}
    ]
}

image

Was this page helpful?
0 / 5 - 0 ratings