@hyperframes/lint 0.7.70 → 0.7.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +8 -4
- package/dist/browser.js.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2426,8 +2426,12 @@ ${right.raw}`)
|
|
|
2426
2426
|
return findings;
|
|
2427
2427
|
},
|
|
2428
2428
|
// gsap_infinite_repeat
|
|
2429
|
-
({ scripts }) => {
|
|
2429
|
+
({ scripts, rootTag }) => {
|
|
2430
2430
|
const findings = [];
|
|
2431
|
+
const declaredDuration = Number.parseFloat(
|
|
2432
|
+
rootTag ? readAttr(rootTag.raw, "data-duration") ?? "" : ""
|
|
2433
|
+
);
|
|
2434
|
+
const hasFiniteCompositionWindow = Number.isFinite(declaredDuration) && declaredDuration > 0;
|
|
2431
2435
|
const pattern = /repeat\s*:\s*-1(?!\d)/g;
|
|
2432
2436
|
for (const { snippet } of scanScriptsForRegexMatches(scripts, pattern, {
|
|
2433
2437
|
stripComments: true,
|
|
@@ -2436,9 +2440,9 @@ ${right.raw}`)
|
|
|
2436
2440
|
})) {
|
|
2437
2441
|
findings.push({
|
|
2438
2442
|
code: "gsap_infinite_repeat",
|
|
2439
|
-
severity: "error",
|
|
2440
|
-
message:
|
|
2441
|
-
fixHint: "
|
|
2443
|
+
severity: hasFiniteCompositionWindow ? "warning" : "error",
|
|
2444
|
+
message: hasFiniteCompositionWindow ? `GSAP tween uses \`repeat: -1\` (infinite), but the composition declares a finite ${declaredDuration}s window. HyperFrames clips deterministic seeking and export to that explicit duration.` : "GSAP tween uses `repeat: -1` (infinite) without a finite composition `data-duration`. The timeline can report an unbounded duration and make render planning fail.",
|
|
2445
|
+
fixHint: hasFiniteCompositionWindow ? "Keep the explicit finite composition `data-duration`. Use a finite repeat count only when the loop itself must end before the composition does." : "Add a finite composition `data-duration`, or replace `repeat: -1` with `repeat: Math.max(0, Math.floor(totalDuration / singleCycleDuration) - 1)`.",
|
|
2442
2446
|
snippet: truncateSnippet(snippet)
|
|
2443
2447
|
});
|
|
2444
2448
|
}
|