ESLint Bug: extended config does not work with globally installed eslint
See original GitHub issueWhen running lint (eslint .
) from a globally installed version of eslint (npm install -g eslint
) you will get the following error. This appears to be a problem with ESLint itself.
package.json
dependencies: {
"eslint-config-defaults": "^7.x.x",
"eslint": "^1.10.3"
}
eslint .
/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:332
throw e;
^
Error: Cannot read config package: eslint-config-defaults/configurations/walmart/es6-browser
Error: Cannot find module 'eslint-config-defaults/configurations/walmart/es6-browser'
Referenced from: /Users/ebaer/dev/tmp/builder-test/.eslintrc
at Function.Module._resolveFilename (module.js:327:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at loadPackage (/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:168:16)
at loadConfigFile (/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:212:18)
at load (/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:385:18)
at /Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:326:36
at Array.reduceRight (native)
at applyExtends (/Users/ebaer/.nvm/versions/node/v5.2.0/lib/node_modules/eslint/lib/config/config-file.js:309:28)
Workarounds:
- Run the version of eslint inside your project’s
node_modules
:./node_modules/.bin/eslint .
- Use npm scripts since they automatically check local node_modules first:
npm run lint
scripts: {
"lint": "eslint ."
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
How to install ESlint globally? - Stack Overflow
You can install Node modules within the project (locally) or globally. To switch to globally, you may use the -g flag, like so:...
Read more >Getting Started with ESLint - Pluggable JavaScript Linter
ESLint will not lint your code unless you extend from a shared configuration or explicitly turn rules on in your configuration. Global Install....
Read more >eslint/eslint - Gitter
The problem is that eslint fails to resolve the plugins, which are all installed ... A globally-installed ESLint cannot find a locally-installed plugin....
Read more >eslint-plugin-react - npm
It is also possible to install ESLint globally rather than locally (using npm install eslint --global). However, this is not recommended, ...
Read more >Setting Up ESLint Globally - Tracy Lum
The folks at ESLint recommned a local setup in general, but heck, I work on a lot of JavaScript, and I don't always...
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 Free
Top 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
try this npm install --save eslint-config-defaults
Yes, it’s still a problem