Skip to content

redundant-variant

Reports a variant that adds no condition, such as hover:hover:.

This rule reports a variant that adds no condition, such as a second hover: in hover:hover:. It also reports a variant that another variant in the stack already implies. With the default breakpoints, sm: is redundant in sm:md: because every width that matches md: also matches sm:.

Reported

style("hover:hover:p-4");redundant-variant: variant `hover` repeats the earlier `hover` and has no effect
style("sm:md:p-4");redundant-variant: variant `sm` has no effect because `md` implies its condition

Fixed

style("hover:p-4");
style("md:p-4");

How to fix

Remove the extra variant, and keep the others. The automatic fix removes it.

Variants that can never match together are reported by unsatisfiable-variants instead.

Rule settings

PresetSeverity
recommendedwarn
strictdeny
stylisticoff

Configure lint to change the severity or options.