Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add more examples for multiline-ternary #17610

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/src/rules/multiline-ternary.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ var foo = bar > baz ? value1 : value2;
The above can be rewritten as the following to improve readability and more clearly delineate the operands:

```js

var foo = bar > baz ?
value1 :
value2;

var foo = bar > baz
? value1
: value2;
```

## Rule Details
Expand Down Expand Up @@ -74,6 +79,12 @@ foo > bar ?
value1 :
value2) :
value3;

foo > bar
? (baz > qux
? value1
: value2)
: value3;
```

:::
Expand Down Expand Up @@ -126,6 +137,12 @@ foo > bar &&
bar > baz ?
value1 :
value2;

foo > bar
? baz > qux
? value1
: value2
: value3;
```

:::
Expand Down