denoland / deno

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

`deno fmt` removes trailing commas in function parameters and calls #26951

Closed greentore closed 22 hours ago

greentore commented 1 day ago

Currently deno fmt inserts / preserves trailing commas only where they were allowed in es5, but prettier has been adding them everywhere since v3.0.0 by default. It's a bit troublesome for me as I'm trying to migrate some of my projects from node + prettier to deno and editing a file with long function calls results in unnecessary diffs.

dsherret commented 1 day ago

Currently deno fmt inserts / preserves trailing commas only where they were allowed in es5, but prettier has been adding them everywhere since v3.0.0 by default.

Can you provide an example? It's been leaving them there for many years, from my understanding (been leaving them for longer than prettier has).

dsherret commented 22 hours ago

Here's a playground showing deno fmt not removing trailing commas in function parameters and calls. Are you sure Deno is formatting the code? I'm going to close this one because I'm pretty confident it's not doing this, but please let me know if I'm wrong by commenting and showing a reproduction.

https://dprint.dev/playground/#code/MYQwNmCiAeAOBOAKAsAKAASfSAzgEwDNdDij8yTyAaNLbc0xh5wmjLJyrgtuzigfyEsBaAJRo0BAK4A7YABcAlgHtZ6WCHggAtgFMFe+DhTtMw7hZ60OIq6V63LIx+bvvWNt1zy+--gPF0AG80AF8gA/config/N4KABGBEAmCmB2B7SAuMAXATgV1iAviEA/plugin/typescript