From 5d37f46eab4215fba1165ca940df3ed583da2f33 Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Tue, 11 Jun 2024 12:38:28 +0200 Subject: [PATCH 1/3] docs(useImportType): add docs about TypeScript settings --- .../biome_js_analyze/src/lint/style/use_import_type.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 e09a6b37176e..bbd65fdffab9 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 @@ -33,6 +33,16 @@ declare_rule! { /// The rule ensures that all imports used only as a type use a type-only `import`. /// It also groups inline type imports into a grouped `import type`. /// + /// If you are using the TypeScript Compiler (TSC) to transpile your code into JavaScript, + /// then you can disable this rule, as TSC is able to remove imports that are only used as types. + /// However, for consistency and compatibility with other transpilers, you nay want to enable this rule. + /// In that case we recommend to enable TSC's [verbatimModuleSyntax](https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax). + /// This configuration ensures that TSC preserves imports that are not marked with the `type` qualifier. + /// + /// You may also want to enable the editor setting [typescript.preferences.preferTypeOnlyAutoImports](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3-rc/#settings-to-prefer-type-auto-imports) from the TypeScript LSP. + /// This setting is available in Visual Studio Code. + /// It ensures that the `tyupe` is used when the editor automatically imports a type. + /// /// ## Caveat with TypeScript experimental decorators /// /// Some frameworks like Angular and NestJS rely on From d0ad62782891607fab477211a7389036875a0323 Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Tue, 11 Jun 2024 12:53:25 +0200 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Ze-Zheng Wu --- crates/biome_js_analyze/src/lint/style/use_import_type.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 bbd65fdffab9..da8c4a7b84c0 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 @@ -36,12 +36,12 @@ declare_rule! { /// If you are using the TypeScript Compiler (TSC) to transpile your code into JavaScript, /// then you can disable this rule, as TSC is able to remove imports that are only used as types. /// However, for consistency and compatibility with other transpilers, you nay want to enable this rule. - /// In that case we recommend to enable TSC's [verbatimModuleSyntax](https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax). + /// In that case we recommend to enable TSC's [`verbatimModuleSyntax`](https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax). /// This configuration ensures that TSC preserves imports that are not marked with the `type` qualifier. /// - /// You may also want to enable the editor setting [typescript.preferences.preferTypeOnlyAutoImports](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3-rc/#settings-to-prefer-type-auto-imports) from the TypeScript LSP. + /// You may also want to enable the editor setting [`typescript.preferences.preferTypeOnlyAutoImports`](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3-rc/#settings-to-prefer-type-auto-imports) from the TypeScript LSP. /// This setting is available in Visual Studio Code. - /// It ensures that the `tyupe` is used when the editor automatically imports a type. + /// It ensures that the `type` is used when the editor automatically imports a type. /// /// ## Caveat with TypeScript experimental decorators /// From 54cfa890c8570f17c7d27f3313072d25b9fb6116 Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Tue, 11 Jun 2024 14:37:12 +0200 Subject: [PATCH 3/3] Update crates/biome_js_analyze/src/lint/style/use_import_type.rs Co-authored-by: Emanuele Stoppa --- .../biome_js_analyze/src/lint/style/use_import_type.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 da8c4a7b84c0..715b6f4cf8bf 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 @@ -33,15 +33,15 @@ declare_rule! { /// The rule ensures that all imports used only as a type use a type-only `import`. /// It also groups inline type imports into a grouped `import type`. /// - /// If you are using the TypeScript Compiler (TSC) to transpile your code into JavaScript, - /// then you can disable this rule, as TSC is able to remove imports that are only used as types. - /// However, for consistency and compatibility with other transpilers, you nay want to enable this rule. + /// If you use the TypeScript Compiler (TSC) to compile your code into JavaScript, + /// then you can disable this rule, as TSC can remove imports only used as types. + /// However, for consistency and compatibility with other transpilers, you may want to enable this rule. /// In that case we recommend to enable TSC's [`verbatimModuleSyntax`](https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax). - /// This configuration ensures that TSC preserves imports that are not marked with the `type` qualifier. + /// This configuration ensures that TSC preserves imports not marked with the `type` qualifier. /// /// You may also want to enable the editor setting [`typescript.preferences.preferTypeOnlyAutoImports`](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3-rc/#settings-to-prefer-type-auto-imports) from the TypeScript LSP. /// This setting is available in Visual Studio Code. - /// It ensures that the `type` is used when the editor automatically imports a type. + /// It ensures the `type` is used when the editor automatically imports a type. /// /// ## Caveat with TypeScript experimental decorators ///