Skip to content

Commit b3976e8

Browse files
authored
Run Prettier from command line and remove VS Code plugin which provides inconsistent fromatting (#322)
1 parent 9c8ef39 commit b3976e8

File tree

13 files changed

+54
-59
lines changed

13 files changed

+54
-59
lines changed

.vscode/settings.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
"editor.defaultFormatter": "esbenp.prettier-vscode",
3-
"editor.formatOnSave": true,
4-
"cSpell.words": ["Konva"]
2+
"cSpell.words": ["Konva"]
53
}

integration_tests/fixtures/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ type Fixtures = {
1212
registerPage: RegisterPage;
1313
openProjectPage: (id: string) => Promise<ProjectPage>;
1414
openTestVariationListPage: (
15-
projectId: string
15+
projectId: string,
1616
) => Promise<TestVariationListPage>;
1717
openTestVariationDetailsPage: (
18-
id: string
18+
id: string,
1919
) => Promise<TestVariationDetailsPage>;
2020
projectListPage: ProjectListPage;
2121
profilePage: ProfilePage;
@@ -95,8 +95,8 @@ export const test = base.extend<Fixtures>({
9595
apiKey: "ASJDHGAKJSDGASD",
9696
role: "admin",
9797
token: "eyJsgOE8Bw2bFwhZAugRRGm8U",
98-
})
99-
)
98+
}),
99+
),
100100
);
101101

102102
await use();

integration_tests/test/projectList.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ test("can delete project", async ({ projectListPage, page }) => {
2121
await projectListPage.modal.confirmBtn.click();
2222

2323
await expect(projectListPage.notification.message).toHaveText(
24-
"Project name deleted"
24+
"Project name deleted",
2525
);
2626
});

integration_tests/utils/mocks.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ export const mockDeleteProject = async (page: Page, project: Project) => {
2424
route.fulfill({
2525
status: 200,
2626
body: JSON.stringify(project),
27-
})
27+
}),
2828
);
2929
};
3030

3131
export const mockGetBuilds = async (
3232
page: Page,
3333
projectId: string,
34-
builds: Build[]
34+
builds: Build[],
3535
) => {
3636
return page.route(
3737
`${API_URL}/builds?projectId=${projectId}&take=10&skip=0`,
@@ -43,77 +43,77 @@ export const mockGetBuilds = async (
4343
take: 10,
4444
total: 3,
4545
}),
46-
})
46+
}),
4747
);
4848
};
4949

5050
export const mockGetBuildDetails = async (page: Page, build: Build) => {
5151
return page.route(`${API_URL}/builds/${build.id}`, (route) =>
5252
route.fulfill({
5353
body: JSON.stringify(build),
54-
})
54+
}),
5555
);
5656
};
5757

5858
export const mockGetTestRuns = async (
5959
page: Page,
6060
buildId: string,
61-
testRuns: TestRun[]
61+
testRuns: TestRun[],
6262
) => {
6363
return page.route(`${API_URL}/test-runs?buildId=${buildId}`, (route) =>
6464
route.fulfill({
6565
body: JSON.stringify(testRuns),
66-
})
66+
}),
6767
);
6868
};
6969

7070
export const mockTestRun = async (page: Page, testRun: TestRun) => {
7171
return page.route(`${API_URL}/test-runs/${testRun.id}`, (route) =>
7272
route.fulfill({
7373
body: JSON.stringify(testRun),
74-
})
74+
}),
7575
);
7676
};
7777

7878
export const mockImage = async (page: Page, image: string) => {
7979
return page.route(`${API_URL}/${image}`, (route) =>
8080
route.fulfill({
8181
path: `integration_tests/images/${image}`,
82-
})
82+
}),
8383
);
8484
};
8585

8686
export const mockGetUsers = async (page: Page, users: User[]) => {
8787
return page.route(`${API_URL}/users/all`, (route) =>
8888
route.fulfill({
8989
body: JSON.stringify(users),
90-
})
90+
}),
9191
);
9292
};
9393

9494
export const mockGetTestVariations = async (
9595
page: Page,
9696
projectId: string,
97-
testVariations: TestVariation[]
97+
testVariations: TestVariation[],
9898
) => {
9999
return page.route(
100100
`${API_URL}/test-variations?projectId=${projectId}`,
101101
(route) =>
102102
route.fulfill({
103103
body: JSON.stringify(testVariations),
104-
})
104+
}),
105105
);
106106
};
107107

108108
export const mockGetTestVariationDetails = async (
109109
page: Page,
110-
testVariation: TestVariation
110+
testVariation: TestVariation,
111111
) => {
112112
return page.route(
113113
`${API_URL}/test-variations/details/${testVariation.id}`,
114114
(route) =>
115115
route.fulfill({
116116
body: JSON.stringify(testVariation),
117-
})
117+
}),
118118
);
119119
};

jest.transform-nothing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default {};
1+
export default {};

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"scripts": {
4242
"start": "node generate-env-browser.js && cp env-config.js ./public/ && vite",
4343
"test": "jest",
44+
"format": "prettier --write integration_tests src *.js *.ts *.md",
4445
"build": "vite build",
4546
"lint": "eslint --ignore-path .gitignore . --ext .ts,.tsx,.jsx,.js",
4647
"typescheck": "tsc --noEmit",

src/components/BaseModal.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ export const BaseModal: React.FunctionComponent<IProps> = ({
3939
<Button onClick={onCancel} color="primary">
4040
Cancel
4141
</Button>
42-
<Button
43-
type="submit"
44-
color="primary"
45-
data-testId="submitButton"
46-
>
42+
<Button type="submit" color="primary" data-testId="submitButton">
4743
{submitButtonText}
4844
</Button>
4945
</DialogActions>

src/components/BuildList/index.tsx

+10-10
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const useStyles = makeStyles((theme: Theme) =>
5050
visibility: "inherit",
5151
},
5252
},
53-
})
53+
}),
5454
);
5555

5656
const BuildList: FunctionComponent = () => {
@@ -69,7 +69,7 @@ const BuildList: FunctionComponent = () => {
6969

7070
const handleMenuClick = (
7171
event: React.MouseEvent<HTMLElement>,
72-
build: Build
72+
build: Build,
7373
) => {
7474
event.stopPropagation();
7575
setAnchorEl(event.currentTarget);
@@ -90,7 +90,7 @@ const BuildList: FunctionComponent = () => {
9090

9191
const selectBuildCalback = React.useCallback(
9292
(id?: string) => navigate(buildTestRunLocation(id)),
93-
[navigate]
93+
[navigate],
9494
);
9595

9696
const handlePaginationChange = React.useCallback(
@@ -106,11 +106,11 @@ const BuildList: FunctionComponent = () => {
106106
.catch((err: string) =>
107107
enqueueSnackbar(err, {
108108
variant: "error",
109-
})
109+
}),
110110
);
111111
}
112112
},
113-
[buildDispatch, enqueueSnackbar, selectedProjectId, take]
113+
[buildDispatch, enqueueSnackbar, selectedProjectId, take],
114114
);
115115

116116
React.useEffect(() => {
@@ -215,12 +215,12 @@ const BuildList: FunctionComponent = () => {
215215
.then((b) =>
216216
enqueueSnackbar(`${menuBuild.id} finished`, {
217217
variant: "success",
218-
})
218+
}),
219219
)
220220
.catch((err) =>
221221
enqueueSnackbar(err, {
222222
variant: "error",
223-
})
223+
}),
224224
);
225225
handleMenuClose();
226226
}}
@@ -273,7 +273,7 @@ const BuildList: FunctionComponent = () => {
273273
.catch((err) =>
274274
enqueueSnackbar(err, {
275275
variant: "error",
276-
})
276+
}),
277277
);
278278
handleMenuClose();
279279
}}
@@ -298,7 +298,7 @@ const BuildList: FunctionComponent = () => {
298298
`Build #${menuBuild.number || menuBuild.id} deleted`,
299299
{
300300
variant: "success",
301-
}
301+
},
302302
);
303303
})
304304
.then(() => handlePaginationChange(paginationPage))
@@ -310,7 +310,7 @@ const BuildList: FunctionComponent = () => {
310310
.catch((err) =>
311311
enqueueSnackbar(err, {
312312
variant: "error",
313-
})
313+
}),
314314
);
315315
handleMenuClose();
316316
}}

src/components/Header.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import {
2424

2525
const Header: FunctionComponent = () => {
2626
const [avatarMenuRef, setAvatarMenuRef] = React.useState<null | HTMLElement>(
27-
null
27+
null,
2828
);
2929
const [helpMenuRef, setHelpMenuRef] = React.useState<null | HTMLElement>(
30-
null
30+
null,
3131
);
3232
const { loggedIn, user } = useUserState();
3333
const authDispatch = useUserDispatch();
@@ -46,7 +46,7 @@ const Header: FunctionComponent = () => {
4646
handleMenuClose();
4747
window.open(
4848
"https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/issues/new",
49-
"_blank"
49+
"_blank",
5050
);
5151
};
5252

src/components/LoginForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const LoginForm = () => {
3232
.catch((err) =>
3333
enqueueSnackbar(err, {
3434
variant: "error",
35-
})
35+
}),
3636
);
3737
};
3838

src/components/RegisterForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const RegisterForm = () => {
3535
.catch((err) =>
3636
enqueueSnackbar(err, {
3737
variant: "error",
38-
})
38+
}),
3939
);
4040
};
4141

src/pages/ProfilePage.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ const ProfilePage = () => {
5151
.then(() =>
5252
enqueueSnackbar("User updated", {
5353
variant: "success",
54-
})
54+
}),
5555
)
5656
.catch((err) =>
5757
enqueueSnackbar(err, {
5858
variant: "error",
59-
})
59+
}),
6060
);
6161
}
6262
};
@@ -72,12 +72,12 @@ const ProfilePage = () => {
7272
.then(() =>
7373
enqueueSnackbar("Password updated", {
7474
variant: "success",
75-
})
75+
}),
7676
)
7777
.catch((err) =>
7878
enqueueSnackbar(err, {
7979
variant: "error",
80-
})
80+
}),
8181
);
8282
}
8383
};
@@ -110,7 +110,7 @@ const ProfilePage = () => {
110110
inputProps={{
111111
onChange: (event: any) =>
112112
setFirstName(
113-
(event.target as HTMLInputElement).value
113+
(event.target as HTMLInputElement).value,
114114
),
115115
"data-testId": "firstName",
116116
}}
@@ -131,7 +131,7 @@ const ProfilePage = () => {
131131
inputProps={{
132132
onChange: (event: any) =>
133133
setLastName(
134-
(event.target as HTMLInputElement).value
134+
(event.target as HTMLInputElement).value,
135135
),
136136
"data-testId": "lastName",
137137
}}
@@ -152,7 +152,7 @@ const ProfilePage = () => {
152152
inputProps={{
153153
onChange: (event: any) =>
154154
setEmail(
155-
(event.target as HTMLInputElement).value
155+
(event.target as HTMLInputElement).value,
156156
),
157157
"data-testId": "email",
158158
}}
@@ -217,7 +217,7 @@ const ProfilePage = () => {
217217
inputProps={{
218218
onChange: (event: any) =>
219219
setPassword(
220-
(event.target as HTMLInputElement).value
220+
(event.target as HTMLInputElement).value,
221221
),
222222
"data-testId": "password",
223223
}}
@@ -268,7 +268,7 @@ const ProfilePage = () => {
268268
textColor="primary"
269269
onChange={(
270270
event: React.ChangeEvent<{}>,
271-
newValue: number
271+
newValue: number,
272272
) => {
273273
setTabIndex(newValue);
274274
}}

vite.config.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {defineConfig} from "vite";
1+
import { defineConfig } from "vite";
22

33
import react from "@vitejs/plugin-react";
44

@@ -17,18 +17,18 @@ function manualChunks(id : string) {
1717

1818
// https://vitejs.dev/config/
1919
export default defineConfig({
20-
plugins: [react()],
21-
build: {
22-
outDir: 'build',
23-
sourcemap: true,
20+
plugins: [react()],
21+
build: {
22+
outDir: "build",
23+
sourcemap: true,
2424

25-
// https://rollupjs.org/configuration-options/
26-
/*
25+
// https://rollupjs.org/configuration-options/
26+
/*
2727
rollupOptions: {
2828
output: {
2929
manualChunks: manualChunks
3030
}
3131
}
3232
*/
33-
}
33+
},
3434
});

0 commit comments

Comments
 (0)