-
-
Notifications
You must be signed in to change notification settings - Fork 760
fix(parse/css/tailwind): make @custom-variant accept selector lists
#8041
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
Conversation
🦋 Changeset detectedLatest commit: 53ddb17 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
WalkthroughThis change updates the Tailwind-related CSS parsing to accept a list of selectors in Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-10-15T09:24:31.042ZApplied to files:
⏰ 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)
🔇 Additional comments (1)
Comment |
There was a problem hiding this 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
⛔ Files ignored due to path filters (8)
crates/biome_css_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_factory/src/generated/syntax_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/dark.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-multiple-selectors.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/shadcn-default.css.snapis excluded by!**/*.snapand included by**crates/biome_css_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/nodes_mut.rsis 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
AnyCssSelectortoCssSelectorListproperly 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
SelectorListandParseSeparatedListwhilst removing the unusedexpected_selector.
126-142: List-based parsing correctly implemented.The shorthand parser now constructs a
SelectorListwith appropriate end and recovery tokens, properly handling comma-separated selectors within parentheses.
CodSpeed Performance ReportMerging #8041 will not alter performanceComparing Summary
Footnotes
|
0b177d9 to
53ddb17
Compare
Summary
This simply expands what
@custom-variantaccepts to be a selector list instead of a single selector.related to #7964 (comment)
Test Plan
Added tests, CI should be green
Docs