sindresorhus/eslint-plugin-unicorn

`no-nested-ternary` does not autofix nested ternary

Open

#2,008 opened on Dec 7, 2022

View on GitHub
 (3 comments) (0 reactions) (0 assignees)JavaScript (5,022 stars) (468 forks)user submission
docshelp wantedwontfix

Description

var cellText = isYear
    ? i
    : isMonth
        ? settings.text.monthsShort[i]
        : isDay
            ? cellDate.getDate()
            : module.helper.dateFormat(formatter.cellTime, cellDate);

When the rule can autofix ternary (add parenthesis around), I would expect it to fix any level of nesting.

Currently it seems it can autofix only 2 nested ternary operators.

Contributor guide