Bug 1391699 - Disallow fallthrough case statements. r?automatedtester
We recently had a serious bug in Marionette (https://bugzil.la/1254136)
due to a case statement that fell through due to a missing "break"
statement. This patch introduces a lint rule to prevent similar episodes
in the future.
When you do want a case to fall through, it is possible to add a comment
like this:
switch (foo) {
case 1:
doSomething();
// fall through
case 2:
doSomething();
break;
}
MozReview-Commit-ID: Gu8cFGsdne2
--- a/testing/marionette/.eslintrc.js
+++ b/testing/marionette/.eslintrc.js
@@ -8,14 +8,15 @@ module.exports = {
"FunctionExpression": {"body": 1, "parameters": 2},
"MemberExpression": 2,
"SwitchCase": 1,
}],
"max-len": ["error", 78, {
"ignoreStrings": true,
"ignoreUrls": true,
}],
+ "no-fallthrough": "error",
"no-new-object": "error",
"no-undef-init": "error",
"object-curly-spacing": ["error", "never"],
"semi": "error",
}
};