-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse errors with ES6 export {} declaration #2567
Parse errors with ES6 export {} declaration #2567
Comments
I think JSHint should warn at line 3: it is valid, but it is probably a mistake. |
I think you could argue that both are possibly mistakes.. the 2nd case could be covered by
neither of which give warnings. |
(but to clarify they shouldn't error, they should possibly warn) |
Now JSHint correctly parses this code: import { a, } from "source"; export { a, }; export {}; but warns `Empty export.` at line 3 This commit fixes jshint#2567
Now JSHint correctly parses this code: import { a, } from "source"; export { a, }; export {}; but warns `Empty export.` at line 3 This commit fixes jshint#2567
Now JSHint correctly parses this code: export { a, }; export {}; but warns `Empty export.` at line 2 This commit fixes jshint#2567
JSHint doesn't warn about trailing commas, as they are ignored. I think this is more JSCS territory. var a = [ 1, ]; // No warnings
var b = [ 1, , 2]; // Empty array elements require elision=true. |
You're right, it didn't occur to me it could be a style choice. I agree on a warning for line 3. |
It'd probably be good to warn on the equivalent import statement, too: import {} from 'module'; It's more likely that the user messed up since there's the syntax |
@gustavderdrache, @nicolo-ribaudo already did this on the pr ;) but its a breaking change so likely one for v3 |
Now JSHint correctly parses this code: export { a, }; export {}; but warns `Empty export.` at line 2 This commit fixes jshint#2567
Now JSHint correctly parses this code: export { a, }; export {}; but warns `Empty export.` at line 2 This commit fixes jshint#2567
Both of these lines cause an error about an expected identifier, but the grammar indicates they should be allowed:
The text was updated successfully, but these errors were encountered: