test(linter/plugins): add eslint-plugin-sonarjs to conformance tests#18646
Merged
graphite-app[bot] merged 1 commit intomainfrom Jan 28, 2026
Conversation
This was referenced Jan 28, 2026
Member
Author
52b81bf to
ca06ae4
Compare
d3fd142 to
abf3a7b
Compare
ca06ae4 to
c6c8e0f
Compare
3fd83e2 to
b49bf28
Compare
b49bf28 to
1ade5ac
Compare
This was referenced Jan 28, 2026
Merged
1ade5ac to
1fcc896
Compare
de0192e to
cacafcf
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR integrates eslint-plugin-sonarjs into the Oxlint JS plugins conformance test harness, so SonarJS’ own rule tests are run through Oxlint’s RuleTester and summarized in snapshots. It also adds the necessary wiring and submodule initialization to fetch, patch, and execute the SonarJS test suite.
Changes:
- Exported
TestCasesfrom the conformancerule_testershim andcurrentRulefrom the capture module to enable SonarJS-specific RuleTester adaptations. - Added a new
sonarjstest group that locates SonarJS rule tests, patches their internal rule testers (including type-aware variants and a JSX filename fixup for a React-specific rule), and defines SonarJS-specific skip logic. - Extended the conformance initialization script to clone and prepare the SonarJS repository and added a generated conformance snapshot
sonarjs.md, as well as registering the new group in the globalTEST_GROUPSlist.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/oxlint/conformance/src/rule_tester.ts | Exports TestCases type so external group adapters (SonarJS) can reuse the RuleTester test case structure. |
| apps/oxlint/conformance/src/capture.ts | Exports currentRule so the SonarJS group can inspect the currently running rule when patching its NoTypeCheckingRuleTester. |
| apps/oxlint/conformance/src/groups/sonarjs.ts | New SonarJS TestGroup that wires SonarJS test discovery, patches its rule testers for type-aware tests and JSX filename issues, and defines SonarJS-specific skip rules and parser configuration. |
| apps/oxlint/conformance/src/groups/index.ts | Registers the new sonarjs group alongside the existing ESLint, React Hooks, and Stylistic groups. |
| apps/oxlint/conformance/init.sh | Extends the setup script to clone/build the SonarJS repo, patch its tests/checkers for use with the conformance harness, and normalize import.meta.dirname and node:test usage. |
| apps/oxlint/conformance/snapshots/sonarjs.md | Generated conformance snapshot summarizing SonarJS rule/test pass/fail/skip stats under the Oxlint plugin API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cacafcf to
5f1e6c8
Compare
1fcc896 to
0e45d02
Compare
Member
Author
Merge activity
|
#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.
5f1e6c8 to
026e475
Compare
0e45d02 to
c1df165
Compare
Base automatically changed from
om/01-28-test_linter_plugins_conformance_tester_shorten_filename_in_test_cases_in_snapshots
to
main
January 28, 2026 23:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add
eslint-plugin-sonarjsto 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.