Skip to content

Commit 4a05730

Browse files
committed
style: run linter
1 parent 8adba0f commit 4a05730

7 files changed

Lines changed: 93 additions & 172 deletions

File tree

‎apps/meridian/app/pages/dashboard/[slug]/index.vue‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ interface ErrorsResponse {
8282
8383
const { data: errorsData } = await useAsyncData<ErrorsResponse | null>(
8484
`project-errors-${slug.value}`,
85-
() => (project.value ? requestFetch<ErrorsResponse>(`/api/v3/projects/${project.value.id}/errors`) : Promise.resolve(null)),
85+
() =>
86+
project.value ? requestFetch<ErrorsResponse>(`/api/v3/projects/${project.value.id}/errors`) : Promise.resolve(null),
8687
{ watch: [project] },
8788
);
8889
@@ -131,7 +132,9 @@ const { data: geography } = await useAsyncData<GeographyResponse | null>(
131132
`project-geography-${slug.value}`,
132133
() =>
133134
project.value?.type === 'server'
134-
? requestFetch<GeographyResponse>(`/api/v3/projects/${project.value.id}/geography`, { query: { range: range.value } })
135+
? requestFetch<GeographyResponse>(`/api/v3/projects/${project.value.id}/geography`, {
136+
query: { range: range.value },
137+
})
135138
: Promise.resolve(null),
136139
{ watch: [range, project] },
137140
);

‎apps/meridian/app/pages/dashboard/[slug]/players.vue‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const stats = computed(() => [
4040
hint: 'Never seen on this server before',
4141
},
4242
]);
43-
4443
</script>
4544

4645
<template>
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
export function parseClickhouseDate(value: string): Date {
2-
if (!value) return new Date(NaN);
3-
if (value.endsWith('Z') || /[+-]\d{2}:?\d{2}$/.test(value)) return new Date(value);
4-
const iso = value.includes('T') ? value : value.replace(' ', 'T');
5-
return new Date(`${iso}Z`);
2+
if (!value) return new Date(NaN);
3+
if (value.endsWith('Z') || /[+-]\d{2}:?\d{2}$/.test(value)) return new Date(value);
4+
const iso = value.includes('T') ? value : value.replace(' ', 'T');
5+
return new Date(`${iso}Z`);
66
}
77

88
export function relativeTime(value: string): string {
9-
const diff = Date.now() - parseClickhouseDate(value).getTime();
10-
const m = Math.floor(diff / 60000);
11-
if (m < 1) return 'just now';
12-
if (m < 60) return `${m}m ago`;
13-
const h = Math.floor(m / 60);
14-
if (h < 24) return `${h}h ago`;
15-
return `${Math.floor(h / 24)}d ago`;
9+
const diff = Date.now() - parseClickhouseDate(value).getTime();
10+
const m = Math.floor(diff / 60000);
11+
if (m < 1) return 'just now';
12+
if (m < 60) return `${m}m ago`;
13+
const h = Math.floor(m / 60);
14+
if (h < 24) return `${h}h ago`;
15+
return `${Math.floor(h / 24)}d ago`;
1616
}
1717

1818
export function formatAbsolute(value: string): string {
19-
return parseClickhouseDate(value).toLocaleString();
19+
return parseClickhouseDate(value).toLocaleString();
2020
}

‎apps/meridian/server/api/v3/projects/[id]/errors.get.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ export default defineEventHandler(async event => {
2525
const id = requireParam(event, 'id');
2626
const query = getQuery(event);
2727

28-
const status = (typeof query.status === 'string' ? query.status : 'unresolved') as
29-
| 'unresolved'
30-
| 'resolved'
31-
| 'all';
28+
const status = (typeof query.status === 'string' ? query.status : 'unresolved') as 'unresolved' | 'resolved' | 'all';
3229
const sortKey = (typeof query.sort === 'string' && SORT_COLUMNS[query.sort] ? query.sort : 'last_seen') as
3330
| 'last_seen'
3431
| 'first_seen'

‎apps/meridian/server/utils/version-utils.ts‎

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,58 @@
44
// Newer versions sort before older ones; pre-release < rc < release.
55

66
interface ParsedVersion {
7-
major: number;
8-
minor: number;
9-
patch: number;
10-
preRelease: 'pre' | 'rc' | null;
11-
preNumber: number;
7+
major: number;
8+
minor: number;
9+
patch: number;
10+
preRelease: 'pre' | 'rc' | null;
11+
preNumber: number;
1212
}
1313

1414
const VERSION_RE = /^(\d+)\.(\d+)(?:\.(\d+))?(?:-(pre|rc)(\d+))?$/;
1515

1616
function toInt(value: string | undefined): number {
17-
if (!value) return 0;
18-
const n = parseInt(value, 10);
19-
return Number.isNaN(n) ? 0 : n;
17+
if (!value) return 0;
18+
const n = parseInt(value, 10);
19+
return Number.isNaN(n) ? 0 : n;
2020
}
2121

2222
function parseVersion(version: string): ParsedVersion {
23-
const match = version.match(VERSION_RE);
24-
if (!match) return { major: 0, minor: 0, patch: 0, preRelease: null, preNumber: 0 };
25-
return {
26-
major: toInt(match[1]),
27-
minor: toInt(match[2]),
28-
patch: toInt(match[3]),
29-
preRelease: (match[4] as 'pre' | 'rc' | undefined) ?? null,
30-
preNumber: toInt(match[5]),
31-
};
23+
const match = version.match(VERSION_RE);
24+
if (!match) return { major: 0, minor: 0, patch: 0, preRelease: null, preNumber: 0 };
25+
return {
26+
major: toInt(match[1]),
27+
minor: toInt(match[2]),
28+
patch: toInt(match[3]),
29+
preRelease: (match[4] as 'pre' | 'rc' | undefined) ?? null,
30+
preNumber: toInt(match[5]),
31+
};
3232
}
3333

3434
function compareVersions(a: string, b: string): number {
35-
const vA = parseVersion(a);
36-
const vB = parseVersion(b);
37-
if (vA.major !== vB.major) return vB.major - vA.major;
38-
if (vA.minor !== vB.minor) return vB.minor - vA.minor;
39-
if (vA.patch !== vB.patch) return vB.patch - vA.patch;
40-
if (vA.preRelease === null && vB.preRelease !== null) return -1;
41-
if (vA.preRelease !== null && vB.preRelease === null) return 1;
42-
if (vA.preRelease !== vB.preRelease) {
43-
if (vA.preRelease === 'rc' && vB.preRelease === 'pre') return -1;
44-
if (vA.preRelease === 'pre' && vB.preRelease === 'rc') return 1;
45-
}
46-
return vB.preNumber - vA.preNumber;
35+
const vA = parseVersion(a);
36+
const vB = parseVersion(b);
37+
if (vA.major !== vB.major) return vB.major - vA.major;
38+
if (vA.minor !== vB.minor) return vB.minor - vA.minor;
39+
if (vA.patch !== vB.patch) return vB.patch - vA.patch;
40+
if (vA.preRelease === null && vB.preRelease !== null) return -1;
41+
if (vA.preRelease !== null && vB.preRelease === null) return 1;
42+
if (vA.preRelease !== vB.preRelease) {
43+
if (vA.preRelease === 'rc' && vB.preRelease === 'pre') return -1;
44+
if (vA.preRelease === 'pre' && vB.preRelease === 'rc') return 1;
45+
}
46+
return vB.preNumber - vA.preNumber;
4747
}
4848

4949
// Group key: `major.minor`. For 1.20.1 → "1.20"; for 26.1.2 → "26.1".
5050
// 26.1 and 26.1.2 land in the same group; 26.2 is its own group.
5151
export function groupVersions(versionKeys: string[]): Record<string, string[]> {
52-
const sorted = [...versionKeys].sort(compareVersions);
53-
const groups: Record<string, string[]> = {};
54-
for (const version of sorted) {
55-
const { major, minor } = parseVersion(version);
56-
const key = `${major}.${minor}`;
57-
if (!groups[key]) groups[key] = [];
58-
groups[key].push(version);
59-
}
60-
return groups;
52+
const sorted = [...versionKeys].sort(compareVersions);
53+
const groups: Record<string, string[]> = {};
54+
for (const version of sorted) {
55+
const { major, minor } = parseVersion(version);
56+
const key = `${major}.${minor}`;
57+
if (!groups[key]) groups[key] = [];
58+
groups[key].push(version);
59+
}
60+
return groups;
6161
}

0 commit comments

Comments
 (0)