-
-
Notifications
You must be signed in to change notification settings - Fork 763
feat(linter/plugins): RuleTester support languageOptions.sourceType
#16660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(linter/plugins): RuleTester support languageOptions.sourceType
#16660
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.
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
ParseOptionssupport to theparse()function call in the lint workflow - Implemented proper merging of
languageOptionsfrom 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.
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.
c1324c6 to
973a1ba
Compare
809ac17 to
4cf1353
Compare
) Follow-on after #16660. Add tests for `languageOptions.sourceType` in `RuleTester`.
…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.
) Follow-on after #16660. Add tests for `languageOptions.sourceType` in `RuleTester`.
…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.
…-project#16670) Follow-on after oxc-project#16660. Add tests for `languageOptions.sourceType` in `RuleTester`.
…ester` (oxc-project#16671) Follow-on after oxc-project#16660. Add 1 more test that I missed in oxc-project#16670.

RuleTesteruselanguageOptions.sourceTypein config / test case definition to determine whether to parse a file as script or module.sourceType: "unambiguous"is also supported.sourceType: "commonjs"is also supported (treated the same as"script").This fixes ~300 conformance tests.