Skip to content

Commit ff2a6e6

Browse files
committed
docs(linter): Add docs for no-param-reassign config options.
This will allow us to auto-gen docs for the config rule when building the website. I believe the note about the rust regex syntax is correct, I based it on the similar comment from the new-cap rule.
1 parent aa024d9 commit ff2a6e6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

crates/oxc_linter/src/rules/eslint/no_param_reassign.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use lazy_regex::Regex;
22
use rustc_hash::FxHashSet;
3+
use schemars::JsonSchema;
34

45
use oxc_ast::{
56
AstKind,
@@ -29,10 +30,17 @@ fn assignment_to_param_property_diagnostic(name: &str, span: Span) -> OxcDiagnos
2930
.with_label(span)
3031
}
3132

32-
#[derive(Debug, Default, Clone)]
33+
#[derive(Debug, Default, Clone, JsonSchema)]
34+
#[serde(rename_all = "camelCase", default)]
3335
struct NoParamReassignConfig {
36+
/// When true, also check for modifications to properties of parameters.
3437
props: bool,
38+
/// An array of parameter names whose property modifications should be ignored.
3539
ignore_property_modifications_for: FxHashSet<String>,
40+
/// An array of regex patterns (as strings) for parameter names whose property modifications should be ignored.
41+
/// Note that this uses [Rust regex syntax](https://docs.rs/regex/latest/regex/) and so may not have all features
42+
/// available to JavaScript regexes.
43+
#[schemars(with = "Vec<String>", default)]
3644
ignore_property_modifications_for_regex: Vec<Regex>,
3745
}
3846

@@ -73,7 +81,8 @@ declare_oxc_lint!(
7381
/// ```
7482
NoParamReassign,
7583
eslint,
76-
restriction
84+
restriction,
85+
config = NoParamReassignConfig,
7786
);
7887

7988
impl Rule for NoParamReassign {

0 commit comments

Comments
 (0)