-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Handle call expressions in the no-anonymous-default-export rule #977
Handle call expressions in the no-anonymous-default-export rule #977
Conversation
@@ -43,6 +44,7 @@ ruleTester.run('no-anonymous-default-export', rule, { | |||
test({ code: 'export default \'foo\'', errors: [{ message: 'Assign literal to a variable before exporting as module default' }] }), | |||
test({ code: 'export default `foo`', errors: [{ message: 'Assign literal to a variable before exporting as module default' }] }), | |||
test({ code: 'export default {}', errors: [{ message: 'Assign object to a variable before exporting as module default' }] }), | |||
test({ code: 'export default foo(bar)', errors: [{ message: 'Assign call result to a variable before exporting as module default' }] }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this constitutes a breaking change if it's false
by default; it'd need to default to true
so it can be semver-minor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, yes. Will fix that.
Apparently the "default" property of the JSON schema is ignored by ESLint, so I added a bit of code that generates defaults. |
1 similar comment
020ce05
to
1739d6b
Compare
Call expressions are not handled by the
no-anonymous-default-export
rule... not anymore!Previously:
After the PR: