@hyperframes/lint 0.7.63 → 0.7.65
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 +25 -4
- package/dist/browser.js.map +1 -1
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2279,8 +2279,8 @@ ${right.raw}`)
|
|
|
2279
2279
|
findings.push({
|
|
2280
2280
|
code: "gsap_infinite_repeat",
|
|
2281
2281
|
severity: "error",
|
|
2282
|
-
message: "GSAP tween uses `repeat: -1` (infinite). Infinite repeats break the deterministic capture engine which seeks to exact frame times. Use a finite repeat count calculated from the composition duration: `repeat: Math.floor(duration / cycleDuration) - 1`.",
|
|
2283
|
-
fixHint: "Replace `repeat: -1` with a finite count, e.g. `repeat: Math.floor(totalDuration / singleCycleDuration) - 1`. Use Math.floor (not Math.ceil)
|
|
2282
|
+
message: "GSAP tween uses `repeat: -1` (infinite). Infinite repeats break the deterministic capture engine which seeks to exact frame times. Use a finite repeat count calculated from the composition duration: `repeat: Math.max(0, Math.floor(duration / cycleDuration) - 1)`.",
|
|
2283
|
+
fixHint: "Replace `repeat: -1` with a finite count, e.g. `repeat: Math.max(0, Math.floor(totalDuration / singleCycleDuration) - 1)`. Use Math.floor (not Math.ceil) so the animation fits, and clamp at zero so a short composition cannot evaluate to -1.",
|
|
2284
2284
|
snippet: truncateSnippet(snippet)
|
|
2285
2285
|
});
|
|
2286
2286
|
}
|
|
@@ -2299,7 +2299,26 @@ ${right.raw}`)
|
|
|
2299
2299
|
code: "gsap_repeat_ceil_overshoot",
|
|
2300
2300
|
severity: "warning",
|
|
2301
2301
|
message: "GSAP repeat calculation uses `Math.ceil` which can overshoot the composition duration. For example, Math.ceil(10.5 / 2) - 1 = 5 repeats \u2192 6 cycles \xD7 2s = 12s, exceeding 10.5s.",
|
|
2302
|
-
fixHint: "Use `Math.floor` instead of `Math.ceil` to ensure the animation fits within the duration: `repeat: Math.floor(totalDuration / cycleDuration) - 1`. Math.floor(10.5 / 2) - 1 = 4 repeats \u2192 5 cycles \xD7 2s = 10s \u2713",
|
|
2302
|
+
fixHint: "Use `Math.floor` instead of `Math.ceil` to ensure the animation fits within the duration: `repeat: Math.max(0, Math.floor(totalDuration / cycleDuration) - 1)`. Math.floor(10.5 / 2) - 1 = 4 repeats \u2192 5 cycles \xD7 2s = 10s \u2713",
|
|
2303
|
+
snippet: truncateSnippet(snippet)
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
return findings;
|
|
2307
|
+
},
|
|
2308
|
+
// gsap_repeat_floor_unclamped
|
|
2309
|
+
({ scripts }) => {
|
|
2310
|
+
const findings = [];
|
|
2311
|
+
const pattern = /repeat\s*:\s*Math\.floor\s*\([^)]+\)\s*-\s*1/g;
|
|
2312
|
+
for (const { snippet } of scanScriptsForRegexMatches(scripts, pattern, {
|
|
2313
|
+
stripComments: false,
|
|
2314
|
+
contextBefore: 40,
|
|
2315
|
+
contextAfter: 40
|
|
2316
|
+
})) {
|
|
2317
|
+
findings.push({
|
|
2318
|
+
code: "gsap_repeat_floor_unclamped",
|
|
2319
|
+
severity: "warning",
|
|
2320
|
+
message: "GSAP repeat calculation can evaluate to -1 when the composition is shorter than one cycle, which GSAP interprets as an infinite repeat.",
|
|
2321
|
+
fixHint: "Clamp the finite repeat count at zero: `repeat: Math.max(0, Math.floor(totalDuration / cycleDuration) - 1)`.",
|
|
2303
2322
|
snippet: truncateSnippet(snippet)
|
|
2304
2323
|
});
|
|
2305
2324
|
}
|
|
@@ -3493,10 +3512,12 @@ var compositionRules = [
|
|
|
3493
3512
|
}
|
|
3494
3513
|
if (timing.diagnostics.some(({ code }) => code === "deprecated-end")) {
|
|
3495
3514
|
const elementId = readAttr(tag.raw, "id") || void 0;
|
|
3515
|
+
const conflicting = timing.diagnostics.some(({ code }) => code === "conflicting-end");
|
|
3516
|
+
const message = conflicting ? `<${tag.name}${elementId ? ` id="${elementId}"` : ""}> has data-end that disagrees with data-duration. Remove the stale data-end; the compiler regenerates it from data-duration.` : `<${tag.name}${elementId ? ` id="${elementId}"` : ""}> uses data-end without data-duration. Use data-duration in source HTML.`;
|
|
3496
3517
|
findings.push({
|
|
3497
3518
|
code: "deprecated_data_end",
|
|
3498
3519
|
severity: "error",
|
|
3499
|
-
message
|
|
3520
|
+
message,
|
|
3500
3521
|
elementId,
|
|
3501
3522
|
fixHint: "Replace data-end with data-duration. The compiler generates data-end from data-duration automatically.",
|
|
3502
3523
|
snippet: truncateSnippet(tag.raw)
|