Skip to content

Formatter drops comment before comma in collection literal #1584

@munificent

Description

@munificent

Here's a minimal repro of an issue found in a larger piece of code. If you format:

var x = [
  1 // Comment 1.
  ,
  2 // Comment 2.
];

It outputs:

var x = [
  1,
  2, // Comment 2.
];

It seems to only have this bug if the first comment is before the comma (which is weird) and there is a second comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions