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 treats nested function parameters incorrectly #8892
Comments
Thanks for reporting, I can reproduce this issue. |
Previously, the `indent` rule would only offset the first token of an element in a list (e.g. an array). However, this was incorrect because the other tokens of the element might not depend on the indentatio nof the first token. For example, in a function expression, the indentation of the parens does not depend on the indentation of the `function` token. This commit updates the `indent` rule to correctly offset all of the tokens in the element.
@not-an-aardvark I tried 4.2.0 and the issue isn't really fixed. The example I had above now passes, but if I change the So changing from |
I think you want the If it still isn't working after that, please open a new issue. |
Oh, I see. Using |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
/*eslint indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 1} }]*/
What did you do? Please include the actual source code causing the issue.
I ran ESlint to check for validation issues.
What did you expect to happen?
I expected no validation issues.
What actually happened? Please include the actual, raw output from ESLint.
It gave me validation errors:
If I run
--fix
it ends up looking like this, which to me is double the function parameter spacing that I want (it has 4 spaces instead of 2) and it adds 2 spaces before) {
.Note
Running without the
define
as a simple method works as expected from the documentation examples. I.e. this works as expected (no validation issues):The text was updated successfully, but these errors were encountered: