|
2 | 2 |
|
3 | 3 | - :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
|
4 | 4 |
|
5 | | -This rule report variable definitions of v-for directives or scope attributes if those are not used. |
6 | | - |
7 | 5 | ## :book: Rule Details
|
8 | 6 |
|
9 | | -:-1: Examples of **incorrect** code for this rule: |
| 7 | +This rule report variable definitions of v-for directives or scope attributes if those are not used. |
10 | 8 |
|
11 | | -```html |
| 9 | +<eslint-code-block :rules="{'vue/no-unused-vars': ['error']}"> |
| 10 | +``` |
12 | 11 | <template>
|
13 | | - <ol v-for="i in 5"><!-- "i" is defined but never used. --> |
14 | | - <li>item</li> |
| 12 | + <!-- ✓ GOOD --> |
| 13 | + <ol v-for="i in 5"> |
| 14 | + <li>{{ i }}</li> |
15 | 15 | </ol>
|
16 | | -</template> |
17 | | -``` |
18 | | - |
19 | | -:+1: Examples of **correct** code for this rule: |
20 | 16 |
|
21 | | -```html |
22 | | -<template> |
| 17 | + <!-- ✗ BAD --> |
23 | 18 | <ol v-for="i in 5">
|
24 | | - <li>{{i}}</li><!-- "i" is defined and used. --> |
| 19 | + <li>item</li> |
25 | 20 | </ol>
|
26 | 21 | </template>
|
27 | 22 | ```
|
| 23 | +</eslint-code-block> |
28 | 24 |
|
29 | 25 | ## :wrench: Options
|
30 | 26 |
|
|
0 commit comments