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

SCSS: function arguments on different lines in maps #9128

Open
TheComputerM opened this issue Sep 2, 2020 · 5 comments
Open

SCSS: function arguments on different lines in maps #9128

TheComputerM opened this issue Sep 2, 2020 · 5 comments
Assignees
Labels
lang:css/scss/less Issues affecting CSS, Less or SCSS type:bug Issues identifying ugly output, or a defect in the program

Comments

@TheComputerM
Copy link

Prettier 2.1.1
Playground link

--parser scss

Input:

$display-breakpoints: map-deep-merge(
  (
    "print-only": "only print",
    "screen-only": "only screen",
    "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})",
    "sm-only": "only screen and (min-width: #{map-get($grid-breakpoints, "sm")}) and (max-width: #{map-get($grid-breakpoints, "md")-1})",
    "sm-and-down": "only screen and (max-width: #{map-get($grid-breakpoints, "md")-1})",
    "sm-and-up": "only screen and (min-width: #{map-get($grid-breakpoints, "sm")})",
    "md-only": "only screen and (min-width: #{map-get($grid-breakpoints, "md")}) and (max-width: #{map-get($grid-breakpoints, "lg")-1})",
    "md-and-down": "only screen and (max-width: #{map-get($grid-breakpoints, "lg")-1})",
    "md-and-up": "only screen and (min-width: #{map-get($grid-breakpoints, "md")})",
    "lg-only": "only screen and (min-width: #{map-get($grid-breakpoints, "lg")}) and (max-width: #{map-get($grid-breakpoints, "xl")-1})",
    "lg-and-down": "only screen and (max-width: #{map-get($grid-breakpoints,"xl")-1})",
    "lg-and-up": "only screen and (min-width: #{map-get($grid-breakpoints,"lg")})",
    "xl-only": "only screen and (min-width: #{map-get($grid-breakpoints,"xl")})",
  ),
  $display-breakpoints
);

Output:

$display-breakpoints: map-deep-merge(
  (
    "print-only": "only print",
    "screen-only": "only screen",
    "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, " sm
      ")-1})",
    "sm-only": "only screen and (min-width: #{map-get($grid-breakpoints, " sm
      ")}) and (max-width: #{map-get($grid-breakpoints, " md ")-1})",
    "sm-and-down": "only screen and (max-width: #{map-get($grid-breakpoints, "
      md ")-1})",
    "sm-and-up": "only screen and (min-width: #{map-get($grid-breakpoints, " sm
      ")})",
    "md-only": "only screen and (min-width: #{map-get($grid-breakpoints, " md
      ")}) and (max-width: #{map-get($grid-breakpoints, " lg ")-1})",
    "md-and-down": "only screen and (max-width: #{map-get($grid-breakpoints, "
      lg ")-1})",
    "md-and-up": "only screen and (min-width: #{map-get($grid-breakpoints, " md
      ")})",
    "lg-only": "only screen and (min-width: #{map-get($grid-breakpoints, " lg
      ")}) and (max-width: #{map-get($grid-breakpoints, " xl ")-1})",
    "lg-and-down": "only screen and (max-width: #{map-get($grid-breakpoints," xl
      ")-1})",
    "lg-and-up": "only screen and (min-width: #{map-get($grid-breakpoints," lg
      ")})",
    "xl-only": "only screen and (min-width: #{map-get($grid-breakpoints," xl
      ")})",
  ),
  $display-breakpoints
);

Expected behavior:

@TheComputerM
Copy link
Author

This results in wrong code. There should not be spaces between quotes.

@alexander-akait alexander-akait added lang:css/scss/less Issues affecting CSS, Less or SCSS type:bug Issues identifying ugly output, or a defect in the program labels Sep 2, 2020
@TheComputerM
Copy link
Author

I think this somewhat looks like: #7419. Are they the same?

@alexander-akait
Copy link
Member

@TheComputerM No, it is another issue

@agamkrbit
Copy link
Contributor

can I pick this ?

@fisker
Copy link
Sponsor Member

fisker commented Sep 10, 2020

can I pick this ?

Sure, thanks.

fisker added a commit that referenced this issue Nov 24, 2022
Co-authored-by: agamkrbit <agamkrbit123@gmail.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
medikoo pushed a commit to medikoo/prettier-elastic that referenced this issue Jan 4, 2024
prettier#9184)

Co-authored-by: agamkrbit <agamkrbit123@gmail.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:css/scss/less Issues affecting CSS, Less or SCSS type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

4 participants