Type-check script/, worker/, e2e/, and tool configs - #2030
Merged
Merged
Conversation
tsconfig.astro.json only covers src/ and astro.config.mjs, so astro check never saw script/**/*.ts, worker/*.js, e2e/, vitest.config.ts, or playwright.config.ts. Add tsconfig.tooling.json (named so Astro and Vite don't pick it up as a root tsconfig.json), an npm run check:tooling script, and wire it into npm test and the CI check job. Fix the 7 errors it surfaced (all type noise, no runtime changes): - e2e/link-validation.spec.ts: drop unused fs/path imports - sync-document.ts: DocumentRecord as a type alias so it satisfies putRecord's index-signature record param - worker/index.test.js: JSDoc types for test helpers; ASSETS.fetch mock accepts RequestInfo | URL to match the binding's fetch signature Also drop the stale _site exclude from tsconfig.astro.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
tsconfig.astro.jsononly includessrc/andastro.config.mjs, soastro checknever type-checkedscript/**/*.ts,worker/*.js,e2e/,vitest.config.ts, orplaywright.config.ts.Changes
tsconfig.tooling.json: strict,noEmit,module: ESNext+moduleResolution: bundler(matches how tsx runs the extensionless-import scripts), Node types, DOM lib for Playwright page code and the Worker'sRequest/Response, andallowJs+checkJsforworker/. No new deps: the worker's existing JSDoc types are enough, so@cloudflare/workers-typesisn't needed.tsconfig.tooling.jsonrather thantsconfig.jsonon purpose. Vite/esbuild and the Astro language server resolve the nearesttsconfig.json, so a root one would start governingsrc/transforms and editor checks.npm run check:tooling(tsc -p tsconfig.tooling.json), added tonpm testand as a step in the ci.ymlcheckjob. Left out of build-and-deploy.yml; CI already gates PRs._siteexclude fromtsconfig.astro.json.Errors found
7 errors before fixes. None were real runtime bugs:
e2e/link-validation.spec.ts: unusedfs/pathimports.script/standard-site/sync-document.ts:DocumentRecordinterface isn't assignable toputRecord's{ [x: string]: unknown }record param. Switched to a type alias (identical shape).worker/index.test.js: implicitanyon test helpers, plus theASSETS.fetchmock took onlyRequestwhile the worker's env type saystypeof fetch. The mock now acceptsRequestInfo | URL.No files excluded.
Verification
npm run check:tooling: 0 errorsnpm run check: 0 errors, 0 warnings, 0 hintsnpm run test:vitest: 64 files, 2019 tests passSKIP_PDF=1 npm run build: succeedsnpx knip: output identical to mainnpx eslinton changed files: clean🤖 Generated with Claude Code