Skip to content

Commit 1aa26df

Browse files
authored
docs: Add more examples for multiline-ternary (#17610)
1 parent 47d0b44 commit 1aa26df

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

docs/src/rules/multiline-ternary.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ var foo = bar > baz ? value1 : value2;
1818
The above can be rewritten as the following to improve readability and more clearly delineate the operands:
1919

2020
```js
21+
2122
var foo = bar > baz ?
2223
value1 :
2324
value2;
25+
26+
var foo = bar > baz
27+
? value1
28+
: value2;
2429
```
2530

2631
## Rule Details
@@ -74,6 +79,12 @@ foo > bar ?
7479
value1 :
7580
value2) :
7681
value3;
82+
83+
foo > bar
84+
? (baz > qux
85+
? value1
86+
: value2)
87+
: value3;
7788
```
7889

7990
:::
@@ -126,6 +137,12 @@ foo > bar &&
126137
bar > baz ?
127138
value1 :
128139
value2;
140+
141+
foo > bar
142+
? baz > qux
143+
? value1
144+
: value2
145+
: value3;
129146
```
130147

131148
:::

0 commit comments

Comments
 (0)