Skip to content

ci: typecheck + lint gates, Node 22/24 matrix, package metadata fixes, README#137

Merged
jodeleeuw merged 6 commits into
mainfrom
claude/infra-ci-tooling
Jul 20, 2026
Merged

ci: typecheck + lint gates, Node 22/24 matrix, package metadata fixes, README#137
jodeleeuw merged 6 commits into
mainfrom
claude/infra-ci-tooling

Conversation

@jodeleeuw

Copy link
Copy Markdown
Member

Summary

Implements the infrastructure workstream of the repository improvement plan (docs/dev/improvement-plan.md, Phase 3).

CI

  • Typecheck gate: per-package typecheck scripts + root npm run typecheck, wired into CI. packages/cli was previously never typechecked at all (esbuild build + sucrase test transform = type errors shipped silently).
  • Lint gate: npm run lint --workspaces --if-present in CI. The frontend had an ESLint config and lint script that nothing ever ran. Lint is scoped to src with --max-warnings 10 (9 pre-existing react-hooks/react-refresh warnings; ~27 no-explicit-any errors live only in test mocks and are excluded rather than churned).
  • Node versions: test job now runs a 22.x/24.x matrix (was a single 20.x, which is past EOL); engines: >=20 declared in root and both publishable packages; cache: npm added to release.yml.

Package metadata (affects what ships to npm)

  • packages/metadata: repository/bugs corrected from jspsych/jsPsychjspsych/metadata (the npm page currently links to the wrong repo); types condition moved first in the exports map (TS condition matching is order-sensitive); dead build:types script and vestigial husky devDependency removed.
  • packages/cli: @jspsych/metadata dependency pinned to ^0.0.3 || ^0.1.0 instead of *. (A bare ^0.1.0 empirically breaks npm ci today — npm only workspace-links when the local version satisfies the range, and metadata is still 0.0.3 until Version Packages #47 lands.)

Housekeeping

  • Root README expanded from 2 lines to a real overview (packages table, CLI quick-start, docs links, dev commands); ignored --platform=node flag removed from the root build script; root package gets a name (prevents npm install in a worktree from rewriting the lockfile's root name).

Minimal src touches (required to turn the gates green — called out for review)

  • packages/cli/tsconfig.json: skipLibCheck: true (same flag frontend already carries, for the same @types/node Buffer-typings conflict under TS 5.9).
  • One cast in packages/cli/tests/data.test.ts (getMetadata() is typed {} in the library).
  • Six tiny no-explicit-any fixes in frontend src (typed casts for webkitdirectory/showSaveFilePicker etc.).

Testing

Full suite 656 passed; npm run typecheck exit 0 across all packages; npm run build --workspaces exit 0; lint 0 errors / 9 warnings (under threshold) — all verified against a fresh npm ci, matching CI.

Notes for review

🤖 Generated with Claude Code

https://claude.ai/code/session_01QMjKvi9vHT3LfikGfW84Kg


Generated by Claude Code

claude added 4 commits July 6, 2026 20:41
CI never ran tsc or eslint, so type errors and lint violations (including
an untypechecked packages/cli) could land silently. Add a `typecheck`
script to every package (tsc --noEmit, or the frontend's existing `tsc -b`
project setup) plus a root script that runs them all, wire both typecheck
and `lint --workspaces --if-present` into the Build job, and bump the pinned
Node 20.x (EOL) to a 22.x/24.x matrix for the Test job.

Fixing packages/cli's typecheck required skipLibCheck (an @types/node
version bump introduced generic TypedArrays that conflict with this
tsconfig's ES2018 lib under this TypeScript version — the frontend
tsconfig already carries the same flag) and a narrow `as any` cast in one
test assertion where the library's own return type is untyped `{}`.

Making frontend lint pass in CI required replacing a handful of
`any`-typed showSaveFilePicker/webkitdirectory workarounds with narrow
structural types, and scoping the lint script to src/ (tests aren't
typechecked by this project either, so this mirrors existing convention)
with a small --max-warnings allowance for the pre-existing react-hooks/
react-refresh warnings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMjKvi9vHT3LfikGfW84Kg
packages/metadata's repository/bugs URLs pointed at jspsych/jsPsych
(the wrong repo) and would leak that to npm on publish; point them at
jspsych/metadata instead. Reorder the exports map so the "types"
condition comes first — TS condition matching is order-sensitive, so a
trailing "types" entry can be skipped. Drop the dead build:types script
(references a nonexistent tsconfig.build.json and isn't part of the
build chain) and the vestigial husky devDependency (no .husky/ directory
in this repo).

packages/cli depended on "@jspsych/metadata": "*", which would happily
resolve to an incompatible future major. Pin it to the 0.0.x/0.1.x line
(0.1.0 is the pending release in PR #47) rather than a bare "^0.1.0":
until that release ships, the local workspace package is still at 0.0.3,
and a range that excludes it breaks `npm install` for local dev and CI
alike since npm workspaces only symlinks a dependency when the workspace
version satisfies the declared range.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMjKvi9vHT3LfikGfW84Kg
The root README was two lines; expand it into a proper overview (what
the project is, the monorepo layout, a CLI quick-start, links to the
docs/ guides, and dev/contributing commands) without turning it into a
duplicate of the package-level READMEs.

Also drop --platform=node from the root `build` script: npm silently
ignores flags passed after `--workspaces` that aren't recognized by
`npm run`, so it had no effect (each package's own build script already
sets --platform=node where esbuild needs it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMjKvi9vHT3LfikGfW84Kg
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMjKvi9vHT3LfikGfW84Kg
@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4941b05

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@jspsych/metadata Patch
@jspsych/metadata-cli Patch
frontend Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jodeleeuw and others added 2 commits July 20, 2026 17:50
# Conflicts:
#	README.md
#	packages/frontend/src/global.d.ts
#	packages/frontend/src/pages/DataUpload.tsx
…docs-site CLI reference

- Reconcile README with the merged Docusaurus docs site (#139): keep the
  monorepo intro/quick-start/development sections, point Documentation at
  metadata.jspsych.org and website/, drop the legacy docs/ links.
- Drop Node 20 support (maintainer decision): engines >=22 in all three
  packages, release workflow bumped 20.x -> 22.x to match the CI matrix
  (22/24) that npm test actually runs on.
- Widen the CLI's @jspsych/metadata range to '>=0.0.3 <0.2.0' so a future
  0.0.x or 0.1.x patch release cannot re-break npm ci (caret ranges on
  0.0.x match only that exact version).
- Sync website/docs/reference/cli-reference.md with the exit-code scheme
  and flag-validation behavior that landed in #135 (the docs/ copy was
  updated there; the site copy predated it).
- Resolve merge conflicts from main: take #136's DataUpload busy-state
  effect (webkitdirectory is now set via JSX spread, making #137's typed
  effect obsolete) and accept #136's deletion of global.d.ts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jodeleeuw
jodeleeuw merged commit 9b406ee into main Jul 20, 2026
3 checks passed
@jodeleeuw
jodeleeuw deleted the claude/infra-ci-tooling branch July 20, 2026 21:55
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