Run new lint rules (#5413)
This commit is contained in:
@@ -24,7 +24,7 @@ const PRECEDENCE = {
|
||||
"*": 9,
|
||||
"/": 9,
|
||||
"%": 9,
|
||||
"**": 10
|
||||
"**": 10,
|
||||
};
|
||||
|
||||
export function NullableTypeAnnotation(node: Object, parent: Object): boolean {
|
||||
@@ -64,7 +64,7 @@ export function Binary(node: Object, parent: Object): boolean {
|
||||
}
|
||||
|
||||
if (t.isBinary(parent)) {
|
||||
const parentOp = parent.operator;
|
||||
const parentOp = parent.operator;
|
||||
const parentPos = PRECEDENCE[parentOp];
|
||||
|
||||
const nodeOp = node.operator;
|
||||
@@ -220,7 +220,7 @@ export function AssignmentExpression(node: Object): boolean {
|
||||
// in statement.
|
||||
function isFirstInStatement(printStack: Array<Object>, {
|
||||
considerArrow = false,
|
||||
considerDefaultExports = false
|
||||
considerDefaultExports = false,
|
||||
} = {}): boolean {
|
||||
let i = printStack.length - 1;
|
||||
let node = printStack[i];
|
||||
|
||||
@@ -71,7 +71,7 @@ export const nodes = {
|
||||
if ((state.hasCall && state.hasHelper) || state.hasFunction) {
|
||||
return {
|
||||
before: state.hasFunction,
|
||||
after: true
|
||||
after: true,
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -82,7 +82,7 @@ export const nodes = {
|
||||
|
||||
SwitchCase(node: Object, parent: Object): ?WhitespaceObject {
|
||||
return {
|
||||
before: node.consequent.length || parent.cases[0] === node
|
||||
before: node.consequent.length || parent.cases[0] === node,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -93,7 +93,7 @@ export const nodes = {
|
||||
LogicalExpression(node: Object): ?WhitespaceObject {
|
||||
if (t.isFunction(node.left) || t.isFunction(node.right)) {
|
||||
return {
|
||||
after: true
|
||||
after: true,
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -105,7 +105,7 @@ export const nodes = {
|
||||
Literal(node: Object): ?WhitespaceObject {
|
||||
if (node.value === "use strict") {
|
||||
return {
|
||||
after: true
|
||||
after: true,
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -118,7 +118,7 @@ export const nodes = {
|
||||
if (t.isFunction(node.callee) || isHelper(node)) {
|
||||
return {
|
||||
before: true,
|
||||
after: true
|
||||
after: true,
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -140,7 +140,7 @@ export const nodes = {
|
||||
if (enabled) {
|
||||
return {
|
||||
before: true,
|
||||
after: true
|
||||
after: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -154,10 +154,10 @@ export const nodes = {
|
||||
if (t.isBlockStatement(node.consequent)) {
|
||||
return {
|
||||
before: true,
|
||||
after: true
|
||||
after: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -169,7 +169,7 @@ nodes.ObjectTypeProperty =
|
||||
nodes.ObjectMethod = function (node: Object, parent): ?WhitespaceObject {
|
||||
if (parent.properties[0] === node) {
|
||||
return {
|
||||
before: true
|
||||
before: true,
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -202,7 +202,7 @@ export const list = {
|
||||
|
||||
ObjectExpression(node: Object): Array<Object> {
|
||||
return node.properties;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -215,7 +215,7 @@ export const list = {
|
||||
["Loop", true],
|
||||
["LabeledStatement", true],
|
||||
["SwitchStatement", true],
|
||||
["TryStatement", true]
|
||||
["TryStatement", true],
|
||||
].forEach(function ([type, amounts]) {
|
||||
if (typeof amounts === "boolean") {
|
||||
amounts = { after: amounts, before: amounts };
|
||||
|
||||
Reference in New Issue
Block a user