Skip to content

refactor(linter): split entry points for custom plugins/config/types#18601

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/01-26-refactor_linter_split_entry_points_for_custom_plugins_config_types
Jan 27, 2026
Merged

refactor(linter): split entry points for custom plugins/config/types#18601
graphite-app[bot] merged 1 commit intomainfrom
c/01-26-refactor_linter_split_entry_points_for_custom_plugins_config_types

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Jan 26, 2026

This is technically breaking (only for types), but custom plugins are experimental.

The ruletester/defineRule/definePlugin are re-exported but with a @deprecated tag which I think is a good enough trade off

I want to avoid users bringing in a ton of custom plugin code when doing import { defineConfig } from 'oxlint'

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins labels Jan 26, 2026
@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Jan 26, 2026
Copy link
Contributor Author

camc314 commented Jan 26, 2026


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.

@camc314 camc314 marked this pull request as ready for review January 26, 2026 20:31
Copilot AI review requested due to automatic review settings January 26, 2026 20:31
@camc314 camc314 force-pushed the c/01-26-refactor_linter_split_entry_points_for_custom_plugins_config_types branch 2 times, most recently from 88fa054 to 742c57f Compare January 26, 2026 20:32
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 oxlint package to split entry points for custom plugins, rule testing, and configuration. The goal is to separate concerns and reduce bundle size for users who only need configuration imports without bringing in custom plugin code.

Changes:

  • Add new entry points oxlint/plugin and oxlint/rule-tester for custom plugin and rule testing APIs
  • Update package.json exports to include the new entry points
  • Deprecate definePlugin, defineRule, and RuleTester exports from main entry point with JSDoc warnings
  • Move all TypeScript type exports to the plugin.ts entry point

Reviewed changes

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

Show a summary per file
File Description
npm/oxlint/package.json Adds exports configuration for new entry points (./plugin and ./rule-tester)
apps/oxlint/package.json Adds exports and imports configuration for new entry points
apps/oxlint/tsdown.config.ts Updates build configuration to include new entry point files in the build
apps/oxlint/src-js/plugin.ts New entry point exporting definePlugin, defineRule, and all plugin-related types
apps/oxlint/src-js/rule-tester.ts New entry point exporting RuleTester class
apps/oxlint/src-js/index.ts Refactored to only export deprecated functions, removes all type exports

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

@overlookmotel
Copy link
Member

Good idea to move RuleTester into a separate export. It's a lot of code.

But I don't particularly see the benefit of moving definePlugin and defineRule into oxlint/plugin, because that leaves the oxlint entry point empty. The index.ts entry point is only loaded if you import / require Oxlint programatically.

I actually think definePlugin and defineRule should move into a separate package anyway. I think I wrote about this somewhere, but I can't find it now, so I opened #18610.

@camc314
Copy link
Contributor Author

camc314 commented Jan 27, 2026

But I don't particularly see the benefit of moving definePlugin and defineRule into oxlint/plugin, because that leaves the oxlint entry point empty.

Yeah I'm adding defineConfig in a PR a little higher up the stack - users importing defineConfig is the most common case, so I think it makes sense for it to be at the root of the package.

@camc314 camc314 force-pushed the c/01-26-refactor_linter_split_entry_points_for_custom_plugins_config_types branch 2 times, most recently from ddba0f7 to dcf2a20 Compare January 27, 2026 00:22
@overlookmotel
Copy link
Member

overlookmotel commented Jan 27, 2026

Yeah I'm adding defineConfig in a PR a little higher up the stack

Ah ha now it makes sense.

Would appreciate your thoughts on #18610 when you have time.

@graphite-app graphite-app bot changed the base branch from c/01-26-refactor_linter_update_type_references_for_lazy-loaded_functions to graphite-base/18601 January 27, 2026 00:30
@graphite-app graphite-app bot force-pushed the graphite-base/18601 branch from 32fbe3d to b1c5f35 Compare January 27, 2026 00:37
@graphite-app graphite-app bot force-pushed the c/01-26-refactor_linter_split_entry_points_for_custom_plugins_config_types branch from dcf2a20 to 10510d6 Compare January 27, 2026 00:37
@graphite-app graphite-app bot changed the base branch from graphite-base/18601 to main January 27, 2026 00:37
@graphite-app graphite-app bot force-pushed the c/01-26-refactor_linter_split_entry_points_for_custom_plugins_config_types branch from 10510d6 to 5eeb708 Compare January 27, 2026 00:38
Copy link
Member

@overlookmotel overlookmotel left a comment

Choose a reason for hiding this comment

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

Pushed a commit to fix lint errors. Merging.

@camc314
Copy link
Contributor Author

camc314 commented Jan 27, 2026

🙏i couldn't work out why it was failing. thanks

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jan 27, 2026
Copy link
Member

overlookmotel commented Jan 27, 2026

Merge activity

…18601)

This is technically breaking (only for types), but custom plugins are experimental.

The ruletester/defineRule/definePlugin are re-exported but with a `@deprecated` tag which I think is a good enough trade off

I want to avoid users bringing in a ton of custom plugin code when doing `import { defineConfig } from 'oxlint'`
@graphite-app graphite-app bot force-pushed the c/01-26-refactor_linter_split_entry_points_for_custom_plugins_config_types branch from 0541569 to 81eb6fa Compare January 27, 2026 00:58
@graphite-app graphite-app bot merged commit 81eb6fa into main Jan 27, 2026
19 checks passed
@graphite-app graphite-app bot deleted the c/01-26-refactor_linter_split_entry_points_for_custom_plugins_config_types branch January 27, 2026 01:04
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 27, 2026
shibanet0 added a commit to shibanet0/oxc that referenced this pull request Feb 16, 2026
The configuration_schema.json file was not accessible after adding the `exports` field in oxc-project#18601. This adds the missing export entry.

Fixes the import: `import schema from 'oxlint/configuration_schema.json'`
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.

3 participants