Skip to content

Commit c3a92e0

Browse files
authored
docs(linter): Add configuration option docs for oxc/no-rest-spread-properties rule. (#15070)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### objectRestMessage type: `string` default: `""` A message to display when object rest properties are found. ### objectSpreadMessage type: `string` default: `""` A message to display when object spread properties are found. ```
1 parent c7c9213 commit c3a92e0

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

crates/oxc_linter/src/rules/oxc/no_rest_spread_properties.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use oxc_ast::AstKind;
22
use oxc_diagnostics::OxcDiagnostic;
33
use oxc_macros::declare_oxc_lint;
44
use oxc_span::Span;
5+
use schemars::JsonSchema;
56

67
use crate::{AstNode, context::LintContext, rule::Rule};
78

@@ -16,9 +17,12 @@ fn no_rest_spread_properties_diagnostic(
1617
#[derive(Debug, Default, Clone)]
1718
pub struct NoRestSpreadProperties(Box<NoRestSpreadPropertiesOptions>);
1819

19-
#[derive(Debug, Default, Clone)]
20+
#[derive(Debug, Default, Clone, JsonSchema)]
21+
#[serde(rename_all = "camelCase", default)]
2022
pub struct NoRestSpreadPropertiesOptions {
23+
/// A message to display when object spread properties are found.
2124
object_spread_message: String,
25+
/// A message to display when object rest properties are found.
2226
object_rest_message: String,
2327
}
2428

@@ -50,29 +54,10 @@ declare_oxc_lint!(
5054
/// let { x, ...y } = z;
5155
/// let z = { x, ...y };
5256
/// ```
53-
///
54-
/// ### Options
55-
///
56-
/// ```json
57-
/// {
58-
/// "rules": {
59-
/// "no-rest-spread-properties": [
60-
/// "error",
61-
/// {
62-
/// "objectSpreadMessage": "Object spread properties are not allowed.",
63-
/// "objectRestMessage": "Object rest properties are not allowed."
64-
/// }
65-
/// ]
66-
/// }
67-
/// }
68-
/// ```
69-
///
70-
/// - `objectSpreadMessage`: A message to display when object spread properties are found.
71-
/// - `objectRestMessage`: A message to display when object rest properties are found.
72-
///
7357
NoRestSpreadProperties,
7458
oxc,
7559
restriction,
60+
config = NoRestSpreadPropertiesOptions,
7661
);
7762

7863
impl Rule for NoRestSpreadProperties {

0 commit comments

Comments
 (0)