Skip to content

Commit 62c60d7

Browse files
mysticateamichalsnik
authored andcommitted
Fix: no-invalid-template-root has false positive about empty templates (fixes #41) (#44)
* Fix: `no-invalid-template-root` has false positive about empty templates (fixes #41) * revive warnings of empty * update docs * fix for src attributes * fix error message * `if` → `in`
1 parent c44b155 commit 62c60d7

17 files changed

+55
-39
lines changed

docs/rules/no-confusing-v-for-v-if.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ So when they exist on the same node, `v-if` directive should use the reference w
88

99
## 📖 Rule Details
1010

11-
This rule reports the elements which have both `v-for` and `v-if` directives if the following cases:
11+
This rule reports the elements which have both `v-for` and `v-if` directives in the following cases:
1212

1313
- The `v-if` directive does not use the reference which is to the variables which are defined by the `v-for` directives.
1414

docs/rules/no-invalid-template-root.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@ This rule checks whether every template root is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports the template root if the following cases:
7+
This rule reports the template root in the following cases:
88

9+
- The root is nothing. E.g. `<template></template>`.
910
- The root is text. E.g. `<template>hello</template>`.
1011
- The root is multiple elements. E.g. `<template><div>one</div><div>two</div></template>`.
1112
- The root element has `v-for` directives. E.g. `<template><div v-for="x in list">{{x}}</div></template>`.
12-
- The root element has `v-if`/`v-else-if` directives without `v-else` elements. E.g. `<template><div v-if="foo">hello</div></template>`.
1313
- The root element is `<template>` or `<slot>` elements. E.g. `<template><template>hello</template></template>`.
1414

1515
👎 Examples of **incorrect** code for this rule:
1616

17+
```html
18+
<template>
19+
</template>
20+
```
21+
1722
```html
1823
<template>
1924
<div>hello</div>
@@ -33,17 +38,17 @@ This rule reports the template root if the following cases:
3338
</template>
3439
```
3540

41+
👍 Examples of **correct** code for this rule:
42+
3643
```html
3744
<template>
38-
<div v-if="foo"></div>
45+
<div>abc</div>
3946
</template>
4047
```
4148

42-
👍 Examples of **correct** code for this rule:
43-
4449
```html
4550
<template>
46-
<div>abc</div>
51+
<div v-if="foo"></div>
4752
</template>
4853
```
4954

docs/rules/no-invalid-v-bind.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This rule checks whether every `v-bind` directive is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports `v-bind` directives if the following cases:
7+
This rule reports `v-bind` directives in the following cases:
88

99
- The directive does not have that attribute value. E.g. `<div v-bind:aaa></div>`
1010
- The directive has invalid modifiers. E.g. `<div v-bind:aaa.bbb="ccc"></div>`

docs/rules/no-invalid-v-cloak.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This rule checks whether every `v-cloak` directive is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports `v-cloak` directives if the following cases:
7+
This rule reports `v-cloak` directives in the following cases:
88

99
- The directive has that argument. E.g. `<div v-cloak:aaa></div>`
1010
- The directive has that modifier. E.g. `<div v-cloak.bbb></div>`

docs/rules/no-invalid-v-else-if.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This rule checks whether every `v-else-if` directive is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports `v-else-if` directives if the following cases:
7+
This rule reports `v-else-if` directives in the following cases:
88

99
- The directive has that argument. E.g. `<div v-if="foo"></div><div v-else-if:aaa="bar"></div>`
1010
- The directive has that modifier. E.g. `<div v-if="foo"></div><div v-else-if.bbb="bar"></div>`

docs/rules/no-invalid-v-else.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This rule checks whether every `v-else` directive is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports `v-else` directives if the following cases:
7+
This rule reports `v-else` directives in the following cases:
88

99
- The directive has that argument. E.g. `<div v-if="foo"></div><div v-else:aaa></div>`
1010
- The directive has that modifier. E.g. `<div v-if="foo"></div><div v-else.bbb></div>`

docs/rules/no-invalid-v-for.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This rule checks whether every `v-for` directive is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports `v-for` directives if the following cases:
7+
This rule reports `v-for` directives in the following cases:
88

99
- The directive has that argument. E.g. `<div v-for:aaa></div>`
1010
- The directive has that modifier. E.g. `<div v-for.bbb></div>`

docs/rules/no-invalid-v-html.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This rule checks whether every `v-html` directive is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports `v-html` directives if the following cases:
7+
This rule reports `v-html` directives in the following cases:
88

99
- The directive has that argument. E.g. `<div v-html:aaa></div>`
1010
- The directive has that modifier. E.g. `<div v-html.bbb></div>`

docs/rules/no-invalid-v-if.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This rule checks whether every `v-if` directive is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports `v-if` directives if the following cases:
7+
This rule reports `v-if` directives in the following cases:
88

99
- The directive has that argument. E.g. `<div v-if:aaa="foo"></div>`
1010
- The directive has that modifier. E.g. `<div v-if.bbb="foo"></div>`

docs/rules/no-invalid-v-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This rule checks whether every `v-model` directive is valid.
44

55
## 📖 Rule Details
66

7-
This rule reports `v-model` directives if the following cases:
7+
This rule reports `v-model` directives in the following cases:
88

99
- The directive has that argument. E.g. `<input v-model:aaa="foo">`
1010
- The directive has the modifiers which are not supported. E.g. `<input v-model.bbb="foo">`

0 commit comments

Comments
 (0)