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

Filenames should be consistent with a styleguide rule #5383

Closed
Bargs opened this issue Nov 12, 2015 · 7 comments
Closed

Filenames should be consistent with a styleguide rule #5383

Bargs opened this issue Nov 12, 2015 · 7 comments

Comments

@Bargs
Copy link
Contributor

Bargs commented Nov 12, 2015

The current styleguide doesn't explicitly define a filename format. A PR to close this issue should include an addition to the styleguide and a cleanup of existing filenames.

Previous debate was over camelCase vs. snake_case

For snake_case:

  • most existing filenames and directories are snake_case
  • The current style guide implies snake_case is correct
  • node_modules and bower_components are both snake case

For camelCase:

  • Maps more directly to variable names e.g.:
import SomeClass from './SomeClass';
import someFunction from './someFunction';
@w33ble
Copy link
Contributor

w33ble commented Nov 12, 2015

I'll echo what I assume I've said before, possibly multiple times (but thanks for creating a formal issue about it).

I'm partial to snake_case naming, since it's more common in the JS ecosystem and it's what we've mostly used so far. However, as long as we are consistent, I honestly do not care.

@spalger
Copy link
Contributor

spalger commented Nov 13, 2015

I strongly prefer camelCase and am willing to do the work to transition the code base.

I am want camelCase because there is no good reason to use two capitalization styles. If we used snake_case variable names I would prefer snake_case file names. We don't. Let's be consistent and use camelCase everywhere! 🎉

🐫 🐫 🐫 🐫 🐫 🐫 🐫 🐫 🐫 🐫 🐫 🐫 🐫

@spalger spalger changed the title Filenames should be consistent with a styleguide rule 🐫 vs 🐍 Filenames should be consistent Nov 13, 2015
@spalger spalger changed the title 🐫 vs 🐍 Filenames should be consistent Filenames should be consistent with a styleguide rule Nov 13, 2015
@Bargs
Copy link
Contributor Author

Bargs commented Nov 13, 2015

I'm also a fan of the 🐫

Just today I found myself trying to name an exported function with 🐍 to match its filename, and eslint rapped me across the knuckles.

@kimjoar
Copy link
Contributor

kimjoar commented Nov 13, 2015

🐫s all the way!

I've started mapping filenames directly to my default export. I just find it easier to read and work with.

@epixa
Copy link
Contributor

epixa commented Nov 23, 2015

I vote for the exact naming conventions in the airbnb styleguide: https://github.com/airbnb/javascript#22.6

So:

  • PascalCase.js for files that export a single class or an object literal
  • camelCase.js for files that export a function

@w33ble
Copy link
Contributor

w33ble commented Nov 23, 2015

PascalCase.js for files that export a single class or an object literal
camelCase.js for files that export a function

If we're doing camel, I kind of like this in principle, but I can see it becoming a problem on OS's that are loose with case (Windows and most people on Mac, so almost everyone). Renaming that file becomes a pain, requiring you to rename it to something completely different, check in the "remove" to git, then rename it back to the case you actually want...

@spalger
Copy link
Contributor

spalger commented Nov 23, 2015

@rashidkpc has settled this, we're moving all filenames to snake_case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants