question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load plugin '@typescript-eslint' declared in '.eslintrc » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'

See original GitHub issue

Describe the bug

When I run eslint: lint whole folder task, it fails because of the error mentioned in the title.

Did you try recovering your dependencies?

Yes, I did.

Which terms did you search for in User Guide?

The issue is not related to any of them, it’s ESLint.

Environment

Environment Info:

  current version of create-react-app: 3.4.1
  running from C:\Users\X\AppData\Roaming\npm\node_modules\create-react-app

  System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
  Binaries:
    Node: 12.10.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Users\X\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.4 - C:\Users\X\AppData\Roaming\npm\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
    Internet Explorer: Not Found
  npmPackages:
    react: ^16.13.1 => 16.13.1
    react-dom: ^16.13.1 => 16.13.1
    react-scripts: ^3.4.1 => 3.4.1
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

Just run eslint: lint whole folder task.

This is my ESLint config:

{
  "extends": [
    "react-app",
    "airbnb",
    "prettier"
  ],
  "env": {
    "mocha": true,
    "es6": true,
    "commonjs": true,
    "browser": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "modules": true,
      "experimentalObjectRestSpread": true
    }
  },
  "plugins": [
    "prettier"
  ],
  "rules": {
    "no-underscore-dangle": "off",
    "class-methods-use-this": "off",
    "import/no-extraneous-dependencies": [
      "error",
      {
        "devDependencies": true
      }
    ]
  }
}

Expected behavior

It should not throw exceptions.

Actual behavior

It throws the above exception.

Reproducible demo

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:68
  • Comments:58 (1 by maintainers)

github_iconTop GitHub Comments

106reactions
maldimirovcommented, Jul 5, 2020

The issue can be resolved by using a .eslintignore file. In my case is seems eslint was trying to lint the node_modules and adding a eslintignore file with just node_modules in it stop the error.

52reactions
Lelithcommented, Jun 22, 2020

@Vanuan thank you, it fixed my problem!

So I changed my script from eslint . to estlint ./src and it now works like a charm. So I guess it was finding some *.ts file in any of the node modules or any other hidden folder that might have a ts file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to load plugin @typescript-eslint: Cannot find ...
I use eslint-loader . Just figured out that it uses an older version of eslint, unless you specify the path to eslint using...
Read more >
WEB-53184
Error : Failed to load plugin '@typescript-eslint' declared in '../../../.eslintrc.json': Cannot find module '@typescript-eslint/eslint-plugin'.
Read more >
Failed to load plugin '@typescript-eslint ... - Corey Roth's Blog
Failed to load plugin '@typescript-eslint/eslint-plugin' declared in '.eslintrc.js with SPFx 1.15 and Azure DevOps Pipeline.
Read more >
eslint/eslint - Gitter
js --resolve-plugins-relative-to c:\Users\user\AppData\Roaming\npm .\** Error: Failed to load parser '@typescript-eslint/parser' declared in '--config': Cannot ...
Read more >
error: failed to load plugin '@typescript-eslint' declared in '. ...
eslintrc.json': cannot find module 'typescript'. Add Answer | View In TPC Matrix. Technical Problem Cluster First Answered On February 4, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found