denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.9k stars 5.22k forks source link

`deno fmt` breaks list of objects in the middle of an object #22459

Open tgross35 opened 6 months ago

tgross35 commented 6 months ago

For a list of objects, Deno applies the following formatting:

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

It breaks the line in the middle of an object, which doesn't make much sense. This formatting gets reapplied even if I delete line breaks and trailing commas. The following would be much better:

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

No specific format configuration outside of excluded files.

deno 1.40.3 (release, aarch64-apple-darwin) v8 12.1.285.6 typescript 5.3.3

lucacasonato commented 2 months ago

Opened upstream issue https://github.com/dprint/dprint-plugin-typescript/issues/641