From 3889fa23836be0e2eb0a03a9e770e0eeb3092731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Mino?= Date: Fri, 13 Sep 2024 23:08:03 +0200 Subject: [PATCH] fix: using indentation of 2 spaces to align with generator prettier configuration Otherwise resources files are not formatted correctly --- .../prettier/domain/PrettierModuleFactoryTest.java | 12 ++++++------ .../secondary/JHipsterModulesAssertions.java | 2 +- .../projects/init/.lintstagedrc.withoutPrettier.cjs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) 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 e932dbef829..5c9496a5e3f 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 @@ -26,20 +26,20 @@ void shouldBuildModuleWithoutPrettierLintStaged() { JHipsterModule module = factory.buildModule(properties); - assertThatModuleWithFiles(module, packageJsonFile(), withoutPrettierLintStagedConfigFile()) + assertThatModuleWithFiles(module, packageJsonFile(), lintStagedConfigFileWithoutPrettier()) .hasFiles(".prettierignore") .hasFile(".lintstagedrc.cjs") .containing( """ module.exports = { - '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'], - '*.pug': ['eslint --fix', 'prettier --write'], + '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'], + '*.pug': ['eslint --fix', 'prettier --write'], }; """ ) .and() .hasFile(".prettierrc") - .containing("tabWidth: 4") + .containing("tabWidth: 2") .containing("endOfLine: 'crlf'") .containing("@prettier/plugin-xml") .containing("prettier-plugin-gherkin") @@ -68,7 +68,7 @@ void shouldBuildModuleWithEmptyLintStaged() { .containing( """ module.exports = { - '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'], + '*.{md,json,yml,html,css,scss,java,xml,feature}': ['prettier --write'], }; """ ); @@ -78,7 +78,7 @@ private JHipsterModuleProperties properties(String folder) { return JHipsterModulesFixture.propertiesBuilder(folder) .projectBaseName("testProject") .put("projectName", "Test Project") - .put("indentSize", 4) + .put("indentSize", 2) .put("endOfLine", "crlf") .build(); } diff --git a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/JHipsterModulesAssertions.java b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/JHipsterModulesAssertions.java index a2ef1ce84a2..1b2dbd1d3b8 100644 --- a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/JHipsterModulesAssertions.java +++ b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/JHipsterModulesAssertions.java @@ -64,7 +64,7 @@ public static ModuleFile emptyLintStagedConfigFile() { return file("src/test/resources/projects/init/.lintstagedrc.empty.cjs", ".lintstagedrc.cjs"); } - public static ModuleFile withoutPrettierLintStagedConfigFile() { + public static ModuleFile lintStagedConfigFileWithoutPrettier() { return file("src/test/resources/projects/init/.lintstagedrc.withoutPrettier.cjs", ".lintstagedrc.cjs"); } diff --git a/src/test/resources/projects/init/.lintstagedrc.withoutPrettier.cjs b/src/test/resources/projects/init/.lintstagedrc.withoutPrettier.cjs index 6759d674119..03227b138ba 100644 --- a/src/test/resources/projects/init/.lintstagedrc.withoutPrettier.cjs +++ b/src/test/resources/projects/init/.lintstagedrc.withoutPrettier.cjs @@ -1,3 +1,3 @@ module.exports = { - '*.pug': ['eslint --fix', 'prettier --write'], + '*.pug': ['eslint --fix', 'prettier --write'], };