Skip to content

Commit d102a85

Browse files
authored
Add more examples to self-closing-comp docs
I also changed some syntax highlighting to use JSX.
1 parent c0038f9 commit d102a85

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

docs/rules/self-closing-comp.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Components without children can be self-closed to avoid unnecessary extra closin
66

77
The following patterns are considered warnings:
88

9-
```js
9+
```jsx
1010
var HelloJohn = <Hello name="John"></Hello>;
1111
```
1212

1313
The following patterns are not considered warnings:
1414

15-
```js
15+
```jsx
1616
var contentContainer = <div className="content"></div>;
1717

1818
var intentionalSpace = <div>{' '}</div>;
@@ -43,15 +43,17 @@ When `true`, custom components tags should be self-closed.
4343

4444
The following patterns are considered warnings:
4545

46-
```js
46+
```jsx
4747
var HelloJohn = <Hello name="John"></Hello>;
4848
```
4949

5050
The following patterns are not considered warnings:
5151

52-
```js
52+
```jsx
5353
var contentContainer = <div className="content"></div>;
5454

55+
var intentionalSpace = <div>{' '}</div>;
56+
5557
var HelloJohn = <Hello name="John" />;
5658

5759
var Profile = <Hello name="John"><img src="picture.png" /></Hello>;
@@ -63,14 +65,16 @@ When `true`, html components tags should be self-closed.
6365

6466
The following patterns are considered warnings:
6567

66-
```js
68+
```jsx
6769
var contentContainer = <div className="content"></div>;
6870
```
6971

7072
The following patterns are not considered warnings:
7173

72-
```js
74+
```jsx
7375
var contentContainer = <div className="content" />;
7476

7577
var contentContainer = <div className="content"><div /></div>;
78+
79+
var intentionalSpace = <div>{' '}</div>;
7680
```

0 commit comments

Comments
 (0)