Front end developer specialising in JavaScript and React. Experienced in all aspects of modern front end development. Passionate about making accessible, secure and performant software.
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:
It's the standard typing style in the JavaScript ecosystem.
It's the easiest to type.
We can use camel case stuff in JavaScript.
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.