Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/calm-foxes-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@biomejs/biome": patch
---

Fixed [#8109](https://github.com/biomejs/biome/issues/8109): return statements in Astro frontmatter no longer trigger "Illegal return statement" errors when using `experimentalFullSupportEnabled`.
30 changes: 30 additions & 0 deletions crates/biome_cli/tests/cases/handle_astro_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,33 @@ function foo(){console.log("Hello")}
result,
));
}

#[test]
fn does_not_throw_parse_error_for_return_full_support() {
let fs = MemoryFileSystem::default();
let mut console = BufferConsole::default();

fs.insert(
"biome.json".into(),
r#"{ "html": { "experimentalFullSupportEnabled": true } }"#.as_bytes(),
);

let astro_file_path = Utf8Path::new("file.astro");
fs.insert(astro_file_path.into(), ASTRO_RETURN.as_bytes());

let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["lint", astro_file_path.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");

assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"does_not_throw_parse_error_for_return_full_support",
fs,
console,
result,
));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
source: crates/biome_cli/tests/snap_test.rs
expression: redactor(content)
---
## `biome.json`

```json
{ "html": { "experimentalFullSupportEnabled": true } }
```

## `file.astro`

```astro
---
const foo = true;
if (foo) {
return "Something";
}

---
<div></div>
```

# Emitted Messages

```block
Checked 1 file in <TIME>. No fixes applied.
```
2 changes: 1 addition & 1 deletion crates/biome_js_syntax/src/file_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub enum EmbeddingKind {

impl EmbeddingKind {
pub const fn is_astro(&self) -> bool {
matches!(self, Self::Astro { frontmatter: false })
matches!(self, Self::Astro { .. })
}
pub const fn is_astro_frontmatter(&self) -> bool {
matches!(self, Self::Astro { frontmatter: true })
Expand Down
Loading