Skip to content
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

require()s at top of file #21

Open
piranna opened this issue Oct 9, 2015 · 3 comments
Open

require()s at top of file #21

piranna opened this issue Oct 9, 2015 · 3 comments

Comments

@piranna
Copy link

piranna commented Oct 9, 2015

file require()s entries should be at the top of the page, maybe with interlazed with some variables definitions, but in the recomended order: Node.js build-ins, third-party modules, and last modules on the same project. This can be easily identified by the usage of relative paths on the requires.

@konobi
Copy link
Owner

konobi commented Oct 12, 2015

While I like that organization myself, I'm not sure how valuable it is in itself. For example, "kwalitee" would fail because it has to do require() based on programmatic names for modules.
Do you have some esprima style code that'd work for this sort of detection?

@piranna
Copy link
Author

piranna commented Oct 12, 2015

Your use case is something that fails on browserify and need some hacks, so could be considered "bad code", or at least show a warning. This can be identified because require() argument is a variable and didn't solved to a constant when browserify/esprima was called.

@konobi
Copy link
Owner

konobi commented Oct 30, 2015

Sure, but kwalitee isn't meant for the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants