dprint / dprint-plugin-typescript

TypeScript and JavaScript code formatting plugin for dprint.
https://dprint.dev/plugins/typescript
MIT License
248 stars 50 forks source link

Array of objects is not formatted nicely #641

Open lucacasonato opened 3 weeks ago

lucacasonato commented 3 weeks ago

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" }];