Skip to content

Unexpected trailing comma in comments for scss file #15193

@lanzhi-lee

Description

@lanzhi-lee

Prettier 3.0.0
Playground link

--parser scss

Input:

@mixin responsive() {
  // some code
}

.test {
  @include responsive(
    (
      'margin-top': (
        5px,
        v4(6),
        v4(6),
        v4(6),
        6px,
      ),
      'font-size': (
        v1(12),
        v2(16),
        v4(18),
        v4(18),
        18px,
      ),
      // 'line-height': (v1(20), v2(36), v4(36), 36px, 36px),
      // 'height': (v1(20), v2(30), v4(30), 30px, 30px),
    )
  );
}

Output:

Whenever I press the formatting button, Prettier adds a comma at the end of this line
image

@mixin responsive() {
  // some code
}

.test {
  @include responsive(
    (
      "margin-top": (
        5px,
        v4(6),
        v4(6),
        v4(6),
        6px,
      ),
      "font-size": (
        v1(12),
        v2(16),
        v4(18),
        v4(18),
        18px,
      ),
      // 'line-height': (v1(20), v2(36), v4(36), 36px, 36px),
      // 'height': (v1(20), v2(30), v4(30), 30px, 30px),,
    )
  );
}

Expected behavior:

as mentioned above

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions