Prettier pr-18186
Playground link
Input:
type A = {
property: // Comment
B;
property2: /* Comment */
B
property3: /* Comment */
B
}
const A2 = {
property: // Comment
B,
property2: /* Comment */
B,
property3: /* Comment */ B
}
Output:
type A = {
property: B; // Comment
property2 /* Comment */: B;
property3 /* Comment */: B;
};
const A2 = {
// Comment
property: B,
/* Comment */ property2: B,
property3: /* Comment */ B,
};
Expected output:
type A = {
property: // Comment
B;
property2 /* Comment */: B;
property3: /* Comment */ B;
};
const A2 = {
property: // Comment
B,
property2 /* Comment */: B,
property3: /* Comment */ B,
};
// or
type A = {
property: B; // Comment
property2 /* Comment */: B;
property3: /* Comment */ B;
};
const A2 = {
property: B, // Comment
property2 /* Comment */: B,
property3: /* Comment */ B,
};
Why?
#18110 made some changes in the comments for PropertySignature, which caused property2: /* Comment */ B to be formatted as property2 /* Comment */ : B. I think the comment should keep its original place, that is said it should be formatted as `property2: /* Comment */ B
The expected output maintains consistency and keeps the comment position as similar as before.
Prettier pr-18186
Playground link
Input:
Output:
Expected output:
Why?
#18110 made some changes in the comments for PropertySignature, which caused
property2: /* Comment */ Bto be formatted asproperty2 /* Comment */ : B. I think the comment should keep its original place, that is said it should be formatted as `property2: /* Comment */ BThe expected output maintains consistency and keeps the comment position as similar as before.