Skip to content

Feature request: multiline collection literals should break consistently (one element per line) #1160

@Fei-Wang

Description

@Fei-Wang

What I want

When an array/dictionary literal is multiline, format it consistently as one element per line (no mixed layout).

Example

Input:

var l = [
  "xxx", "yyy",
  "zzzz",
]

Expected:

var l = [
  "xxx",
  "yyy",
  "zzzz",
]

Same idea for dictionaries: if multiline, one key: value per line.

Question

Is there an existing config/rule to enforce this? If not, could we add an option to make collection-literal element lists use a “consistent” breaking strategy (if it breaks, it breaks everywhere)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions