Skip to content

Commit 1aa27f0

Browse files
authored
Merge pull request #56 from Visual-Regression-Tracker/52-project-id
Code formating updated
2 parents d372ebe + e1494d8 commit 1aa27f0

28 files changed

+718
-199
lines changed

package-lock.json

Lines changed: 515 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
"@testing-library/jest-dom": "^5.11.1",
1010
"@testing-library/react": "^10.4.7",
1111
"@testing-library/user-event": "^12.0.11",
12+
"husky": "^4.2.5",
1213
"konva": "^7.0.3",
14+
"lint-staged": "^10.2.11",
1315
"material-ui-popup-state": "^1.6.1",
1416
"notistack": "^0.9.17",
17+
"prettier": "^2.0.5",
1518
"qs": "^6.9.4",
1619
"react": "^16.13.1",
1720
"react-debounce-input": "^3.2.2",
@@ -43,6 +46,16 @@
4346
"last 1 safari version"
4447
]
4548
},
49+
"husky": {
50+
"hooks": {
51+
"pre-commit": "lint-staged"
52+
}
53+
},
54+
"lint-staged": {
55+
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
56+
"prettier --write"
57+
]
58+
},
4659
"devDependencies": {
4760
"@types/jest": "^26.0.5",
4861
"@types/node": "^13.13.0",

src/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { SnackbarProvider } from 'notistack';
2+
import { SnackbarProvider } from "notistack";
33
import "./App.css";
44
import Header from "./components/Header";
55
import {

src/App.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from 'react';
2-
import { render } from '@testing-library/react';
3-
import App from './App';
1+
import React from "react";
2+
import { render } from "@testing-library/react";
3+
import App from "./App";
44

5-
test('renders learn react link', () => {
5+
test("renders learn react link", () => {
66
const { getByText } = render(<App />);
77
const linkElement = getByText(/learn react/i);
88
expect(linkElement).toBeInTheDocument();

src/_config/api.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const API_URL = process.env.REACT_APP_API_URL
1+
export const API_URL = process.env.REACT_APP_API_URL;

src/_helpers/service.helpers.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import { usersService } from '../services'
2-
import { User } from '../types';
1+
import { usersService } from "../services";
2+
import { User } from "../types";
33

44
export function authHeader() {
5-
// return authorization header with jwt token
6-
const userString = localStorage.getItem('user')
7-
if (userString) {
8-
const user: User = JSON.parse(userString);
9-
if (user && user.token) {
10-
return { 'Authorization': 'Bearer ' + user.token };
11-
}
5+
// return authorization header with jwt token
6+
const userString = localStorage.getItem("user");
7+
if (userString) {
8+
const user: User = JSON.parse(userString);
9+
if (user && user.token) {
10+
return { Authorization: "Bearer " + user.token };
1211
}
13-
return [];
12+
}
13+
return [];
1414
}
1515

1616
export function handleResponse(response: Response) {
17-
return response.text().then((text: string) => {
18-
const data = text && JSON.parse(text);
19-
if (!response.ok) {
20-
if (response.status === 401) {
21-
// auto logout if 401 response returned from api
22-
usersService.logout();
23-
window.location.reload();
24-
}
17+
return response.text().then((text: string) => {
18+
const data = text && JSON.parse(text);
19+
if (!response.ok) {
20+
if (response.status === 401) {
21+
// auto logout if 401 response returned from api
22+
usersService.logout();
23+
window.location.reload();
24+
}
2525

26-
const error = (data && data.message) || response.statusText;
27-
return Promise.reject(error);
28-
}
26+
const error = (data && data.message) || response.statusText;
27+
return Promise.reject(error);
28+
}
2929

30-
return data;
31-
});
32-
}
30+
return data;
31+
});
32+
}

src/components/DateFormated.tsx

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/components/DrawArea.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ export const DrawArea: FunctionComponent<IDrawArea> = ({
126126
<React.Fragment>
127127
<Grid container direction="column">
128128
<Grid item>
129-
<ImageDetails type={type} branchName={branchName} imageName={imageName} />
129+
<ImageDetails
130+
type={type}
131+
branchName={branchName}
132+
imageName={imageName}
133+
/>
130134
</Grid>
131135
{imageStatus === "loading" && (
132136
<Grid

src/components/PrivateRoute.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ import { useAuthState } from "../contexts";
44
import { routes } from "../constants";
55

66
const PrivateRoute: React.SFC<RouteProps> = ({
7-
component: Component,
8-
...rest
7+
component: Component,
8+
...rest
99
}) => {
10-
const { loggedIn } = useAuthState();
11-
if (!Component) {
12-
return null;
13-
}
14-
return (
15-
<Route
16-
{...rest}
17-
render={(props) =>
18-
loggedIn ? (
19-
<Component {...props} />
20-
) : (
21-
<Redirect
22-
to={{ pathname: routes.LOGIN, state: { from: props.location } }}
23-
/>
24-
)
25-
}
26-
/>
27-
);
10+
const { loggedIn } = useAuthState();
11+
if (!Component) {
12+
return null;
13+
}
14+
return (
15+
<Route
16+
{...rest}
17+
render={(props) =>
18+
loggedIn ? (
19+
<Component {...props} />
20+
) : (
21+
<Redirect
22+
to={{ pathname: routes.LOGIN, state: { from: props.location } }}
23+
/>
24+
)
25+
}
26+
/>
27+
);
2828
};
2929

3030
export default PrivateRoute;

src/components/TestRunDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const TestRunDetails: React.FunctionComponent<IProps> = ({
1616
<Typography>OS: {testRun.os}</Typography>
1717
</Grid>
1818
)}
19-
{testRun.device && (
19+
{testRun.device && (
2020
<Grid item>
2121
<Typography>Device: {testRun.device}</Typography>
2222
</Grid>

0 commit comments

Comments
 (0)