← All tasks
javascripteslint/eslint #1238Not a task: not reproduced

Plugins fail to load when eslint is installed globally

envgap__eslint__eslint-1238

Original GitHub issue ↗Opened 2014-09-09

01 / FAILURE SIGNATURE

As reported upstream

Error: Cannot find module 'eslint-plugin-no-exclusive-tests'
Not a benchmark task.
  • No curated issue-specific recipe or verified environment fix is available.

02 / ENVIRONMENT RECIPE

Base commit
Not freshly verified
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

eslint/eslint #1238 · read the original issue
I've authored a plugin [eslint-no-exclusive-tests](https://github.com/tlvince/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:

``` shell
❯ 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](http://eslint.org/docs/developer-guide/working-with-plugins.html) say to add eslint as a peerDependency, it gets installed locally to the project. If using the local eslint, the plugin runs as expected:

``` shell
❯ ./node_modules/.bin/eslint spec.js

spec.js
   3:0   error  Unexpected ddescribe                       no-exclusive-tests/no-exclusive-tests
```

`package.json`:

``` json
...
  "devDependencies": {
    "eslint": "^0.8.0",
    "eslint-plugin-no-exclusive-tests": "^0.2.0"
...
```

`.eslintrc`

``` yaml
plugins:
  - no-exclusive-tests
rules:
  no-exclusive-tests/no-exclusive-tests: 2
```
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]

Issue-specific recipe and runtime smoke command require review against the complete issue and repository.

Legacy reproduction is generic install-only; match the actual issue failure before admission.