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.VariableDeclarators insufficient for different scenarios #5492
Comments
Hi @ffxsam, thanks for the issue. It looks like there's not enough information for us to know how to help you. If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions. If it's something else, please just provide as much additional information as possible. Thanks! |
Version 2.2.0. |
Can you also provide
|
Sure. Here's the code. Line 25 is the first line:
My .eslintrc is set to:
I get the following errors:
If I modify the indent settings by commenting out VariableDeclarator:
Then I get this:
There needs to be separate considerations for indenting/aligning variable names, and indenting braces/brackets. |
I've been grappling with this problem over the past week, including with ESLint 2.3.0. It "fixes" this code with excessive indentation:
|
Yep. Exactly why I think that
But not braces, brackets, parens, and other non-alpha syntax:
|
I don't think that's exactly right; you still want:
The offending logic seems to be: Line 448 in bb8f470
I'm trying to figure out what this line is supposed to do. |
Ok, I have a PR ready for review: #5509 |
Fix: overindent in VariableDeclarator parens or brackets (fixes #5492)
Docs: Minor README clarifications Fixable rules are mostly limited to whitespace fixes; indicate no-reserved-keys replacement as quote-props Fix: overindent in VariableDeclarator parens or brackets (fixes eslint#5492) Docs: no-lone-blocks - show non-problematic (and problematic) label Docs: Rearrange rules for better categories (and improve rule summaries) Fix: handle personal package.json without config (fixes eslint#5496) Docs: fix func-style arrow exception option
I ran into a problem just now, with this code:
No matter how I set
VariableDeclarators
, I can't win. :) Either it complains about the alignment of variablesa
andb
, or if I adjust for that, it complains about the curly braces.IMO, and according to how I interpret the documentation,
VariableDeclarators
should only be concerned with indentation of variable names, not indentation of other syntax such as brackets and braces. In other words, the code above should be totally valid given this setting:The text was updated successfully, but these errors were encountered: