-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Media queries ignore printWidth #6729
Comments
Scenario 2 has nothing to do with the simple/not simple distinction. The thing is Prettier special-cases some hard-coded template literal tags, including Did I answer your question? |
@thorn0 Thanks for the quick response! |
@algomaster99 We recommend turning off all rules that conflict with Prettier. See: https://prettier.io/docs/en/integrating-with-linters.html
|
Thanks @lydell ! |
It's actually a bug. Media queries ignore Prettier 1.18.2 --parser css
--print-width 40 Input: @media only screen and
(min-device-width: 768px) and
(max-device-width: 1024px) {
overflow-x: scroll;
overflow-y: hidden;
} Output: @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
overflow-x: scroll;
overflow-y: hidden;
} |
@thorn0 it is expected, we try to avoid break |
I can't find any such discussion either. Looks like a bug to me. |
@thorn0 hm, what is expected: @media only screen and
(min-device-width: 768px) and
(max-device-width: 1024px) {
overflow-x: scroll;
overflow-y: hidden;
} @media only screen
and (min-device-width: 768px)
and (max-device-width: 1024px) {
overflow-x: scroll;
overflow-y: hidden;
} |
@thorn0 also for me it is not bug, it is feature, we don't break code in this case |
We might want to research how exactly people usually prefer to break media queries, but this expression can be even longer and not breaking it doesn't make sense to me. |
@thorn0 usually |
Let's just keep the issue open for now. |
Prettier 1.18.2
Playground link
Scenario 1
Input:
Output:
Expected behavior:
As expected.
Scenario 2
Input:
Output:
Expected behavior:
Should have left it multi-line
Why is there an inconsistent breaking of template literals? When does it break and when not? Referring to this PR - #5979, what is meant by "simple template literals"?
The text was updated successfully, but these errors were encountered: