You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/self-closing-comp.md
+52-1Lines changed: 52 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,5 +17,56 @@ var contentContainer = <div className="content"></div>;
17
17
18
18
var HelloJohn =<Hello name="John"/>;
19
19
20
-
var Profile =<Hello name="John"><img src="picture.png"/></Hello>;
20
+
var Profile =<Hello name="John"><img src="picture.png"/></Hello>;
21
+
```
22
+
23
+
## Rule Options
24
+
25
+
The rule can take one argument to select types of tags, which should be self-closed when this is possible. By default only custom components tags should be self-closed.
26
+
27
+
```js
28
+
...
29
+
"self-closing-comp": ["error", {
30
+
"component":true,
31
+
"html":false
32
+
}]
33
+
...
34
+
```
35
+
36
+
### `component`
37
+
38
+
When `true`, custom components tags should be self-closed.
39
+
40
+
The following patterns are considered warnings:
41
+
42
+
```js
43
+
var HelloJohn =<Hello name="John"></Hello>;
44
+
```
45
+
46
+
The following patterns are not considered warnings:
47
+
48
+
```js
49
+
var contentContainer =<div className="content"></div>;
50
+
51
+
var HelloJohn =<Hello name="John"/>;
52
+
53
+
var Profile =<Hello name="John"><img src="picture.png"/></Hello>;
54
+
```
55
+
56
+
### `html`
57
+
58
+
When `true`, html components tags should be self-closed.
59
+
60
+
The following patterns are considered warnings:
61
+
62
+
```js
63
+
var contentContainer =<div className="content"></div>;
64
+
```
65
+
66
+
The following patterns are not considered warnings:
67
+
68
+
```js
69
+
var contentContainer =<div className="content"/>;
70
+
71
+
var contentContainer =<div className="content"><div /></div>;
0 commit comments