enable prefer const (#5113)

This commit is contained in:
Henry Zhu
2017-01-14 09:48:52 -05:00
committed by GitHub
parent 982850731e
commit 672adba9a1
177 changed files with 1862 additions and 1863 deletions

View File

@@ -3,13 +3,13 @@ export default function ({ parse, traverse }) {
visitor: {
CallExpression(path) {
if (path.get("callee").isIdentifier({ name: "eval" }) && path.node.arguments.length === 1) {
let evaluate = path.get("arguments")[0].evaluate();
const evaluate = path.get("arguments")[0].evaluate();
if (!evaluate.confident) return;
let code = evaluate.value;
const code = evaluate.value;
if (typeof code !== "string") return;
let ast = parse(code);
const ast = parse(code);
traverse.removeProperties(ast);
return ast.program;
}