Skip to content
Permalink
Browse files

Turn on no-fallthrough rule (#11093)

* chore: turn on no-fallthrough

* chore: fix no-fallthrough errors
  • Loading branch information
JLHwung committed Feb 7, 2020
1 parent 5e58903 commit 0b3dea8f549dd552e31b4a5988f61f0968f7628f
@@ -36,6 +36,7 @@ module.exports = function(api) {
case "standalone":
includeRegeneratorRuntime = true;
unambiguousSources.push("packages/babel-runtime/regenerator");
// fall through
case "rollup":
convertESM = false;
ignoreLib = false;
@@ -30,7 +30,6 @@ module.exports = {
"no-console": "off",
"no-constant-condition": "off",
"no-empty": "off",
"no-fallthrough": "off",
"no-inner-declarations": "off",
"no-labels": "off",
"no-loop-func": "off",
@@ -21,6 +21,7 @@ export default function* loadCjsOrMjsDefault(
} catch (e) {
if (e.code !== "ERR_REQUIRE_ESM") throw e;
}
// fall through
case "mjs":
if (yield* isAsync()) {
return yield* waitFor(loadMjsDefault(filepath));
@@ -1058,7 +1058,7 @@ export default class ExpressionParser extends LValParser {

case tt.at:
this.parseDecorators();

// fall through
case tt._class:
node = this.startNode();
this.takeDecorators(node);
@@ -1111,7 +1111,7 @@ export default class ExpressionParser extends LValParser {
return this.finishNode(node, "PipelinePrimaryTopicReference");
}
}

// fall through
default:
throw this.unexpected();
}
@@ -1441,7 +1441,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
);
}

this.unexpected();
throw this.unexpected();
case tt.num:
return this.parseLiteral(
this.state.value,
@@ -332,7 +332,7 @@ export default class Tokenizer extends LocationParser {
) {
++this.state.pos;
}

// fall through
case charCodes.lineFeed:
case charCodes.lineSeparator:
case charCodes.paragraphSeparator:
@@ -736,7 +736,7 @@ export default class Tokenizer extends LocationParser {
}
}
// Anything else beginning with a digit is an integer, octal
// number, or float.
// number, or float. (fall through)
case charCodes.digit1:
case charCodes.digit2:
case charCodes.digit3:
@@ -1221,6 +1221,7 @@ export default class Tokenizer extends LocationParser {
if (this.input.charCodeAt(this.state.pos) === charCodes.lineFeed) {
++this.state.pos;
}
// fall through
case charCodes.lineFeed:
out += "\n";
break;
@@ -1268,9 +1269,11 @@ export default class Tokenizer extends LocationParser {
if (this.input.charCodeAt(this.state.pos) === charCodes.lineFeed) {
++this.state.pos;
}
// fall through
case charCodes.lineFeed:
this.state.lineStart = this.state.pos;
++this.state.curLine;
// fall through
case charCodes.lineSeparator:
case charCodes.paragraphSeparator:
return "";
@@ -1279,6 +1282,7 @@ export default class Tokenizer extends LocationParser {
if (inTemplate) {
return null;
}
// fall through
default:
if (ch >= charCodes.digit0 && ch <= charCodes.digit7) {
const codePos = this.state.pos - 1;
@@ -54,16 +54,18 @@ export default function isReferenced(
if (parent.params.includes(node)) {
return false;
}
// Fall-through to next case clause to check whether the node is the method's name.
// fall through

// yes: { [NODE]: "" }
// no: { NODE: "" }
// depends: { NODE }
// depends: { key: NODE }
// fall through
case "ObjectProperty":
// no: class { NODE = value; }
// yes: class { [NODE] = value; }
// yes: class { key = NODE; }
// fall through
case "ClassProperty":
case "ClassPrivateProperty":
if (parent.key === node) {

0 comments on commit 0b3dea8

Please sign in to comment.
You can’t perform that action at this time.