-
-
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
Add prefer-default-export
rule (fixes #304)
#308
Conversation
|
||
// There is more thank one named exports in the module. | ||
export const foo = 'foo'; | ||
export const bar 'bar'; |
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.
missing =
here
Thanks a lot @gavriguy, looks good! Could you add a line about it in the README, and add an entry in the changelog? You can thank yourself there too :) |
fixed. thanks for the warm welcome |
Just making a note: would like to support
I think the first is solved by counting The latter just needs to inspect the // replaces `ExportNamedDeclaration` visitor.
'ExportSpecifier': function(node) {
if (node.exported.name === 'default') {
hasDefaultExport = true
} else {
namedExportCount++
namedExportNode = node
}
} |
@gavriguy let me know if you're up for making those changes in this PR. I can also do it post-merge if you'd rather not. 😎 |
great ideas ill work on it. thanks |
I've made the changes. Anyways now everything works and all tests are passing. |
one of the build failed because of timeout - I think its a travis issue, but I don't see how to rebuild it again (maybe because I don't have the right permissions at Travis) Can you please have a look? |
Changes look good, no worries on the build. You could rebase against the tip, if you want, but I will probably tweak the change log a little before merging anyway, so you don't need to worry about it. Thanks for the updates! 😄 |
93f4dd8
to
1e0992d
Compare
Thanks, I rebased against master - please let me know if you need anything more. thanks |
Merged via cf45512. Thanks! |
Add
prefer-default-export
ruleWhen there is only a single export from a module prefer using default export over named export.