refactor(linter/plugins): refactor state reset after errors during linting#17206
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
10800a6 to
1fbf13b
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors state reset logic after linting operations by introducing a new resetStateAfterError() function that consolidates the cleanup of diagnostics and file-related state. This allows both the main linter and RuleTester to follow the same code path for state resets.
Key changes:
- Replaced the
finallyblock inlintFile()with explicit calls toresetFile()in the success path andresetStateAfterError()in the error path - Created a new exported function
resetStateAfterError()that clears diagnostics and resets file state - Updated
RuleTesterto use the newresetStateAfterError()function instead of manually resetting state
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/oxlint/src-js/plugins/lint.ts | Refactored lintFile() to remove finally block and use explicit reset calls; added new resetStateAfterError() function |
| apps/oxlint/src-js/package/rule_tester.ts | Updated to import and use resetStateAfterError() instead of manually resetting diagnostics and calling resetFile() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
857ea37 to
1746050
Compare
1fbf13b to
ebd3750
Compare
Merge activity
|
…nting (#17206) Pure refactor. Alter how state is reset after linting a file. Move logic for resetting state into a new function `resetStateAfterError` which `RuleTester` can also use. This ensures that `RuleTester` follows the same code path as the actual linter.
1746050 to
9d6520e
Compare
ebd3750 to
6f05a99
Compare

Pure refactor. Alter how state is reset after linting a file.
Move logic for resetting state into a new function
resetStateAfterErrorwhichRuleTestercan also use. This ensures thatRuleTesterfollows the same code path as the actual linter.