`eslint --init` with airbnb config doesn't install all necessary peerDependencies
See original GitHub issueWhat version of ESLint are you using? 3.2.2
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Was automatically generated by eslint --init
command (See raw output in the end):
module.exports = {
"extends": "airbnb",
"plugins": [
"react"
]
};
What did you do? Please include the actual source code causing the issue.
I called eslint --init
from the command line. See raw output in the end
What did you expect to happen?
I expected eslint --init
to install everything needed for the AirBnB style guide after I selected that I wanted to follow that style guide.
What actually happened? Please include the actual, raw output from ESLint.
Two dependencies were missing for eslint-config-airbnb
to run properly, eslint-plugin-import
and eslint-plugin-jsx-a11y
.
Full output starting from a fresh eslint --init
call:
~/Workspace/test_eslint_init$ node_modules/.bin/eslint --init
? How would you like to configure ESLint? Use a popular style guide
? Which style guide do you want to follow? AirBnB
? What format do you want your config file to be in? JavaScript
Installing eslint-plugin-react, eslint-config-airbnb
test_eslint_init@1.0.0 /Users/vitorbalocco/Workspace/test_eslint_init
├─┬ eslint-config-airbnb@10.0.0
│ ├── eslint-config-airbnb-base@5.0.1
│ └── UNMET PEER DEPENDENCY eslint-plugin-import@^1.12.0
├── UNMET PEER DEPENDENCY eslint-plugin-import@^1.12.0
├── UNMET PEER DEPENDENCY eslint-plugin-jsx-a11y@^2.0.1
└─┬ eslint-plugin-react@6.0.0
└── jsx-ast-utils@1.3.1
npm WARN eslint-config-airbnb@10.0.0 requires a peer of eslint-plugin-jsx-a11y@^2.0.1 but none was installed.
npm WARN eslint-config-airbnb@10.0.0 requires a peer of eslint-plugin-import@^1.12.0 but none was installed.
npm WARN eslint-config-airbnb-base@5.0.1 requires a peer of eslint-plugin-import@^1.12.0 but none was installed.
npm WARN test_eslint_init@1.0.0 No description
npm WARN test_eslint_init@1.0.0 No repository field.
Successfully created .eslintrc.js file in /Users/vitorbalocco/Workspace/test_eslint_init
~/Workspace/test_eslint_init$
~/Workspace/test_eslint_init$ touch test.js
~/Workspace/test_eslint_init$ node_modules/.bin/eslint test.js
Oops! Something went wrong! :(
ESLint couldn't find the plugin "eslint-plugin-jsx-a11y". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-jsx-a11y 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-jsx-a11y@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.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
I don’t really think that extracting it to JSON file is going to help any. It’s already trivial to add dependencies to the init command, since it just requires adding additional string to an array. (see https://github.com/eslint/eslint/pull/6657/files#diff-da527c6839c0e6e4d343b5c77fcdd27cR281)
Looking ahead a bit, I wonder if we could extract some of that information to a configurable JSON file to make maintenance a bit easier?
I’m not advocating doing that for this issue-- just thinking it might be a worthwhile refactor later on.