-
Notifications
You must be signed in to change notification settings - Fork 8
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
JavaScript file naming conventions #106
Comments
I disagree here, I feel like as we almost always use classes now it makes sense to match other languages and files should be camelCase. I'll often find I store my components like Otherwise your proposed import would look like:
which I don't think is as semantic. But I don't think it matters much as long as it's consistent across a project. |
Surely it should just be
I propose that it should be
Definitely Thoughts? |
Depends on the project - you should typically split up your folder structure by domain, having all your components in one big folder isn't ideal for maintainability if you just have one folder for 120+ components. By having folders like i.e
|
My preference is:
|
Ah, true true. |
I think I'd prefer to have one or the other rather than both |
It's a tough one that's for sure, it could depend on the context on the application. If you're building a complex JS application it makes sense to treat the files like a typical compiled language does i.e. If you're just doing a bit of scripting to add some small functionality to a typical page it makes sense to do what a typical interpreted language does i.e. It's what me and @ash123456789 have done for our current project. The complex React part of the application is treated like an application with PascalCase & the basic scripting parts of the site is treated basically like |
My reasons for this difference is that I feel classes, which usually are part of front-end framework code, are often core application code and should be treated as such. While other JS files I feel are more like static assets of the project, not necessarily providing critical application code, and sometimes directly included via |
What you would like to change/add
I'd like to proposal a differing opinion from Airbnb's javascript style guide. In their style guide they mention that filenames should match exactly the default export.
But I think that all JavaScript related directories and files should be lowercase and piped.
Why you would like to change/add this
I think it is just a cleaner naming conventions, and how I've always done it in my own projects.
Examples
Airbnb
Piped
Checklist
Sources
The text was updated successfully, but these errors were encountered: