mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[be] Fix missing break and update no-fallthrough eslint rule
- Fixes a missing break in InferTypes - I disabled no-fallthrough previously because it would erroneously report that certain cases with non-builtin throws (eg `invariant`) would fall through. This brings the rule back but allows disabling it with a `// break omitted` comment, since it's still helpful in catching some actual missing breaks.
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
} from "../HIR/HIR";
|
||||
import { BuiltInArrayId, BuiltInObjectId } from "../HIR/ObjectShape";
|
||||
import { eachInstructionLValue, eachInstructionOperand } from "../HIR/visitors";
|
||||
import { assertExhaustive } from "../Utils/utils";
|
||||
|
||||
function isPrimitiveBinaryOp(op: t.BinaryExpression["operator"]): boolean {
|
||||
switch (op) {
|
||||
@@ -182,7 +183,29 @@ function* generateInstructionTypes(
|
||||
});
|
||||
|
||||
yield equation(left, returnType);
|
||||
break;
|
||||
}
|
||||
|
||||
case "DeclareLocal":
|
||||
case "Destructure":
|
||||
case "NewExpression":
|
||||
case "TypeCastExpression":
|
||||
case "JsxExpression":
|
||||
case "JsxFragment":
|
||||
case "RegExpLiteral":
|
||||
case "PropertyStore":
|
||||
case "PropertyDelete":
|
||||
case "ComputedStore":
|
||||
case "ComputedLoad":
|
||||
case "ComputedDelete":
|
||||
case "FunctionExpression":
|
||||
case "TaggedTemplateExpression":
|
||||
case "TemplateLiteral":
|
||||
case "Await":
|
||||
case "UnsupportedNode":
|
||||
break;
|
||||
default:
|
||||
assertExhaustive(value, `Unhandled instruction value kind: ${value}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user