-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentsarea:idempotencyIssues with re-printing Prettier’s outputIssues with re-printing Prettier’s outputlang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
Prettier 3.1.0
Playground link
--parser typescriptInput:
export default class Foo {
constructor({
foo,
// bar = "bar",
// bazz = "bazz",
}: FooInit) {}
}Output:
export default class Foo {
constructor({
foo,
} // bar = "bar",
// bazz = "bazz",
: FooInit) {}
}Expected behavior:
I would expect no changes whatsoever to the original input:
export default class Foo {
constructor({
foo,
// bar = "bar",
// bazz = "bazz",
}: FooInit) {}
}Notes
This behaviour is actually fairly buggy, not only is the output not desirable, the output isn't stable, feeding the output back into prettier changes it again:
export default class Foo {
constructor({
foo, // bar = "bar",
} // bazz = "bazz",
: FooInit) {}
}which feeding back in becomes (and will from now on alternate between this and the above printing):
export default class Foo {
constructor({
foo, // bar = "bar",
// bazz = "bazz",
}: FooInit) {}
}Metadata
Metadata
Assignees
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentsarea:idempotencyIssues with re-printing Prettier’s outputIssues with re-printing Prettier’s outputlang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.