fix(linter): prevent conflicting type import fixes (#27409)

`typescript/no-import-type-side-effects` can convert an import to `import type` while `import/no-duplicates` appends an inline type specifier in the same fix pass, producing invalid syntax such as `import type { CoreSetup, Logger, type LoggerFactory }`. This caused the [Kibana ecosystem CI job](https://github.com/oxc-project/oxc-ecosystem-ci/actions/runs/37620021185/job/112790134395) to panic.
This commit is contained in:
camc314 committed 2026-10-07 13:44:06 +00:00
1 parent 848a4e7173
commit 25122137c0
1 file changed
+3 -1
@@ -106,7 +106,7 @@ impl Rule for NoImportTypeSideEffects {
ctx.diagnostic_with_fix(
no_import_type_side_effects_diagnostic(import_decl.span),
|fixer| {
let mut fix = fixer.new_fix_with_capacity(type_specifiers.len() + 1);
let mut fix = fixer.new_fix_with_capacity(type_specifiers.len() + 2);
let raw = ctx.source_range(import_decl.span);
// import type A from 'foo.js'
@@ -124,6 +124,8 @@ impl Rule for NoImportTypeSideEffects {
)));
}
fix.push(Fix::new("", Span::empty(import_decl.span.end)));
fix.with_message("Convert to top-level type import")
},
);