Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LiaSolo committed Oct 15, 2024
1 parent c838ec7 commit 3d5c77c
Show file tree
Hide file tree
Showing 25 changed files with 80 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ModeButton: FC<ModeButtonProps> = ({
}: ModeButtonProps) => (
<Button
variant="secondary"
icon={ <Icon name={!tableMode ? "grid" : "list"} />}
icon={<Icon name={!tableMode ? 'grid' : 'list'} />}
className={classNames(className, styles.wrapper, styles.modeButton)}
aria-label="Change mode"
{...props}
Expand Down
3 changes: 0 additions & 3 deletions web-app/client/src/components/Icon/Icon.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import Icon from './Icon';

const user = userEvent.setup();

describe('Icon Component', () => {
beforeEach(() => {
jest.clearAllMocks();
Expand Down
2 changes: 1 addition & 1 deletion web-app/client/src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Icon = <TName extends IconName>(
if (!icons[props.name]) {
throw new Error(`There is no icon with name "${props.name}!"`);
}
return icons[props.name]({...props, role: 'img'});
return icons[props.name]({ ...props, role: 'img' });
};

export default Icon;
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import MultiSelect from './MultiSelect';
import { countries } from 'countries-list';

const user = userEvent.setup();
const options = [
Expand Down
8 changes: 4 additions & 4 deletions web-app/client/src/components/Inputs/Password/Password.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ComponentProps, FC } from 'react';
import { Text } from '@components/Inputs';
import styles from './Password.module.scss';
import { ComponentProps } from 'react';
import { Control, Controller, FieldValues, Path } from 'react-hook-form';
import isStrongPassword from 'validator/lib/isStrongPassword';
import { Text } from '@components/Inputs';
import styles from './Password.module.scss';

const passwordTooltip = (
<div className={styles.tooltip}>
Expand Down Expand Up @@ -68,7 +68,7 @@ const Password = <T extends FieldValues>({
control={control}
rules={{
...rules,
validate: validate as any,
validate,
}}
render={({ field, fieldState }) => (
<Text
Expand Down
35 changes: 17 additions & 18 deletions web-app/client/src/components/Inputs/Password/TestPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,36 @@ const defaultValues: Inputs = {
};

export const TestPassword: FC = () => {

const {
control,
handleSubmit,
formState: { errors, isSubmitting },
formState: { isSubmitting },
} = useForm<Inputs>({
defaultValues,
});

const onSubmit = handleSubmit(async () => {
console.log('submit')
console.log('submit');
});

return (
<>
<form onSubmit={onSubmit}>
<Password
control={control}
controlName="password"
label="Password"
placeholder="admin1234"
rules={{ required: 'Required' }}
/>
<Button
variant="primary"
type="submit"
disabled={isSubmitting}
role="submit"
>
Test Button
</Button>
<Password
control={control}
controlName="password"
label="Password"
placeholder="admin1234"
rules={{ required: 'Required' }}
/>
<Button
variant="primary"
type="submit"
disabled={isSubmitting}
role="submit"
>
Test Button
</Button>
</form>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions web-app/client/src/components/Loader/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import cn from 'classnames';
import { useRouter } from 'next/router';
import { NextSeo } from 'next-seo';
import { FC, useEffect, useState } from 'react';
import Icon, { IconName } from '@components/Icon';
import { approximateAlgorithms } from '@constants/options';
import { primitivePathnames } from '@constants/primitiveReportPathnames';
import useTaskState from '@hooks/useTaskState';
import getTaskStatusData from '@utils/getTaskStatusData';
import { PrimitiveType } from 'types/globalTypes';
import styles from './Loader.module.scss';
import { NextSeo } from 'next-seo';
import { approximateAlgorithms } from '@constants/options';

const Loader: FC = () => {
const router = useRouter();
Expand Down
4 changes: 2 additions & 2 deletions web-app/client/src/components/LogInModal/steps/LogIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useForm } from 'react-hook-form';
import isEmail from 'validator/lib/isEmail';
import Button from '@components/Button';
import { Text } from '@components/Inputs';
import Password from '@components/Inputs/Password';
import {
logIn,
logInVariables,
Expand All @@ -12,7 +13,6 @@ import { LOG_IN } from '@graphql/operations/mutations/logIn';
import { useAuthContext } from '@hooks/useAuthContext';
import hashPassword from '@utils/hashPassword';
import styles from '../LogInModal.module.scss';
import Password from '@components/Inputs/Password';

type Inputs = {
email: string;
Expand All @@ -32,7 +32,7 @@ interface Props {
const LogIn: FC<Props> = ({ onSuccess, onRecovery }) => {
const { applyTokens } = useAuthContext();
const {
control,
control,
register,
handleSubmit,
formState: { errors, isSubmitting },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useMutation } from '@apollo/client';
import { FC } from 'react';
import { useForm } from 'react-hook-form';
import Button from '@components/Button';
import Password from '@components/Inputs/Password';
import {
changePassword,
changePasswordVariables,
Expand All @@ -10,7 +11,6 @@ import { CHANGE_PASSWORD } from '@graphql/operations/mutations/changePassword';
import { useAuthContext } from '@hooks/useAuthContext';
import hashPassword from '@utils/hashPassword';
import styles from '../LogInModal.module.scss';
import Password from '@components/Inputs/Password';

type Inputs = {
password: string;
Expand All @@ -34,7 +34,7 @@ const RestorePassword: FC<Props> = ({ onSuccess, email }) => {
const {
control,
handleSubmit,
formState: { errors, isSubmitting },
formState: { isSubmitting },
} = useForm<Inputs>({
defaultValues,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ describe('Modal Container as Test Modal window', () => {
jest.clearAllMocks();
});

const renderAndOpen = async () => {
render(<TestModal />);
const triggerOpen = screen.getByText('Test Button');
await user.click(triggerOpen);
};
const renderAndOpen = async () => {
render(<TestModal />);
const triggerOpen = screen.getByText('Test Button');
await user.click(triggerOpen);
};

test('Should open', async () => {
await renderAndOpen();
Expand All @@ -32,6 +32,4 @@ const renderAndOpen = async () => {
await user.click(screen.getByText('Outside'));
expect(screen.queryByText('Test Modal')).toBeNull();
});


});
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const ModalContainer: FCWithChildren<ModalProps> = ({
onClick={onClose}
aria-label="Close"
className={styles.closeButton}
role='close'
role="close"
>
<Icon name="cross" />
</button>
Expand Down
2 changes: 1 addition & 1 deletion web-app/client/src/components/ModalContainer/TestModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from '@components/Button';
import { FC, useState } from 'react';
import Button from '@components/Button';
import ModalContainer from './ModalContainer';

export const TestModal: FC = () => {
Expand Down
3 changes: 1 addition & 2 deletions web-app/client/src/components/SignUpModal/steps/CoreInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { countries } from 'countries-list';
import { FC } from 'react';
import { useForm } from 'react-hook-form';
import isEmail from 'validator/lib/isEmail';
import isStrongPassword from 'validator/lib/isStrongPassword';
import Button from '@components/Button';
import { Text } from '@components/Inputs';
import Password from '@components/Inputs/Password';
import { ControlledSelect } from '@components/Inputs/Select';
import {
createUser,
Expand All @@ -15,7 +15,6 @@ import { CREATE_USER } from '@graphql/operations/mutations/createUser';
import { useAuthContext } from '@hooks/useAuthContext';
import hashPassword from '@utils/hashPassword';
import styles from '../../LogInModal/LogInModal.module.scss';
import Password from '@components/Inputs/Password';

const countryNames = Object.entries(countries).map(([, country]) => country);

Expand Down
6 changes: 3 additions & 3 deletions web-app/client/src/components/Tooltip/Tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ describe('Tooltip', () => {
render(<Tooltip>Test Tooltip</Tooltip>);
const trigger = screen.getByRole('img');
await user.hover(trigger);
return trigger
}
return trigger;
};

test('Should open with text by hover', async () => {
await renderAndOpen()
await renderAndOpen();
expect(screen.getByText(/test tooltip/i));
});

Expand Down
15 changes: 4 additions & 11 deletions web-app/client/src/hooks/useTaskState.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import { useLazyQuery, useQuery } from '@apollo/client';
import { useQuery } from '@apollo/client';
import { useAtom } from 'jotai';
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import taskStateAtom, {
taskStateAtomDefaultValues,
taskStateAtomDefaultValuesWithID,
} from '@atoms/primaryAtoms/taskStateAtom';
import {
getTaskState,
getTaskState_taskInfo_state,
getTaskState_taskInfo_state_TaskState,
getTaskStateVariables,
} from '@graphql/operations/queries/__generated__/getTaskState';
import { getTaskState_taskInfo_state } from '@graphql/operations/queries/__generated__/getTaskState';
import {
getTaskStateLite,
getTaskStateLiteVariables,
} from '@graphql/operations/queries/__generated__/getTaskStateLite';
import { GET_TASK_STATE } from '@graphql/operations/queries/getTaskState';
import { GET_TASK_STATE_LITE } from '@graphql/operations/queries/getTaskStateLite';
import { showError } from '@utils/toasts';
import { GET_TASK_TYPE } from '@graphql/operations/queries/getTaskType';
import { showError } from '@utils/toasts';

const useTaskState = () => {
const router = useRouter();
Expand Down Expand Up @@ -89,7 +82,7 @@ const useTaskState = () => {
if (state && 'processStatus' in state) {
setTaskState({
...taskState,
state: state,
state,
});
}
if (state && state.__typename !== 'TaskState') {
Expand Down
2 changes: 1 addition & 1 deletion web-app/client/src/pages/create-task/choose-file.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cn from 'classnames';
import type { GetServerSideProps, NextPage } from 'next';
import { useRouter } from 'next/router';
import { NextSeo } from 'next-seo';
import { useEffect, useMemo, useState } from 'react';
import Button from '@components/Button';
import { Collapse } from '@components/Collapse';
Expand All @@ -16,7 +17,6 @@ import { useTaskUrlParams } from '@hooks/useTaskUrlParams';
import styles from '@styles/ChooseFile.module.scss';
import { AllowedDataset } from 'types/algorithms';
import { MainPrimitiveType } from 'types/globalTypes';
import { NextSeo } from 'next-seo';

const sortDatasetsBySupportedPrimitive = (
datasets?: AllowedDataset[],
Expand Down
2 changes: 1 addition & 1 deletion web-app/client/src/pages/create-task/choose-primitive.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useRouter } from 'next/router';
import { NextSeo } from 'next-seo';
import Button from '@components/Button';
import Icon from '@components/Icon';
import PrimitiveCard from '@components/PrimitiveCard';
Expand All @@ -8,7 +9,6 @@ import primitiveInfo from '@constants/primitiveInfoType';
import { useTaskUrlParams } from '@hooks/useTaskUrlParams';
import styles from '@styles/ChoosePrimitive.module.scss';
import { MainPrimitiveType } from 'types/globalTypes';
import { NextSeo } from 'next-seo';

const header = (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { NextPage } from 'next';
import { useRouter } from 'next/router';
import { NextSeo } from 'next-seo';
import React from 'react';
import AlgorithmFormConfigurator from '@components/AlgorithmFormConfigurator';
import {
Expand All @@ -8,7 +9,6 @@ import {
} from '@constants/formPrimitives';
import { useTaskUrlParams } from '@hooks/useTaskUrlParams';
import styles from '@styles/ConfigureAlgorithm.module.scss';
import { NextSeo } from 'next-seo';

const ConfigureAlgorithm: NextPage = () => {
const router = useRouter();
Expand Down
4 changes: 2 additions & 2 deletions web-app/client/src/pages/papers.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { GetServerSideProps, NextPage } from 'next';
import { NextSeo } from 'next-seo';
import Icon from '@components/Icon';
import PrPublicationCard from '@components/PrPublicationCard';
import SciencePublicationCard from '@components/SciencePublicationCard';
import cmsClient from '@graphql/cmsClient';
import { getPublications } from '@graphql/operations/queries/__generated__/getPublications';
import { GET_PUBLICATIONS } from '@graphql/operations/queries/getPublications';
import styles from '@styles/Papers.module.scss';
import { NextSeo } from 'next-seo';

interface Props {
papers: getPublications;
Expand All @@ -18,7 +18,7 @@ const Papers: NextPage<Props> = ({ papers }) => {

return (
<>
<NextSeo title='Papers' />
<NextSeo title="Papers" />
<div className={styles.papersPage}>
<Icon name="backgroundHome" className={styles.background} />

Expand Down
2 changes: 1 addition & 1 deletion web-app/client/src/pages/reports/charts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useQuery } from '@apollo/client';
import { NextSeo } from 'next-seo';
import { ReactElement } from 'react';
import LayeredChart from '@components/Chart';
import { ReportsLayout } from '@components/ReportsLayout/ReportsLayout';
Expand All @@ -10,7 +11,6 @@ import {
import { GET_PIE_CHART_DATA } from '@graphql/operations/queries/getPieChartData';
import styles from '@styles/Charts.module.scss';
import { NextPageWithLayout } from 'types/pageWithLayout';
import { NextSeo } from 'next-seo';

const getChartData = (data?: getPieChartData) => {
if (
Expand Down
4 changes: 2 additions & 2 deletions web-app/client/src/pages/reports/dependencies.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useLazyQuery } from '@apollo/client';
import type { GetServerSideProps } from 'next';
import { NextSeo } from 'next-seo';
import { ReactElement, useEffect, useMemo, useState } from 'react';
import { FormProvider } from 'react-hook-form';
import Button from '@components/Button';
Expand All @@ -16,6 +17,7 @@ import { Text } from '@components/Inputs';
import Pagination from '@components/Pagination/Pagination';
import ReportsLayout from '@components/ReportsLayout';
import { TaskContextProvider, useTaskContext } from '@components/TaskContext';
import { Algorithms, approximateAlgorithms } from '@constants/options';
import client from '@graphql/client';
import {
GetMainTaskDeps,
Expand All @@ -32,8 +34,6 @@ import {
PrimitiveType,
} from 'types/globalTypes';
import { NextPageWithLayout } from 'types/pageWithLayout';
import { Algorithms, approximateAlgorithms } from '@constants/options';
import { NextSeo } from 'next-seo';

type Props = {
defaultData?: GetMainTaskDeps;
Expand Down
Loading

0 comments on commit 3d5c77c

Please sign in to comment.