Skip to content

feat(lint): detect missing adapter library scripts (GSAP, Lottie, Three.js)#149

Closed
miguel-heygen wants to merge 1 commit intomainfrom
feat/lint-missing-adapter-libs
Closed

feat(lint): detect missing adapter library scripts (GSAP, Lottie, Three.js)#149
miguel-heygen wants to merge 1 commit intomainfrom
feat/lint-missing-adapter-libs

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen commented Mar 31, 2026

Summary

  • Adds 3 new error-severity lint rules that fire when a composition uses an adapter library without loading it:
    • missing_gsap_script — uses gsap.to/from/timeline or window.__timelines but no GSAP <script> tag
    • missing_lottie_script — has data-lottie-src or lottie.loadAnimation but no Lottie <script> tag
    • missing_three_script — references THREE. but no Three.js <script> tag
  • Each rule includes a fixHint with the recommended CDN script tag

Stacks on fix/lint-improvements (#134).

Test plan

  • 7 new test cases covering all 3 rules (usage without script → error, usage with script → clean)
  • All 380 core tests pass

@miguel-heygen miguel-heygen changed the base branch from fix/lint-improvements to main March 31, 2026 21:18
…ee.js)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen miguel-heygen force-pushed the feat/lint-missing-adapter-libs branch from 8bee1c6 to f8cb0e6 Compare March 31, 2026 21:24
miguel-heygen added a commit that referenced this pull request Mar 31, 2026
…ith plugin system (#170)

## Summary

- Breaks `hyperframeLinter.ts` from 1,314 lines (one massive function) into a plugin system of focused rule modules
- Introduces `LintContext` — HTML is parsed once and shared across all rules
- Adds `LintRule<TContext>` type as the formal contract for rules
- Public API unchanged: `lintHyperframeHtml`, `lintMediaUrls`, `lintScriptUrls` signatures identical

## New file structure

```
src/lint/
  utils.ts          — shared types (OpenTag, ExtractedBlock), regex constants, helpers
  context.ts        — LintContext type + buildLintContext() factory
  rules/
    core.ts         — structural rules (root attrs, timeline registry, script syntax)
    media.ts        — media element rules (duplicate ids, video pitfalls, placeholder URLs, etc.)
    gsap.ts         — GSAP rules + GSAP-specific parsing utils
    captions.ts     — caption rules
    composition.ts  — timed element, deprecated attrs, template literal selector, external scripts
    adapters.ts     — Lottie + Three.js missing-script rules (from PR #149)
  hyperframeLinter.ts — orchestrator only (~200 lines, down from 1,314)
```

## Adding a new adapter rule going forward

1. Create `src/lint/rules/my-adapter.ts` exporting `myAdapterRules: LintRule[]`
2. Import and spread into `ALL_RULES` in `hyperframeLinter.ts`

## Test plan

- [x] All 402 core tests pass unchanged
- [x] Full workspace build clean (`pnpm build`)
- [x] TypeScript strict mode clean (`pnpm tsc --noEmit`)
@miguel-heygen miguel-heygen deleted the feat/lint-missing-adapter-libs branch April 6, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants