Skip to content

feat(css): use expression in page#9342

Merged
denbezrukov merged 1 commit intomainfrom
dbezrukov/expr-in-page
Mar 5, 2026
Merged

feat(css): use expression in page#9342
denbezrukov merged 1 commit intomainfrom
dbezrukov/expr-in-page

Conversation

@denbezrukov
Copy link
Copy Markdown
Contributor

Summary

Allow scss expression is a page at rule

Test Plan

cargo test -p biome_css_parser/formatter

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 5, 2026

⚠️ No Changeset found

Latest commit: 9874d44

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added A-Parser Area: parser A-Formatter Area: formatter L-CSS Language: CSS and super languages labels Mar 5, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 5, 2026

Walkthrough

This change extends the CSS parser to support SCSS variable declarations and nesting blocks within @page at-rules. The parser now recognises SCSS-specific syntax (variables, computed expressions, nested declarations) inside page rules, complemented by test files demonstrating features like computed padding with scale variables, map declarations, and new margin/padding constructs in page pseudo-elements.

Possibly related PRs

Suggested labels

A-Parser, A-Formatter, L-CSS, L-SCSS

Suggested reviewers

  • ematipico
  • siketyan
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding support for SCSS expressions within the @page at-rule, which aligns with the parser modifications and test updates.
Description check ✅ Passed The description directly relates to the changeset, explaining the intent to allow SCSS expressions in page at-rules and providing a test command.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dbezrukov/expr-in-page

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
crates/biome_css_parser/src/syntax/at_rule/page.rs (1)

190-192: Formatting inconsistency.

Line 192 crams two conditions onto a single line while others are split. Consider aligning for readability:

♻️ Suggested formatting
            // SCSS allows variable declarations and nested properties inside any block.
            || is_at_scss_declaration(p)
-            || is_at_scss_nesting_declaration(p) || is_at_any_declaration_with_semicolon(p)
+            || is_at_scss_nesting_declaration(p)
+            || is_at_any_declaration_with_semicolon(p)
            || is_at_qualified_rule(p)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_css_parser/src/syntax/at_rule/page.rs` around lines 190 - 192,
The boolean condition list in the at-rule parsing expression is misaligned: move
the final two predicates (is_at_scss_nesting_declaration and
is_at_any_declaration_with_semicolon) each to their own line to match the
existing multiline formatting used for is_at_scss_declaration and maintain
consistent indentation; update the expression containing is_at_scss_declaration,
is_at_scss_nesting_declaration, and is_at_any_declaration_with_semicolon so each
OR clause is on its own line for readability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/biome_css_parser/src/syntax/at_rule/page.rs`:
- Around line 190-192: The boolean condition list in the at-rule parsing
expression is misaligned: move the final two predicates
(is_at_scss_nesting_declaration and is_at_any_declaration_with_semicolon) each
to their own line to match the existing multiline formatting used for
is_at_scss_declaration and maintain consistent indentation; update the
expression containing is_at_scss_declaration, is_at_scss_nesting_declaration,
and is_at_any_declaration_with_semicolon so each OR clause is on its own line
for readability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c4b8bec2-80cc-4505-957d-57b75a520724

📥 Commits

Reviewing files that changed from the base of the PR and between b535f60 and 9874d44.

⛔ Files ignored due to path filters (2)
  • crates/biome_css_formatter/tests/specs/css/scss/declaration/page-at-rule.scss.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/page.scss.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • crates/biome_css_formatter/tests/specs/css/scss/declaration/page-at-rule.scss
  • crates/biome_css_parser/src/syntax/at_rule/page.rs
  • crates/biome_css_parser/tests/css_test_suite/ok/scss/at-rule/page.scss

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 5, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks
⏩ 187 skipped benchmarks1


Comparing dbezrukov/expr-in-page (9874d44) with main (b535f60)

Open in CodSpeed

Footnotes

  1. 187 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.

@denbezrukov denbezrukov merged commit 20a64c4 into main Mar 5, 2026
16 checks passed
@denbezrukov denbezrukov deleted the dbezrukov/expr-in-page branch March 5, 2026 10:23
ematipico pushed a commit that referenced this pull request Mar 6, 2026
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 L-CSS Language: CSS and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant