Expected a 'break' statement before 'case'
98 break;
99 case 'vote':
100 sendVoteLinks(interaction);
101 case 'votes':102 showTopVotersInteraction({103 interaction,104 client: args.interaction.client105 });106 break;107 case 'mama':
108 //await mamaAwards2021Interaction(interaction)
109 await interaction.reply('The 2022 Mama Awards Votes have ended. Come back next year!')
Description
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.
Bad Practice
switch(foo) {
case 1: doSomething();
case 2: doSomethingElse();
}
Recommended
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();
}