-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
chore: standardize on lowercase/dasherized file names #10691
Conversation
Also note I removed some misc. files from the starter blog (e.g. .eslint.js, .travis.yml, etc.) |
This is called kebab-case |
@polarathene lodash (and probably jQuery, underscore, and other libraries) popularized the kebab-case term, but it's been called a few different things (including dash-case). https://stackoverflow.com/a/17820138 But yeah--noted. Thanks! |
@pieh mentioned a possibly helpful plugin to automate this out. https://github.com/selaux/eslint-plugin-filenames
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, I think uppercase file names may be better.
Refs: https://github.com/airbnb/javascript/tree/master/react#naming
@ZYSzys re: uppercase, yeah, I honestly don't really care what we use as long as it's consistent. I tend to use kebab-case (dash-case) in my personal projects, but as long as we are consistent in a style I vote that. Also note, that we don't really use Airbnb style-guide in Gatsby whatsoever, although it certainly is ubiquitous! |
What's the status here? 😊 Do only the merge conflicts need to be resolved? |
@LekoArts it should be ready now. Sorry for the delay! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's 🚢 it
Description
I've seen some tweets that indicate that sometimes there can be confusion as to whether to use uppercase or lowercase conventions for React component file names.
This isn't specific to Gatsby, but we can resolve some of this by documenting a consistent format, and for that I'd recommend that we consistently document lowercase with a dash separating terms (dasherized, e.g. NavBar is
nav-bar.js
). This is what we use in the starters (e.g. src/components/header.js instead of src/components/Header.js) outside of the blog starter--which has been normalized in this PR.I've also done a simple find and replace for usage of these (e.g. src/components/Bio.js -> src/components/bio.js) so that the documentation matches the usage. There are additional uppercase components (e.g. src/components/SEO.js) but I left those as is, since the usage of them where referenced is also uppercase.
Related Issues
Sorta related to #10671 as well as my comment here