fix(site): add astro check CI and reduce errors/hints#1109
Merged
Conversation
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>
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
CI Failure Diagnosis
|
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>
Contributor
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (8)
Players (3)
Skins (17)
UI Components (25)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (7)
Skins (14)
UI Components (20)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (9)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (10)
📦 @videojs/spf — no changesEntries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
…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>
…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
2 tasks
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1110
Summary
Reduces
astro checkfrom 125 errors / 49 hints to 0 errors / 33 hints, and addsastro checkas a CI gate.Type error fixes (125 → 0)
Initial cleanup (125 → 4):
replaceAll,Intl.ListFormat)vi.fngenerics to Vitest 3+ syntax (66 errors)utilReferenceModel.jsandcomponentReferenceModel.jsto TypeScript (18 errors)typescript-api-extractorrenames and TS 6 changes (10 errors)@videojs/htmland@videojs/reactAPIs (9 errors)@types/jsdom, fixiron-session/marked/routing type mismatches (8 errors)'mux-video'renderer →'hls'in MuxUploaderPanel (2 errors)@ts-expect-erroronly 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-levelPlayerControllerfrom@videojs/htmlinstead of the one returned bycreatePlayer()).Drift absorbed after
mainmerge (24 new errors → 0):astro.config.mjs: Import Shiki grammars fromshiki/langs/*.mjs(Shiki tightened thelangstype toLanguageRegistration[]). Drop stale Astro 5@ts-expect-erroron Vite plugins (Astro 6 aligned the types).middleware/__tests__/index.test.ts:AstroActionContextis no longer exported fromastro:actions; derive viaReturnType<typeof getActionContext>.Code/Shared.tsx: NarrowpreClassName/codeClassNametostring | undefinedto satisfyclsx'sClassValue.DocsLink.astro: NarrowclassNamewith?? undefined—HTMLAttributes<'a'>.classis nullable butA.astro'sclassprop is not.Img.astro: Split the<Image>branches by inlinetypeof src === 'string'narrowing so each call site matches exactly one AstroImageoverload. No runtime change; removes asrc as stringcast.vitest.config.ts: Switch/// <reference types="vitest" />→"vitest/config"(Vitest 4+ path). Drop stale Astro 5@ts-expect-error.use-mediademo removed — referencedHTMLMediaElementproperties (tagName,currentSrc,videoWidth,videoHeight) that are no longer on theMediainterface 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)
parseNamesfunction from build-ejected-skins_...propsrest spread from 12 SocialProofLogos componentsThe remaining 33 hints are all unfixable, with comments explaining why:
import * as tsstyle suggestions (8) — idiomatic TS compiler API patterndefine:varsnot visible to type checker (2) — language-tools#711is:inline(1) — expected for structured data (astro#3544)returnhides usage — astro check can't see reads insidereturn(Net hint count rose slightly after the
mainmerge absorbed new upstream drift; the hints above cover the full remaining set.)CI:
astro checkas a hard gateastro-checkjob towebsite-tests.yml(runs on all PRs and pushes to main)api-docs,ejected-skins) before checking so CI matches local results--minimumSeverity warningto hide hints from CI outputcontinue-on-error) — same as packagetypecheckVerified
astro check— 0 errors, 0 warnings, 33 hintspnpm -F site test— all tests passing (green on CI)Follow-ups
use-mediareference page needs prose update + new demo following the MediaHost architecture from chore(site): rewrite media element builder for MediaHost architecture #1334seal/unsealnow hard-requireSESSION_COOKIE_PASSWORD, and MuxUploader renderer switched'mux-video'→'hls'. Both are behavior tightenings that land with this PR; confirmed intentional.Test plan
pnpm astro checkreports 0 errorspnpm -F site testpasses (CI)astro-checkjob runs and is greenplayer-controller,html-create-playerafter fix(site): work around #1111 in create-player/player-controller demos #1403 workaround)/docs/framework/react/reference/use-mediastill 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.ymladds anastro-checkjob that builds packages, generates docs/skins content, and runspnpm 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.fntypings, clsx class types, Astro component props), and refactors the API reference model helpers into typed TS (componentReferenceModel,utilReferenceModel) plus TypeScript AST handling updates inapi-docs-builder.Behavior/content adjustments. Session
seal/unsealnow hard-error ifSESSION_COOKIE_PASSWORDis missing, Mux uploader switches renderer tohls, some docs demos/content are updated or removed (notably theuse-mediademo), and various unused props/imports are cleaned up to reduceastro checkhints.Reviewed by Cursor Bugbot for commit 37b6032. Bugbot is set up for automated code reviews on this repo. Configure here.