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

'indent' rule confused by extra parentheses #8924

Closed
edg2s opened this issue Jul 11, 2017 · 1 comment
Closed

'indent' rule confused by extra parentheses #8924

edg2s opened this issue Jul 11, 2017 · 1 comment
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

@edg2s
Copy link
Contributor

edg2s commented Jul 11, 2017

Tell us about your environment

  • ESLint Version: whatever the web demo uses: http://eslint.org/demo/
  • Node Version: see above
  • npm Version: see above

What parser (default, Babel-ESLint, etc.) are you using?
see above
Please show your full configuration:
http://eslint.org/demo/ with 'indent' checked

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

var $template = (
    $( 'div' )
        .foo()
        .bar()
);

What did you expect to happen?
'indent' rule should not be triggered, and indeed without the extra parentheses it isn't:

var $template =
    $( 'div' )
        .foo()
        .bar();

What actually happened? Please include the actual, raw output from ESLint.
Complained about indentation of .foo and .bar and de-indent one step:

3:1 - Expected indentation of 4 spaces but found 8. (indent)
4:1 - Expected indentation of 4 spaces but found 8. (indent)
// Fixed Code
var $template = (
    $( 'div' )
    .foo()
    .bar()
);
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jul 11, 2017
@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly indent Relates to the `indent` rule rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Jul 11, 2017
@not-an-aardvark not-an-aardvark self-assigned this Jul 11, 2017
@not-an-aardvark
Copy link
Member

Thanks for reporting, I can reproduce this issue.

Simplified example:

/* eslint indent:error*/
(
    foo
        .bar
)

not-an-aardvark added a commit that referenced this issue Jul 12, 2017
The MemberExpression listener in `indent` contains some logic to ensure that if the object of a MemberExpression is wrapped in parentheses, the property is offset from the opening paren, not the object itself. Due to a bug, this logic also caused the property to be offset from the opening paren if the entire MemberExpression was wrapped in parentheses, raather than just the object. This commit updates the MemberExpression listener to specifically check for parentheses around the object, not the entire MemberExpression.
@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 indent Relates to the `indent` rule rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants