💼 This rule is enabled in the ✅ recommended
config.
💡 This rule is manually fixable by editor suggestions.
An empty case before the last default case is useless.
switch (foo) {
case 1:
default:
handleDefaultCase();
break;
}
switch (foo) {
case 1:
case 2:
handleCase1And2();
break;
}
switch (foo) {
case 1:
handleCase1();
break;
default:
handleDefaultCase();
break;
}
switch (foo) {
case 1:
handleCase1();
// Fallthrough
default:
handleDefaultCase();
break;
}
switch (foo) {
// This is actually useless, but we only check cases where the last case is the `default` case
case 1:
default:
handleDefaultCase();
break;
case 2:
handleCase2();
break;
}