newline-between-switch-case
💼 This rule is enabled in the ✅ recommended
config.
Requires newlines between switch cases.
🔧 This rule is automatically fixable by the --fix
CLI option.
Having newlines between each case can make code easier to read, as it better delineates each block.
Based on this rule.
Rule Details​
This rule does not apply to "fall through" switch cases; those should be squished together with the other cases. See below for an example.
// Bad
switch (foo) {
case 1:
case 2:
case 3: {
doSomething();
break;
}
case 4: {
doSomething();
break;
}
}
// Good
switch (foo) {
case 1:
case 2:
case 3: {
doSomething();
break;
}
case 4: {
doSomething();
break;
}
}
Options​
This rule is not configurable.