Skip to content

feat(lint): add gsap_css_transform_conflict and sequential_clips_different_tracks rules#105

Closed
miguel-heygen wants to merge 1 commit into
heygen-com:mainfrom
miguel-heygen:feat/lint-gsap-css-transform-conflict
Closed

feat(lint): add gsap_css_transform_conflict and sequential_clips_different_tracks rules#105
miguel-heygen wants to merge 1 commit into
heygen-com:mainfrom
miguel-heygen:feat/lint-gsap-css-transform-conflict

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

Summary

Two new lint rules that catch silent rendering bugs discovered while authoring compositions with HyperFrames.

  • gsap_css_transform_conflict (error) — fires when an element has transform: translateX(-50%) or transform: scale() in CSS and a GSAP tl.to/from tween animates x, y, xPercent, yPercent, or scale. GSAP silently overwrites the full CSS transform, discarding centering tricks like translateX(-50%). The fix hint guides authors to the safe fromTo + xPercent pattern.

  • sequential_clips_different_tracks (warning) — fires when sequential (non-overlapping) class="clip" scenes are on different data-track-index values. The framework only auto-mounts/unmounts clips on the same track; clips on different tracks are always present in the DOM, making GSAP opacity the only guard — which can silently fail at seek time, causing only the first scene to render.

Root cause

Both bugs were encountered while building a launch video. The title reveal placed HYPER and FRAMES off-center because tl.to("#title", { x: 0 }) stripped the translateX(-50%) centering. Separately, a multi-scene composition showed only the first scene because each scene was on a unique track index.

Test plan

  • gsap_css_transform_conflict — positive: tl.to with x on element with CSS translateX → error
  • gsap_css_transform_conflict — positive: tl.to with scale on element with CSS scale() → error
  • gsap_css_transform_conflict — negative: tl.fromTo on element without CSS transform → no finding
  • sequential_clips_different_tracks — positive: 3 sequential clips on tracks 1/2/3 → warning
  • sequential_clips_different_tracks — negative: 3 sequential clips all on track 1 → no finding
  • All 21 existing tests still pass (pnpm vitest run src/lint/hyperframeLinter.test.ts)
  • Pre-commit hooks (lint + format) pass clean

🤖 Generated with Claude Code

…erent_tracks rules

Two new lint rules that catch silent rendering bugs:

**gsap_css_transform_conflict** (error)
When an element has `transform: translateX(-50%)` or `transform: scale()`
in CSS and is also targeted by a GSAP `tl.to/from` tween animating `x`,
`y`, `xPercent`, `yPercent`, or `scale` — GSAP silently overwrites the
full CSS transform, discarding centering tricks like translateX(-50%).

Root cause: discovered while authoring a title reveal where `HYPER` and
`FRAMES` were meant to collide at center but ended up pinned to the right
half of the frame because `tl.to("#title", { x: 0 })` stripped the
`translateX(-50%)` centering.

Fix hint guides authors toward the safe pattern:
  `tl.fromTo('#el', { xPercent: -50, x: -1000 }, { xPercent: -50, x: 0 })`

**sequential_clips_different_tracks** (warning)
When sequential (non-overlapping) `class="clip"` elements are spread across
different `data-track-index` values, the framework only auto-mounts/unmounts
clips on the *same* track. Clips on different tracks are always present in
the DOM — only GSAP opacity controls their visibility, which can silently
fail at seek time, causing only the first scene to appear.

Fix hint: use `data-track-index="1"` on all sequential scene clips.

Both rules are tested with positive cases (conflict detected) and negative
cases (correct patterns not flagged).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen
Copy link
Copy Markdown
Collaborator Author

Closing in favour of a cleaner PR pushed directly from the main repo.

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