Skip to content
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

Merged
merged 14 commits into from
Feb 5, 2019

Conversation

DSchau
Copy link
Contributor

@DSchau DSchau commented Dec 27, 2018

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

@DSchau DSchau requested a review from a team as a code owner December 27, 2018 21:07
@DSchau DSchau requested a review from a team December 27, 2018 21:07
@DSchau
Copy link
Contributor Author

DSchau commented Dec 27, 2018

Also note I removed some misc. files from the starter blog (e.g. .eslint.js, .travis.yml, etc.)

@polarathene
Copy link
Contributor

lowercase with a dash separating terms (dasherized, e.g. NavBar is nav-bar.js)

This is called kebab-case

@DSchau
Copy link
Contributor Author

DSchau commented Dec 28, 2018

@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!

@DSchau
Copy link
Contributor Author

DSchau commented Dec 28, 2018

@pieh mentioned a possibly helpful plugin to automate this out.

https://github.com/selaux/eslint-plugin-filenames

Worth checking out as part of this PR

1732e29 and a9c5334

Copy link
Contributor

@ZYSzys ZYSzys left a 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

@DSchau
Copy link
Contributor Author

DSchau commented Jan 4, 2019

@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!

@LekoArts
Copy link
Contributor

What's the status here? 😊 Do only the merge conflicts need to be resolved?

@DSchau
Copy link
Contributor Author

DSchau commented Feb 4, 2019

@LekoArts it should be ready now. Sorry for the delay!

Copy link
Contributor

@pieh pieh left a 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

@DSchau DSchau merged commit 50920c1 into gatsbyjs:master Feb 5, 2019
@DSchau DSchau deleted the starters/dasherize branch February 5, 2019 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants