# no-use-v-if-with-v-for

Rule `vue/no-use-v-if-with-v-for`. Disallow using `v-if` on the same element as `v-for`

- Source: vue
- Technologies: Vue
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 42.4M weekly downloads of presets that enable it
- Trend: +88.4% last quarter
- Rank: #362 by reach, #354 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/no-use-v-if-with-v-for` | yes | no | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/no-use-v-if-with-v-for.html) |
| Biome | `correctness/noVueVIfWithVFor` | yes | no | group correctness, since 2.3.6 | [docs](https://biomejs.dev/linter/rules/no-vue-v-if-with-v-for/) |

## Code examples

### Incorrect: the rule reports this

```vue
  <TodoItem
    v-if="complete"
    v-for="todo in todos"
    :todo="todo"
  /><!-- ↑ In this case, the `v-if` should be written on the wrapper element. -->
  <TodoItem
    v-for="todo in todos"
    v-if="todo.shown"
    :todo="todo"
  /><!-- ↑ In this case, the `v-for` list variable should be replace with a computed property that returns your filtered list. -->
</template>
```

```vue
  <TodoItem
    v-for="todo in todos"
    v-if="shown"
    :todo="todo"
  />
</template>
```

### Correct: the rule accepts this

```vue
<ul v-if="complete">
  <TodoItem
    v-for="todo in todos"
    :todo="todo"
  />
</ul>
<TodoItem
  v-for="todo in shownTodos"
  :todo="todo"
/>
```

```vue
<TodoItem
  v-for="todo in todos"
  v-if="todo.shown"
  :todo="todo"
/>
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import vue from "eslint-plugin-vue";

export default [
  {
    plugins: { vue },
    rules: {
      "vue/no-use-v-if-with-v-for": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "correctness": {
        "noVueVIfWithVFor": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Vue recommended](https://lintradar.dev/presets/vue-recommended.md) | ESLint | `eslint-plugin-vue` | 118 | 9.5M | +46.6% |
| [Vue essential](https://lintradar.dev/presets/vue-essential.md) | ESLint | `eslint-plugin-vue` | 85 | 9.5M | +46.6% |
| [Vue strongly recommended](https://lintradar.dev/presets/vue-strongly-recommended.md) | ESLint | `eslint-plugin-vue` | 110 | 9.5M | +46.6% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |

## Related rules

- [vue/no-use-computed-property-like-method](https://lintradar.dev/rules/vue/no-use-computed-property-like-method.md): Disallow use computed property like method
- [vue/no-useless-template-attributes](https://lintradar.dev/rules/vue/no-useless-template-attributes.md): Disallow useless attribute on `<template>`
- [vue/no-textarea-mustache](https://lintradar.dev/rules/vue/no-textarea-mustache.md): Disallow mustaches in `<textarea>`
- [vue/no-v-for-template-key-on-child](https://lintradar.dev/rules/vue/no-v-for-template-key-on-child.md): Disallow key of `<template v-for>` placed on child elements
- [vue/no-template-key](https://lintradar.dev/rules/vue/no-template-key.md): Disallow `key` attribute on `<template>`
- [vue/no-v-text-v-html-on-component](https://lintradar.dev/rules/vue/no-v-text-v-html-on-component.md): Disallow v-text / v-html on component

---

Web page: https://lintradar.dev/rules/vue/no-use-v-if-with-v-for. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
