Skip to content

Commit 5317452

Browse files
committed
Add documentation for the jsx-curly-spacing alternative option
1 parent 82b4fb7 commit 5317452

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/rules/jsx-curly-spacing.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,25 @@ The following patterns are not warnings:
107107
<Hello name={ {firstname: 'John', lastname: 'Doe'} } />;
108108
```
109109

110+
#### Alternative
111+
112+
When setting the `alternative` option to `true` you must collapse the curly braces:
113+
114+
```json
115+
"jsx-curly-spacing": [2, "always", {"alternative": true}]
116+
```
117+
118+
When `"always"` is used and `alternative` is `true`, the following pattern is not warnings:
119+
120+
```js
121+
<App foo={{ bar: true, baz: true }} />;
122+
```
123+
124+
When `"always"` is used and `alternative` is `true`, the following pattern is considered warnings:
125+
126+
```js
127+
<App foo={ {bar: true, baz: true} } />;
128+
```
110129

111130
## When Not To Use It
112131

0 commit comments

Comments
 (0)