Skip to content

Commit

Permalink
turn class declarations into variable declarations - fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmck committed Feb 28, 2015
1 parent 62ba733 commit 45528ce
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions eslint/babel-eslint-parser/acorn-to-esprima.js
Expand Up @@ -30,18 +30,26 @@ var astTransformVisitor = {
delete node.argument;
}

if (t.isClassProperty(node)) {
// eslint doesn't like these
this.remove();
}

if (t.isImportBatchSpecifier(node)) {
// ImportBatchSpecifier<name> => ImportNamespaceSpecifier<id>
node.type = "ImportNamespaceSpecifier";
node.id = node.name;
delete node.name;
}

// classes

if (t.isClassDeclaration(node)) {
return t.variableDeclaration("let", [
t.variableDeclarator(node.id, node)
]);
}

if (t.isClassProperty(node)) {
// eslint doesn't like these
this.remove();
}

// JSX

if (t.isJSXIdentifier(node)) {
Expand Down

0 comments on commit 45528ce

Please sign in to comment.