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

@@ -6,16 +6,16 @@ export default function () {
"ArrowFunctionExpression|FunctionExpression": {
exit(path) {
if (path.key !== "value" && !path.parentPath.isObjectProperty()) {
let replacement = nameFunction(path);
const replacement = nameFunction(path);
if (replacement) path.replaceWith(replacement);
}
}
},
ObjectProperty(path) {
let value = path.get("value");
const value = path.get("value");
if (value.isFunction()) {
let newNode = nameFunction(value);
const newNode = nameFunction(value);
if (newNode) value.replaceWith(newNode);
}
}