Skip to content

missing-document-target

Reports a style.css() utility without a selector to apply to.

This rule reports a utility in style.css() that has no element to style. style.css() returns a stylesheet, not props for an element, so a utility needs a selector option or a variant that sets its own selector. Otherwise the utility produces no CSS.

Reported

style.css("p-4");missing-document-target: no variant selects the element to style; start with a variant such as `host:` or `[:root]:`

Fixed

style.css("p-4", { selector: ":host" });

How to fix

  • Add a selector option, such as :host for the shadow host.
  • Or use a variant that sets its own selector, such as host:p-4.

See style.css().

Rule settings

PresetSeverity
recommendeddeny
strictdeny
stylisticoff

Configure lint to change the severity or options.