Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Beyond these, also use jsbeautifier.org, which will allow automatic code formatting. Use that before committing code.

Code style conventions (much taken from http://javascript.crockford.com/code.html)

  • Do not use tab to format code. Use 4 spaces instead (configurable through a good IDE)
  • Avoid lines longer than 120 characters (again can be set through an IDE)
  • Class comments should be using /** */
  • Generally use line comments. Save block comments for formal documentation and for commenting out.
  • Give variables their own line and arrange them alphabetically (with nice line comments)
  • Define all variables at the top of the function.
  • Use camelCase for variable and function names
  • Global variables should be in all caps
  • Use of global variables should be minimized. Implied global variables should never be used.
  • Remove trailing commas if there is no other field following
  • Use {} instead of new Object(). Use [] instead of new Array().
  • It is almost always better to use the === and !== operators. The == and != operators do type coercion. In particular, do not use == to compare against falsy values.
  • Define a route for every view you create in ST/extjs. Route and view should have the same name.
  • No labels