Skip to content

Commit 9e74973

Browse files
committed
Add documentation for indentLogicalExpressions option of jsx-indent rule.
1 parent ce54181 commit 9e74973

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

docs/rules/jsx-indent.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ The following patterns are considered warnings:
3131
## Rule Options
3232

3333
It takes an option as the second parameter which can be `"tab"` for tab-based indentation or a positive number for space indentations.
34-
To enable checking the indentation of attributes, use the third parameter to turn on the `checkAttributes` option (default is false).
34+
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.
3535

3636
```js
3737
...
38-
"react/jsx-indent": [<enabled>, 'tab'|<number>, {checkAttributes: <boolean>}]
38+
"react/jsx-indent": [<enabled>, 'tab'|<number>, {checkAttributes: <boolean>, indentLogicalExpressions: <boolean>}]
3939
...
4040
```
4141

@@ -61,6 +61,13 @@ The following patterns are considered warnings:
6161
}
6262
/>
6363
</App>
64+
65+
// [2, 2, {indentLogicalExpressions: true}]
66+
<App>
67+
{condition && (
68+
<Hello />
69+
)}
70+
</App>
6471
```
6572
6673
The following patterns are **not** warnings:
@@ -92,6 +99,13 @@ The following patterns are **not** warnings:
9299
}
93100
/>
94101
</App>
102+
103+
// [2, 2, {indentLogicalExpressions: true}]
104+
<App>
105+
{condition && (
106+
<Hello />
107+
)}
108+
</App>
95109
```
96110
97111
## When not to use

0 commit comments

Comments
 (0)