Skip to content

Commit b7fbc7b

Browse files
committed
Add section 18.12 on line length
1 parent fbf81eb commit b7fbc7b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,31 @@ Other Style Guides
16921692
// good
16931693
const foo = { clark: 'kent' };
16941694
```
1695+
- [18.12](#18.12) <a name='18.12'></a> Avoid having lines of code that are longer than 100 characters (including whitespace).
1696+
> Why? This ensures readability and maintainability.
1697+
1698+
eslint rules: [`max-len`](http://eslint.org/docs/rules/max-len.html).
1699+
1700+
```javascript
1701+
// bad
1702+
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.'));
1719+
```
16951720

16961721
**[⬆ back to top](#table-of-contents)**
16971722

0 commit comments

Comments
 (0)