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
}
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.
You might want to change your eslint config now that 1.0.0 has been released:
"indent": [2, 2, {"SwitchCase": 1}],
+1 we use extends: "airbnb" and would like "indent": [2, 2, {"SwitchCase": 1}] to be in eslint-config-airbnb.
+1
fwiw I agree that if it's here, the first example (https://github.com/airbnb/javascript/issues/296#issuecomment-91070293) should be the one enforced by the config - however, I'd prefer to ban switch altogether :-) although that should be a different discussion.
Most helpful comment
You might want to change your eslint config now that 1.0.0 has been released:
"indent": [2, 2, {"SwitchCase": 1}],