Skip to content

ineffective-anchor-scope

Reports an empty or repeated ref list in an anchor scope.

This rule reports an anchor scope with an empty ref list, or with a ref listed twice. An empty list sets no anchor-scope, and a repeated ref adds nothing.

Reported

style(style.anchorScope([]));ineffective-anchor-scope: anchor scope is empty; no scope declaration is emitted

Fixed

const trigger = style.ref("trigger");
style(style.anchorScope([trigger]));

How to fix

Write the scope that you mean:

  • List the refs whose anchor names this element limits, as in the example.
  • Use "all" to limit every anchor name.
  • Use "none" to set anchor-scope: none.

See style.anchorScope().

Rule settings

PresetSeverity
recommendedwarn
strictdeny
stylisticoff

Configure lint to change the severity or options.