semi reports missing semicolon on export default class
See original GitHub issue// test.js
export default class {};
// config.json
{
"env": {
"es6": true
},
"ecmaFeatures": {
"modules": true
},
"rules": {
"semi": 2
}
}
$ eslint --reset --no-eslintrc --config config.json test.js
test.js
2:23 error Missing semicolon semi
✖ 1 problem (1 error, 0 warnings)
Looks like similar cases were addressed in #2178 and this one was missed.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Semicolon after default export - javascript - Stack Overflow
You don't need to add a semicolon after a export default when it's followed by a function declaration, that's what the grammar says....
Read more >SyntaxError: missing ; before statement - JavaScript | MDN
The JavaScript exception "missing ; before statement" occurs when there is a semicolon ( ; ) missing somewhere and can't be added by...
Read more >semi - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Rollup and Bublé. Runtime error due to missing semicolon in ...
Evertything worked fine until I refactor it (due to a security issue reported by github) but now, it compiles OK, but crashes at...
Read more >In csv export set delimiter to semicolon instead of comma in ...
csv), while Open Office and Libre Office do that, and changing the default delimiter in Excel requires to change the language/locale settings. So,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Working on this. It’s quite the bear. In the meantime, this is my interpretation of the spec, broken down by the productions of
ExportDeclaration
:export * FromClause ;
Semicolon belongs to
ExportDeclaration
.export ExportClause FromClause ;
Semicolon belongs to
ExportDeclaration
.export ExportClause ;
Semicolon belongs to
ExportDeclaration
.export VariableStatement
Semicolon belongs to
VariableStatement
.export Declaration
Declaration : HoistableDeclaration
No semicolon.
Declaration : ClassDeclaration
No semicolon.
Declaration : LexicalDeclaration
Semicolon belongs to LexicalDeclaration.
export default HoistableDeclaration
No semicolon.
export default ClassDeclaration
No semicolon.
export default AssignmentExpression ;
Semicolon belongs to ExportDeclaration.
tl;dr:
ExportAllDeclaration
may have a semicolon.ExportNamedDeclaration
whosedeclaration
isnull
may have a semicolon.ExportNamedDeclaration
with a childdeclaration
does not have a semicolon, though its child may.ExportDefaultDeclaration
may have a semicolon only if itsdeclaration
is an expression.(end tl;dr)
I find this interesting, from ESTree:
If
declaration
and (specifiers
,source
) are mutually exclusive, why are they the same node?Edit:
ExportDefaultDeclaration
may have a semicolon if its child is an expression.@lo1tuma Ah, you’re right! That’s… unexpected. Thanks!