Skip to content

duplicate-definition

Reports a utility or variant definition that replaces an earlier one with the same name.

This rule reports a @utility or @custom-variant definition that replaces an earlier definition with the same name. The definitions do not combine, so the earlier one is lost. In the example, hocus matches focus only, not hover.

Reported

@custom-variant hocus (&:hover);duplicate-definition: `@custom-variant hocus` is never used because a later definition with the same name replaces it
@custom-variant hocus (&:focus);

Fixed

@custom-variant hocus (&:hover, &:focus);

How to fix

  • To combine the definitions, write them as one definition, as in the example.
  • If one of the definitions is left over, remove it.

Rule settings

PresetSeverity
recommendedwarn
strictdeny
stylisticoff

Configure lint to change the severity or options.