Skip to content

feat(cli): add opt-in strict checkJs typecheck command - #4275

Merged
josephfarina merged 2 commits into
mainfrom
feat/strict-typecheck-command
Jul 24, 2026
Merged

josephfarina merged 2 commits into
mainfrom
feat/strict-typecheck-command

Conversation

@josephfarina

@josephfarina josephfarina commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds an opt-in strict checkJs type-check command for the CLI. Not wired into CI yet — this just makes the check runnable locally.

The CLI ships as hand-written .mjs (no build step) and is type-checked via TypeScript's checkJs against JSDoc annotations. Today only a handful of files are covered (typecheck:json-api checks json.mjs, manifest.mjs, parse.mjs, config.mjs); the rest of the package has never been strict-checked, so type errors and missing annotations land freely.

Change

  • tsconfig.strict.json — full strict checkJs over the whole package: src, bin, scripts, docs, and the emitted templates (including their .tsx source). Tests excluded. strict includes noImplicitAny, so an un-annotated parameter is an error — this is what will eventually force complete JSDoc.
  • typecheck:strict script → tsc --project tsconfig.strict.json.
  • A CONTRIBUTING note explaining it's opt-in for now, plus the pnpm build prerequisite (the template .tsx files import built workspace packages).
pnpm build                                    # so core/charts/lab dist types resolve
pnpm -F @astryxdesign/cli typecheck:strict

Scope / current error count

Whole-package strict currently reports ~1717 errors:

Area Errors
src 1617
docs 97
bin + scripts 3
templates (incl. 639 .tsx) 0 ✓

The 639 emitted template .tsx files are already strict-clean once the workspace packages are built — confirmed they're genuinely in the checked program (injecting a bad type into one raises the count and is caught).

Deliberately NOT in this PR

No CI wiring, no allowlist, no baseline/ratchet. The plan:

  1. This PR — land the command so the check exists and can be run over the whole package.
  2. Follow-up PRs — burn the ~1717 errors down to zero (annotations + real fixes).
  3. Final PR — make typecheck:strict a required CI gate once the package is clean.

Test

  • pnpm -F @astryxdesign/cli typecheck:strict runs over the whole package and reports the current errors (exits non-zero, as expected until clean).
  • Existing typecheck:json-api and typecheck:template-docs still pass.
  • No runtime / published-behavior change — tooling only.

The CLI ships as hand-written .mjs (no build step) and is type-checked via
checkJs against JSDoc. Only a handful of files are covered by the existing
typecheck:json-api project; the rest of the tree has never been strict-checked.

Add tsconfig.strict.json (whole non-test tree, full strict incl. noImplicitAny)
and a 'typecheck:strict' script so contributors can run it locally. It is NOT
wired into CI yet — the tree still has known strict errors. Those will be burned
down in follow-up PRs, after which a later PR makes it a required gate.
@vercel

vercel Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 24, 2026 12:14am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 23, 2026
github-actions Bot added a commit that referenced this pull request Jul 24, 2026
@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

Cover bin, scripts, docs, and the emitted templates (including their .tsx
source) in addition to src — not just src/**. The template .tsx files import
built workspace packages (@astryxdesign/core,charts,lab), so a full 'pnpm build'
is required before running; documented that prerequisite. Whole-package strict
currently reports ~1717 errors (1617 src + 97 docs + 3 bin/scripts; templates
are already clean).
github-actions Bot added a commit that referenced this pull request Jul 24, 2026
@josephfarina
josephfarina merged commit f70a9e3 into main Jul 24, 2026
19 checks passed
josephfarina added a commit that referenced this pull request Jul 24, 2026
…JSDoc

Drive `pnpm -F @astryxdesign/cli typecheck:strict` (tsconfig.strict.json — full
strict checkJs over the whole CLI package: src, bin, scripts, docs, and the
emitted templates) to zero errors, down from 1717 across 119 files.

Fixes are JSDoc-only: no runtime logic changed, .mjs stays .mjs, no @ts-ignore
or rule disabling (the single exception is an eslint-disable for the untyped
jscodeshift AST factory type, which genuinely cannot be expressed without any).

Strict checking surfaced and corrected several real type-contract drifts:
- upgrade.run response type declared a `depsUpdated` field the command never
  emits and omitted the real integrations/filesChanged/transformsApplied/errors
- registered the emitted theme.list, theme.add, and layout.* response types in
  the --json envelope union (they were defined and emitted but never listed in
  CLIAnyResponse, so their payloads were never actually type-checked)
- added category? to ReferenceSection in core docs-types (reference docs
  already emit it on sections)

Also: typed jscodeshift transforms via a shared ambient module declaration plus
codemod typedefs, and narrowed catch(e) to Error across command/api handlers.

This does not wire the check into CI (that is a follow-up); typecheck:strict
remains the opt-in command added in #4275, now passing at zero.
@github-actions
github-actions Bot deleted the feat/strict-typecheck-command branch July 24, 2026 06:55
josephfarina added a commit that referenced this pull request Jul 24, 2026
Wire `pnpm -F @astryxdesign/cli typecheck:strict` (full-package strict
checkJs over src, bin, scripts, docs, and the emitted templates) into CI
as a required gate — the follow-up #4275 promised once the tree was clean,
now unblocked by #4283 driving strict errors to zero.

Mirrors the repo's existing typecheck-gate convention: added to the
build-storybook job in ci.yml (PRs + merge queue) and the test job in
deploy.yml (push to main / deploy). Both jobs already run `pnpm build`
first, which strict typecheck requires so the template .tsx sources can
resolve the built @astryxdesign/{core,charts,lab} types.

Also updates packages/cli/CONTRIBUTING.md, which documented this as
"not yet wired into CI."

Co-authored-by: Cursor <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — bafa17c1 Deployed Jul 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant