case
statements found JS-006417 debug('Port is already in use.');
18 process.exit(1);
19 }
20 default: {21 throw error;22 }23 }
24}
25function onListening(server) {
13 debug('Requires elevated privileges');
14 process.exit(1);
15 }
16 case 'EADDRINUSE': {17 debug('Port is already in use.');18 process.exit(1);19 }20 default: {
21 throw error;
22 }
If the fallthrough is intentional in the code, there is no way to indicate this intent in the language.
It's considered a best practice to always indicate when a fallthrough is intentional using a comment which matches the /falls?\s?through/i
regular expression.
switch(foo) {
case 1: doSomething();
case 2: doSomethingElse();
}
switch(foo) {
case 1:
doSomething();
break;
case 2:
doSomethingElse();
}
function bar(foo) {
switch(foo) {
case 1:
doSomething();
return;
case 2:
doSomething();
}
}
switch(foo) {
case 1:
doSomething();
throw new Error("Boo!");
case 2:
doSomething();
}
switch(foo) {
case 1:
case 2:
doSomething();
}
switch(foo) {
case 1:
doSomething();
// falls through
case 2:
doSomething();
}