Skip to content

useVueVForKey

biome.json
{
"linter": {
"rules": {
"nursery": {
"useVueVForKey": "error"
}
}
}
}

Enforce that elements using v-for also specify a unique key.

When rendering lists with v-for, Vue relies on a key to track elements efficiently. The key can be provided via longhand v-bind:key or shorthand :key. If you need to animate the entrance/exit of an item in a list, the key should be a unique identifier for each item in the list, and not the index of the item.

For more information, see the Vue documentation on list rendering.

<li v-for="item in items">{{ item }}</li>
<li v-for="item in items" :key="item.id">{{ item }}</li>
<li v-for="item in items" v-bind:key="item.id">{{ item }}</li>