pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
vue/no-deprecated-router-link-tag-prop |
disallow using deprecated `tag` property on `RouterLink` (in Vue.js 3.0.0+) |
v7.20.0 |
disallow using deprecated
tag
property onRouterLink
(in Vue.js 3.0.0+)
- ⚙️ This rule is included in all of
"plugin:vue/vue3-essential"
,"plugin:vue/vue3-strongly-recommended"
and"plugin:vue/vue3-recommended"
.
This rule reports deprecated the tag
attribute on RouterLink
elements (removed in Vue.js v3.0.0+).
<template>
<!-- ✓ GOOD -->
<RouterLink to="/">Home</RouterLink>
<router-link to="/">Home</router-link>
<RouterLink to="/">
<div>Home</div>
</RouterLink>
<router-link to="/">
<div>Home</div>
</router-link>
<NuxtLink tag="div" to="/">Home</NuxtLink>
<nuxt-link tag="div" to="/">Home</nuxt-link>
<!-- ✗ BAD -->
<RouterLink tag="div" to="/">Home</RouterLink>
<router-link tag="div" to="/">Home</router-link>
<RouterLink :tag="someVariable" to="/">Home</RouterLink>
<router-link :tag="someVariable" to="/">Home</router-link>
</template>
{
"vue/no-deprecated-router-link-tag-prop": ["error", {
"components": ['RouterLink']
}]
}
components
(string[]
) ... Component names which will be checked with thetag
attribute. default['RouterLink']
.
Note: this rule will check both kebab-case
and PascalCase
versions of the
given component names.
<template>
<!-- ✗ BAD -->
<RouterLink tag="div" to="/">Home</RouterLink>
<router-link tag="div" to="/">Home</router-link>
<RouterLink :tag="someVariable" to="/">Home</RouterLink>
<router-link :tag="someVariable" to="/">Home</router-link>
<NuxtLink tag="div" to="/">Home</NuxtLink>
<nuxt-link tag="div" to="/">Home</nuxt-link>
<NuxtLink :tag="someVariable" to="/">Home</NuxtLink>
<nuxt-link :tag="someVariable" to="/">Home</nuxt-link>
</template>
This rule was introduced in eslint-plugin-vue v7.20.0