mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 06:30:03 +00:00
refactor: drop unused exports detected by fallow auto-fix
Run `fallow fix --auto-fixable` to remove `export` keywords from symbols fallow's reachability analysis identifies as unused. Keeps only the cases where the symbol is still referenced internally in its own file (so removing `export` doesn't surface a new oxlint `no-unused-vars` error). Result: fallow dead-code findings drop from 276 → 208 (68 fewer unused exports), with no behavior change — each symbol is still defined and used exactly the same way within its file. Reverted ~20 files where fallow's auto-fix would have created cascading "declared but never used" lint errors — those are cases where the symbol isn't used at all, and properly cleaning them up means deleting the declaration, not just dropping `export`. Better to land that as a separate, narrower PR rather than mixing it into a mechanical de-export. Also reverted four false positives where fallow missed real consumers: - `captureCost.ts` (renderOrchestrator has two separate import blocks from the same module; fallow only saw the first) - `propertyPanelHelpers.ts`, `domEditingLayers.ts` (real internal uses fallow's reachability missed) - `render.ts` (functions imported via `await import()` dynamic import, which fallow's static analysis doesn't follow) Test plan: bun run --filter '*' typecheck (clean), oxlint + oxfmt clean, cli/core/studio/engine vitest suites pass (335 + 917 + 576 + 605 tests).
This commit is contained in:
@@ -20,7 +20,7 @@ export function isFinitePositive(value: number): boolean {
|
||||
return Number.isFinite(value) && value > 0;
|
||||
}
|
||||
|
||||
export function clampTime(time: number, duration: number): number {
|
||||
function clampTime(time: number, duration: number): number {
|
||||
const safeDuration = Math.max(0, Number.isFinite(duration) ? duration : 0);
|
||||
const safeTime = Math.max(0, Number.isFinite(time) ? time : 0);
|
||||
return safeDuration > 0 ? Math.min(safeTime, safeDuration) : safeTime;
|
||||
|
||||
@@ -15,7 +15,7 @@ import { isFinitePositive } from "./playbackAdapter";
|
||||
// Duration attribute helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function readDurationAttribute(el: Element | null | undefined): number {
|
||||
function readDurationAttribute(el: Element | null | undefined): number {
|
||||
if (!el) return 0;
|
||||
const duration =
|
||||
Number.parseFloat(el.getAttribute("data-duration") ?? "") ||
|
||||
@@ -42,7 +42,7 @@ export function readTimelineDurationFromDocument(doc: Document | null | undefine
|
||||
// DOM element type guards
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function isHtmlElement(el: Element): el is HTMLElement {
|
||||
function isHtmlElement(el: Element): el is HTMLElement {
|
||||
const HtmlElementCtor = el.ownerDocument.defaultView?.HTMLElement ?? globalThis.HTMLElement;
|
||||
return typeof HtmlElementCtor !== "undefined" && el instanceof HtmlElementCtor;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export function getTimelineElementDisplayLabel(input: {
|
||||
return tag ? `${tag} clip` : "Timeline clip";
|
||||
}
|
||||
|
||||
export const IMPLICIT_TIMELINE_LAYER_SKIP_TAGS = new Set([
|
||||
const IMPLICIT_TIMELINE_LAYER_SKIP_TAGS = new Set([
|
||||
"base",
|
||||
"link",
|
||||
"meta",
|
||||
@@ -123,7 +123,7 @@ export const IMPLICIT_TIMELINE_LAYER_SKIP_TAGS = new Set([
|
||||
"template",
|
||||
]);
|
||||
|
||||
export function humanizeTimelineIdentifier(value: string): string {
|
||||
function humanizeTimelineIdentifier(value: string): string {
|
||||
return value
|
||||
.trim()
|
||||
.replace(/[_-]+/g, " ")
|
||||
@@ -239,7 +239,7 @@ export function getTimelineElementIdentity(element: TimelineElement): string {
|
||||
// DOM node querying
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function getTimelineDomNodes(doc: Document): Element[] {
|
||||
function getTimelineDomNodes(doc: Document): Element[] {
|
||||
const rootComp = doc.querySelector("[data-composition-id]");
|
||||
return Array.from(doc.querySelectorAll("[data-start]")).filter((node) => node !== rootComp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user