mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
d5d3c76cf6
#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.
Oxlint JS plugins conformance tests
Conformance tests run:
- All ESLint's tests for its built-in rules as Oxlint JS plugins.
- Tests from various ESLint plugins, running in Oxlint.
They do this by substituting ESLint's RuleTester for Oxlint's version, and then require()ing the test files
to run the tests.
The results are saved in snapshots directory.
Setup
Build Oxlint in conformance mode:
cd apps/oxlint
pnpm install
pnpm run build-conformance
Initialize plugin submodules:
pnpm run init-conformance
Run conformance tests
pnpm run conformance
Updating a pinned repo version
All upstream repo URLs, commit SHAs, and version labels are stored in repos.json.
Both init.sh and the TypeScript test groups read from this single file.
To update a repo to a newer version:
- Edit
repos.json— update thecommitShaandversionfor the repo. - Re-initialize submodules:
pnpm run init-conformance - Re-run the conformance tests:
pnpm run conformance - Commit the updated
repos.jsonand snapshot files.
Adding a plugin to conformance tests
- Add an entry to
repos.jsonwith the repo's URL, commit SHA, and version. - Add code to
init.shto clone and set up the plugin's repo. - Add a file to
src/groupsdirectory (copy pattern used for other plugins). - Add the group to
src/groups/index.ts.
Debugging
While working on adding a new plugin, you may find it useful to filter the test run, by editing
conformance/src/filter.ts. You can filter by plugin name, rule, or the code of a specific test case.