Skip to content

Commit 66fa479

Browse files
committed
Fix: Don't allow default export class by mistake (fixes #82)
1 parent 42ce538 commit 66fa479

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

espree.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4716,6 +4716,7 @@ function parseExportDefaultDeclaration() {
47164716
var declaration = null,
47174717
expression = null,
47184718
possibleIdentifierToken,
4719+
allowClasses = extra.ecmaFeatures.classes,
47194720
marker = markerCreate();
47204721

47214722
// covers:
@@ -4738,7 +4739,7 @@ function parseExportDefaultDeclaration() {
47384739
if (lookahead.value === "function") {
47394740
declaration = parseFunctionDeclaration(true);
47404741
return markerApply(marker, astNodeFactory.createExportDefaultDeclaration(declaration));
4741-
} else if (lookahead.value === "class") {
4742+
} else if (allowClasses && lookahead.value === "class") {
47424743
declaration = parseClassDeclaration(true);
47434744
return markerApply(marker, astNodeFactory.createExportDefaultDeclaration(declaration));
47444745
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
"index": 15,
3+
"lineNumber": 1,
4+
"column": 16,
5+
"description": "Unexpected reserved word"
6+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default class {}

0 commit comments

Comments
 (0)