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 86467a94cb2..e0ecae0869b 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 @@ -116,7 +116,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) { private Consumer patchEslintConfig(JHipsterModuleProperties properties) { String reactConfig = """ - \t\tfiles: ['src/main/webapp/**/*.{ts,tsx}', 'src/main/webapp/**/*.spec.ts'], + \t\tfiles: ['src/main/webapp/**/*.{ts,tsx}', 'src/test/webapp/unit/**/*.{ts,tsx}'], \t\textends: [...typescript.configs.recommendedTypeChecked, react], \t\tsettings: { \t\t\treact: { @@ -143,6 +143,9 @@ private Consumer patchEslintConfig(JHipsterModuleProperti regex("[ \\t]+quotes: \\['error', 'single', \\{ avoidEscape: true }],"), """ \t\t\t'react/react-in-jsx-scope': 'off', + \t\t\t'@typescript-eslint/no-explicit-any': 'off', + \t\t\t'@typescript-eslint/no-unsafe-argument': 'off', + \t\t\t'@typescript-eslint/await-thenable': 'off', \t\t\t'@typescript-eslint/no-misused-promises': [ \t\t\t\t'error', \t\t\t\t{ diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactory.java index 59d68cd6879..6243dc7f596 100644 --- a/src/main/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactory.java @@ -65,7 +65,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) { vi.mock('react-i18next', () => ({ useTranslation: () => { return { - t: vi.fn().mockImplementation((_str: string) => 'Internationalization enabled'), + t: vi.fn().mockImplementation(() => 'Internationalization enabled'), }; }, })); diff --git a/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginForm/index.test.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginForm/index.test.tsx.mustache index 513c72e1621..3cac8855967 100644 --- a/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginForm/index.test.tsx.mustache +++ b/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginForm/index.test.tsx.mustache @@ -14,7 +14,7 @@ const login = async () => { const { getByText, getByPlaceholderText, getByTestId } = render(); const loginButton = getByText('Log in'); fireEvent.click(loginButton); - await act(async () => { + await act(() => { fireEvent.change(getByPlaceholderText("Nom d'utilisateur"), { target: { value: 'admin' }, }); @@ -40,7 +40,7 @@ describe('loginForm', () => { fireEvent.click(loginButton); expect(getByText('Connect')).toBeTruthy(); const submitButton = getByTestId('submit-button'); - await act(async () => { + await act(() => { fireEvent.click(submitButton); }); }); diff --git a/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginModal/index.test.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginModal/index.test.tsx.mustache index 0bfd9b2e3fb..e7d2756581c 100644 --- a/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginModal/index.test.tsx.mustache +++ b/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginModal/index.test.tsx.mustache @@ -37,7 +37,7 @@ describe('test login modal', () => { it('should contain password input', async () => { const { getByPlaceholderText, getByTestId } = LoginModalRender(true); const username = getByPlaceholderText('Mot de passe'); - await act(async () => { + await act(() => { const displayPasswordButton = getByTestId('display-password'); fireEvent.click(displayPasswordButton); }); @@ -54,7 +54,7 @@ describe('test login modal', () => { const { getByPlaceholderText, getByTestId } = LoginModalRender(true); const spy = vi.spyOn(axios, 'post'); spy.mockImplementationOnce((): Promise => Promise.resolve({ data: {} })); - await act(async () => { + await act(() => { fireEvent.change(getByPlaceholderText("Nom d'utilisateur"), { target: { value: 'admin' }, }); @@ -71,7 +71,7 @@ describe('test login modal', () => { const { getByPlaceholderText, getByRole } = LoginModalRender(true); const spy = vi.spyOn(axios, 'post'); spy.mockImplementationOnce((): Promise => Promise.resolve({ data: {} })); - await act(async () => { + await act(() => { fireEvent.change(getByPlaceholderText("Nom d'utilisateur"), { target: { value: 'admin' }, }); @@ -86,7 +86,7 @@ describe('test login modal', () => { it('should contain error message when submit button is clicked with empty value', async () => { const { getByTestId } = LoginModalRender(true); - await act(async () => { + await act(() => { const submitButton = getByTestId('submit-button'); fireEvent.click(submitButton); }); diff --git a/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt b/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt index e8134c13e44..51b0b8c3a73 100644 --- a/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt +++ b/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt @@ -16,7 +16,7 @@ export default typescript.config( }, js.configs.recommended, { - files: ['src/main/webapp/**/*.{ts,tsx}', 'src/main/webapp/**/*.spec.ts'], + files: ['src/main/webapp/**/*.{ts,tsx}', 'src/test/webapp/unit/**/*.{ts,tsx}'], extends: [...typescript.configs.recommendedTypeChecked, react], settings: { react: { @@ -31,6 +31,9 @@ export default typescript.config( }, rules: { 'react/react-in-jsx-scope': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/await-thenable': 'off', '@typescript-eslint/no-misused-promises': [ 'error', {