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

arrow-parens ("as-needed") doesn't take async into account #8682

Closed
jlsjonas opened this issue Jun 2, 2017 · 1 comment · Fixed by singapore/lint-condo#308, renovatebot/renovate#290 or homezen/hz-test-helpers#42
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 rule Relates to ESLint's core rules

Comments

@jlsjonas
Copy link

jlsjonas commented Jun 2, 2017

Tell us about your environment

  • ESLint Version: 3.19.0 (with the latest babel-eslint)
  • Node Version: 7.9.0
  • npm Version: 4.2.0

What parser (default, Babel-ESLint, etc.) are you using? babel-eslint (as eslint doesn't support async

Please show your full configuration:

final test with the following, still breaks:

{
  "root": true,
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 7,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "impliedStrict": true,
      "experimentalObjectRestSpread": true
    }
  },
  "env": {
    "browser": true,
    "mocha": true,
    "node": true,
    "es6": true
  },
  "globals": {
    "describe": false,
    "it": false
  },
  "rules": {
    "arrow-parens": [
      2,
      "as-needed"
    ]
  }
}

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

const foo = async(bar) => {
//...
}

What did you expect to happen?
fix to

const foo = async bar => {
//...
}```
(or just skip the line, would be fine too)

**What actually happened? Please include the actual, raw output from ESLint.**
```js
const foo = asyncbar => {
//...
}

as the async was no longer async (but asyncbar), causing the function to no longer be an async function

/path/to/foo.js
  24:25  error  Parsing error: await is a reserved word
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jun 2, 2017
@soda0289 soda0289 added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Jun 2, 2017
@soda0289
Copy link
Member

soda0289 commented Jun 2, 2017

Thanks for the report.

I can confirm this broken behavior. It should add a space.

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
3 participants