fix inconsistent parsing of injected expressions in styled-components' css#8097
Merged
thorn0 merged 18 commits intoprettier:masterfrom May 7, 2020
Merged
fix inconsistent parsing of injected expressions in styled-components' css#8097thorn0 merged 18 commits intoprettier:masterfrom
thorn0 merged 18 commits intoprettier:masterfrom
Conversation
Member
|
What about this? --parser babelInput: const Header = styled.div`
${something()}
& > ${Child}${Child2}:not(:first-child) {
margin-left:5px;
}
`Output: Error: Couldn't insert all the expressions
at transformCssDoc (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:24233:13)
at Object.embed$3 [as embed] (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:24077:20)
at Object.printSubtree (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16837:30)
at callPluginPrintFunction (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16958:33)
at https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16922:49
at Object.printComments (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16595:21)
at printGenerically (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16922:24)
at FastPath.call (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16715:22)
at printPathNoParens (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:28820:92)
at Object.genericPrint$3 [as print] (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:27330:32) |
Contributor
Author
|
@thorn0 looking into it. thanks for pointing it out. |
Contributor
Author
|
@thorn0 should be working as expected now. |
thorn0
requested changes
Apr 20, 2020
Member
thorn0
left a comment
There was a problem hiding this comment.
Prettier pr-8097
Playground link
--parser babelInput:
styled.div`
font-family: "${a}", "${b}";
`Output:
Error: Couldn't insert all the expressions
at transformCssDoc (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:24233:13)
at Object.embed$3 [as embed] (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:24077:20)
at Object.printSubtree (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16837:30)
at callPluginPrintFunction (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16958:33)
at https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16922:49
at Object.printComments (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16595:21)
at printGenerically (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16922:24)
at FastPath.call (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:16715:22)
at printPathNoParens (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:28831:92)
at Object.genericPrint$3 [as print] (https://deploy-preview-8097--prettier.netlify.app/lib/standalone.js:27341:32)
thorn0
reviewed
Apr 20, 2020
thorn0
reviewed
Apr 20, 2020
thorn0
reviewed
Apr 21, 2020
fisker
reviewed
Apr 21, 2020
thorn0
reviewed
Apr 21, 2020
thorn0
reviewed
Apr 21, 2020
thorn0
approved these changes
Apr 22, 2020
This was
linked to
issues
May 6, 2020
alexander-akait
approved these changes
May 6, 2020
Member
alexander-akait
left a comment
There was a problem hiding this comment.
Hope, we will not break something, CSS-in-JS is our pain 😄
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8095
This fixes this error:
When this is parsed:
docs/directory)changelog_unreleased/*/pr-XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.✨Try the playground for this PR✨