From d780164faf92b660f91a5c1a6ec26f5a60c51a0c Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Tue, 29 Oct 2024 11:42:29 +0100 Subject: [PATCH] refactor(useImportType,useExportType): ignore dts (#4418) --- CHANGELOG.md | 4 ++++ crates/biome_js_analyze/src/lint/style/use_export_type.rs | 2 +- crates/biome_js_analyze/src/lint/style/use_import_type.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f97e3eed9915..fad0a944e1c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,10 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b Contributed by @Conaclos +#### Enhancements + +- `useExportType` and `useImportType` now ignore TypeScript declaration files ([#4416](https://github.com/biomejs/biome/pull/4416)). Contributed by @Conaclos + ### Parser #### Bug fixes diff --git a/crates/biome_js_analyze/src/lint/style/use_export_type.rs b/crates/biome_js_analyze/src/lint/style/use_export_type.rs index d47077b45120..08d71641ac84 100644 --- a/crates/biome_js_analyze/src/lint/style/use_export_type.rs +++ b/crates/biome_js_analyze/src/lint/style/use_export_type.rs @@ -79,7 +79,7 @@ impl Rule for UseExportType { fn run(ctx: &RuleContext) -> Self::Signals { let source_type = ctx.source_type::(); - if !source_type.language().is_typescript() { + if !source_type.language().is_typescript() || source_type.language().is_definition_file() { return None; } let export_named_clause = ctx.query(); diff --git a/crates/biome_js_analyze/src/lint/style/use_import_type.rs b/crates/biome_js_analyze/src/lint/style/use_import_type.rs index 3bf082d239af..cea7adaadc36 100644 --- a/crates/biome_js_analyze/src/lint/style/use_import_type.rs +++ b/crates/biome_js_analyze/src/lint/style/use_import_type.rs @@ -128,7 +128,7 @@ impl Rule for UseImportType { fn run(ctx: &RuleContext) -> Self::Signals { let source_type = ctx.source_type::(); - if !source_type.language().is_typescript() { + if !source_type.language().is_typescript() || source_type.language().is_definition_file() { return None; } let import = ctx.query();