[guide] Add array-bracket-newline (close #1338)

This commit is contained in:
JPeer264
2017-03-16 09:05:59 +01:00
parent 321fb271bd
commit 5797f545d8

View File

@@ -417,6 +417,45 @@ Other Style Guides
**[⬆ back to top](#table-of-contents)**
<a name="arrays--bracket-newline"></a>
- [4.6](#arrays--bracket-newline) Use line breaks after open and before close array brackets if an array has multiple lines
```javascript
// bad
const arr = [
[0, 1], [2, 3], [4, 5],
];
const objectInArray = [{
id: 1,
}, {
id: 2,
}];
const numberInArray = [
1, 2,
];
// good
const arr = [[0, 1], [2, 3], [4, 5]];
const objectInArray = [
{
id: 1,
},
{
id: 2,
},
];
const numberInArray = [
1,
2,
];
```
**[⬆ back to top](#table-of-contents)**
## Destructuring
<a name="destructuring--object"></a><a name="5.1"></a>