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

📝 css formatter adds single quotes on @charset #4384

Closed
1 task done
Barsnes opened this issue Oct 25, 2024 · 2 comments · Fixed by #4404
Closed
1 task done

📝 css formatter adds single quotes on @charset #4384

Barsnes opened this issue Oct 25, 2024 · 2 comments · Fixed by #4404
Assignees
Labels
A-Formatter Area: formatter L-CSS Language: CSS S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@Barsnes
Copy link

Barsnes commented Oct 25, 2024

Environment information

CLI:
  Version:                      1.9.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v22.3.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/4.2.2"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Formatter:
  Format with errors:           true
  Indent style:                 Space
  Indent width:                 2
  Line ending:                  Lf
  Line width:                   80
  Attribute position:           Auto
  Bracket spacing:              BracketSpacing(true)
  Ignore:                       []
  Include:                      []

JavaScript Formatter:
  Enabled:                      true
  JSX quote style:              Single
  Quote properties:             AsNeeded
  Trailing commas:              All
  Semicolons:                   Always
  Arrow parentheses:            Always
  Bracket spacing:              unset
  Bracket same line:            false
  Quote style:                  Single
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Attribute position:           unset

JSON Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Trailing Commas:              unset

CSS Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Quote style:                  Single

GraphQL Formatter:
  Enabled:                      false
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Bracket spacing:              unset
  Quote style:                  unset

Workspace:
  Open Documents:               0

Configuration

{
  "css": {
    "formatter": {
      "enabled": true,
      "quoteStyle": "single"
    }
  },
}

Playground link

https://github.com/Barsnes/biome-charset-quotes

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Barsnes Barsnes added the S-Needs triage Status: this issue needs to be triaged label Oct 25, 2024
@Barsnes
Copy link
Author

Barsnes commented Oct 25, 2024

When you run biome check in the repo, this is what the formatter outputs:

  × Formatter would have printed the following content:

    1   │ - @charset·"UTF-8";␍
    2   │ - ␍
    3   │ - [data-mode="dark"]·{␍
    4   │ - ··color:·black;␍
    5   │ - }
      1 │ + @charset·'UTF-8';
      2 │ +
      3 │ + [data-mode='dark']·{
      4 │ + ··color:·black;
      5 │ + }
      6 │ +

@charset is invalid with single quotes, and this at rule should always have double quotes.
I suggest overriding the setting for css.formatter.quoteStyle when the formatter encounters a charset at rule.

MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/@charset#valid_and_invalid_charset_declarations

@ematipico ematipico added A-Formatter Area: formatter L-CSS Language: CSS S-Bug-confirmed Status: report has been confirmed as a valid bug labels Oct 25, 2024
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Oct 25, 2024
@fireairforce
Copy link
Member

i will fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter L-CSS Language: CSS S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants