switch-case-break-position
March 27, 2026 Β· View on GitHub
π Enforce consistent break/return/continue/throw position in case clauses.
πΌπ« This rule is enabled in the β
recommended config. This rule is disabled in the βοΈ unopinionated config.
π§ This rule is automatically fixable by the --fix CLI option.
Enforce that terminating statements (break, return, continue, throw) appear inside the block statement of a case clause, not after it.
This can happen when refactoring β for example, removing an if wrapper but leaving the break outside the braces.
break and continue are auto-fixed. return and throw are still reported, but are left for manual fixes because moving them into the block can change lexical binding resolution.
Examples
// β
switch(foo) {
case 1: {
doStuff();
}
break;
}
// β
switch(foo) {
case 1: {
doStuff();
break;
}
}