refactor(linter): store rule options as Vecs#16339
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. |
CodSpeed Performance ReportMerging #16339 will not alter performanceComparing Summary
Footnotes
|
efee93a to
c39aaa5
Compare
2876176 to
ec38b61
Compare
ec38b61 to
b77cfba
Compare
c39aaa5 to
43b9cc1
Compare
43b9cc1 to
04d8ab9
Compare
b77cfba to
eaeb0d4
Compare
eaeb0d4 to
eb5fff7
Compare
04d8ab9 to
4e3338f
Compare
eb5fff7 to
44db42f
Compare
4e3338f to
e31b2bd
Compare
44db42f to
37781ad
Compare
37781ad to
5a98c87
Compare
5a98c87 to
eab0874
Compare
There was a problem hiding this comment.
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.configfromOption<Value>toOption<Vec<Value>>whereSomealways contains a non-empty vector - Updated
ExternalPluginStore::add_optionsto acceptVec<Value>directly, removing unnecessary runtime assertions - Modified conversion logic to properly transform between internal storage format and the expected
from_configurationparameter 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.
Merge activity
|
eab0874 to
c51a380
Compare
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.

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