sindresorhus/eslint-plugin-unicorn

Do you want to work on this issue?

You can request for a bounty in order to promote it!

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

mvorisek posted onGitHub

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.


Add parenthesis won't fix anything, this rule doesn't allow nested ternary > 2 level.

posted by fisker about 2 years ago

Maybe we should document that.

posted by fisker about 2 years ago

yeah you are right @mvorisek it can autofix only 2 nested ternary operators.

var cellText = isYear ? i : (isMonth ? settings.text.monthsShort[i] : (isDay ? cellDate.getDate() : module.helper.dateFormat(formatter.cellTime, cellDate))); can you provide me what more I've to do in this issue?

posted by kaushalji-123 about 1 year ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests