Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions npm/oxlint-plugins-dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).

## [1.42.0] - 2026-01-26

### 🚀 Features

- Initial release of `@oxlint/plugins-dev` package
35 changes: 35 additions & 0 deletions npm/oxlint-plugins-dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# @oxlint/plugins-dev

Development and testing utilities for [Oxlint](https://oxc.rs/docs/guide/usage/linter.html) JS plugins.

This package provides the `RuleTester` class for testing custom Oxlint rules.

## Installation

```bash
npm install --save-dev @oxlint/plugins-dev
```

## Usage

API is identical to [ESLint's `RuleTester`](https://eslint.org/docs/latest/integrate/nodejs-api#ruletester).

```typescript
import { RuleTester } from "@oxlint/plugins-dev";

const ruleTester = new RuleTester();

ruleTester.run("my-rule", myRule, {
valid: ["const x = 1;"],
invalid: [
{
code: "var x = 1;",
errors: [{ message: "Use const instead of var" }],
},
],
});
```

## Docs

For full documentation, see [Oxlint JS Plugins docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).
2 changes: 2 additions & 0 deletions npm/oxlint-plugins-dev/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Re-export development utilities types from `oxlint` package
export * from "oxlint/plugins-dev";
2 changes: 2 additions & 0 deletions npm/oxlint-plugins-dev/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Re-export development utilities from `oxlint` package
export * from "oxlint/plugins-dev";
37 changes: 37 additions & 0 deletions npm/oxlint-plugins-dev/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@oxlint/plugins-dev",
"version": "1.42.0",
"description": "Development utilities for Oxlint plugins",
"keywords": [
"oxlint",
"plugin",
"rule-tester",
"testing"
],
"homepage": "https://oxc.rs/docs/guide/usage/linter/plugin-system",
"bugs": "https://github.com/oxc-project/oxc/issues",
"license": "MIT",
"author": "Boshen and oxc contributors",
"repository": {
"type": "git",
"url": "git+https://github.com/oxc-project/oxc.git",
"directory": "npm/oxlint-plugins-dev"
},
"funding": {
"url": "https://github.com/sponsors/Boshen"
},
"files": [
"index.js",
"index.d.ts",
"README.md"
],
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"dependencies": {
"oxlint": "^1.42.0"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
}
11 changes: 11 additions & 0 deletions npm/oxlint-plugins/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).

## [1.42.0] - 2026-01-26

### 🚀 Features

- Initial release of `@oxlint/plugins` package
82 changes: 82 additions & 0 deletions npm/oxlint-plugins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# @oxlint/plugins

Plugin utilities for [Oxlint](https://oxc.rs/docs/guide/usage/linter.html).

This package provides optional functions to assist in creating Oxlint JS plugins and rules.

## Installation

```bash
npm install @oxlint/plugins
```

## Usage

### Define functions

Use `definePlugin` and `defineRule` if authoring your plugin in TypeScript for type safety.

```typescript
import { definePlugin, defineRule } from "@oxlint/plugins";

const myRule = defineRule({
create(context) {
return {
Program(node) {
// Rule logic here
},
};
},
});

export default definePlugin({
name: "my-plugin",
rules: { "my-rule": myRule },
});
```

### Types

This package also includes types for plugins and rules.

```typescript
import type { Context, Rule, ESTree } from "@oxlint/plugins";

const myRule: Rule = {
create(context: Context) {
return {
Program(node: ESTree.Program) {
// Rule logic here
},
};
},
};
```

### ESLint compatibility

If your plugin uses Oxlint's [alternative `createOnce` API](https://oxc.rs/docs/guide/usage/linter/js-plugins.html#alternative-api),
use `eslintCompatPlugin` to convert the plugin so it will also work with ESLint.

```typescript
import { eslintCompatPlugin } from "@oxlint/plugins";

const myRule = {
createOnce(context) {
return {
Program(node) {
// Rule logic here
},
};
},
};

export default eslintCompatPlugin({
name: "my-plugin",
rules: { "my-rule": myRule },
});
```

## Docs

For full documentation, see [Oxlint JS Plugins docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).
2 changes: 2 additions & 0 deletions npm/oxlint-plugins/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Re-export plugins types from `oxlint` package
export * from "oxlint/plugins";
2 changes: 2 additions & 0 deletions npm/oxlint-plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Re-export all plugin APIs from `oxlint` package
export * from "oxlint/plugins";
37 changes: 37 additions & 0 deletions npm/oxlint-plugins/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@oxlint/plugins",
"version": "1.42.0",
"description": "Plugin utilities for Oxlint",
"keywords": [
"eslint",
"linter",
"oxlint",
"plugin"
],
"homepage": "https://oxc.rs/docs/guide/usage/linter/plugin-system",
"bugs": "https://github.com/oxc-project/oxc/issues",
"license": "MIT",
"author": "Boshen and oxc contributors",
"repository": {
"type": "git",
"url": "git+https://github.com/oxc-project/oxc.git",
"directory": "npm/oxlint-plugins"
},
"funding": {
"url": "https://github.com/sponsors/Boshen"
},
"files": [
"index.js",
"index.d.ts",
"README.md"
],
"type": "module",
"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.

},
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
}
2 changes: 2 additions & 0 deletions oxc_release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ versioned_files = [
"crates/oxc_linter/Cargo.toml",
"editors/vscode/package.json",
"npm/oxlint/package.json",
"npm/oxlint-plugins/package.json",
"npm/oxlint-plugins-dev/package.json",
]

[[releases]]
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading