Skip to content

fix(embeds): improve detection of bindings in Astro files#9473

Merged
dyc3 merged 2 commits intomainfrom
fix/improve-astro-detection
Mar 13, 2026
Merged

fix(embeds): improve detection of bindings in Astro files#9473
dyc3 merged 2 commits intomainfrom
fix/improve-astro-detection

Conversation

@ematipico
Copy link
Copy Markdown
Member

Summary

Easy fix for Astro files. It should improve the QoL

Tests generated with AI

Test Plan

Added new tests

Docs

@ematipico ematipico requested review from a team March 13, 2026 12:53
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: e962f49

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

@github-actions github-actions Bot added A-CLI Area: CLI A-Project Area: project A-Parser Area: parser L-HTML Language: HTML and super languages labels Mar 13, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1d65f12f-800e-4b00-8571-5dd71286e391

📥 Commits

Reviewing files that changed from the base of the PR and between 3d63c04 and e962f49.

📒 Files selected for processing (1)
  • .changeset/sharp-adults-jog.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/sharp-adults-jog.md

Walkthrough

This change extends HTML embedding to recognise and parse Astro directives and HTML attribute initializers as embeddable expressions, adds pub fn initializer(&self) -> Option<HtmlAttributeInitializerClause> to AnyAstroDirective, and adds tests validating no-unused-variable extraction across various Astro attribute and directive bindings.

Possibly related PRs

Suggested labels

A-Linter

Suggested reviewers

  • dyc3
  • siketyan
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title directly and clearly describes the main change: improving detection of bindings in Astro files, which aligns with all file modifications across the codebase.
Description check ✅ Passed The description relates to the changeset, mentioning an 'easy fix for Astro files' and noting that tests were added, though it lacks specific technical detail about what was fixed.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/improve-astro-detection
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/sharp-adults-jog.md:
- Line 5: Fix the typo in the changeset description: replace the misspelled word
"insisde" with "inside" in the sentence that mentions detection of variables in
Astro files (the line referencing the rule `noUnusedVariables`) so the
description reads "inside Astro files."

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6eed4e71-3099-44be-a354-530df44cc008

📥 Commits

Reviewing files that changed from the base of the PR and between 071d9b9 and 3d63c04.

⛔ Files ignored due to path filters (3)
  • crates/biome_cli/tests/snapshots/main_cases_handle_astro_files/embedded_bindings_are_tracked_correctly.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_handle_astro_files/no_unused_variables_in_astro_attribute_expressions.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_handle_astro_files/no_unused_variables_in_astro_directive_expressions.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (4)
  • .changeset/sharp-adults-jog.md
  • crates/biome_cli/tests/cases/handle_astro_files.rs
  • crates/biome_html_syntax/src/directive_ext.rs
  • crates/biome_service/src/file_handlers/html.rs

Comment thread .changeset/sharp-adults-jog.md Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 13, 2026

Merging this PR will not alter performance

✅ 64 untouched benchmarks
⏩ 152 skipped benchmarks1


Comparing fix/improve-astro-detection (e962f49) with main (058f7b5)

Open in CodSpeed

Footnotes

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

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

I don't have much experience with astro, but LGTM

@dyc3 dyc3 merged commit 50e93bd into main Mar 13, 2026
17 checks passed
@dyc3 dyc3 deleted the fix/improve-astro-detection branch March 13, 2026 15:47
@github-actions github-actions Bot mentioned this pull request Mar 13, 2026
@EvHaus
Copy link
Copy Markdown

EvHaus commented Mar 16, 2026

@ematipico After upgrading from 2.4.6 → 2.4.7 I'm seeing new Biome failures where TypeScript type usage is no longer being considered as variable usage, eg:

const { a, b, c } = useThing();

// In 2.4.6 Biome would correctly detect this as variable usage.
// In 2.4.7 Biome now falsely reports this as a `lint/correctness/noUnusedVariables` failure
return someFunction<typeof a, typeof b, typeof c>();

This PR was the only change to the noUnusedVariables rule between those two versions. Is it possible there was a regression introduced?

@ematipico
Copy link
Copy Markdown
Member Author

Regression yes, this PR unluckily. Please open an issue with a reproduction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Parser Area: parser A-Project Area: project L-HTML Language: HTML and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants