Skip to content

[styled-components] Adds newline in template literal #4355

@joshjg

Description

@joshjg

Prettier 1.12.1
Playground link

Input:

const Example = styled.div`
	border: 1px solid ${({active}) => active ? themeColor.active : themeColor.inactive};
`;

Output:

const Example = styled.div`
  border: 1px solid
    ${({ active }) => (active ? themeColor.active : themeColor.inactive)};
`;

Expected behavior:
Prettier should not add a newline after 'solid' because it changes the resulting string. Something along these lines would be better.

const Example = styled.div`
	border: 1px solid ${({active}) =>
		active ? themeColor.active : themeColor.inactive
	};
`;

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:multiparserIssues with printing one language inside another, like CSS-in-JSlang:css/scss/lessIssues affecting CSS, Less or SCSS

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions