Repository: jhipster/jhipster-lite
Pull request #10025 (2024-06-09 17:57:00)

chore(eslint): apply eslint on whole sources
See [.eslintrc.js](https://github.com/jhipster/jhipster-lite/pull/10015/files#r1632309848)


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
index 0d10aea08..5dfd05cdb 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
@@ -56,7 +56,7 @@ public class ReactCoreModulesFactory {
         .addScript(scriptKey("build"), scriptCommand("tsc && vite build --emptyOutDir"))
         .addScript(scriptKey("preview"), scriptCommand("vite preview"))
         .addScript(scriptKey("start"), scriptCommand("vite"))
-        .addScript(scriptKey("lint"), scriptCommand("eslint --ext .js,.ts,.tsx src/main/webapp/app/**/*"))
+        .addScript(scriptKey("lint"), scriptCommand("eslint --ext .js,.ts,.tsx src/"))
         .addScript(scriptKey("test"), scriptCommand("npm run test:watch"))
         .addScript(scriptKey("test:coverage"), scriptCommand("vitest run --coverage"))
         .addScript(scriptKey("test:watch"), scriptCommand("vitest --"))
diff --git a/src/main/java/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressModuleFactory.java
index 48f335ab1..ac9154778 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressModuleFactory.java
@@ -57,7 +57,7 @@ public class CypressModuleFactory {
       .files()
         .batch(SOURCE.append(CYPRESS_TEST), CYPRESS_DESTINATION)
           .addFile("cypress-config.ts")
-          .addFile(".eslintrc.js")
+          .addFile(".eslintrc.cjs")
           .addFile("tsconfig.json")
           .and()
         .add(
diff --git a/src/main/java/tech/jhipster/lite/generator/client/vue/core/domain/VueModulesFactory.java b/src/main/java/tech/jhipster/lite/generator/client/vue/core/domain/VueModulesFactory.java
index 1f3bbe183..7abcd72c9 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/vue/core/domain/VueModulesFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/vue/core/domain/VueModulesFactory.java
@@ -67,7 +67,7 @@ public class VueModulesFactory {
         .addDevDependency(packageName("sinon"), VUE)
         .addScript(scriptKey("build"), scriptCommand("vue-tsc -p tsconfig.build.json --noEmit && vite build --emptyOutDir"))
         .addScript(scriptKey("dev"), scriptCommand("vite"))
-        .addScript(scriptKey("lint"), scriptCommand("eslint --ext .js,.ts,.vue src/main/webapp/app/**/*"))
+        .addScript(scriptKey("lint"), scriptCommand("eslint --ext .js,.ts,.vue src/"))
         .addScript(scriptKey("preview"), scriptCommand("vite preview"))
         .addScript(scriptKey("start"), scriptCommand("vite"))
         .addScript(scriptKey("test"), scriptCommand("npm run test:watch"))


Test patch:
diff --git a/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/.eslintrc.js b/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/.eslintrc.cjs
similarity index 100%
rename from src/main/resources/generator/client/common/cypress/src/test/javascript/integration/.eslintrc.js
rename to src/main/resources/generator/client/common/cypress/src/test/javascript/integration/.eslintrc.cjs
diff --git a/src/test/features/client/browser-test/cypress.feature b/src/test/features/client/browser-test/cypress.feature
index da4cd759a..9587d2eeb 100644
--- a/src/test/features/client/browser-test/cypress.feature
+++ b/src/test/features/client/browser-test/cypress.feature
@@ -4,4 +4,4 @@ Feature: Cypress module
     When I apply "cypress" module to default project with package json
       | serverPort | 9000 |
     Then I should have files in "src/test/javascript/integration"
-      | .eslintrc.js |
+      | .eslintrc.cjs |
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 1c44baf5b..3cbe5dc77 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
@@ -44,7 +44,7 @@ class ReactCoreModulesFactoryTest {
       .containing(nodeScript("build", "tsc && vite build --emptyOutDir"))
       .containing(nodeScript("preview", "vite preview"))
       .containing(nodeScript("start", "vite"))
-      .containing(nodeScript("lint", "eslint --ext .js,.ts,.tsx src/main/webapp/app/**/*"))
+      .containing(nodeScript("lint", "eslint --ext .js,.ts,.tsx src/"))
       .containing(nodeScript("test", "npm run test:watch"))
       .containing(nodeScript("test:coverage", "vitest run --coverage"))
       .containing(nodeScript("test:watch", "vitest --"))
diff --git a/src/test/java/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressModuleFactoryTest.java
index dc180d895..542fd9d6b 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressModuleFactoryTest.java
@@ -82,7 +82,7 @@ class CypressModuleFactoryTest {
       .hasFile("src/test/javascript/integration/cypress-config.ts")
       .containing("baseUrl: 'http://localhost:9000',")
       .and()
-      .hasPrefixedFiles("src/test/javascript/integration", ".eslintrc.js", "tsconfig.json")
+      .hasPrefixedFiles("src/test/javascript/integration", ".eslintrc.cjs", "tsconfig.json")
       .hasFiles("src/test/javascript/integration/common/primary/app/Home.spec.ts");
   }
 }
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 4c6929231..966f8de39 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
@@ -48,7 +48,7 @@ class VueModulesFactoryTest {
         .containing(nodeDependency("vue-router"))
         .containing(nodeScript("build", "vue-tsc -p tsconfig.build.json --noEmit && vite build --emptyOutDir"))
         .containing(nodeScript("dev", "vite"))
-        .containing(nodeScript("lint", "eslint --ext .js,.ts,.vue src/main/webapp/app/**/*"))
+        .containing(nodeScript("lint", "eslint --ext .js,.ts,.vue src/"))
         .containing(nodeScript("preview", "vite preview"))
         .containing(nodeScript("start", "vite"))
         .containing(nodeScript("test", "npm run test:watch"))