Skip to content

invalid-cva-config

Reports an unknown or malformed field in a style.cva() configuration.

This rule reports a style.cva() configuration that the compiler cannot read, such as an unknown field, a default for an option that does not exist, or a configuration that is not written in the call. The factory ignores the invalid part.

Reported

style.cva("p-4", { variant: { size: { small: "p-2" } } });invalid-cva-config: invalid style.cva() configuration: unknown configuration property

Fixed

style.cva("p-4", { variants: { size: { small: "p-2" } } });

How to fix

  • Use the fields variants, defaultVariants, and compoundVariants.
  • Write the configuration as an object literal in the call.
  • In defaultVariants and compoundVariants, use only options and values that variants declares.

See style.cva().

Rule settings

PresetSeverity
recommendeddeny
strictdeny
stylisticoff

Configure lint to change the severity or options.