Run new lint rules (#5413)
This commit is contained in:
@@ -24,7 +24,7 @@ export function _getTypeAnnotation(): ?Object {
|
||||
if (!node) {
|
||||
// handle initializerless variables, add in checks for loop initializers too
|
||||
if (this.key === "init" && this.parentPath.isVariableDeclarator()) {
|
||||
const declar = this.parentPath.parentPath;
|
||||
const declar = this.parentPath.parentPath;
|
||||
const declarParent = declar.parentPath;
|
||||
|
||||
// for (let NODE in bar) {}
|
||||
|
||||
@@ -101,7 +101,7 @@ function inferAnnotationFromBinaryExpression(name, path) {
|
||||
const operator = path.node.operator;
|
||||
|
||||
const right = path.get("right").resolve();
|
||||
const left = path.get("left").resolve();
|
||||
const left = path.get("left").resolve();
|
||||
|
||||
let target;
|
||||
if (left.isIdentifier({ name })) {
|
||||
@@ -167,7 +167,7 @@ function getConditionalAnnotation(path, name) {
|
||||
const ifStatement = getParentConditionalPath(path);
|
||||
if (!ifStatement) return;
|
||||
|
||||
const test = ifStatement.get("test");
|
||||
const test = ifStatement.get("test");
|
||||
const paths = [test];
|
||||
const types = [];
|
||||
|
||||
@@ -188,7 +188,7 @@ function getConditionalAnnotation(path, name) {
|
||||
if (types.length) {
|
||||
return {
|
||||
typeAnnotation: t.createUnionTypeAnnotation(types),
|
||||
ifStatement
|
||||
ifStatement,
|
||||
};
|
||||
} else {
|
||||
return getConditionalAnnotation(ifStatement, name);
|
||||
|
||||
@@ -52,7 +52,7 @@ export function BinaryExpression(node) {
|
||||
return t.booleanTypeAnnotation();
|
||||
} else if (operator === "+") {
|
||||
const right = this.get("right");
|
||||
const left = this.get("left");
|
||||
const left = this.get("left");
|
||||
|
||||
if (left.isBaseType("number") && right.isBaseType("number")) {
|
||||
// both numbers so this will be a number
|
||||
@@ -65,7 +65,7 @@ export function BinaryExpression(node) {
|
||||
// unsure if left and right are strings or numbers so stay on the safe side
|
||||
return t.unionTypeAnnotation([
|
||||
t.stringTypeAnnotation(),
|
||||
t.numberTypeAnnotation()
|
||||
t.numberTypeAnnotation(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -73,14 +73,14 @@ export function BinaryExpression(node) {
|
||||
export function LogicalExpression() {
|
||||
return t.createUnionTypeAnnotation([
|
||||
this.get("left").getTypeAnnotation(),
|
||||
this.get("right").getTypeAnnotation()
|
||||
this.get("right").getTypeAnnotation(),
|
||||
]);
|
||||
}
|
||||
|
||||
export function ConditionalExpression() {
|
||||
return t.createUnionTypeAnnotation([
|
||||
this.get("consequent").getTypeAnnotation(),
|
||||
this.get("alternate").getTypeAnnotation()
|
||||
this.get("alternate").getTypeAnnotation(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ export {
|
||||
Func as ArrowFunctionExpression,
|
||||
Func as FunctionDeclaration,
|
||||
Func as ClassExpression,
|
||||
Func as ClassDeclaration
|
||||
Func as ClassDeclaration,
|
||||
};
|
||||
|
||||
export function CallExpression() {
|
||||
|
||||
Reference in New Issue
Block a user