Skip to content

no-class-property

Reports the class field, which adds classes without generated CSS.

This rule reports a class field in style(). A class field adds classes that another stylesheet defines, so Stillwind does not check them. Enable this rule when every style in the project must come from utilities. No preset enables it.

Reported

.card {
  border-radius: 8px;
  padding: 16px;
}
style({ class: "card" });no-class-property: `class` contributions are forbidden in style objects; use utilities, custom properties, or CSS variants

Fixed

@utility card {
  border-radius: 8px;
  padding: 16px;
}
style("card");

How to fix

  • Move the class’s declarations into a utility, as in the example. Keep the same declarations so the component’s appearance does not change.
  • If a third-party library needs its own class, keep the class field and add a suppression comment with the reason.

Rule settings

PresetSeverity
recommendedoff
strictoff
stylisticoff

Configure lint to change the severity or options.