Skip to content

Commit 252c3ba

Browse files
committed
[jsx-wrap-multilines] Add docs
1 parent 657e77e commit 252c3ba

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

docs/rules/jsx-wrap-multilines.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ Wrapping multiline JSX in parentheses can improve readability and/or convenience
66

77
## Rule Details
88

9-
This rule optionally takes a second parameter in the form of an object, containing places to apply the rule. By default, all the syntax listed below will be checked, but these can be explicitly disabled. Any syntax type missing in the object will follow the default behavior (become enabled).
9+
This rule optionally takes a second parameter in the form of an object, containing places to apply the rule. By default, all the syntax listed below will be checked except the conditional expressions, logical expressions and JSX attributes, but these can be explicitly disabled. Any syntax type missing in the object will follow the default behavior (become enabled).
1010

1111
There are the possible syntax available:
1212

1313
* `declaration`
1414
* `assignment`
1515
* `return`
1616
* `arrow`
17+
* `condition` (not enabled by default)
18+
* `logical` (not enabled by default)
19+
* `attr` (not enabled by default)
1720

1821
The following patterns are considered warnings:
1922

@@ -118,3 +121,62 @@ var hello = () => (
118121
</div>
119122
);
120123
```
124+
125+
The following patterns are considered warnings when configured `{condition: true}`.
126+
127+
```jsx
128+
<div>
129+
{foo ? <div>
130+
<p>Hello</p>
131+
</div> : null}
132+
</div>
133+
```
134+
135+
The following patterns are not considered warnings when configured `{condition: true}`.
136+
137+
```jsx
138+
<div>
139+
{foo ? (<div>
140+
<p>Hello</p>
141+
</div>) : null}
142+
</div>
143+
```
144+
145+
146+
The following patterns are considered warnings when configured `{logical: true}`.
147+
148+
```jsx
149+
<div>
150+
{foo &&
151+
<div>
152+
<p>Hello World</p>
153+
</div>
154+
}
155+
</div>
156+
```
157+
158+
The following patterns are not considered warnings when configured `{logical: true}`.
159+
160+
```jsx
161+
<div> not
162+
```
163+
164+
The following patterns are considered warnings when configured `{attr: true}`.
165+
166+
```jsx
167+
<div attr={<div>
168+
<p>Hello</p>
169+
</div>}>
170+
<p>Hello</p>
171+
</div>;
172+
```
173+
174+
The following patterns are not considered warnings when configured `{attr: true}`.
175+
176+
```jsx
177+
<div attr={(<div>
178+
<p>Hello</p>
179+
</div>)}>
180+
<p>Hello</p>
181+
</div>;
182+
```

0 commit comments

Comments
 (0)