Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions crates/oxc_linter/src/rules/oxc/no_rest_spread_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use oxc_ast::AstKind;
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use schemars::JsonSchema;

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

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

#[derive(Debug, Default, Clone)]
#[derive(Debug, Default, Clone, JsonSchema)]
#[serde(rename_all = "camelCase", default)]
pub struct NoRestSpreadPropertiesOptions {
/// A message to display when object spread properties are found.
object_spread_message: String,
/// A message to display when object rest properties are found.
object_rest_message: String,
}

Expand Down Expand Up @@ -50,29 +54,10 @@ declare_oxc_lint!(
/// let { x, ...y } = z;
/// let z = { x, ...y };
/// ```
///
/// ### Options
///
/// ```json
/// {
/// "rules": {
/// "no-rest-spread-properties": [
/// "error",
/// {
/// "objectSpreadMessage": "Object spread properties are not allowed.",
/// "objectRestMessage": "Object rest properties are not allowed."
/// }
/// ]
/// }
/// }
/// ```
///
/// - `objectSpreadMessage`: A message to display when object spread properties are found.
/// - `objectRestMessage`: A message to display when object rest properties are found.
///
NoRestSpreadProperties,
oxc,
restriction,
config = NoRestSpreadPropertiesOptions,
);

impl Rule for NoRestSpreadProperties {
Expand Down
Loading