FormidableLabs/eslint-config-formidable

Decision: Filenames shall be dash-case'd.

Closed this issue · 5 comments

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.

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.

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

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.

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.

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?