-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Consistency in lists/objects #74
Copy link
Copy link
Closed
Labels
area:object literalslocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be takenIssues needing discussion and a decision to be made before action can be taken
Description
Activity
Metadata
Metadata
Assignees
Labels
area:object literalslocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be takenIssues needing discussion and a decision to be made before action can be taken
Thanks for your work, I'm VERY interested in something that deals with formatting in my place =)
One thing that struck me upon trying it out tonight, though, was that it does not handle "siblings" consistently. That is, given a list of, say, { id, name } objects; if one of them has a name large enough to reach the line limit, then this object, and this object alone, will be printed over 4 lines, while its siblings will be printed on 1 line. The "exploded" one will have a trailing comma, too, while obviously the one-liners will not.
Original
test.js:Result (
$ prettier --bracket-spacing --trailing-comma --print-width 40 test.js):I think that in this case, the original is the better code: it's consistent, easily readable and parsable, at the only cost of taking a lot of vertical space (scrolling is cheap, though).
EDIT: removed JSX example and reworded the issue as per @vramana's comment.