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