Skip to content

test(linter/plugins): add eslint-plugin-sonarjs to conformance tests#18646

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests
Jan 28, 2026
Merged

test(linter/plugins): add eslint-plugin-sonarjs to conformance tests#18646
graphite-app[bot] merged 1 commit intomainfrom
om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jan 28, 2026

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.

Copy link
Member Author

overlookmotel commented Jan 28, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-test Category - Testing. Code is missing test cases, or a PR is adding them label Jan 28, 2026
@overlookmotel overlookmotel self-assigned this Jan 28, 2026
@graphite-app graphite-app bot changed the base branch from om/01-28-refactor_linter_plugins_simplify_implementation_of_sourcecode.parserservices_ to graphite-base/18646 January 28, 2026 02:27
@graphite-app graphite-app bot force-pushed the om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests branch from 52b81bf to ca06ae4 Compare January 28, 2026 02:34
@graphite-app graphite-app bot force-pushed the graphite-base/18646 branch from d3fd142 to abf3a7b Compare January 28, 2026 02:34
@graphite-app graphite-app bot changed the base branch from graphite-base/18646 to main January 28, 2026 02:34
@graphite-app graphite-app bot force-pushed the om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests branch from ca06ae4 to c6c8e0f Compare January 28, 2026 02:35
@overlookmotel overlookmotel force-pushed the om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests branch 2 times, most recently from 3fd83e2 to b49bf28 Compare January 28, 2026 03:31
@overlookmotel overlookmotel changed the base branch from main to graphite-base/18646 January 28, 2026 22:09
@overlookmotel overlookmotel force-pushed the om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests branch from b49bf28 to 1ade5ac Compare January 28, 2026 22:09
@overlookmotel overlookmotel changed the base branch from graphite-base/18646 to om/01-28-test_linter_plugins_conformance_tester_shorten_filename_in_test_cases_in_snapshots January 28, 2026 22:09
@overlookmotel overlookmotel force-pushed the om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests branch from 1ade5ac to 1fcc896 Compare January 28, 2026 22:22
@overlookmotel overlookmotel force-pushed the om/01-28-test_linter_plugins_conformance_tester_shorten_filename_in_test_cases_in_snapshots branch from de0192e to cacafcf Compare January 28, 2026 22:22
@overlookmotel overlookmotel marked this pull request as ready for review January 28, 2026 22:30
Copilot AI review requested due to automatic review settings January 28, 2026 22:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TestCases from the conformance rule_tester shim and currentRule from the capture module to enable SonarJS-specific RuleTester adaptations.
  • Added a new sonarjs test 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 global TEST_GROUPS list.

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.

@overlookmotel overlookmotel force-pushed the om/01-28-test_linter_plugins_conformance_tester_shorten_filename_in_test_cases_in_snapshots branch from cacafcf to 5f1e6c8 Compare January 28, 2026 22:38
@overlookmotel overlookmotel force-pushed the om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests branch from 1fcc896 to 0e45d02 Compare January 28, 2026 22:38
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jan 28, 2026
Copy link
Member Author

overlookmotel commented Jan 28, 2026

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.
@graphite-app graphite-app bot force-pushed the om/01-28-test_linter_plugins_conformance_tester_shorten_filename_in_test_cases_in_snapshots branch from 5f1e6c8 to 026e475 Compare January 28, 2026 23:05
@graphite-app graphite-app bot force-pushed the om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests branch from 0e45d02 to c1df165 Compare January 28, 2026 23:05
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 28, 2026
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
@graphite-app graphite-app bot merged commit c1df165 into main Jan 28, 2026
20 checks passed
@graphite-app graphite-app bot deleted the om/01-27-test_linter_plugins_add_eslint-plugin-sonarjs_to_conformance_tests branch January 28, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants