vue/no-template-shadow
eslint-plugin-vue
No autofixRecommended
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-template-shadow": "error",
},
},
];Disallow variable declarations from shadowing variables declared in the outer scope
<div>
<div v-for="k in 5">
<div v-for="k in 10"></div>
<div slot-scope="{ k }"></div>
</div>
</div>
<div v-for="l in 5"></div>
</template>
<script>
export default {
data() {
return {
l: false
}
}
}
</script><div v-for="i in 5"></div>
<div v-for="j in 5"></div><template>
<div v-for="i in 5"></div>
</template>
<script>
export default {
data() {
return {
i: 'some value'
}
}
}
</script>Examples from the ESLint documentation.
vue/no-template-shadow
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-template-shadow": "error",
},
},
];Oxlint does not have this rule.
nursery/noVueTemplateShadow
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"noVueTemplateShadow": "error"
}
}
}
}Enforce attribute naming style on custom components in template
Enforce that each component should be in its own file
Enforce specific casing for the Prop name in Vue components
Require emits option with name triggered by $emit()