From b59248cfc7133a7287c57dedb1e03380906d9eb6 Mon Sep 17 00:00:00 2001 From: Anish Date: Sun, 11 Feb 2024 00:25:42 +0500 Subject: [PATCH] 2195 enhancement modify linting (#2198) * fixing the linting issues * fixing the linting issuesgs * fixing the linting issues * fixing the linting issues * fixing the linting issues * fixing the linting issues * fixing the linting issues * fix the linting issues of project web only * fix the linting issues of project web only * fix the linting issues of project web only --- .husky/pre-commit | 5 +- .prettierrc | 1 - apps/web/.eslintrc.json | 5 +- apps/web/.prettierrc | 1 - .../app/[locale]/integration/github/page.tsx | 4 +- apps/web/app/[locale]/kanban/page.tsx | 2 +- apps/web/app/[locale]/page.tsx | 1 - apps/web/app/api/timer/start/route.ts | 2 +- .../app/hooks/auth/useAuthenticationTeam.ts | 155 +++++++++--------- apps/web/app/interfaces/IScreenshoot.ts | 2 +- apps/web/app/interfaces/ITaskTimesheet.ts | 2 +- .../client/api/public-organization-team.ts | 4 +- apps/web/app/stores/kanban.ts | 12 +- apps/web/app/utils/scroll-to-element.ts | 2 +- .../web/components/pages/main/header-tabs.tsx | 2 +- .../shared/skeleton/KanbanBoardSkeleton.tsx | 70 ++++---- apps/web/components/ui/svgs/add.tsx | 16 +- apps/web/components/ui/svgs/bug.tsx | 31 ++-- .../components/ui/svgs/circular-progress.tsx | 94 +++++------ apps/web/components/ui/svgs/kanban.tsx | 19 ++- apps/web/components/ui/svgs/priority-icon.tsx | 23 ++- apps/web/components/ui/svgs/three-dot.tsx | 29 ++-- .../components/ui/svgs/vertical-three-dot.tsx | 34 ++-- .../web/components/ui/svgs/vertificalline.tsx | 16 +- apps/web/lib/components/breadcrumb.tsx | 11 +- apps/web/lib/components/toggler.tsx | 2 +- .../lib/features/activity/task-activity.tsx | 8 +- .../lib/settings/left-side-setting-menu.tsx | 9 +- apps/web/lib/settings/version-form.tsx | 1 - apps/web/package.json | 11 +- package.json | 7 +- yarn.lock | 35 +++- 32 files changed, 345 insertions(+), 271 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 689d8ff55..ec2e9a469 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,7 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -# npm test +cd "apps/web" + +yarn lint + diff --git a/.prettierrc b/.prettierrc index 1a058e296..035f8a26d 100644 --- a/.prettierrc +++ b/.prettierrc @@ -7,7 +7,6 @@ "arrowParens": "always", "trailingComma": "none", "quoteProps": "as-needed", - "trimTrailingWhitespace": true, "overrides": [ { "files": "*.scss", diff --git a/apps/web/.eslintrc.json b/apps/web/.eslintrc.json index e197b7626..446b951d2 100644 --- a/apps/web/.eslintrc.json +++ b/apps/web/.eslintrc.json @@ -1,8 +1,7 @@ { + "plugins": ["unused-imports"], "extends": "next/core-web-vitals", "rules": { - "react/no-unstable-nested-components": [ - "error" - ] + "unused-imports/no-unused-imports": "error" } } diff --git a/apps/web/.prettierrc b/apps/web/.prettierrc index 1a058e296..035f8a26d 100644 --- a/apps/web/.prettierrc +++ b/apps/web/.prettierrc @@ -7,7 +7,6 @@ "arrowParens": "always", "trailingComma": "none", "quoteProps": "as-needed", - "trimTrailingWhitespace": true, "overrides": [ { "files": "*.scss", diff --git a/apps/web/app/[locale]/integration/github/page.tsx b/apps/web/app/[locale]/integration/github/page.tsx index 328856e60..666fa38db 100644 --- a/apps/web/app/[locale]/integration/github/page.tsx +++ b/apps/web/app/[locale]/integration/github/page.tsx @@ -18,10 +18,10 @@ const GitHub = () => { const installing = useRef(false); - const { installGitHub, getRepositories } = useGitHubIntegration(); + const { installGitHub, getRepositories } = useGitHubIntegration(); const { getIntegrationTenant, loading: integrationTenantLoading, integrationTenant } = useIntegrationTenant(); const { loading: loadingIntegrationTypes, integrationTypes, getIntegrationTypes } = useIntegrationTypes(); - + const handleInstallGitHub = useCallback(() => { installing.current = true; diff --git a/apps/web/app/[locale]/kanban/page.tsx b/apps/web/app/[locale]/kanban/page.tsx index 21b981cfc..159280e85 100644 --- a/apps/web/app/[locale]/kanban/page.tsx +++ b/apps/web/app/[locale]/kanban/page.tsx @@ -78,7 +78,7 @@ const Kanban = () => {
- +
diff --git a/apps/web/app/[locale]/page.tsx b/apps/web/app/[locale]/page.tsx index bf49f7c37..870292674 100644 --- a/apps/web/app/[locale]/page.tsx +++ b/apps/web/app/[locale]/page.tsx @@ -39,7 +39,6 @@ import { headerTabs } from '@app/stores/header-tabs'; function MainPage() { const t = useTranslations(); - const { isTeamMember, isTrackingEnabled, activeTeam } = useOrganizationTeams(); const fullWidth = useRecoilValue(fullWidthState); const view = useRecoilValue(headerTabs); diff --git a/apps/web/app/api/timer/start/route.ts b/apps/web/app/api/timer/start/route.ts index 175421893..52d3c92eb 100644 --- a/apps/web/app/api/timer/start/route.ts +++ b/apps/web/app/api/timer/start/route.ts @@ -14,7 +14,7 @@ export async function POST(req: Request) { taskId, teamId: organizationTeamId } = await authenticatedGuard(req, res); - console.log({ user, tenantId, taskId}) + console.log({ user, tenantId, taskId }); if (!user) return $res('Unauthorized'); await startTimerRequest( diff --git a/apps/web/app/hooks/auth/useAuthenticationTeam.ts b/apps/web/app/hooks/auth/useAuthenticationTeam.ts index 75b6fa2ca..36fa9f926 100644 --- a/apps/web/app/hooks/auth/useAuthenticationTeam.ts +++ b/apps/web/app/hooks/auth/useAuthenticationTeam.ts @@ -15,99 +15,92 @@ const FIRST_STEP = 'STEP1' as const; const SECOND_STEP = 'STEP2' as const; export interface IStepProps { - handleOnChange: any; - form: IRegisterDataAPI; + handleOnChange: any; + form: IRegisterDataAPI; } const initialValues: IRegisterDataAPI = RECAPTCHA_SITE_KEY - ? { - name: '', - email: '', - team: '', - recaptcha: '' - } - : { - name: '', - email: '', - team: '' - }; + ? { + name: '', + email: '', + team: '', + recaptcha: '' + } + : { + name: '', + email: '', + team: '' + }; export function useAuthenticationTeam() { - const query = useSearchParams(); - const queryEmail = useMemo(() => { - const emailQuery = - query?.get('email') || - localStorage?.getItem('ever-teams-start-email') || - ''; - return emailQuery; - }, [query]); - initialValues.email = queryEmail; - const [step, setStep] = useState( - FIRST_STEP - ); - const [formValues, setFormValues] = useState(initialValues); - const [errors, setErrors] = useState(initialValues); - const { queryCall, loading, infiniteLoading } = useQuery(registerUserTeamAPI); + const query = useSearchParams(); + const queryEmail = useMemo(() => { + const emailQuery = query?.get('email') || localStorage?.getItem('ever-teams-start-email') || ''; + return emailQuery; + }, [query]); + initialValues.email = queryEmail; + const [step, setStep] = useState(FIRST_STEP); + const [formValues, setFormValues] = useState(initialValues); + const [errors, setErrors] = useState(initialValues); + const { queryCall, loading, infiniteLoading } = useQuery(registerUserTeamAPI); - const handleSubmit = (e: any) => { - e.preventDefault(); - if (step === FIRST_STEP) { - const { errors, valid } = authFormValidate(['team'], formValues); - setErrors(errors as any); - valid && setStep(SECOND_STEP); - return; - } + const handleSubmit = (e: any) => { + e.preventDefault(); + if (step === FIRST_STEP) { + const { errors, valid } = authFormValidate(['team'], formValues); + setErrors(errors as any); + valid && setStep(SECOND_STEP); + return; + } - const noRecaptchaArray = ['email', 'name']; + const noRecaptchaArray = ['email', 'name']; - const withRecaptchaArray = [...noRecaptchaArray, 'recaptcha']; + const withRecaptchaArray = [...noRecaptchaArray, 'recaptcha']; - const validationFields = RECAPTCHA_SITE_KEY - ? withRecaptchaArray - : noRecaptchaArray; + const validationFields = RECAPTCHA_SITE_KEY ? withRecaptchaArray : noRecaptchaArray; - const { errors, valid } = authFormValidate(validationFields, formValues); + const { errors, valid } = authFormValidate(validationFields, formValues); - if (!valid) { - setErrors(errors as any); - return; - } + if (!valid) { + setErrors(errors as any); + return; + } - formValues['timezone'] = userTimezone(); - infiniteLoading.current = true; + formValues['timezone'] = userTimezone(); + infiniteLoading.current = true; - queryCall(formValues) - .then(() => window.location.reload()) - .catch((err: AxiosError) => { - if (err.response?.status === 400) { - setErrors((err.response?.data as any)?.errors || {}); - } - }); - }; + queryCall(formValues) + .then(() => window.location.reload()) + .catch((err: AxiosError) => { + if (err.response?.status === 400) { + setErrors((err.response?.data as any)?.errors || {}); + } + }); + }; - const handleOnChange = useCallback( - (e: any) => { - const { name, value } = e.target; - const key = name as keyof IRegisterDataAPI; - if (errors[key]) { - errors[key] = ''; - } - setFormValues((prevState) => ({ - ...prevState, - [name]: value - })); - }, - [errors] - ); + const handleOnChange = useCallback( + (e: any) => { + const { name, value } = e.target; + const key = name as keyof IRegisterDataAPI; + if (errors[key]) { + errors[key] = ''; + } + setFormValues((prevState) => ({ + ...prevState, + [name]: value + })); + }, + [errors] + ); - return { - handleSubmit, - handleOnChange, - loading, - FIRST_STEP, - step, - SECOND_STEP, - setStep, - errors, - formValues - }; + return { + handleSubmit, + handleOnChange, + loading, + FIRST_STEP, + step, + SECOND_STEP, + setStep, + errors, + formValues + }; } diff --git a/apps/web/app/interfaces/IScreenshoot.ts b/apps/web/app/interfaces/IScreenshoot.ts index fd30efe8d..29f3aed57 100644 --- a/apps/web/app/interfaces/IScreenshoot.ts +++ b/apps/web/app/interfaces/IScreenshoot.ts @@ -10,6 +10,6 @@ export interface IScreenShootItem { imageUrl: string; percent: number | string; showProgress?: boolean; - isTeamPage?: boolean + isTeamPage?: boolean; onShow: () => any; } diff --git a/apps/web/app/interfaces/ITaskTimesheet.ts b/apps/web/app/interfaces/ITaskTimesheet.ts index d0e265f94..5efcf0b23 100644 --- a/apps/web/app/interfaces/ITaskTimesheet.ts +++ b/apps/web/app/interfaces/ITaskTimesheet.ts @@ -4,7 +4,7 @@ import { ITeamTask } from './ITask'; import { ITimerSlot } from './timer/ITimerSlot'; export interface ITaskTimesheet { - id: string + id: string; title: string; description?: string; metaData?: string; diff --git a/apps/web/app/services/client/api/public-organization-team.ts b/apps/web/app/services/client/api/public-organization-team.ts index d9838ee8e..9c9707ac8 100644 --- a/apps/web/app/services/client/api/public-organization-team.ts +++ b/apps/web/app/services/client/api/public-organization-team.ts @@ -26,9 +26,8 @@ export function getPublicOrganizationTeamsAPI(profile_link: string, team_id: str params[`relations[${i}]`] = rl; }); - const queries = qs.stringify(params); - + const endpoint = GAUZY_API_BASE_SERVER_URL.value ? `/public/team/${profile_link}/${team_id}?${queries}` : `/public/team/${profile_link}/${team_id}?type=team`; @@ -49,7 +48,6 @@ export function getPublicOrganizationTeamsMiscDataAPI(profile_link: string, team params[`relations[${i}]`] = rl; }); - const queries = qs.stringify(params); const endpoint = GAUZY_API_BASE_SERVER_URL.value diff --git a/apps/web/app/stores/kanban.ts b/apps/web/app/stores/kanban.ts index 9940f0465..2ea76ec99 100644 --- a/apps/web/app/stores/kanban.ts +++ b/apps/web/app/stores/kanban.ts @@ -1,9 +1,7 @@ -import { IKanban } from "@app/interfaces/IKanban"; -import { atom } from "recoil"; +import { IKanban } from '@app/interfaces/IKanban'; +import { atom } from 'recoil'; export const kanbanBoardState = atom({ - key: 'kanbanBoardState', - default: { - - } -}) + key: 'kanbanBoardState', + default: {} +}); diff --git a/apps/web/app/utils/scroll-to-element.ts b/apps/web/app/utils/scroll-to-element.ts index a233b8d43..5aedc9fc8 100644 --- a/apps/web/app/utils/scroll-to-element.ts +++ b/apps/web/app/utils/scroll-to-element.ts @@ -3,4 +3,4 @@ export function scrollToElement(rect: DOMRect, diff = 150) { top: rect.y > 0 ? rect.y + window.scrollY - diff : window.scrollY - Math.abs(rect.y) - diff, behavior: 'smooth' }); -} \ No newline at end of file +} diff --git a/apps/web/components/pages/main/header-tabs.tsx b/apps/web/components/pages/main/header-tabs.tsx index 7e205d4f1..29e83d3d8 100644 --- a/apps/web/components/pages/main/header-tabs.tsx +++ b/apps/web/components/pages/main/header-tabs.tsx @@ -20,7 +20,7 @@ const HeaderTabs = ({ linkAll }: { linkAll: boolean }) => { return ( <> - {options.map(({ label, icon: Icon, view: optionView },index) => ( + {options.map(({ label, icon: Icon, view: optionView }, index) => (