-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
CSS in JS crashes with variable wrapped in quotes #5219
Copy link
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 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.
Description
Prettier 1.16.4
Playground link
--parser babelInput:
import { css } from 'emotion';
const pathToFont = '/some/font';
const someStyle = css`
src: "${pathToFont}";
`;Output:
Error: Couldn't insert all the expressions
at transformCssDoc (https://prettier.io/lib/standalone.js:22171:11)
at Object.embed$4 [as embed] (https://prettier.io/lib/standalone.js:22011:18)
at Object.printSubtree (https://prettier.io/lib/standalone.js:15781:31)
at callPluginPrintFunction (https://prettier.io/lib/standalone.js:15898:29)
at https://prettier.io/lib/standalone.js:15863:16
at Object.printComments (https://prettier.io/lib/standalone.js:15586:17)
at printGenerically (https://prettier.io/lib/standalone.js:15862:22)
at FastPath.call (https://prettier.io/lib/standalone.js:15700:16)
at printPathNoParens (https://prettier.io/lib/standalone.js:25178:91)
at Object.genericPrint$3 [as print] (https://prettier.io/lib/standalone.js:23541:28)Expected behavior:
For Prettier not to crash 😅
This is a reduced example, real world case is a @font-face declaration. I do think the quotes are not necessary, but Prettier shouldn't crash, it's valid CSS
Reactions are currently unavailable
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 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.