diff --git a/packages/lint/src/rules/gsap.test.ts b/packages/lint/src/rules/gsap.test.ts index e4a0798cd21..0f8dc494997 100644 --- a/packages/lint/src/rules/gsap.test.ts +++ b/packages/lint/src/rules/gsap.test.ts @@ -3056,6 +3056,29 @@ describe("SVG draw-on rules", () => { expect(finding?.severity).toBe("warning"); expect(finding?.selector).toBe("#ring"); + expect(finding?.fixHint).toContain("every fromTo except the earliest-positioned one (at 5s)"); + expect(finding?.fixHint).toContain("gsap_timeline_set_initial_hide"); + }); + + it("gsap_repeated_fromto_without_baseline: accepts the hinted shape when the later tween is authored first", async () => { + const html = ` + +
+ + +`; + const result = await lintHyperframeHtml(html); + const finding = result.findings.find( + (candidate) => candidate.code === "gsap_repeated_fromto_without_baseline", + ); + + expect(finding).toBeUndefined(); }); it("gsap_repeated_fromto_without_baseline: accepts explicit immediateRender false", async () => { diff --git a/packages/lint/src/rules/gsap.ts b/packages/lint/src/rules/gsap.ts index 215669de778..721d2825782 100644 --- a/packages/lint/src/rules/gsap.ts +++ b/packages/lint/src/rules/gsap.ts @@ -1148,9 +1148,10 @@ export const gsapRules: LintRule[] = [ `(immediateRender), not at tween position.`, selector, fixHint: - `Add \`immediateRender: false\` to the destination vars of each future fromTo, or set a safe ` + - `resting state with an earlier \`tl.set("${selector}", { ... }, 0)\`. Pre-first-tween seeks must not ` + - `inherit whichever fromTo call happened to author last.`, + `Add \`immediateRender: false\` to every fromTo except the earliest-positioned one ` + + `(at ${firstFromToPosition}s), so pre-first-tween seeks keep its "from" values. ` + + `A hiding \`tl.set(..., 0)\` baseline trips gsap_timeline_set_initial_hide, and a \`gsap.set\` ` + + `authored before the fromTo calls is overwritten by them.`, snippet: truncateSnippet(fromToWindows.map((win) => win.raw).join("\n")), }); }