Repository navigation
Conversation
The Program visitor read sourceCode.scopeManager.scopes for every file, which forces JS-side scope analysis even for files with no identifier assertion. Read it on the first `identifier as T` in a file and reset it per file instead. Findings are unchanged; a CLI test covers the per-file reset, which RuleTester cannot see because each case gets a fresh rule instance.
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.
no-widen-then-assertreadscontext.sourceCode.scopeManager.scopesin itsProgramvisitor. That forces JS-side scope analysis on every linted file, including files with noidentifier as Tassertion, which is the only case the rule ever needs scopes for.This reads the scopes on the first identifier assertion in a file instead, and resets the cache in
Program. Findings are unchanged.Measured cost of enabling only this rule on top of an existing config (oxlint 1.78, Node 24, full tree, interleaved medians of 8 runs):
The new
no-widen-then-assert-cli.test.tscovers the per-file reset. RuleTester can't see it, because each case gets a fresh rule instance, while the CLI reuses one instance across files. With the reset removed, the existing suite still passes but the CLI test fails (the second file's finding is lost to the first file's stale scopes).pnpm checkpasses, andpnpm sync:skill-assetsmirrored the change into the skill bundle.🤖 Generated with Claude Code