Skip to content

Conventions

angelxuanchang edited this page Jan 13, 2018 · 1 revision
  1. When creating a new JS file, follow the CommonJS-spec (e.g., node-style code) instead of appending properties to window or writing AMD-style modules.
  2. Limit the number of script tags inside of HTML/Jade files, and try not to embed JS in HTML files.
  3. For any external dependency that is already prebuilt, install it with bower, npm instead of downloading it into the source folder (unless the dependency isn't on npm or bower).
  4. Fork or create a repo for external dependencies on GitHub and require them if you decide to make edits to the dependencies. Consider using a .npmignore file and creating a npm module for the dependency so you can require a limited subset of the files instead.
  5. Split up large JS files with lots of application logic into multiple files.
  6. If you want your code reviewed by another person (recommended), please create a PR for your changes instead of checking straight into master (e.g., for clientside code without tests and adds additional functionality)
  7. Please write accompanying tests for any functionality introduced in the serverside code.
  8. Use git mv (instead of mv) to move/rename files to help minimize the number of merge conflicts.
  9. Run npm test and address any linter warnings/errors or failing tests before checking in code.
Clone this wiki locally