-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[styled-components] Comments following interpolations are duplicated #5381
Copy link
Copy link
Closed
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentsarea:multiparserIssues with printing one language inside another, like CSS-in-JSIssues with printing one language inside another, like CSS-in-JSlang:css/scss/lessIssues affecting CSS, Less or SCSSIssues affecting CSS, Less or SCSSlocked-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:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!
Milestone
Metadata
Metadata
Assignees
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentsarea:multiparserIssues with printing one language inside another, like CSS-in-JSIssues with printing one language inside another, like CSS-in-JSlang:css/scss/lessIssues affecting CSS, Less or SCSSIssues affecting CSS, Less or SCSSlocked-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:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!
If a standalone Styled Components interpolation is following by a CSS comment, the CSS comment is duplicated in the resulting output.
Prettier 1.15.1
Playground link
# Options (if any): none / defaultsInput:
Output:
Each subsequent format will continue to duplicate all comments, for example formatting that output again results in the following (playground link):
Expected behavior:
Adding a semicolon to the end of the interpolation results in the expected behavior:
However I don't believe a semicolon should be required in this case, given that the interpolation could be the result of a call to
cssor other similar multi-rule mixins.