Skip to content

Comments

refactor(linter/plugins): improve calculating plugin name#15811

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-16-refactor_linter_plugins_improve_calculating_plugin_name
Nov 17, 2025
Merged

refactor(linter/plugins): improve calculating plugin name#15811
graphite-app[bot] merged 1 commit intomainfrom
11-16-refactor_linter_plugins_improve_calculating_plugin_name

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 17, 2025

Provide better errors when validating plugin names, correct type of packageName passed from Rust, and use cheaper check packageName !== null.

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

overlookmotel commented Nov 17, 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.

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 refactoring improves plugin name calculation and validation by extracting the logic into a dedicated function with better error handling. The changes align the TypeScript types with the actual values passed from Rust (changing string | undefined to string | null for the packageName parameter), and optimize null checking.

  • Extracted plugin name calculation into a separate getPluginName function with enhanced validation
  • Updated packageName parameter type from string | undefined to string | null to match NAPI-rs conversion of Rust's Option<String>
  • Added type validation to ensure plugin.meta.name is a string if defined
  • Improved error messages for better clarity

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/oxlint/src-js/plugins/load.ts Refactored plugin name extraction into getPluginName function with better validation, updated parameter types to reflect actual values from Rust, and improved error messages
apps/oxlint/src-js/cli.ts Updated loadPluginWrapper signature to match the corrected packageName parameter type

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

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Nov 17, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 17, 2025

Merge activity

Provide better errors when validating plugin names, correct type of `packageName` passed from Rust, and use cheaper check `packageName !== null`.
@graphite-app graphite-app bot force-pushed the 11-16-refactor_linter_plugins_improve_calculating_plugin_name branch from 3a1d6fe to 61650f9 Compare November 17, 2025 21:52
@graphite-app graphite-app bot merged commit 61650f9 into main Nov 17, 2025
18 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 17, 2025
@graphite-app graphite-app bot deleted the 11-16-refactor_linter_plugins_improve_calculating_plugin_name branch November 17, 2025 21:59
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…t#15811)

Provide better errors when validating plugin names, correct type of `packageName` passed from Rust, and use cheaper check `packageName !== null`.
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.

1 participant