feat(linter/plugins): support parserOptions.ecmaFeatures.jsx option in RuleTester#16690
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 adds support for the parserOptions.ecmaFeatures.jsx option to RuleTester, improving compatibility with ESLint's RuleTester API. When set to true and no explicit lang option is provided, JSX parsing is enabled automatically. This enhancement allows ~250 additional conformance tests to pass.
Key changes:
- Implemented deep merging for
ecmaFeatureswithinparserOptionsconfiguration hierarchy - Added logic to derive parse language from
ecmaFeatures.jsxwhenlangis not explicitly specified - Removed completed "TODO: Merge deeply" comments now that deep merging is implemented
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
apps/oxlint/src-js/package/rule_tester.ts |
Adds mergeEcmaFeatures function for deep config merging, updates getParseOptions to use ecmaFeatures.jsx as fallback when lang is not set, removes resolved TODO comments, and documents precedence rules |
apps/oxlint/test/rule_tester.test.ts |
Comprehensive test suite covering default behavior, explicit true/false settings, global/instance/test-case-level configuration, override scenarios, and precedence rules with the lang option |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
… in `RuleTester` (#16690) Add `parserOptions.ecmaFeatures.jsx` to `RuleTester`, for compatibility with ESLint's `RuleTester`. ```js const tester = new RuleTester({ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true }, }, }, }); tester.run("my-rule", rule, { valid: [ // No parsing error "<div />", ], invalid: [], }); ``` This fixes another ~250 conformance tests.
affb872 to
cd78a76
Compare
1c4f36d to
2b73b14
Compare
… in `RuleTester` (#16690) Add `parserOptions.ecmaFeatures.jsx` to `RuleTester`, for compatibility with ESLint's `RuleTester`. ```js const tester = new RuleTester({ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true }, }, }, }); tester.run("my-rule", rule, { valid: [ // No parsing error "<div />", ], invalid: [], }); ``` This fixes another ~250 conformance tests.
… in `RuleTester` (oxc-project#16690) Add `parserOptions.ecmaFeatures.jsx` to `RuleTester`, for compatibility with ESLint's `RuleTester`. ```js const tester = new RuleTester({ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true }, }, }, }); tester.run("my-rule", rule, { valid: [ // No parsing error "<div />", ], invalid: [], }); ``` This fixes another ~250 conformance tests.

Add
parserOptions.ecmaFeatures.jsxtoRuleTester, for compatibility with ESLint'sRuleTester.This fixes another ~250 conformance tests.