Skip to content

Commit

Permalink
[jsx-wrap-multilines] Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yepninja committed Aug 20, 2017
1 parent 657e77e commit 252c3ba
Showing 1 changed file with 63 additions and 1 deletion.
64 changes: 63 additions & 1 deletion docs/rules/jsx-wrap-multilines.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ Wrapping multiline JSX in parentheses can improve readability and/or convenience

## Rule Details

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).
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).

There are the possible syntax available:

* `declaration`
* `assignment`
* `return`
* `arrow`
* `condition` (not enabled by default)
* `logical` (not enabled by default)
* `attr` (not enabled by default)

The following patterns are considered warnings:

Expand Down Expand Up @@ -118,3 +121,62 @@ var hello = () => (
</div>
);
```

The following patterns are considered warnings when configured `{condition: true}`.

```jsx
<div>
{foo ? <div>
<p>Hello</p>
</div> : null}
</div>
```

The following patterns are not considered warnings when configured `{condition: true}`.

```jsx
<div>
{foo ? (<div>
<p>Hello</p>
</div>) : null}
</div>
```


The following patterns are considered warnings when configured `{logical: true}`.

```jsx
<div>
{foo &&
<div>
<p>Hello World</p>
</div>
}
</div>
```

The following patterns are not considered warnings when configured `{logical: true}`.

```jsx
<div> not
```

The following patterns are considered warnings when configured `{attr: true}`.

```jsx
<div attr={<div>
<p>Hello</p>
</div>}>
<p>Hello</p>
</div>;
```

The following patterns are not considered warnings when configured `{attr: true}`.

```jsx
<div attr={(<div>
<p>Hello</p>
</div>)}>
<p>Hello</p>
</div>;
```

0 comments on commit 252c3ba

Please sign in to comment.