Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: pages/coding-style.html

Issue 29375722: Noissue - Update the JavaScript coding style guide regarding ESLint (Closed)
Left Patch Set: Addressed Sebastian's feedback Created Feb. 15, 2017, 11:21 a.m.
Right Patch Set: Reworded new spacing rule Created Feb. 15, 2017, 11:47 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 title=Coding Style 1 title=Coding Style
2 2
3 3
4 <h2 id="precedence">{{s1 Precedence}}</h2> 4 <h2 id="precedence">{{s1 Precedence}}</h2>
5 5
6 <p>{{s2 The Adblock Plus coding style is based on others. Our rules (both genera l and language specific) always overrule referenced style guides. The language s pecific sections overrule the general section.}}</p> 6 <p>{{s2 The Adblock Plus coding style is based on others. Our rules (both genera l and language specific) always overrule referenced style guides. The language s pecific sections overrule the general section.}}</p>
7 7
8 <h2 id="consistency">{{s3 Consistency}}</h2> 8 <h2 id="consistency">{{s3 Consistency}}</h2>
9 9
10 <p>{{s4 Consistency is most important: Be consistent within functions, files, mo dules and projects. Making existing code conform with this style guide is fine, but it should happen in dedicated commits, preferably for a whole module or proj ect at once.}}</p> 10 <p>{{s4 Consistency is most important: Be consistent within functions, files, mo dules and projects. Making existing code conform with this style guide is fine, but it should happen in dedicated commits, preferably for a whole module or proj ect at once.}}</p>
(...skipping 10 matching lines...) Expand all
21 <li>{{todo-comments Don't add TODO comments, create an <a href="https://issues .adblockplus.org">issue</a> and reference it in a comment instead.}}</li> 21 <li>{{todo-comments Don't add TODO comments, create an <a href="https://issues .adblockplus.org">issue</a> and reference it in a comment instead.}}</li>
22 </ul> 22 </ul>
23 23
24 <h2 id="javascript">{{s14 JavaScript}}</h2> 24 <h2 id="javascript">{{s14 JavaScript}}</h2>
25 <ul> 25 <ul>
26 <li>{{s15 Follow the Mozilla Coding Style's <a href="https://developer.mozilla .org/en-US/docs/Developer_Guide/Coding_Style#JavaScript_practices">JavaScript pr actices</a>.}}</li> 26 <li>{{s15 Follow the Mozilla Coding Style's <a href="https://developer.mozilla .org/en-US/docs/Developer_Guide/Coding_Style#JavaScript_practices">JavaScript pr actices</a>.}}</li>
27 <li>{{javascript-strict Always use <a href="https://developer.mozilla.org/docs /Web/JavaScript/Reference/Strict_mode">strict mode</a>.}}</li> 27 <li>{{javascript-strict Always use <a href="https://developer.mozilla.org/docs /Web/JavaScript/Reference/Strict_mode">strict mode</a>.}}</li>
28 <li>{{javascript-opening-braces Opening braces of object literals don't go on their own line when that would cause a syntax error.}}</li> 28 <li>{{javascript-opening-braces Opening braces of object literals don't go on their own line when that would cause a syntax error.}}</li>
29 <li>{{javascript-if-else-braces When an <code><fix>if</fix></code> statement, an <code><fix>else</fix></code> statement or a loop spans over more than one lin e always enclose it with braces.}}</li> 29 <li>{{javascript-if-else-braces When an <code><fix>if</fix></code> statement, an <code><fix>else</fix></code> statement or a loop spans over more than one lin e always enclose it with braces.}}</li>
30 <li>{{s18 In classes, prefix private functions with a single underscore to mak e them pseudo-private.}}</li> 30 <li>{{s18 In classes, prefix private functions with a single underscore to mak e them pseudo-private.}}</li>
31 <li>{{javascript-spacing-literals Don't add spaces directly inside of Object a nd Array literals.}}</li> 31 <li>{{javascript-spacing-literals Don't add any spaces immediately after openi ng, or before closing, an object or array literal.}}</li>
Sebastian Noack 2017/02/15 11:34:45 I don't think that Object and Array need to be cap
kzar 2017/02/15 11:48:55 Yea I found this rule hard to word and I think you
32 <h3 id="javascript-modern">{{javascript-es6 Modern JavaScript (where supported )}}</h3> 32 <h3 id="javascript-modern">{{javascript-es6 Modern JavaScript (where supported )}}</h3>
33 <ul> 33 <ul>
34 <li>{{javascript-block-scoping Always use <a href="https://developer.mozilla .org/docs/Web/JavaScript/Reference/Statements/block#With_let_and_const">block-sc oping</a> (<code><fix>let</fix></code> / <code><fix>const</fix></code>), except when sharing global variables between scripts cannot be avoided.}}</li> 34 <li>{{javascript-block-scoping Always use <a href="https://developer.mozilla .org/docs/Web/JavaScript/Reference/Statements/block#With_let_and_const">block-sc oping</a> (<code><fix>let</fix></code> / <code><fix>const</fix></code>), except when sharing global variables between scripts cannot be avoided.}}</li>
35 <li>{{javascript-const Use <code><fix>const</fix></code> for constant expres sions that could as well have been inlined (e.g. static parameters, imported mod ules, etc.).}}</li> 35 <li>{{javascript-const Use <code><fix>const</fix></code> for constant expres sions that could as well have been inlined (e.g. static parameters, imported mod ules, etc.).}}</li>
36 <li>{{javascript-arrow Use the <a href="https://developer.mozilla.org/docs/W eb/JavaScript/Reference/Functions/Arrow_functions">arrow function</a> syntax whe n passing anonymous functions that don't require the binding of their own <code> <fix>this</fix></code> or <code><fix>arguments</fix></code> variables.}}</li> 36 <li>{{javascript-arrow Use the <a href="https://developer.mozilla.org/docs/W eb/JavaScript/Reference/Functions/Arrow_functions">arrow function</a> syntax whe n passing anonymous functions that don't require the binding of their own <code> <fix>this</fix></code> or <code><fix>arguments</fix></code> variables.}}</li>
37 <li>{{javascript-method Use the <a href="https://developer.mozilla.org/docs/ Web/JavaScript/Reference/Functions/Method_definitions">method definition shortha nd</a> syntax when defining methods on an object.}}</li> 37 <li>{{javascript-method Use the <a href="https://developer.mozilla.org/docs/ Web/JavaScript/Reference/Functions/Method_definitions">method definition shortha nd</a> syntax when defining methods on an object.}}</li>
38 <li>{{javascript-for-of When iterating over arrays in the canonical order us e the new <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/S tatements/for...of"><code><fix>for..of</fix></code></a> syntax if the loop index isn't required. (Rather than using <code><fix>for(;;)</fix></code> or the <code ><fix>forEach()</fix></code> method.)}}</li> 38 <li>{{javascript-for-of When iterating over arrays in the canonical order us e the new <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/S tatements/for...of"><code><fix>for..of</fix></code></a> syntax if the loop index isn't required. (Rather than using <code><fix>for(;;)</fix></code> or the <code ><fix>forEach()</fix></code> method.)}}</li>
39 <li>{{javascript-map-set Use the <a href="https://developer.mozilla.org/docs /Web/JavaScript/Reference/Global_Objects/Map"><code><fix>Map</fix></code></a> or <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Obj ects/Set"><code><fix>Set</fix></code></a> objects, rather than misusing plain ob jects, when you need a hash table.}}</li> 39 <li>{{javascript-map-set Use the <a href="https://developer.mozilla.org/docs /Web/JavaScript/Reference/Global_Objects/Map"><code><fix>Map</fix></code></a> or <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Obj ects/Set"><code><fix>Set</fix></code></a> objects, rather than misusing plain ob jects, when you need a hash table.}}</li>
40 <li>{{javascript-eslint Run <a href="http://eslint.org"><fix>ESLint</fix></a > with the <a href="https://hg.adblockplus.org/codingtools/file/tip/eslint-confi g-eyeo"><fix>eslint-config-eyeo</fix></a> configuration and fix any warning.}}</ li> 40 <li>{{javascript-eslint Run <a href="http://eslint.org"><fix>ESLint</fix></a > with the <a href="https://hg.adblockplus.org/codingtools/file/tip/eslint-confi g-eyeo"><fix>eslint-config-eyeo</fix></a> configuration and fix any warning.}}</ li>
41 </ul> 41 </ul>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 <ul> 87 <ul>
88 <li>{{objc-conventions Follow Apple's <a href="https://developer.apple.com/lib rary/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Conventions/Co nventions.html">conventions</a>}}.</li> 88 <li>{{objc-conventions Follow Apple's <a href="https://developer.apple.com/lib rary/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Conventions/Co nventions.html">conventions</a>}}.</li>
89 </ul> 89 </ul>
90 90
91 <h2 id="puppet">{{s31 Puppet}}</h2> 91 <h2 id="puppet">{{s31 Puppet}}</h2>
92 <ul> 92 <ul>
93 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht ml">Puppet Style Guide</a>.}}</li> 93 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht ml">Puppet Style Guide</a>.}}</li>
94 <li>{{s33 Opening braces don't go on their own line.}}</li> 94 <li>{{s33 Opening braces don't go on their own line.}}</li>
95 <li>{{s34 Arrows should not be aligned.}}</li> 95 <li>{{s34 Arrows should not be aligned.}}</li>
96 </ul> 96 </ul>
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld