Skip to content

noVueDeprecatedScopeAttribute (HTML)

Language HTML
biome.json
{
"linter": {
"rules": {
"nursery": {
"noVueDeprecatedScopeAttribute": "error"
}
}
}
}

Disallow the scope attribute on <template> elements in Vue templates.

Old versions of Vue used the scope attribute to receive the values that a component passes to its slot, also called slot props. Current versions of Vue don’t support this attribute: they ignore it, so the names it declares are never defined inside the <template>.

Use the v-slot directive, or its # shorthand, to receive slot props instead.

<template>
<ListComponent>
<template scope="props">
{{ props.title }}
</template>
</ListComponent>
</template>
code-block.vue:3:15 lint/nursery/noVueDeprecatedScopeAttribute ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unexpected scope attribute on a <template> element.

1 │ <template>
2 │ <ListComponent>
> 3 │ <template scope="props">
│ ^^^^^
4 │ {{ props.title }}
5 │ </template>

ℹ Vue no longer supports the scope attribute, so the slot props it names are never defined.

ℹ Use the v-slot directive instead, like <template v-slot="props">.

ℹ 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.

<template>
<ListComponent>
<template v-slot="props">
{{ props.title }}
</template>
</ListComponent>
<ListComponent>
<template #item="{ title }">
{{ title }}
</template>
</ListComponent>
</template>