IssueRaiser

Keep multi-line formatting for destructuring assignment

I think multi-line destructuring should not be collapsed by Prettier. Same concept as the [multi-line objects special case](https://github.com/prettier/prettier/blob/master/Rationale.md#multi-line-objects). When doing destructuring (particularly nested) new lines can greatly enhance readability. **Example of current behaviour** Input: ```javascript // Object with multiple lines uncollapsed by Prettier const user = { name: { first: "Zoid", last: "Berg", }, }; // Similar destructuring assignment is collapsed by Prettier const { name: { first, last, }, } = user; ``` Prettier output: ```javascript // Object with multiple lines uncollapsed by Prettier const user = { name: { first: "Zoid", last: "Berg" } }; // Similar destructuring assignment is collapsed by Prettier const { name: { first, last } } = user; ```

Posted by Brian-Gaffney on Jul 27, 2017, 9:40 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

github (Software)

Keep multi-line formatting for destructuring assignment

Brian-GaffneyJul 27, 2017, 9:40 AM

I think multi-line destructuring should not be collapsed by Prettier. Same concept as the [multi-line objects special case](https://github.com/prettier/prettier/blob/master/Rationale.md#multi-line-objects). When doing destructuring (particularly nested) new lines can greatly enhance readability. **Example of current behaviour** Input: ```javascript // Object with multiple lines uncollapsed by Prettier const user = { name: { first: "Zoid", last: "Berg", }, }; // Similar destructuring assignment is collapsed by Prettier const { name: { first, last, }, } = user; ``` Prettier output: ```javascript // Object with multiple lines uncollapsed by Prettier const user = { name: { first: "Zoid", last: "Berg" } }; // Similar destructuring assignment is collapsed by Prettier const { name: { first, last } } = user; ```

Comments (0)

No comments yet. Start the discussion.

Comment on this issue