# no-template-shadow

Rule `vue/no-template-shadow`. Disallow variable declarations from shadowing variables declared in the outer scope

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/no-template-shadow` | yes | no | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/no-template-shadow.html) |
| Biome | `nursery/noVueTemplateShadow` | yes | no | group nursery, since 2.6.5 | [docs](https://biomejs.dev/linter/rules/no-vue-template-shadow/) |

## Code examples

### Incorrect: the rule reports this

```vue
  <div>
    <div v-for="k in 5">
      <div v-for="k in 10"></div>
      <div slot-scope="{ k }"></div>
    </div>
  </div>
  <div v-for="l in 5"></div>
</template>

<script>
export default {
  data() {
    return {
      l: false
    }
  }
}
</script>
```

### Correct: the rule accepts this

```vue
<div v-for="i in 5"></div>
<div v-for="j in 5"></div>
```

```vue
<template>
  <div v-for="i in 5"></div>
</template>

<script>
export default {
  data() {
    return {
      i: 'some value'
    }
  }
}
</script>
```

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

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noVueTemplateShadow": "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 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/attribute-hyphenation](https://lintradar.dev/rules/vue/attribute-hyphenation.md): Enforce attribute naming style on custom components in template
- [vue/one-component-per-file](https://lintradar.dev/rules/vue/one-component-per-file.md): Enforce that each component should be in its own file
- [vue/prop-name-casing](https://lintradar.dev/rules/vue/prop-name-casing.md): Enforce specific casing for the Prop name in Vue components
- [vue/require-explicit-emits](https://lintradar.dev/rules/vue/require-explicit-emits.md): Require `emits` option with name triggered by `$emit()`
- [vue/valid-v-text](https://lintradar.dev/rules/vue/valid-v-text.md): Enforce valid `v-text` directives
- [vue/v-bind-style](https://lintradar.dev/rules/vue/v-bind-style.md): Enforce `v-bind` directive style

---

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