How to setup flatTernaryExpressions in prettier VSCode?

Viewed 45

I have configured prettier for formatting documents in VSCode. When I format document, it formats like below

function fun1(value: string): string {
    return <condition_1>
        ? "string1"
        : <condition_1>
        ? "string2"
        : <condition_2>
        ? "string2"
        : "string3"

I am expecting formatting like this

function fun1(value: string): string {
    return <condition_1>
        ? "string1"
        : <condition_1>
            ? "string2"
            : <condition_2>
                ? "string2"
                : "string3"
0 Answers
Related