vue/no-template-key
eslint-plugin-vue
No autofixRecommended
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-template-key": "error",
},
},
]; <template key="foo"> ... </template>
<template v-bind:key="bar"> ... </template>
<template :key="baz"> ... </template>
</template><div key="foo"> ... </div>
<template> ... </template>
<!-- It's valid for Vue.js 3.x -->
<template v-for="item in list" :key="item.id"> ... </template>Examples from the ESLint documentation.
vue/no-template-key
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-template-key": "error",
},
},
];Oxlint does not have this rule.
nursery/noVueTemplateKey
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"noVueTemplateKey": "error"
}
}
}
}Disallow use of value wrapped by ref() (Composition API) as an operand
Disallow using v-if on the same element as v-for
Disallow useless attribute on <template>