Repository: jhipster/jhipster-lite (java)

Issue:
Improve prettier configuration
Following https://github.com/jhipster/jhipster-lite/commit/74f4ab96f908618c9a7a932bbd2b36bf40bdb4ee by @murdos 

The prettier configuration should be consistent with JHLite
See the entry in package.json

![image](https://github.com/jhipster/jhipster-lite/assets/9156882/bed1e6fc-70c3-451f-a89b-0278fc087e6f)


Pull request:
feat: improve prettier configuration
Fixes #9817

Patch:
diff --git a/package.json b/package.json
index 17e8de54f..b2012281a 100644
--- a/package.json
+++ b/package.json
@@ -32,8 +32,8 @@
     "lint:pug": "npm run lint:ci:pug",
     "lint:sass": "npm run lint:ci:sass -- --fix",
     "prepare": "husky",
-    "prettier:check": "prettier . --check",
-    "prettier:format": "prettier . --write",
+    "prettier:check": "prettier --check .",
+    "prettier:format": "prettier --write .",
     "preview": "vite preview",
     "start": "npm run dev",
     "test": "npm run test:watch",
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 bb7742b33..00f74341f 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
@@ -37,8 +37,8 @@ public class PrettierModuleFactory {
         .addDevDependency(packageName("prettier-plugin-java"), COMMON)
         .addDevDependency(packageName("prettier-plugin-packagejson"), COMMON)
         .addScript(scriptKey("prepare"), scriptCommand("husky"))
-        .addScript(scriptKey("prettier:check"), scriptCommand("prettier --check '{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml,feature}'"))
-        .addScript(scriptKey("prettier:format"), scriptCommand("prettier --write '{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml,feature}'"))
+        .addScript(scriptKey("prettier:check"), scriptCommand("prettier --check ."))
+        .addScript(scriptKey("prettier:format"), scriptCommand("prettier --write ."))
         .and()
       .build();
     //@formatter:on
diff --git a/src/main/resources/generator/prettier/.lintstagedrc.cjs b/src/main/resources/generator/prettier/.lintstagedrc.cjs
index 4854f65e0..ce7f9a41c 100644
--- a/src/main/resources/generator/prettier/.lintstagedrc.cjs
+++ b/src/main/resources/generator/prettier/.lintstagedrc.cjs
@@ -1,3 +1,3 @@
 module.exports = {
-  '{src/**/,}*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
+  '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
 };


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
index 341eacf6a..c0a8d6329 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
@@ -65,7 +65,7 @@ class AngularModuleFactoryTest {
         """
         module.exports = {
           '{src/**/,}*.{js,ts,tsx,vue}': ['eslint --fix'],
-          '{src/**/,}*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
+          '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
         };
         """
       )
diff --git a/src/test/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.java
index 8da9471ec..addac185f 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.java
@@ -54,7 +54,7 @@ class ReactCoreModulesFactoryTest {
         """
         module.exports = {
           '{src/**/,}*.{js,ts,tsx,vue}': ['eslint --fix'],
-          '{src/**/,}*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
+          '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
         };
         """
       )
diff --git a/src/test/java/tech/jhipster/lite/generator/client/vue/core/domain/VueModulesFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/vue/core/domain/VueModulesFactoryTest.java
index 61ee593ae..303c17260 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/vue/core/domain/VueModulesFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/vue/core/domain/VueModulesFactoryTest.java
@@ -60,7 +60,7 @@ class VueModulesFactoryTest {
           """
             module.exports = {
               '{src/**/,}*.{js,ts,tsx,vue}': ['eslint --fix'],
-              '{src/**/,}*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
+              '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
             };
             """
         )
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 cddc2ac54..f6c4d166c 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
@@ -49,10 +49,8 @@ class PrettierModuleFactoryTest {
       .containing(nodeDependency("prettier-plugin-java"))
       .containing(nodeDependency("prettier-plugin-packagejson"))
       .containing(nodeScript("prepare", "husky"))
-      .containing(nodeScript("prettier:check", "prettier --check '{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml,feature}'"))
-      .containing(
-        nodeScript("prettier:format", "prettier --write '{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml,feature}'")
-      );
+      .containing(nodeScript("prettier:check", "prettier --check ."))
+      .containing(nodeScript("prettier:format", "prettier --write ."));
   }
 
   private JHipsterModuleProperties properties(String folder) {
diff --git a/src/test/resources/generator/command/package-complete.json b/src/test/resources/generator/command/package-complete.json
index 40ffd69ed..8da2afa57 100644
--- a/src/test/resources/generator/command/package-complete.json
+++ b/src/test/resources/generator/command/package-complete.json
@@ -3,8 +3,8 @@
   "version": "0.0.1",
   "description": "Jhipster lite",
   "scripts": {
-    "prettier:check": "prettier --check \"{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml}\"",
-    "prettier:format": "prettier --write \"{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml}\""
+    "prettier:check": "prettier --check .",
+    "prettier:format": "prettier --write ."
   },
   "dependencies": {
     "prettier": "2.5.1"
diff --git a/src/test/resources/generator/command/package-test.json b/src/test/resources/generator/command/package-test.json
index 83b7ae0ec..24c4b9665 100644
--- a/src/test/resources/generator/command/package-test.json
+++ b/src/test/resources/generator/command/package-test.json
@@ -2,8 +2,8 @@
   "name": "jhlitetest",
   "version": "0.0.1",
   "scripts": {
-    "prettier:check": "prettier --check \"{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml}\"",
-    "prettier:format": "prettier --write \"{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml}\""
+    "prettier:check": "prettier --check .",
+    "prettier:format": "prettier --write ."
   },
   "devDependencies": {
     "prettier-plugin-java": "1.6.1"
diff --git a/src/test/resources/generator/common/.lintstagedrc.cjs b/src/test/resources/generator/common/.lintstagedrc.cjs
index 4854f65e0..ce7f9a41c 100644
--- a/src/test/resources/generator/common/.lintstagedrc.cjs
+++ b/src/test/resources/generator/common/.lintstagedrc.cjs
@@ -1,3 +1,3 @@
 module.exports = {
-  '{src/**/,}*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
+  '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
 };
diff --git a/src/test/resources/projects/files/package.json b/src/test/resources/projects/files/package.json
index 04fdd63b3..f0f641d71 100644
--- a/src/test/resources/projects/files/package.json
+++ b/src/test/resources/projects/files/package.json
@@ -6,8 +6,8 @@
   "license": "UNLICENSED",
   "scripts": {
     "prepare": "husky",
-    "prettier:check": "prettier --check \"{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml}\"",
-    "prettier:format": "prettier --write \"{,src/**/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml}\""
+    "prettier:check": "prettier --check .",
+    "prettier:format": "prettier --write ."
   },
   "devDependencies": {
     "@prettier/plugin-xml": "2.2.0",
diff --git a/src/test/resources/projects/init/.lintstagedrc.cjs b/src/test/resources/projects/init/.lintstagedrc.cjs
index 4854f65e0..ce7f9a41c 100644
--- a/src/test/resources/projects/init/.lintstagedrc.cjs
+++ b/src/test/resources/projects/init/.lintstagedrc.cjs
@@ -1,3 +1,3 @@
 module.exports = {
-  '{src/**/,}*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
+  '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'],
 };