-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Last indented list item inline comment is being moved to outer comment and combined with existing comment #11910
Copy link
Copy link
Closed
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentslang: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.status:needs investigationIssues that need additional investigation, e.g. to understand whether the reported behavior is a bugIssues that need additional investigation, e.g. to understand whether the reported behavior is a bug
Description
Prettier 2.5.0
Playground link
--parser babelInput:
// TypeScript interface
interface Thing1 {
aaa: (
| 'thing1' // Comment1
| 'thing2' // Comment2
)[]; // Final comment
}Output:
// TypeScript interface
interface Thing1 {
aaa: (
| "thing1" // Comment1
| "thing2"
)[]; // Comment2 // Final comment
}Expected behavior:
// TypeScript interface
interface Thing1 {
aaa: (
| "thing1" // Comment1
| "thing2" // Comment2
)[]; // Final comment
}The placement of Comment2 in the sample output is the point of concern.
Curiously, using 'flow', 'babel', 'babel-flow' and 'typescript' parsers, the same incorrect output is obtained.
But: when using babel-ts as the parser, it seems to generate the expected output.
So, I'm thinking this is a bug in Prettier rather than in the parsers?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentslang: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.status:needs investigationIssues that need additional investigation, e.g. to understand whether the reported behavior is a bugIssues that need additional investigation, e.g. to understand whether the reported behavior is a bug