-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Formatting incorrect using styled-component component selector pattern #7826
Copy link
Copy link
Closed
Copy link
Labels
area: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 SCSSlang:javascriptIssues affecting JSIssues affecting JSlocked-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.
Metadata
Metadata
Assignees
Labels
area: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 SCSSlang:javascriptIssues affecting JSIssues affecting JSlocked-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.
Prettier 2.0.1
Playground link
Input:
Output:
Expected behavior:
When using the component selector pattern from styled-components, I am seeing an issue with the formatting of the output CSS. This above is a slightly modified example from the documentation. Note that if I included an
&to the selector (before the curly brace) it will format correctly (e.g.,${Link}:hover &).The examples I am seeing in my own application are being formatted:
All of which I would expect to break styling behavior.
Love the new update, though! The Prettier team must have worked incredibly hard to make so many impressive improvements.
Thank you for your time.