standard / standard

🌟 JavaScript Style Guide, with linter & automatic code fixer
https://standardjs.com
MIT License
29.07k stars 2.33k forks source link

Global standard doesn't find global babel-eslint since version 13 #1328

Open tsujigiri opened 5 years ago

tsujigiri commented 5 years ago

What version of standard? 13.0.1 What operating system, Node.js, and npm version? Arch Linux (locally) and Docker image circleci/ruby:2.5.3-node-browsers. Node: 11.15.0 npm: 6.10.0 babel-eslint: 10.0.2 What did you expect to happen? npm install -g standard babel-eslint to install compatible versions of both. What actually happened? Running standard --parser babel-eslint [files] throws an error:

standard: Unexpected linter output:

Error: Failed to load parser 'babel-eslint' declared in 'CLIOptions': Cannot find module 'babel-eslint'
Require stack:
- /home/helge/code/combostrike/backoffice/__placeholder__.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.resolve (internal/modules/cjs/helpers.js:19:19)
    at Object.resolve (/home/helge/.node_modules/lib/node_modules/standard/node_modules/eslint/lib/shared/relative-module-resolver.js:44:50)
    at ConfigArrayFactory._loadParser (/home/helge/.node_modules/lib/node_modules/standard/node_modules/eslint/lib/cli-engine/config-array-factory.js:752:45)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/home/helge/.node_modules/lib/node_modules/standard/node_modules/eslint/lib/cli-engine/config-array-factory.js:550:32)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/home/helge/.node_modules/lib/node_modules/standard/node_modules/eslint/lib/cli-engine/config-array-factory.js:491:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at createConfigArray (/home/helge/.node_modules/lib/node_modules/standard/node_modules/eslint/lib/cli-engine/config-array-factory.js:307:25)
    at ConfigArrayFactory.create (/home/helge/.node_modules/lib/node_modules/standard/node_modules/eslint/lib/cli-engine/config-array-factory.js:362:16)

If you think this is a bug in `standard`, open an issue: https://github.com/standard/standard/issues

Workaround Installing standard version <13 works fine.

Edit: Added the name of the Docker image we use in our CI.

feross commented 5 years ago

Thanks for the issue. There is a bug right now where standard doesn't work when installed globally. Looking into it now.

feross commented 5 years ago

This should be fixed in standard 13.0.2.

tsujigiri commented 5 years ago

Unfortunately, I still get the same error, on CI and locally. 😬

feross commented 5 years ago

ESLint 6 changed the way that parsers and plugins are resolved. They must now be installed locally in your project, even if standard is installed globally. It's an unfortunate change.

feross commented 5 years ago

This may be fixed if we adopt the babel-eslint parser by default as I proposed in https://github.com/standard/standard/issues/1356