Global ESLint does not resolve local dependencies of a module defined in extends
See original GitHub issueWhat version of ESLint are you using?
v2.9.0
What parser (default, Babel-ESLint, etc.) are you using?
N/A
Please show your full configuration: What did you do? Please include the actual source code causing the issue. What did you expect to happen? What actually happened? Please include the actual, raw output from ESLint.
Using module path with local install
npm install eslint
npm install eslint-config-canonical
echo '{ "extends": "./node_modules/eslint-config-canonical/eslintrc.json" }' > .eslintrc
node ./node_modules/.bin/eslint ./src
Works as expected (produces linting report for files contained in ./src
).
Using module name with local install
npm install eslint
npm install eslint-config-canonical
echo '{ "extends": "eslint-config-canonical" }' > .eslintrc
node ./node_modules/.bin/eslint ./src
Works as expected (produces linting report for files contained in ./src
).
Using module path with global install
npm install eslint
npm install eslint-config-canonical
echo '{ "extends": "eslint-config-canonical" }' > .eslintrc
/Users/gajus/.nvm/versions/node/v6.1.0/bin/eslint ./src
Cannot find dependency of eslint-config-canonical
:
Oops! Something went wrong! :(
ESLint couldn't find the plugin "eslint-plugin-no-use-extend-native". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-no-use-extend-native 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-no-use-extend-native@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.
Expected result:
Lint code using eslint-config-canonical
and its dependencies.
Using module name with global install
npm install eslint
npm install eslint-config-canonical
echo '{ "extends": "eslint-config-canonical" }' > .eslintrc
/Users/gajus/.nvm/versions/node/v6.1.0/bin/eslint ./src
Complain that module “eslint-config-canonical” is not found:
Cannot find module 'eslint-config-canonical'
Referenced from: /Users/gajus/Documents/dev/applaudience/forward-proxy/.eslintrc
Error: Cannot find module 'eslint-config-canonical'
Referenced from: /Users/gajus/Documents/dev/applaudience/forward-proxy/.eslintrc
at Object.ModuleResolver.resolve (/Users/gajus/.nvm/versions/node/v6.1.0/lib/node_modules/eslint/lib/util/module-resolver.js:75:19)
at resolve (/Users/gajus/.nvm/versions/node/v6.1.0/lib/node_modules/eslint/lib/config/config-file.js:473:33)
at load (/Users/gajus/.nvm/versions/node/v6.1.0/lib/node_modules/eslint/lib/config/config-file.js:490:24)
at /Users/gajus/.nvm/versions/node/v6.1.0/lib/node_modules/eslint/lib/config/config-file.js:386:36
at Array.reduceRight (native)
at applyExtends (/Users/gajus/.nvm/versions/node/v6.1.0/lib/node_modules/eslint/lib/config/config-file.js:363:28)
at Object.load (/Users/gajus/.nvm/versions/node/v6.1.0/lib/node_modules/eslint/lib/config/config-file.js:525:22)
at loadConfig (/Users/gajus/.nvm/versions/node/v6.1.0/lib/node_modules/eslint/lib/config.js:64:33)
at getLocalConfig (/Users/gajus/.nvm/versio%
Expected result:
Lint code using eslint-config-canonical
and its dependencies.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Using eslint with typescript - Unable to resolve path to module
I had the same problem and I was only able to fix it by adding the typescript plugin to .eslintrc , using the...
Read more >Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Shareable Configs - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Working with Plugins - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >no-restricted-imports - ESLint - Pluggable JavaScript Linter
Imports are an ES6/ES2015 standard for making the functionality of other modules available in your current module. In CommonJS this is implemented through ......
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
Also possibly of interest to you: https://github.com/mysticatea/eslint-cli
Appreciate you filling us in, @nzakas. I’m going to go ahead and close this. Thanks for the issue, @gajus.