Skip to content

refactor(linter/plugins): simplify JS callback type#16452

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-03-refactor_linter_plugins_simplify_js_callback_type
Dec 3, 2025
Merged

refactor(linter/plugins): simplify JS callback type#16452
graphite-app[bot] merged 1 commit intomainfrom
12-03-refactor_linter_plugins_simplify_js_callback_type

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 3, 2025

Simplify the type for ExternalLinterLoadPluginCb by converting errors to Strings in the closure returned by wrap_load_plugin, rather than doing it later.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Dec 3, 2025
Copy link
Member Author

overlookmotel commented Dec 3, 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 3, 2025

CodSpeed Performance Report

Merging #16452 will not alter performance

Comparing 12-03-refactor_linter_plugins_simplify_js_callback_type (c4a2c99) with main (8c10694)1

Summary

✅ 4 untouched
⏩ 41 skipped2

Footnotes

  1. No successful run was found on main (481fe81) during the generation of this report, so 8c10694 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 41 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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 the ExternalLinterLoadPluginCb type to simplify error handling by using String directly as the error type instead of Box<dyn Error + Send + Sync>. The error-to-string conversion is now performed within the wrap_load_plugin closure, making the type definition cleaner and more consistent with other external linter callback types.

Key changes:

  • Simplified the ExternalLinterLoadPluginCb type signature to use Result<PluginLoadResult, String>
  • Moved error-to-string conversion logic into wrap_load_plugin using map_err
  • Updated error handling in config_builder.rs to directly use the string error without additional conversion

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/oxc_linter/src/external_linter.rs Simplified ExternalLinterLoadPluginCb type to use String for errors, removed unused Error import
crates/oxc_linter/src/config/config_builder.rs Updated error handling to directly use string errors from the callback without calling .to_string()
apps/oxlint/src/js_plugins/external_linter.rs Added Error import and moved error-to-string conversion into wrap_load_plugin via map_err

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 3, 2025

Merge activity

Simplify the type for `ExternalLinterLoadPluginCb` by converting errors to `String`s in the closure returned by `wrap_load_plugin`, rather than doing it later.
@graphite-app graphite-app bot force-pushed the 12-03-refactor_linter_plugins_simplify_js_callback_type branch from c4a2c99 to c869ee1 Compare December 3, 2025 19:06
@graphite-app graphite-app bot merged commit c869ee1 into main Dec 3, 2025
20 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 3, 2025
@graphite-app graphite-app bot deleted the 12-03-refactor_linter_plugins_simplify_js_callback_type branch December 3, 2025 19:11
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
Simplify the type for `ExternalLinterLoadPluginCb` by converting errors to `String`s in the closure returned by `wrap_load_plugin`, rather than doing it later.
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 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.

3 participants