Failed to load plugin '@typescript-eslint' declared in '.eslintrc » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'
See original GitHub issueDescribe 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:
- Created 3 years ago
- Reactions:68
- Comments:58 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue can be resolved by using a
.eslintignore
file. In my case is seems eslint was trying to lint thenode_modules
and adding a eslintignore file with just node_modules in it stop the error.@Vanuan thank you, it fixed my problem!
So I changed my script from
eslint .
toestlint ./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.