ezsystems/ezcs — pull request #2 by dpobel (2013-06-11 16:17:13+00:00)
Title: Reorganized repository and configuration to check JavaScript code with jshint

JIRA issue: https://jira.ez.no/browse/EZP-21010

This PR adds the configuration to jshint to check the JavaScript code against the coding standard I'm currently writing.

Here are the main points (mostly inspired by the YUI coding style rules, I took jshint.json from https://github.com/yui/yui-lint and changed/added a few settings):
* The code is indented with 4 spaces. tabs must not be used to indent code.
* Do not rely on the automatic semicolon insertion, put a semicolon where it is needed
* The `{` (left curly brace) is always at the end of a line and preceded by a space
* The `}` (right curly brace) is always at the beginning of a line indented to be aligned
* In lists (literal object, literal array), the comma is put at the end
* The code includes the `"use strict";` statement to trigger [the strict execution mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode)
* The line length should not exceed 150 characters
* The code must be documented to generate an API documentation with [yuidoc](http://yui.github.io/yuidoc/). The comment block is required for each module, class and public method/function. Inline comments can be added but only where the code requires some explanations, ie do not paraphrase the code with inline comments.
* Protected and private method names begin with an underscore (`_`)
* All variables used in a function are declared in one `var` statement at the very beginning of the function
* All names in the code are written in *lowerCamelCase* with 2 exceptions:
1. Variables which are actually a constant are written in uppercase and the words are separated by an underscore (`MY_VARIABLE`)
1. The name of class (component, widget, ...anything you use as a constructor) is written in *UpperCamelCase*
* Global variables and functions should be avoided as much as possible
* In the YUI context:
* The code is divided into modules
* eZ's components are exported under the `Y.eZ` namespace
* eZ's module names start with the `ez-` prefix

[This gist shows an example of a valid JavaScript file](https://gist.github.com/dpobel/5758265).