multiline-ternary
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"multiline-ternary": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
foo > bar ? value1 : value2;
foo > bar ? value :
value2;
foo > bar ?
value : value2;foo > bar ? value1 :
value2;
foo > bar ?
value1 : value2;
foo > bar &&
bar > baz ? value1 : value2;foo > bar ? value :
value2;
foo > bar ?
value : value2;
foo >
bar ?
value1 :
value2;foo > bar ?
value1 :
value2;
foo > bar ?
(baz > qux ?
value1 :
value2) :
value3;
foo > bar
? (baz > qux
? value1
: value2)
: value3;foo > bar ? value1 : value2;
foo > bar ?
value1 :
value2;
foo > bar ?
(baz > qux ? value1 : value2) :
value3;
foo > bar ?
(baz > qux ?
value1 :
value2) :
value3;
foo > bar &&
bar > baz ?
value1 :
value2;
foo > bar
? baz > qux
? value1
: value2
: value3;foo > bar ? value1 : value2;
foo > bar ? (baz > qux ? value1 : value2) : value3;
foo > bar ? (
baz > qux ? value1 : value2
) : value3;Examples from the ESLint documentation.
multiline-ternary
eslint
export default [
{
rules: {
"multiline-ternary": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce newlines between operands of ternary expressions in <template>
Disallow equal signs explicitly at the beginning of regular expressions
Disallow calls to the Object constructor without an argument
Enforce a maximum depth that callbacks can be nested
Enforce a maximum cyclomatic complexity allowed in a program
Enforce the use of u or v flag on regular expressions