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

Allow ternary as an arrow function body #9

Open
ckknight opened this issue Jun 25, 2019 · 0 comments
Open

Allow ternary as an arrow function body #9

ckknight opened this issue Jun 25, 2019 · 0 comments

Comments

@ckknight
Copy link

I'd like to be able to configure this plugin such that:

Bad:

const arrow = () => {
  return a ? b : c; // error because it's a return statement
};

function fn() {
  return a ? b : c;
}

Good:

const arrow = () => a ? b : c;

const arrowWithReturn = () => {
  if (a) {
    return b;
  } else {
    return c;
  }
};

function fn() {
  if (a) {
    return b;
  } else {
    return c;
  }
}

I can get almost there with the @getify/proper-ternary/where rule, except that I don't want () => a ? b : c to be an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant