Skip to content

ambiguous-style-base-order

Reports two independent base styles in one call that set the same property.

This rule reports a style() call with two base styles that set the same property, when neither base is built on the other. The order of the arguments does not decide which base wins, so the result is not defined.

Reported

const first = style("p-2");
const second = style("p-4");
export const props = style(first, second);ambiguous-style-base-order: two composition bases declare `padding`; neither base precedes the other, so which declaration wins is undefined

Fixed

const first = style("p-2");
const second = style(first, "p-4");
export const props = style(second);

How to fix

  • Build the overriding base on the other one, as in the example. Then its utilities always win.
  • Or remove the property from one of the bases.

Bases that set different properties do not need this.

Rule settings

PresetSeverity
recommendedwarn
strictdeny
stylisticoff

Configure lint to change the severity or options.

The CLI and the editor report this rule only when they analyze the whole project.