Skip to content

useVueDefaultExport (JavaScript)

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

Require the <script> block of a Vue component to have a default export.

When a .vue file has no <script setup> block, Vue builds the component from the default export of its <script> block. If the block has no default export, the component can’t use anything the block declares, such as data, props, or methods.

A file with a <script setup> block is not checked, because Vue builds the component from that block instead.

<script>
const foo = "foo";
</script>
<script>
import { defineComponent } from "vue";
export const component = defineComponent({});
</script>
<script>
export default {
data() {
return {
foo: "foo",
};
},
};
</script>
<script>
export const foo = "foo";
</script>
<script setup>
const bar = "bar";
</script>