From 4722cf1241d0eb1e5408b45d18730aa409910ec9 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 4 Sep 2024 20:28:28 +0200 Subject: [PATCH] React/ESLint: enable some rules --- .../client/react/core/eslint.config.js.mustache | 10 ++++++---- .../app/login/primary/loginModal/index.tsx.mustache | 4 ++-- .../main/webapp/app/login/services/login.ts.mustache | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/resources/generator/client/react/core/eslint.config.js.mustache b/src/main/resources/generator/client/react/core/eslint.config.js.mustache index 2a5a13d05ec..5e0322fd429 100644 --- a/src/main/resources/generator/client/react/core/eslint.config.js.mustache +++ b/src/main/resources/generator/client/react/core/eslint.config.js.mustache @@ -33,10 +33,12 @@ export default typescript.config( }, rules: { 'react/react-in-jsx-scope': 'off', - '@typescript-eslint/no-unsafe-argument': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-floating-promises': 'off', - '@typescript-eslint/no-misused-promises': 'off', + '@typescript-eslint/no-misused-promises': [ + 'error', + { + 'checksVoidReturn': false + } + ], }, }, ); diff --git a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/index.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/index.tsx.mustache index 8a03feca740..02234e19a20 100644 --- a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/index.tsx.mustache +++ b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/index.tsx.mustache @@ -20,9 +20,9 @@ const LoginModal = ({ open, onClose }: LoginModalType) => { const toggleVisibility = () => setIsVisible(!isVisible); - const onSubmit = (loginData: LoginFunctionType) => { + const onSubmit = async (loginData: LoginFunctionType) => { if (loginData.username && loginData.password) { - login({ ...loginData, setUsername, setToken }); + await login({ ...loginData, setUsername, setToken }); setError(false); onClose(); } else { diff --git a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/services/login.ts.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/services/login.ts.mustache index 2e8523fc187..e2b93712f74 100644 --- a/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/services/login.ts.mustache +++ b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/services/login.ts.mustache @@ -11,7 +11,7 @@ export const login = ({ username, password, rememberMe, setUsername, setToken }: password, rememberMe, }) - .then(response => { + .then((response: { data: { id_token: string }}) => { setLocalStorage('token', response.data.id_token); setLocalStorage('username', username); setUsername(username);