typescript-book
typescript-book copied to clipboard
Reconsider my file naming convention and default exports
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 :rose:
Reference : https://github.com/reactjs/rfcs/pull/64#issuecomment-431395596 :rose:
@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 :)
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 :rose:
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 :+1:
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.
I was just thinking out aloud 🌹