diff --git a/crates/oxc_linter/src/rules/react/jsx_max_depth.rs b/crates/oxc_linter/src/rules/react/jsx_max_depth.rs index be2329d059a46..c836b64d8eb98 100644 --- a/crates/oxc_linter/src/rules/react/jsx_max_depth.rs +++ b/crates/oxc_linter/src/rules/react/jsx_max_depth.rs @@ -36,8 +36,9 @@ impl std::ops::Deref for JsxMaxDepth { } #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] -#[serde(rename_all = "camelCase", default)] +#[serde(rename_all = "camelCase", default, deny_unknown_fields)] pub struct JsxMaxDepthConfig { + /// The maximum allowed depth of nested JSX elements and fragments. pub max: usize, } @@ -89,9 +90,7 @@ declare_oxc_lint!( impl Rule for JsxMaxDepth { fn from_configuration(value: serde_json::Value) -> Result { - Ok(serde_json::from_value::>(value) - .map(DefaultRuleConfig::into_inner) - .unwrap_or_default()) + serde_json::from_value::>(value).map(DefaultRuleConfig::into_inner) } fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {