Skip to content

test(linter/plugins): simplify enabling ESLint compat mode in conformance tester#16658

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-09-test_linter_plugins_simplify_enabling_eslint_compat_mode_in_conformance_tester
Dec 9, 2025
Merged

test(linter/plugins): simplify enabling ESLint compat mode in conformance tester#16658
graphite-app[bot] merged 1 commit intomainfrom
12-09-test_linter_plugins_simplify_enabling_eslint_compat_mode_in_conformance_tester

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 9, 2025

Conformance test runner had a complicated set-up to inject eslintCompat: true to the options for running rules.

Simplify this by:

  • Adding an undocumented registerModifyTestCaseHook method to RuleTester which is only present in debug build.
  • Using that hook to set eslintCompat: true just before the test case is run.

This change also enables more complicated modifications of test cases to come in later PRs, to e.g. enable handling test cases which are TypeScript.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins labels Dec 9, 2025
Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 9, 2025


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 Dec 9, 2025
@overlookmotel overlookmotel marked this pull request as ready for review December 9, 2025 18:21
Copilot AI review requested due to automatic review settings December 9, 2025 18:21
Copy link
Copy Markdown
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 simplifies the conformance tester's setup for enabling ESLint compatibility mode by introducing a debug-only hook mechanism. Previously, the conformance tester used a complex system of overriding RuleTester methods to prevent disabling eslintCompat. Now, it uses a simpler hook-based approach that modifies test cases just before they're executed.

Key changes:

  • Added registerModifyTestCaseHook method to RuleTester (debug builds only) for registering callbacks that modify test cases before execution
  • Modified mergeConfigIntoTestCase to invoke the registered hook on the merged test case configuration
  • Simplified conformance tester's RuleTesterShim by removing complex config protection logic and using the hook to set eslintCompat: true directly on test cases

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/oxlint/src-js/package/rule_tester.ts Adds debug-only registerModifyTestCaseHook API and calls registered hook in mergeConfigIntoTestCase before returning merged test case
apps/oxlint/conformance/src/rule_tester.ts Removes complex config protection logic and uses new hook mechanism to set eslintCompat: true on test cases; removes unused assert import

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overlookmotel overlookmotel self-assigned this Dec 9, 2025
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 9, 2025
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Dec 9, 2025

Merge activity

…ance tester (#16658)

Conformance test runner had a complicated set-up to inject `eslintCompat: true` to the options for running rules.

Simplify this by:

* Adding an undocumented `registerModifyTestCaseHook` method to `RuleTester` which is only present in debug build.
* Using that hook to set `eslintCompat: true` just before the test case is run.

This change also enables more complicated modifications of test cases to come in later PRs, to e.g. enable handling test cases which are TypeScript.
@graphite-app graphite-app bot force-pushed the 12-09-refactor_linter_plugins_refactor_config_merging_in_ruletester_ branch from 18e615d to eb9f814 Compare December 9, 2025 18:44
@graphite-app graphite-app bot force-pushed the 12-09-test_linter_plugins_simplify_enabling_eslint_compat_mode_in_conformance_tester branch from 1e9ae6a to f791273 Compare December 9, 2025 18:45
Base automatically changed from 12-09-refactor_linter_plugins_refactor_config_merging_in_ruletester_ to main December 9, 2025 18:50
@graphite-app graphite-app bot merged commit f791273 into main Dec 9, 2025
19 checks passed
@graphite-app graphite-app bot deleted the 12-09-test_linter_plugins_simplify_enabling_eslint_compat_mode_in_conformance_tester branch December 9, 2025 18:51
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 9, 2025
Copilot AI pushed a commit that referenced this pull request Dec 10, 2025
…ance tester (#16658)

Conformance test runner had a complicated set-up to inject `eslintCompat: true` to the options for running rules.

Simplify this by:

* Adding an undocumented `registerModifyTestCaseHook` method to `RuleTester` which is only present in debug build.
* Using that hook to set `eslintCompat: true` just before the test case is run.

This change also enables more complicated modifications of test cases to come in later PRs, to e.g. enable handling test cases which are TypeScript.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…ance tester (oxc-project#16658)

Conformance test runner had a complicated set-up to inject `eslintCompat: true` to the options for running rules.

Simplify this by:

* Adding an undocumented `registerModifyTestCaseHook` method to `RuleTester` which is only present in debug build.
* Using that hook to set `eslintCompat: true` just before the test case is run.

This change also enables more complicated modifications of test cases to come in later PRs, to e.g. enable handling test cases which are TypeScript.
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