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

Comments

@zbjornson
Copy link

@zbjornson zbjornson commented Feb 20, 2018

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 eslint bot added the triage label Feb 20, 2018
@not-an-aardvark
Copy link
Member

@not-an-aardvark not-an-aardvark commented Feb 20, 2018

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 eslint bot locked and limited conversation to collaborators Sep 3, 2018
@eslint eslint bot added the archived due to age label Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.