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 winsFixed
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 asstyle(fade, slide.for("a")).
Rule settings
| Preset | Severity |
|---|---|
recommended | warn |
strict | deny |
stylistic | off |
Configure lint to change the severity or options.