ESLint fails to find plugin in node_modules folder
See original GitHub issueTell us about your environment
- ESLint Version: 3.11.0
- Node Version: 4.6.0
- npm Version: 2.15.11
What parser (default, Babel-ESLint, etc.) are you using?
Default parser through the command line - also experienced it through the atom plugin linter-eslint
Please show your full configuration:
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
extends: [
'eslint:recommended',
'plugin:ember-suave/recommended'
],
env: {
browser: true
},
rules: {
indent: ['error', 4],
'space-before-function-paren': ['error', {anonymous: 'ignore', named: 'never'}],
'object-curly-spacing': ['error', 'never'],
'array-bracket-spacing': ['error', 'never'],
'key-spacing': ['error', {mode: 'minimum'}],
'keyword-spacing': ['error', {overrides: {
'catch': {'after': true}
}}],
'ember-suave/require-access-in-comments': 'off'
},
globals: {
moment: false,
validator: false
}
};
What did you do? Please include the actual source code causing the issue.
Source code: master branch of https://github.com/TryGhost/Ghost-Admin
Steps to reproduce:
- clone the repo
npm install
(verify that the eslint-plugin-ember-suave is installed into node_modules)eslint app
What did you expect to happen? I expected ESLint to run.
What actually happened? Please include the actual, raw output from ESLint. Raw error output:
Cannot find module 'eslint-plugin-ember-suave'
Referenced from: /Users/acburdine/Sites/Ghost/eslint-bug-test/Ghost-Admin/.eslintrc.js
Error: Cannot find module 'eslint-plugin-ember-suave'
Referenced from: /Users/acburdine/Sites/Ghost/eslint-bug-test/Ghost-Admin/.eslintrc.js
at Object.resolve (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/util/module-resolver.js:74:19)
at resolve (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:473:33)
at load (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:495:26)
at /Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:391:36
at Array.reduceRight (native)
at applyExtends (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:362:28)
at Object.load (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:529:22)
at loadConfig (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config.js:63:33)
at getLocalConfig (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config.js:130:29)
at Config.options.env.globals.Config.getConfig (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config.js:256:22)
Additional Information:
I also experienced the same issue with https://github.com/jgwhite/ember-sortable (after adding the same config). Initially I thought this was because both depended indirectly on eslint
through ember-cli-eslint
, and that does fix the issue with atom-linter, but I think the issue is related to node’s resolution process.
Potential related issue: #7083
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (14 by maintainers)
Top GitHub Comments
I would be in favor of using the JSCS/grunt/gulp approach of having the global installation defer to the local installation if it exists. We can always have a
--use-global-eslint
option or something if people want to override the behavior.Not only JSCS, but others tools as well, from top of my head – grunt/gulp maybe even jshint.
Worked as charm and you know, doing
./node_modules/.bin/eslint
is kinda ugly