remove es20xx prefixes from plugins and rename folders (#6575)

This commit is contained in:
Henry Zhu
2017-10-28 20:43:15 -04:00
committed by GitHub
parent 92a3caeb9c
commit 9ac326b075
1672 changed files with 1200 additions and 1203 deletions

View File

@@ -0,0 +1,24 @@
import nameFunction from "@babel/helper-function-name";
export default function() {
return {
visitor: {
FunctionExpression: {
exit(path) {
if (path.key !== "value" && !path.parentPath.isObjectProperty()) {
const replacement = nameFunction(path);
if (replacement) path.replaceWith(replacement);
}
},
},
ObjectProperty(path) {
const value = path.get("value");
if (value.isFunction()) {
const newNode = nameFunction(value);
if (newNode) value.replaceWith(newNode);
}
},
},
};
}