Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CSS: Prettier wrongly adds new semicolons to at-rule preludes #8201

@tomhodgins

Description

@tomhodgins

Prettier 2.0.5
Playground link

Input:

@a b({"c": d}) {}

Output:

@a b( {
  "c":d ;
}
) {
}

Expected behavior:

What's breaking things is that Prettier is introducing a totally new ; character after the d that previously didn't exist anywhere. I'm not sure why it does this, but it's causing enough breakage that I'm going to have to disable Prettier in some workflows unless/until this is fixed.

Note: this doesn't seem to be a PostCSS parsing error - you can easily generate a PostCSS parsing error with input like a { --a: {a} } - my example above seems to be parsable by PostCSS but broken in Prettier, and so that's why I'm reporting here instead of to PostCSS

Also, if it helps, this is not problematic: @a b({c: d}) {}, but when you make either of those innermost tokens into a string (e.g. @a b({"c": d}) {} or @a b({c: "d"}) {}) Prettier seems to have an issue.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:css/scss/lessIssues affecting CSS, Less or SCSSscope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions