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.

ESLint Bug: extended config does not work with globally installed eslint

See original GitHub issue

When 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:open
  • Created 8 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
j492commented, Nov 8, 2016

try this npm install --save eslint-config-defaults

9reactions
LordDelacroixcommented, Aug 19, 2016

Yes, it’s still a problem

Read more comments on GitHub >

github_iconTop 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 >

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