When calling deno fmt and a list of properties/values are long, it will append an unnecessary comma after the last one.
const object: { longName: boolean, otherLongName: boolean } = { longName: true, otherLongName: false }
```sh
deno fmt
Output:
```ts
const object: { longName: boolean; otherLongName: boolean } = {
longName: true,
otherLongName: false,
};
That can result in pretty weird looking code when it is more complex. Is this intentional?
Far from unnecessary. Starting from ES5, trailing commas are gradually being accepted and preferred since this reduces confusion.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas
It's also the standard option when using prettier (and obviously dprint defaults to this as well, as you can tell).
_edit:_ regarding the confusion bit, the MDN docs explain it perfectly:
If you want to add a new property, you can simply add a new line without modifying the previously last line if that line already uses a trailing comma. This makes version-control diffs cleaner and editing code might be less troublesome.
Thank you for the link and the explanation. In that case it is therefore intentional.
Most helpful comment
Far from unnecessary. Starting from ES5, trailing commas are gradually being accepted and preferred since this reduces confusion.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas
It's also the standard option when using prettier (and obviously dprint defaults to this as well, as you can tell).
_edit:_ regarding the confusion bit, the MDN docs explain it perfectly: