You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+101-4Lines changed: 101 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -346,6 +346,54 @@ Other Style Guides
346
346
const nodes = Array.from(foo);
347
347
```
348
348
349
+
- [4.5](#4.5) <a name='4.5'></a> Use return statements in array method callbacks. It's ok to omit the returnif the function body consists of a single statement following [8.2](#8.2). eslint: [`array-callback-return`](http://eslint.org/docs/rules/array-callback-return)
- [6.4](#6.4) <a name='6.4'></a> When programmatically building up strings, use template strings instead of concatenation. eslint: [`prefer-template`](http://eslint.org/docs/rules/prefer-template.html) jscs: [`requireTemplateStrings`](http://jscs.info/rule/requireTemplateStrings)
498
+
- [6.4](#6.4) <a name='6.4'></a> When programmatically building up strings, use template strings instead of concatenation. eslint: [`prefer-template`](http://eslint.org/docs/rules/prefer-template.html) [`template-curly-spacing`](http://eslint.org/docs/rules/template-curly-spacing) jscs: [`requireTemplateStrings`](http://jscs.info/rule/requireTemplateStrings)
451
499
452
500
> Why? Template strings give you a readable, concise syntax with proper newlines and string interpolation features.
453
501
@@ -462,6 +510,11 @@ Other Style Guides
462
510
return ['How are you, ', name, '?'].join();
463
511
}
464
512
513
+
// bad
514
+
functionsayHi(name) {
515
+
return`How are you, ${ name }?`;
516
+
}
517
+
465
518
// good
466
519
functionsayHi(name) {
467
520
return`How are you, ${name}?`;
@@ -535,7 +588,7 @@ Other Style Guides
535
588
```
536
589
537
590
<a name="es6-rest"></a>
538
-
- [7.6](#7.6) <a name='7.6'></a> Never use `arguments`, opt to use rest syntax `...` instead.
591
+
- [7.6](#7.6) <a name='7.6'></a> Never use `arguments`, opt to use rest syntax `...` instead. [`prefer-rest-params`](http://eslint.org/docs/rules/prefer-rest-params)
539
592
540
593
> Why? `...` is explicit about which arguments you want pulled. Plus rest arguments are a real Array and not Array-like like `arguments`.
541
594
@@ -771,6 +824,19 @@ Other Style Guides
771
824
});
772
825
```
773
826
827
+
- [8.5](#8.5) <a name='8.5'></a> Avoid confusing arrow function syntax (`=>`) with comparison operators (`<=`, `>=`). eslint: [`no-confusing-arrow`](http://eslint.org/docs/rules/no-confusing-arrow)
- [9.5](#9.5) <a name='9.5'></a> Classes have a default constructor if one is not specified. An empty constructor function or one that just delegates to a parent class is unnecessary. [`no-useless-constructor`](http://eslint.org/docs/rules/no-useless-constructor)
953
+
954
+
```javascript
955
+
// bad
956
+
class Jedi {
957
+
constructor() {}
958
+
959
+
getName() {
960
+
return this.name;
961
+
}
962
+
}
963
+
964
+
// bad
965
+
class Rey extends Jedi {
966
+
constructor(...args) {
967
+
super(args);
968
+
}
969
+
}
970
+
971
+
// good
972
+
class Rey extends Jedi {
973
+
constructor(...args) {
974
+
super(args);
975
+
this.name = 'Rey';
976
+
}
977
+
}
978
+
```
979
+
886
980
**[⬆ backtotop](#table-of-contents)**
887
981
888
982
@@ -1592,8 +1686,8 @@ Other Style Guides
1592
1686
})(this);↵
1593
1687
```
1594
1688
1595
-
- [18.6](#18.6) <a name='18.6'></a> Use indentation when making long method chains. Use a leading dot, which
1596
-
emphasizes that the line is a method call, not a newstatement.
1689
+
- [18.6](#18.6) <a name='18.6'></a> Use indentation when making long method chains (more than 2 method chains). Use a leading dot, which
1690
+
emphasizes that the line is a method call, not a newstatement. eslint: [`newline-per-chained-call`](http://eslint.org/docs/rules/newline-per-chained-call) [`no-whitespace-before-property`](http://eslint.org/docs/rules/no-whitespace-before-property)
- [18.7](#18.7) <a name='18.7'></a> Leave a blank line after blocks and before the next statement. jscs: [`requirePaddingNewLinesAfterBlocks`](http://jscs.info/rule/requirePaddingNewLinesAfterBlocks)
0 commit comments