Skip to content

A comment on after parameter list moves before parameter list #9367

@sosukesuzuki

Description

@sosukesuzuki

from: #9324 (comment)
Prettier 2.1.2
Playground link

--parser babel-ts

Input:

class Test {
  foo (/* 2 */) /* 3 */;
}

Output:

class Test {
  foo /* 3 */(/* 2 */);
}

Expected behavior:

class Test {
  foo (/* 2 */) /* 3 */;
}

Additional info:

With typescript parser, #9324 happens.

Playground link

--parser typescript
// Input
class Test {
  foo (/* 2 */) /* 3 */;
}

// Output
Error: Comment "3" was not printed. Please report this error!
    at https://prettier.io/lib/standalone.js:15:106002
    at Array.forEach (<anonymous>)
    at Object.ensureAllCommentsPrinted (https://prettier.io/lib/standalone.js:15:105970)
    at Xi (https://prettier.io/lib/standalone.js:15:111682)
    at Yi (https://prettier.io/lib/standalone.js:15:113795)
    at formatWithCursor (https://prettier.io/lib/standalone.js:15:113915)
    at https://prettier.io/lib/standalone.js:15:386874
    at Object.format (https://prettier.io/lib/standalone.js:15:386957)
    at formatCode (https://prettier.io/worker.js:115:21)
    at handleMessage (https://prettier.io/worker.js:66:18)

Metadata

Metadata

Assignees

Labels

area:commentsIssues with how Prettier prints commentslang: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