Add package typecheck scripts#2312
Conversation
📝 WalkthroughWalkthroughPackage-level typecheck scripts and scoped TypeScript configurations are added across the workspace. The motion ChangesTypecheck and typing updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/dev-server/tsconfig.typecheck.json (1)
1-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider extracting a shared typecheck tsconfig base.
All packages now have identical
tsconfig.typecheck.jsonfiles. A shared base (e.g.,tsconfig.typecheck.base.jsonat the workspace root) extended by each package would eliminate duplication and simplify future updates to include/exclude patterns.♻️ Optional: shared base approach
// tsconfig.typecheck.base.json (workspace root) { "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/__tests__/**"] }// packages/dev-server/tsconfig.typecheck.json { "extends": ["../../tsconfig.typecheck.base.json", "./tsconfig.json"] }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/dev-server/tsconfig.typecheck.json` around lines 1 - 12, Duplicate typecheck configuration should be centralized. Add a workspace-level tsconfig.typecheck.base.json containing the shared include and exclude patterns, then update each package’s tsconfig.typecheck.json, including the dev-server configuration, to extend both the shared base and its local tsconfig.json while removing duplicated fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/create-termui-app/src/commands/add.ts`:
- Line 91: The registry response is cast to RegistryIndex without runtime
validation. In the registry-fetching function, validate the parsed JSON with a
RegistryIndex schema or type guard before returning it, and handle invalid
payloads with an appropriate error instead of passing them to findComponentEntry
or printAvailableComponents.
---
Nitpick comments:
In `@packages/dev-server/tsconfig.typecheck.json`:
- Around line 1-12: Duplicate typecheck configuration should be centralized. Add
a workspace-level tsconfig.typecheck.base.json containing the shared include and
exclude patterns, then update each package’s tsconfig.typecheck.json, including
the dev-server configuration, to extend both the shared base and its local
tsconfig.json while removing duplicated fields.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4366fd5f-6e24-441f-9275-c2f45ed7515e
📒 Files selected for processing (20)
packages/create-termui-app/package.jsonpackages/create-termui-app/src/commands/add.tspackages/create-termui-app/tsconfig.typecheck.jsonpackages/dev-server/package.jsonpackages/dev-server/tsconfig.typecheck.jsonpackages/jsx/package.jsonpackages/jsx/tsconfig.typecheck.jsonpackages/motion/package.jsonpackages/motion/src/sequence.tspackages/motion/tsconfig.typecheck.jsonpackages/router/package.jsonpackages/router/tsconfig.typecheck.jsonpackages/store/package.jsonpackages/store/tsconfig.typecheck.jsonpackages/testing/package.jsonpackages/testing/tsconfig.typecheck.jsonpackages/tss/package.jsonpackages/tss/tsconfig.typecheck.jsonpackages/ui/package.jsonpackages/ui/tsconfig.typecheck.json
| } | ||
|
|
||
| return await response.json(); | ||
| return await response.json() as RegistryIndex; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '--- add.ts ---\n'
sed -n '1,220p' packages/create-termui-app/src/commands/add.ts
printf '\n--- RegistryIndex search ---\n'
rg -n "type RegistryIndex|interface RegistryIndex|RegistryIndex" packages/create-termui-app -S
printf '\n--- schema/validation search ---\n'
rg -n "zod|schema|validate|response\.json\(\) as RegistryIndex|RegistryIndex" packages/create-termui-app/src -SRepository: Karanjot786/TermUI
Length of output: 247
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- add.ts ---'
sed -n '1,220p' packages/create-termui-app/src/commands/add.ts
echo
echo '--- RegistryIndex search ---'
rg -n "type RegistryIndex|interface RegistryIndex|RegistryIndex" packages/create-termui-app -S
echo
echo '--- schema/validation search ---'
rg -n "zod|schema|validate|response\.json\(\) as RegistryIndex|RegistryIndex" packages/create-termui-app/src -SRepository: Karanjot786/TermUI
Length of output: 14138
Validate the registry JSON before casting it
packages/create-termui-app/src/commands/add.ts:91 still trusts the remote payload as RegistryIndex without any runtime check. A malformed response can fail later in findComponentEntry or printAvailableComponents; add a schema/type guard before returning it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/create-termui-app/src/commands/add.ts` at line 91, The registry
response is cast to RegistryIndex without runtime validation. In the
registry-fetching function, validate the parsed JSON with a RegistryIndex schema
or type guard before returning it, and handle invalid payloads with an
appropriate error instead of passing them to findComponentEntry or
printAvailableComponents.
Source: Coding guidelines
Summary
tsc --noEmitValidation
turbo run typecheckwas not runFixes #2302
Summary by CodeRabbit