Run new lint rules (#5413)

This commit is contained in:
Brian Ng
2017-03-04 09:46:01 -06:00
committed by Henry Zhu
parent f7e2d88f6c
commit 8a82cc060a
181 changed files with 1459 additions and 1454 deletions

View File

@@ -40,7 +40,7 @@ const iifeVisitor = {
Scope(path) {
// different bindings
path.skip();
}
},
};
export const visitor = {
@@ -53,7 +53,7 @@ export const visitor = {
const state = {
iife: false,
scope: scope
scope: scope,
};
const body = [];
@@ -67,8 +67,8 @@ export const visitor = {
const defNode = buildDefaultParam({
VARIABLE_NAME: left,
DEFAULT_VALUE: right,
ARGUMENT_KEY: t.numericLiteral(i),
ARGUMENTS: argsIdentifier
ARGUMENT_KEY: t.numericLiteral(i),
ARGUMENTS: argsIdentifier,
});
defNode._blockHoist = node.params.length - i;
body.push(defNode);
@@ -90,7 +90,7 @@ export const visitor = {
continue;
}
const left = param.get("left");
const left = param.get("left");
const right = param.get("right");
//
@@ -134,5 +134,5 @@ export const visitor = {
} else {
path.get("body").unshiftContainer("body", body);
}
}
},
};

View File

@@ -15,7 +15,7 @@ export const visitor = {
const uid = path.scope.generateUidIdentifier("ref");
const declar = t.variableDeclaration("let", [
t.variableDeclarator(param.node, uid)
t.variableDeclarator(param.node, uid),
]);
declar._blockHoist = outputParamsLength - i;
@@ -25,5 +25,5 @@ export const visitor = {
param.replaceWith(uid);
}
}
}
},
};

View File

@@ -17,7 +17,7 @@ export default function () {
break;
}
}
}
}, destructuring.visitor, rest.visitor, def.visitor])
},
}, destructuring.visitor, rest.visitor, def.visitor]),
};
}

View File

@@ -153,7 +153,7 @@ const memberExpressionOptimisationVisitor = {
if (node.name === state.name) {
state.deopted = true;
}
}
},
};
function hasRest(node) {
return t.isRestElement(node.params[node.params.length - 1]);
@@ -178,7 +178,7 @@ function optimiseIndexGetter(path, argsId, offset) {
path.parentPath.replaceWith(restIndexImpure({
ARGUMENTS: argsId,
INDEX: index,
REF: temp
REF: temp,
}));
} else {
path.parentPath.replaceWith(restIndex({
@@ -214,10 +214,10 @@ export const visitor = {
// check and optimise for extremely common cases
const state = {
references: [],
offset: node.params.length,
offset: node.params.length,
argumentsNode: argsId,
outerBinding: scope.getBindingIdentifier(rest.name),
outerBinding: scope.getBindingIdentifier(rest.name),
// candidate member expressions we could optimise if there are no other references
candidates: [],
@@ -295,10 +295,10 @@ export const visitor = {
ARGUMENTS: argsId,
ARRAY_KEY: arrKey,
ARRAY_LEN: arrLen,
START: start,
ARRAY: rest,
KEY: key,
LEN: len,
START: start,
ARRAY: rest,
KEY: key,
LEN: len,
});
if (state.deopted) {
@@ -322,5 +322,5 @@ export const visitor = {
target.insertBefore(loop);
}
}
},
};