case
statements found JS-006445 // skipcq: JS-0002
46 console.error(`${bind} is already in use`)
47 process.exit(1)
48 default:49 throw error50 }
51}
52function onListening() {
41 // skipcq: JS-0002
42 console.error(`${bind} requires elevated privileges`)
43 process.exit(1)
44 case 'EADDRINUSE':45 // skipcq: JS-000246 console.error(`${bind} is already in use`)47 process.exit(1)48 default:
49 throw error
50 }
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();
}