[Survey response requested] Dart format trailing comma proposal

61 views
Skip to first unread message

Bob Nystrom

unread,
Aug 22, 2023, 8:05:12 PM8/22/23
to General Dart Discussion

TL;DR: We're proposing a set of style changes to dart format that would affect about 10% of all Dart code. We want to know what you think.

The main change is that you no longer need to manually add or remove trailing commas. Today, the formatter supports two separate styles, which you must control explicitly by adding or removing trailing commas throughout your code. This proposal would remove that choice completely in favor of a single unified style. When an argument list or parameter list splits, it would always be formatted like:

longFunction(
  longArgument,
  anotherLongArgument,
);

We believe the large churn is worth it to free people from having to remember to apply trailing commas consistently. Dart will be less work to write, edit, and review. We also think the resulting style is better.


You can learn more about the proposal and give us your feedback here:


https://github.com/dart-lang/dart_style/issues/1253


Thank you in advance for your feedback!


– Bob Nystrom, on behalf of the Dart team


Mathieu Blais D'Amours

unread,
Aug 23, 2023, 3:05:28 AM8/23/23
to 'Bob Nystrom' via Dart Misc
Hi Bob,

At our company, we wholeheartedly agree with this direction. We're already doing this verbally in PRs, kindly asking people to add trailing commas when arguments split lines and they forget to do so.

Best regards,


LE COURAGE DE FAIRE AUTREMENT

Mathieu D'Amours 
- CTO
mathieu@
braver.health
 --
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CAF8T8LzqbN%3DZrZr010n2JZ9PFKtmbjZyjqDQX-OqFyZZf-PrGA%40mail.gmail.com.

Chris Norman

unread,
Aug 23, 2023, 4:23:28 AM8/23/23
to mi...@dartlang.org
As a blind coder, the proposed change makes code a lot easier to navigate through. Thank you so much!

Take care,

Chris Norman



Guyren Howe

unread,
Aug 23, 2023, 4:48:20 AM8/23/23
to mi...@dartlang.org
Whoever chose the standard formatting style has no earthly idea what “readable” means.

Get back to me when I can customise it or write my own formatter.

--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CAF8T8LzqbN%3DZrZr010n2JZ9PFKtmbjZyjqDQX-OqFyZZf-PrGA%40mail.gmail.com.

Chris Norman

unread,
Aug 23, 2023, 7:30:10 AM8/23/23
to mi...@dartlang.org
Surely, if you could customise it to your heart's content, it would no longer be a "standard formatting style"?

Can you not already write your own formatter? I just assumed anyone with a will could.

Take care,

Chris Norman



Guyren Howe

unread,
Aug 26, 2023, 1:55:31 PM8/26/23
to Dart Misc
That would surely be a good deal of work, even if I could find a parser and all the rest.

--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/07A12E2E-0423-4343-8A06-451DD403E393%40gmail.com.
--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
Reply all
Reply to author
Forward
0 new messages