-
-
Notifications
You must be signed in to change notification settings - Fork 418
Closed as not planned
Labels
Description
Description
So unicorn/prefer-ternary does not play nicely with the standard rule no-else-return.
With this example
// ❌
function example() {
if (test) {
return a;
} else {
return b;
}
}no-else-return autofixes it like so...
// ❌
function example() {
if (test) {
return a;
}
return b;
}Examples
So ideally unicorn/prefer-ternary would autofix as per this example...
// ❌
function example() {
if (test) {
return a;
}
return b;
}
// ✅
function example() {
return test ? a : b;
}Additional Info
Maybe having no-else-return isn't that great, but still an opportunity to improve here.