Skip to content

SCSS lists/maps break with comments #4074

Closed

Description

@jgerigmeyer

Prettier 1.11.0
Playground link

--parser scss

Input:

$my-list:
  'foo', // Foo
  'bar'; // Bar

$my-map: (
  'foo': 1, // Foo
  'bar': 2, // Bar
);

Output:

$my-list: "foo", / / Foo "bar"; // Bar

$my-map: (
  "foo": 1,
  / / Foo "bar": 2,
  / / Bar
);

Expected behavior:

This is similar to #2686 (which has been fixed), but causes syntax errors when lists or maps include inline comments.

Activity

  1. added
    lang:css/scss/less
    on Feb 28, 2018
  2. suchipi commented on Feb 28, 2018

    @suchipi
    Member

    Thanks for the report

  3. added
    priority:high
    scope:dependency
    on Mar 1, 2018
  4. alexander-akait commented on Mar 1, 2018

    @alexander-akait
    Member

    Value parser don't respect // comments, i will send PR

  5. alexander-akait commented on Mar 1, 2018

    @alexander-akait
    Member

    Just information.
    Need also tests:

    $colors: (
        black: (
            primary: #242629,
            lighten-1: #333437,
            lighten-2: #4a4c51,
            lighten-3: #5a5e65
        ),
        white: (
            primary: #fafafa,
            darken-1: #efefef,
            darken-2: #c7cad0,
            darken-3: #979aa0
        )
    )
  6. alexander-akait commented on Mar 1, 2018

    @alexander-akait
    Member

    About above example, we should rewrite all logic around groups 😞 Right now it is very difficult pretty output this structures. I will think how we can do with this. Help welcome 😫

  7. ekfuhrmann commented on Mar 1, 2018

    @ekfuhrmann

    Is it possible to treat SASS maps like JSON for formatting?

  8. alexander-akait commented on Mar 15, 2018

    @alexander-akait
    Member

    @ekfuhrmann yes, but difficult, need rewrite groups logic, i will send PR in this mouth, very busy and no many time on open source (need work for money 😞 )

  9. added
    locked-due-to-inactivity
    on Jul 5, 2018
  10. locked as resolved and limited conversation to collaborators on Jul 5, 2018
  11. added theissue type on Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

lang:css/scss/lesslocked-due-to-inactivitypriority:highscope:dependency

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions