Skip to content

Formatting array containing array spreads moves comments #7655

Open
@mediremi

Description

@mediremi

This issue is present since v11.1.0.

The formatter moves comments inside an array to after the array if the array contains a spread:

// Before formatter

let arr = [1, 2, 3]

let _ = [
  // Comment before
  ...arr,
  // Comment after
  4
]
// After formatter

let arr = [1, 2, 3]

let _ = [...arr, 4] // Comment before

// Comment after

Playground link

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions