Skip to content

fix(lint): keep separate count-up objects apart in the repeated fromTo check - #7701

Open
wonjangcloud9 wants to merge 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/lint-fromto-proxy-targets
Open

wonjangcloud9 wants to merge 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/lint-fromto-proxy-targets

Conversation

@wonjangcloud9

Copy link
Copy Markdown
Contributor

Context: I've been using HyperFrames every day for the past two weeks to make Korean Shorts and long-form videos, and it's been great to work with. This PR is one of a batch of fixes for things I ran into along the way, so you'll see several PRs from me at once — sorry for the pile-up, and thanks for your patience. Each one is reproduced on current main, independent of the others, and can be reviewed, merged or closed on its own.

What

gsap_repeated_fromto_without_baseline no longer reports several independent plain-object tweens (count-ups) as one target that is fromTo'd over and over. It groups fromTo calls by the parser's target identity instead of its display label.

Why

A chart scene had four count-up numbers, each driven by its own object through a small helper:

const count = (sel, to, t, d) => {
  const o = { v: 0 };
  tl.fromTo(o, { v: 0 }, { v: to, duration: d, onUpdate: () => { document.querySelector(sel).textContent = o.v.toFixed(0); } }, t);
};

hyperframes lint / check warned:

⚠ gsap_repeated_fromto_without_baseline: 4 tl.fromTo() calls target "proxy (unresolved DOM association)" with no stable baseline. The last-authored fromTo "from" values become the element's resting state for any seek before the first tween actually runs …
  Fix: Add `immediateRender: false` to every fromTo except the earliest-positioned one (at 2.21s) …

Those are four different objects, so no tween can leak its "from" values into another one. The rule keyed its groups on targetSelector, and the parser gives every plain-object tween whose onUpdate it cannot map to a DOM channel the same label, "proxy (unresolved DOM association)". The parser already tells these objects apart: it sets targetIdentity (proxy:<name>@<declaration>, plus the helper/loop call site for per-call objects). overlapping_gsap_tweens already uses that identity and skips labels with no identity (targetHasNoStableIdentity). This rule did neither.

Related work

How

packages/lint/src/rules/gsap.ts:

  • targetKey(win) = win.targetIdentity ?? win.targetSelector. The fromTo groups and the earlier-tl.set baseline lookup now compare targetKey.
  • A target with no stable identity (targetHasNoStableIdentity: __unresolved__, dwell/hold, or a proxy … label without an identity) is skipped. The old code skipped only __unresolved__.

DOM selectors have no targetIdentity, so their grouping does not change. One object tweened by two fromTo calls still warns.

Test plan

Unit (packages/lint/src/rules/gsap.test.ts):

  • keeps separate count-up objects apart: two named objects plus two per-call objects from a helper, no finding.
  • still warns for one count-up object tweened twice: same object, two fromTo, 2 tl.fromTo() calls.

On main (affa03b6) with the fix stashed, × gsap_repeated_fromto_without_baseline: keeps separate count-up objects apart fails (expected { …(6) } to be undefined). With the fix, packages/lint passes all 27 files and 1311 tests.

Real CLI on a repro (index.html with const rev = { v: 0 }, const loss = { v: 0 } and the helper above called twice):

$ hyperframes lint          # main affa03b6
  ⚠ gsap_repeated_fromto_without_baseline: 4 tl.fromTo() calls target "proxy (unresolved DOM association)" with no stable baseline. …
◇  0 error(s), 1 warning(s)

$ hyperframes lint          # this branch
◇  0 errors, 0 warnings

The original project (chart scene with four count(...) calls) shows the same thing: main warns once for compositions/chart.html, and this branch reports 0 errors, 0 warnings.

Gates: oxlint and oxfmt are clean. fallow audit --base origin/main reports no issues in the changed files. The comment ratchet and comment citations pass, and the lefthook typecheck passes.

…o check

gsap_repeated_fromto_without_baseline grouped fromTo calls by the parser's
target label, and every plain-object tween without a DOM write is labelled
"proxy (unresolved DOM association)". Four independent count-up objects
(`const o = { v: 0 }` per counter) were reported as one target fromTo'd four
times. Group by the parser's target identity instead, which already tells
proxy declarations (and helper/loop instances) apart, and skip targets with no
stable identity, the same way overlapping_gsap_tweens does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant