Skip to content

Commit aab8d6d

Browse files
authored
docs(tag-check): Add example and explain all options (#1383)
1 parent 19dc511 commit aab8d6d

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

docs/user-guide/rules/tags-check.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,61 @@ id: tags-check
33
title: tags-check
44
---
55

6-
Allowing specify rules for any tag and validate that
6+
Check if particular tags are self-closing or must include or exclude particular tags.
7+
8+
Level: `error`
9+
10+
## Config value
11+
12+
1. true: enable rule
13+
2. false: disable rule
14+
3. {}: configuration object, mapping values of tags to their respective configuration. Tags configuration can have properties of:
15+
16+
`selfclosing`
17+
18+
If an element is or is not self-closing, when it otherwise should be.
19+
20+
Level: `warn`
21+
22+
`attrsRequired`
23+
24+
If an element is missing an attribute that should exist.
25+
26+
Level: `error`
27+
28+
`redundantAttrs`
29+
30+
If an element has an attribute that is not necessary.
31+
32+
Level: `error`
33+
34+
`attrsOptional`
35+
36+
If an element has an attribute that is not included in the allowable set.
37+
38+
Level: `error`
39+
40+
### Example
41+
42+
```json
43+
{
44+
...
45+
"tags-check": {
46+
"a": {
47+
"selfclosing": true,
48+
"attrsRequired": ["href", "title"],
49+
"redundantAttrs": ["alt"],
50+
}
51+
},
52+
"script": {
53+
"attrsOptional": [
54+
["async", "async"],
55+
["defer", "defer"],
56+
],
57+
},
58+
...
59+
}
60+
```
761

862
The following pattern are **not** considered violations:
963

@@ -15,7 +69,7 @@ The following pattern are **not** considered violations:
1569
<img src="bbb" title="aaa" alt="asd" />
1670
```
1771

18-
The following pattern is considered violation:
72+
The following pattern is considered a violation:
1973

2074
<!-- prettier-ignore -->
2175
```html

0 commit comments

Comments
 (0)