Skip to content

feat(linter/plugins): RuleTester parser support options#16641

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-08-feat_linter_plugins_ruletester_parser_support_options
Dec 9, 2025
Merged

feat(linter/plugins): RuleTester parser support options#16641
graphite-app[bot] merged 1 commit intomainfrom
12-08-feat_linter_plugins_ruletester_parser_support_options

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 9, 2025

Add options to the parser used in RuleTester. Currently RuleTester doesn't actually use these options, but this prepares the way for other changes to RuleTester in future PRs.

The extra types for Comment etc in bindings.d.ts are just the result of using oxc_napi crate for its get_source_type function. We don't use those types, but they're also not exposed externally, so it doesn't matter.

@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 9, 2025
Copy link
Copy Markdown
Member Author


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 09:59
Copilot AI review requested due to automatic review settings December 9, 2025 09:59
@overlookmotel overlookmotel self-assigned this Dec 9, 2025
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 parser options support to RuleTester by introducing a ParserOptions struct that allows configuring the language type (js, jsx, ts, tsx, dts) and source type (script, module, unambiguous) for parsing. The options are threaded through from TypeScript to Rust and used to configure the parser's SourceType.

Key Changes:

  • Added ParserOptions struct with lang and source_type fields on Rust side
  • Updated parse_raw_sync and parse_raw_impl to accept optional parser options
  • Added corresponding TypeScript type definitions and updated the parse function signature

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
apps/oxlint/src/js_plugins/parse.rs Adds ParserOptions struct, updates parser functions to accept options, and includes get_source_type helper function to process the options
apps/oxlint/src-js/package/parse.ts Updates parse function signature to accept optional ParseOptions parameter and passes it to Rust binding
apps/oxlint/src-js/bindings.d.ts Defines ParserOptions TypeScript interface and updates parseRawSync signature (auto-generated)

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

@overlookmotel overlookmotel force-pushed the 12-08-feat_linter_plugins_ruletester_parser_support_options branch from fdabc71 to d5bf26a Compare December 9, 2025 11:21
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Dec 9, 2025

CodSpeed Performance Report

Merging #16641 will not alter performance

Comparing 12-08-feat_linter_plugins_ruletester_parser_support_options (fbdd54f) with main (6cddbe7)

Summary

✅ 42 untouched
⏩ 3 skipped1

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@overlookmotel overlookmotel force-pushed the 12-08-feat_linter_plugins_ruletester_parser_support_options branch from d5bf26a to fbdd54f Compare December 9, 2025 11:58
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 9, 2025
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Dec 9, 2025

Merge activity

Add options to the parser used in `RuleTester`. Currently `RuleTester` doesn't actually use these options, but this prepares the way for other changes to `RuleTester` in future PRs.

The extra types for `Comment` etc in `bindings.d.ts` are just the result of using `oxc_napi` crate for its `get_source_type` function. We don't use those types, but they're also not exposed externally, so it doesn't matter.
@graphite-app graphite-app bot force-pushed the 12-08-feat_linter_plugins_ruletester_parser_support_options branch from fbdd54f to 554250e Compare December 9, 2025 12:48
graphite-app bot pushed a commit that referenced this pull request Dec 9, 2025
…fig types (#16642)

Add to types for `Config` and `TestCase` in `RuleTester`. Similar to #16641, these options are currently ignored, but it prepares the way for other changes to `RuleTester` in future PRs.
@graphite-app graphite-app bot merged commit 554250e into main Dec 9, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 12-08-feat_linter_plugins_ruletester_parser_support_options branch December 9, 2025 12:53
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 9, 2025
Copilot AI pushed a commit that referenced this pull request Dec 10, 2025
Add options to the parser used in `RuleTester`. Currently `RuleTester` doesn't actually use these options, but this prepares the way for other changes to `RuleTester` in future PRs.

The extra types for `Comment` etc in `bindings.d.ts` are just the result of using `oxc_napi` crate for its `get_source_type` function. We don't use those types, but they're also not exposed externally, so it doesn't matter.
Copilot AI pushed a commit that referenced this pull request Dec 10, 2025
…fig types (#16642)

Add to types for `Config` and `TestCase` in `RuleTester`. Similar to #16641, these options are currently ignored, but it prepares the way for other changes to `RuleTester` in future PRs.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…t#16641)

Add options to the parser used in `RuleTester`. Currently `RuleTester` doesn't actually use these options, but this prepares the way for other changes to `RuleTester` in future PRs.

The extra types for `Comment` etc in `bindings.d.ts` are just the result of using `oxc_napi` crate for its `get_source_type` function. We don't use those types, but they're also not exposed externally, so it doesn't matter.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…fig types (oxc-project#16642)

Add to types for `Config` and `TestCase` in `RuleTester`. Similar to oxc-project#16641, these options are currently ignored, but it prepares the way for other changes to `RuleTester` in future PRs.
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