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

Suggestion to add switch #296

Closed
ButuzGOL opened this issue Apr 8, 2015 · 5 comments
Closed

Suggestion to add switch #296

ButuzGOL opened this issue Apr 8, 2015 · 5 comments

Comments

@ButuzGOL
Copy link

ButuzGOL commented Apr 8, 2015

Does it make sense to add switch
Because it's not clear add spaces before case or not

switch (expression) {
  case expression:
    statements
    break;
  default:
    statements
}

Or

switch (expression) {
case expression:
  statements
  break;
default:
  statements
}
@nkbt
Copy link

nkbt commented Apr 8, 2015

Because you have indentation of 2 spaces and you do indentation after each { + new line, it becomes quite clear you should do.

switch (expression) {
  case expression:
    statements
    break;
  default:
    statements
}

But yeah, could be mentioned because for some reasons autoformatters allow you not to indent case in switch, which is really weird case.

@kevinrenskers
Copy link

You might want to change your eslint config now that 1.0.0 has been released:

"indent": [2, 2, {"SwitchCase": 1}],

@turadg
Copy link

turadg commented Aug 6, 2015

+1 we use extends: "airbnb" and would like "indent": [2, 2, {"SwitchCase": 1}] to be in eslint-config-airbnb.

@ljharb
Copy link
Collaborator

ljharb commented Oct 9, 2015

fwiw I agree that if it's here, the first example (#296 (comment)) should be the one enforced by the config - however, I'd prefer to ban switch altogether :-) although that should be a different discussion.

@postmeback
Copy link

If the PR serves the purpose, then shall we close it ?

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

No branches or pull requests

7 participants