* fix inconsistent parsing of styled-components' css * fix for multiple placeholders in one line * add test for multiple placeholders in one line * add changelog for the pr * fix multi part placeholders * make placeholderMatch regex stricter * add tests for all fixed cases * update changelog * fix changelog link * do not edit the original doc.parts * fix changelog output * simplify logic * remove unnecessary `tokens` array * simplify logic even more * changes according to review * finalize * update snapshots after merge Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
898 B
898 B
Fix inconsistent parsing of injected expressions in styled-components template literals (#8097 by @thecodrr)
// Input
const SingleConcat = styled.div`
${something()}
& > ${Child}:not(:first-child) {
margin-left:5px;
}
`
const MultiConcats = styled.div`
${something()}
& > ${Child}${Child2}:not(:first-child) {
margin-left:5px;
}
`
const SeparatedConcats = styled.div`
font-family: "${a}", "${b}";
`
// Prettier stable -- same as input
// Prettier master
const SingleConcat = styled.div`
${something()}
& > ${Child}:not(:first-child) {
margin-left: 5px;
}
`;
const MultiConcats = styled.div`
${something()}
& > ${Child}${Child2}:not(:first-child) {
margin-left: 5px;
}
`;
const SeparatedConcats = styled.div`
font-family: "${a}", "${b}";
`;