Skip to content

refactor(linter/plugins): refactor config merging in RuleTester#16657

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

refactor(linter/plugins): refactor config merging in RuleTester#16657
graphite-app[bot] merged 1 commit intomainfrom
12-09-refactor_linter_plugins_refactor_config_merging_in_ruletester_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 9, 2025

RuleTester has 3 levels of config:

  1. Default config - set with RuleTester.setDefaultConfig(...).
  2. RuleTester instance config - set with new RuleTester(...).
  3. Config set on individual test cases.

Simplify handling all this by merging configs into each TestCase, so that TestCase contains all the properties for an individual test - regardless of at what level they were set.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior 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.

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 refactors config merging in RuleTester to simplify the handling of three-level configuration (default, instance, and test case). Instead of passing config separately through multiple function layers, configs are now merged directly into each test case object at the start of test execution, making the data flow more straightforward.

Key Changes:

  • Removed index signature [key: string]: unknown from Config interface for stricter typing
  • Made TestCase interface extend Config to allow test cases to have config properties
  • Refactored config merging to happen once per test case via mergeConfigIntoTestCase() instead of repeatedly through function chains
  • Added TEST_CASE_PROP_KEYS set to filter test-case-specific properties during config merging, including "__proto__" for security

Reviewed changes

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

File Description
apps/oxlint/test/rule_tester.test.ts Updated tests to use actual config property eslintCompat instead of arbitrary whatever property, reflecting stricter Config interface typing
apps/oxlint/src-js/package/rule_tester.ts Core refactoring: removed index signature from Config, added config filtering logic, merged config into test cases early in execution flow, updated function signatures accordingly

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

@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

…6657)

`RuleTester` has 3 levels of config:

1. Default config - set with `RuleTester.setDefaultConfig(...)`.
2. `RuleTester` instance config - set with `new RuleTester(...)`.
3. Config set on individual test cases.

Simplify handling all this by merging configs into each `TestCase`, so that `TestCase` contains all the properties for an individual test - regardless of at what level they were set.
@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 merged commit eb9f814 into main Dec 9, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 12-09-refactor_linter_plugins_refactor_config_merging_in_ruletester_ branch December 9, 2025 18:50
@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
…6657)

`RuleTester` has 3 levels of config:

1. Default config - set with `RuleTester.setDefaultConfig(...)`.
2. `RuleTester` instance config - set with `new RuleTester(...)`.
3. Config set on individual test cases.

Simplify handling all this by merging configs into each `TestCase`, so that `TestCase` contains all the properties for an individual test - regardless of at what level they were set.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…c-project#16657)

`RuleTester` has 3 levels of config:

1. Default config - set with `RuleTester.setDefaultConfig(...)`.
2. `RuleTester` instance config - set with `new RuleTester(...)`.
3. Config set on individual test cases.

Simplify handling all this by merging configs into each `TestCase`, so that `TestCase` contains all the properties for an individual test - regardless of at what level they were set.
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-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants