Skip to content

Commit b311647

Browse files
committed
chore: Run prettier formatting on codebase
Signed-off-by: Andrew Burnes <[email protected]>
1 parent 0819597 commit b311647

File tree

666 files changed

+21732
-12948
lines changed

Some content is hidden

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

666 files changed

+21732
-12948
lines changed

.babelrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"presets": [
33
[
4-
"@babel/preset-env", {
4+
"@babel/preset-env",
5+
{
56
"targets": {
67
"browsers": "last 2 versions"
78
}

.cz.json

+20-12
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,27 @@
1515
"schema_pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w \\-'])+([\\s\\S]*)",
1616
"bump_pattern": "^(.+!|BREAKING CHANGE|chore|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\-\\.]+\\))?:",
1717
"bump_map": {
18-
".+!": "MAJOR",
19-
"BREAKING CHANGE": "MAJOR",
20-
"feat": "MINOR",
21-
"fix": "PATCH",
22-
"chore": "PATCH",
23-
"docs": "PATCH",
24-
"perf": "PATCH",
25-
"refactor": "PATCH",
26-
"revert": "MINOR",
27-
"style": "PATCH",
28-
"test": "PATCH"
18+
".+!": "MAJOR",
19+
"BREAKING CHANGE": "MAJOR",
20+
"feat": "MINOR",
21+
"fix": "PATCH",
22+
"chore": "PATCH",
23+
"docs": "PATCH",
24+
"perf": "PATCH",
25+
"refactor": "PATCH",
26+
"revert": "MINOR",
27+
"style": "PATCH",
28+
"test": "PATCH"
2929
},
30-
"change_type_order": ["Breaking Changes", "Added", "Fixed", "Performance", "Reverted", "Maintenance", "Documentation"],
30+
"change_type_order": [
31+
"Breaking Changes",
32+
"Added",
33+
"Fixed",
34+
"Performance",
35+
"Reverted",
36+
"Maintenance",
37+
"Documentation"
38+
],
3139
"commit_parser": "^((?P<change_type>chore|docs|feat|fix|perf|refactor|revert|style|test|BREAKING CHANGE)(?:\\((?P<scope>[^()\r\n]*)\\)|\\()?(?P<breaking>!)?|\\w+!):\\s(?P<message>.*)?",
3240
"changelog_pattern": "^(.+!|BREAKING CHANGE|chore|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\-\\.]+\\))?:",
3341
"change_type_map": {

.nycrc

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
2-
"reporter": [
3-
"lcov",
4-
"html"
5-
],
6-
"extension": [
7-
".jsx"
8-
],
2+
"reporter": ["lcov", "html"],
3+
"extension": [".jsx"],
94
"cache": true
105
}

.prettierrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"singleQuote": true
2+
"singleQuote": true,
3+
"printWidth": 90,
4+
"useTabs": false,
5+
"tabWidth": 2
36
}

Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ lint-client: ## Lint admin client code
3333

3434
lint: lint-server lint-client ## Lint project
3535

36-
lint-fix: ## lint and fix
36+
lint-fix: ## lint and fix
3737
docker compose run --rm app yarn lint --fix
3838

39+
format:
40+
docker compose run --rm app yarn format
41+
42+
format-check:
43+
docker compose run --rm app yarn format:check
44+
3945
migrate: ## Run database migrations
4046
docker compose run --rm app yarn migrate:up
4147

@@ -70,4 +76,4 @@ everything: # When you switch to a new branch and need to rebuild everything
7076
make install
7177
make migrate
7278
make seed
73-
make start
79+
make start

admin-client/eslint.config.mjs

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ import pluginJs from '@eslint/js';
33
import eslintPluginSvelte from 'eslint-plugin-svelte';
44

55
export default [
6-
{ languageOptions: { globals: { ...globals.browser, process: false } } },
6+
{
7+
languageOptions: {
8+
globals: {
9+
...globals.browser,
10+
process: false,
11+
},
12+
},
13+
},
714
{ files: ['**/*.svelte'] },
815
{
916
ignores: ['public/build', 'rollup.config.js'],

admin-client/public/index.html

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<!doctype html>
2-
<html lang='en'>
3-
<head>
4-
<meta charset='utf-8'>
5-
<meta name='viewport' content='width=device-width,initial-scale=1.0'>
6-
<meta name='theme-color' content='#333333'>
7-
<link rel="shortcut icon" href="/favicon.ico">
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
6+
<meta name="theme-color" content="#333333" />
7+
<link rel="shortcut icon" href="/favicon.ico" />
88

9-
<title>Pages Admin</title>
10-
<link rel='stylesheet' href='/uswds.min.css'>
11-
<link rel='stylesheet' href='/devtools.css'>
12-
<link rel='stylesheet' href='/build/bundle.css'>
9+
<title>Pages Admin</title>
10+
<link rel="stylesheet" href="/uswds.min.css" />
11+
<link rel="stylesheet" href="/devtools.css" />
12+
<link rel="stylesheet" href="/build/bundle.css" />
1313

14-
<script type="module" defer src='/build/bundle.js'></script>
15-
</head>
16-
<body>
17-
</body>
14+
<script type="module" defer src="/build/bundle.js"></script>
15+
</head>
16+
<body></body>
1817
</html>

admin-client/rollup.config.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ export default {
5959
dest: 'public',
6060
},
6161
{
62-
src: [
63-
`${uswds}/css/uswds.min.css`,
64-
`${uswds}/css/uswds.min.css.map`,
65-
],
62+
src: [`${uswds}/css/uswds.min.css`, `${uswds}/css/uswds.min.css.map`],
6663
dest: 'public',
6764
},
6865
],

admin-client/src/flows/destroySite.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ function destroy(site) {
77
try {
88
await destroySite(site.id);
99
page('/sites');
10-
return notification.setSuccess(`Site ${site.id}: ${site.repository} deleted successfully!`);
10+
return notification.setSuccess(
11+
`Site ${site.id}: ${site.repository} deleted successfully!`,
12+
);
1113
} catch (error) {
1214
return notification.setError(`Unable to delete site ${site.id}: ${error.message}`);
1315
}

admin-client/src/flows/organizations.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import { notification } from '../stores';
33
import { deactivateOrganization, activateOrganization } from '../lib/api';
44

55
async function deactivate(id, redirectTo) {
6-
if (!window.confirm('Are you sure you want to deactivate this organization?')) { return null; }
6+
if (!window.confirm('Are you sure you want to deactivate this organization?')) {
7+
return null;
8+
}
79
try {
810
await deactivateOrganization(id);
911
page(redirectTo);
1012
return notification.setSuccess(`Organization ${id} deactivated successfully!`);
1113
} catch (error) {
12-
return notification.setError(`Unable to deactivate organization ${id}: ${error.message}`);
14+
return notification.setError(
15+
`Unable to deactivate organization ${id}: ${error.message}`,
16+
);
1317
}
1418
}
1519

@@ -19,7 +23,9 @@ async function activate(id, redirectTo) {
1923
page(redirectTo);
2024
return notification.setSuccess(`Organization ${id} activated successfully!`);
2125
} catch (error) {
22-
return notification.setError(`Unable to activate organization ${id}: ${error.message}`);
26+
return notification.setError(
27+
`Unable to activate organization ${id}: ${error.message}`,
28+
);
2329
}
2430
}
2531

admin-client/src/helpers/downloadCSV.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export const downloadCSV = async (fetchCSV, filename) => {
22
const csv = await fetchCSV();
3-
const blob = new Blob([csv], { type: 'application/octet-stream' });
3+
const blob = new Blob([csv], {
4+
type: 'application/octet-stream',
5+
});
46
const aElement = document.createElement('a');
57
aElement.setAttribute('download', filename);
68
const href = URL.createObjectURL(blob);

admin-client/src/lib/api.js

+61-37
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,35 @@ function _setSearchString(query = {}) {
2121
return search.toString();
2222
}
2323

24-
async function _fetch(path, fetchOpts = {}, apiOpts = { handleError: true }) {
25-
const fetchOptions = { ...defaultOptions, ...fetchOpts };
24+
async function _fetch(
25+
path,
26+
fetchOpts = {},
27+
apiOpts = {
28+
handleError: true,
29+
},
30+
) {
31+
const fetchOptions = {
32+
...defaultOptions,
33+
...fetchOpts,
34+
};
2635
if (!['GET', 'HEAD', 'OPTIONS'].includes(fetchOptions.method)) {
2736
fetchOptions.headers['x-csrf-token'] = session.csrfToken();
2837
}
2938

30-
let request = fetch(`${apiUrl}/admin${path}`, fetchOptions)
31-
.then(async (r) => {
32-
if (r.ok) return r.json();
33-
if (r.status === 401) {
34-
authLogout();
35-
return null;
36-
}
37-
if (r.status === 422) {
38-
const json = await r.json();
39-
const error = new Error(json.message || r.statusText);
40-
error.errors = json.errors;
41-
throw error;
42-
}
43-
throw new Error(r.statusText);
44-
});
39+
let request = fetch(`${apiUrl}/admin${path}`, fetchOptions).then(async (r) => {
40+
if (r.ok) return r.json();
41+
if (r.status === 401) {
42+
authLogout();
43+
return null;
44+
}
45+
if (r.status === 422) {
46+
const json = await r.json();
47+
const error = new Error(json.message || r.statusText);
48+
error.errors = json.errors;
49+
throw error;
50+
}
51+
throw new Error(r.statusText);
52+
});
4553

4654
if (apiOpts.handleError) {
4755
request = request.catch((e) => {
@@ -55,24 +63,25 @@ async function _fetch(path, fetchOpts = {}, apiOpts = { handleError: true }) {
5563
}
5664

5765
async function _fetchAttachedFile(path) {
58-
const fetchOptions = { ...defaultOptions };
66+
const fetchOptions = {
67+
...defaultOptions,
68+
};
5969
fetchOptions.headers['x-csrf-token'] = session.csrfToken();
6070

61-
let request = fetch(`${apiUrl}/admin${path}`, fetchOptions)
62-
.then(async (r) => {
63-
if (r.ok) return r.text();
64-
if (r.status === 401) {
65-
authLogout();
66-
return null;
67-
}
68-
if (r.status === 422) {
69-
const json = await r.json();
70-
const error = new Error(json.message || r.statusText);
71-
error.errors = json.errors;
72-
throw error;
73-
}
74-
throw new Error(r.statusText);
75-
});
71+
let request = fetch(`${apiUrl}/admin${path}`, fetchOptions).then(async (r) => {
72+
if (r.ok) return r.text();
73+
if (r.status === 401) {
74+
authLogout();
75+
return null;
76+
}
77+
if (r.status === 422) {
78+
const json = await r.json();
79+
const error = new Error(json.message || r.statusText);
80+
error.errors = json.errors;
81+
throw error;
82+
}
83+
throw new Error(r.statusText);
84+
});
7685

7786
request = request.catch((e) => {
7887
notification.setError(`API request failed: ${e.message}`);
@@ -84,7 +93,10 @@ async function _fetchAttachedFile(path) {
8493
}
8594

8695
function destroy(path, body) {
87-
return _fetch(path, { method: 'DELETE', body: JSON.stringify(body) });
96+
return _fetch(path, {
97+
method: 'DELETE',
98+
body: JSON.stringify(body),
99+
});
88100
}
89101

90102
function get(path, query) {
@@ -101,11 +113,21 @@ function getAttachedFile(path) {
101113
}
102114

103115
function post(path, body = {}, opts = {}) {
104-
return _fetch(path, { method: 'POST', body: JSON.stringify(body) }, opts);
116+
return _fetch(
117+
path,
118+
{
119+
method: 'POST',
120+
body: JSON.stringify(body),
121+
},
122+
opts,
123+
);
105124
}
106125

107126
function put(path, body) {
108-
return _fetch(path, { method: 'PUT', body: JSON.stringify(body) });
127+
return _fetch(path, {
128+
method: 'PUT',
129+
body: JSON.stringify(body),
130+
});
109131
}
110132

111133
async function destroySite(id) {
@@ -117,7 +139,9 @@ async function fetchMe() {
117139
}
118140

119141
function fetchBuildLogEventSource(id, onMessage) {
120-
const es = new EventSource(`${apiUrl}/admin/builds/${id}/log`, { withCredentials: true });
142+
const es = new EventSource(`${apiUrl}/admin/builds/${id}/log`, {
143+
withCredentials: true,
144+
});
121145
es.addEventListener('message', onMessage);
122146
es.addEventListener('error', (error) => {
123147
console.error('EventSource failed:', error);

admin-client/src/lib/auth.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ function externalAuth(path, action, hidden = false) {
1919
if (hidden) {
2020
opts = 'width=1,height=1,top=0,left=0';
2121
} else {
22-
const {
23-
width, height, top, left,
24-
} = calcWindow();
22+
const { width, height, top, left } = calcWindow();
2523
opts = `resizable=yes,scrollbars=yes,width=${width},height=${height},top=${top},left=${left}`;
2624
}
2725

@@ -76,10 +74,4 @@ function logout() {
7674
page('/login');
7775
}
7876

79-
export {
80-
authenticate,
81-
deauthenticate,
82-
init,
83-
login,
84-
logout,
85-
};
77+
export { authenticate, deauthenticate, init, login, logout };

0 commit comments

Comments
 (0)