useVueDefaultExport (JavaScript)
Language JavaScript (and super languages)
Summary
Section titled “Summary”- Rule available since:
v2.6.5 - Diagnostic Category:
lint/nursery/useVueDefaultExport - This rule doesn’t have a fix.
- The default severity of this rule is error.
- This rule belongs to the following domains:
- Sources:
- Same as
vue/require-default-export
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useVueDefaultExport": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<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>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.