Skip to content

noVueDeprecatedRouterLinkTagProp (HTML)

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

Disallow the tag prop on RouterLink.

Vue Router 4, the version of Vue Router for Vue 3, doesn’t support the tag prop on <RouterLink>. Writing <RouterLink tag="li"> doesn’t render an <li> element: the prop is ignored, and the link still renders as an <a> element.

To render a different element, add the custom prop and put your own element in the link’s default slot. The slot gives you a navigate function to call when the element is clicked:

<template>
<RouterLink to="/" custom v-slot="{ navigate }">
<li role="link" @click="navigate">Home</li>
</RouterLink>
</template>

This rule checks <RouterLink> and <router-link>. Use the components option to check other link components.

<template>
<RouterLink tag="li" to="/">Home</RouterLink>
</template>
code-block.vue:2:15 lint/nursery/noVueDeprecatedRouterLinkTagProp ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ The tag prop is used on RouterLink.

1 │ <template>
> 2 │ <RouterLink tag="li" to="/">Home</RouterLink>
│ ^^^^^^^^
3 │ </template>
4 │

ℹ Vue Router 4 doesn't support this prop, so it's ignored and the link still renders as an <a> element.

ℹ To render a different element, add the custom prop and put the element in the link's default slot.

ℹ 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>
<router-link :tag="element" to="/">Home</router-link>
</template>
code-block.vue:2:16 lint/nursery/noVueDeprecatedRouterLinkTagProp ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ The tag prop is used on router-link.

1 │ <template>
> 2 │ <router-link :tag="element" to="/">Home</router-link>
│ ^^^^^^^^^^^^^^
3 │ </template>
4 │

ℹ Vue Router 4 doesn't support this prop, so it's ignored and the link still renders as an <a> element.

ℹ To render a different element, add the custom prop and put the element in the link's default slot.

ℹ 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>
<RouterLink to="/">Home</RouterLink>
<router-link to="/">
<div>Home</div>
</router-link>
<NuxtLink tag="li" to="/">Home</NuxtLink>
</template>

Default: ["RouterLink"]

The names of the link components to check. Each name matches both its PascalCase and kebab-case spelling, so "NuxtLink" matches <NuxtLink> and <nuxt-link>. Setting this option replaces the default list, so include "RouterLink" to keep checking it.

biome.json
{
"linter": {
"rules": {
"nursery": {
"noVueDeprecatedRouterLinkTagProp": {
"level": "on",
"options": {
"components": [
"RouterLink",
"NuxtLink"
]
}
}
}
}
}
}
<template>
<nuxt-link tag="li" to="/">Home</nuxt-link>
</template>
code-block.vue:2:14 lint/nursery/noVueDeprecatedRouterLinkTagProp ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ The tag prop is used on nuxt-link.

1 │ <template>
> 2 │ <nuxt-link tag="li" to="/">Home</nuxt-link>
│ ^^^^^^^^
3 │ </template>
4 │

ℹ Vue Router 4 doesn't support this prop, so it's ignored and the link still renders as an <a> element.

ℹ To render a different element, add the custom prop and put the element in the link's default slot.

ℹ 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>
<NuxtLink to="/">Home</NuxtLink>
</template>