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
Verbose/Complete Local Requirements #15
Comments
i'm never verbose, but i don't feel strongly about it |
You are requireing, not including, which means the one without .js at the end should be used. |
What about where the require is included? For clarity I think requires should always be at the top of the file unless there is a really good reason to only include in a closure/scope of some sort like a rare conditional. I see code all the time where people do lazy requires, inline, etc. To me it obfuscates the code making difficulty to understand a file's external dependencies. My suggested rule should be something like this: Requires At TopAlways put |
I would be fine merging something like that in @guomo. |
I'm not sure if this should fall under the scope of the style guide, but should requirements be verbose?
E.g.
var sample = require('./routes');
vs
var sample = require('./routes/index.js');
Or
var other = require('./routes/other');
vs
var other = require('./routes/other.js');
I personally always include them, to avoid any accidental conflicts that might be cause by editor autosaves, or something wonky, yet Express uses the former rather than the latter.
This is just one thing I was pondering, since the latter seems like a better practice. However, I'm not sure it actually warrants inclusion in the style guide.
The text was updated successfully, but these errors were encountered: