no-ternary
Disallow ternary operators
        ❄️ Frozen
        
This rule is currently frozen and is not accepting feature requests.
The ternary operator is used to conditionally assign a value to a variable. Some believe that the use of ternary operators leads to unclear code.
const foo = isBar ? baz : qux;
Rule Details
This rule disallows ternary operators.
Examples of incorrect code for this rule:
                            
                                Open in Playground
                            
/*eslint no-ternary: "error"*/
const foo = ;
function quux() {
  return ;
}
Examples of correct code for this rule:
                            
                                Open in Playground
                            
            /*eslint no-ternary: "error"*/
let foo;
if (isBar) {
    foo = baz;
} else {
    foo = qux;
}
function quux() {
    if (foo) {
        return bar();
    } else {
        return baz();
    }
}
Related Rules
Version
This rule was introduced in ESLint v0.0.9.