Skip to content

[Chore] Speed up lint and check-types with caches and staged-only pre-commit lint - #2092

Merged
edelauna merged 1 commit into
mainfrom
perf/lint-checktypes-caching-0pmwirvfjdlq2
Oct 21, 2026
Merged

edelauna merged 1 commit into
mainfrom
perf/lint-checktypes-caching-0pmwirvfjdlq2

Conversation

@ghost

@ghost ghost commented Oct 18, 2026

Copy link
Copy Markdown

​Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

Related GitHub Issue

Closes: #2090

Description

This PR makes local lint and type checks faster. It implements the proposal in #2090.

Changes:

  • The lint scripts in src and webview-ui now pass --cache --cache-strategy content to ESLint. The cache lives at node_modules/.cache/eslint/.eslintcache in each package. That path is already git-ignored, so .gitignore needs no change.
  • src/tsconfig.json and webview-ui/tsconfig.json now set "incremental": true with a tsBuildInfoFile under node_modules/.cache/tsc/. The shared default in packages/config-typescript/base.json is unchanged. declaration stays off, as measured in the issue.
  • The pre-commit hook no longer runs pnpm lint on the whole repository. It runs lint-staged only. The lint-staged config now routes staged .ts/.tsx files to the ESLint config of their own package, so staged files in every workspace package keep full lint coverage. Prettier still formats staged files.
  • CI keeps the full lint. The compile job in .github/workflows/code-qa.yml already runs pnpm lint and pnpm check-types, so no workflow change is needed.
  • The check-types script in webview-ui is now tsc --noEmit. It was plain tsc, but the tsconfig already set "noEmit": true, so it never emitted. The emit output of webview-ui comes from the build script (tsc -b && vite build); vite owns the emitted files. No consumer reads output from check-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):

Check Before (cold) After (cold cache) After (warm cache)
pnpm lint (all packages) 26.3s (src alone 24.6s) 28.5s (fills ESLint cache) 6.0s
pnpm check-types (all packages) 15.9s (src 14.1s, webview-ui 11.4s) 16.1s (fills tsbuildinfo) 5.4s
Pre-commit hook, one staged file full pnpm lint ran (~26s) — 1.1–1.5s

Repeat steps for reviewers:

  1. Run pnpm lint twice. The second run skips unchanged files through the ESLint cache.
  2. Run pnpm check-types twice. The second run uses the incremental build info.
  3. Stage one changed source file and commit. The hook lints only staged files.
  4. Add const x: any = null to a staged file in src and commit. ESLint blocks the commit with @typescript-eslint/no-explicit-any.

Also verified:

  • pnpm lint and pnpm check-types pass at the repo root (11/11 turbo tasks).
  • pnpm test passes (13/13 turbo tasks, ~11000 tests). One first run had 2 failures in src/__tests__/extension.spec.ts under 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:check passes.
  • Cache files land only in git-ignored paths. git status stays clean.
  • tsc -b in webview-ui stays correct and fast with the shared tsBuildInfoFile (up-to-date build in 0.27s after a warm check-types).

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I reviewed my own code with care.
  • Writing Style: The PR title and description use Simplified Technical English (ASD-STE100): short sentences, plain words, active voice, one idea per sentence, no contractions.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): If a user would notice this change at a glance (layout, theme tokens, brand elements, empty/error states), I added or updated a *.visual.tsx snapshot in webview-ui/. See webview-ui/AGENTS.md → "When a UI change needs a snapshot".
  • Documentation Impact: I checked if my changes need documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I read and agree to the Contributor Guidelines.

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

  • No documentation updates are required.

This PR changes developer tooling. User-facing product behavior does not change.

Additional Notes

  • The lint-staged config lists one entry per workspace package. This keeps staged-file lint coverage equal to the old full pnpm lint for .ts/.tsx files, including packages outside src and webview-ui.
  • The ESLint cache and tsbuildinfo files live under node_modules/.cache/. Deleting them is always safe. The next run rebuilds them.
  • webview-ui's clean script now also removes node_modules/.cache/tsc, because the build info moved there.
  • Timings come from an 18-core sandbox. They differ in scale from the issue's WSL2 20-core numbers but show the same ratios.

Get in Touch

0x7777777_

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: Zoo-Code-Org/Zoo-Code/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 4ea7c1a3-acb6-416b-843b-d05a51a7f750

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review status

This 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. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna marked this pull request as ready for review October 21, 2026 02:10
@edelauna
edelauna enabled auto-merge October 21, 2026 02:10
@edelauna
edelauna added this pull request to the merge queue Oct 21, 2026
@github-actions github-actions Bot added the coderabbit-review-active Required CI passed; CodeRabbit review is active label Oct 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 21, 2026
@github-actions github-actions Bot added the awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit label Oct 21, 2026
@edelauna
edelauna added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit c1eb1a9 Oct 21, 2026
39 of 41 checks passed
@edelauna
edelauna deleted the perf/lint-checktypes-caching-0pmwirvfjdlq2 branch October 21, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit coderabbit-review-active Required CI passed; CodeRabbit review is active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: speed up lint and check-types (cache, incremental, staged-only hook)

2 participants