eslint-plugin-proper-ternary
eslint-plugin-proper-ternary copied to clipboard
Allow ternary as an arrow function body
I'd like to be able to configure this plugin such that:
Bad:
const arrow = () => {
return a ? b : c; // error because it's a return statement
};
function fn() {
return a ? b : c;
}
Good:
const arrow = () => a ? b : c;
const arrowWithReturn = () => {
if (a) {
return b;
} else {
return c;
}
};
function fn() {
if (a) {
return b;
} else {
return c;
}
}
I can get almost there with the @getify/proper-ternary/where rule, except that I don't want () => a ? b : c to be an error.