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

Skip to content

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Nov 8, 2025

Summary

This simply expands what @custom-variant accepts to be a selector list instead of a single selector.

related to #7964 (comment)

Test Plan

Added tests, CI should be green

Docs

@changeset-bot
Copy link

changeset-bot bot commented Nov 8, 2025

🦋 Changeset detected

Latest commit: 53ddb17

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor Author

dyc3 commented Nov 8, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 50977 50977 0
Passed 49764 49764 0
Failed 1171 1171 0
Panics 42 42 0
Coverage 97.62% 97.62% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6320 6320 0
Passed 2106 2106 0
Failed 4214 4214 0
Panics 0 0 0
Coverage 33.32% 33.32% 0.00%

ts/babel

Test result main count This PR count Difference
Total 835 835 0
Passed 742 742 0
Failed 93 93 0
Panics 0 0 0
Coverage 88.86% 88.86% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18813 18813 0
Passed 14065 14065 0
Failed 4747 4747 0
Panics 1 1 0
Coverage 74.76% 74.76% 0.00%

@dyc3 dyc3 requested review from a team November 8, 2025 14:57
@dyc3 dyc3 marked this pull request as ready for review November 8, 2025 14:57
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 8, 2025

Walkthrough

This change updates the Tailwind-related CSS parsing to accept a list of selectors in @custom-variant shorthand. The parser now builds and parses a SelectorList (with proper end-kind and recovery tokens) instead of a single selector, the grammar/codegen entry for TwCustomVariantShorthand was changed to use CssSelectorList, and tests were added demonstrating multi-selector shorthand like @custom-variant cell (th:has(&), td:has(&)). No public API signatures were otherwise altered.

Suggested labels

L-Tailwind

Suggested reviewers

  • ematipico

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and directly summarises the main change: enabling @custom-variant to accept selector lists instead of single selectors.
Description check ✅ Passed The description is related to the changeset, explaining the motivation for expanding @custom-variant to accept selector lists and referencing a related issue.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/tw-fix-custom-variant-shorthand

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b177d9 and 53ddb17.

⛔ Files ignored due to path filters (8)
  • crates/biome_css_factory/src/generated/node_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_factory/src/generated/syntax_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/dark.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-multiple-selectors.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/shadcn-default.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/nodes_mut.rs is excluded by !**/generated/**, !**/generated/** and included by **
📒 Files selected for processing (4)
  • .changeset/stale-windows-strive.md (1 hunks)
  • crates/biome_css_parser/src/syntax/at_rule/tailwind.rs (2 hunks)
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-multiple-selectors.css (1 hunks)
  • xtask/codegen/css.ungram (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/stale-windows-strive.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/biome_css_parser/src/syntax/at_rule/tailwind.rs
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-multiple-selectors.css
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Unions of nodes must start with Any* (e.g., AnyHtmlAttribute)

Applied to files:

  • xtask/codegen/css.ungram
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: autofix
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Parser conformance
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_formatter)
🔇 Additional comments (1)
xtask/codegen/css.ungram (1)

1931-1935: LGTM! Selector list support correctly implemented.

The change from a single selector to CssSelectorList properly enables the shorthand to accept multiple selectors like (.foo, .bar). The grammar structure is valid and consistent with how selector lists are used elsewhere in the file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da70d8b and 0b177d9.

⛔ Files ignored due to path filters (8)
  • crates/biome_css_factory/src/generated/node_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_factory/src/generated/syntax_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/dark.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-multiple-selectors.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/shadcn-default.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/nodes_mut.rs is excluded by !**/generated/**, !**/generated/** and included by **
📒 Files selected for processing (4)
  • .changeset/stale-windows-strive.md (1 hunks)
  • crates/biome_css_parser/src/syntax/at_rule/tailwind.rs (2 hunks)
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-multiple-selectors.css (1 hunks)
  • xtask/codegen/css.ungram (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Unions of nodes must start with Any* (e.g., AnyHtmlAttribute)

Applied to files:

  • xtask/codegen/css.ungram
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/lib.rs : Implement FormatLanguage for HtmlFormatLanguage with associated types: SyntaxLanguage=HtmlLanguage, Context=HtmlFormatContext, FormatRule=FormatHtmlSyntaxNode

Applied to files:

  • crates/biome_css_parser/src/syntax/at_rule/tailwind.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/cst.rs : Create FormatHtmlSyntaxNode in cst.rs implementing FormatRule<HtmlSyntaxNode> and AsFormat/IntoFormat for HtmlSyntaxNode using the provided plumbing

Applied to files:

  • crates/biome_css_parser/src/syntax/at_rule/tailwind.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Parse rules should return ParsedSyntax; return Absent without consuming tokens when the node cannot be predicted

Applied to files:

  • crates/biome_css_parser/src/syntax/at_rule/tailwind.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes for enclosing syntax errors must include the Bogus word (e.g., HtmlBogusAttribute)

Applied to files:

  • crates/biome_css_parser/src/syntax/at_rule/tailwind.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Use p.eat for optional tokens, p.expect for required tokens; use .ok() for optional nodes and .or_add_diagnostic(...) for required nodes

Applied to files:

  • crates/biome_css_parser/src/syntax/at_rule/tailwind.rs
🧬 Code graph analysis (1)
crates/biome_css_parser/src/syntax/at_rule/tailwind.rs (3)
crates/biome_css_syntax/src/generated/nodes.rs (27)
  • syntax (9888-9890)
  • syntax (9936-9938)
  • syntax (9985-9987)
  • syntax (10032-10034)
  • syntax (10083-10085)
  • syntax (10139-10141)
  • syntax (10191-10193)
  • syntax (10246-10248)
  • syntax (10301-10303)
  • syntax (10349-10351)
  • syntax (10400-10402)
  • syntax (10452-10454)
  • syntax (10501-10503)
  • syntax (10549-10551)
  • syntax (10601-10603)
  • syntax (10652-10654)
  • selector (2464-2466)
  • selector (2539-2541)
  • selector (3766-3768)
  • selector (4021-4023)
  • selector (4271-4273)
  • selector (4371-4373)
  • selector (4899-4901)
  • selector (5400-5402)
  • selector (6000-6002)
  • selector (7002-7004)
  • selector (7045-7047)
crates/biome_css_parser/src/syntax/parse_error.rs (3)
  • expected_identifier (9-11)
  • expected_string (50-52)
  • expected_tw_source (243-245)
crates/biome_css_parser/src/syntax/mod.rs (1)
  • parse_regular_identifier (433-435)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_css_parser)
🔇 Additional comments (5)
.changeset/stale-windows-strive.md (1)

1-9: LGTM! Clear documentation.

The changelog entry accurately describes the new functionality with a helpful example.

xtask/codegen/css.ungram (1)

1935-1939: Correct alignment with list-based parsing.

The change from AnyCssSelector to CssSelectorList properly reflects the new support for multiple selectors in shorthand syntax.

crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-multiple-selectors.css (1)

1-3: Good test coverage.

The test cases appropriately exercise both simple selectors and complex pseudo-class expressions with nesting, validating the new list-based parsing.

crates/biome_css_parser/src/syntax/at_rule/tailwind.rs (2)

6-11: Imports correctly updated.

The changes properly replace single-selector parsing with list-based parsing by importing SelectorList and ParseSeparatedList whilst removing the unused expected_selector.


126-142: List-based parsing correctly implemented.

The shorthand parser now constructs a SelectorList with appropriate end and recovery tokens, properly handling comma-separated selectors within parentheses.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 8, 2025

CodSpeed Performance Report

Merging #8041 will not alter performance

Comparing dyc3/tw-fix-custom-variant-shorthand (53ddb17) with main (78011b1)1

Summary

✅ 29 untouched
⏩ 111 skipped2

Footnotes

  1. No successful run was found on main (c09e45c) during the generation of this report, so 78011b1 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 111 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dyc3 dyc3 force-pushed the dyc3/tw-fix-custom-variant-shorthand branch from 0b177d9 to 53ddb17 Compare November 8, 2025 15:45
Copy link
Contributor Author

dyc3 commented Nov 8, 2025

Merge activity

  • Nov 8, 7:43 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Nov 8, 7:44 PM UTC: @dyc3 merged this pull request with Graphite.

@dyc3 dyc3 merged commit beeb7bb into main Nov 8, 2025
19 checks passed
@dyc3 dyc3 deleted the dyc3/tw-fix-custom-variant-shorthand branch November 8, 2025 19:44
@github-actions github-actions bot mentioned this pull request Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Parser Area: parser A-Tooling Area: internal tools L-CSS Language: CSS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants