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

Reconsider my file naming convention and default exports #440

Open
basarat opened this issue Oct 22, 2018 · 5 comments
Open

Reconsider my file naming convention and default exports #440

basarat opened this issue Oct 22, 2018 · 5 comments

Comments

@basarat
Copy link
Owner

basarat commented Oct 22, 2018

If this React React.lazy RFC lands will change the naming convention to be Buttons.tsx (instead of buttons.tsx) and sunset the default exports issues, probably move into a blog post with a mention of its okay as the conventions beat personal preference 🌹

@basarat
Copy link
Owner Author

basarat commented Oct 22, 2018

Reference : reactjs/rfcs#64 (comment) 🌹

@0x80
Copy link

0x80 commented Sep 16, 2020

@basarat The RFC is merged, but by skimming over the long thread I fail to understand what impact it has on your recommendation to avoid named exports. I would still want to use named exports because I create barrel files etc, but could add a default export if required for lazy imports.

As far as file naming goes I'm convinced that all lower case file naming is superior. I wish you would use the style guide to at least point users to some of the benefits, instead of just saying camel-casing is the convention so you should use that. But maybe I should just write an article to try and persuade people :)

@basarat
Copy link
Owner Author

basarat commented Sep 16, 2020

You and I see eye to eye 🤗

My new objective : add a section "When its okay to use export default" and simply point to when you want to use some API that works with it e.g. React.lazy 🌹

I also eye eye to eye on file naming. I recommend camelCase here https://basarat.gitbook.io/typescript/styleguide#filename and I don't see myself adding confusing-anything-is-fine (which is how I view most things personally, life is too short) comments to a styleguide so will leave it as is 👍

@0x80
Copy link

0x80 commented Sep 18, 2020

My point was not to hint on "anything is fine" but more the contrary. Consistency is important and I think its harder to achieve with camel-cased file names.

But I will just start by spreading the word myself.

@basarat
Copy link
Owner Author

basarat commented Sep 18, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants