Skip to content

feat(linter/plugins): create @oxlint/plugins and @oxlint/plugins-dev NPM packages#18796

Closed
overlookmotel wants to merge 1 commit intomainfrom
om/02-01-feat_linter_plugins_create_oxlint_plugins_and_oxlint_plugins-dev_npm_packages
Closed

feat(linter/plugins): create @oxlint/plugins and @oxlint/plugins-dev NPM packages#18796
overlookmotel wants to merge 1 commit intomainfrom
om/02-01-feat_linter_plugins_create_oxlint_plugins_and_oxlint_plugins-dev_npm_packages

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Feb 1, 2026

Closes #18610.

Add NPM packages @oxlint/plugins and @oxlint/plugins-dev.

Add the 2 packages to the versioned_files list in oxc_release.toml. From what I can understand (and what Claude tells me), that should be all that's needed to bump versions in pre-release workflow, along with the rest.

The release workflow already publishes all packages matching npm/oxlint*:

- name: Publish npm packages as latest
# NOTE: The trailing slash on $package/ changes it to publishing the directory
run: |
for package in npm/oxlint*
do
pnpm publish $package/ --provenance --access public --no-git-checks
echo '----'
done

Copy link
Member Author

overlookmotel commented Feb 1, 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.

@overlookmotel overlookmotel marked this pull request as ready for review February 1, 2026 01:56
Copilot AI review requested due to automatic review settings February 1, 2026 01:56
@overlookmotel overlookmotel requested a review from camc314 February 1, 2026 01:56
@overlookmotel overlookmotel force-pushed the om/02-01-feat_linter_plugins_create_oxlint_plugins_and_oxlint_plugins-dev_npm_packages branch from 4232002 to 58496be Compare February 1, 2026 01:59
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 introduces two new NPM packages (@oxlint/plugins and @oxlint/plugins-dev) intended to provide plugin authoring utilities separately from the main oxlint package. However, the implementation has a critical flaw that contradicts the stated goal.

Changes:

  • Added @oxlint/plugins package for plugin and rule definition utilities
  • Added @oxlint/plugins-dev package for the RuleTester development utility
  • Updated oxc_release.toml to include the new packages in version management

Reviewed changes

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

Show a summary per file
File Description
oxc_release.toml Added versioned file entries for the two new packages
npm/oxlint-plugins/package.json Package manifest for @oxlint/plugins with oxlint dependency
npm/oxlint-plugins/index.js Re-exports plugin APIs from oxlint package
npm/oxlint-plugins/index.d.ts Re-exports plugin types from oxlint package
npm/oxlint-plugins/README.md Documentation for using the plugins package
npm/oxlint-plugins/CHANGELOG.md Initial changelog entry
npm/oxlint-plugins-dev/package.json Package manifest for @oxlint/plugins-dev with oxlint dependency
npm/oxlint-plugins-dev/index.js Re-exports development utilities from oxlint package
npm/oxlint-plugins-dev/index.d.ts Re-exports development types from oxlint package
npm/oxlint-plugins-dev/README.md Documentation for using the plugins-dev package
npm/oxlint-plugins-dev/CHANGELOG.md Initial changelog entry

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

@overlookmotel overlookmotel force-pushed the om/02-01-feat_linter_plugins_create_oxlint_plugins_and_oxlint_plugins-dev_npm_packages branch from 8eef88a to 4259390 Compare February 1, 2026 02:02
@camc314 camc314 force-pushed the om/02-01-refactor_linter_plugins_rename_oxlint_rule-tester_to_oxlint_plugins-dev_ branch from 9fae30e to ceae6b5 Compare February 1, 2026 13:16
@graphite-app graphite-app bot changed the base branch from om/02-01-refactor_linter_plugins_rename_oxlint_rule-tester_to_oxlint_plugins-dev_ to graphite-base/18796 February 1, 2026 13:23
@graphite-app graphite-app bot force-pushed the graphite-base/18796 branch from 9fae30e to ab4fddd Compare February 1, 2026 13:30
@graphite-app graphite-app bot force-pushed the om/02-01-feat_linter_plugins_create_oxlint_plugins_and_oxlint_plugins-dev_npm_packages branch from 4259390 to 3d7c122 Compare February 1, 2026 13:30
@graphite-app graphite-app bot changed the base branch from graphite-base/18796 to main February 1, 2026 13:31
@graphite-app graphite-app bot force-pushed the om/02-01-feat_linter_plugins_create_oxlint_plugins_and_oxlint_plugins-dev_npm_packages branch from 3d7c122 to 1e13925 Compare February 1, 2026 13:31
"main": "index.js",
"types": "index.d.ts",
"dependencies": {
"oxlint": "^1.42.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is right - it will mean that the dependency is the published version, which will make local dev a nightmare?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm. Do you mean local dev as in local dev for us? Or for users?

For a user of a plugin, it is a real dependency (not a peer dependency).

Or maybe this approach just plain doesn't work, and we need to put the code in the packages themselves and @oxlint/plugins shouldn't have any dependencies at all?

Copy link
Contributor

@camc314 camc314 Feb 1, 2026

Choose a reason for hiding this comment

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

yes - local dev for us.

I think there definitly is a way that this can work - but i think putting 1.42 here will point it to the published version.

does pnpm install oxlint as a dep?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this approach is probably better: #18824.

@overlookmotel
Copy link
Member Author

Superceded by #18824.

@overlookmotel overlookmotel deleted the om/02-01-feat_linter_plugins_create_oxlint_plugins_and_oxlint_plugins-dev_npm_packages branch February 3, 2026 14:45
graphite-app bot pushed a commit that referenced this pull request Feb 3, 2026
Alternative to #18796. Part of #18610.

## Overview

Add `@oxlint/plugins` package.

`@oxlint/plugins` package has no dependency on `oxlint`, which solves the problem raised in #18796 (comment), and is also what we wanted in the end anyway. We don't actually want plugins packages to have to depend on `oxlint`.

## Differences from other Oxc packages

This package is different from all our other packages, in that it's intended to work not only with Oxlint's ecosystem, but also with ESLint's ecosystem.

`@oxlint/plugins` will be a *runtime* dependency of plugin packages that the community create, and they may want their plugin to be compatible with both Oxlint and ESLint - this package provides the `eslintCompatPlugin` function for exactly this purpose.

Our aim is to allow plugin authors to migrate from ESLint's `create` API to Oxlint's `createOnce` API with minimum friction, and without breaking changes for their users:

1. Their plugin should remain compatible with ESLint.
2. They do not need to alter the versions of NodeJS they support (no change to `engines` field in `package.json`).
3. They can continue to publish their plugin as a CommonJS package, if that's the format they currently use.

## Package composition

Due to these requirements, the make-up of `@oxlint/plugins` is different from our other packages:

### Dual Format

This package is in "dual package" format, with both ESM and CommonJS entry points.

### Older NodeJS versions support

This package supports NodeJS versions back to v12.22.0.

https://github.com/oxc-project/oxc/blob/9938dc476f8533b7011af03cdbac328b0d00d344/npm/oxlint-plugins/package.json#L40-L42

This matches `engines` field in all ESLint 8.x.x releases:

* 8.0.0: https://www.npmjs.com/package/eslint/v/8.0.0?activeTab=code
* 8.57.1: https://www.npmjs.com/package/eslint/v/8.57.1?activeTab=code

Therefore, `@oxlint/plugins` can be used by any plugin which supports ESLint 8 or later.

Note: Download counts for ESLint 8 are still roughly equal to ESLint 9, even though v9 was released 2 years ago.

#### Notes

* Changing `target` in TSDown to `"node12"` does not result in any changes to built files. See 3rd commit in this PR.
* `exports` field in `package.json` is supported (without experimental flag) from NodeJS v12.17.0 + v14.0.0.
* `.cjs` file extension supported from NodeJS v12.0.0.

## Building the package

This PR adds 2 extra builds to TSDown config, which generate the files for the package. `build.ts` script moves the files into `npm/oxlint-plugins` directory.

Later on, we'll move the logic for moving the files into the CI release workflow, so we don't need to check the generated build files into Git.

## `@oxlint/plugins-dev`

In #18610 we decided to also add an `@oxlint/plugins-dev` to contain `RuleTester`, so we can move that out of `oxlint` package. This PR *does not* add that package. I've skipped that for now as (a) it's trickier and (b) it's much less important.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linter plugins: Separate packages for definePlugin, defineRule and RuleTester

3 participants