Plugins fail to load when eslint is installed globally
See original GitHub issueI’ve authored a plugin eslint-no-exclusive-tests that warns if certain Jasmine methods are used (ddescribe, iit
etc.)
When eslint is installed globally (as normal), a module loader error is thrown:
❯ eslint spec.js
module.js:340
throw err;
^
Error: Cannot find module 'eslint-plugin-no-exclusive-tests'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /usr/local/lib/node_modules/eslint/lib/cli-engine.js:122:26
at Array.forEach (native)
at loadPlugins (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:115:21)
at processFile (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:151:9)
at /usr/local/lib/node_modules/eslint/lib/cli-engine.js:222:30
at walk (/usr/local/lib/node_modules/eslint/lib/util/traverse.js:82:9)
As the docs say to add eslint as a peerDependency, it gets installed locally to the project. If using the local eslint, the plugin runs as expected:
❯ ./node_modules/.bin/eslint spec.js
spec.js
3:0 error Unexpected ddescribe no-exclusive-tests/no-exclusive-tests
package.json
:
...
"devDependencies": {
"eslint": "^0.8.0",
"eslint-plugin-no-exclusive-tests": "^0.2.0"
...
.eslintrc
plugins:
- no-exclusive-tests
rules:
no-exclusive-tests/no-exclusive-tests: 2
Issue Analytics
- State:
- Created 9 years ago
- Comments:38 (18 by maintainers)
Top Results From Across the Web
Failed to load plugin 'import' declared in '... » eslint-config ...
I've tried setting it up through eslint --init, uninstalling eslint globally and having all the packages locally, installing each package ...
Read more >Getting Started with ESLint - Pluggable JavaScript Linter
ESLint is completely pluggable, every single rule is a plugin and you can add ... It is also possible to install ESLint globally...
Read more >eslint/eslint - Gitter
If ESLint is installed globally, then make sure eslint-plugin-promise is also installed globally. A globally-installed ESLint cannot find a locally-installed ...
Read more >Error: Failed to load plugin declared in '.eslintrc' : WEB-44691
ESLint is installed globally. An ESLint plugin (for example 'eslint-plugin-fp') is also installed globally. In WebStorm preferences — manually configured ...
Read more >eslint-plugin-jest - npm
Installation. yarn add --dev eslint eslint-plugin-jest. Note: If you installed ESLint globally then you must also install eslint-plugin-jest ...
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
I’d like to recommend https://www.npmjs.com/package/eslint-cli
Hi all, I ran into this issue on vim with ‘syntastic’. Since I have to use local eslint, the following is my vim config:
Now the effect between vim and ‘npm run eslint’ is exactly the same.