From 5797f545d8c0840feadc6d1464120d8eb5f47c38 Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Thu, 16 Mar 2017 09:05:59 +0100 Subject: [PATCH] [guide] Add array-bracket-newline (close #1338) --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index 2680c19a..48afd4b0 100644 --- a/README.md +++ b/README.md @@ -417,6 +417,45 @@ Other Style Guides **[⬆ back to top](#table-of-contents)** + + - [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