useVueValidVFor
Summary
Section titled “Summary”- Rule available since:
v2.4.15 - Diagnostic Category:
lint/nursery/useVueValidVFor - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Same as
vue/valid-v-for
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useVueValidVFor": "error" } } }}Description
Section titled “Description”Enforces valid v-for directives in Vue templates.
This rule reports v-for directives in the following cases:
- The directive has an argument. E.g.
<div v-for:aaa="item in items"></div> - The directive has a modifier. E.g.
<div v-for.bbb="item in items"></div> - The directive does not have a value. E.g.
<div v-for></div> - The second or third aliases are empty or are not simple identifiers.
- A custom component rendered with
v-foris missingv-bind:key. - The
v-bind:keyexpression does not use any variable introduced by thev-fordirective.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<div v-for:aaa="item in items"></div><div v-for="(item, { key }) in items"></div><MyItem v-for="item in items"></MyItem><div v-for="item in items" :key="foo"></div><div v-for="item in items"></div><MyItem v-for="item in items" :key="item.id" /><template v-for="item in items"> <div :key="item.id"></div></template>Related rules:
Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.