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

Change in behavior of 'indent' rule in 4.18.0 #9995

Assignees
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 indent Relates to the `indent` rule rule Relates to ESLint's core rules

Comments

@zbjornson
Copy link

Tell us about your environment

  • ESLint Version: 4.18.0
  • Node Version: 8.9.4
  • npm Version: 5.5.1

What parser (default, Babel-ESLint, etc.) are you using?
default with ecmaVersion: 8

Please show your full configuration:

Configuration
extends:
  - eslint:recommended
parserOptions:
  ecmaVersion: 8
rules:
  indent:
    - error
    - tab

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

This was valid in 4.17.0:

function baz2() {
	return true &&
		![].some(g => {
			return true;
		});
}

but 4.18.0 wants it formatted like:

function baz2() {
	return true &&
		![].some(g => {
		return true;
	});
}

This only happens if there's a ! in front of the [].some bit.

eslint file.js

What did you expect to happen?
Same behavior as 4.17.0, per above.

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

  4:1   error  Expected indentation of 2 tabs but found 3  indent
  5:1   error  Expected indentation of 1 tab but found 2   indent
@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Feb 20, 2018
@not-an-aardvark not-an-aardvark added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion indent Relates to the `indent` rule and removed triage An ESLint team member will look at this issue soon labels Feb 20, 2018
@not-an-aardvark
Copy link
Member

Thanks for the report, I can reproduce this issue.

@not-an-aardvark not-an-aardvark self-assigned this Mar 3, 2018
not-an-aardvark added a commit that referenced this issue Mar 3, 2018
This updates the `indent` rule to ensure that the tokens in a non-ignored node are always indented at least as much as the first token of the node. This fixes an issue where some tokens would not have enough indentation if their node's listener did not explicitly give them an offset.
This was referenced Mar 22, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Sep 3, 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 Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.