Skip to content

useVueConsistentVForDelimiter (HTML)

Language HTML
biome.json
{
"linter": {
"rules": {
"nursery": {
"useVueConsistentVForDelimiter": "error"
}
}
}
}

Enforce a consistent delimiter between the item and the list in v-for directives.

In a v-for directive, Vue accepts both in and of between the item and the list, and treats them the same way: item in items and item of items render the same list. Using the same word everywhere makes templates easier to read and search.

<template>
<div v-for="item of items"></div>
</template>
code-block.vue:2:20 lint/nursery/useVueConsistentVForDelimiter  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This v-for uses of instead of in.

1 │ <template>
> 2 │ <div v-for="item of items"></div>
│ ^^
3 │ </template>
4 │

ℹ Vue treats in and of the same way in v-for, so mixing them makes templates harder to read and search.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

ℹ Safe fix: Use in instead.

1 1 │ <template>
2 │ - ··<div·v-for="item·of·items"></div>
2 │ + ··<div·v-for="item·in·items"></div>
3 3 │ </template>
4 4 │

<template>
<div v-for="item in items"></div>
<div v-for="(item, index) in items"></div>
</template>

The word to use between the item and the list: "in" or "of".

Default: "in"

biome.json
{
"linter": {
"rules": {
"nursery": {
"useVueConsistentVForDelimiter": {
"level": "on",
"options": {
"delimiter": "of"
}
}
}
}
}
}
<template>
<div v-for="item in items"></div>
</template>
code-block.vue:2:20 lint/nursery/useVueConsistentVForDelimiter  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This v-for uses in instead of of.

1 │ <template>
> 2 │ <div v-for="item in items"></div>
│ ^^
3 │ </template>
4 │

ℹ Vue treats in and of the same way in v-for, so mixing them makes templates harder to read and search.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

ℹ Safe fix: Use of instead.

1 1 │ <template>
2 │ - ··<div·v-for="item·in·items"></div>
2 │ + ··<div·v-for="item·of·items"></div>
3 3 │ </template>
4 4 │

<template>
<div v-for="item of items"></div>
</template>