Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Decision: Filenames shall be dash-case'd. #29

Closed
kylecesmat opened this issue Sep 28, 2016 · 5 comments
Closed

Decision: Filenames shall be dash-case'd. #29

kylecesmat opened this issue Sep 28, 2016 · 5 comments

Comments

@kylecesmat
Copy link
Contributor

kylecesmat commented Sep 28, 2016

Wanting to create a forum to talk about filename casing, postfixing, & best patterns.

I understand there are pitfalls associated with pascal/camel-casing and case-sensetive filesystems, however there does seem to be a lot of support in the React community for ComponentName filenames. The naming translates well into component use inside JSX. Projects like airbnb-eslint-config & React Core have adopted this kind of naming.

Other considerations such as component-name.react.js and component-name.ios.js postfixing should be accounted for as well in filename discussions.

@aweary
Copy link

aweary commented Sep 28, 2016

I think dashed-case should be the default, PascalCase allowed for React components, and camelCase allowed if the file is being exported and the export name matches the filename.

@ryan-roemer ryan-roemer changed the title Filenames Casing & Postfixing [Ongoing Discussion] Filenames Casing & Postfixing Sep 28, 2016
ryan-roemer added a commit to FormidableLabs/react-native-responsive-styles that referenced this issue Sep 28, 2016
* Update `eslint-config-formidable` to get proper `filenames` rules.
* Add overrides for `filenames` pending FormidableLabs/eslint-config-formidable#29
* Fix incorrect match export name.
* Implement `package.json:scripts.test`
@divmain
Copy link

divmain commented Sep 30, 2016

Anything case-sensitive will be an issue for Mac users.

This just came up with a client of ours. File was named someThing.js on the filesystem, and they imported something in another module. This worked fine locally, but broke in Linux test and prod environments. Even fixing the thing is harder than it should be.

Strongly recommend staying away from case-sensitive filename patterns.

cc @aweary @jevakallio

@ryan-roemer
Copy link
Member

I've repeatedly encountered @divmain 's anecdote on our largest client projects.

Basically, I think the tl;dr is that case-sensitive filenaming is fine if you have a super-small team where if things go awry you can walk over and manually help everyone completely nuke the repo and start again to remove the vestiges of casing gone wrong. But, on larger projects and/or larger teams it can be a disaster and more likely to have an issue come up as a project grows.

And, anecdotally, right out of the gate, @jevakallio 's new project had an issue wherein the casing of the ES6 class didn't match the filename. (Fortunately, the class name was wrong I think, so we didn't have to recase the file, just the code.) But, it underscores that situations implicating case changing occur frequently enough to be a pain.

I second @divmain 's suggestion that we

Strongly recommend staying away from case-sensitive filename patterns.

@kenwheeler
Copy link

I'm going to chime in and recommend all dash case, all the time. Capital case react component naming never really made sense to me. The .ios.js naming is functional in RN, as it resolves the file based upon platform, but I don't feel like the .react.js extension is necessary. The whole .react and .jsx I believe came from when you would have different loaders based upon extension, which is no longer the case. Add in all the case sensitivity issues and I think file-name.js makes sense to use pretty much everywhere.

@ryan-roemer
Copy link
Member

OK, I'm designating:

DECISION: Formidable is "all dash-case, all the time".

  • @jevakallio / @aweary -- Can you do tickets to convert your Formidable projects to dash case? Thanks!

OPEN ISSUE: @kylecesmat / everyone else. If we want to further discuss the .ios.js thing can we open a new issue to contain the discussion there?

@ryan-roemer ryan-roemer changed the title [Ongoing Discussion] Filenames Casing & Postfixing Decision: Filenames shall be dash-case'd. Oct 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants