Skip to content

feat(linter/plugins): support parserOptions.ecmaFeatures.jsx option in RuleTester#16690

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-10-feat_linter_plugins_support_parseroptions.ecmafeatures.jsx_option_in_ruletester_
Dec 10, 2025
Merged

feat(linter/plugins): support parserOptions.ecmaFeatures.jsx option in RuleTester#16690
graphite-app[bot] merged 1 commit intomainfrom
12-10-feat_linter_plugins_support_parseroptions.ecmafeatures.jsx_option_in_ruletester_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 10, 2025

Add parserOptions.ecmaFeatures.jsx to RuleTester, for compatibility with ESLint's RuleTester.

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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request labels Dec 10, 2025
Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 10, 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 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 ecmaFeatures within parserOptions configuration hierarchy
  • Added logic to derive parse language from ecmaFeatures.jsx when lang is 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.

@overlookmotel overlookmotel self-assigned this Dec 10, 2025
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Dec 10, 2025
Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 10, 2025

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.
@graphite-app graphite-app bot force-pushed the 12-10-test_linter_plugins_shorten_ruletester_test_cases branch from affb872 to cd78a76 Compare December 10, 2025 11:11
@graphite-app graphite-app bot force-pushed the 12-10-feat_linter_plugins_support_parseroptions.ecmafeatures.jsx_option_in_ruletester_ branch from 1c4f36d to 2b73b14 Compare December 10, 2025 11:12
Base automatically changed from 12-10-test_linter_plugins_shorten_ruletester_test_cases to main December 10, 2025 11:17
@graphite-app graphite-app bot merged commit 2b73b14 into main Dec 10, 2025
19 checks passed
@graphite-app graphite-app bot deleted the 12-10-feat_linter_plugins_support_parseroptions.ecmafeatures.jsx_option_in_ruletester_ branch December 10, 2025 11:17
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 10, 2025
Copilot AI pushed a commit that referenced this pull request Dec 10, 2025
… 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.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
… 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.
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