From 74f4ab96f908618c9a7a932bbd2b36bf40bdb4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Mino?= Date: Sat, 20 Apr 2024 10:15:56 +0200 Subject: [PATCH] chore(prettier): simplify prettier configuration: run prettier by default on all files excepted those explicitly ignored --- .jhipster/modules/history.json | 52 +++---- .prettierignore | 1 + package.json | 5 +- src/main/glyph/font/jhlite-icons.svg | 128 ++++++++++++++---- .../app/auth/oauth2-auth.service.spec.ts | 8 +- .../webapp/app/auth/oauth2-auth.service.ts | 2 +- .../common/primary/app/Home.spec.ts | 1 - .../javascript/integration/cypress-config.ts | 1 - .../common/playwright/playwright.config.ts | 18 +-- .../generator/client/react/.eslintrc.cjs | 18 +-- .../generator/client/react/postcss.config.js | 2 +- .../generator/client/react/tailwind.config.js | 14 +- .../common/domain/optional/Optional.spec.ts | 12 +- src/main/style/atom/chip/_chip.scss | 6 +- .../landscape-minimap/_landscape-minimap.scss | 2 +- .../style/organism/landscape/_landscape.scss | 3 +- .../_menu-content-template.scss | 6 +- src/main/style/token/_colors.scss | 18 +-- .../cypress/integration/Landscape.spec.ts | 6 +- .../cypress/integration/Patch.spec.ts | 6 +- src/test/resources/projects/react-app/App.tsx | 5 +- .../resources/projects/react-app/index.tsx | 2 +- 22 files changed, 193 insertions(+), 123 deletions(-) diff --git a/.jhipster/modules/history.json b/.jhipster/modules/history.json index 4ac7838d2f5..c0774df230a 100644 --- a/.jhipster/modules/history.json +++ b/.jhipster/modules/history.json @@ -1,27 +1,31 @@ { - "actions" : [ { - "module" : "application-service-hexagonal-architecture-documentation", - "date" : "2022-07-29T05:45:39.864617462Z", - "properties" : { } - }, { - "module" : "maven-java", - "date" : "2024-01-29T22:31:20.121046866Z", - "properties" : { - "packageName" : "com.mycompany.myapp", - "projectName" : "JHipster Sample Application", - "baseName" : "jhipsterSampleApplication", - "endOfLine" : "lf", - "indentSize" : 2 + "actions": [ + { + "module": "application-service-hexagonal-architecture-documentation", + "date": "2022-07-29T05:45:39.864617462Z", + "properties": {} + }, + { + "module": "maven-java", + "date": "2024-01-29T22:31:20.121046866Z", + "properties": { + "packageName": "com.mycompany.myapp", + "projectName": "JHipster Sample Application", + "baseName": "jhipsterSampleApplication", + "endOfLine": "lf", + "indentSize": 2 + } + }, + { + "module": "jacoco-check-min-coverage", + "date": "2024-01-29T22:31:20.126024517Z", + "properties": { + "packageName": "com.mycompany.myapp", + "projectName": "JHipster Sample Application", + "baseName": "jhipsterSampleApplication", + "endOfLine": "lf", + "indentSize": 2 + } } - }, { - "module" : "jacoco-check-min-coverage", - "date" : "2024-01-29T22:31:20.126024517Z", - "properties" : { - "packageName" : "com.mycompany.myapp", - "projectName" : "JHipster Sample Application", - "baseName" : "jhipsterSampleApplication", - "endOfLine" : "lf", - "indentSize" : 2 - } - } ] + ] } diff --git a/.prettierignore b/.prettierignore index 65e71e8ca7b..ecb717c2640 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,3 +4,4 @@ build package-lock.json .git .mvn +template-infinitest.filters diff --git a/package.json b/package.json index 163dc5c9842..f8282d275d4 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,8 @@ "lint:pug": "npm run lint:ci:pug", "lint:sass": "npm run lint:ci:sass -- --fix", "prepare": "husky", - "prettier:check": "npm run prettier:run -- --check", - "prettier:format": "npm run prettier:run -- --write", - "prettier:run": "prettier '{{src/**/,}*.{md,json,yml,html,vue,java,xml,feature},*.{js,ts},.github/**/*.yml,documentation/**/*.md,src/{main/glyph,main/webapp,test/javascript}/**/*.{css,scss}}'", + "prettier:check": "prettier . --check", + "prettier:format": "prettier . --write", "preview": "vite preview", "start": "npm run dev", "test": "npm run vitest -- run --coverage --", diff --git a/src/main/glyph/font/jhlite-icons.svg b/src/main/glyph/font/jhlite-icons.svg index 62a2dc0eaba..5543da6d14b 100644 --- a/src/main/glyph/font/jhlite-icons.svg +++ b/src/main/glyph/font/jhlite-icons.svg @@ -1,42 +1,122 @@ - + -Copyright (C) 2023 by original authors @ fontello.com - - - - - + Copyright (C) 2023 by original authors @ fontello.com + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + diff --git a/src/main/resources/generator/client/angular/security/oauth2/src/main/webapp/app/auth/oauth2-auth.service.spec.ts b/src/main/resources/generator/client/angular/security/oauth2/src/main/webapp/app/auth/oauth2-auth.service.spec.ts index 98cf78c0d80..b9c46e41109 100644 --- a/src/main/resources/generator/client/angular/security/oauth2/src/main/webapp/app/auth/oauth2-auth.service.spec.ts +++ b/src/main/resources/generator/client/angular/security/oauth2/src/main/webapp/app/auth/oauth2-auth.service.spec.ts @@ -71,9 +71,7 @@ describe('Oauth2 Auth Service', () => { it('should init refresh token and return true when the user is authenticated', async () => { // Given - jest - .spyOn(keycloakInstance, 'init') - .mockReturnValue(Promise.resolve(true).then() as unknown as Promise); + jest.spyOn(keycloakInstance, 'init').mockReturnValue(Promise.resolve(true).then() as unknown as Promise); // When const authenticated = await lastValueFrom(service.initAuthentication()); @@ -93,9 +91,7 @@ describe('Oauth2 Auth Service', () => { it('should reload window and return false when the user is not authenticated', async () => { // Given - jest - .spyOn(keycloakInstance, 'init') - .mockReturnValue(Promise.resolve(false).then() as unknown as Promise); + jest.spyOn(keycloakInstance, 'init').mockReturnValue(Promise.resolve(false).then() as unknown as Promise); // When const authenticated = await lastValueFrom(service.initAuthentication()); diff --git a/src/main/resources/generator/client/angular/security/oauth2/src/main/webapp/app/auth/oauth2-auth.service.ts b/src/main/resources/generator/client/angular/security/oauth2/src/main/webapp/app/auth/oauth2-auth.service.ts index 4e3134e3992..1d3994a97f5 100644 --- a/src/main/resources/generator/client/angular/security/oauth2/src/main/webapp/app/auth/oauth2-auth.service.ts +++ b/src/main/resources/generator/client/angular/security/oauth2/src/main/webapp/app/auth/oauth2-auth.service.ts @@ -35,7 +35,7 @@ export class Oauth2AuthService { }), tap(() => { this.initUpdateTokenRefresh(); - }) + }), ); } diff --git a/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/common/primary/app/Home.spec.ts b/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/common/primary/app/Home.spec.ts index 283cb535e43..396af3e2567 100644 --- a/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/common/primary/app/Home.spec.ts +++ b/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/common/primary/app/Home.spec.ts @@ -4,4 +4,3 @@ describe('Home', () => { cy.title().should('include', 'JHipster'); }); }); - diff --git a/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/cypress-config.ts b/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/cypress-config.ts index 4458433eed7..14a32b687ce 100644 --- a/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/cypress-config.ts +++ b/src/main/resources/generator/client/common/cypress/src/test/javascript/integration/cypress-config.ts @@ -9,4 +9,3 @@ export default defineConfig({ video: false, }, }); - diff --git a/src/main/resources/generator/client/common/playwright/playwright.config.ts b/src/main/resources/generator/client/common/playwright/playwright.config.ts index 9a15ee5ddc0..4a35d3b7a83 100644 --- a/src/main/resources/generator/client/common/playwright/playwright.config.ts +++ b/src/main/resources/generator/client/common/playwright/playwright.config.ts @@ -19,7 +19,7 @@ const config: PlaywrightTestConfig = { * Maximum time expect() should wait for the condition to be met. * For example in `await expect(locator).toHaveText();` */ - timeout: 5000 + timeout: 5000, }, /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, @@ -65,16 +65,16 @@ const config: PlaywrightTestConfig = { /* Test against mobile viewports. */ { - name: 'Mobile Chrome', - use: { - ...devices['Pixel 5'], - }, + name: 'Mobile Chrome', + use: { + ...devices['Pixel 5'], + }, }, { - name: 'Mobile Safari', - use: { - ...devices['iPhone 12'], - }, + name: 'Mobile Safari', + use: { + ...devices['iPhone 12'], + }, }, /* Test against branded browsers. */ diff --git a/src/main/resources/generator/client/react/.eslintrc.cjs b/src/main/resources/generator/client/react/.eslintrc.cjs index 65f2382c4da..388ddaacdd0 100644 --- a/src/main/resources/generator/client/react/.eslintrc.cjs +++ b/src/main/resources/generator/client/react/.eslintrc.cjs @@ -2,23 +2,23 @@ module.exports = { env: { node: true, }, - extends: ["eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended"], + extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:@typescript-eslint/recommended'], parserOptions: { ecmaFeatures: { jsx: true, }, ecmaVersion: 2018, - sourceType: "module", + sourceType: 'module', }, - plugins: ["react"], - ignorePatterns: ["node_modules/"], + plugins: ['react'], + ignorePatterns: ['node_modules/'], rules: { - "react/react-in-jsx-scope": "off", - "react/jsx-no-target-blank": "off", + 'react/react-in-jsx-scope': 'off', + 'react/jsx-no-target-blank': 'off', }, settings: { react: { - version: "detect" - } - } + version: 'detect', + }, + }, }; diff --git a/src/main/resources/generator/client/react/postcss.config.js b/src/main/resources/generator/client/react/postcss.config.js index 2e7af2b7f1a..2aa7205d4b4 100644 --- a/src/main/resources/generator/client/react/postcss.config.js +++ b/src/main/resources/generator/client/react/postcss.config.js @@ -3,4 +3,4 @@ export default { tailwindcss: {}, autoprefixer: {}, }, -} +}; diff --git a/src/main/resources/generator/client/react/tailwind.config.js b/src/main/resources/generator/client/react/tailwind.config.js index c53cd060c63..9f3fd1a0778 100644 --- a/src/main/resources/generator/client/react/tailwind.config.js +++ b/src/main/resources/generator/client/react/tailwind.config.js @@ -1,16 +1,14 @@ -const { nextui } = require("@nextui-org/react"); +const { nextui } = require('@nextui-org/react'); module.exports = { content: [ - "./src/main/webapp/index.html", - "./src/main/webapp/**/*.{js,ts,jsx,tsx}", + './src/main/webapp/index.html', + './src/main/webapp/**/*.{js,ts,jsx,tsx}', './node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}', ], theme: { extend: {}, }, - darkMode: "class", - plugins: [ - nextui(), - ], -} + darkMode: 'class', + plugins: [nextui()], +}; diff --git a/src/main/resources/generator/typescript/test/javascript/spec/common/domain/optional/Optional.spec.ts b/src/main/resources/generator/typescript/test/javascript/spec/common/domain/optional/Optional.spec.ts index 3a62104c1d8..61417a80633 100644 --- a/src/main/resources/generator/typescript/test/javascript/spec/common/domain/optional/Optional.spec.ts +++ b/src/main/resources/generator/typescript/test/javascript/spec/common/domain/optional/Optional.spec.ts @@ -26,7 +26,7 @@ describe('Optional', () => { expect( Optional.empty() .map(dummy => dummy) - .isEmpty() + .isEmpty(), ).toBe(true); }); @@ -34,7 +34,7 @@ describe('Optional', () => { expect( Optional.of('value') .map(value => 'beer ' + value) - .orElse('dummy') + .orElse('dummy'), ).toBe('beer value'); }); }); @@ -44,7 +44,7 @@ describe('Optional', () => { expect( Optional.empty() .filter(() => true) - .isEmpty() + .isEmpty(), ).toBe(true); }); @@ -52,7 +52,7 @@ describe('Optional', () => { expect( Optional.of('value') .filter(value => value.indexOf('v') !== -1) - .orElse('dummy') + .orElse('dummy'), ).toBe('value'); }); @@ -60,7 +60,7 @@ describe('Optional', () => { expect( Optional.of('value') .filter(() => false) - .orElse('other') + .orElse('other'), ).toBe('other'); }); }); @@ -128,7 +128,7 @@ describe('Optional', () => { expect( Optional.of('beer') .flatMap(value => Optional.of('my ' + value)) - .orElse('dummy') + .orElse('dummy'), ).toBe('my beer'); }); }); diff --git a/src/main/style/atom/chip/_chip.scss b/src/main/style/atom/chip/_chip.scss index ec97957ee19..d48c1687391 100644 --- a/src/main/style/atom/chip/_chip.scss +++ b/src/main/style/atom/chip/_chip.scss @@ -71,13 +71,13 @@ $jhlite-anchor-point-border-size: 3px; &.-extended { margin-bottom: 15px; } - + &.-left-anchor-point::before { @extend %anchor-point; left: -$jhlite-anchor-point-size; } - + &.-right-anchor-point::after { @extend %anchor-point; @@ -89,7 +89,7 @@ $jhlite-anchor-point-border-size: 3px; cursor: pointer; animation: $jhlite-valid-highlight-animation; } - + &.-not-selectable-highlighted::before, &.-not-selectable-highlighted::after { background-color: $jhlite-global-color-fill-disabled-light; diff --git a/src/main/style/organism/landscape-minimap/_landscape-minimap.scss b/src/main/style/organism/landscape-minimap/_landscape-minimap.scss index 16d5ff10378..08691618bc3 100644 --- a/src/main/style/organism/landscape-minimap/_landscape-minimap.scss +++ b/src/main/style/organism/landscape-minimap/_landscape-minimap.scss @@ -38,4 +38,4 @@ $jhlite-minimap-size-background-color: #0000009a; width: 100%; height: 100%; } -} \ No newline at end of file +} diff --git a/src/main/style/organism/landscape/_landscape.scss b/src/main/style/organism/landscape/_landscape.scss index 1005c22279a..107dc2c9d16 100644 --- a/src/main/style/organism/landscape/_landscape.scss +++ b/src/main/style/organism/landscape/_landscape.scss @@ -8,7 +8,8 @@ $jhlite-landscape-not-selectable-highlight-animation: $jhlite-global-not-selecta $jhlite-landscape-valid-highlight-end-color: $jhlite-global-valid-highlight-end-color; $jhlite-landscape-primary-alternative-color: $jhlite-global-primary-alternative-color; -.jhipster-landscape, .jhlite-landscape-minimap { +.jhipster-landscape, +.jhlite-landscape-minimap { .jhipster-landscape-map { position: relative; padding: $jhlite-landscape-padding; diff --git a/src/main/style/template/menu-content-template/_menu-content-template.scss b/src/main/style/template/menu-content-template/_menu-content-template.scss index 0f8f8a9071a..bbe5c102890 100644 --- a/src/main/style/template/menu-content-template/_menu-content-template.scss +++ b/src/main/style/template/menu-content-template/_menu-content-template.scss @@ -12,7 +12,8 @@ $jhlite-menu-content-template-color-divider: $jhlite-global-color-fill-secondary height: inherit; } - &--content, &--menu { + &--content, + &--menu { box-sizing: border-box; flex-basis: 0; flex-grow: 1; @@ -37,7 +38,8 @@ $jhlite-menu-content-template-color-divider: $jhlite-global-color-fill-secondary width: $jhlite-menu-content-template-menu-medium-width; } - &--content, &--menu { + &--content, + &--menu { border-right: 1px solid $jhlite-menu-content-template-color-divider; border-bottom: 0; diff --git a/src/main/style/token/_colors.scss b/src/main/style/token/_colors.scss index 59ad8ccb49e..60a1637f14a 100644 --- a/src/main/style/token/_colors.scss +++ b/src/main/style/token/_colors.scss @@ -65,21 +65,9 @@ $jhlite-global-invalid-highlight-end-color: #900f0f; } /** Other */ -$jhlite-global-color-fill-disabled-dark: color.change( - $jhlite-global-color-primary, - $saturation: 25%, - $lightness: 40% -) !default; -$jhlite-global-color-fill-disabled-light: color.change( - $jhlite-global-color-primary, - $saturation: 20%, - $lightness: 75% -) !default; -$jhlite-global-color-text-disabled: color.change( - $jhlite-global-color-primary, - $saturation: 25%, - $lightness: 60% -) !default; +$jhlite-global-color-fill-disabled-dark: color.change($jhlite-global-color-primary, $saturation: 25%, $lightness: 40%) !default; +$jhlite-global-color-fill-disabled-light: color.change($jhlite-global-color-primary, $saturation: 20%, $lightness: 75%) !default; +$jhlite-global-color-text-disabled: color.change($jhlite-global-color-primary, $saturation: 25%, $lightness: 60%) !default; $jhlite-global-color-fill-secondary: $jhlite-color-neutral-900 !default; // @deprecated $jhlite-global-color-link-light: $jhlite-global-color-text-light !default; // @deprecated $jhlite-global-color-link-light-hover: $jhlite-color-brand-200 !default; // @deprecated diff --git a/src/test/javascript/cypress/integration/Landscape.spec.ts b/src/test/javascript/cypress/integration/Landscape.spec.ts index 986ea868626..de4b047acfd 100644 --- a/src/test/javascript/cypress/integration/Landscape.spec.ts +++ b/src/test/javascript/cypress/integration/Landscape.spec.ts @@ -8,7 +8,7 @@ describe('Landscape', () => { cy.visit('/landscape', { // see https://www.cypress.io/blog/2019/12/13/test-your-web-app-in-dark-mode/ onBeforeLoad(win) { - cy.stub(win, 'matchMedia').withArgs('(prefers-color-scheme: dark)').returns({ matches: true }) + cy.stub(win, 'matchMedia').withArgs('(prefers-color-scheme: dark)').returns({ matches: true }); }, }); @@ -17,11 +17,11 @@ describe('Landscape', () => { cy.get(themeSwitchButton).should('exist').should('not.be.visible').should('not.be.checked'); cy.get('[aria-label="dark-theme"]').should('exist'); - cy.get(themeSwitchButton).click({ force: true }) + cy.get(themeSwitchButton).click({ force: true }); cy.get(themeSwitchButton).should('be.checked'); cy.get('[aria-label="light-theme"]').should('exist'); - cy.get(themeSwitchButton).click({ force: true }) + cy.get(themeSwitchButton).click({ force: true }); cy.get(themeSwitchButton).should('not.be.checked'); cy.get('[aria-label="dark-theme"]').should('exist'); }); diff --git a/src/test/javascript/cypress/integration/Patch.spec.ts b/src/test/javascript/cypress/integration/Patch.spec.ts index 307122f60ee..b2e6aaf81da 100644 --- a/src/test/javascript/cypress/integration/Patch.spec.ts +++ b/src/test/javascript/cypress/integration/Patch.spec.ts @@ -34,7 +34,7 @@ describe('Patch', () => { it('should change theme after toggle switch theme button', () => { cy.visit('/patches', { onBeforeLoad(win) { - cy.stub(win, 'matchMedia').withArgs('(prefers-color-scheme: dark)').returns({ matches: true }) + cy.stub(win, 'matchMedia').withArgs('(prefers-color-scheme: dark)').returns({ matches: true }); }, }); @@ -43,11 +43,11 @@ describe('Patch', () => { cy.get(themeSwitchButton).should('exist').should('not.be.visible').should('not.be.checked'); cy.get('[aria-label="dark-theme"]').should('exist'); - cy.get(themeSwitchButton).click({ force: true }) + cy.get(themeSwitchButton).click({ force: true }); cy.get(themeSwitchButton).should('be.checked'); cy.get('[aria-label="light-theme"]').should('exist'); - cy.get(themeSwitchButton).click({ force: true }) + cy.get(themeSwitchButton).click({ force: true }); cy.get(themeSwitchButton).should('not.be.checked'); cy.get('[aria-label="dark-theme"]').should('exist'); }); diff --git a/src/test/resources/projects/react-app/App.tsx b/src/test/resources/projects/react-app/App.tsx index 6967b3afb16..54e54a37351 100644 --- a/src/test/resources/projects/react-app/App.tsx +++ b/src/test/resources/projects/react-app/App.tsx @@ -12,7 +12,10 @@ function App() { JHipster logo

React + TypeScript + Vite

- Recommended IDE setup: VSCode + Recommended IDE setup:  + + VSCode +

diff --git a/src/test/resources/projects/react-app/index.tsx b/src/test/resources/projects/react-app/index.tsx index 44a79759b02..af46811591d 100644 --- a/src/test/resources/projects/react-app/index.tsx +++ b/src/test/resources/projects/react-app/index.tsx @@ -8,5 +8,5 @@ const root = createRoot(container!); root.render( - + , );