-
Notifications
You must be signed in to change notification settings - Fork 26.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
Filenames with different UpperCamelCase are unsafe in case-insensitive filesystems #501
Comments
Why would they be changed? |
Refactor ? Mistakes ? It's good a style guide allows for those wouldn't you say ? |
+1 on this. |
It's a good thought but at Airbnb we follow PascalCaseNaming practices. You're welcome to fork our guide though and add your own rules :) |
The PascalCaseNaming practice is good for code, not so much for file systems. Not only to avoid errors in case insenstivie OSs but I also had troubles in the past with git picking up case changes. Lowercase would align better with npm, where it's a requirement for package names. |
|
I mean, if you publish to npm a library called "Airbnb Lib" that exports a class named |
Sure. However, this standard (name filenames to match the casing of the default export) doesn't apply to packages - see The git issues only apply when renaming or creating a file - otherwise it should work just fine. |
I literally faced this issue. One of my file name was "LiveUnassignedOrdersListItem.js". It was working on my local system (OSX), but when I tried to put the build on cloud server the build was failing. These are such bugs you can't debug easily. |
if only @goatslacker would re-open the issue also take the opportunity to fix file case naming at airbnb... Would be great for the community as everyone looks up to this codestyle to see what's right and wrong. |
Our current file naming isn’t broken. Our linter config complains when you import files with the wrong casing, and this makes things work fine regardless of underlying case sensitivity. |
Using upper-camel-case for filenames, or any sort of case that involves different letter casing, is dangerous when your team includes developers committing code from case insensitive filesystems (mostly people with windows and NTFS, and OSX and case insensitive HFS+).
It's a problem specifically when a developer in a case insensitive filesystem renames a folder in a way that just changes the folder's case, and pushes it. Because github (and probably all git hosts) run on linux, you'll get an inconsistency there that you will not observe in an inconsistent file system.
For instance if you had
Button/Button.jsx
andButton/style.css
, and you rename the button folder and file tobutton/button.jsx
, in the remote git repository you would end up with two folders,button/button.jsx
andButton/style.css
. Nothing would be different in your local filesystem.I understand if you strictly follow the conventions and never ever change a folder case you will be fine, but it's easy to overlook if someone does it.
The text was updated successfully, but these errors were encountered: