Skip to content
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

Merged
merged 1 commit into from
Jan 4, 2018

Conversation

fatfisz
Copy link
Contributor

@fatfisz fatfisz commented Nov 28, 2017

Call expressions are not handled by the no-anonymous-default-export rule... not anymore!

Previously:

// No error
export default foo(bar)

After the PR:

// Error: Assign call result to a variable before exporting as module default
export default foo(bar)

@coveralls
Copy link

coveralls commented Nov 29, 2017

Coverage Status

Coverage remained the same at 96.088% when pulling 6647f86 on fatfisz:no-anonymous-call-default-export into 9db95b3 on benmosher:master.

@@ -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' }] }),
Copy link
Member

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

Copy link
Contributor Author

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.

@fatfisz
Copy link
Contributor Author

fatfisz commented Nov 30, 2017

Apparently the "default" property of the JSON schema is ignored by ESLint, so I added a bit of code that generates defaults.

@coveralls
Copy link

coveralls commented Nov 30, 2017

Coverage Status

Coverage increased (+0.008%) to 96.096% when pulling 5c72c73 on fatfisz:no-anonymous-call-default-export into 9db95b3 on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.008%) to 96.096% when pulling 020ce05 on fatfisz:no-anonymous-call-default-export into 9db95b3 on benmosher:master.

1 similar comment
@coveralls
Copy link

coveralls commented Nov 30, 2017

Coverage Status

Coverage increased (+0.008%) to 96.096% when pulling 020ce05 on fatfisz:no-anonymous-call-default-export into 9db95b3 on benmosher:master.

@ljharb ljharb force-pushed the no-anonymous-call-default-export branch from 020ce05 to 1739d6b Compare January 4, 2018 08:00
@ljharb ljharb self-assigned this Jan 4, 2018
@coveralls
Copy link

coveralls commented Jan 4, 2018

Coverage Status

Coverage increased (+0.007%) to 96.21% when pulling 1739d6b on fatfisz:no-anonymous-call-default-export into 697afb2 on benmosher:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 96.21% when pulling 1739d6b on fatfisz:no-anonymous-call-default-export into 697afb2 on benmosher:master.

@coveralls
Copy link

coveralls commented Jan 4, 2018

Coverage Status

Coverage increased (+0.007%) to 96.21% when pulling 1739d6b on fatfisz:no-anonymous-call-default-export into 697afb2 on benmosher:master.

@ljharb ljharb merged commit bac9794 into import-js:master Jan 4, 2018
@fatfisz fatfisz deleted the no-anonymous-call-default-export branch January 4, 2018 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants