Repository navigation
[Chore] Speed up lint and check-types with caches and staged-only pre-commit lint - #2092
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Review statusThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging. Current step: Required CI passed. Waiting for automated review of the latest commit. If automated review does not start, a maintainer must restart it. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Related GitHub Issue
Closes: #2090
Description
This PR makes local lint and type checks faster. It implements the proposal in #2090.
Changes:
lintscripts insrcandwebview-uinow pass--cache --cache-strategy contentto ESLint. The cache lives atnode_modules/.cache/eslint/.eslintcachein each package. That path is already git-ignored, so.gitignoreneeds no change.src/tsconfig.jsonandwebview-ui/tsconfig.jsonnow set"incremental": truewith atsBuildInfoFileundernode_modules/.cache/tsc/. The shared default inpackages/config-typescript/base.jsonis unchanged.declarationstays off, as measured in the issue.pre-commithook no longer runspnpm linton the whole repository. It runslint-stagedonly. Thelint-stagedconfig now routes staged.ts/.tsxfiles to the ESLint config of their own package, so staged files in every workspace package keep full lint coverage. Prettier still formats staged files.compilejob in.github/workflows/code-qa.ymlalready runspnpm lintandpnpm check-types, so no workflow change is needed.check-typesscript inwebview-uiis nowtsc --noEmit. It was plaintsc, but the tsconfig already set"noEmit": true, so it never emitted. The emit output ofwebview-uicomes from thebuildscript (tsc -b && vite build); vite owns the emitted files. No consumer reads output fromcheck-types.Trade-off from the issue: without
declaration, incremental checks pay off in full only for leaf-file edits. Edits to shared files still recheck dependents.Test Procedure
Measured in the task sandbox (18 cores, warm turbo cache bypassed with
--force, so the numbers show real ESLint and tsc work):pnpm lint(all packages)srcalone 24.6s)pnpm check-types(all packages)src14.1s,webview-ui11.4s)pnpm lintran (~26s)Repeat steps for reviewers:
pnpm linttwice. The second run skips unchanged files through the ESLint cache.pnpm check-typestwice. The second run uses the incremental build info.const x: any = nullto a staged file insrcand commit. ESLint blocks the commit with@typescript-eslint/no-explicit-any.Also verified:
pnpm lintandpnpm check-typespass at the repo root (11/11 turbo tasks).pnpm testpasses (13/13 turbo tasks, ~11000 tests). One first run had 2 failures insrc/__tests__/extension.spec.tsunder full parallel load. The spec passes in isolation on a clean tree and on this tree, and the full suite passed on rerun. This is a pre-existing load flake, not a change from this PR.pnpm format:checkpasses.git statusstays clean.tsc -binwebview-uistays correct and fast with the sharedtsBuildInfoFile(up-to-date build in 0.27s after a warmcheck-types).Pre-Submission Checklist
*.visual.tsxsnapshot inwebview-ui/. Seewebview-ui/AGENTS.md→ "When a UI change needs a snapshot".Visual Snapshots
This PR changes build tooling only. It has no user-visible UI surface.
Videos (interaction / animation only)
No interaction or animation changes. No video needed.
Documentation Updates
This PR changes developer tooling. User-facing product behavior does not change.
Additional Notes
lint-stagedconfig lists one entry per workspace package. This keeps staged-file lint coverage equal to the old fullpnpm lintfor.ts/.tsxfiles, including packages outsidesrcandwebview-ui.node_modules/.cache/. Deleting them is always safe. The next run rebuilds them.webview-ui'scleanscript now also removesnode_modules/.cache/tsc, because the build info moved there.Get in Touch
0x7777777_