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

@@ -1,10 +1,10 @@
export default function ({ types: t }) {
function build(node, nodes, scope) {
let first = node.specifiers[0];
const first = node.specifiers[0];
if (!t.isExportNamespaceSpecifier(first) && !t.isExportDefaultSpecifier(first)) return;
let specifier = node.specifiers.shift();
let uid = scope.generateUidIdentifier(specifier.exported.name);
const specifier = node.specifiers.shift();
const uid = scope.generateUidIdentifier(specifier.exported.name);
let newSpecifier;
if (t.isExportNamespaceSpecifier(specifier)) {
@@ -24,8 +24,8 @@ export default function ({ types: t }) {
visitor: {
ExportNamedDeclaration(path) {
let { node, scope } = path;
let nodes = [];
const { node, scope } = path;
const nodes = [];
build(node, nodes, scope);
if (!nodes.length) return;