sindresorhus/eslint-plugin-unicorn

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

Closed

#2,008 opened on Dec 7, 2022

 (3 comments) (0 reactions) (0 assignees)JavaScript (468 forks)user submission
docshelp wantedwontfix

Repository metrics

Stars
 (5,022 stars)
PR merge metrics
 (Avg merge 1d 16h) (399 merged PRs in 30d)

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