test(linter/plugins): simplify enabling ESLint compat mode in conformance tester#16658
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
There was a problem hiding this comment.
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
registerModifyTestCaseHookmethod toRuleTester(debug builds only) for registering callbacks that modify test cases before execution - Modified
mergeConfigIntoTestCaseto invoke the registered hook on the merged test case configuration - Simplified conformance tester's
RuleTesterShimby removing complex config protection logic and using the hook to seteslintCompat: truedirectly 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.
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.
18e615d to
eb9f814
Compare
1e9ae6a to
f791273
Compare
…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.
…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.

Conformance test runner had a complicated set-up to inject
eslintCompat: trueto the options for running rules.Simplify this by:
registerModifyTestCaseHookmethod toRuleTesterwhich is only present in debug build.eslintCompat: truejust 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.