Repository: jhipster/jhipster-lite
Pull request #10975 (2024-09-25 09:31:32)

feat(prettier): add prettier plugin 'prettier-plugin-organize-imports' to prettier module


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/prettier/domain/PrettierModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/prettier/domain/PrettierModuleFactory.java
index 853174848..847b8724c 100644
--- a/src/main/java/tech/jhipster/lite/generator/prettier/domain/PrettierModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/prettier/domain/PrettierModuleFactory.java
@@ -31,6 +31,7 @@ public class PrettierModuleFactory {
         .addDevDependency(packageName("prettier"), COMMON)
         .addDevDependency(packageName("prettier-plugin-gherkin"), COMMON)
         .addDevDependency(packageName("prettier-plugin-java"), COMMON)
+        .addDevDependency(packageName("prettier-plugin-organize-imports"), COMMON)
         .addDevDependency(packageName("prettier-plugin-packagejson"), COMMON)
         .addScript(scriptKey("prettier:check"), scriptCommand("prettier --check ."))
         .addScript(scriptKey("prettier:format"), scriptCommand("prettier --write ."))
diff --git a/src/main/resources/generator/dependencies/common/package.json b/src/main/resources/generator/dependencies/common/package.json
index c2bc16b3f..9c1aee655 100644
--- a/src/main/resources/generator/dependencies/common/package.json
+++ b/src/main/resources/generator/dependencies/common/package.json
@@ -44,6 +44,7 @@
     "prettier": "3.3.3",
     "prettier-plugin-gherkin": "3.1.0",
     "prettier-plugin-java": "2.6.4",
+    "prettier-plugin-organize-imports": "4.1.0",
     "prettier-plugin-packagejson": "2.5.2",
     "recursive-copy-cli": "1.0.20",
     "start-server-and-test": "2.0.8",
diff --git a/src/main/resources/generator/prettier/.prettierrc.mustache b/src/main/resources/generator/prettier/.prettierrc.mustache
index 71ed128e0..33f34cf35 100644
--- a/src/main/resources/generator/prettier/.prettierrc.mustache
+++ b/src/main/resources/generator/prettier/.prettierrc.mustache
@@ -10,6 +10,7 @@ plugins:
   - '@prettier/plugin-xml'
   - prettier-plugin-gherkin
   - prettier-plugin-java
+  - prettier-plugin-organize-imports
   - prettier-plugin-packagejson
 
 # js and ts rules:


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/prettier/domain/PrettierModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/prettier/domain/PrettierModuleFactoryTest.java
index 5c9496a5e..9d2bbb6aa 100644
--- a/src/test/java/tech/jhipster/lite/generator/prettier/domain/PrettierModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/prettier/domain/PrettierModuleFactoryTest.java
@@ -44,6 +44,7 @@ class PrettierModuleFactoryTest {
       .containing("@prettier/plugin-xml")
       .containing("prettier-plugin-gherkin")
       .containing("prettier-plugin-java")
+      .containing("prettier-plugin-organize-imports")
       .containing("prettier-plugin-packagejson")
       .and()
       .hasFile("package.json")
@@ -51,6 +52,7 @@ class PrettierModuleFactoryTest {
       .containing(nodeDependency("prettier"))
       .containing(nodeDependency("prettier-plugin-gherkin"))
       .containing(nodeDependency("prettier-plugin-java"))
+      .containing(nodeDependency("prettier-plugin-organize-imports"))
       .containing(nodeDependency("prettier-plugin-packagejson"))
       .containing(nodeScript("prettier:check", "prettier --check ."))
       .containing(nodeScript("prettier:format", "prettier --write ."));