* Add indentation back to nested ternaries (except JSX) * Add a real-world test case * Add changelog entry --------- Co-authored-by: Alex Rattray <rattrayalex@stripe.com>
585 B
585 B
Add indentation back to nested ternaries (#9559 by @rattrayalex)
// Input
const message =
i % 3 === 0 && i % 5 === 0
? "fizzbuzz"
: i % 3 === 0
? "fizz"
: i % 5 === 0
? "buzz"
: String(i);
// Prettier stable
const message =
i % 3 === 0 && i % 5 === 0
? "fizzbuzz"
: i % 3 === 0
? "fizz"
: i % 5 === 0
? "buzz"
: String(i);
// Prettier main
const message =
i % 3 === 0 && i % 5 === 0
? "fizzbuzz"
: i % 3 === 0
? "fizz"
: i % 5 === 0
? "buzz"
: String(i);