Skip to content

Comments

refactor(linter/plugins): prepare for rule options#16158

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-26-refactor_linter_plugins_prepare_for_rule_options
Nov 26, 2025
Merged

refactor(linter/plugins): prepare for rule options#16158
graphite-app[bot] merged 1 commit intomainfrom
11-26-refactor_linter_plugins_prepare_for_rule_options

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 26, 2025

Preparatory work for supporting rule options.

Store options for all rules in an allOptions array. Currently this array only contains a single value for empty options, but in future we'll populate it with options extracted from configs, sent over from Rust side.

Am adding this now, before full implementation (#14825), as it's required for rule tester.

Copy link
Member Author

overlookmotel commented Nov 26, 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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Nov 26, 2025
@overlookmotel overlookmotel marked this pull request as ready for review November 26, 2025 12:20
Copilot AI review requested due to automatic review settings November 26, 2025 12:20
@overlookmotel overlookmotel self-assigned this Nov 26, 2025
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Nov 26, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 26, 2025

Merge activity

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 refactors the options handling system for linter rules in preparation for supporting rule options. The main change is to centralize options management through a new options.ts module with an allOptions array that stores all rule options configurations.

Key Changes:

  • Creates a new centralized options module (options.ts) with an allOptions array for storing rule configurations
  • Changes RuleDetails.options from always being DEFAULT_OPTIONS to initially null, then set before linting each file
  • Threads optionsIds parameter through the linting pipeline to support per-rule options lookup

Reviewed changes

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

Show a summary per file
File Description
apps/oxlint/src-js/plugins/options.ts New module centralizing options type and storage with allOptions array and DEFAULT_OPTIONS_ID constant
apps/oxlint/src-js/plugins/load.ts Moves Options type to new module and initializes RuleDetails.options to null instead of DEFAULT_OPTIONS
apps/oxlint/src-js/plugins/lint.ts Adds optionsIds parameter and assigns options from allOptions array before linting each file
apps/oxlint/src-js/plugins/context.ts Updates imports and adds null assertion for options in context getter
apps/oxlint/src-js/index.ts Updates exports to reference Options type from new module

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

Preparatory work for supporting rule options.

Store options for all rules in an `allOptions` array. Currently this array only contains a single value for empty options, but in future we'll populate it with options extracted from configs, sent over from Rust side.

Am adding this now, before full implementation (#14825), as it's required for rule tester.
@graphite-app graphite-app bot force-pushed the 11-26-refactor_linter_plugins_prepare_for_rule_options branch from 388e098 to fa3b070 Compare November 26, 2025 12:23
@graphite-app graphite-app bot merged commit fa3b070 into main Nov 26, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 11-26-refactor_linter_plugins_prepare_for_rule_options branch November 26, 2025 12:29
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 26, 2025
@lilnasy lilnasy mentioned this pull request Nov 28, 2025
3 tasks
overlookmotel added a commit that referenced this pull request Dec 1, 2025
- Implements #14825
- Rebased #15822. Refactored. Pruned the slop. Tests passing.

### Big changes from the original approach
- [x] Options IDs are stored in their own arrays. This was laid out in
#16158. The original approach was to store `ruleId`-`optionId` pairs as
tuples in an array - several heap allocated objects and excessive
pointer indirection.
- [x] The rust code populates the options by calling a new JS callback
named `setupConfigs()`. I expect we would use this callback for more
plugin related data, including settings which are currently implemented
in a hacky way.
- [ ] Investigate a refactor to avoid requiring a mutable reference to
`ExternalPluginStore` everywhere.

<details>
<summary>

#### Smaller Changes

</summary>

- Removed the extra fixture ("working version"). There were no
meaningful changes compared to the first fixture. Probably slop.

</details>

---------

Co-authored-by: Peter Wagenet <peter@wagenet.us>
Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
Preparatory work for supporting rule options.

Store options for all rules in an `allOptions` array. Currently this array only contains a single value for empty options, but in future we'll populate it with options extracted from configs, sent over from Rust side.

Am adding this now, before full implementation (oxc-project#14825), as it's required for rule tester.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
- Implements oxc-project#14825
- Rebased oxc-project#15822. Refactored. Pruned the slop. Tests passing.

### Big changes from the original approach
- [x] Options IDs are stored in their own arrays. This was laid out in
oxc-project#16158. The original approach was to store `ruleId`-`optionId` pairs as
tuples in an array - several heap allocated objects and excessive
pointer indirection.
- [x] The rust code populates the options by calling a new JS callback
named `setupConfigs()`. I expect we would use this callback for more
plugin related data, including settings which are currently implemented
in a hacky way.
- [ ] Investigate a refactor to avoid requiring a mutable reference to
`ExternalPluginStore` everywhere.

<details>
<summary>

#### Smaller Changes

</summary>

- Removed the extra fixture ("working version"). There were no
meaningful changes compared to the first fixture. Probably slop.

</details>

---------

Co-authored-by: Peter Wagenet <peter@wagenet.us>
Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
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-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant