Skip to content

Conversation

@ematipico
Copy link
Member

Summary

Closes #7857

The test case was generated with AI

Test Plan

Added one

Docs

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2025

🦋 Changeset detected

Latest commit: 324fff3

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 labels Oct 26, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 26, 2025

Walkthrough

The change maps Astro HTML sources to a TypeScript/JS file source with an Astro embedding kind so Biome parses <script> tags in .astro files as TypeScript. It adds a changeset for a patch release and a test that formats an .astro file containing a TypeScript script tag to verify the behaviour.

Suggested labels

L-JavaScript, A-Formatter

Suggested reviewers

  • siketyan
  • dyc3

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix(core): parse astro script as TS" clearly and specifically describes the primary change in the pull request. It directly corresponds to the main objective of fixing issue #7857, which is to ensure Astro script tags are parsed as TypeScript rather than JavaScript. The title uses conventional commit format and is concise without vague terminology, making it immediately clear to reviewers scanning the history what this fix accomplishes.
Linked Issues Check ✅ Passed The changes align with the primary objectives from issue #7857. The code modification in html.rs adds Astro-specific handling in parse_embedded_script to map Astro HTML sources to TypeScript file sources [#7857], directly addressing the requirement to parse Astro script tags as TypeScript. A test case was added in handle_astro_files.rs to validate the formatting behaviour [#7857]. The changeset file documents the patch release for this fix [#7857]. All core coding requirements are satisfied.
Out of Scope Changes Check ✅ Passed All changes are directly scoped to fixing the Astro TypeScript parsing issue. The changeset file follows standard release documentation practices, the test file addition provides test coverage for the new functionality, and the html.rs modification is the core implementation of the fix. No extraneous changes or unrelated modifications are apparent in the changeset.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/script-ts-astro

📜 Recent 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 838a287 and 324fff3.

📒 Files selected for processing (1)
  • .changeset/ten-hoops-unite.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/ten-hoops-unite.md
⏰ 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). (8)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test Node.js API
  • GitHub Check: Check Dependencies
  • GitHub Check: autofix

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

🧹 Nitpick comments (1)
.changeset/ten-hoops-unite.md (1)

5-5: Remove article "the" before "Biome".

"Now Biome parses" reads better than "Now the Biome parses".

Apply this diff:

-Fixed [#7857](https://github.com/biomejs/biome/issues/7857). Now the Biome parses `<script>` tags as TypeScript when analysing a `.astro` file.
+Fixed [#7857](https://github.com/biomejs/biome/issues/7857). Now Biome parses `<script>` tags as TypeScript when analysing a `.astro` file.
📜 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 fe90c78 and 13245d3.

⛔ Files ignored due to path filters (1)
  • crates/biome_cli/tests/snapshots/main_cases_handle_astro_files/format_astro_with_typescript_script_tag.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/ten-hoops-unite.md (1 hunks)
  • crates/biome_cli/tests/cases/handle_astro_files.rs (2 hunks)
  • crates/biome_service/src/file_handlers/html.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_cli/tests/cases/handle_astro_files.rs
  • crates/biome_service/src/file_handlers/html.rs
**/tests/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place test files under a tests/ directory in each crate

Files:

  • crates/biome_cli/tests/cases/handle_astro_files.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • crates/biome_cli/tests/cases/handle_astro_files.rs
  • crates/biome_service/src/file_handlers/html.rs
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: In changesets, only use #### or ##### headers; other header levels are not allowed
Changesets should cover user-facing changes only; internal changes do not need changesets
Use past tense for what you did and present tense for current Biome behavior in changesets
When fixing a bug in a changeset, start with an issue link (e.g., “Fixed #1234: …”)
When referencing a rule or assist in a changeset, include a link to its page on the website
Include code blocks in changesets when applicable to illustrate changes
End every sentence in a changeset with a period

Files:

  • .changeset/ten-hoops-unite.md
🧠 Learnings (1)
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
PR: biomejs/biome#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_cli/tests/cases/handle_astro_files.rs
🧬 Code graph analysis (2)
crates/biome_cli/tests/cases/handle_astro_files.rs (2)
crates/biome_cli/tests/main.rs (1)
  • run_cli (332-347)
crates/biome_cli/tests/snap_test.rs (1)
  • assert_cli_snapshot (407-409)
crates/biome_service/src/file_handlers/html.rs (2)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (2)
  • JsFileSource (9483-9492)
  • EmbeddingKind (9510-9510)
crates/biome_js_syntax/src/file_source.rs (1)
  • ts (173-180)
🪛 LanguageTool
.changeset/ten-hoops-unite.md

[uncategorized] ~5-~5: Possible missing comma found.
Context: .../github.com//issues/7857). Now the Biome parses <script> tags as Typ...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Documentation
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: autofix
  • GitHub Check: Test Node.js API
🔇 Additional comments (2)
crates/biome_service/src/file_handlers/html.rs (1)

491-492: LGTM!

The logic correctly ensures all script tags in Astro files are parsed as TypeScript with the appropriate embedding kind, consistent with how Svelte and Vue are handled above.

crates/biome_cli/tests/cases/handle_astro_files.rs (1)

638-669: Test structure looks good.

The test follows the established pattern and correctly validates formatting with the --write flag. However, see the concern about test content above.

@ematipico ematipico force-pushed the fix/script-ts-astro branch from 13245d3 to 838a287 Compare October 26, 2025 09:23
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: 1

📜 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 13245d3 and 838a287.

⛔ Files ignored due to path filters (1)
  • crates/biome_cli/tests/snapshots/main_cases_handle_astro_files/format_astro_with_typescript_script_tag.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/ten-hoops-unite.md (1 hunks)
  • crates/biome_cli/tests/cases/handle_astro_files.rs (2 hunks)
  • crates/biome_service/src/file_handlers/html.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/biome_service/src/file_handlers/html.rs
  • crates/biome_cli/tests/cases/handle_astro_files.rs
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: In changesets, only use #### or ##### headers; other header levels are not allowed
Changesets should cover user-facing changes only; internal changes do not need changesets
Use past tense for what you did and present tense for current Biome behavior in changesets
When fixing a bug in a changeset, start with an issue link (e.g., “Fixed #1234: …”)
When referencing a rule or assist in a changeset, include a link to its page on the website
Include code blocks in changesets when applicable to illustrate changes
End every sentence in a changeset with a period

Files:

  • .changeset/ten-hoops-unite.md
🪛 LanguageTool
.changeset/ten-hoops-unite.md

[uncategorized] ~5-~5: Possible missing comma found.
Context: .../github.com//issues/7857). Now the Biome parses <script> tags as Typ...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ 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 (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@ematipico ematipico merged commit c9f7fe5 into main Oct 26, 2025
13 checks passed
@ematipico ematipico deleted the fix/script-ts-astro branch October 26, 2025 12:56
@github-actions github-actions bot mentioned this pull request Oct 26, 2025
Jagget pushed a commit to Jagget/biome that referenced this pull request Oct 27, 2025
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Conaclos pushed a commit that referenced this pull request Nov 1, 2025
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 Astro script tags must be interpreted as TypeScript, not JavaScript

3 participants