From MozillaWiki
Jump to: navigation, search

Code Style

Here are some style guidance for the Raindrop code.


All code should conform to the JSLint style. Big highlights:

  • 4 spaces for indentation, using spaces, not tabs.
  • One var call per function.
  • Always use braces around blocks.
  • Prefer camelCase always instead of using_underscores. The back-end data model will have fields that have underscores, those are fine to reference. But for things that exist in just the front end code, camelCase is preferred, including in file names.

To validate your code, here are some options:

  • Use the online website
  • If using Komodo or Komodo Edit, there is JSLint add-on. Go to Tools, Add-Ons, then click the Get Add-ons button, and search for "jslint".
  • Use the dvcs_jslint to hook up JSLint as a pre-commit step for Mercurial.

All documentation for the JavaScript should be done in JSDoc format.