JS.VUE.NO.TEMPLATE.SHADOW

Disallow variable declarations from shadowing variables declared in the outer scope

no-template-shadow should report variable definitions of v-for directives or scope attributes if they shadow the variables in parent scopes.

Rule Details

This rule aims to eliminate shadowed variable declarations of v-for directives or scope attributes.

{'vue/no-template-shadow': ['error']}

Copy
<template>
  <!-- GOOD -->
  <div v-for="i in 5"></div>
  <div v-for="j in 5"></div>

  <!-- BAD -->
  <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>

Options

Nothing.

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/