Commit Graph

21 Commits

Author SHA1 Message Date
overlookmotel 9de9385fd1 refactor(linter/plugins): rename oxlint/plugin to oxlint/plugins (#18792)
Part of #18610.

Our intent is to move `definePlugin`, `defineRule`, and `eslintCompatPlugin` to a separate package `@oxlint/plugins` (plural to avoid confusion with naming convention for plugins `oxlint-plugin-xxx`).

So rename the current entry point which exports these functions from `oxlint/plugin` to `oxlint/plugins` (plural).
2026-02-01 13:23:14 +00:00
overlookmotel 6ad44809e6 refactor(linter/plugins): remove experimental warning (#18771)
As we prepare for alpha release of JS plugins, it feels like we can remove the warning logged to stderr.

```
WARNING: JS plugins are experimental and not subject to semver.
Breaking changes are possible while JS plugins support is under development.
```

They do still remain experimental, but I don't think we need to shout that quite as loudly now.
2026-01-31 17:28:11 +00:00
camc314 81eb6fa9db refactor(linter): split entry points for custom plugins/config/types (#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'`
2026-01-27 00:58:08 +00:00
camc314 3bd6d68feb test(linter): dont print links in diagnostics in tests (#18074) 2026-01-16 23:15:50 +00:00
connorshea 529901cfc9 fix(linter): include JS plugin rules when calculating total rule count (#17520)
This ensures that we print the expected number of rules for users that are using JS Plugins.

Fix #17519.

Based on #17517, because otherwise we'd end up with weird snapshot differences when trying to merge these anyway.

AI Disclosure: The fix here was generated with Copilot + GitHub's Raptor mini model.
2025-12-31 23:14:52 +00:00
connorshea 96ef2cced3 fix(linter): print total rule # when using a single nested config (#17517)
For a while, we've been skipping the printing of rule runs unless `--disable-nested-config` was passed. This was a result of the nested_configs value including the base config (see #16356). When we were checking whether that value was empty, it would always have at least 1 item (unless nested configs were entirely disabled).

As part of this, I've updated some configs in the fixtures to disable correctness rules, otherwise we will end up with a bunch of fixture snapshots needing updates every time a new default rule is added.

It's probably easiest to review this one commit at a time.
2025-12-31 22:56:47 +00:00
Boshen 523a30a016 style(all): apply oxfmt default options (#16091)
Embrace the defaults!

---------

Co-authored-by: Yuji Sugiura <y.sugiura.0316@gmail.com>
2025-11-25 15:56:24 +09:00
overlookmotel 690abec235 test(linter/plugins): use subpath imports (#15920)
Shorten imports in test fixtures using [subpath imports](https://nodejs.org/docs/latest-v24.x/api/packages.html#subpath-imports).

Before:

```ts
import type { Plugin } from '../../../dist/index.js';
```

After:

```ts
import type { Plugin } from '#oxlint';
```
2025-11-21 11:44:25 +00:00
sapphi-red 56c66279bb fix(linter/plugins): resolve JS plugins only with conditions Node.js supports (#15248)
Fixes the `require` related error described in https://github.com/oxc-project/oxc/discussions/14862#discussioncomment-14861678.
This was happening because Node.js does not use `module` condition but the plugin resolver used that. I aligned the conditions to what Node.js uses (I didn't include `node-addon` because it's not popular and requires detecting `--no-addons` to do it properly).
https://nodejs.org/docs/v24.11.0/api/packages.html#conditional-exports

I'm not sure why, but the test snapshot doesn't seem stable on my machine.

cc @TheAlexLichter

refs #14541
2025-11-04 15:58:18 +00:00
Peter Wagenet 2de9f39a96 fix(linter/plugins): fall back to package name if meta.name is missing (#14938)
Fixes #14937
2025-10-25 23:45:50 +01:00
overlookmotel 8d8881d142 test(linter/plugins): expand tests for module resolution of plugins (#14559)
Follow-on after #14541. Add more tests for module resolution of plugins, including `default` condition.
2025-10-13 14:40:43 +00:00
magic-akari 74e52f3df6 fix(linter/plugins): resolve JS plugins with ESM condition names (#14541)
- Closes: #14503
2025-10-13 21:31:50 +08:00
overlookmotel 6ff3a23ecc test(linter/plugins): add tests for .ts, .mts, .cts plugin files (#14164)
Add tests for loading all types of TS files as plugins - `.ts`, `.mts`, `.cts`.
2025-09-28 15:07:50 +00:00
overlookmotel aca083a8dc test(linter/plugins): include stderr output in snapshots (#14155)
Include `stderr` output in test snapshots. This makes sure that the "JS plugins are experimental" warning is not output if user doesn't use JS plugins.
2025-09-26 13:34:52 +00:00
overlookmotel 0029b7f218 test(linter/plugins): normalize line breaks in snapshots (#14154)
Trim leading/trailing line breaks from `stdout` in test snapshots and convert `\r\n` to `\n`. This ensures tests will pass on Windows, and removes extraneous line breaks from snapshots.
2025-09-26 12:31:19 +00:00
overlookmotel b4d716fd72 feat(linter/plugins): move custom JS plugin config to jsPlugins (#14133)
Fixes #12432.

JS plugins were previously configured by adding them to `plugins` array in config file. Instead, move them to a separate `jsPlugins` array.

Before:

```json
{
  "plugins": ["oxc", "react", "./custom-plugin.js"],
}
```

After:

```json
{
  "plugins": ["oxc", "react"],
  "jsPlugins": ["./custom-plugin.js"],
}
```
2025-09-26 10:06:36 +00:00
overlookmotel fc14abc5b5 test(linter/plugins): format test fixtures (#14125)
Pure refactor. Format files in `test/fixtures` directory. Only changes to fixture files are to add `// dprint-ignore-file` comments to 2 of them.
2025-09-25 20:35:48 +00:00
overlookmotel a6f965f1a2 test(linter/plugins): simplify configs in test fixtures (#14124)
Pure refactor. Remove `"ignorePatterns": ["**/*", "!files/**"]` from `.oxlintrc.json` in every test fixture, by running `oxlint` with `oxlint --js-plugins files`.
2025-09-25 20:35:48 +00:00
overlookmotel b1685f7a6a test(linter/plugins): refactor tests (#14123)
Refactor tests for Oxlint plugins. Break up snapshots into 1 per fixture directory, to make them easier to navigate.
2025-09-25 20:35:47 +00:00
overlookmotel 5c862f95ae test(linter/plugins): standardize test fixture structure (#14114)
Pure refactor of tests. Standardize the directory structure of all test fixtures.

* Move files to be linted into `files` subdirectory.
* Move plugin to a file called `plugin.js` (except 1 fixture which has multiple plugins).
* Change `ignorePatterns` in `.oxlintrc.json` config files to whitelist files in `files` dir, instead of blacklisting the plugin file.
2025-09-25 12:09:54 +00:00
overlookmotel f51240ee3c test(linter/plugins): tests for different import styles (#13859)
Add tests for importing plugins via various path styles and module formats:

* CommonJS
* ESM
* Relative path to file
* Relative path to directory
* Package in `node_modules`
2025-09-17 12:49:48 +00:00