From bbb14eaeb619754726901404f513099c7a03325a Mon Sep 17 00:00:00 2001 From: Gustavo Fuhr Date: Wed, 30 Nov 2022 04:02:55 -0300 Subject: [PATCH] fixes eslint --- packages/webapp/.eslintrc.json | 1 + .../webapp/src/classes/client/mock-client/index.ts | 8 ++++---- .../webapp/src/classes/client/rest-client/index.ts | 2 +- .../src/components/common/google-button/index.tsx | 12 ++++++++++-- .../src/components/common/google-icon/index.tsx | 1 + .../src/components/common/separator/index.tsx | 13 ++++++++++++- .../src/components/registration-callback/index.tsx | 1 - 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/packages/webapp/.eslintrc.json b/packages/webapp/.eslintrc.json index 257c1652..d0246ba5 100644 --- a/packages/webapp/.eslintrc.json +++ b/packages/webapp/.eslintrc.json @@ -30,6 +30,7 @@ "@typescript-eslint/no-explicit-any": "error", "@typescript-eslint/explicit-module-boundary-types": "error", "@typescript-eslint/no-unused-vars": "error", + "react/no-unknown-property": ["error", { "ignore": ["css"] }], "react-hooks/rules-of-hooks": "warn", // Checks rules of Hooks "react-hooks/exhaustive-deps": "warn", // Checks effect dependencies "no-restricted-imports": [ diff --git a/packages/webapp/src/classes/client/mock-client/index.ts b/packages/webapp/src/classes/client/mock-client/index.ts index 337d990c..0ea5246f 100644 --- a/packages/webapp/src/classes/client/mock-client/index.ts +++ b/packages/webapp/src/classes/client/mock-client/index.ts @@ -408,16 +408,15 @@ class MockClient implements Client { return Promise.resolve(); } - wait(ms: number) { - console.log('Start waiting'); - return new Promise((resolve, reject) => { + wait(ms: number): Promise { + return new Promise((resolve) => { setTimeout(() => { - console.log('Done waiting'); resolve(ms); }, ms); }); } + // eslint-disable-next-line @typescript-eslint/no-unused-vars processGoogleCallback(code: string): Promise { // artificial delay for more realistic mock experience const handler = (success: (result: Oauth2CallbackResult) => void) => { @@ -436,6 +435,7 @@ class MockClient implements Client { return new Promise(handler); } + // eslint-disable-next-line @typescript-eslint/no-unused-vars confirmAccountSync(email: string, code: string): Promise { return Promise.resolve(); } diff --git a/packages/webapp/src/classes/client/rest-client/index.ts b/packages/webapp/src/classes/client/rest-client/index.ts index 9f46cea7..71fdd650 100644 --- a/packages/webapp/src/classes/client/rest-client/index.ts +++ b/packages/webapp/src/classes/client/rest-client/index.ts @@ -659,7 +659,7 @@ export default class RestClient implements Client { .put(`${this.baseUrl}/service/users/confirmAccountSync?email=${email}&code=${code}`, { headers: { 'Content-Type': 'application/json' }, }) - .then((response) => { + .then(() => { success(); }) .catch((error) => { diff --git a/packages/webapp/src/components/common/google-button/index.tsx b/packages/webapp/src/components/common/google-button/index.tsx index a97cdaae..25a2cd0d 100644 --- a/packages/webapp/src/components/common/google-button/index.tsx +++ b/packages/webapp/src/components/common/google-button/index.tsx @@ -1,10 +1,10 @@ +import React from 'react'; import { css } from '@emotion/react'; import { Button } from '@mui/material'; import GoogleIcon from '../google-icon'; const googleButtonStyle = css({ color: '#000000', - //fontSize: "15px", fontWeight: '300', border: '1px solid black', '&:hover': { @@ -12,7 +12,15 @@ const googleButtonStyle = css({ }, }); -const GoogleButton = ({ text, onClick }) => { +type GoogleButtonProps = { + text: string; + onClick: React.MouseEventHandler; +}; + +const GoogleButton: React.FunctionComponent = ({ + text, + onClick, +}: GoogleButtonProps) => { return (