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
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -421,7 +421,7 @@ Other Style Guides
421
421
const name = 'Capt. Janeway';
422
422
```
423
423
424
-
- [6.2](#6.2) <a name='6.2'></a> Strings longer than 100 characters should be written across multiple lines using string concatenation.
424
+
- [6.2](#6.2) <a name='6.2'></a> Strings that cause the line to go over 100 characters should be written across multiple lines using string concatenation.
425
425
- [6.3](#6.3) <a name='6.3'></a> Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/airbnb/javascript/issues/40).
426
426
427
427
```javascript
@@ -1692,6 +1692,31 @@ Other Style Guides
1692
1692
// good
1693
1693
const foo = { clark: 'kent' };
1694
1694
```
1695
+
- [18.12](#18.12) <a name='18.12'></a> Avoid having lines of code that are longer than 100characters (including whitespace).
1696
+
> Why? This ensures readability and maintainability.
const foo = 'Whatever national crop flips the window. The cartoon reverts within the screw. Whatever wizard constrains a helpful ally. The counterpart ascends!';
1703
+
1704
+
// bad
1705
+
$.ajax({ method: 'POST', url: 'https://airbnb.com/', data: { name: 'John' } }).done(() => console.log('Congratulations!')).fail(() => console.log('You have failed this city.'));
1706
+
1707
+
// good
1708
+
const foo = 'Whatever national crop flips the window. The cartoon reverts within the screw. ' +
1709
+
'Whatever wizard constrains a helpful ally. The counterpart ascends!';
1710
+
1711
+
// good
1712
+
$.ajax({
1713
+
method: 'POST',
1714
+
url: 'https://airbnb.com/',
1715
+
data: { name: 'John' },
1716
+
})
1717
+
.done(() => console.log('Congratulations!'))
1718
+
.fail(() => console.log('You have failed this city.'));
0 commit comments