Skip to content

Commit 91f25b7

Browse files
committed
add documentation
Signed-off-by: Sebastian Malton <[email protected]>
1 parent 7440098 commit 91f25b7

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

docs/rules/jsx-tag-spacing.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Examples of **correct** code for this rule, when configured with `{ "closingSlas
6262

6363
### `beforeSelfClosing`
6464

65-
This check can be set to `"always"`, `"never"` or `"allow"` (to disable it).
65+
This check can be set to `"always"`, `"never"`, `"multiline-always"`, or `"allow"` (to disable it).
6666

6767
If it is `"always"`, the check warns whenever a space is missing before the closing bracket. If `"never"` then it warns if a space is present before the closing bracket. The default value of this check is `"always"`.
6868

@@ -102,6 +102,26 @@ Examples of **correct** code for this rule, when configured with `{ "beforeSelfC
102102
/>
103103
```
104104

105+
Examples of **incorrect** code for this rule, when configured with `{ "beforeSelfClosing": "multiline-always" }`:
106+
107+
```jsx
108+
<Hello
109+
firstName="John"
110+
lastName="Smith" />
111+
<Hello
112+
firstName="John"
113+
lastName="Smith"/>
114+
```
115+
116+
Examples of **correct** code for this rule, when configured with `{ "beforeSelfClosing": "multiline-always" }`:
117+
118+
```jsx
119+
<Hello
120+
firstName="John"
121+
lastName="Smith"
122+
/>
123+
```
124+
105125
### `afterOpening`
106126

107127
This check can be set to `"always"`, `"never"`, `"allow-multiline"` or `"allow"` (to disable it).
@@ -179,7 +199,7 @@ Examples of **correct** code for this rule, when configured with `{ "afterOpenin
179199

180200
### `beforeClosing`
181201

182-
This check can be set to `"always"`, `"never"`, or `"allow"` (to disable it).
202+
This check can be set to `"always"`, `"never"`, `"multiline-always"`, or `"allow"` (to disable it).
183203

184204
If it is `"always"` the check warns whenever whitespace is missing before the closing bracket of a JSX opening element or whenever a space is missing before the closing bracket closing element. If `"never"`, then it warns if a space is present before the closing bracket of either a JSX opening element or closing element. This rule will never warn for self closing JSX elements. The default value of this check is `"allow"`.
185205

@@ -219,6 +239,31 @@ Examples of **correct** code for this rule, when configured with `{ "beforeClosi
219239
</Hello>
220240
```
221241

242+
Examples of **incorrect** code for this rule, when configured with `{ "beforeClosing": "multiline-always" }`:
243+
244+
```jsx
245+
<Hello
246+
firstName="John"
247+
lastName="Smith">
248+
</Hello>
249+
<Hello
250+
firstName="John"
251+
lastName="Smith" >
252+
Goodbye
253+
</Hello>
254+
```
255+
256+
Examples of **correct** code for this rule, when configured with `{ "beforeClosing": "multiline-always" }`:
257+
258+
```jsx
259+
<Hello
260+
firstName="John"
261+
lastName="Smith"
262+
>
263+
Goodbye
264+
</Hello>
265+
```
266+
222267
## When Not To Use It
223268

224269
You can turn this rule off if you are not concerned with the consistency of spacing in or around JSX brackets.

0 commit comments

Comments
 (0)