dart-lang / dart_style

An opinionated formatter/linter for Dart code
https://pub.dev/packages/dart_style
BSD 3-Clause "New" or "Revised" License
645 stars 118 forks source link

Format `with` and `implements` in enum declarations. #1442

Closed munificent closed 4 months ago

munificent commented 4 months ago

There was an old test for this but somehow I must have dropped the clause parts of that test when migrating it and then forgot to implement clauses on enums.

Handling this required juggling some code around because, unlike most other type declarations, we allow the body of an enum to not split if it only contains values and no members. But we also want to force the enum values to split if there is a split in the header. (This is almost never relevant because if you have a with or implements clause in an enum, you almost certainly want to define some members too, but the formatter should do the right thing regardless.)

In the process of working on this, I noticed that ListStyle.splitListIfBeforeSplits is no longer used, so I removed that.