Skip to content

refactor(linter/plugins): refactor state reset after errors during linting#17206

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/12-20-refactor_linter_plugins_refactor_state_reset_after_errors_during_linting
Dec 21, 2025
Merged

refactor(linter/plugins): refactor state reset after errors during linting#17206
graphite-app[bot] merged 1 commit intomainfrom
om/12-20-refactor_linter_plugins_refactor_state_reset_after_errors_during_linting

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 21, 2025

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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins labels Dec 21, 2025
Copy link
Member Author

overlookmotel commented Dec 21, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Dec 21, 2025
@overlookmotel overlookmotel force-pushed the om/12-20-refactor_linter_plugins_refactor_state_reset_after_errors_during_linting branch from 10800a6 to 1fbf13b Compare December 21, 2025 13:23
@overlookmotel overlookmotel marked this pull request as ready for review December 21, 2025 13:25
Copilot AI review requested due to automatic review settings December 21, 2025 13:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 finally block in lintFile() with explicit calls to resetFile() in the success path and resetStateAfterError() in the error path
  • Created a new exported function resetStateAfterError() that clears diagnostics and resets file state
  • Updated RuleTester to use the new resetStateAfterError() 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.

@overlookmotel overlookmotel self-assigned this Dec 21, 2025
@overlookmotel overlookmotel force-pushed the om/12-21-test_linter_plugins_add_ability_to_lint_files_in_deterministic_order branch from 857ea37 to 1746050 Compare December 21, 2025 14:23
@overlookmotel overlookmotel force-pushed the om/12-20-refactor_linter_plugins_refactor_state_reset_after_errors_during_linting branch from 1fbf13b to ebd3750 Compare December 21, 2025 14:23
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 21, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 21, 2025

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.
@graphite-app graphite-app bot force-pushed the om/12-21-test_linter_plugins_add_ability_to_lint_files_in_deterministic_order branch from 1746050 to 9d6520e Compare December 21, 2025 14:33
@graphite-app graphite-app bot force-pushed the om/12-20-refactor_linter_plugins_refactor_state_reset_after_errors_during_linting branch from ebd3750 to 6f05a99 Compare December 21, 2025 14:33
Base automatically changed from om/12-21-test_linter_plugins_add_ability_to_lint_files_in_deterministic_order to main December 21, 2025 14:38
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 21, 2025
@graphite-app graphite-app bot merged commit 6f05a99 into main Dec 21, 2025
19 checks passed
@graphite-app graphite-app bot deleted the om/12-20-refactor_linter_plugins_refactor_state_reset_after_errors_during_linting branch December 21, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants