From 8e1119976da30c951d2cc9b77af4da1a982980e8 Mon Sep 17 00:00:00 2001 From: Juga Paazmaya Date: Wed, 23 Aug 2023 11:24:16 +0300 Subject: [PATCH] Remember to run Prettier, even when it has precommit hook --- integration_tests/pages/LoginPage.ts | 5 +++-- integration_tests/test/login.spec.ts | 6 +++--- src/components/BuildList/index.tsx | 2 +- src/components/CommentsPopper.tsx | 13 ++++++++++--- src/components/LoginForm.tsx | 5 +---- src/components/PasswordField.tsx | 17 +++++++++-------- src/components/ProjectSelect.tsx | 2 +- src/components/RegisterForm.tsx | 15 +++------------ src/components/TestDetailsDialog/DrawArea.tsx | 6 +----- .../TestDetailsDialog/TestDetailsModal.tsx | 8 ++------ src/components/TestDetailsDialog/index.tsx | 13 +++++++------ .../TestRunList/StatusFilterOperators.tsx | 9 ++++++--- .../TestRunList/TagFilterOperators.tsx | 6 +++++- src/components/TestRunList/index.tsx | 17 ++++++++++------- src/components/UserList/index.tsx | 6 +++--- src/contexts/testRun.context.tsx | 4 ++-- src/pages/ProjectPage.tsx | 3 +-- src/pages/TestVariationDetailsPage.tsx | 6 +++--- 18 files changed, 71 insertions(+), 72 deletions(-) diff --git a/integration_tests/pages/LoginPage.ts b/integration_tests/pages/LoginPage.ts index edc83758..ab46269a 100644 --- a/integration_tests/pages/LoginPage.ts +++ b/integration_tests/pages/LoginPage.ts @@ -4,6 +4,7 @@ export class LoginPage extends BasePage { email = this.page.getByTestId("email"); password = this.page.getByTestId("password"); loginBtn = this.page.getByTestId("loginBtn"); - showPasswordBtn = this.page.locator("[aria-label='toggle password visibility']"); + showPasswordBtn = this.page.locator( + "[aria-label='toggle password visibility']", + ); } - diff --git a/integration_tests/test/login.spec.ts b/integration_tests/test/login.spec.ts index ac815f82..4b4b7fe3 100644 --- a/integration_tests/test/login.spec.ts +++ b/integration_tests/test/login.spec.ts @@ -24,8 +24,8 @@ test("show and hide password", async ({ loginPage }) => { await loginPage.password.type("123456"); await loginPage.showPasswordBtn.click(); - expect(await loginPage.password.getAttribute('type')).toBe('text'); + expect(await loginPage.password.getAttribute("type")).toBe("text"); await loginPage.showPasswordBtn.click(); - expect(await loginPage.password.getAttribute('type')).toBe('password'); -}); \ No newline at end of file + expect(await loginPage.password.getAttribute("type")).toBe("password"); +}); diff --git a/src/components/BuildList/index.tsx b/src/components/BuildList/index.tsx index 0a703606..fdaa83b6 100644 --- a/src/components/BuildList/index.tsx +++ b/src/components/BuildList/index.tsx @@ -1,5 +1,5 @@ import React, { FunctionComponent } from "react"; -import { makeStyles, createStyles } from '@mui/styles'; +import { makeStyles, createStyles } from "@mui/styles"; import { List, ListItemButton, diff --git a/src/components/CommentsPopper.tsx b/src/components/CommentsPopper.tsx index 5f444ec1..6e0d50ac 100644 --- a/src/components/CommentsPopper.tsx +++ b/src/components/CommentsPopper.tsx @@ -1,6 +1,14 @@ import React from "react"; -import { makeStyles } from '@mui/styles'; -import { Button, Popper, Fade, Paper, TextField, Badge, type Theme } from "@mui/material"; +import { makeStyles } from "@mui/styles"; +import { + Button, + Popper, + Fade, + Paper, + TextField, + Badge, + type Theme, +} from "@mui/material"; import { usePopupState, bindToggle, @@ -16,7 +24,6 @@ const useStyles = makeStyles((theme: Theme) => ({ }, })); - interface IProps { text: string | undefined; onSave: (comment: string) => Promise; diff --git a/src/components/LoginForm.tsx b/src/components/LoginForm.tsx index f5ca13ba..edc2467d 100644 --- a/src/components/LoginForm.tsx +++ b/src/components/LoginForm.tsx @@ -63,10 +63,7 @@ const LoginForm = () => { - + diff --git a/src/components/PasswordField.tsx b/src/components/PasswordField.tsx index 6d8b9796..ca189139 100644 --- a/src/components/PasswordField.tsx +++ b/src/components/PasswordField.tsx @@ -1,18 +1,19 @@ import React, { useState } from "react"; -import { - IconButton, - InputAdornment, -} from "@mui/material"; +import { IconButton, InputAdornment } from "@mui/material"; import { Visibility, VisibilityOff } from "@mui/icons-material"; import { TextValidator } from "react-material-ui-form-validator"; interface PasswordFieldProps { - password: string; - setPassword: React.Dispatch>; - label?: string; + password: string; + setPassword: React.Dispatch>; + label?: string; } -const PasswordField = ({password, setPassword, label = "Password" }: PasswordFieldProps) => { +const PasswordField = ({ + password, + setPassword, + label = "Password", +}: PasswordFieldProps) => { const [showPassword, setShowPassword] = useState(false); const handleClickShowPassword = () => setShowPassword((show) => !show); diff --git a/src/components/ProjectSelect.tsx b/src/components/ProjectSelect.tsx index 0d39f903..4e1e55ef 100644 --- a/src/components/ProjectSelect.tsx +++ b/src/components/ProjectSelect.tsx @@ -1,5 +1,5 @@ import React, { FunctionComponent } from "react"; -import { makeStyles, createStyles } from '@mui/styles'; +import { makeStyles, createStyles } from "@mui/styles"; import { FormControl, InputLabel, diff --git a/src/components/RegisterForm.tsx b/src/components/RegisterForm.tsx index 20860816..eb75ae3d 100644 --- a/src/components/RegisterForm.tsx +++ b/src/components/RegisterForm.tsx @@ -1,11 +1,5 @@ import React, { useState, FormEvent } from "react"; -import { - Button, - Grid, - Card, - CardContent, - CardActions, -} from "@mui/material"; +import { Button, Grid, Card, CardContent, CardActions } from "@mui/material"; import { useUserDispatch, login } from "../contexts"; import { usersService } from "../services"; import { useSnackbar } from "notistack"; @@ -39,7 +33,7 @@ const RegisterForm = () => { }), ); }; - + const errorForTwoChar = "Enter at least two characters."; return ( @@ -105,10 +99,7 @@ const RegisterForm = () => { /> - + diff --git a/src/components/TestDetailsDialog/DrawArea.tsx b/src/components/TestDetailsDialog/DrawArea.tsx index c874aff6..fe37c381 100644 --- a/src/components/TestDetailsDialog/DrawArea.tsx +++ b/src/components/TestDetailsDialog/DrawArea.tsx @@ -339,9 +339,5 @@ export const DrawArea: FunctionComponent = ({ ); // TODO: Separate SVG with reason... - return ( - <> - {imageName ? imageCanvas() : } - - ); + return <>{imageName ? imageCanvas() : }; }; diff --git a/src/components/TestDetailsDialog/TestDetailsModal.tsx b/src/components/TestDetailsDialog/TestDetailsModal.tsx index f10af69a..4d6238b0 100644 --- a/src/components/TestDetailsDialog/TestDetailsModal.tsx +++ b/src/components/TestDetailsDialog/TestDetailsModal.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { makeStyles } from '@mui/styles'; +import { makeStyles } from "@mui/styles"; import { Typography, Button, @@ -603,11 +603,7 @@ const TestDetailsModal: React.FunctionComponent = ({ - + diff --git a/src/components/TestDetailsDialog/index.tsx b/src/components/TestDetailsDialog/index.tsx index 61d2703b..0f58fc6e 100644 --- a/src/components/TestDetailsDialog/index.tsx +++ b/src/components/TestDetailsDialog/index.tsx @@ -28,13 +28,14 @@ export const TestDetailsDialog: React.FunctionComponent = () => { const [navigationTargetId, setNavigationTargetId] = React.useState(); const testRuns = React.useMemo(() => { - if(filteredSortedTestRunIds) { + if (filteredSortedTestRunIds) { return allTestRuns - .filter((tr) => filteredSortedTestRunIds.includes(tr.id)) - .sort( - (a, b) => - filteredSortedTestRunIds.indexOf(a.id) - filteredSortedTestRunIds.indexOf(b.id), - ) + .filter((tr) => filteredSortedTestRunIds.includes(tr.id)) + .sort( + (a, b) => + filteredSortedTestRunIds.indexOf(a.id) - + filteredSortedTestRunIds.indexOf(b.id), + ); } return allTestRuns; }, [allTestRuns, filteredSortedTestRunIds]); diff --git a/src/components/TestRunList/StatusFilterOperators.tsx b/src/components/TestRunList/StatusFilterOperators.tsx index fc0ff47d..ae3de218 100644 --- a/src/components/TestRunList/StatusFilterOperators.tsx +++ b/src/components/TestRunList/StatusFilterOperators.tsx @@ -11,11 +11,14 @@ import { GridFilterItem, GridCellParams, GridFilterOperator, - GridFilterInputValueProps + GridFilterInputValueProps, } from "@mui/x-data-grid"; import { TestStatus } from "../../types"; -const StatusInputComponent = ({ item, applyValue }: GridFilterInputValueProps) => { +const StatusInputComponent = ({ + item, + applyValue, +}: GridFilterInputValueProps) => { const { testRuns } = useTestRunState(); const handleFilterChange = (event: SelectChangeEvent) => { @@ -52,7 +55,7 @@ const StatusInputComponent = ({ item, applyValue }: GridFilterInputValueProps) = ); }; -export const StatusFilterOperators: GridFilterOperator[] = [ +export const StatusFilterOperators: GridFilterOperator[] = [ ...getGridStringOperators() .filter((operator) => operator.value === "equals") .map((operator) => ({ diff --git a/src/components/TestRunList/TagFilterOperators.tsx b/src/components/TestRunList/TagFilterOperators.tsx index 2e4179f4..ebbd575d 100644 --- a/src/components/TestRunList/TagFilterOperators.tsx +++ b/src/components/TestRunList/TagFilterOperators.tsx @@ -6,7 +6,11 @@ import { } from "@mui/material"; import React from "react"; import { useTestRunState } from "../../contexts"; -import { getGridStringOperators, GridFilterOperator, GridFilterInputValueProps } from "@mui/x-data-grid"; +import { + getGridStringOperators, + GridFilterOperator, + GridFilterInputValueProps, +} from "@mui/x-data-grid"; const TagInputComponent = ({ item, applyValue }: GridFilterInputValueProps) => { const { testRuns } = useTestRunState(); diff --git a/src/components/TestRunList/index.tsx b/src/components/TestRunList/index.tsx index 2a28820c..bf2cf999 100644 --- a/src/components/TestRunList/index.tsx +++ b/src/components/TestRunList/index.tsx @@ -53,7 +53,7 @@ const columnsDef: GridColDef[] = [ return tags.reduce( (prev, curr) => prev.concat(curr ? `${curr};` : ""), - "" + "", ); }, renderCell: (params: GridCellParams) => ( @@ -72,7 +72,7 @@ const columnsDef: GridColDef[] = [ margin: "1px", }} /> - ) + ), )} ), @@ -124,12 +124,12 @@ const TestRunList: React.FunctionComponent = () => { testRunDispatch({ type: "get", payload, - }) + }), ) .catch((err: string) => enqueueSnackbar(err, { variant: "error", - }) + }), ); } else { testRunDispatch({ @@ -161,8 +161,8 @@ const TestRunList: React.FunctionComponent = () => { () => (unsubscribe = apiRef.current.subscribeEvent( "stateChange", - handleStateChange - )) + handleStateChange, + )), ); }, [apiRef, apiRef.current.instanceId]); @@ -192,7 +192,10 @@ const TestRunList: React.FunctionComponent = () => { onSortModelChange={(model) => setSortModel(model)} onRowClick={(param: GridRowParams) => { navigate( - buildTestRunLocation(selectedBuild.id, param.row["id"].toString()) + buildTestRunLocation( + selectedBuild.id, + param.row["id"].toString(), + ), ); }} /> diff --git a/src/components/UserList/index.tsx b/src/components/UserList/index.tsx index 81100b5c..f3020d24 100644 --- a/src/components/UserList/index.tsx +++ b/src/components/UserList/index.tsx @@ -61,7 +61,7 @@ const UserList = () => { userDispatch({ type: "getAll", payload: users, - }) + }), ); }, [userDispatch]); @@ -78,12 +78,12 @@ const UserList = () => { .catch((err) => enqueueSnackbar(err, { variant: "error", - }) + }), ); } return newState; }, - [enqueueSnackbar] + [enqueueSnackbar], ); const apiRef = useGridApiRef(); diff --git a/src/contexts/testRun.context.tsx b/src/contexts/testRun.context.tsx index 6724a519..93b01b19 100644 --- a/src/contexts/testRun.context.tsx +++ b/src/contexts/testRun.context.tsx @@ -79,7 +79,7 @@ type TestRunProviderProps = { const TestRunStateContext = React.createContext(undefined); const TestRunDispatchContext = React.createContext( - undefined + undefined, ); const initialState: State = { @@ -130,7 +130,7 @@ function testRunReducer(state: State, action: IAction): State { ...state.testRuns, ...action.payload.filter( // remove duplicates - (i) => !state.testRuns.find((tr) => tr.id === i.id) + (i) => !state.testRuns.find((tr) => tr.id === i.id), ), ], }; diff --git a/src/pages/ProjectPage.tsx b/src/pages/ProjectPage.tsx index 81f8279b..b13e9260 100644 --- a/src/pages/ProjectPage.tsx +++ b/src/pages/ProjectPage.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from "react"; -import { makeStyles } from '@mui/styles'; +import { makeStyles } from "@mui/styles"; import { Grid, Box } from "@mui/material"; import { useParams, useNavigate } from "react-router-dom"; import BuildList from "../components/BuildList"; @@ -22,7 +22,6 @@ const useStyles = makeStyles(() => ({ }, })); - const ProjectPage = () => { const classes = useStyles(); const { projectId } = useParams<{ projectId: string }>(); diff --git a/src/pages/TestVariationDetailsPage.tsx b/src/pages/TestVariationDetailsPage.tsx index 306e3f4f..dabf3bec 100644 --- a/src/pages/TestVariationDetailsPage.tsx +++ b/src/pages/TestVariationDetailsPage.tsx @@ -47,7 +47,7 @@ const TestVariationDetailsPage: React.FunctionComponent = () => { .catch((err) => enqueueSnackbar(err, { variant: "error", - }) + }), ); } }, [testVariationId, enqueueSnackbar]); @@ -72,11 +72,11 @@ const TestVariationDetailsPage: React.FunctionComponent = () => { if (testRun) { navigate({ pathname: buildProjectPageUrl( - testVariation.projectId + testVariation.projectId, ), ...buildTestRunLocation( testRun.buildId, - testRun.id + testRun.id, ), }); }