Skip to content

noAstroComponentDefaultExport (JavaScript)

Language JavaScript (and super languages)
biome.json
{
"linter": {
"rules": {
"nursery": {
"noAstroComponentDefaultExport": "error"
}
}
}
}

Disallow runtime default exports in Astro component frontmatter.

Astro generates the runtime default export for each component. Defining another runtime default export in the component frontmatter conflicts with that generated export. Named exports and type-only default exports are allowed.

---
export default function render() {}
---
code-block.astro:2:8 lint/nursery/noAstroComponentDefaultExport ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Astro components cannot define a runtime default export.

1 │ ---
> 2 │ export default function render() {}
│ ^^^^^^^
3 │ ---
4 │

ℹ Astro generates the component's runtime default export.

ℹ Remove this export or use a named export instead.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

---
export function helper() {}
export default interface Props {}
---