Skip to content

Always have a trailing comma on enums #1726

@spydon

Description

@spydon

What input code did you provide to the formatter?

enum Conferences {
  FlutterAndFriends,
  FlutterLatAm,
  FlutterCon,
  FlutterVikings,
}

What output did the formatter produce?

enum Conferences { FlutterAndFriends, FlutterLatAm, FlutterCon, FlutterVikings }

What output did you expect or want the formatter to produce?

Describe how you expected the formatter to format the code, ideally by showing what you had in mind as code.

enum Conferences {
  FlutterAndFriends,
  FlutterLatAm,
  FlutterCon,
  FlutterVikings,
}

Anything else we should know?

Some formatters are forcing trailing commas on enums (like Prettier, thanks for the reference Bob!), and I think we should do the same.

Here are some reasons why I think this would be a good idea:

  1. Cleaner Diffs in Version Control
  2. Easier Reordering
  3. Simplifies Adding/Removing Items
  4. Improves Readability

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions