Skip to content

prettier add comma break Scss "if" syntax logic #18465

@keatkeat87

Description

@keatkeat87

Prettier 3.7.4
Playground link

--parser scss

Input:

$value: if(sass(false): 1; else: -1);

body {
  width: $value + 5px
}

Output:

$value: if(
  sass(false): 1; else: -1,
);

body {
  width: $value + 5px;   /* css output will be -15px */
}

Expected output:

$value: if(
  sass(false): 1; else: -1
);

body {
  width: $value + 5px;   /* css output will be 4px */
}

Why?
After -1 should not have a comma.
It will affect the SCSS compile results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions