Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint@4.1.1 --init installs eslint@3.19.0 #8870

Closed
btmills opened this issue Jul 3, 2017 · 9 comments · Fixed by #8911
Closed

eslint@4.1.1 --init installs eslint@3.19.0 #8870

btmills opened this issue Jul 3, 2017 · 9 comments · Fixed by #8911
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly cli Relates to ESLint's command-line interface

Comments

@btmills
Copy link
Member

btmills commented Jul 3, 2017

Originally reported on Stack Overflow.

Tell us about your environment

  • ESLint Version: 4.1.1
  • Node Version: 7.10.0
  • npm Version: 4.6.1

What parser (default, Babel-ESLint, etc.) are you using? n/a

Please show your full configuration: n/a

What did you do? Please include the actual source code causing the issue.

~$ mkdir test
~$ cd test
~/test$ echo '{ "private": true }' > package.json
~/test$ npm install --save-dev eslint
# ...
~/test$ node --version
v7.10.0
~/test$ npm --version
4.6.1
~/test$ node_modules/.bin/eslint --version
v4.1.1
~/test$ 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
? Do you use React? No
? What format do you want your config file to be in? JavaScript
Checking peerDependencies of eslint-config-airbnb-base
Installing eslint-config-airbnb-base@latest, eslint@^3.19.0, eslint-plugin-import@^2.2.0
# ...
Successfully created .eslintrc.js file in ~/test
~/test$ node_modules/.bin/eslint --version
v3.19.0

What did you expect to happen?

eslint@4.1.1 is still installed.

What actually happened? Please include the actual, raw output from ESLint.

eslint@3.19.0 is installed.

@btmills btmills added bug ESLint is working incorrectly cli Relates to ESLint's command-line interface evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 3, 2017
@not-an-aardvark
Copy link
Member

I think this is intended and was introduced in #8713. eslint-config-airbnb doesn't support ESLint 4.x, so eslint --init tries to install the right versions to make things work.

@maxlapides
Copy link

I am seeing a similar issue. When I install ESLint, I am always getting v3.19.0 of the CLI:

yarn remove eslint
yarn add eslint --dev
./node_modules/.bin/eslint -v
> v3.19.0

@maxlapides
Copy link

Okay I figured out that this was happening because one of my dependencies requires eslint 3. It's kind of unexpected that my dependency's required version of eslint would override the version required by the project itself, but perhaps I don't understand the complexities here.

@kaicataldo
Copy link
Member

@maxlapides A number of breaking changes were introduced on the plugin authoring side of things in ESLint v4. Installing ESLint v4 with a plugin that has not been updated yet could result in a broken installation, so the behavior you're seeing is intentional to ensure that everything works together.

@kaicataldo kaicataldo added works as intended The behavior described in this issue is working correctly and removed bug ESLint is working incorrectly cli Relates to ESLint's command-line interface evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 5, 2017
@nzakas
Copy link
Member

nzakas commented Jul 7, 2017

This still seems like a bug to me. It might be doing the right thing to make stuff work, but I don't think we should be installing a different version of ESLint during --init. I'd rather see an error message output.

@kaicataldo kaicataldo added bug ESLint is working incorrectly cli Relates to ESLint's command-line interface evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed works as intended The behavior described in this issue is working correctly labels Jul 7, 2017
@kaicataldo
Copy link
Member

Added back labels while we continue this discussion.

@mysticatea
Copy link
Member

OK, in that case, how about we add a question to confirm to install a different version of ESLint?

Preconditions: when package.json has a ESLint version that the chosen config does not support.

  ~/test$ 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
  ? Do you use React? No
+ ? The style guide Airbnb requires eslint@^3.19. Do you install it? Yes
  ? What format do you want your config file to be in? JavaScript
  Checking peerDependencies of eslint-config-airbnb-base
  Installing eslint-config-airbnb-base@latest, eslint@^3.19.0, eslint-plugin-import@^2.2.0
  # ...
  Successfully created .eslintrc.js file in ~/test

@nunofreitasbotelho
Copy link

Has anyone tried to upgrade the eslint after the whole config finishes? It would be like this:
Get -v 4.1.0
Asks for Airbnb Config? Y
Downgrades to -v 3.19.0
Upgrade to -v 4.1.0

@nzakas
Copy link
Member

nzakas commented Jul 9, 2017

@mysticatea I think we need to be more explicit:

The style guide Airbnb requires eslint@3.9.0. You are currently using eslint@4.1.0. Do you want to downgrade?

@mysticatea mysticatea added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 10, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly cli Relates to ESLint's command-line interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants