Rule: switch-default

Require a default case in all switch statements.

Config

Not configurable.

Config examples
"switch-default": true
Schema
null

Code examples:

Requires a `default` case in `switch` statements.
"rules": { "switch-default": true }
Passes
let foo: number = 1;
switch (foo) {
    case 1:
        doSomething();
        break;
    case 2:
        doSomething2();
        break;
    default:
        console.log('default');
}
Fails
let foo: number = 1;
switch (foo) {
    case 1:
        doSomething();
        break;
    case 2:
        doSomething2();
}