11'use strict' ;
22
3- // # Whitespace
4- // Limit your lines to 105 characters
3+ // Limit your lines to 120 characters
4+ testMyStringLikeYouNeverTestedItBefore ( ) ;
5+
56function testMyStringLikeYouNeverTestedItBefore ( ) {
6- const string = 'The path of the righteous man is beset on all sides by the iniquities of the ' +
7- 'selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, ' +
8- 'shepherds the weak through the valley of darkness, for he is truly his brother\'s ' +
9- 'keeper and the finder of lost children. And I will strike down upon thee with great' +
10- 'vengeance and furious anger those who would attempt to poison and destroy My brothers.' ;
7+ const string = 'The path of the righteous man is beset on all sides by the iniquities of the selfish and the ' +
8+ 'tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the ' +
9+ 'valley of darkness, for he is truly his brother\'s keeper and the finder of lost children. And I will strike down ' +
10+ 'upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers.' ;
1111
1212 return string ;
1313}
1414
15- testMyStringLikeYouNeverTestedItBefore ( ) ;
15+ // Don't require the `radix` argument for `parseInt`.
16+ // Both forms should be acceptable.
17+ parseInt ( '10' ) ;
18+ parseInt ( '10' , 10 ) ;
1619
1720// Use function before declaration
1821functionDefinedBeforeUse ( ) ;
1922
2023function functionDefinedBeforeUse ( ) {
24+ // Quotes in object properties
25+ // If one property needs quotes, then we'll require quotes on any properties for the same object.
26+ const obj = {
27+ 'foo word' : 'bar' ,
28+ 'other foo' : 'bar2' ,
29+ 'foo' : 'bar' ,
30+ } ;
31+
32+ // If none of them require quotes, then quotes are disallowed.
33+ const anotherObject = Object . assign ( { } , obj , {
34+ foo : 'bar' ,
35+ foo2 : 'bar2' ,
36+ foo3 : 'bar3' ,
37+ } ) ;
2138
39+ return anotherObject ;
2240}
2341
2442// Allowing to reassign parameter
@@ -29,8 +47,7 @@ function reassignParameter(value) {
2947// Curly braces with if else
3048if ( reassignParameter ) {
3149 reassignParameter ( ) ;
32- }
33- else {
50+ } else {
3451 functionDefinedBeforeUse ( ) ;
3552}
3653
@@ -44,3 +61,8 @@ function testMyTrailingComma(
4461}
4562
4663testMyTrailingComma ( ) ;
64+
65+ // Allowing for...of loops.
66+ for ( const item of [ ( ) => { } , ( ) => { } , ( ) => { } ] ) {
67+ item ( ) ;
68+ }
0 commit comments