Skip to content

invalid-view-transition-definition

Reports an unknown field in a style.viewTransition() definition.

This rule reports a style.viewTransition() definition that the compiler cannot read, such as an unknown field. Each field must name a snapshot pseudo-element, so an unknown field produces no CSS.

Reported

const transition = style.viewTransition({ before: "opacity-0" });invalid-view-transition-definition: view transition keys must be `group`, `old`, `new`, or `imagePair`
style(transition.for("card"));

Fixed

const transition = style.viewTransition({ old: "opacity-0" });
style(transition.for("card"));

How to fix

  • Use the fields group, imagePair, old, and new. old styles the snapshot before the update, and new styles the snapshot after it.
  • Write each field as a utility string literal.

See style.viewTransition().

Rule settings

PresetSeverity
recommendeddeny
strictdeny
stylisticoff

Configure lint to change the severity or options.