Skip to content

duplicate-view-transition-name

Reports two .for() calls in one style() call.

This rule reports a style() call with more than one .for(). An element has one view-transition-name, so only one of the names takes effect.

Reported

const transition = style.viewTransition({ old: "duration-150" });
style(transition.for("a"), transition.for("b"));duplicate-view-transition-name: 2 view-transition-name sources in one style() call; only one element value applies, and a runtime name wins

Fixed

const transition = style.viewTransition({ old: "duration-150" });
style(transition.for("a"));

How to fix

  • Keep one .for() for the element, as in the example.
  • If the names belong to different elements, give each element its own style() call with its own .for().
  • To combine several transitions on one element, pass the others without .for(), such as style(fade, slide.for("a")).

Rule settings

PresetSeverity
recommendedwarn
strictdeny
stylisticoff

Configure lint to change the severity or options.