author | Laurent Peuch <cortex@worlddomination.be> |
Thu, 21 Feb 2019 18:56:42 +0100 | |
branch | 3.26 |
changeset 12464 | d26382fc15d8 |
parent 12443 | 47f85e75d214 |
permissions | -rw-r--r-- |
6049
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1 |
Javascript Coding Standards |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2 |
--------------------------- |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
3 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
4 |
(Draft, to be continued) |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
5 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
6 |
:Naming: camelCase, except for CONSTANTS |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
7 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
8 |
Indentation rules |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
9 |
~~~~~~~~~~~~~~~~~ |
12443
47f85e75d214
[doc] translate french to english
Laurent Peuch <cortex@worlddomination.be>
parents:
10492
diff
changeset
|
10 |
|
47f85e75d214
[doc] translate french to english
Laurent Peuch <cortex@worlddomination.be>
parents:
10492
diff
changeset
|
11 |
- one space before an opening curly bracket ({) |
6049
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
12 |
|
12443
47f85e75d214
[doc] translate french to english
Laurent Peuch <cortex@worlddomination.be>
parents:
10492
diff
changeset
|
13 |
- line break after a closing curly bracket (}) (possibly no line break if |
47f85e75d214
[doc] translate french to english
Laurent Peuch <cortex@worlddomination.be>
parents:
10492
diff
changeset
|
14 |
everything is on the same line) |
6049
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
15 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
16 |
- no tabs |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
17 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
18 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
19 |
Documentation |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
20 |
~~~~~~~~~~~~~ |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
21 |
XXX explain comment format for documentation generation |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
22 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
23 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
24 |
Coding |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
25 |
~~~~~~ |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
26 |
- Don't forget 'var' before variable definition, and semi-colon (';') after **each** statement. |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
27 |
- Check the firebug console for deprecation warnings |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
28 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
29 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
30 |
API usage |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
31 |
~~~~~~~~~ |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
32 |
- unless intended, use jQuery('container') rather than jqNode('container') |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
33 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
34 |
|
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
35 |
See also |
f0ae98fa85a1
[doc] started js/css coding standards
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
36 |
~~~~~~~~ |
12443
47f85e75d214
[doc] translate french to english
Laurent Peuch <cortex@worlddomination.be>
parents:
10492
diff
changeset
|
37 |
http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml |