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 level (parameters: first) for async arrow functions #13497

Closed
pbadenski opened this issue Jul 16, 2020 · 2 comments · Fixed by #13544
Closed

Indent level (parameters: first) for async arrow functions #13497

pbadenski opened this issue Jul 16, 2020 · 2 comments · Fixed by #13544
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 rule Relates to ESLint's core rules

Comments

@pbadenski
Copy link

Probably the same as #10531 which was automatically closed due to inactivity 2 years ago.

Tell us about your environment

ESLint Version: 7.4.0
Node Version: 14.5.0
yarn Version: 1.22.4
What parser (default, Babel-ESLint, etc.) are you using? espree & @typescript-eslint/parser

Configuration

const indentOptions = {
  "FunctionDeclaration": { "parameters": "first" },
  "FunctionExpression": { "parameters": "first" },
};
const indent = ["error", 2, indentOptions];

module.exports = {
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: "module"
  },
  overrides: [
    {
      files: ["*.js"],
      parser: "espree",
      rules: {
        indent: indent
      }
    }
  ]
};

What did you do?

const foo = async (arg1,
                   arg2) =>
{
  return arg1 + arg2;
}

node_modules/.bin/eslint foo.js

What did you expect to happen?

Run without errors

What actually happened?

/private/tmp/foo/foo.js
  2:1  error  Expected indentation of 2 spaces but found 19  indent

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

Note: if I remove the async then the error goes away (the "parameters": "first" is honoured).

@pbadenski pbadenski added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jul 16, 2020
@anikethsaha
Copy link
Member

Thanks for the report 👍

I think this is a bug and I can reproduce this. demo

@anikethsaha anikethsaha removed the triage An ESLint team member will look at this issue soon label Jul 20, 2020
@mdjermanovic mdjermanovic added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules labels Jul 24, 2020
@yeonjuan
Copy link
Member

I agree 👍 It seems a bug to me

@anikethsaha anikethsaha added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Aug 2, 2020
anikethsaha added a commit to anikethsaha/eslint that referenced this issue Aug 2, 2020
aladdin-add pushed a commit that referenced this issue Aug 14, 2020
* Fix: indent for async arrow functions (fixes #13497)

* Update: addde open paren check and tests

* Chore: changed variable name to nextToken

* Chore: added tests with comments

* Chore: added one more test case

* Chore: simplified logic

* Chore: tests indentation

* Chore: fixed indentation of the test cases

* Chore: formatting for the test cases

* Chore: using descriptive skip options instead of number
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 11, 2021
@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 11, 2021
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 rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants