-
Notifications
You must be signed in to change notification settings - Fork 913
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
File naming conventions #30
Comments
I like to use CustomerInvoice.class.js for a class only and CustomerInvoice.module.js for modules |
We currently follow a lower_snake_case naming convention, but many of the core contributors agree that we should have adopted a naming scheme that matches the expected output of that module. In that scenario, the require statement would match up with the variable it was assigned to. // FooBarClass.js
module.exports = function FooBarClass() {
} // someMapFunction.js
module.exports = function someMapFunction(item, i, list) {
} // someContainerModule.js
module.exports = {
Class1: require('./Class1')
}; // variables should match the filename
var FooBarClass = require('./FooBarClass');
var someMapFunction = require('./someMapFunction');
var Class1 = require('./someContainerModule').Class1; |
I like that. It seems to make sense and makes it easier to identify where a
|
I don't like putting .class and .module especially because referring to classes in javascript is a bad habit to begin with. Naming scheme to match expected output like @spenceralger said makes the most sense. |
I saved nodejs file as "dynamicrouting_with_restriction". |
There appear to be two common styles: using the same case as the default identifier in the file ( Personally I favor dash separated to avoid accidental case sensitivity.
(Any time you have filenames differing only by case, Mac users are going to complain.) Since there may never be consensus here, it might be worth closing this issue and opening one on https://github.com/standard/standard |
Inspired from Angular's file naming convention, I name my files as,
|
Hey, Do you know if naming the files in the singular is the best approach? |
Thanks for the great guide.
I wonder what about File naming conventions for js files, files can be modules or class
For example how class file for CustomerInvoice class be named?
Camel case or snake case?
Thanks.
The text was updated successfully, but these errors were encountered: