# no-unused-vars

Rule `vue/no-unused-vars`. Disallow unused variable definitions of v-for directives or scope attributes

- Source: vue
- Technologies: Vue
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 11.8M weekly downloads of presets that enable it
- Trend: +49.7% last quarter
- Rank: #839 by reach, #842 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/no-unused-vars` | yes | suggestion | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/no-unused-vars.html) |
| Biome | `correctness/noUnusedVariables` | yes | unsafe | group correctness, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-unused-variables/) |

## Code examples

### Incorrect: the rule reports this

```vue
  <ol v-for="i in 5">
    <li>item</li>
  </ol>
</template>
```

### Correct: the rule accepts this

```vue
<ol v-for="i in 5">
  <li>{{ i }}</li>
</ol>
```

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-unused-vars": "error",
    },
  },
];
```

### Biome: `biome.json`

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [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% |
| [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

- [eslint/no-unused-vars](https://lintradar.dev/rules/eslint/no-unused-vars.md): Disallow unused variables
- [typescript/no-unused-vars](https://lintradar.dev/rules/typescript/no-unused-vars.md): Disallow unused variables
- [sonarjs/no-unused-vars](https://lintradar.dev/rules/sonarjs/no-unused-vars.md): Unused local variables and functions should be removed
- [vue/no-reserved-component-names](https://lintradar.dev/rules/vue/no-reserved-component-names.md): Disallow the use of reserved names in component definitions
- [vue/comment-directive](https://lintradar.dev/rules/vue/comment-directive.md): Support comment-directives in `<template>`
- [vue/no-shared-component-data](https://lintradar.dev/rules/vue/no-shared-component-data.md): Enforce component's data property to be a function

---

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