Skip to content

Inline comments in list destructuring moved to wrong side of comma #1013

@dmsnell

Description

@dmsnell

To keep destructuring legible without creating unused bindings I typically add an explanatory comment but running through prettier moves the comments to the wrong spots where it ends up obscuring the explanation

Prettier 1.13.6
Playground link

--parser babylon

Input:

const [ /* full match */, username, /* role */, /* title */, email ] = user;

Output:

const [, /* full match */ username /* role */ /* title */, , , email] = user;

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:commentsIssues with how Prettier prints commentsdifficulty:hardIssues that might take an entire weekend, or require a tough decision to fixlang:javascriptIssues affecting JS

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions