Code Styling Rules

ankit edited this page Jan 29, 2012 · 2 revisions

Indentation

Use 2 Spaces, Soft Tabs.

Comments

For JSDoc comments, always use /* */. For example:

/**
 * Retrieves all the global rules
 * @return {Object} The rules of the global stylesheet.
 */

Use // for inline comments

Blank Lines

Blank lines should have no spaces. If you use TextMate, use this bundle.

Line Length Limit

There is no hard set limit for this. Just make sure it is readable.

JSDoc Documentation

Visit the official jsdoc-toolkit reference for a detailed list of all the tags used in our JSDoc documentation.

Everything else

For everything else, follow the rules in the Google JavaScript Style Guide: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml Also, we also use the Closure Linter utility to check our files to avoid common issues.