prettier/tests/ternaries
Christopher Chedeau 314e96322c Add parenthesis for unusual nested ternaries (#1386)
All of the discussions around ternaries are for the form

```js
cond1 ? elem1_if : cond2 ? elem2_if : elem_else
```

but some of them are for the form

```js
cond1 ? cond2 ? elem2_if : elem2_else : elem1_else
```

which is more rare and would be good to call out by adding parenthesis.

```js
cond1 ? (cond2 ? elem2_if : elem2_else) : elem1_else
```

Note that we only want parenthesis if it's written inline, otherwise the indentation is good enough to understand the flow:

```js
cond1
  ? cond2 ? elem2_if : elem2_else
  : elem1_else
```
2017-05-01 14:28:36 -07:00
..
__snapshots__ Add parenthesis for unusual nested ternaries (#1386) 2017-05-01 14:28:36 -07:00
jsfmt.spec.js Feature/verify against same snapshot (#1087) 2017-03-25 08:10:17 -07:00
parenthesis.js Add parenthesis for unusual nested ternaries (#1386) 2017-05-01 14:28:36 -07:00
test.js Indent ternaries (#484) 2017-01-26 11:58:40 -08:00