Visitar URL original
Stop moving comment into destructuring pattern · Issue #19903 · prettier/prettier · GitHub
Skip to content

Stop moving comment into destructuring pattern #19903

Closed

Description

@fisker

Prettier 055dba4
Playground link

--parser typescript

Input:

const []
  // 1 
  : Foo = []

const [
  // 2
  ]
  : Foo = []

Output:

const [
  // 1
]: Foo = [];

const [
  // 2
]: Foo = [];

Expected output:

const []
  // 1 
  : Foo = []

const [
  // 2
]: Foo = [];

Why?

Comment "1" should not move into patterns. Related code was introduced in #15708. We should make it stricter.

Activity

  1. added theissue type on Aug 20, 2026
  2. added
    help wantedWe're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue!
    area:commentsIssues with how Prettier prints comments
    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)
    lang:flowIssues affecting Flow-specific constructs (not general JS issues)
    on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:commentsIssues with how Prettier prints commentshelp wantedWe're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue!lang:flowIssues affecting Flow-specific constructs (not general JS issues)lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions