From ee8dacab1e5be5445a545e60b94cdc1ac3f498fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 21 May 2026 14:09:25 -0400 Subject: [PATCH] fix(lint): exclude gsap.fromTo() from gsap_from_opacity_noop rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gsap.fromTo(target, fromVars, toVars) animates to toVars, not to the current CSS value — so fromTo({opacity:0}, {opacity:1}) with CSS opacity:0 is a legitimate 0→1 fade-in, not a noop. The rule was false-positiving on these calls with error severity, which would block the render pipeline. Drop the fromTo branch from the trigger guard and add a test case that proves fromTo does not fire. --- packages/core/src/lint/rules/gsap.test.ts | 18 ++++++++++++++++++ packages/core/src/lint/rules/gsap.ts | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/core/src/lint/rules/gsap.test.ts b/packages/core/src/lint/rules/gsap.test.ts index 4ec961842..5dd6e2e5e 100644 --- a/packages/core/src/lint/rules/gsap.test.ts +++ b/packages/core/src/lint/rules/gsap.test.ts @@ -806,6 +806,24 @@ describe("GSAP rules", () => { expect(finding).toBeUndefined(); }); + it("does NOT error when gsap.fromTo({opacity:0}, {opacity:1}) — destination overrides CSS", () => { + const html = ` + +
+
Hello
+
+ +`; + const result = lintHyperframeHtml(html); + const finding = result.findings.find((f) => f.code === "gsap_from_opacity_noop"); + expect(finding).toBeUndefined(); + }); + it("does NOT error when gsap.to() uses opacity:0 (exit animation)", () => { const html = ` diff --git a/packages/core/src/lint/rules/gsap.ts b/packages/core/src/lint/rules/gsap.ts index 76ac506ca..7c28aaa4f 100644 --- a/packages/core/src/lint/rules/gsap.ts +++ b/packages/core/src/lint/rules/gsap.ts @@ -875,7 +875,7 @@ export const gsapRules: Array<(ctx: LintContext) => HyperframeLintFinding[]> = [ const windows = extractGsapWindows(script.content); for (const win of windows) { - if (win.method !== "from" && win.method !== "fromTo") continue; + if (win.method !== "from") continue; if (!win.properties.includes("opacity")) continue; const sel = win.targetSelector; const cssKey = sel.startsWith("#") || sel.startsWith(".") ? sel : `#${sel}`;