Open
Description
The preferred ternary style is the following:
- if it can fit on a single line, put it on a single line, e.g.
const color = selected ? 'green' : 'orange'
- if it can't fit on a single line, put the
?
and:
at the start of each line, e.g.
const result = reallyVeryLengthConditional
? superLongComputationOfPositiveResult()
: superLongComputationOfNegativeResult();
const style = selected
? {
color: 'green',
fontWeight: 'bold',
}
: {
color: 'orange',
}
Metadata
Metadata
Assignees
Labels
No labels