biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
14.36k stars 445 forks source link

📝 Unwanted zero added before .<number> in CSS #4025

Open yoavbls opened 2 days ago

yoavbls commented 2 days ago

Unwanted zero is added when we're using one of our utils so

.div {
  margin-left: theme(spacing.2);  
}

become:

.div {
  margin-left: theme(spacing 0.2);  
}

which is not the intention and doesn't happen with Prettier or VSCode default formatter.

Thank you very much for your amazing work on Biome 🙏🏼

Environment information

CLI:
  Version:                      1.9.2
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.10.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/4.5.0"

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

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

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

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:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Bracket spacing:              unset
  Quote style:                  unset

Workspace:
  Open Documents:               0

Configuration

{
  "css": {
    "linter": {
      "enabled": false
    },
    "formatter": {
      "enabled": true,
      "quoteStyle": "single"
    },
    "parser": {
      "cssModules": true,
      "allowWrongLineComments": true
    }
  }
}

Playground link

https://biomejs.dev/playground/?files.main.css=LgBkAGkAdgAgAHsACgAgACAAbQBhAHIAZwBpAG4ALQBsAGUAZgB0ADoAIAB0AGgAZQBtAGUAKABzAHAAYQBjAGkAbgBnAC4AMgApADsAIAAgAAoAfQA%3D

Code of Conduct

ematipico commented 2 days ago

The file contains invalid CSS syntax. I suppose you're using tailwind, which uses invalid/proposed syntax that isn't official yet

yoavbls commented 2 days ago

Yes, it is utility related to tailwind. I would not treat [a-zA-Z].\d as a number but I understand it could happen because of the invalid syntax and out of scope. Thank you either way 🙏🏼