Repository navigation
Run local lint in typescript-eslint single-run mode, as in CI - #6556
Open
bram-atmire wants to merge 1 commit into
Open
bram-atmire wants to merge 1 commit into
bram-atmire wants to merge 1 commit into
Conversation
typescript-eslint only infers a single run when CI=true or when eslint is invoked directly. A local "ng lint" matches neither, so typescript-eslint falls back to watch programs, which need much more memory: locally lint can run out of memory with the 4 GB heap used in CI. Set TSESTREE_SINGLE_RUN=true for lint:nobuild, so local lint runs the same way as CI. lint-fix is unchanged, because single-run mode is not used with --fix. Assisted-by: Claude Code [claude-opus-5-5]
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.
TL;DR & References
npm run lintlocally uses about half the memory and is faster, the same as in CI. CI itself does not change.Description
Locally,
npm run lintcan run out of memory with the 4 GB heap that CI uses. The reason is that typescript-eslint only uses its faster "single-run" mode when it detects CI (CI=true) or a directeslintinvocation, andng lintlocally is neither. This PR setsTSESTREE_SINGLE_RUN=truein thelint:nobuildscript, so local lint runs the same way as in CI.Instructions for Reviewers
typescript-eslint decides in
inferSingleRunwhether a run is a single run. If it is, it builds each TypeScript program once; otherwise it uses watch programs, which are meant for editors and use much more memory. GitHub Actions setsCI=true, so CI already uses single-run mode. A localng lintdoes not match the detection, so it falls back to watch programs.TSESTREE_SINGLE_RUN=trueis the documented way to force single-run mode.Measured locally (macOS, Node 20.19),
npm run lint:nobuild -- --quietas in CI:--max-old-space-size=4096; passes with 8 GB, 126 s, 6.5 GB peak memoryList of changes in this PR:
package.json:lint:nobuildrunscross-env TSESTREE_SINGLE_RUN=true ng lint(npm run lintcallslint:nobuild).cross-envis already a dev dependency.lint-fixis not changed on purpose: typescript-eslint does not use single-run mode with--fix, because fixes change files during the run.How to test
NODE_OPTIONS=--max-old-space-size=4096 npm run lintpasses locally. Onmainit may run out of memory.AI Disclosure (REQUIRED)
Were AI tools used in the creation of this PR?
Claude Code (claude-opus-5-5) found the cause in typescript-eslint's single-run detection, made the change and measured lint locally with and without it (memory and duration above). I reviewed the change and this description.
My human review didn't reveal any particular flaws.
Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.