Skip to content

fix(site): add astro check CI and reduce errors/hints#1109

Merged
decepulis merged 13 commits intomainfrom
fix/site-astro-check-errors
Apr 22, 2026
Merged

fix(site): add astro check CI and reduce errors/hints#1109
decepulis merged 13 commits intomainfrom
fix/site-astro-check-errors

Conversation

@decepulis
Copy link
Copy Markdown
Collaborator

@decepulis decepulis commented Mar 24, 2026

Closes #1110

Summary

Reduces astro check from 125 errors / 49 hints to 0 errors / 33 hints, and adds astro check as a CI gate.

Type error fixes (125 → 0)

Initial cleanup (125 → 4):

  • Bump tsconfig lib ES2020 → ES2022 (enables replaceAll, Intl.ListFormat)
  • Update vi.fn generics to Vitest 3+ syntax (66 errors)
  • Convert utilReferenceModel.js and componentReferenceModel.js to TypeScript (18 errors)
  • Fix api-docs-builder for typescript-api-extractor renames and TS 6 changes (10 errors)
  • Update demo code for current @videojs/html and @videojs/react APIs (9 errors)
  • Install @types/jsdom, fix iron-session/marked/routing type mismatches (8 errors)
  • Fix stale 'mux-video' renderer → 'hls' in MuxUploaderPanel (2 errors)
  • @ts-expect-error only where the type checker provably can't model runtime behavior: Astro slot-to-prop transform (3), MuxUploader ref (1)

Blocker cleared: The 4 Selector-incompatibility errors tracked in #1111 were resolved by the workaround in #1403 (use module-level PlayerController from @videojs/html instead of the one returned by createPlayer()).

Drift absorbed after main merge (24 new errors → 0):

  • astro.config.mjs: Import Shiki grammars from shiki/langs/*.mjs (Shiki tightened the langs type to LanguageRegistration[]). Drop stale Astro 5 @ts-expect-error on Vite plugins (Astro 6 aligned the types).
  • middleware/__tests__/index.test.ts: AstroActionContext is no longer exported from astro:actions; derive via ReturnType<typeof getActionContext>.
  • Code/Shared.tsx: Narrow preClassName/codeClassName to string | undefined to satisfy clsx's ClassValue.
  • DocsLink.astro: Narrow className with ?? undefinedHTMLAttributes<'a'>.class is nullable but A.astro's class prop is not.
  • Img.astro: Split the <Image> branches by inline typeof src === 'string' narrowing so each call site matches exactly one Astro Image overload. No runtime change; removes a src as string cast.
  • vitest.config.ts: Switch /// <reference types="vitest" />"vitest/config" (Vitest 4+ path). Drop stale Astro 5 @ts-expect-error.
  • use-media demo removed — referenced HTMLMediaElement properties (tagName, currentSrc, videoWidth, videoHeight) that are no longer on the Media interface after the MediaHost rework in chore(site): rewrite media element builder for MediaHost architecture #1334. Follow-up for prose + new demo: Docs: Update use-media Reference Page for MediaHost Architecture #1405.

Hint cleanup (49 → 33)

  • Remove unused imports, variables, and props across site components
  • Remove unused parseNames function from build-ejected-skins
  • Prefix unused test fixture params with _
  • Remove ...props rest spread from 12 SocialProofLogos components

The remaining 33 hints are all unfixable, with comments explaining why:

  • import * as ts style suggestions (8) — idiomatic TS compiler API pattern
  • Deprecated lucide brand icons (6) — will replace when lucide v1.0 drops
  • define:vars not visible to type checker (2) — language-tools#711
  • JSON-LD is:inline (1) — expected for structured data (astro#3544)
  • Frontmatter return hides usage — astro check can't see reads inside return

(Net hint count rose slightly after the main merge absorbed new upstream drift; the hints above cover the full remaining set.)

CI: astro check as a hard gate

  • Added astro-check job to website-tests.yml (runs on all PRs and pushes to main)
  • Generates site content (api-docs, ejected-skins) before checking so CI matches local results
  • Uses --minimumSeverity warning to hide hints from CI output
  • Hard failure (no continue-on-error) — same as package typecheck

Verified

  • astro check0 errors, 0 warnings, 33 hints
  • pnpm -F site test — all tests passing (green on CI)
  • CI green: astro-check, typecheck, lint, build, all package tests

Follow-ups

Test plan

  • pnpm astro check reports 0 errors
  • pnpm -F site test passes (CI)
  • CI astro-check job runs and is green
  • Spot-check demo pages in dev server (especially player-controller, html-create-player after fix(site): work around #1111 in create-player/player-controller demos #1403 workaround)
  • Verify /docs/framework/react/reference/use-media still renders (demo removed; prose still present)

🤖 Generated with Claude Code


Note

Medium Risk
Adds a new CI gate (astro check) and makes broad TypeScript/typing changes across the site build and docs tooling; failures could block merges and a few tweaks touch auth/session behavior.

Overview
CI now gates on Astro typechecking. website-tests.yml adds an astro-check job that builds packages, generates docs/skins content, and runs pnpm astro check.

Typecheck fixes across the site + tooling. Updates Astro/Shiki config to pre-register Shiki grammars via shiki/langs/*.mjs, bumps TS lib target, tightens/adjusts types (Vitest refs, vi.fn typings, clsx class types, Astro component props), and refactors the API reference model helpers into typed TS (componentReferenceModel, utilReferenceModel) plus TypeScript AST handling updates in api-docs-builder.

Behavior/content adjustments. Session seal/unseal now hard-error if SESSION_COOKIE_PASSWORD is missing, Mux uploader switches renderer to hls, some docs demos/content are updated or removed (notably the use-media demo), and various unused props/imports are cleaned up to reduce astro check hints.

Reviewed by Cursor Bugbot for commit 37b6032. Bugbot is set up for automated code reviews on this repo. Configure here.

Prompted by #1101 (TS 6 / Vitest 4 upgrade), `astro check` accumulated
125 type errors across config, tests, builder scripts, demos, and source
files. This commit brings the count to zero so we can enforce it in CI.

Key changes:
- Bump tsconfig lib ES2020 → ES2022 (replaceAll, Intl.ListFormat)
- Update vi.fn generics to Vitest 3+ syntax
- Convert utilReferenceModel.js and componentReferenceModel.js to .ts
- Fix api-docs-builder for TAE and TS 6 API changes
- Update demo code for current @videojs/html and @videojs/react APIs
- Install @types/jsdom, fix iron-session/marked/routing type mismatches
- Add @ts-expect-error where Astro type-checker can't model runtime
  behavior (Vite 6/8 plugin mismatch, Astro slot-to-prop transform)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 24, 2026

Deploy Preview for vjs10-site ready!

Name Link
🔨 Latest commit 37b6032
🔍 Latest deploy log https://app.netlify.com/projects/vjs10-site/deploys/69e8dd9752eb260008635cd0
😎 Deploy Preview https://deploy-preview-1109--vjs10-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v10-sandbox Ready Ready Preview, Comment Apr 22, 2026 2:39pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

CI Failure Diagnosis

File Type What failed
site/package.json link Lockfile out of date — @types/jsdom@^28.0.1 was added to site/package.json but pnpm-lock.yaml was not regenerated. Run pnpm install and commit the updated lockfile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Runs `astro check` on PRs to surface type regressions without blocking
merges. Uses `continue-on-error: true` so failures show as yellow
warnings instead of red failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 24, 2026

📦 Bundle Size Report

🎨 @videojs/html — no changes
Presets (7)
Entry Size
/video (default) 28.70 kB
/video (default + hls) 161.34 kB
/video (minimal) 26.22 kB
/video (minimal + hls) 158.79 kB
/audio (default) 26.57 kB
/audio (minimal) 24.17 kB
/background 4.15 kB
Media (8)
Entry Size
/media/background-video 1.04 kB
/media/container 1.73 kB
/media/dash-video 236.54 kB
/media/hls-video 133.86 kB
/media/mux-audio 160.01 kB
/media/mux-video 159.87 kB
/media/native-hls-video 3.77 kB
/media/simple-hls-video 15.80 kB
Players (3)
Entry Size
/video/player 7.21 kB
/audio/player 5.27 kB
/background/player 3.86 kB
Skins (17)
Entry Type Size
/video/minimal-skin.css css 3.50 kB
/video/skin.css css 3.53 kB
/video/minimal-skin js 26.20 kB
/video/minimal-skin.tailwind js 26.42 kB
/video/skin js 28.70 kB
/video/skin.tailwind js 28.78 kB
/audio/minimal-skin.css css 2.54 kB
/audio/skin.css css 2.50 kB
/audio/minimal-skin js 24.17 kB
/audio/minimal-skin.tailwind js 24.35 kB
/audio/skin js 26.58 kB
/audio/skin.tailwind js 26.72 kB
/background/skin.css css 117 B
/background/skin js 1.14 kB
/base.css css 157 B
/shared.css css 88 B
/skin-element js 1.35 kB
UI Components (25)
Entry Size
/ui/alert-dialog 1022 B
/ui/alert-dialog-close 509 B
/ui/alert-dialog-description 380 B
/ui/alert-dialog-title 385 B
/ui/buffering-indicator 2.46 kB
/ui/captions-button 2.63 kB
/ui/cast-button 2.66 kB
/ui/compounds 4.14 kB
/ui/controls 2.31 kB
/ui/error-dialog 3.02 kB
/ui/fullscreen-button 2.62 kB
/ui/hotkey 1.90 kB
/ui/mute-button 2.69 kB
/ui/pip-button 2.64 kB
/ui/play-button 2.66 kB
/ui/playback-rate-button 2.68 kB
/ui/popover 1.83 kB
/ui/poster 2.26 kB
/ui/seek-button 2.65 kB
/ui/slider 1.52 kB
/ui/thumbnail 2.92 kB
/ui/time 2.52 kB
/ui/time-slider 3.92 kB
/ui/tooltip 2.02 kB
/ui/volume-slider 2.66 kB

Sizes are marginal over the root entry point.

⚛️ @videojs/react — no changes
Presets (7)
Entry Size
/video (default) 23.53 kB
/video (default + hls) 154.79 kB
/video (minimal) 21.11 kB
/video (minimal + hls) 152.52 kB
/audio (default) 19.07 kB
/audio (minimal) 17.58 kB
/background 755 B
Media (7)
Entry Size
/media/background-video 575 B
/media/dash-video 235.04 kB
/media/hls-video 132.64 kB
/media/mux-audio 158.59 kB
/media/mux-video 158.53 kB
/media/native-hls-video 2.26 kB
/media/simple-hls-video 14.36 kB
Skins (14)
Entry Type Size
/video/minimal-skin.css css 3.44 kB
/video/skin.css css 3.46 kB
/video/minimal-skin js 21.04 kB
/video/minimal-skin.tailwind js 24.53 kB
/video/skin js 23.40 kB
/video/skin.tailwind js 24.63 kB
/audio/minimal-skin.css css 2.44 kB
/audio/skin.css css 2.39 kB
/audio/minimal-skin js 17.52 kB
/audio/minimal-skin.tailwind js 20.04 kB
/audio/skin js 19.01 kB
/audio/skin.tailwind js 20.02 kB
/background/skin.css css 90 B
/background/skin js 272 B
UI Components (20)
Entry Size
/ui/alert-dialog 1.14 kB
/ui/buffering-indicator 1.83 kB
/ui/captions-button 2.07 kB
/ui/cast-button 2.07 kB
/ui/controls 1.81 kB
/ui/error-dialog 2.28 kB
/ui/fullscreen-button 2.09 kB
/ui/mute-button 2.11 kB
/ui/pip-button 2.01 kB
/ui/play-button 2.00 kB
/ui/playback-rate-button 1.94 kB
/ui/popover 1.86 kB
/ui/poster 1.69 kB
/ui/seek-button 2.14 kB
/ui/slider 2.67 kB
/ui/thumbnail 2.12 kB
/ui/time 2.11 kB
/ui/time-slider 2.43 kB
/ui/tooltip 2.18 kB
/ui/volume-slider 3.19 kB

Sizes are marginal over the root entry point.

🧩 @videojs/core — no changes
Entries (9)
Entry Size
. 4.96 kB
/dom 11.84 kB
/dom/media/custom-media-element 1.90 kB
/dom/media/dash 234.13 kB
/dom/media/google-cast 4.07 kB
/dom/media/hls 131.89 kB
/dom/media/mux 158.01 kB
/dom/media/native-hls 1.61 kB
/dom/media/simple-hls 13.73 kB
🏷️ @videojs/element — no changes
Entries (2)
Entry Size
. 999 B
/context 943 B
📦 @videojs/store — no changes
Entries (3)
Entry Size
. 1.39 kB
/html 695 B
/react 360 B
🔧 @videojs/utils — no changes
Entries (10)
Entry Size
/array 104 B
/dom 1.92 kB
/events 319 B
/function 327 B
/object 275 B
/predicate 265 B
/string 148 B
/style 190 B
/time 478 B
/number 158 B
📦 @videojs/spf — no changes
Entries (3)
Entry Size
. 40 B
/dom 13.33 kB
/playback-engine 13.24 kB

ℹ️ How to interpret

All sizes are standalone totals (minified + brotli).

Icon Meaning
No change
🔺 Increased ≤ 10%
🔴 Increased > 10%
🔽 Decreased
🆕 New (no baseline)

Run pnpm size locally to check current sizes.

…in CI

Remove unused imports, variables, and props across site components.
Add explanatory comments for unfixable hints (define:vars, JSON-LD,
deprecated lucide icons, frontmatter return). Generate api-docs and
ejected-skins before astro check in CI so results match local. Use
--minimumSeverity warning to hide remaining hints in CI output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Job-level continue-on-error still shows as red X in PR checks.
Step-level makes the step show as warning but the job passes green.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Package typecheck is already a hard failure — astro check should be
too. The 4 remaining errors are a package type bug (#1111) and will
clear once that's resolved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@decepulis decepulis marked this pull request as ready for review March 24, 2026 20:05
@decepulis decepulis changed the title fix(site): resolve astro check type errors (125 → 0) fix(site): add astro check CI gate and reduce errors from 125 to 4 Mar 24, 2026
@decepulis decepulis changed the title fix(site): add astro check CI gate and reduce errors from 125 to 4 fix(site): add astro check CI gate and reduce errors/hints Mar 24, 2026
@decepulis decepulis changed the title fix(site): add astro check CI gate and reduce errors/hints fix(site): add astro check CI and reduce errors/hints Mar 24, 2026
…tions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…errors

# Conflicts:
#	pnpm-lock.yaml
#	site/astro.config.mjs
#	site/src/components/FooterDocs.astro
#	site/src/components/docs/demos/use-button/react/css/BasicUsage.tsx
#	site/src/components/icons/SocialProofLogos.tsx
claude added 3 commits April 22, 2026 14:06
Type errors introduced by main drift during the life of this PR:

- astro.config.mjs: import Shiki lang grammars from 'shiki/langs/*.mjs'
  (Shiki types tightened from strings to LanguageRegistration[]); drop
  stale Astro 5 @ts-expect-error on Vite plugins (Astro 6 aligned types)
- middleware test: AstroActionContext no longer exported; derive via
  ReturnType<typeof getActionContext>
- Code/Shared.tsx: narrow preClassName/codeClassName to 'string | undefined'
  (Shiki emits strings; matches clsx's ClassValue)
- DocsLink.astro: annotate 'href: string' explicitly (astro-check inferred
  string|null|undefined through polymorphic intersection; root cause TBD)
- Img.astro: make 'inferSize={true}' explicit to match overload
- vitest.config.ts: switch reference to 'vitest/config' (Vitest 4+ path);
  drop stale Astro 5 @ts-expect-error
- Remove use-media demo (referenced HTMLMediaElement props no longer on
  Media interface after #1334). Follow-up: #1405.
…errors

# Conflicts:
#	site/src/components/docs/demos/player-controller/html/css/BasicUsage.ts
DocsLink.astro: HTMLAttributes<'a'>.class is typed 'string | null
| undefined'; A.astro's class prop is 'string | undefined'. Narrow
with 'className ?? undefined' to drop the null.

Img.astro: cast src to string for the Astro Image branch. The
wrapper passes through a union (string | ImageMetadata | Promise<...>)
that Astro's overloaded Image prop union can't model in a single
call site. The cast is truthful at runtime: public-path strings
and remote URL strings both round-trip under 'inferSize: true'.
Replace the `src as string` cast with inline typeof narrowing across
three branches:

- typeof string + http → native <img> (same as before)
- typeof string + non-http → <Image inferSize={true}> (public paths)
- ImageMetadata | Promise → <Image> (no inferSize; dimensions from metadata)

TS narrows `src` at each level via the inline `typeof` check, so each
<Image> call matches one Astro overload cleanly. No runtime changes.
@decepulis decepulis merged commit c3984f7 into main Apr 22, 2026
26 checks passed
@decepulis decepulis deleted the fix/site-astro-check-errors branch April 22, 2026 15:18
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.

Chore: Clean Up Site Types and Add Astro Check CI Workflow

2 participants