Skip to content

test(linter/plugins): conformance tester identify known parsers by parseForESLint function#18680

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/01-28-test_linter_plugins_conformance_tester_identify_known_parsers_by_parse_function
Jan 28, 2026
Merged

test(linter/plugins): conformance tester identify known parsers by parseForESLint function#18680
graphite-app[bot] merged 1 commit intomainfrom
om/01-28-test_linter_plugins_conformance_tester_identify_known_parsers_by_parse_function

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jan 28, 2026

Conformance tester was identifying known parsers specified by test cases by comparing the parser object to known values. Instead, compare parser.parseForESLint functions.

This produces an accurate match even when the test case object is deep cloned which results in the parser object being a new (unknown) object. But the parseForESLint function stays the same after cloning.

eslint-plugin-sonarjs does this kind of deep cloning.

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 changed the title test(linter/plugins): conformance tester identify known parsers by parse function test(linter/plugins): conformance tester identify known parsers by parseForESLint function Jan 28, 2026
@overlookmotel overlookmotel marked this pull request as ready for review January 28, 2026 22:18
Copilot AI review requested due to automatic review settings January 28, 2026 22:18
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

Updates the conformance tester’s known-parser detection to be resilient to deep-cloned test case objects by matching parsers via their parseForESLint function reference rather than the parser object identity.

Changes:

  • Replace parser identity maps with maps keyed by parseForESLint function references.
  • Update test-case preprocessing to resolve parser details using parseForESLint.
  • Adjust conformance runner setup to populate and clear the new maps.

Reviewed changes

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

File Description
apps/oxlint/conformance/src/rule_tester.ts Switches parser recognition to use parseForESLint function keys when deriving parser details and normalizing test cases.
apps/oxlint/conformance/src/index.ts Updates parser loading/registration to populate the new parseForESLint-keyed map and renames path mapping accordingly.

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

@overlookmotel overlookmotel self-assigned this Jan 28, 2026
@overlookmotel overlookmotel force-pushed the om/01-28-test_linter_plugins_conformance_tester_keep_other_module_exports_when_mocking_ruletester_modules branch from 81d4d84 to f626725 Compare January 28, 2026 22:37
@overlookmotel overlookmotel force-pushed the om/01-28-test_linter_plugins_conformance_tester_identify_known_parsers_by_parse_function branch from cf53919 to 8e79f9e Compare January 28, 2026 22:37
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 28, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 28, 2026

Merge activity

…arseForESLint` function (#18680)

Conformance tester was identifying known parsers specified by test cases by comparing the `parser` object to known values. Instead, compare `parser.parseForESLint` functions.

This produces an accurate match even when the test case object is deep cloned which results in the `parser` object being a new (unknown) object. But the `parseForESLint` function stays the same after cloning.

`eslint-plugin-sonarjs` does this kind of deep cloning.
@graphite-app graphite-app bot force-pushed the om/01-28-test_linter_plugins_conformance_tester_keep_other_module_exports_when_mocking_ruletester_modules branch from f626725 to 70e4bd2 Compare January 28, 2026 23:03
@graphite-app graphite-app bot force-pushed the om/01-28-test_linter_plugins_conformance_tester_identify_known_parsers_by_parse_function branch from 8e79f9e to c3d1ae9 Compare January 28, 2026 23:04
@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_keep_other_module_exports_when_mocking_ruletester_modules to main January 28, 2026 23:10
@graphite-app graphite-app bot merged commit c3d1ae9 into main Jan 28, 2026
20 checks passed
@graphite-app graphite-app bot deleted the om/01-28-test_linter_plugins_conformance_tester_identify_known_parsers_by_parse_function branch January 28, 2026 23:11
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