Hi,
I'd like to know what is your files and folders naming convention if you have one ?
hello_world.ext
hello-world.ext
hello.world.ext
...
Can you explain your preference in the way to fit best to that data programming world we are living in ?
Thanks
Top comments (2)
I personally use camel case for most things, or pascal case if something is exporting a class (or React component).
Also I always prefer a component based file structure.
React component example:
Foo/
Foo.jsx
Foo.test.jsx
Foo.module.scss - Further, I use camel casing for classes for consistency.
index.js
Standard module not exporting a class:
foo/
foo.js
foo.test.js
index.js
Reasoning
It doesn't matter for private projects. As long as you're consistent within your team and codebase. It really doesn't matter at all.
But benefits for camel casing are:
In a private project, the rest are okay too. Underscore case is very readable, but I find it the slowest to type. Kebab case is quite readable too, but I just don't like the look of it as much. Also we can't use kebab style in JavaScript, so that's a negative point in terms of consistency.
ex.
good_naming.log