caseFallthroughs
Reports switch case clauses that fall through unexpectedly.
✅ This rule is included in the ts logical presets.
The switch statement in JavaScript allows “fallthrough” from one case to the next, which is often unintentional and can lead to bugs.
This rule reports cases that fall through to the next case without a break, return, throw, or continue statement.
Empty case clauses are allowed to fall through, as this is a common pattern for grouping multiple cases. Intentional fallthrough can be indicated with a comment containing “falls through” (case-insensitive).
Examples
Section titled “Examples”switch (value) { case 1: doSomething(); case 2: doSomethingElse(); break;}switch (value) { case 1: if (condition) { break; } case 2: break;}switch (value) { case 1: doSomething(); break; case 2: doSomethingElse(); break;}switch (value) { case 1: case 2: doSomething(); break;}switch (value) { case 1: doSomething(); // falls through case 2: doSomethingElse(); break;}switch (value) { case 1: return first(); case 2: return second();}Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you rely heavily on intentional fallthrough in switch statements and prefer not to add comments, you may disable this rule. Some legacy codebases may use fallthrough patterns that would require extensive refactoring.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noFallthroughSwitchClause - Deno:
no-fallthrough - ESLint:
no-fallthrough - Oxlint:
eslint/no-fallthrough