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

[v4] indent: False positive with multi-line parenthesized function calls #8790

Closed
nwoltman opened this issue Jun 23, 2017 · 1 comment · Fixed by homezen/eslint-config-homezen#43
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

@nwoltman
Copy link
Contributor

nwoltman commented Jun 23, 2017

Tell us about your environment

  • ESLint Version: 4.1.0
  • Node Version: 7.10.0
  • npm Version: 4.2.0

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

{
  "root": true,
  "parserOptions": {
    "ecmaVersion": 2017
  },
  "rules": {
    "indent": ["error", 2, {
      "SwitchCase": 1,
      "MemberExpression": 1,
      "FunctionDeclaration": {"parameters": 1},
      "FunctionExpression": {"parameters": 1},
      "CallExpression": {"arguments": 1}
    }]
  }
}

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

const str = (obj =>
  Object.keys(obj).join('')
)({
  k: 'v',
});

What did you expect to happen?

No errors

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

4:1  error  Expected indentation of 4 spaces but found 2  indent
5:1  error  Expected indentation of 2 spaces but found 0  indent

The problem seems like it's being caused by the indentation of the arrow function.
If I use a normal function:

const str = (function(obj) {
  return Object.keys(obj).join('')
})({
  k: 'v',
});

there are no errors.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jun 23, 2017
@nwoltman nwoltman changed the title [4.0] indent: Incorrect expected indentation with multi-line arrow iffe [v4] indent: False positive with multi-line arrow iffe Jun 24, 2017
@not-an-aardvark
Copy link
Member

Thanks for reporting, I can reproduce this issue.

@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 Jun 25, 2017
@not-an-aardvark not-an-aardvark changed the title [v4] indent: False positive with multi-line arrow iffe [v4] indent: False positive with multi-line parenthesized function calls Jun 25, 2017
not-an-aardvark added a commit that referenced this issue Jun 25, 2017
This fixes a bug in the `indent` rule where the arguments of a call expression were aligned offset the last token of the callee, even when the callee was parenthesized. Instead, the rule should offset from the closing paren in those cases.
@not-an-aardvark not-an-aardvark self-assigned this Jun 25, 2017
@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

Successfully merging a pull request may close this issue.

3 participants