From 70e7be4c93b2cea7ccd0fd893f209058cc1ee68e Mon Sep 17 00:00:00 2001 From: connorshea <2977353+connorshea@users.noreply.github.com> Date: Wed, 21 Jan 2026 05:55:07 +0000 Subject: [PATCH] fix(linter): Update `import/no-unassigned-import` to raise an error when passed invalid config options. (#18108) This was missed by the script in #18107 due to having no serde usage on the struct itself. --- crates/oxc_linter/src/rules/import/no_unassigned_import.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/oxc_linter/src/rules/import/no_unassigned_import.rs b/crates/oxc_linter/src/rules/import/no_unassigned_import.rs index e9842c807da52..1a306e05168e1 100644 --- a/crates/oxc_linter/src/rules/import/no_unassigned_import.rs +++ b/crates/oxc_linter/src/rules/import/no_unassigned_import.rs @@ -26,6 +26,7 @@ fn no_unassigned_import_diagnostic(span: Span, msg: &str) -> OxcDiagnostic { pub struct NoUnassignedImport(Box); #[derive(Debug, Default, Clone, JsonSchema, Deserialize)] +#[serde(deny_unknown_fields)] pub struct NoUnassignedImportConfig { /// A list of glob patterns to allow unassigned imports for specific modules. /// For example: @@ -84,9 +85,7 @@ declare_oxc_lint!( impl Rule for NoUnassignedImport { fn from_configuration(value: 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>) {