-
-
Notifications
You must be signed in to change notification settings - Fork 760
fix(parse/css/tailwind): make @custom-variant accept at-rules like @media
#8042
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: f95c88a 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. |
0b177d9 to
53ddb17
Compare
bd32f77 to
5bd2772
Compare
53ddb17 to
beeb7bb
Compare
5bd2772 to
72f4950
Compare
72f4950 to
0cea473
Compare
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
WalkthroughThis pull request refactors CSS at-rule handling by introducing a declarator-based architecture. The parser is updated with new functions to separately parse at-rule keywords and parameters (declarators) from their associated blocks. Corresponding formatter modules are created for each declarator type following a consistent FormatNodeRule pattern. The Tailwind Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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: 2
🧹 Nitpick comments (2)
crates/biome_css_formatter/src/generated.rs (2)
79-110: Both conditional/declaration block Declarator adapters are wired properlyAll good functionally. Tiny nit: codegen sometimes emits
FormatRefWithRule :: new(extra spaces) and mixes multi/one‑liners; consider normalising for tidy diffs.Also applies to: 111-142
508-520: Ultra‑long one‑liner impl — prefer multiline for readabilityThis single‑line impl can be hard to review and may trip line‑length policies. Suggest adjusting the generator to emit the same multiline shape used elsewhere.
CodSpeed Performance ReportMerging #8042 will not alter performanceComparing Summary
Footnotes
|
|
All of the lint rules that have regressions use the semantic model. So this change caused a regression in the css semantic model.
|
9489e76 to
2c2bba1
Compare
2c2bba1 to
b7acb1f
Compare
b7acb1f to
f95c88a
Compare
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: 0
🧹 Nitpick comments (1)
crates/biome_css_formatter/src/generated.rs (1)
444-456: Codegen style is mixed (single‑line vs multi‑line impls).Not a blocker, but consider normalising the generator to emit one style to reduce future diff churn.
Also applies to: 1063-1075, 1714-1726, 5812-5824
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (59)
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_formatter/tests/specs/prettier/css/comments/at-rules.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_color_profile_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_and_query_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_or_query_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_style_not_query.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_style_query_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_counter_style_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_font_face_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_font_palette_values_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_layer_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_media_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_property_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_scope_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_supports/at_rule_supports_and_condition_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_supports/at_rule_supports_invalid_after_support_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_supports/at_rule_supports_not_condition_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_supports/at_rule_supports_or_condition_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/at_rule/conditional_at_rule_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/error/property/unicode_range_error.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_color_profile.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_container.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_container_complex.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_counter_style.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_font_face.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_font_palette_values.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_layer.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_media.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_media_complex.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_page_complex.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_position_try.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_property.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_scope.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_starting_style.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_supports.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_supports_complex.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_view_transition.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/grit_metavariable/metavar.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/nesting/conditional_at_rule.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/nesting/nesting.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/property/unicode_range.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-at-rules-simple.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-at-rules.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-media.css.snapis excluded by!**/*.snapand included by**crates/biome_css_syntax/src/generated/kind.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/macros.rsis excluded by!**/generated/**,!**/generated/**and 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**crates/biome_graphql_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_grit_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_js_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_json_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_markdown_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_tailwind_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_yaml_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**
📒 Files selected for processing (48)
.changeset/forty-nails-carry.md(1 hunks)crates/biome_css_formatter/src/css/any/at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/any/mod.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/container_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/font_palette_values_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/mod.rs(7 hunks)crates/biome_css_formatter/src/css/auxiliary/position_try_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/property_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/supports_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/auxiliary/view_transition_at_rule_declarator.rs(1 hunks)crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/container_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/font_face_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/media_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/property_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/scope_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/supports_at_rule.rs(1 hunks)crates/biome_css_formatter/src/css/statements/view_transition_at_rule.rs(1 hunks)crates/biome_css_formatter/src/generated.rs(15 hunks)crates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.rs(1 hunks)crates/biome_css_formatter/src/tailwind/any/mod.rs(1 hunks)crates/biome_css_parser/src/syntax/at_rule/color_profile.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/container/mod.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/counter_style.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/font_face.rs(1 hunks)crates/biome_css_parser/src/syntax/at_rule/font_palette_values.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/media.rs(1 hunks)crates/biome_css_parser/src/syntax/at_rule/mod.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/position_try.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/property.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/scope.rs(1 hunks)crates/biome_css_parser/src/syntax/at_rule/starting_style.rs(1 hunks)crates/biome_css_parser/src/syntax/at_rule/supports/mod.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/tailwind.rs(2 hunks)crates/biome_css_parser/src/syntax/at_rule/view_transition.rs(1 hunks)crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-at-rules-simple.css(1 hunks)crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-at-rules.css(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (15)
- crates/biome_css_formatter/src/css/auxiliary/container_at_rule_declarator.rs
- crates/biome_css_formatter/src/css/statements/font_face_at_rule.rs
- crates/biome_css_parser/src/syntax/at_rule/font_face.rs
- crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-at-rules-simple.css
- crates/biome_css_formatter/src/css/statements/property_at_rule.rs
- crates/biome_css_formatter/src/css/auxiliary/supports_at_rule_declarator.rs
- crates/biome_css_formatter/src/css/statements/supports_at_rule.rs
- crates/biome_css_formatter/src/css/auxiliary/font_palette_values_at_rule_declarator.rs
- crates/biome_css_parser/src/syntax/at_rule/position_try.rs
- crates/biome_css_formatter/src/css/auxiliary/position_try_at_rule_declarator.rs
- crates/biome_css_formatter/src/css/statements/view_transition_at_rule.rs
- crates/biome_css_formatter/src/css/auxiliary/view_transition_at_rule_declarator.rs
- crates/biome_css_parser/src/syntax/at_rule/counter_style.rs
- crates/biome_css_formatter/src/css/auxiliary/property_at_rule_declarator.rs
- crates/biome_css_formatter/src/css/statements/container_at_rule.rs
🧰 Additional context used
🧠 Learnings (25)
📚 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.rscrates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/media_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/statements/counter_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/mod.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.rs
📚 Learning: 2025-10-25T07:22:18.540Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7852
File: crates/biome_css_parser/src/syntax/property/mod.rs:161-168
Timestamp: 2025-10-25T07:22:18.540Z
Learning: In the Biome CSS parser, lexer token emission should not be gated behind parser options like `is_tailwind_directives_enabled()`. The lexer must emit correct tokens regardless of parser options to enable accurate diagnostics and error messages when the syntax is used incorrectly.
Applied to files:
.changeset/forty-nails-carry.mdcrates/biome_css_parser/src/syntax/at_rule/media.rscrates/biome_css_parser/src/syntax/at_rule/mod.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import and use the `FormatNode` trait for AST nodes
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/tailwind/any/mod.rscrates/biome_css_formatter/src/css/any/mod.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/media_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/statements/counter_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/mod.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.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_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/media_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/statements/counter_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Implement the `Format` trait for your node type and use `JsFormatter` with `write!`/`format_args!` to define formatting
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/media_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/statements/counter_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.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/**/*.rs : After generation, remove usages of `format_verbatim_node` and implement real formatting with biome_formatter utilities
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/tailwind/any/mod.rscrates/biome_css_formatter/src/css/any/mod.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/media_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/statements/counter_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/mod.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.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/context.rs : Create HtmlFormatContext in context.rs with comments and source_map fields and implement FormatContext and CstFormatContext
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When a token is mandatory and present in the AST, use the AST-provided token (e.g., `node.l_paren_token().format()`) instead of emitting a static token
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/media_at_rule.rscrates/biome_css_parser/src/syntax/at_rule/media.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/statements/counter_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.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/lib.rs : Add the provided AsFormat, IntoFormat, and iterator plumbing code to lib.rs
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/tailwind/any/mod.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.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/tests/language.rs : Create tests/language.rs defining `HtmlTestFormatLanguage` and implement the TestFormatLanguage trait
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.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/lib.rs : Expose a documented public function `format_node(options: HtmlFormatOptions, root: &HtmlSyntaxNode) -> FormatResult<Formatted<HtmlFormatContext>>` delegating to `biome_formatter::format_node`
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/media_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/statements/counter_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.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/lib.rs : Define the HtmlFormatter type alias: `type HtmlFormatter<'buf> = Formatter<'buf, HtmlFormatContext>;`
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/any/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use `dbg_write!` to debug and inspect the emitted IR during formatting
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.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/view_transition.rscrates/biome_css_parser/src/syntax/at_rule/starting_style.rscrates/biome_css_parser/src/syntax/at_rule/container/mod.rscrates/biome_css_parser/src/syntax/at_rule/media.rscrates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_parser/src/syntax/at_rule/scope.rscrates/biome_css_parser/src/syntax/at_rule/supports/mod.rscrates/biome_css_parser/src/syntax/at_rule/font_palette_values.rscrates/biome_css_parser/src/syntax/at_rule/property.rscrates/biome_css_parser/src/syntax/at_rule/color_profile.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/comments.rs : Define HtmlCommentStyle implementing CommentStyle in comments.rs
Applied to files:
crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/scope_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/counter_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/mod.rscrates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to fix code; if a mandatory token/node is missing, return `None` instead
Applied to files:
crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rscrates/biome_css_formatter/src/tailwind/any/mod.rscrates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/generated.rscrates/biome_css_formatter/src/tailwind/any/custom_variant_shorthand.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/**/*.rs : Do not copy or clone data between module graph entries (including behind Arc). Each module must avoid holding duplicated data from another module to enable simple invalidation.
Applied to files:
crates/biome_css_formatter/src/tailwind/any/mod.rscrates/biome_css_formatter/src/css/any/mod.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Applied to files:
crates/biome_css_formatter/src/tailwind/any/mod.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/tests/spec_tests.rs : In tests/spec_tests.rs, generate tests with `tests_macros::gen_tests! {"tests/specs/html/**/*.html", crate::spec_test::run, ""}`
Applied to files:
crates/biome_css_formatter/src/tailwind/any/mod.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/src/*_kinds_src.rs : Add src/<lang>_kinds_src.rs under xtask/codegen that returns a static KindSrc
Applied to files:
crates/biome_css_formatter/src/tailwind/any/mod.rscrates/biome_css_formatter/src/css/any/mod.rscrates/biome_css_formatter/src/css/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For non-mandatory tokens, use the provided helper constructors (e.g., `token`, `space_token`, `dynamic_token`)
Applied to files:
crates/biome_css_formatter/src/tailwind/any/mod.rscrates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_formatter/src/css/statements/position_try_at_rule.rscrates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rscrates/biome_css_formatter/src/css/statements/starting_style_at_rule.rscrates/biome_css_formatter/src/generated.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/crates/**/src/lexer/mod.rs : Create a lexer module at crates/<parser_crate>/src/lexer/mod.rs
Applied to files:
crates/biome_css_formatter/src/css/any/mod.rscrates/biome_css_formatter/src/css/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/{type_info,local_inference,resolver,flattening}.rs : Avoid recursive type structures and cross-module Arcs; represent links between types using TypeReference and TypeData::Reference.
Applied to files:
crates/biome_css_formatter/src/css/any/mod.rscrates/biome_css_formatter/src/css/auxiliary/mod.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 : Bogus nodes must be part of a variant/union (e.g., AnyHtmlAttribute includes HtmlBogusAttribute)
Applied to files:
crates/biome_css_parser/src/syntax/at_rule/mod.rscrates/biome_css_formatter/src/css/auxiliary/mod.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/mod.rs
🧬 Code graph analysis (19)
crates/biome_css_parser/src/syntax/at_rule/tailwind.rs (1)
crates/biome_css_parser/src/syntax/at_rule/mod.rs (1)
parse_at_rule_declarator(193-204)
crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rs (1)
crates/biome_css_syntax/src/generated/nodes.rs (1)
font_face_token(1904-1906)
crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs (2)
crates/biome_css_syntax/src/generated/nodes.rs (1)
scope_token(5887-5889)crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs (1)
crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_formatter/src/css/any/at_rule_declarator.rs (2)
packages/@biomejs/js-api/src/common.ts (1)
FormatResult(30-39)crates/biome_css_formatter/src/css/any/at_rule.rs (1)
FormatAnyCssAtRule(6-6)
crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs (2)
crates/biome_css_syntax/src/generated/nodes.rs (1)
color_profile_token(545-547)crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_formatter/src/css/statements/scope_at_rule.rs (2)
packages/@biomejs/js-api/src/common.ts (1)
FormatResult(30-39)crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_parser/src/syntax/at_rule/mod.rs (15)
crates/biome_css_parser/src/syntax/at_rule/color_profile.rs (2)
parse_color_profile_at_rule(19-30)parse_color_profile_at_rule_declarator(33-59)crates/biome_css_parser/src/syntax/at_rule/container/mod.rs (2)
parse_container_at_rule(68-79)parse_container_at_rule_declarator(82-108)crates/biome_css_parser/src/syntax/at_rule/counter_style.rs (2)
parse_counter_style_at_rule(19-30)parse_counter_style_at_rule_declarator(33-56)crates/biome_css_parser/src/syntax/at_rule/font_face.rs (2)
parse_font_face_at_rule(15-26)parse_font_face_at_rule_declarator(29-38)crates/biome_css_parser/src/syntax/at_rule/font_palette_values.rs (2)
parse_font_palette_values_at_rule(22-33)parse_font_palette_values_at_rule_declarator(36-59)crates/biome_css_parser/src/syntax/at_rule/keyframes.rs (1)
parse_keyframes_at_rule(66-86)crates/biome_css_parser/src/syntax/at_rule/media.rs (2)
parse_media_at_rule(23-34)parse_media_at_rule_declarator(37-51)crates/biome_css_parser/src/syntax/at_rule/page.rs (1)
parse_page_at_rule(26-39)crates/biome_css_parser/src/syntax/at_rule/position_try.rs (2)
parse_position_try_at_rule(22-33)parse_position_try_at_rule_declarator(36-59)crates/biome_css_parser/src/syntax/at_rule/property.rs (2)
parse_property_at_rule(21-32)parse_property_at_rule_declarator(35-58)crates/biome_css_parser/src/syntax/at_rule/scope.rs (2)
parse_scope_at_rule(19-30)parse_scope_at_rule_declarator(33-45)crates/biome_css_parser/src/syntax/at_rule/starting_style.rs (2)
parse_starting_style_at_rule(43-54)parse_starting_style_at_rule_declarator(57-66)crates/biome_css_parser/src/syntax/at_rule/supports/mod.rs (2)
parse_supports_at_rule(61-72)parse_supports_at_rule_declarator(75-92)crates/biome_css_parser/src/syntax/at_rule/view_transition.rs (2)
parse_view_transition_at_rule(16-27)parse_view_transition_at_rule_declarator(30-39)crates/biome_css_parser/src/syntax/parse_error.rs (1)
expected_any_at_rule(185-210)
crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs (3)
packages/@biomejs/js-api/src/common.ts (1)
FormatResult(30-39)crates/biome_css_syntax/src/generated/nodes.rs (2)
media_token(3250-3252)queries(3253-3255)crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs (1)
crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs (1)
crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_parser/src/syntax/at_rule/font_palette_values.rs (1)
crates/biome_css_parser/src/syntax/mod.rs (1)
parse_dashed_identifier(507-515)
crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs (1)
crates/biome_css_syntax/src/generated/nodes.rs (1)
starting_style_token(6131-6133)
crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs (1)
crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs (1)
crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_parser/src/syntax/at_rule/property.rs (1)
crates/biome_css_parser/src/syntax/mod.rs (1)
parse_dashed_identifier(507-515)
crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs (2)
crates/biome_css_syntax/src/generated/nodes.rs (1)
counter_style_token(1370-1372)crates/biome_formatter/src/builders.rs (1)
space(606-608)
crates/biome_css_parser/src/syntax/at_rule/color_profile.rs (1)
crates/biome_css_parser/src/syntax/mod.rs (1)
parse_custom_identifier(471-473)
crates/biome_css_formatter/src/generated.rs (1)
crates/biome_css_syntax/src/generated/nodes.rs (16)
fmt(10476-10490)fmt(10524-10538)fmt(10572-10587)fmt(10621-10634)fmt(10668-10685)fmt(10719-10741)fmt(10775-10793)fmt(10827-10848)fmt(10882-10903)fmt(10937-10951)fmt(10985-11002)fmt(11036-11050)fmt(11084-11101)fmt(11135-11150)fmt(11184-11198)fmt(11232-11250)
⏰ 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). (9)
- GitHub Check: Test Node.js API
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_analyze)
🔇 Additional comments (34)
crates/biome_css_parser/src/syntax/at_rule/supports/mod.rs (1)
61-92: Clean declarator refactor—LGTM!The separation of declarator parsing (lines 74–92) from the main at-rule flow (lines 61–72) is well-structured. The new
parse_supports_at_rule_declaratorcorrectly returnsAbsentwithout consuming tokens when not at a@supportstoken (lines 76–78), and the nested AST (CSS_SUPPORTS_AT_RULE→CSS_SUPPORTS_AT_RULE_DECLARATOR+ block) enables declarator reuse in contexts like Tailwind custom-variants. Error recovery is properly handled.crates/biome_css_formatter/src/css/any/mod.rs (1)
1-4: LGTM!The module addition is consistent with the declarator-based refactor and properly generated.
.changeset/forty-nails-carry.md (1)
1-5: LGTM!The changeset accurately documents the enhancement to support at-rules within
@custom-variantshorthand syntax.crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs (1)
14-16: LGTM!The refactor to use the declarator field is clean and maintains proper formatting with correct spacing.
crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs (1)
7-12: LGTM!The declarator-based refactor is consistent with the broader pattern, and the extra blank line improves readability.
crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs (1)
7-12: LGTM!The changes align perfectly with the declarator-based formatting pattern established across other at-rule formatters.
crates/biome_css_parser/src/syntax/at_rule/tailwind.rs (1)
135-142: LGTM!This enables the key feature:
@custom-variantshorthand now accepts at-rules like@mediaand@supports. The conditional logic correctly routes@tokens through the declarator parser whilst preserving selector list behaviour.crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs (1)
1-16: LGTM!The formatter implementation is clean and follows established patterns. It correctly formats the
@token followed by the declarator.crates/biome_css_parser/src/syntax/at_rule/starting_style.rs (2)
50-50: LGTM!The refactor separates declarator parsing from block parsing, aligning with the declarator-based architecture introduced across the codebase.
56-66: LGTM!The new declarator parser follows established patterns: guarded entry, token bump, and completion with the appropriate syntax kind.
crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs (1)
18-19: Declarator formatter slots in nicely. Matches the other at-rule declarators and keeps things tidy.crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs (1)
19-20: Spacing tweak spot on. Token + space + name mirrors the rest of the stack perfectly.crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-at-rules.css (1)
1-63: Great to see exhaustive fixtures. These variants cover the usual Tailwind suspects—future regressions will need a miracle to sneak by.crates/biome_css_parser/src/syntax/at_rule/scope.rs (1)
26-45: Scope declarator helper reads clean. Splitting the declarator keeps the top-level parser lean without upsetting recovery.crates/biome_css_parser/src/syntax/at_rule/container/mod.rs (1)
75-108: Container declarator extraction lands well. Delegating the declarator before the block makes the control flow easier to follow while preserving the existing guards.crates/biome_css_parser/src/syntax/at_rule/font_palette_values.rs (1)
29-59: Declarator split looks tidyNice extraction—keeps the recovery flow untouched while giving us a reusable declarator node. Cheers.
crates/biome_css_formatter/src/css/statements/scope_at_rule.rs (1)
10-12: Formatter swap matches the AST reshapeSwapping to the declarator field keeps the output neat and matches the parser changes. Nicely done.
crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs (1)
10-12: Declarator hand-off looks soundHanding colour profile to the declarator formatter keeps the structure consistent and trims duplication. Ta.
crates/biome_css_formatter/src/tailwind/any/mod.rs (1)
4-4: Module wiring in placeThanks for slotting in the shorthand module—keeps the Tailwind surface in sync with the new formatter.
crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs (1)
9-11: Consistent with the declarator refactorPosition-try now follows the same declarator pattern—looks crisp and keeps formatting uniform.
crates/biome_css_formatter/src/css/any/at_rule_declarator.rs (1)
3-25: Nice delegation setup.
The generated dispatcher cleanly routes every declarator variant without stray cases. Keep them coming.crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rs (1)
1-17: Straightforward and solid.
Letting the declarator forward the@font-facetoken keeps the formatter minimal and on-spec.crates/biome_css_formatter/src/css/statements/media_at_rule.rs (1)
10-12: Lean formatting win.
Switching todeclarator + blocktrims duplication and still yields the expected@media … { … }layout.crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs (1)
14-22: Looks crisp.
Emitting the optional range only when present gives tidy output for both@scopeforms.crates/biome_css_parser/src/syntax/at_rule/view_transition.rs (1)
23-39: Declarator split makes sense.
Pulling the declarator into its own helper keeps the main rule parser in line with the other at-rules.crates/biome_css_parser/src/syntax/at_rule/mod.rs (1)
225-231: Cheers for advancing the bogus branch.Thanks for bumping the offender before wrapping it as bogus; the parser no longer gets stuck reliving the same token, so Tailwind shorthands can actually close their parens now. Nicely done.
crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs (1)
1-20: Looks tidy. The token–space–name ordering mirrors the other declarator formatters, keeping spacing consistent across the board.crates/biome_css_parser/src/syntax/at_rule/color_profile.rs (1)
26-59: Declarator split reads well. Delegating to the declarator function keeps the wrapper lean and reuses the shared recovery path nicely.crates/biome_css_formatter/src/css/auxiliary/mod.rs (1)
3-101: Module list extended sensibly. Wiring the declarator modules in here makes them easy to discover alongside the existing helpers.crates/biome_css_formatter/src/generated.rs (5)
719-750: *All new AtRuleDeclarator impls are consistent.Uniform FormatRule + As/IntoFormat pattern; no red flags.
Also applies to: 1063-1075, 1516-1547, 1714-1726, 2630-2661, 3498-3522, 3561-3592, 4625-4656, 4843-4855, 4958-4989, 5812-5824
9981-9999: Test fixtures verified—both @media and @supports covered.The parser test suite includes comprehensive fixtures for Tailwind custom-variant shorthand covering both @media (print, viewport conditions, logical chains, etc.) and @supports (display properties, selectors, logical operators). Snapshots are maintained. No action required.
8097-8121: AnyCssAtRuleDeclarator: all verified.The module is properly re-exported in
css/any/mod.rsandFormatAnyCssAtRuleDeclaratorexists with the correct implementation. Hooking is sound.
41-78: CssAtRuleDeclarator wiring is correct.Module is properly exported at line 3 of auxiliary/mod.rs and FormatCssAtRuleDeclarator is correctly accessible. All import paths resolve as expected.
2630-2661: Add formatter spec tests for @custom-variant @media patterns with nested conditions.The parser fixtures you've verified include comprehensive @custom-variant @media coverage, but formatter spec tests are incomplete. The only formatter spec containing @custom-variant (
shadcn-default.css) has a selector-based pattern (@custom-variant dark (&:is(.dark *))), not @media queries.Add formatter snapshots in
crates/biome_css_formatter/tests/specs/css/tailwind/covering:
- Simple media:
@custom-variant md (@media (max-width: 320px));- Nested and/or:
@custom-variant media-and (@media (min-width: 300px) and (orientation: landscape));This ensures the
CssMediaAtRuleDeclaratorformatter impl (generated.rs lines 2630–2661) is actually exercised end-to-end.
Summary
This expands
@custom-variantto also accept at-rules. In order to do this, I had to significantly refactor how at-rules were parsed in order to minimize the duplicated code in the parser. This was done by adding at-rule "declarators". I didn't really have any better idea for the name.Most of the grunt work of this refactor was done by AI, but it was heavily guided.
closes #7964
Test Plan
Added tests. Parser snapshots were updated to match the new parsed tree.
There's only 1 very minor regression in CSS formatting, and while it was technically caused by this PR, I think the real root cause is deeper.
Docs