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-body-style autofix errors with sequence expression #11917

mdjermanovic opened this issue Jun 28, 2019 · 2 comments


Copy link

commented Jun 28, 2019

Tell us about your environment

  • ESLint Version: 6.0.1 (same with 5.16.0)
  • Node Version: 10.16.0
  • npm Version: 6.9.0

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


Please show your full configuration:

module.exports = {
  parserOptions: {
    ecmaVersion: 6,
  rules: {
    "arrow-body-style": "error",

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

First example:

const foo = () => { return bar, baz; };

Second example:

const a = 1;
if (true) {
  let foo = () => { return bar, a; };
  console.log(a); // 1
eslint index.js --fix

What did you expect to happen?

Not a syntax error or changed semantics.

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

const foo = () => bar, baz; // SyntaxError: Missing initializer in const declaration
const a = 1;
if (true) {
  let foo = () => bar, a;
  console.log(a); // undefined

Are you willing to submit a pull request to fix this bug?



This comment has been minimized.

Copy link

commented Jun 28, 2019

Should we add parens at this case?

@mysticatea mysticatea added accepted rule and removed triage labels Jun 28, 2019


This comment has been minimized.

Copy link

commented Jun 28, 2019

Thank you for your report.

I confirmed it: online demo

I agree that we should parenthesize the body in that case as same as () => { return { bar, baz }; } case.

g-plane added a commit that referenced this issue Jun 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.