Skip to content

Commit 9a0ed13

Browse files
committed
docs(linter): Fix config option docs for eslint/operator-assignment rule. (#16030)
This was inaccurate previously as I had added this before string-only config options were supported for doc generation. Part of #14743. Generated docs: ```md ## Configuration This rule accepts one of the following string values: ### `"always"` Requires assignment operator shorthand where possible. ### `"never"` Disallows assignment operator shorthand. ```
1 parent 3976e4f commit 9a0ed13

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ fn operator_assignment_diagnostic(mode: Mode, span: Span, operator: &str) -> Oxc
2727
#[derive(Debug, Default, PartialEq, Clone, Copy, Serialize, JsonSchema)]
2828
#[serde(rename_all = "kebab-case")]
2929
enum Mode {
30+
/// Requires assignment operator shorthand where possible.
3031
#[default]
3132
Always,
33+
/// Disallows assignment operator shorthand.
3234
Never,
3335
}
3436

@@ -38,18 +40,8 @@ impl Mode {
3840
}
3941
}
4042

41-
#[derive(Debug, Default, Clone, Serialize, JsonSchema)]
42-
#[serde(rename_all = "camelCase", default)]
43+
#[derive(Debug, Default, Clone, Serialize)]
4344
pub struct OperatorAssignment {
44-
/// This rule has a single string option:
45-
/// * `always` requires assignment operator shorthand where possible
46-
/// * `never` disallows assignment operator shorthand
47-
///
48-
/// Example:
49-
/// ```json
50-
/// "eslint/operator-assignment": ["error", "always"]
51-
/// "eslint/operator-assignment": ["error", "never"]
52-
/// ```
5345
mode: Mode,
5446
}
5547

@@ -102,7 +94,7 @@ declare_oxc_lint!(
10294
eslint,
10395
style,
10496
fix_dangerous,
105-
config = OperatorAssignment,
97+
config = Mode,
10698
);
10799

108100
impl Rule for OperatorAssignment {

0 commit comments

Comments
 (0)