diff --git a/apps/oxlint/src/lint.rs b/apps/oxlint/src/lint.rs index ffe842a861374..0e1b55444292e 100644 --- a/apps/oxlint/src/lint.rs +++ b/apps/oxlint/src/lint.rs @@ -628,7 +628,7 @@ mod test { let args = &["fixtures/svelte/debugger.svelte"]; let result = test(args); assert_eq!(result.number_of_files, 1); - assert_eq!(result.number_of_warnings, 2); + assert_eq!(result.number_of_warnings, 1); assert_eq!(result.number_of_errors, 0); } diff --git a/crates/oxc_linter/src/rules/eslint/no_unused_vars/mod.rs b/crates/oxc_linter/src/rules/eslint/no_unused_vars/mod.rs index 6ae3bb022f932..9a5f605ca6ec7 100644 --- a/crates/oxc_linter/src/rules/eslint/no_unused_vars/mod.rs +++ b/crates/oxc_linter/src/rules/eslint/no_unused_vars/mod.rs @@ -214,12 +214,12 @@ impl Rule for NoUnusedVars { } fn should_run(&self, ctx: &ContextHost) -> bool { - // ignore .d.ts and vue files. + // ignore .d.ts and vue/svelte files. // 1. declarations have side effects (they get merged together) - // 2. vue scripts declare variables that get used in the template, which + // 2. vue/svelte scripts declare variables that get used in the template, which // we can't detect !ctx.source_type().is_typescript_definition() - && !ctx.file_path().extension().is_some_and(|ext| ext == "vue") + && !ctx.file_path().extension().is_some_and(|ext| ext == "vue" || ext == "svelte") } }