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;
	}
}