This rule reports a .for() call with more than one argument, or with a key that
is not a string or a number. One .for() call names one element, so extra
arguments do not name more elements.
Reported
const transition = style.viewTransition({ old: "duration-150" });
style(transition.for("a", "b"));invalid-view-transition-use: viewTransition.for() accepts at most one key expressionFixed
const transition = style.viewTransition({ old: "duration-150" });
const first = style(transition.for("a"));
const second = style(transition.for("b"));How to fix
- Give each element its own
.for()call with its own key, as in the example. - Use a string or a number as the key, such as the ID of the item.
Rule settings
| Preset | Severity |
|---|---|
recommended | deny |
strict | deny |
stylistic | off |
Configure lint to change the severity or options.