Skip to content

chore: add minimal validation — format, typecheck, CI - #17

Merged
jigarkhwar merged 3 commits into
mainfrom
chore/validation-tooling
Aug 4, 2026
Merged

chore: add minimal validation — format, typecheck, CI#17
jigarkhwar merged 3 commits into
mainfrom
chore/validation-tooling

Conversation

@jigarkhwar

@jigarkhwar jigarkhwar commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What changed

Minimal validation for the site: formatting, type checking / compilation, and CI that enforces both on every PR.

Two tools, four devDependencies:

  • Format — Prettier + prettier-plugin-astro, config matching the code style already in the repo (single quotes, semicolons, printWidth 100).
  • Typecheck / compilation@astrojs/check + typescript, as npm run typecheck. astro build alone does not typecheck — it strips TS via esbuild, so a bad product tag or malformed code token compiles fine and only shows up as a broken card in the browser. astro check rejects it at the source (verified: swapping one product's tag to an invalid value fails the check with Type '"Bogus"' is not assignable to type '"Plugin" | "AI" | ...').
  • CI (.github/workflows/ci.yml) — pull_request + push to main: checkout, Node 22 (Astro 7 needs >=22.12.0, now pinned via engines), npm ci, then format:check / typecheck / build as separate steps so a red PR names the check that broke. Nothing gated a PR before this — deploy.yml only builds and deploys on push to main, so a change that failed to typecheck would land and then break the deploy.

npm run validate chains all three locally.

Deliberately left out

An earlier revision of this PR also added ESLint and Vitest. Both are dropped to keep the dependency footprint small — measured, not guessed:

npm packages added over main
prettier + prettier-plugin-astro + typescript +7
@astrojs/check +74
eslint + eslint-plugin-astro + typescript-eslint + vitest +136 ← dropped
  • ESLint — 3 packages plus a config to police ~30 lines of inline DOM wiring. astro check already covers the type-level errors that actually break this site. Easy to add later if the JS surface grows.
  • Vitest — the tests worth writing here (product has a recognized tag, code tokens use a known syntax class, required fields present) are the same invariants Product / CodeToken already encode as types and astro check already enforces. Runtime assertions restating the type system are upkeep without coverage.

@astrojs/check is the expensive one at 74 packages, but it's what the official npm create astro scaffold ships for TypeScript projects, it's devDependencies-only (zero effect on the shipped site), and it's what makes the deleted tests unnecessary. Say the word if you'd rather drop it too and rely on astro build alone — that would take this to +7 packages, at the cost of no type checking at all.

Commits

  1. Tooling — configs, 4 devDependencies, and a // prettier-ignore above each product's code: array in site.ts (each array packs several token tuples per line so the line mirrors the source line it renders as; prettier's default array-breaking would expand each snippet to 20+ lines).
  2. Formatting — mechanical npm run format over the site source, plus a two-line varconst in BaseLayout's pre-paint theme script. README.md and profile/ are in .prettierignore — org-facing content, not site source, and reflowing their markdown tables would be churn in files this change has no reason to touch.
  3. CI — the workflow.

Verification

npm run validate green end to end; lockfile confirmed in sync with package.json and free of the removed tools (CI installs with npm ci). Site re-checked in the browser after the reformat — theme toggle, accordion and copy buttons all still work.

🤖 Generated with Claude Code

Minimal validation for the site — formatting and type checking /
compilation. Two tools, four devDependencies:

- prettier + prettier-plugin-astro, config matching the code style
  already in the repo (single quotes, semicolons, printWidth 100)
- @astrojs/check + typescript, wired as `npm run typecheck`. astro
  build alone does not typecheck: it strips TS via esbuild, so a bad
  product tag or a malformed code token would compile fine and only
  surface as a broken card in the browser. astro check rejects it at
  the source.

`npm run validate` chains format:check + typecheck + build.

Deliberately not included, to keep the dependency footprint small:

- eslint (+ eslint-plugin-astro, typescript-eslint) — 3 packages and a
  config to police ~30 lines of inline DOM wiring; astro check already
  covers the type-level errors that actually break this site. Worth
  ~55 npm packages; can be added later if the JS surface grows.
- vitest — the tests I would write here (product has a recognized tag,
  code tokens use a known syntax class, required fields present) are
  the same invariants `Product`/`CodeToken` already encode as types
  and astro check already enforces. Runtime assertions restating the
  type system are upkeep without coverage.

site.ts also gets a // prettier-ignore above each product's code:
array. Each array packs several token tuples per line so the line
mirrors the source line it renders as; prettier's default array
breaking (one tuple per line) would expand each snippet to 20+ lines
and lose that.
Mechanical `npm run format` output over the site source, plus a
two-line var -> const in BaseLayout's pre-paint theme script.

README.md and profile/ are in .prettierignore — they are org-facing
content rather than site source, and reflowing their markdown tables
would be churn in files this change has no reason to touch.
Nothing gated a PR before this: deploy.yml only builds and deploys on
push to main, so a change that failed to typecheck would land and then
break the deploy.

Checkout, Node 22 (Astro 7 needs >=22.12.0, now pinned via engines),
npm ci, then format:check / typecheck / build as separate steps so a
red PR names the check that broke instead of one opaque validate blob.
@jigarkhwar
jigarkhwar force-pushed the chore/validation-tooling branch from 9e29649 to e7f05bd Compare August 4, 2026 08:27
@jigarkhwar jigarkhwar changed the title chore: add minimal validation — format, lint, typecheck, tests chore: add minimal validation — format, typecheck, CI Aug 4, 2026
@jigarkhwar
jigarkhwar merged commit 7ee9df9 into main Aug 4, 2026
1 check passed
@jigarkhwar
jigarkhwar deleted the chore/validation-tooling branch August 4, 2026 08:42
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.

1 participant