Skip to content

Commit

Permalink
Add documentation for indentLogicalExpressions option of jsx-indent r…
Browse files Browse the repository at this point in the history
…ule.
  • Loading branch information
mdnsk committed Apr 3, 2019
1 parent ce54181 commit 9e74973
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions docs/rules/jsx-indent.md
Expand Up @@ -31,11 +31,11 @@ The following patterns are considered warnings:
## Rule Options

It takes an option as the second parameter which can be `"tab"` for tab-based indentation or a positive number for space indentations.
To enable checking the indentation of attributes, use the third parameter to turn on the `checkAttributes` option (default is false).
To enable checking the indentation of attributes or add indentation to logical expressions, use the third parameter to turn on the `checkAttributes` (default is false) and `indentLogicalExpressions` (default is false) respectively.

```js
...
"react/jsx-indent": [<enabled>, 'tab'|<number>, {checkAttributes: <boolean>}]
"react/jsx-indent": [<enabled>, 'tab'|<number>, {checkAttributes: <boolean>, indentLogicalExpressions: <boolean>}]
...
```

Expand All @@ -61,6 +61,13 @@ The following patterns are considered warnings:
}
/>
</App>

// [2, 2, {indentLogicalExpressions: true}]
<App>
{condition && (
<Hello />
)}
</App>
```
The following patterns are **not** warnings:
Expand Down Expand Up @@ -92,6 +99,13 @@ The following patterns are **not** warnings:
}
/>
</App>

// [2, 2, {indentLogicalExpressions: true}]
<App>
{condition && (
<Hello />
)}
</App>
```
## When not to use
Expand Down

0 comments on commit 9e74973

Please sign in to comment.