Assuming #1700 isn't implemented (I'm not against that change btw) can the formatting of ternaries be improved. For the common if/else formatting, it would preferable to follow facebook standard which is:
? trueResult
: falseResult;
which is far more readable vs. the current formatting:
booleanCheck ?
trueResult : falseResult;
For the nested ternaries, I'd love to see a JS style pattern match layout used, though I'm sure this is more contentious. For instance:
? trueResult1 :
booleanCheck2
? trueResult2 :
booleanCheck3
? trueResult3 :
fallbackResult;
First one should be done. Not sure we should encourage the last one though. That should be pattern matching on a tuple
Regarding the second pattern, I don't find myself using it in my reason/ocaml code, as pattern matching is so much more powerful. That said my major annoyance with prettier in the javascript world is it's formatting of ternaries. Perhaps non-nested formatting of these would be a decent incremental step when introducing people to reason. Or even better, maybe convert nested ternaries into switch statements.
Pattern match on a tuple isn't lazy so it's not quite the same. I definitely think the simple case formatting is more important here.
Flattening out the formatting seems nice. I don't have strong opinions on the formatting style of ? placement (end of line or beginning). I suppose beginning of line would make it consistent with other operators.
Most helpful comment
First one should be done. Not sure we should encourage the last one though. That should be pattern matching on a tuple