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/jsx-tag-spacing.md
+47-2Lines changed: 47 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ Examples of **correct** code for this rule, when configured with `{ "closingSlas
62
62
63
63
### `beforeSelfClosing`
64
64
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).
66
66
67
67
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"`.
68
68
@@ -102,6 +102,26 @@ Examples of **correct** code for this rule, when configured with `{ "beforeSelfC
102
102
/>
103
103
```
104
104
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
+
105
125
### `afterOpening`
106
126
107
127
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
179
199
180
200
### `beforeClosing`
181
201
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).
183
203
184
204
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"`.
185
205
@@ -219,6 +239,31 @@ Examples of **correct** code for this rule, when configured with `{ "beforeClosi
219
239
</Hello>
220
240
```
221
241
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
+
222
267
## When Not To Use It
223
268
224
269
You can turn this rule off if you are not concerned with the consistency of spacing in or around JSX brackets.
0 commit comments