Commit Graph

132 Commits

Author SHA1 Message Date
overlookmotel d5d3c76cf6 test(linter/plugins): skip ESLint Stylistic conformance test with invalid syntax (#26082)
#26076 updated Oxlint JS plugin conformance snapshots, revealing that one ESLint Stylistic test was failing.

Turns out the cause was #25154 which (correctly) made it illegal for a `TSIndexSignature` to contain more than one parameter. The code in this test case is invalid. So just skip the test.
2026-08-25 14:13:28 +00:00
overlookmotel 36ec0ef2ba test(linter/plugins): update conformance snapshot (#26076)
Conformance snapshots had got out of sync. At some point 1 test for ESLint Stylistic's `no-comma` rule has got broken (unclear when or how).

This PR doesn't attempt to fix the bug, but just makes sure the snapshot matches reality.
2026-08-25 10:10:46 +00:00
Boshen 1193c9dbaf chore(oxfmt): dogfood operator position at line start (#25937)
dogfood
2026-08-20 14:36:47 +00:00
overlookmotel 28be3b2148 test(linter/plugins): fix conformance init script (#22423)
Fix the init script which initializes submodules for Oxlint JS plugins
conformance tests.

The script was broken by upgrade to PNPM 11 (#22224), which made
installing packages which have install scripts a hard error.

Fix by telling PNPM not to run packages' install scripts, but not to
raise an error about it either.
2026-05-14 15:27:05 +01:00
renovate 39b24ac73c chore(deps): update dependency oxlint to v1.63.0 (#22151)
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [oxlint](https://oxc.rs/docs/guide/usage/linter) ([source](https://redirect.github.com/oxc-project/oxc/tree/HEAD/npm/oxlint)) | [`1.62.0` → `1.63.0`](https://renovatebot.com/diffs/npm/oxlint/1.62.0/1.63.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/oxlint/1.63.0?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/oxlint/1.63.0?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/oxlint/1.62.0/1.63.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/oxlint/1.62.0/1.63.0?slim=true) |

---

### Release Notes

<details>
<summary>oxc-project/oxc (oxlint)</summary>

### [`v1.63.0`](https://redirect.github.com/oxc-project/oxc/blob/HEAD/npm/oxlint/CHANGELOG.md#1630---2026-05-05)

[Compare Source](https://redirect.github.com/oxc-project/oxc/compare/oxlint_v1.62.0...oxlint_v1.63.0)

##### 📚 Documentation

- [`cacbc4a`](https://redirect.github.com/oxc-project/oxc/commit/cacbc4a) linter: Fix jest settings docs. ([#&#8203;22127](https://redirect.github.com/oxc-project/oxc/issues/22127)) (connorshea)

</details>

---

### Configuration

📅 **Schedule**: (in timezone Asia/Shanghai)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNTkuMiIsInVwZGF0ZWRJblZlciI6IjQzLjE1OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2026-05-05 15:47:30 +00:00
connorshea ebd2ce4cb1 test(linter/plugins): Include a repo link and SHA/version in the JS Plugin conformance markdown files. (#20606)
This also simplifies the way we track the conformance versions a bit, by centralizing the info into `repos.json`.

I know #20607 will conflict with this one, so feel free to merge whichever of these two you prefer, and then I'll resolve the conflicts afterward.

AI Disclosure: Generated with help from Claude Code.
2026-04-23 21:17:01 +00:00
overlookmotel a6a07d1bcf test(linter/plugins): bump eslint-plugin-cypress in conformance (#21466)
Bump `eslint-plugin-cypress` in Oxlint JS plugin conformance tests.

Now that https://github.com/cypress-io/eslint-plugin-cypress/pull/308 is merged, 100% tests pass rate.
2026-04-15 14:19:50 +00:00
Connor Shea 2ca1005884 test(linter/plugins): Add eslint-plugin-regexp to conformance tests for JS Plugins (#20607)
AI Disclosure: Used Claude Code w/ Opus 4.6 for troubleshooting, basic
setup, and handling the weirdness of the snapshot tests. Manually
reviewed and verified the changes, iterated on it a good amount to make
sure the test failures that exist are actually valid, and that the
correct logic is used to validate fixers and failures are as-expected.

This one was a mess to figure out due to the complexity of the snapshot
testing system. I am fairly confident in this changeset and its accuracy
after I've iterated on it a good amount now with Claude and my own
testing.

There are a handful of failures/differences, however they appear to be
either actual differences, or due to unsupported features in the
snapshot testing system:

- There are some that use `// eslint-disable-line` which the snapshot
testing system doesn't support as far as I can tell
- There are some that use `"sourceType": "script"` and `/* exported
varname */`, which Oxlint also does not support. I assume we can skip
these?
- "Don't conflict even if using the rules together." failures are due to
not using the RuleTester in those tests and attempting to test multiple
rules together, should probably be skipped?

One difference here that appears to be a genuine bug in the JS plugins
code is the failures on `sort-flags`? I was able to reproduce one of the
failures (I only tested one manually) locally by running oxlint with the
plugin, and the `/\w/yvsimg` regex is not being fixed to sort the flags
by Oxlint. It is being fixed correctly by ESLint though, so it's
definitely a bug in our code. Seemingly, Oxlint doesn't recognize
`/\w/yvsimg` as a violation of the `regexp/sort-flags` rule at all. I've
created https://github.com/oxc-project/oxc/issues/20609 regarding this
issue and potentially fixing it.

See the plugin source code here:
https://github.com/ota-meshi/eslint-plugin-regexp/tree/788787a7e9e820c40321fe2f1095d00d4a486866

Result:

```
### Rules

| Status            | Count | %      |
| ----------------- | ----- | ------ |
| Total rules       |    82 | 100.0% |
| Fully passing     |    78 |  95.1% |
| Partially passing |     4 |   4.9% |
| Fully failing     |     0 |   0.0% |
| Load errors       |     0 |   0.0% |
| No tests run      |     0 |   0.0% |

### Tests

| Status      | Count | %      |
| ----------- | ----- | ------ |
| Total tests |  2370 | 100.0% |
| Passing     |  2349 |  99.1% |
| Failing     |     9 |   0.4% |
| Skipped     |    12 |   0.5% |
```

---------

Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2026-03-27 21:15:24 +00:00
Connor Shea fb3ae9890d test(linter/plugins): Add eslint-plugin-mocha to JS Plugins conformance suite (#20611)
Add `eslint-plugin-mocha` to Oxlint JS plugins conformance tests suite.
100% of tests passing.
2026-03-27 15:31:44 +00:00
overlookmotel 608cd3c478 test(linter/plugins): fix stack traces in conformance snapshots (#20473)
Fix bug in conformance test runner. It was removing some lines from stack traces where errors occur.
2026-03-21 12:24:11 +00:00
Connor Shea 2c50654aa5 test(linter/plugins): Add eslint-plugin-cypress to the conformance suite for JS Plugins (#20265)
This adds eslint-plugin-cypress, based on the same changes from the last
2 additions I've done. See the repo here:
https://github.com/cypress-io/eslint-plugin-cypress

AI Disclosure: Generated with Claude Code, tested/spot-checked and
verified by me (including the SHA hash, of course).

```
### Rules

| Status            | Count | %      |
| ----------------- | ----- | ------ |
| Total rules       |    12 | 100.0% |
| Fully passing     |    11 |  91.7% |
| Partially passing |     1 |   8.3% |
| Fully failing     |     0 |   0.0% |
| Load errors       |     0 |   0.0% |
| No tests run      |     0 |   0.0% |

### Tests

| Status      | Count | %      |
| ----------- | ----- | ------ |
| Total tests |   150 | 100.0% |
| Passing     |   147 |  98.0% |
| Failing     |     3 |   2.0% |
| Skipped     |     0 |   0.0% |
```
2026-03-19 23:08:36 +00:00
Connor Shea 6528f37420 test(linter/plugins): Add eslint-plugin-playwright to the conformance tests (#20264)
AI Disclosure: Generated with Claude Code based on the change in #20262,
reviewed and confirmed/tested/conformance tests run by me.

Adds
[eslint-plugin-playwright](https://github.com/mskelton/eslint-plugin-playwright)
to the conformance suite. Almost all of its tests pass, except 4.

```
### Rules

| Status            | Count | %      |
| ----------------- | ----- | ------ |
| Total rules       |    58 | 100.0% |
| Fully passing     |    57 |  98.3% |
| Partially passing |     1 |   1.7% |
| Fully failing     |     0 |   0.0% |
| Load errors       |     0 |   0.0% |
| No tests run      |     0 |   0.0% |

### Tests

| Status      | Count | %      |
| ----------- | ----- | ------ |
| Total tests |  3048 | 100.0% |
| Passing     |  3044 |  99.9% |
| Failing     |     4 |   0.1% |
| Skipped     |     0 |   0.0% |
```

---------

Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2026-03-19 19:47:38 +00:00
Connor Shea d480bfed3e test(linter/plugins): Add eslint-plugin-storybook to the JS Plugins conformance suite (#20262)
- Tried to keep it as simple as I could, basically copy-pasted the e18e
code and then had Claude help me with parsing issues I ran into. The
`stories.js` files that are used for these tests are actually JSX/TSX
and so I needed to force Oxlint to use the TypeScript/TSX parser by
overriding the file name. I am unsure why Storybook does this or if
there's a simpler fix, but it works for now.
- `--conditions=code` in the conformance command is seemingly necessary
for storybook's eslint plugin to be loaded, I am admittedly unsure if
that causes any problems for the other plugins but I was able to run all
of them (excluding reactHooks) fine locally after the change with no
diffs in the snaps, so ¯\\\_(ツ)_/¯. reactHooks wasn't working for me
before this change either, so I don't think that's a problem with my
change.
- The `no-uninstalled-addons` rule is skipped because it relies on
reading package.json files and that seems to be not-possible, as best as
I can tell. Or at least, I didn't feel it worthwhile to try to figure
out how to make it work after solving for the parser issues on the other
rules.

See the storybook plugin source code here:
https://github.com/storybookjs/storybook/tree/1ba2d0721a9b5e50dcb3974bae7f40d10d71c043/code/lib/eslint-plugin

AI Disclosure: As noted above, used Claude for troubleshooting/fixing
parser config issues.

Result:

```
### Rules

| Status            | Count | %      |
| ----------------- | ----- | ------ |
| Total rules       |    16 | 100.0% |
| Fully passing     |    16 | 100.0% |
| Partially passing |     0 |   0.0% |
| Fully failing     |     0 |   0.0% |
| Load errors       |     0 |   0.0% |
| No tests run      |     0 |   0.0% |

### Tests

| Status      | Count | %      |
| ----------- | ----- | ------ |
| Total tests |   161 | 100.0% |
| Passing     |   141 |  87.6% |
| Failing     |     0 |   0.0% |
| Skipped     |    20 |  12.4% |
```

(note that one of the rules is skipped, so I'd think the "No tests run"
should be 1?)

---------

Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2026-03-19 18:40:42 +00:00
overlookmotel 4047e71ef3 docs(linter/plugins): improve docs for conformance tests (#20528)
Prompted by #20262. Fix an omission in docs for conformance tests, and explain how to filter tests while working on adding a plugin to conformance suite.
2026-03-19 15:34:15 +00:00
overlookmotel 13606c3ab1 docs(linter/plugins): update conformance README (#20234)
Update README for Oxlint JS plugins conformance tests. Going to link to this in alpha blog post.
2026-03-11 15:23:42 +00:00
sapphi-red e255fcd6b5 refactor(linter/plugins): enable TS strict option (#19675)
Enable TypeScript strict option in `apps/oxlint`.
2026-03-06 17:30:20 +00:00
camc314 6a6513c6ab perf(linter/plugins): use Oxc tokens in plugins (#19498)
Builds on #19497. Use the tokens generated by Oxc's parser in linter plugins, instead of running TS parser to tokenize source.

This is a sizeable perf gain, and also allows us to remove TS parser from `oxlint`'s bundle (#19531).

Additionally, our parser is more accurate  than TypeScript - we handle HTML comments and space before slash in closing JSX elements (`< /div>`) - so this fixes a few conformance tests.
2026-02-24 11:31:04 +00:00
overlookmotel c0a3f7ddd9 test(linter/plugins): add eslint-plugin-testing-library to conformance tests (#19225)
Add `eslint-plugin-testing-library` to conformance tests. 100% pass.
2026-02-10 17:44:01 +00:00
overlookmotel 65d55f3793 test(linter/plugins): conformance tester support parsers as named exports (#19224)
Refactor of conformance tests.

Sometimes a custom parser is a named export of a module, not the default export. Support this case in the conformance runner, and simplify the E18E conformance tests setup by using it.
2026-02-10 17:44:00 +00:00
overlookmotel 3d96f6a661 test(linter/plugins): shorten conformance tester code (#19223)
Pure refactor of conformance tester code. Shorten some code.
2026-02-10 17:44:00 +00:00
overlookmotel 7e8873b66d test(linter/plugins): add @e18e/eslint-plugin to conformance tests (#19184)
Add `@e18e/eslint-plugin` to conformance tests. 100% pass (except for type-aware rules which we can't support).
2026-02-09 20:17:38 +00:00
overlookmotel 1d37f4a695 test(linter/plugins): fix mocking RuleTester modules (#19183)
Conformance tests need to mock some modules to replace ESLint / TSESLint's `RuleTester` with our own. Prevent errors during mocking when the module is transpiled from ESM and so the property to replace is a getter.

This supports #19184.
2026-02-09 20:17:37 +00:00
overlookmotel 31302c5f5f test(linter/plugins): mock function in conformance tests take via param (#19182)
Conformance tests need to mock some modules to replace ESLint / TS-ESLint's `RuleTester` with our own, or to mock TS-ESLint parser.

Make this easier to do when then the module to be mocked is imported by test files via a chain of other imports by taking a `via` parameter. Example of usage in a doc comment added in this PR.

This supports #19184.
2026-02-09 20:17:37 +00:00
overlookmotel afc10b104e test(linter/plugins): correct typo in comment (#19180)
Just fix a small typo.
2026-02-09 14:23:42 +00:00
camc314 d4b0324ac2 refactor(oxlint): enable useUnknownInCatchVariables tsconfig setting (#19141) 2026-02-09 13:54:38 +00:00
overlookmotel 5bd405491e test(linter/plugins): bump ESLint version used in conformance tests (#19173)
ESLint v10 [is out](https://eslint.org/blog/2026/02/eslint-v10.0.0-released/). Bump the version of ESLint used in conformance tests to 10.0.0. All tests still pass.
2026-02-09 12:12:31 +00:00
overlookmotel e3dc5f6c10 feat(linter/plugins): RuleTester test suggestions (#19104)
`RuleTester` test that suggestions provided by the rule match what's expected in the test case - that code after applying each suggestion matches the test case's `output` property, and that suggestions' descriptions also match those specified in test cases.

Skip one conformance test for ESLint's `prefer-regex-literals` rule where the suggestion description in Oxlint is different from ESLint, but in a completely cosmetic way. There's no need to match it exactly. That apart, no change to conformance test results, which strongly suggests that Oxlint is treating suggestions correctly.
2026-02-08 20:33:18 +00:00
overlookmotel 825f1483c8 fix(linter/plugins): RuleTester consider adjacent fixes as overlapping in ESLint compat mode (#19094)
Oxlint's behavior when applying two fixes which are directly adjacent to each other is different from ESLint.

* ESLint considers adjacent fixes to be overlapping and only applies the 1st.
* Oxlint considers adjacent fixes NOT to be overlapping and applies them both.

Alter this behavior in `RuleTester` to follow ESLint's logic when `eslintCompat` option is used. This fixes the rest of the failing conformance tests which were broken by #19091.

This PR does not alter the logic for Oxlint itself. I think we should consider doing that, but it needs discussion, so I'll open a separate issue for it.
2026-02-08 20:05:58 +00:00
overlookmotel 6054249f9b feat(linter/plugins): add recursive option to RuleTester (#19093)
Add a `recursive` option to `RuleTester` which makes multiple rounds of fixes rather than a single round.

* `recursive: false` = no extra rounds of fixes.
* `recursive: 2` = 2 extra rounds.
* `recursive: true` = 10 extra rounds.

Default is `false`, which is ESLint's `RuleTester`'s behavior.

If a round produces no further fixes, the loop exits, so `recursive: 10` really means *up to* 10 rounds.

`eslint-plugin-stylistic` uses `eslint-vitest-rule-tester` for its tests, which offers this `recursive` option. Adding support for this option to our `RuleTester` fixes 12 failing conformance tests.
2026-02-08 20:05:58 +00:00
overlookmotel ecd24560a1 fix(linter/plugins): handle fix with -1 offsets in file with BOM (#19092)
Fix an edge case bug where Oxlint was unable to handle fixes with with offset `-1`. Offset `-1` is used in files which contain a BOM to represent "before the BOM".

ESLint's `unicode-bom` rule produces a fix `{ range: [-1, 0], text: "" }` to remove BOM from a file with such a BOM.

`-1` can't be represented as a `u32`, so we have to take a rather annoying workaround - add 1 to offsets before sending them to Rust.

An alternative would have been to make `start` and `end` `i64`s so they can represent `-1`, but this would seem wasteful since we only need to represent -1, not any other negative value. So adding 1 to offsets is cheaper.

This fixes 2 ESLint conformance tests.
2026-02-08 20:05:57 +00:00
overlookmotel 27c241b8ed feat(linter/plugins): RuleTester test fixes (#19091)
`RuleTester` test that fixes provided by the rule match what's expected in the test case - that code after applying fixes matches the test case's `output` property.

This reveals some bugs - 12 ESLint + 62 `eslint-plugin-stylistic` conformance tests are failing after this PR. These bugs are fixed in later PRs in this stack.
2026-02-08 20:05:57 +00:00
overlookmotel 97f873bfdd test(linter/plugin): remove unnecessary optional chain in conformance tests (#19155)
Tiny change to conformance tests. `err` is always defined here so `err?.message` is unnecessary.
2026-02-08 17:23:26 +00:00
overlookmotel f442a083fb test(linter/plugins): fix tester script (#19095)
Fix tester script. It was broken by changes last week.
2026-02-07 01:41:04 +00:00
overlookmotel b7416d06a9 refactor(linter/plugins): remove deprecated exports from index entry point (#18828)
Remove re-exports of `definePlugin`, `defineRule` and `RuleTester` from main `index` entry point of `oxlint` package.

We want this to be cheap:

```js
import { defineConfig } from "oxlint";
```

But with the deprecated exports, this would eagerly load ~20,000 lines of JS plugins-related code. See `index.js` in `dist` directory before and after this PR in release build. It was the import from `./lint.js` which was massive.

Personally, I don't think we need to keep the deprecated exports, for 3 reasons:

1. We have very clearly said that JS plugins are experimental and that breaking changes are very possible.
2. Given how broken our types are at present, probably few people were using `definePlugin` and `defineRule` anyway!
3. The fix for users who do get broken is trivial:

```diff
- import { definePlugin } from "oxlint";
+ import { definePlugin } from "@oxlint/plugins";
```
2026-02-03 15:46:17 +00:00
overlookmotel ab4fdddc61 refactor(linter/plugins): rename oxlint/rule-tester to oxlint/plugins-dev (#18793)
Part of #18610.

Our intent is to move `RuleTester` to a separate package `@oxlint/plugins-dev`.

So rename the current entry point which exports `RuleTester` from `oxlint/rule-tester` to `oxlint/plugins-dev`.
2026-02-01 13:23:14 +00:00
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 986222470f perf(linter/plugins): reduce cost of workspaces (#18758)
Workspaces support (#17809) added overhead on JS side of hashmap lookups. Every call to `lintFile` has to look up details (e.g. registered rules, rule options) from hashmaps keyed by workspace URI.

### Perf

Take a different approach which is optimized for common case of there being only 1 workspace:

* At any time there's 1 "current workspace".
* Store rules, options, and CWD in top-level vars (back to how it was before #17809).
* Switch workspaces only when required. Switching reassigns the values in these top level vars.

Before:

* Get rules, options, and CWD from hashmaps keyed by workspace URI.

After:

* Quick check "is the current workspace the one we need?".
* If so, do nothing - the top-level vars `registeredRules`, `allOptions`, and `cwd` elready contain the right settings for the desired workspace.
* If current workspace is not the right one, look up the details for desired workspace in `workspaces` hash map and write them into the top-level vars.

In CLI, `workspaceUri` passed to `lintFile` etc is `null`, so the quick "in the right workspace?" check is particularly cheap - just `null === null`. So this reduces the overhead that workspace support adds to CLI to just that 1 instruction.

Add of these functions are entirely synchronous, so there's no possibility of a race where 1 call switches out the values in the top-level vars, while another call is busy using them.

### CLI: No call to `createWorkspace`

CLI now doesn't need to call `createWorkspace` at all. The "are we in right workspace?" check always succeeds, so it's irrelevant whether a workspace has been created or not - `workspaces` hashmap is never accessed.

So workspaces is now an LSP-only thing.

### Bundle

This PR also removes all imports from other files from `src-js/workspace/index.ts`. It now only imports `debugAssert`, which is optimized out in release build., leaving no imports at all.

Previously, the imports from other files were causing most of the JS plugins code to get loaded on first call to `createWorkspace`, which broke the lazy loading optimization - Oxlint CLI and LSP were both loading all the JS plugins code eagerly even if the user doesn't use JS plugins.

With this change, the lazy loading optimization is restored. This is visible in the conformance snapshot change in this PR.
2026-01-31 16:20:08 +00:00
overlookmotel 2a72794014 feat(linter/plugins): RuleTester take cwd property (#18756)
Add a `cwd` option to `RuleTester`.

Use this option in conformance tests to set `cwd` to the test files directory. This fixes the 1 test which #17809 broke.
2026-01-31 15:42:33 +00:00
overlookmotel 7c7a984c6d test(linter/plugins): update conformance snapshots (#18752)
Update conformance snapshots. They got out of sync after #17809 (1 broken test, and change to how code is split across files in bundle).
2026-01-31 14:35:05 +00:00
overlookmotel c1df1653ed test(linter/plugins): add eslint-plugin-sonarjs to conformance tests (#18646)
Add `eslint-plugin-sonarjs` to conformance tests.

This was largely motivated by trying to track down the CFG malfunctions reported in #18555. But there are none to be found!

99.7% pass rate. The last 0.3% (14 tests) is rules which use `context.languageOptions.parser.parse`, which we haven't implemented yet.

Failing test cases for rules which are type-aware are skipped (385 tests), as we cannot support them.
2026-01-28 23:02:40 +00:00
overlookmotel 026e475ae1 test(linter/plugins): conformance tester shorten filename in test cases in snapshots (#18682)
`eslint-plugin-sonarjs` sets `filename` property of test cases to an absolute path. Potentially other plugins do this too.

In snapshots, convert to a path relative to repo root, so that snapshot contents will be the same on any machine it's run on. Also conform to unix-style `/`s.
2026-01-28 23:02:39 +00:00
overlookmotel c3d1ae9019 test(linter/plugins): conformance tester identify known parsers by parseForESLint function (#18680)
Conformance tester was identifying known parsers specified by test cases by comparing the `parser` object to known values. Instead, compare `parser.parseForESLint` functions.

This produces an accurate match even when the test case object is deep cloned which results in the `parser` object being a new (unknown) object. But the `parseForESLint` function stays the same after cloning.

`eslint-plugin-sonarjs` does this kind of deep cloning.
2026-01-28 23:02:39 +00:00
overlookmotel 70e4bd2a9a test(linter/plugins): conformance tester keep other module exports when mocking RuleTester modules (#18679)
When mocking modules containing `RuleTester`, don't replace the whole module, just alter the `RuleTester` property within it. e.g. when mocking the `RuleTester` export of `eslint` package, leave all package's other exports unchanged.
2026-01-28 23:02:38 +00:00
overlookmotel f9949a04f6 test(linter/plugins): conformance tester catch errors in describe callbacks (#18678)
Catch errors in `describe(() => { ... })` blocks and turn them into test cases. This results in a failing test rather than the whole test file failing to load.
2026-01-28 23:02:37 +00:00
overlookmotel 22762c1243 test(linter/plugins): conformance tester allow skipping tests which did not run with RuleTester (#18677)
In conformance tester, process errors for when a test case was not run with the correct `RuleTester` in the same way as other errors. This allows skipping them if this behavior is expected (e.g. unit tests which don't use `RuleTester`).
2026-01-28 23:02:37 +00:00
overlookmotel 34951edfce fix(linter/plugins): filename option takes precedence over parserOptions.lang in RuleTester (#18643)
Fix `RuleTester`' s behavior when test case defines both `filename` and `parserOptions.lang`. `filename` takes precedence.
2026-01-28 02:04:25 +00:00
overlookmotel 6f7f7d16cf test(linter/plugins): improve types in conformance tests (#18641)
Just remove an `any`.
2026-01-27 23:32:55 +00:00
overlookmotel 1363943f3d test(linter/plugins): remove directives when parsing as ES3 (#18636)
In ES3, directives didn't exist yet, and therefore `"use strict"` is treated as a standard string literal, rather than a directive.

In conformance tests, when test case specifies ES3, walk the AST and set `directive` property of all `ExpressionStatement`s to `null`. This transforms any directives in AST into plain string literals.

Combined with #18632 which fixed `"use strict"` processing in TS-ESLint, this means there are 8 ESLint test cases we no longer have to skip. More importantly, we're less likely to run into erroneous test failures when testing other plugins, which are laborious to diagnose.
2026-01-27 18:42:21 +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
overlookmotel 43eccaa154 test(linter/plugins): add eslint-stylistic to conformance tests (#18554)
Add `eslint-plugin-stylistic` to conformance tests.

99.96% pass rate. The remaining 7 failing tests are not easily fixable:

#### `jsx-props-no-multi-spaces` rule

1 failing test

The rule clones nodes with `Object.assign({}, node)`, and then uses the `loc` property of the cloned node. Because `loc` is a getter on *prototype* of AST nodes, `loc` property is not present on the cloned node.

This bug may have real-world impact. We'll need to make `loc` a real property of node objects to fix it (#10307). We originally had `loc` getter on the node objects themselves, but that caused a 3x slowdown.

#### `jsx-tag-spacing` rule

6 failing tests

TypeScript parser (which we use for generating tokens) cannot parse closing JSX tags with whitespace before the `/` - e.g. `<App>text< /App>`.

TS-ESLint parser also fails to parse this [AST explorer](https://ast-explorer.dev/#eNpFyzEKwzAMBdCrGM0p3UModOkROnkRRgUH1xaWUlqC716pHbJJ7/+/Q4EZVnyhpJ5ZYQI20A/TH04kJVf3ZL5cmS+P1pZw9su0me6xhhCB0hPv1CW3GmE2KKgkGmE68huhbp3EC7+ZB6u8/de+kdOIdcD4AgUpMYU=), so this bug is unlikely to have real-world impact.
2026-01-25 22:12:34 +00:00