Skip to content

Commit 8ea254b

Browse files
authored
Merge pull request #1594 from Kobzol/npm-fmt
Add code formatter for frontend
2 parents 1a0c542 + 064be13 commit 8ea254b

Some content is hidden

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

42 files changed

+1965
-1367
lines changed

site/frontend/.prettierrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"bracketSpacing": false,
3+
"tabWidth": 2
4+
}

site/frontend/package-lock.json

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

site/frontend/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"scripts": {
66
"watch": "parcel watch",
77
"build": "parcel build",
8-
"check": "tsc -p tsconfig.json --noEmit"
8+
"fmt": "prettier --write src",
9+
"check": "tsc -p tsconfig.json --noEmit && prettier --check src"
910
},
1011
"author": "",
1112
"license": "MIT",
@@ -14,6 +15,7 @@
1415
"@parcel/transformer-vue": "^2.8.3",
1516
"@types/highcharts": "^7.0.0",
1617
"@types/msgpack-lite": "^0.1.8",
18+
"prettier": "2.8.8",
1719
"typescript": "^5.0.2"
1820
},
1921
"dependencies": {

site/frontend/src/components/as-of.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import {BenchmarkInfo} from "../api";
33
44
const props = defineProps<{
5-
info: BenchmarkInfo
5+
info: BenchmarkInfo;
66
}>();
77
</script>
88
<template>

site/frontend/src/components/with-suspense.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import {Suspense} from "vue";
33
44
const props = defineProps<{
5-
component: Object
5+
component: Object;
66
}>();
77
const component = props.component as any;
88
</script>

site/frontend/src/pages/bootstrap/data-selector.vue

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,40 @@
22
import {onMounted, ref} from "vue";
33
44
export interface SelectionParams {
5-
start: string;
6-
end: string;
5+
start: string;
6+
end: string;
77
}
88
99
const props = defineProps<SelectionParams>();
1010
1111
const emit = defineEmits<{
12-
(e: "change", params: SelectionParams): void
12+
(e: "change", params: SelectionParams): void;
1313
}>();
1414
1515
const startRef = ref<HTMLInputElement | null>(null);
1616
const endRef = ref<HTMLInputElement | null>(null);
1717
1818
onMounted(() => {
19-
startRef.value.value = props.start;
20-
endRef.value.value = props.end;
21-
})
19+
startRef.value.value = props.start;
20+
endRef.value.value = props.end;
21+
});
2222
2323
function submitSettings() {
24-
const start = startRef.value.value;
25-
const end = endRef.value.value;
24+
const start = startRef.value.value;
25+
const end = endRef.value.value;
2626
27-
const params = { start, end };
28-
emit("change", params);
27+
const params = {start, end};
28+
emit("change", params);
2929
}
3030
</script>
3131

3232
<template>
3333
<div id="settings">
34-
start: <input placeholder="yyyy-mm-dd or commit" ref="startRef" />
35-
end: <input placeholder="yyyy-mm-dd or commit" ref="endRef" />&nbsp;<a href="#" @click.prevent="submitSettings">Submit</a>
34+
start: <input placeholder="yyyy-mm-dd or commit" ref="startRef" /> end:
35+
<input placeholder="yyyy-mm-dd or commit" ref="endRef" />&nbsp;<a
36+
href="#"
37+
@click.prevent="submitSettings"
38+
>Submit</a
39+
>
3640
</div>
3741
</template>

site/frontend/src/pages/bootstrap/page.vue

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@ import {withLoading} from "../../utils/loading";
55
import {renderPlots} from "./plots";
66
import {BootstrapData, BootstrapSelector} from "./state";
77
import {BOOTSTRAP_DATA_URL} from "../../urls";
8-
import {createUrlWithAppendedParams, getUrlParams, navigateToUrlParams} from "../../utils/navigation";
8+
import {
9+
createUrlWithAppendedParams,
10+
getUrlParams,
11+
navigateToUrlParams,
12+
} from "../../utils/navigation";
913
1014
import {postJson} from "../../utils/requests";
1115
12-
async function loadBootstrapData(selector: BootstrapSelector, loading: Ref<boolean>) {
13-
const bootstrapData: BootstrapData = await withLoading(loading, () => postJson<BootstrapData>(BOOTSTRAP_DATA_URL, selector));
16+
async function loadBootstrapData(
17+
selector: BootstrapSelector,
18+
loading: Ref<boolean>
19+
) {
20+
const bootstrapData: BootstrapData = await withLoading(loading, () =>
21+
postJson<BootstrapData>(BOOTSTRAP_DATA_URL, selector)
22+
);
1423
1524
// Wait for the UI to be updated, which also resets the plot HTML elements.
1625
// Then draw the plots.
@@ -24,15 +33,17 @@ function loadSelectorFromUrl(urlParams: Dict<string>): BootstrapSelector {
2433
return {
2534
start,
2635
end,
27-
min_seconds: 25
36+
min_seconds: 25,
2837
};
2938
}
3039
3140
function updateSelection(params: SelectionParams) {
32-
navigateToUrlParams(createUrlWithAppendedParams({
33-
start: params.start,
34-
end: params.end
35-
}).searchParams);
41+
navigateToUrlParams(
42+
createUrlWithAppendedParams({
43+
start: params.start,
44+
end: params.end,
45+
}).searchParams
46+
);
3647
}
3748
3849
const loading = ref(true);
@@ -42,16 +53,19 @@ loadBootstrapData(selector, loading);
4253
</script>
4354

4455
<template>
45-
<DataSelector :start="selector.start" :end="selector.end"
46-
@change="updateSelection"></DataSelector>
56+
<DataSelector
57+
:start="selector.start"
58+
:end="selector.end"
59+
@change="updateSelection"
60+
></DataSelector>
4761
<div v-if="loading" id="loading">
4862
<h2>Loading &amp; rendering data..</h2>
4963
<h3>This may take a while!</h3>
5064
</div>
5165
<div v-else>
5266
<div>
53-
See <a href="/compare.html">compare page</a> for descriptions of what
54-
the names mean.
67+
See <a href="/compare.html">compare page</a> for descriptions of what the
68+
names mean.
5569
</div>
5670
<div id="byCrateChart"></div>
5771
<div id="totalChart"></div>

0 commit comments

Comments
 (0)