diff --git a/crates/oxc_linter/src/rules/typescript/no_restricted_types.rs b/crates/oxc_linter/src/rules/typescript/no_restricted_types.rs index e3f2a8bb1adb3..f2735be38b462 100644 --- a/crates/oxc_linter/src/rules/typescript/no_restricted_types.rs +++ b/crates/oxc_linter/src/rules/typescript/no_restricted_types.rs @@ -36,9 +36,9 @@ fn no_restricted_types_diagnostic( pub struct NoRestrictedTypes(Box); #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Default)] +#[serde(rename_all = "camelCase", default, deny_unknown_fields)] struct NoRestrictedTypesConfig { /// A mapping of type names to ban configurations. - #[serde(default)] types: FxHashMap, } @@ -150,9 +150,7 @@ declare_oxc_lint!( impl Rule for NoRestrictedTypes { fn from_configuration(value: serde_json::Value) -> Result { - Ok(serde_json::from_value::>(value) - .unwrap_or_default() - .into_inner()) + serde_json::from_value::>(value).map(DefaultRuleConfig::into_inner) } fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {