Skip to content

🐛 CSS parser with tailwindDirectives does not parse @plugin w/ parameters, biome 1.3.0 #7860

@tony

Description

@tony

Environment information

> [email protected] biome /home/user/project/packages/react
> biome rage

CLI:
  Version:                      2.3.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v24.10.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         pnpm/10.19.0

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         /home/user/project/biome.jsonc
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false

Workspace:
  Open Documents:               0

What happened?

After upgrading from 1.2.7 -> 1.3.0 and adding css.parser.tailwindDirectives, existing Tailwind CSS v4 @plugin code isn't parsed by biome.

Support for @plugin w/ params existing in Tailwind CSS v4

It's practically undocumented. No consensus.

It's tested in the codebase itself:

Example on Biome Playground

https://biomejs.dev/playground/?cssModules=true&code=QABwAGwAdQBnAGkAbgAgACIAbQB5AC0AdABhAGkAbAB3AGkAbgBkAC0AcABsAHUAZwBpAG4AIgAgAHsACgAgACAALQAtAG0AeQAtAHYAYQByAGkAYQBiAGwAZQA6ACAAIgBGAGEAdgBvAHIAaQB0AGUAIAB2AGEAcgBpAGEAYgBsAGUAIgA7AAoAfQA%3D&language=css

Example

@plugin "my-tailwind-plugin" {
  --my-variable: "Favorite variable";
}

Console output

/main.css:2:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ expected `;` but instead found `{`
  
    1 │ /* Example 3: Only JavaScript with minimal shades for performance */
  > 2 │ @plugin "my-tailwind-plugin" {
      │                              ^
    3 │   --my-variable: "Favorite variable";
    4 │ }
  
  ℹ Remove {
  
/main.css:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ Unexpected value or character.
  
    1 │ /* Example 3: Only JavaScript with minimal shades for performance */
    2 │ @plugin "my-tailwind-plugin" {
  > 3 │   --my-variable: "Favorite variable";
      │                  ^^^^^^^^^^^^^^^^^^^
    4 │ }
  
  ℹ Expected one of:
  
  - hover
  - focus
  - active
  - first-child
  - last-child
  - nth-child
  - nth-last-child
  - first-of-type
  - last-of-type
  - nth-of-type
  - nth-last-of-type
  - only-child
  - only-of-type
  - checked
  - disabled
  - enabled
  - required
  - optional
  - valid
  - invalid
  - in-range
  - out-of-range
  - read-only
  - read-write
  - placeholder-shown
  - default
  - checked
  - indeterminate
  - blank
  - empty
  - root
  - target
  - lang
  - not
  - is
  - where
  - fullscreen
  - link
  - visited
  - any-link
  - local-link
  - scope
  - state
  - current
  - past
  - future
  
/main.css:3:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ expected `,` but instead found `;`
  
    1 │ /* Example 3: Only JavaScript with minimal shades for performance */
    2 │ @plugin "my-tailwind-plugin" {
  > 3 │   --my-variable: "Favorite variable";
      │                                     ^
    4 │ }
  
  ℹ Remove ;

Similar TailwindCSS v4 CSS configuration errors introduced in 1.3.0

Expected result

TailwindCSS v4 @plugin directives should parameters the same as it did in 1.2.7.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-ParserArea: parserL-CSSLanguage: CSSS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions