Skip to content

perf(lint): keep JS plugins out of default oxlint and adopt ast-grep - #33430

Merged
nwparker merged 7 commits into
mainfrom
nwparker/lint-speed-ast-grep
Oct 25, 2026
Merged

nwparker merged 7 commits into
mainfrom
nwparker/lint-speed-ast-grep

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53 $\color{#cf222e}{\Huge{\mathbf{−}}}$​226 $\color{#cf222e}{\Huge{\mathbf{−}}}$​173
Prod 37 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2825 $\color{#cf222e}{\Huge{\mathbf{−}}}$​247 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2578

Why

Default oxlint took 21–27s on the whole repo, against ~3.6s with the seven custom JS plugins removed. Most of that cost doesn't come from the rule logic. Once any jsPlugins rule applies to a file, Oxlint has to hand that file's AST to Node. A 29-line import check (mobile-pairing) cost as much on its own as the 380-line app-store-performance plugin. The only way to make default oxlint fast is to have no JS plugin in the root config.

What changed

  • Root .oxlintrc.json now uses native rules only. Default oxlint, the CI root lint step and the first lint-staged step no longer load any JS plugin.
  • The JS plugins that need scope or dataflow analysis moved to config/oxlint-js-plugins.json. It runs through pnpm lint:js-plugins, the pnpm lint chain, a new background CI step, lint-staged, and a new JS plugins scan in check-changed-code-quality.mjs. The gate now treats suppressions naming those plugins as owned by that scan.
  • ast-grep is adopted.
    • Added @ast-grep/[email protected]. Each platform package holds a prebuilt binary for macOS x64/arm64, Linux x64/arm64 (gnu) and Windows x64/arm64/ia32. supportedArchitectures limits installs to the host binary, about 53 MB unpacked. The postinstall only hardlinks that binary over the JS launcher, so it is allowed in allowBuilds.
    • Config lives in config/sgconfig.yml, because new root entries are blocked. Rules are in config/ast-grep/rules/ and checked-in rule tests in config/ast-grep/rule-tests/.
    • New scripts: pnpm lint:ast-grep and pnpm test:ast-grep (ast-grep test).
    • Wired into the pnpm lint chain, a CI step (test + scan --format github), lint-staged, and an ast-grep pass in the changed-lines gate.
    • ast-grep rule ids are per language, so each rule file holds a TypeScript document and a TSX twin (<id>-tsx). .js/.mjs/.cjs are parsed with the TypeScript grammar.
  • Three plugins are ported to ast-grep and deleted, along with their vitest harnesses. The ten existing sort-comparator-performance suppressions, all parity oracles in tests or a benchmark, become // ast-grep-ignore: no-repeated-collator -- <reason>. audit:perf no longer carries the collator rule, since ast-grep now enforces it as an error everywhere.
  • Flaky-test rules, ratcheted. Five ast-grep rules cover *.test.ts(x) and tests/e2e/**. They run at info severity, so the main scan stays quiet. config/scripts/check-flaky-test-pattern-ratchet.mjs reuses runCountRatchet with one row per rule and file, so fixing one pattern can't pay for adding another. run-ratchets.mjs picks the ratchet up automatically.

Per-plugin decisions

The solo cost is oxlint with only that plugin enabled versus none. It was measured on a heavily loaded 16-core machine (load average 30–50), so read the numbers as relative: with no plugins the run took 6.2s wall / 18.2s CPU, and with all seven 25.1s / 39.5s.

Plugin Rules Repo violations / suppressions Solo cost (wall / CPU added) Replaceable by Ran in Decision
sort-comparator-performance no-repeated-collator (warn) 0 / 10 (test parity oracles, benchmark) +12.0s / +12.7s ast-grep (structural) root oxlint, lint-staged, CI, changed gate, audit:perf Ported to ast-grep as an error; suppressions converted
mobile-pairing no-eager-qrcode-import 0 / 0 +23.6s / +15.1s Native no-restricted-imports also flags the lazy await import('qrcode'), so it can't be used; ast-grep fits root oxlint, lint-staged, CI, changed gate Ported to ast-grep
native-chat-design-tokens 3 class-token rules (font size, softened fg, weakened ring) 0 / 0 +3.9s / +0.2s (scoped to native-chat) ast-grep (regex on string fragments, including variant prefixes) root oxlint, lint-staged, CI, changed gate Ported to ast-grep
app-store-performance require-selector, no-identity-selector, no-fresh-selector-result 0 / 0 +12.1s / +17.0s No: needs scope-aware binding resolution, import tracking and one-hop helper expansion. React Doctor's zustand rules overlap partly but only warn on changed lines root oxlint, lint-staged, CI, changed gate, audit:perf Keep as a JS plugin in the dedicated config (CI full tree, gate, lint-staged)
quadratic-buffer-concat no-loop-carried-concat 0 / 0 +4.4s / +5.4s No: loop-carried dataflow (declaration-in-loop, indirect carries) root oxlint, lint-staged, CI, changed gate, audit:perf Keep as a JS plugin in the dedicated config
renderer-scrollbar-style require-styled-vertical-scrollbar 0 / 0 +7.6s / +4.0s (renderer only) Partly (ast-grep could cover literal classes, but not spread props, variant pairing or style objects) root oxlint, lint-staged, CI, changed gate Keep as a JS plugin in the dedicated config
ime-enter-guard require-ime-guard 0 / 0 (shipped with a real IME fix) +6.5s / +2.6s (renderer only) No: same-file reachability through helper functions root oxlint, lint-staged, CI, changed gate Keep as a JS plugin in the dedicated config

No protection is dropped. Every rule still runs on the full tree in CI, on changed lines in the gate, and on staged files before commit.

Flaky-test rules and baseline

Rule What it flags Baselined findings
test-no-wall-clock Date.now() / new Date() in unit tests. Skips files that use vi.useFakeTimers / vi.setSystemTime / vi.spyOn(Date, …), and ${Date.now()} used for unique names 1434 in 487 files
test-no-real-time-wait new Promise(r => setTimeout(r, N)) in any of its forms (only when the timer resolves the executor's own promise, never a timeout guard), await sleep/delay/wait/pause(N), await setTimeout(N), *.waitForTimeout(N). Zero-delay yields are allowed 1062 in 544 files
test-no-polling-loop while / do / for(;;) bodies containing such a sleep 214 in 155 files
test-skip-needs-quarantine Unconditional .skip / .only / .fixme with no // quarantine: #<issue> <reason> in the comment block directly above. Conditional skipIf and Playwright test.skip(cond, reason) are environment guards and aren't flagged 1
test-timeout-needs-reason it(name, fn, N), { timeout } test options, test.setTimeout, test.slow, testInfo.setTimeout with no comment above or beside the timeout 737 in 437 files

Escape hatch for any rule: // ast-grep-ignore: <rule-id> -- <reason> on the line above. pnpm lint:ast-grep:flaky-tests lists every finding.

Timings

All runs were on the same loaded machine; each figure is the minimum over five interleaved runs.

  • Full oxlint: 23.8s → 7.8s wall (CPU 37.7s → 19.9s). On a quiet machine the "after" figure is the ~3.6s native-only run.
  • pnpm lint:js-plugins, which now runs only in gates: 17.3s wall.
  • ast-grep scan with the enforced rules: 5.0s wall (27.5s CPU). With the flaky rules included: 7.9s wall.
  • ast-grep test: under 0.1s.

Found but not changed

Override files globs and ignorePatterns in configs under config/ resolve relative to config/. So in config/oxlint-code-quality-native-plugins.json, the src/renderer/src/**, tests/** and mobile/** overrides never match: the jsx-a11y rules, the tests/ vitest rules and the mobile exhaustive-deps rule silently never run. I confirmed this with an <img> fixture. The new config uses **/src/renderer/src/**. Fixing the existing configs would surface unknown findings, so it's left for a follow-up.

Validation

  • pnpm tc
  • pnpm test:ast-grep: 11 rule suites
  • pnpm lint:ast-grep, pnpm lint:js-plugins, default oxlint, oxfmt --check .
  • pnpm check:flaky-test-pattern-ratchet
  • pnpm check:code-quality:changed: passes. I also checked it against a scratch file with IME, native-chat and qrcode violations, and it reported all three.
  • Targeted vitest runs over config/scripts: the changed-code gate, casting, the PR scope and preflight gate contracts, ratchets, and the remaining plugin harnesses.

Any jsPlugin makes Oxlint hand every file's AST to Node, so the seven custom
plugins cost the default `oxlint` run several times its native time.

- Move app-store-performance, quadratic-buffer-concat, renderer-scrollbar-style
  and ime-enter-guard (scope- or dataflow-aware) to config/oxlint-js-plugins.json,
  run by `pnpm lint:js-plugins`, CI, lint-staged and the changed-lines gate.
- Port sort-comparator-performance, mobile-pairing and native-chat-design-tokens
  to ast-grep rules with rule tests, and delete the plugins.
- Add @ast-grep/cli, config/sgconfig.yml, `pnpm lint:ast-grep` / `test:ast-grep`,
  a CI step, and an ast-grep pass in check-changed-code-quality.
- Add flaky-test rules (wall-clock reads, real-time waits, polling loops,
  unquarantined skips, unexplained timeout bumps), baselined by a count ratchet.
@nwparker
nwparker marked this pull request as ready for review October 25, 2026 06:15
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b511cbb8-80dd-4250-b50c-e50c5e7f4bc6
Commits

Reviewing files that changed from the base of the PR and between 5b5b8d6 and bf4bcba.

Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 49
  • .github/workflows/performance-contracts.yml
  • .github/workflows/pr.yml
  • .oxlintrc.json
  • config/ast-grep/rule-tests/flaky-test-patterns-test.yml
  • config/ast-grep/rule-tests/native-chat-design-tokens-test.yml
  • config/ast-grep/rule-tests/no-eager-qrcode-import-test.yml
  • config/ast-grep/rule-tests/no-repeated-collator-test.yml
  • config/ast-grep/rules/flaky-tests/test-no-polling-loop.yml
  • config/ast-grep/rules/flaky-tests/test-no-real-time-wait.yml
  • config/ast-grep/rules/flaky-tests/test-no-wall-clock.yml
  • config/ast-grep/rules/flaky-tests/test-skip-needs-quarantine.yml
  • config/ast-grep/rules/flaky-tests/test-timeout-needs-reason.yml
  • config/ast-grep/rules/native-chat-no-arbitrary-font-size.yml
  • config/ast-grep/rules/native-chat-no-softened-foreground.yml
  • config/ast-grep/rules/native-chat-no-weakened-focus-ring.yml
  • config/ast-grep/rules/no-eager-qrcode-import.yml
  • config/ast-grep/rules/no-repeated-collator.yml
  • config/flaky-test-pattern-baseline.txt
  • config/oxlint-js-plugins.json
  • config/oxlint-performance-audit.json
  • config/oxlint-plugins/mobile-pairing-qrcode-import.mjs
  • config/oxlint-plugins/native-chat-design-tokens.mjs
  • config/oxlint-plugins/sort-comparator-performance.mjs
  • config/performance-audit.md
  • config/scripts/ast-grep-scan.mjs
  • config/scripts/check-changed-code-quality.mjs
  • config/scripts/check-changed-code-quality.test.mjs
  • config/scripts/check-flaky-test-pattern-ratchet.mjs
  • config/scripts/check-flaky-test-pattern-ratchet.test.mjs
  • config/scripts/ci-shard-timings.json
  • config/scripts/locale-collator-sort-benchmark.mjs
  • config/scripts/mobile-pairing-qrcode-import-plugin.test.mjs
  • config/scripts/moved-code-matcher.test.mjs
  • config/scripts/native-chat-design-tokens-plugin.test.mjs
  • config/scripts/pr-code-change-scope.mjs
  • config/scripts/pr-preflight-gates.test.mjs
  • config/scripts/ratchet-baseline.mjs
  • config/scripts/sort-comparator-performance-plugin.test.mjs
  • config/sgconfig.yml
  • config/vitest.performance.config.ts
  • docs/styleguide/native-chat.md
  • package.json
  • pnpm-workspace.yaml
  • src/main/skills/skill-discovery-order.test.ts
  • src/main/skills/skill-discovery-wsl.test.ts
  • src/main/warp-themes/discovery.test.ts
  • src/main/warp-themes/manual-warp-theme-files.test.ts
  • src/main/warp-themes/theme-file-scanner.test.ts
  • src/renderer/src/components/skills/skill-delete-copy.test.ts

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 22cad9d9-1b01-4629-bfbb-4db034f06246
Commits

Reviewing files that changed from the base of the PR and between e4bbbe0 and 7069e67.

Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 49
  • .github/workflows/performance-contracts.yml
  • .github/workflows/pr.yml
  • .oxlintrc.json
  • AGENTS.md
  • config/ast-grep/rule-tests/flaky-test-patterns-test.yml
  • config/ast-grep/rule-tests/native-chat-design-tokens-test.yml
  • config/ast-grep/rule-tests/no-eager-qrcode-import-test.yml
  • config/ast-grep/rule-tests/no-repeated-collator-test.yml
  • config/ast-grep/rules/flaky-tests/test-no-polling-loop.yml
  • config/ast-grep/rules/flaky-tests/test-no-real-time-wait.yml
  • config/ast-grep/rules/flaky-tests/test-no-wall-clock.yml
  • config/ast-grep/rules/flaky-tests/test-skip-needs-quarantine.yml
  • config/ast-grep/rules/flaky-tests/test-timeout-needs-reason.yml
  • config/ast-grep/rules/native-chat-no-arbitrary-font-size.yml
  • config/ast-grep/rules/native-chat-no-softened-foreground.yml
  • config/ast-grep/rules/native-chat-no-weakened-focus-ring.yml
  • config/ast-grep/rules/no-eager-qrcode-import.yml
  • config/ast-grep/rules/no-repeated-collator.yml
  • config/flaky-test-pattern-baseline.txt
  • config/oxlint-js-plugins.json
  • config/oxlint-performance-audit.json
  • config/oxlint-plugins/mobile-pairing-qrcode-import.mjs
  • config/oxlint-plugins/native-chat-design-tokens.mjs
  • config/oxlint-plugins/sort-comparator-performance.mjs
  • config/performance-audit.md
  • config/scripts/ast-grep-scan.mjs
  • config/scripts/check-changed-code-quality.mjs
  • config/scripts/check-changed-code-quality.test.mjs
  • config/scripts/check-flaky-test-pattern-ratchet.mjs
  • config/scripts/check-flaky-test-pattern-ratchet.test.mjs
  • config/scripts/ci-shard-timings.json
  • config/scripts/locale-collator-sort-benchmark.mjs
  • config/scripts/mobile-pairing-qrcode-import-plugin.test.mjs
  • config/scripts/native-chat-design-tokens-plugin.test.mjs
  • config/scripts/pr-code-change-scope.mjs
  • config/scripts/pr-preflight-gates.test.mjs
  • config/scripts/ratchet-baseline.mjs
  • config/scripts/sort-comparator-performance-plugin.test.mjs
  • config/sgconfig.yml
  • config/vitest.performance.config.ts
  • docs/STYLEGUIDE.md
  • package.json
  • pnpm-workspace.yaml
  • src/main/skills/skill-discovery-order.test.ts
  • src/main/skills/skill-discovery-wsl.test.ts
  • src/main/warp-themes/discovery.test.ts
  • src/main/warp-themes/manual-warp-theme-files.test.ts
  • src/main/warp-themes/theme-file-scanner.test.ts
  • src/renderer/src/components/skills/skill-delete-copy.test.ts
Files with no reviewable changes: 9
  • config/scripts/sort-comparator-performance-plugin.test.mjs
  • config/scripts/native-chat-design-tokens-plugin.test.mjs
  • config/vitest.performance.config.ts
  • config/oxlint-plugins/native-chat-design-tokens.mjs
  • .github/workflows/performance-contracts.yml
  • config/scripts/mobile-pairing-qrcode-import-plugin.test.mjs
  • config/oxlint-plugins/mobile-pairing-qrcode-import.mjs
  • config/oxlint-plugins/sort-comparator-performance.mjs
  • config/scripts/ci-shard-timings.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

The changes move import, comparator, and native-chat checks from local Oxlint plugins to ast-grep rules. They add ast-grep checks for flaky test patterns and a ratchet for tracking findings. New scan integrations connect ast-grep and JavaScript-plugin Oxlint checks to local lint commands and pull-request workflows.

Priority: Normal

Merge Risk: Minimal · up to 7069e

No actionable issue remains from the reviewed lint migration; it is mergeable after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description follows the repository template closely. It has an ELI5 section, a clear 'What changed' section, a 'Why' section that explains the measured cause and the alternatives, and a Testing/Va… Add an ELI5 summary in plain language. Link a real issue in the 'Fixes #' line, or state why no issue applies. Write 'N/A' with a reason under 'Visual Proof', because the change has no UI effect. Fill in 'AI Disclosure' with the model and t…
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 15 files. (24 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title names the main change: JS plugins are removed from the default oxlint config, and ast-grep is adopted as the structural lint tool. The title is specific and matches the objectives and most o…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: JS plugins are removed from the default oxlint config, and ast-grep is adopted as the structural lint tool. The title is specific and matches the objectives and most of the changeset. It uses the conventional commit prefix 'perf(lint)' and is 68 characters long, which is within a normal title length.

Full details: Description check

Explanation

The description follows the repository template closely. It has an ELI5 section, a clear 'What changed' section, a 'Why' section that explains the measured cause and the alternatives, and a Testing/Validation section. It also has a Notes section and a Checklist. Several template sections are missing or left blank: 'ELI5' is absent as a plain-language heading (the 'Why' and 'What changed' sections carry the content), 'Linked Issue' has no issue number (the 'Fixes #' line is empty), 'Visual Proof' is not addressed (the change is tooling-only, so it should state N/A with a reason), 'AI Disclosure' is not filled in, the 'Review' and 'Agent skill upstream boundary' sections are not addressed, and the checklist and manual-test boxes are not ticked. The 'Testing' section lists commands but does not say which platforms were tested. The 'Notes' section lists areas to check (security, cross-platform, SSH, mobile, backwards compatibility, performance), but the description does not address them directly.

Resolution

Add an ELI5 summary in plain language. Link a real issue in the 'Fixes #' line, or state why no issue applies. Write 'N/A' with a reason under 'Visual Proof', because the change has no UI effect. Fill in 'AI Disclosure' with the model and tool used, if any. Address the 'Review' and 'Agent skill upstream boundary' items. State which platforms were tested in the 'Testing' section, and tick the checkboxes that were completed. Address the Notes items (security, cross-platform, SSH, mobile, backwards compatibility, performance) explicitly.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 15 files. (24 skipped: 24 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

@nwparker
nwparker merged commit 5447a26 into main Oct 25, 2026
68 checks passed
@nwparker
nwparker deleted the nwparker/lint-speed-ast-grep branch October 25, 2026 07:23
tomarai85 added a commit to tomarai85/orca that referenced this pull request Oct 26, 2026
Point the imports of persistence-test-harness, persistence-session-fixtures
and pty-host-bindings at the paths main moved them to (stablyai#33233, stablyai#33566), and
say above each 420 s timeout why the relaunch journey needs it, as main's
test-timeout-needs-reason rule (stablyai#33430) asks.
tomarai85 added a commit to tomarai85/orca that referenced this pull request Oct 26, 2026
Point the imports of persistence-test-harness, persistence-session-fixtures
and pty-host-bindings at the paths main moved them to (stablyai#33233, stablyai#33566), and
say above each 420 s timeout why the relaunch journey needs it, as main's
test-timeout-needs-reason rule (stablyai#33430) asks.
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