Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 9, 2025

RuleTester use languageOptions.sourceType in config / test case definition to determine whether to parse a file as script or module.

  • In standard mode, sourceType: "unambiguous" is also supported.
  • In ESLint-compat mode, sourceType: "commonjs" is also supported (treated the same as "script").

This fixes ~300 conformance tests.

Copy link
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.

@overlookmotel overlookmotel marked this pull request as ready for review December 9, 2025 18:26
Copilot AI review requested due to automatic review settings December 9, 2025 18:26
@overlookmotel overlookmotel self-assigned this Dec 9, 2025
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 adds support for languageOptions.sourceType in the RuleTester, enabling test cases and configurations to specify how source files should be parsed (as script, module, or unambiguous). The implementation correctly handles differences between standard and ESLint-compatibility modes, where "unambiguous" is supported in standard mode and "commonjs" (treated as "script") is supported in ESLint-compat mode. This enhancement fixes approximately 300 conformance tests by providing more accurate parsing context.

Key Changes

  • Added ParseOptions support to the parse() function call in the lint workflow
  • Implemented proper merging of languageOptions from configs and test cases with precedence handling
  • Added sourceType validation and conversion logic that differentiates between standard and ESLint-compat modes

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

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Dec 9, 2025
Copy link
Member Author

overlookmotel commented Dec 9, 2025

Merge activity

…e` (#16660)

`RuleTester` use `languageOptions.sourceType` in config / test case definition to determine whether to parse a file as script or module.

* In standard mode, `sourceType: "unambiguous"` is also supported.
* In ESLint-compat mode, `sourceType: "commonjs"` is also supported (treated the same as `"script"`).

This fixes ~300 conformance tests.
@graphite-app graphite-app bot force-pushed the 12-09-test_linter_plugins_allow_filtering_by_rule_or_test_case_in_conformance_tester branch from c1324c6 to 973a1ba Compare December 9, 2025 18:46
@graphite-app graphite-app bot force-pushed the 12-09-feat_linter_plugins_ruletester_support_languageoptions.sourcetype_ branch from 809ac17 to 4cf1353 Compare December 9, 2025 18:46
Base automatically changed from 12-09-test_linter_plugins_allow_filtering_by_rule_or_test_case_in_conformance_tester to main December 9, 2025 18:51
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 9, 2025
@graphite-app graphite-app bot merged commit 4cf1353 into main Dec 9, 2025
19 checks passed
@graphite-app graphite-app bot deleted the 12-09-feat_linter_plugins_ruletester_support_languageoptions.sourcetype_ branch December 9, 2025 18:52
graphite-app bot pushed a commit that referenced this pull request Dec 9, 2025
)

Follow-on after #16660. Add tests for `languageOptions.sourceType` in `RuleTester`.
graphite-app bot pushed a commit that referenced this pull request Dec 9, 2025
…ester` (#16671)

Follow-on after #16660. Add 1 more test that I missed in #16670.
Copilot AI pushed a commit that referenced this pull request Dec 10, 2025
…e` (#16660)

`RuleTester` use `languageOptions.sourceType` in config / test case definition to determine whether to parse a file as script or module.

* In standard mode, `sourceType: "unambiguous"` is also supported.
* In ESLint-compat mode, `sourceType: "commonjs"` is also supported (treated the same as `"script"`).

This fixes ~300 conformance tests.
Copilot AI pushed a commit that referenced this pull request Dec 10, 2025
)

Follow-on after #16660. Add tests for `languageOptions.sourceType` in `RuleTester`.
Copilot AI pushed a commit that referenced this pull request Dec 10, 2025
…ester` (#16671)

Follow-on after #16660. Add 1 more test that I missed in #16670.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…e` (oxc-project#16660)

`RuleTester` use `languageOptions.sourceType` in config / test case definition to determine whether to parse a file as script or module.

* In standard mode, `sourceType: "unambiguous"` is also supported.
* In ESLint-compat mode, `sourceType: "commonjs"` is also supported (treated the same as `"script"`).

This fixes ~300 conformance tests.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…-project#16670)

Follow-on after oxc-project#16660. Add tests for `languageOptions.sourceType` in `RuleTester`.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
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-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants