Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array of objects is not formatted nicely #641

Open
lucacasonato opened this issue Jun 13, 2024 · 1 comment · May be fixed by #649
Open

Array of objects is not formatted nicely #641

lucacasonato opened this issue Jun 13, 2024 · 1 comment · May be fixed by #649
Labels
bug Something isn't working

Comments

@lucacasonato
Copy link
Contributor

Describe the bug

Formatting an array of objects, an object is somehow broken across a new line even if this doesn't look very good.

https://dprint.dev/playground/#code/ATDGHsDsGcBdgGYAdIFkCmBbARugTtABYCWSAKsbADbrTAC8wA2gN7CQCGm6AXMAEQAxAAoA5fsAC+AGmBtO3PkLHAAwlQ7RoEmXPZdeAsgE8k6HbPkGlAEVqg8pWMSg6AugG4gA/plugin/typescript

Deno version: 1.44.1

Input Code

const fpnMembershipTitles = [{ name: "FPN" }, { name: "FPN Class" }, { name: "Type" }, { name: "Description" }];

Expected Output

const fpnMembershipTitles = [
  { name: "FPN" },
  { name: "FPN Class" },
  { name: "Type" },
  { name: "Description" },
];

Actual Output

const fpnMembershipTitles = [{ name: "FPN" }, { name: "FPN Class" }, {
  name: "Type",
}, { name: "Description" }];
@yazan-abdalrahman
Copy link
Contributor

Hello @dsherret @lucacasonato can u review my PR,
#649

I realized that there should be a break line '\n' between '[' and '{', so I checked to see whether this was an array, not a part of a comment, or not part of the string, and then if that correct, I placed a break line '\n' between '[' and '{', so that the behavior worked as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants