Skip to content

Commit

Permalink
Run Prettier from command line and remove VS Code plugin which provid…
Browse files Browse the repository at this point in the history
…es inconsistent fromatting (#322)
  • Loading branch information
paazmaya authored Aug 8, 2023
1 parent 9c8ef39 commit b3976e8
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 59 deletions.
4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"cSpell.words": ["Konva"]
"cSpell.words": ["Konva"]
}
8 changes: 4 additions & 4 deletions integration_tests/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ type Fixtures = {
registerPage: RegisterPage;
openProjectPage: (id: string) => Promise<ProjectPage>;
openTestVariationListPage: (
projectId: string
projectId: string,
) => Promise<TestVariationListPage>;
openTestVariationDetailsPage: (
id: string
id: string,
) => Promise<TestVariationDetailsPage>;
projectListPage: ProjectListPage;
profilePage: ProfilePage;
Expand Down Expand Up @@ -95,8 +95,8 @@ export const test = base.extend<Fixtures>({
apiKey: "ASJDHGAKJSDGASD",
role: "admin",
token: "eyJsgOE8Bw2bFwhZAugRRGm8U",
})
)
}),
),
);

await use();
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test/projectList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ test("can delete project", async ({ projectListPage, page }) => {
await projectListPage.modal.confirmBtn.click();

await expect(projectListPage.notification.message).toHaveText(
"Project name deleted"
"Project name deleted",
);
});
26 changes: 13 additions & 13 deletions integration_tests/utils/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export const mockDeleteProject = async (page: Page, project: Project) => {
route.fulfill({
status: 200,
body: JSON.stringify(project),
})
}),
);
};

export const mockGetBuilds = async (
page: Page,
projectId: string,
builds: Build[]
builds: Build[],
) => {
return page.route(
`${API_URL}/builds?projectId=${projectId}&take=10&skip=0`,
Expand All @@ -43,77 +43,77 @@ export const mockGetBuilds = async (
take: 10,
total: 3,
}),
})
}),
);
};

export const mockGetBuildDetails = async (page: Page, build: Build) => {
return page.route(`${API_URL}/builds/${build.id}`, (route) =>
route.fulfill({
body: JSON.stringify(build),
})
}),
);
};

export const mockGetTestRuns = async (
page: Page,
buildId: string,
testRuns: TestRun[]
testRuns: TestRun[],
) => {
return page.route(`${API_URL}/test-runs?buildId=${buildId}`, (route) =>
route.fulfill({
body: JSON.stringify(testRuns),
})
}),
);
};

export const mockTestRun = async (page: Page, testRun: TestRun) => {
return page.route(`${API_URL}/test-runs/${testRun.id}`, (route) =>
route.fulfill({
body: JSON.stringify(testRun),
})
}),
);
};

export const mockImage = async (page: Page, image: string) => {
return page.route(`${API_URL}/${image}`, (route) =>
route.fulfill({
path: `integration_tests/images/${image}`,
})
}),
);
};

export const mockGetUsers = async (page: Page, users: User[]) => {
return page.route(`${API_URL}/users/all`, (route) =>
route.fulfill({
body: JSON.stringify(users),
})
}),
);
};

export const mockGetTestVariations = async (
page: Page,
projectId: string,
testVariations: TestVariation[]
testVariations: TestVariation[],
) => {
return page.route(
`${API_URL}/test-variations?projectId=${projectId}`,
(route) =>
route.fulfill({
body: JSON.stringify(testVariations),
})
}),
);
};

export const mockGetTestVariationDetails = async (
page: Page,
testVariation: TestVariation
testVariation: TestVariation,
) => {
return page.route(
`${API_URL}/test-variations/details/${testVariation.id}`,
(route) =>
route.fulfill({
body: JSON.stringify(testVariation),
})
}),
);
};
2 changes: 1 addition & 1 deletion jest.transform-nothing.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default {};
export default {};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"scripts": {
"start": "node generate-env-browser.js && cp env-config.js ./public/ && vite",
"test": "jest",
"format": "prettier --write integration_tests src *.js *.ts *.md",
"build": "vite build",
"lint": "eslint --ignore-path .gitignore . --ext .ts,.tsx,.jsx,.js",
"typescheck": "tsc --noEmit",
Expand Down
6 changes: 1 addition & 5 deletions src/components/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ export const BaseModal: React.FunctionComponent<IProps> = ({
<Button onClick={onCancel} color="primary">
Cancel
</Button>
<Button
type="submit"
color="primary"
data-testId="submitButton"
>
<Button type="submit" color="primary" data-testId="submitButton">
{submitButtonText}
</Button>
</DialogActions>
Expand Down
20 changes: 10 additions & 10 deletions src/components/BuildList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const useStyles = makeStyles((theme: Theme) =>
visibility: "inherit",
},
},
})
}),
);

const BuildList: FunctionComponent = () => {
Expand All @@ -69,7 +69,7 @@ const BuildList: FunctionComponent = () => {

const handleMenuClick = (
event: React.MouseEvent<HTMLElement>,
build: Build
build: Build,
) => {
event.stopPropagation();
setAnchorEl(event.currentTarget);
Expand All @@ -90,7 +90,7 @@ const BuildList: FunctionComponent = () => {

const selectBuildCalback = React.useCallback(
(id?: string) => navigate(buildTestRunLocation(id)),
[navigate]
[navigate],
);

const handlePaginationChange = React.useCallback(
Expand All @@ -106,11 +106,11 @@ const BuildList: FunctionComponent = () => {
.catch((err: string) =>
enqueueSnackbar(err, {
variant: "error",
})
}),
);
}
},
[buildDispatch, enqueueSnackbar, selectedProjectId, take]
[buildDispatch, enqueueSnackbar, selectedProjectId, take],
);

React.useEffect(() => {
Expand Down Expand Up @@ -215,12 +215,12 @@ const BuildList: FunctionComponent = () => {
.then((b) =>
enqueueSnackbar(`${menuBuild.id} finished`, {
variant: "success",
})
}),
)
.catch((err) =>
enqueueSnackbar(err, {
variant: "error",
})
}),
);
handleMenuClose();
}}
Expand Down Expand Up @@ -273,7 +273,7 @@ const BuildList: FunctionComponent = () => {
.catch((err) =>
enqueueSnackbar(err, {
variant: "error",
})
}),
);
handleMenuClose();
}}
Expand All @@ -298,7 +298,7 @@ const BuildList: FunctionComponent = () => {
`Build #${menuBuild.number || menuBuild.id} deleted`,
{
variant: "success",
}
},
);
})
.then(() => handlePaginationChange(paginationPage))
Expand All @@ -310,7 +310,7 @@ const BuildList: FunctionComponent = () => {
.catch((err) =>
enqueueSnackbar(err, {
variant: "error",
})
}),
);
handleMenuClose();
}}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import {

const Header: FunctionComponent = () => {
const [avatarMenuRef, setAvatarMenuRef] = React.useState<null | HTMLElement>(
null
null,
);
const [helpMenuRef, setHelpMenuRef] = React.useState<null | HTMLElement>(
null
null,
);
const { loggedIn, user } = useUserState();
const authDispatch = useUserDispatch();
Expand All @@ -46,7 +46,7 @@ const Header: FunctionComponent = () => {
handleMenuClose();
window.open(
"https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/issues/new",
"_blank"
"_blank",
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const LoginForm = () => {
.catch((err) =>
enqueueSnackbar(err, {
variant: "error",
})
}),
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const RegisterForm = () => {
.catch((err) =>
enqueueSnackbar(err, {
variant: "error",
})
}),
);
};

Expand Down
18 changes: 9 additions & 9 deletions src/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ const ProfilePage = () => {
.then(() =>
enqueueSnackbar("User updated", {
variant: "success",
})
}),
)
.catch((err) =>
enqueueSnackbar(err, {
variant: "error",
})
}),
);
}
};
Expand All @@ -72,12 +72,12 @@ const ProfilePage = () => {
.then(() =>
enqueueSnackbar("Password updated", {
variant: "success",
})
}),
)
.catch((err) =>
enqueueSnackbar(err, {
variant: "error",
})
}),
);
}
};
Expand Down Expand Up @@ -110,7 +110,7 @@ const ProfilePage = () => {
inputProps={{
onChange: (event: any) =>
setFirstName(
(event.target as HTMLInputElement).value
(event.target as HTMLInputElement).value,
),
"data-testId": "firstName",
}}
Expand All @@ -131,7 +131,7 @@ const ProfilePage = () => {
inputProps={{
onChange: (event: any) =>
setLastName(
(event.target as HTMLInputElement).value
(event.target as HTMLInputElement).value,
),
"data-testId": "lastName",
}}
Expand All @@ -152,7 +152,7 @@ const ProfilePage = () => {
inputProps={{
onChange: (event: any) =>
setEmail(
(event.target as HTMLInputElement).value
(event.target as HTMLInputElement).value,
),
"data-testId": "email",
}}
Expand Down Expand Up @@ -217,7 +217,7 @@ const ProfilePage = () => {
inputProps={{
onChange: (event: any) =>
setPassword(
(event.target as HTMLInputElement).value
(event.target as HTMLInputElement).value,
),
"data-testId": "password",
}}
Expand Down Expand Up @@ -268,7 +268,7 @@ const ProfilePage = () => {
textColor="primary"
onChange={(
event: React.ChangeEvent<{}>,
newValue: number
newValue: number,
) => {
setTabIndex(newValue);
}}
Expand Down
16 changes: 8 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defineConfig} from "vite";
import { defineConfig } from "vite";

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

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

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
build: {
outDir: 'build',
sourcemap: true,
plugins: [react()],
build: {
outDir: "build",
sourcemap: true,

// https://rollupjs.org/configuration-options/
/*
// https://rollupjs.org/configuration-options/
/*
rollupOptions: {
output: {
manualChunks: manualChunks
}
}
*/
}
},
});

0 comments on commit b3976e8

Please sign in to comment.