Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 820888b

Browse files
author
Noah Lee
authored
Add prettier to styling codes in the ui/ directory. (#429)
* Install prettier * Run prettier * Add prettier script to package.json
1 parent 38bf3b2 commit 820888b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+7095
-6305
lines changed

Diff for: ui/.eslintrc.js

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
module.exports = {
2-
root: true,
3-
parser: '@typescript-eslint/parser',
4-
plugins: [
5-
'@typescript-eslint',
6-
],
7-
extends: [
8-
'eslint:recommended',
9-
'plugin:@typescript-eslint/recommended',
10-
],
11-
rules: {
12-
"@typescript-eslint/no-explicit-any": "off",
13-
"@typescript-eslint/no-empty-interface": "off"
14-
},
15-
};
16-
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
plugins: ['@typescript-eslint'],
5+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
6+
rules: {
7+
'@typescript-eslint/no-explicit-any': 'off',
8+
'@typescript-eslint/no-empty-interface': 'off',
9+
},
10+
};

Diff for: ui/.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
coverage

Diff for: ui/.prettierrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"tabWidth": 2,
3+
"semi": true,
4+
"singleQuote": true
5+
}

Diff for: ui/craco.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
options: {
88
lessLoaderOptions: {
99
lessOptions: {
10-
modifyVars: {
10+
modifyVars: {
1111
// Custom theme
1212
// https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less
1313
// Colors
@@ -17,13 +17,13 @@ module.exports = {
1717
// Layout
1818
'@layout-header-background': '@purple-10',
1919
'@layout-body-background': '#fff',
20-
//
21-
'@border-radius-base': '5px'
20+
//
21+
'@border-radius-base': '5px',
2222
},
2323
javascriptEnabled: true,
2424
},
2525
},
2626
},
2727
},
2828
],
29-
};
29+
};

Diff for: ui/package-lock.json

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ui/package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"@testing-library/user-event": "^12.8.3",
1111
"antd": "^4.16.1",
1212
"craco-less": "^1.17.1",
13+
"follow-redirects": "^1.14.7",
1314
"http-status-codes": "^2.1.4",
1415
"lodash.debounce": "^4.0.8",
1516
"moment": "^2.29.1",
@@ -19,15 +20,15 @@
1920
"react-redux": "^7.2.4",
2021
"react-router-dom": "^5.2.0",
2122
"react-scripts": "4.0.3",
22-
"web-vitals": "^1.1.2",
23-
"follow-redirects": "^1.14.7"
23+
"web-vitals": "^1.1.2"
2424
},
2525
"scripts": {
2626
"start": "craco start",
2727
"build": "craco build",
2828
"test": "craco test",
2929
"eject": "craco eject",
30-
"lint": "npx eslint . --ext .ts,.tsx"
30+
"lint": "npx eslint . --ext .ts,.tsx",
31+
"prettier": "npx prettier --write ."
3132
},
3233
"eslintConfig": {
3334
"extends": [
@@ -58,6 +59,7 @@
5859
"@typescript-eslint/eslint-plugin": "^4.28.4",
5960
"@typescript-eslint/parser": "^4.28.4",
6061
"eslint": "^7.31.0",
62+
"prettier": "2.6.2",
6163
"typescript": "^4.3.5"
6264
}
6365
}

Diff for: ui/public/index.html

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<meta name="theme-color" content="#000000" />
7-
<meta
8-
name="description"
9-
content="Deploy Application safe and fast."
10-
/>
7+
<meta name="description" content="Deploy Application safe and fast." />
118
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
129
<!--
1310
manifest.json provides metadata used when your web app is installed on a

Diff for: ui/src/App.less

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
// Override border of code.
2222
&-code {
2323
> code {
24-
border: 0
24+
border: 0;
2525
}
2626
}
2727

2828
&-quote {
29-
padding: 0 0 0 .6em;
30-
border-left: 4px solid rgba(100,100,100,.2);
31-
opacity: .85;
29+
padding: 0 0 0 0.6em;
30+
border-left: 4px solid rgba(100, 100, 100, 0.2);
31+
opacity: 0.85;
3232
}
3333
}

Diff for: ui/src/App.tsx

+37-41
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,43 @@
1-
import './App.less'
2-
import {
3-
BrowserRouter as Router,
4-
Switch,
5-
Route,
6-
} from "react-router-dom";
1+
import './App.less';
2+
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
73

8-
import Home from "./views/home"
9-
import Repo from "./views/repo"
10-
import Deployment from "./views/deployment"
11-
import Settings from "./views/settings"
12-
import Members from "./views/members"
13-
import Activities from "./views/activities"
4+
import Home from './views/home';
5+
import Repo from './views/repo';
6+
import Deployment from './views/deployment';
7+
import Settings from './views/settings';
8+
import Members from './views/members';
9+
import Activities from './views/activities';
1410

1511
function App(): JSX.Element {
16-
return (
17-
<div className="App">
18-
<Router>
19-
<Switch>
20-
<Route path="/:namespace/:name/deployments/:number">
21-
<Deployment />
22-
</Route>
23-
<Route path="/:namespace/:name/:tab">
24-
<Repo />
25-
</Route>
26-
<Route path="/:namespace/:name">
27-
<Repo />
28-
</Route>
29-
<Route path="/settings">
30-
<Settings />
31-
</Route>
32-
<Route path="/members">
33-
<Members />
34-
</Route>
35-
<Route path="/activities">
36-
<Activities />
37-
</Route>
38-
<Route path="/">
39-
<Home />
40-
</Route>
41-
</Switch>
42-
</Router>
43-
</div>
44-
);
12+
return (
13+
<div className="App">
14+
<Router>
15+
<Switch>
16+
<Route path="/:namespace/:name/deployments/:number">
17+
<Deployment />
18+
</Route>
19+
<Route path="/:namespace/:name/:tab">
20+
<Repo />
21+
</Route>
22+
<Route path="/:namespace/:name">
23+
<Repo />
24+
</Route>
25+
<Route path="/settings">
26+
<Settings />
27+
</Route>
28+
<Route path="/members">
29+
<Members />
30+
</Route>
31+
<Route path="/activities">
32+
<Activities />
33+
</Route>
34+
<Route path="/">
35+
<Home />
36+
</Route>
37+
</Switch>
38+
</Router>
39+
</div>
40+
);
4541
}
4642

4743
export default App;

Diff for: ui/src/apis/_base.ts

+22-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
import { StatusCodes } from "http-status-codes"
2-
import { HttpInternalServerError, HttpUnauthorizedError, HttpPaymentRequiredError } from "../models/errors"
1+
import { StatusCodes } from 'http-status-codes';
2+
import {
3+
HttpInternalServerError,
4+
HttpUnauthorizedError,
5+
HttpPaymentRequiredError,
6+
} from '../models/errors';
37

4-
export const _fetch = async (input: RequestInfo, init?: RequestInit): Promise<Response> => {
5-
const response = await fetch(input, init)
6-
7-
// Throw exception when the general status code is received.
8-
if (response.status === StatusCodes.INTERNAL_SERVER_ERROR) {
9-
throw new HttpInternalServerError("The internal server error occurs.")
10-
} else if (response.status === StatusCodes.UNAUTHORIZED) {
11-
throw new HttpUnauthorizedError("The session is expired.")
12-
} else if (response.status === StatusCodes.PAYMENT_REQUIRED) {
13-
throw new HttpPaymentRequiredError("The license is expired.")
14-
}
8+
export const _fetch = async (
9+
input: RequestInfo,
10+
init?: RequestInit
11+
): Promise<Response> => {
12+
const response = await fetch(input, init);
1513

16-
return response
17-
}
14+
// Throw exception when the general status code is received.
15+
if (response.status === StatusCodes.INTERNAL_SERVER_ERROR) {
16+
throw new HttpInternalServerError('The internal server error occurs.');
17+
} else if (response.status === StatusCodes.UNAUTHORIZED) {
18+
throw new HttpUnauthorizedError('The session is expired.');
19+
} else if (response.status === StatusCodes.PAYMENT_REQUIRED) {
20+
throw new HttpPaymentRequiredError('The license is expired.');
21+
}
22+
23+
return response;
24+
};

0 commit comments

Comments
 (0)