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

operator-linebreak Changes #39

Open
BradMcGonigle opened this issue Mar 2, 2018 · 0 comments
Open

operator-linebreak Changes #39

BradMcGonigle opened this issue Mar 2, 2018 · 0 comments

Comments

@BradMcGonigle
Copy link

BradMcGonigle commented Mar 2, 2018

After some discussion in Slack, it seems like most of us agree that having operator-linebreak set to before is not ideal in at least some cases.

Some like before for:

foo = 1
    + 2;

but not for

{
  foo
  && bar.map(var => (
    <Component />
  ))
}

or

if (someCondition
    || otherCondition) {
}

We could use after but there are cases where some seem not like that either.

answer = everything ?
  42 :
  foo;

versus what some prefer

answer = everything
  ? 42
  : foo;

The answer might be some customization using none and overrides

I'm thinking the rule might look like:

/*eslint operator-linebreak: ["error", "before", { "overrides": { "&&": "after", "||": "after" }}]*/

What other overrides would we want?

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