Speed up viewer and frontend eslint: local cache + drop slow rule - #2586
Merged
Conversation
The viewer's `lint` was ~73s cold. TIMING=25 profiling showed a single type-aware rule, @typescript-eslint/no-duplicate-type-constituents, consumed ~60% of rule time (~15s) while flagging nothing in this codebase — it does expensive type-relation checks against our large generated dotnet-types unions. Disable it. Also enable `--cache` on the local `lint` script (73s -> ~3.5s on warm re-runs) and gitignore .eslintcache. Caching is deliberately NOT applied to CI (`lint:report`): ESLint's file cache keys on each file's own mtime/content and does not track cross-file type dependencies, so a change in one file leaves a stale cached result for an unchanged importer — verified that both metadata and content cache strategies miss a real no-floating-promises error introduced via a dependency change. CI stays uncached so the type-aware gate remains sound. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Apply the same lint-perf learnings from the viewer package to the LexBox web app. Enable `--cache` on the local `lint` script (~105s -> ~3s on warm re-runs) and gitignore .eslintcache. Enabling --cache required removing the explicit `svelteConfig` pass in parserOptions: it embedded svelte.config.js's warningFilter/onwarn functions into the ESLint config, which ESLint cannot serialize for its cache. svelte-eslint-parser auto-loads svelte.config.js from disk instead, so the compile-warning filter still applies (verified: no element_invalid_self_closing_tag warnings leak back, same 8 problems). Also disable @typescript-eslint/no-duplicate-type-constituents for parity with the viewer. As with the viewer, caching stays off in CI (lint:report) because ESLint's file cache does not track cross-file type dependencies. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 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 |
hahn-kev
approved these changes
Aug 20, 2026
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improved linting performance with a local cache, and droped a rule in the viewer which I don't think was useful, but was quite slow.
most of the time taken by linting in the frontend is a rule checking that we're awaiting promises, instead of using them as a value, eg
if (promise)instead ofif (await promise)but that's a very useful rule to I left it on. It's got caching locally now, but a cold run is still slow.🤖 AI summary
frontend/viewer(and to a lesser extentfrontend) lint was slow. Profiling withTIMINGshowed the cost was concentrated in a few type-aware rules plus a full TypeScript program build, not eslint itself.Changes
@typescript-eslint/no-duplicate-type-constituents(both packages). In the viewer it was ~60% of rule time (~15s) and flagged nothing — it does expensive type-relation checks against our large generateddotnet-typesunions. (Infrontendits cost is negligible; dropped there only for parity.)eslint --cacheon the locallintscript in both packages, and gitignore.eslintcache. Warm re-runs only re-lint changed files.frontendonly: enabling--cacherequired removing the explicitsvelteConfigpass inparserOptions— it embeddedsvelte.config.js'swarningFilter/onwarnfunctions into the eslint config, which eslint can't serialize for its cache.svelte-eslint-parserauto-loadssvelte.config.jsfrom disk instead, so the compile-warning filter still applies (verified: noelement_invalid_self_closing_tagwarnings leak back, same problem count).Viewer timings (measured back-to-back, same machine state)
Warm re-runs are consistently 3–4s — this is the everyday local iteration case. Cold absolute times vary with machine load.
Deliberately NOT done: CI caching. ESLint's file cache keys on each file's own mtime/content and does not track cross-file type dependencies. Verified empirically: change a type in file A, leave an importing file B untouched, and a cached run misses the real
no-floating-promiseserror in B — under bothmetadataandcontentcache strategies. So caching stays off in CI (lint:report) to keep the type-aware gate sound; caching is local-only.Deliberately NOT changed:
no-misused-promises. It dominatesfrontendlint time (~80%), but it's a valuable rule (catches async handlers passed where void is expected). TuningchecksVoidReturn.attributes: falseand switching toprojectServicewere both measured and neither reduced its cost, so it's left as-is — local caching already removes the day-to-day pain.Test plan
pnpm run lintin bothfrontend/viewerandfrontendreports the same problem counts as before the change (viewer 14, frontend 8).lintre-run (no file edits) completes in ~3–4s in both packages.frontend: confirmed noelement_invalid_self_closing_tagcompile warnings leak back after dropping the explicitsvelteConfigpass.lint:report) is unchanged and remains uncached.