Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styled-components selection formatting issue #7082

Closed
lekterable opened this issue Dec 2, 2019 · 3 comments
Closed

styled-components selection formatting issue #7082

lekterable opened this issue Dec 2, 2019 · 3 comments
Labels
area:ranges Issues about formatting/ignoring/etc segments of files lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:duplicate Issues that are a duplicate of a previous issue

Comments

@lekterable
Copy link

A quite specific case, because you have to use export const ... syntax and try to format the css parameters inside of a template literal of a given styled-component, but this is also very annoying when using precise-commits to format just the changed lines, as because of this bug 9 spaces of indentation are added instead of 2 whenever you change a single css property.

Prettier 1.19.1

Input:

export const Button = styled.button`
color: blue;
`;

Output (when formatting the selection or running precise-commits):

export const Button = styled.button`
         color: blue;
`;

Output (while formatting the whole file or the whole component - works as expected):

export const Button = styled.button`
  color: blue;
`;

Expected behavior:

export const Button = styled.button`
  color: blue;
`;
@thorn0 thorn0 added the area:ranges Issues about formatting/ignoring/etc segments of files label Dec 2, 2019
@thorn0
Copy link
Member

thorn0 commented Dec 2, 2019

May be a duplicate of #4926, but I'm not sure. Or #3789.

@thorn0 thorn0 added the lang:javascript Issues affecting JS label Dec 2, 2019
@alexander-akait
Copy link
Member

Yes, it is bug #4926

@thorn0
Copy link
Member

thorn0 commented Dec 2, 2019

Duplicate of #4926

@thorn0 thorn0 marked this as a duplicate of #4926 Dec 2, 2019
@thorn0 thorn0 closed this as completed Dec 2, 2019
@thorn0 thorn0 added the type:duplicate Issues that are a duplicate of a previous issue label Dec 2, 2019
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Mar 10, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:ranges Issues about formatting/ignoring/etc segments of files lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:duplicate Issues that are a duplicate of a previous issue
Projects
None yet
Development

No branches or pull requests

3 participants