Skip to content

Comments

refactor(linter): store rule options as Vecs#16339

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-01-refactor_linter_store_rule_options_as_vec_s
Dec 2, 2025
Merged

refactor(linter): store rule options as Vecs#16339
graphite-app[bot] merged 1 commit intomainfrom
12-01-refactor_linter_store_rule_options_as_vec_s

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 1, 2025

Rule options are always an array, so store them as a Vec<Value> instead of a single Value which is always a Value::Array. This gives better type safety.

@github-actions github-actions bot added A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Dec 1, 2025
Copy link
Member Author

overlookmotel commented Dec 1, 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 1, 2025

CodSpeed Performance Report

Merging #16339 will not alter performance

Comparing 12-01-refactor_linter_store_rule_options_as_vec_s (eab0874) with main (d490daa)

Summary

✅ 4 untouched
⏩ 41 skipped1

Footnotes

  1. 41 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 marked this pull request as draft December 1, 2025 13:46
@graphite-app graphite-app bot force-pushed the 12-01-perf_linter_avoid_cloning_rule_options branch 2 times, most recently from efee93a to c39aaa5 Compare December 1, 2025 13:52
@graphite-app graphite-app bot force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from 2876176 to ec38b61 Compare December 1, 2025 13:52
@overlookmotel overlookmotel changed the base branch from 12-01-perf_linter_avoid_cloning_rule_options to graphite-base/16339 December 1, 2025 14:26
@overlookmotel overlookmotel changed the base branch from graphite-base/16339 to 12-01-perf_linter_avoid_cloning_rule_options December 1, 2025 14:26
@overlookmotel overlookmotel changed the base branch from 12-01-perf_linter_avoid_cloning_rule_options to graphite-base/16339 December 1, 2025 14:29
@overlookmotel overlookmotel changed the base branch from graphite-base/16339 to 12-01-perf_linter_avoid_cloning_rule_options December 1, 2025 14:30
@overlookmotel overlookmotel changed the base branch from 12-01-perf_linter_avoid_cloning_rule_options to graphite-base/16339 December 1, 2025 14:30
@overlookmotel overlookmotel force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from ec38b61 to b77cfba Compare December 1, 2025 14:30
@overlookmotel overlookmotel changed the base branch from graphite-base/16339 to 12-01-fix_linter_no-magic-numbers_fix_options_parsing December 1, 2025 14:31
@overlookmotel overlookmotel changed the base branch from 12-01-fix_linter_no-magic-numbers_fix_options_parsing to graphite-base/16339 December 1, 2025 14:48
@overlookmotel overlookmotel force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from b77cfba to eaeb0d4 Compare December 1, 2025 14:48
@overlookmotel overlookmotel changed the base branch from graphite-base/16339 to 12-01-perf_linter_only_clone_config_if_required December 1, 2025 14:48
@overlookmotel overlookmotel marked this pull request as ready for review December 1, 2025 14:51
@overlookmotel overlookmotel force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from eaeb0d4 to eb5fff7 Compare December 1, 2025 14:55
@overlookmotel overlookmotel force-pushed the 12-01-perf_linter_only_clone_config_if_required branch from 04d8ab9 to 4e3338f Compare December 1, 2025 18:32
@overlookmotel overlookmotel force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from eb5fff7 to 44db42f Compare December 1, 2025 18:32
@graphite-app graphite-app bot changed the base branch from 12-01-perf_linter_only_clone_config_if_required to graphite-base/16339 December 1, 2025 18:38
@graphite-app graphite-app bot force-pushed the graphite-base/16339 branch from 4e3338f to e31b2bd Compare December 1, 2025 18:44
@graphite-app graphite-app bot force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from 44db42f to 37781ad Compare December 1, 2025 18:44
@graphite-app graphite-app bot changed the base branch from graphite-base/16339 to main December 1, 2025 18:44
@graphite-app graphite-app bot force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from 37781ad to 5a98c87 Compare December 1, 2025 18:45
Copilot AI review requested due to automatic review settings December 2, 2025 00:15
@overlookmotel overlookmotel force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from 5a98c87 to eab0874 Compare December 2, 2025 00:15
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 rule option storage to use Vec<serde_json::Value> instead of serde_json::Value (which was always a Value::Array), providing better type safety and eliminating runtime panics. The change affects how rule configurations are stored internally while maintaining the same external API behavior for rule configuration methods like from_configuration.

  • Changed ESLintRule.config from Option<Value> to Option<Vec<Value>> where Some always contains a non-empty vector
  • Updated ExternalPluginStore::add_options to accept Vec<Value> directly, removing unnecessary runtime assertions
  • Modified conversion logic to properly transform between internal storage format and the expected from_configuration parameter format

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_linter/src/external_plugin_store.rs Updated add_options method signature to accept Vec<Value> instead of Value, removed panic condition and outdated documentation
crates/oxc_linter/src/config/rules.rs Changed ESLintRule.config type to Option<Vec<Value>>, updated conversion logic for from_configuration calls, modified serialization to handle new type, updated parse_rule_value return type, and fixed test assertions
crates/oxc_linter/src/config/config_store.rs Updated test code to call add_options with Vec<Value> instead of Value::Array

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

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 2, 2025
Copy link
Contributor

camc314 commented Dec 2, 2025

Merge activity

Rule options are always an array, so store them as a `Vec<Value>` instead of a single `Value` which is always a `Value::Array`. This gives better type safety.
@graphite-app graphite-app bot force-pushed the 12-01-refactor_linter_store_rule_options_as_vec_s branch from eab0874 to c51a380 Compare December 2, 2025 09:04
@graphite-app graphite-app bot merged commit c51a380 into main Dec 2, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 12-01-refactor_linter_store_rule_options_as_vec_s branch December 2, 2025 09:09
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 2, 2025
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
Rule options are always an array, so store them as a `Vec<Value>` instead of a single `Value` which is always a `Value::Array`. This gives better type safety.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter 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.

2 participants