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 expands @custom-variant to 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

@changeset-bot
Copy link

changeset-bot bot commented Nov 8, 2025

🦋 Changeset detected

Latest commit: f95c88a

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 github-actions bot added A-Linter Area: linter A-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools L-CSS Language: CSS L-Grit Language: GritQL labels Nov 8, 2025
@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 15:03
@dyc3 dyc3 force-pushed the dyc3/tw-fix-custom-variant-shorthand branch from 0b177d9 to 53ddb17 Compare November 8, 2025 15:45
@dyc3 dyc3 force-pushed the dyc3/tw-fix-custom-variant-shorthand-at-rules branch from bd32f77 to 5bd2772 Compare November 8, 2025 15:49
@dyc3 dyc3 changed the base branch from dyc3/tw-fix-custom-variant-shorthand to graphite-base/8042 November 8, 2025 19:44
@dyc3 dyc3 force-pushed the graphite-base/8042 branch from 53ddb17 to beeb7bb Compare November 8, 2025 19:45
@dyc3 dyc3 force-pushed the dyc3/tw-fix-custom-variant-shorthand-at-rules branch from 5bd2772 to 72f4950 Compare November 8, 2025 19:45
@graphite-app graphite-app bot changed the base branch from graphite-base/8042 to main November 8, 2025 19:46
@dyc3 dyc3 force-pushed the dyc3/tw-fix-custom-variant-shorthand-at-rules branch from 72f4950 to 0cea473 Compare November 8, 2025 19:46
@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%

@github-actions github-actions bot added L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages L-HTML Language: HTML and super languages L-Tailwind Language: Tailwind CSS labels Nov 8, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 8, 2025

Walkthrough

This 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 @custom-variant shorthand parser is extended to accept at-rules (e.g., @media, @supports) directly, resolving the parser error when encountering syntax like @custom-variant name (@media (max-width: 320px)). The generated formatter bindings are updated to wire all new declarator types through the formatting pipeline.

Possibly related PRs

Suggested reviewers

  • ematipico
  • denbezrukov

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: enabling @custom-variant to accept at-rules like @media, which directly addresses the issue being fixed.
Description check ✅ Passed The description is well-related to the changeset, explaining the motivation (expanding @custom-variant to accept at-rules), the implementation approach (refactoring with at-rule declarators), and testing approach.
Linked Issues check ✅ Passed The PR successfully addresses issue #7964 by enabling the parser to accept at-rule syntax in @custom-variant shorthand, eliminating the 'Expected a selector but instead found @' error and supporting Tailwind-documented syntax.
Out of Scope Changes check ✅ Passed All changes are within scope: parser refactoring for at-rule declarators, formatter updates to handle new declarator types, test additions validating the new syntax, and CSS custom-variant improvements for Tailwind support.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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-at-rules

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: 2

🧹 Nitpick comments (2)
crates/biome_css_formatter/src/generated.rs (2)

79-110: Both conditional/declaration block Declarator adapters are wired properly

All 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 readability

This 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-hq
Copy link

codspeed-hq bot commented Nov 8, 2025

CodSpeed Performance Report

Merging #8042 will not alter performance

Comparing dyc3/tw-fix-custom-variant-shorthand-at-rules (f95c88a) with main (ac3fc64)1

Summary

✅ 58 untouched
⏩ 85 skipped2

Footnotes

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

  2. 85 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
Copy link
Contributor Author

dyc3 commented Nov 9, 2025

All of the lint rules that have regressions use the semantic model. So this change caused a regression in the css semantic model.

Though it looks like it's mostly just changes in the verbosity of these rules, not that we are missing cases now? Nvm, it's worse

@dyc3 dyc3 marked this pull request as draft November 9, 2025 13:14
@dyc3 dyc3 force-pushed the dyc3/tw-fix-custom-variant-shorthand-at-rules branch from 9489e76 to 2c2bba1 Compare November 9, 2025 13:56
@github-actions github-actions bot removed the A-Linter Area: linter label Nov 9, 2025
@dyc3 dyc3 force-pushed the dyc3/tw-fix-custom-variant-shorthand-at-rules branch from 2c2bba1 to b7acb1f Compare November 9, 2025 14:10
@dyc3 dyc3 marked this pull request as ready for review November 9, 2025 14:10
@dyc3 dyc3 force-pushed the dyc3/tw-fix-custom-variant-shorthand-at-rules branch from b7acb1f to f95c88a Compare November 9, 2025 14:20
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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0cea473 and f95c88a.

⛔ Files ignored due to path filters (59)
  • 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_formatter/tests/specs/prettier/css/comments/at-rules.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_color_profile_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_and_query_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_or_query_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_style_not_query.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_container/at_rule_container_style_query_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_counter_style_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_font_face_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_font_palette_values_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_layer_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_media_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_property_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_scope_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_supports/at_rule_supports_and_condition_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_supports/at_rule_supports_invalid_after_support_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_supports/at_rule_supports_not_condition_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/at_rule_supports/at_rule_supports_or_condition_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/at_rule/conditional_at_rule_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/property/unicode_range_error.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_color_profile.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_container.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_container_complex.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_counter_style.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_font_face.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_font_palette_values.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_layer.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_media.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_media_complex.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_page_complex.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_position_try.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_property.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_scope.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_starting_style.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_supports.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_supports_complex.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_view_transition.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/grit_metavariable/metavar.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/nesting/conditional_at_rule.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/nesting/nesting.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/property/unicode_range.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-at-rules-simple.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-at-rules.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/custom-variants/shorthand-media.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_syntax/src/generated/kind.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/macros.rs is excluded by !**/generated/**, !**/generated/** 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 **
  • crates/biome_graphql_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_grit_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_html_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_js_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_json_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_markdown_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_tailwind_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_yaml_syntax/src/generated/nodes.rs is 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.rs
  • crates/biome_css_formatter/src/css/auxiliary/font_face_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/media_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/mod.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.md
  • crates/biome_css_parser/src/syntax/at_rule/media.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/tailwind/any/mod.rs
  • crates/biome_css_formatter/src/css/any/mod.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/media_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/mod.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/media_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/media_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/tailwind/any/mod.rs
  • crates/biome_css_formatter/src/css/any/mod.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/media_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/mod.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/media_at_rule.rs
  • crates/biome_css_parser/src/syntax/at_rule/media.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/tailwind/any/mod.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/media_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/scope_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/any/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/auxiliary/at_rule_declarator.rs
  • crates/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.rs
  • crates/biome_css_parser/src/syntax/at_rule/starting_style.rs
  • crates/biome_css_parser/src/syntax/at_rule/container/mod.rs
  • crates/biome_css_parser/src/syntax/at_rule/media.rs
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs
  • crates/biome_css_parser/src/syntax/at_rule/scope.rs
  • crates/biome_css_parser/src/syntax/at_rule/supports/mod.rs
  • crates/biome_css_parser/src/syntax/at_rule/font_palette_values.rs
  • crates/biome_css_parser/src/syntax/at_rule/property.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/statements/color_profile_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/color_profile_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/scope_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/media_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/counter_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/mod.rs
  • crates/biome_css_formatter/src/css/auxiliary/counter_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/tailwind/any/mod.rs
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/auxiliary/starting_style_at_rule_declarator.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/biome_css_formatter/src/generated.rs
  • crates/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.rs
  • crates/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.rs
  • crates/biome_css_formatter/src/css/any/mod.rs
  • crates/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.rs
  • crates/biome_css_parser/src/syntax/at_rule/mod.rs
  • crates/biome_css_formatter/src/css/statements/position_try_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/font_palette_values_at_rule.rs
  • crates/biome_css_formatter/src/css/statements/starting_style_at_rule.rs
  • crates/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.rs
  • crates/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.rs
  • crates/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.rs
  • crates/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_declarator correctly returns Absent without consuming tokens when not at a @supports token (lines 76–78), and the nested AST (CSS_SUPPORTS_AT_RULECSS_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-variant shorthand 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-variant shorthand now accepts at-rules like @media and @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 tidy

Nice 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 reshape

Swapping 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 sound

Handing 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 place

Thanks 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 refactor

Position-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-face token 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 to declarator + block trims 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 @scope forms.

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.rs and FormatAnyCssAtRuleDeclarator exists 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 CssMediaAtRuleDeclarator formatter impl (generated.rs lines 2630–2661) is actually exercised end-to-end.

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

Labels

A-Formatter Area: formatter A-Parser Area: parser A-Tooling Area: internal tools L-CSS Language: CSS L-Grit Language: GritQL L-HTML Language: HTML and super languages L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages L-Tailwind Language: Tailwind CSS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug in CSS parser for Tailwind: custom variants with () syntax not supported

3 participants