Closed Shyam-Chen closed 2 months ago
https://eslint.vuejs.org/rules/no-template-shadow.html
Disallow variable declarations from shadowing variables declared in the outer scope
<script lang="ts"> let foo = $state(['bar', 'baz']); </script> <!-- ✓ GOOD --> <ul> {#each [1, 2, 3] as num (num)} <li>{num}</li> <ul> {#each [11, 22, 33] as subNum (subNum)} <li>{subNum}</li> {/each} </ul> {/each} </ul> <!-- ✗ BAD --> <ul> {#each [1, 2, 3] as num (num)} <li>{num}</li> <ul> {#each [11, 22, 33] as num (num)} <li>{num}</li> {/each} </ul> {/each} </ul> <ul> {#each [1, 2, 3] as foo (foo)} <li>{foo}</li> {/each} </ul>
No response
This plugin works differently from eslint-plugin-vue, so you can check it with the no-shadow rule.
no-shadow
https://eslint.org/docs/latest/rules/no-shadow
Online Demo
Motivation
https://eslint.vuejs.org/rules/no-template-shadow.html
Description
Disallow variable declarations from shadowing variables declared in the outer scope
Examples
Additional comments
No response