Skip to content

Commit ecb5e5b

Browse files
committed
chore: lint
1 parent 4770faa commit ecb5e5b

5 files changed

Lines changed: 79 additions & 81 deletions

File tree

Lines changed: 65 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,88 @@
11
<script setup lang="ts">
2-
import { ref, computed } from "vue";
3-
import { VueUiSparkline } from "vue-data-ui/vue-ui-sparkline"
2+
import { VueUiSparkline } from 'vue-data-ui/vue-ui-sparkline'
43
54
const props = defineProps<{
6-
downloads?: Array<{
7-
downloads: number | null,
8-
weekStart: string,
9-
weekEnd: string
10-
}>
5+
downloads?: Array<{
6+
downloads: number | null
7+
weekStart: string
8+
weekEnd: string
9+
}>
1110
}>()
1211
13-
const dataset = computed(() => props.downloads?.map(d => ({
12+
const dataset = computed(() =>
13+
props.downloads?.map(d => ({
1414
value: d?.downloads ?? 0,
15-
period: `${d.weekStart ?? '-'} to ${d.weekEnd ?? '-'}`
16-
})));
15+
period: `${d.weekStart ?? '-'} to ${d.weekEnd ?? '-'}`,
16+
})),
17+
)
1718
1819
const lastDatapoint = computed(() => {
19-
return (dataset.value || []).at(-1)?.period ?? ''
20+
return (dataset.value || []).at(-1)?.period ?? ''
2021
})
2122
2223
const config = computed(() => ({
23-
theme: 'dark', // enforced dark mode for now
24-
style: {
25-
backgroundColor: 'transparent',
26-
area: {
27-
color: '#6A6A6A',
28-
useGradient: false,
29-
opacity: 10
30-
},
31-
dataLabel: {
32-
offsetX: -10,
33-
fontSize: 28,
34-
bold: false,
35-
color: '#FAFAFA'
36-
},
37-
line: {
38-
color: '#6A6A6A'
39-
},
40-
plot: {
41-
radius: 6,
42-
stroke: '#FAFAFA'
43-
},
44-
title: {
45-
text: lastDatapoint.value,
46-
fontSize: 12,
47-
color: '#666666',
48-
bold: false,
49-
},
50-
verticalIndicator: {
51-
strokeDasharray: 0,
52-
color: '#FAFAFA'
53-
}
54-
}
24+
theme: 'dark', // enforced dark mode for now
25+
style: {
26+
backgroundColor: 'transparent',
27+
area: {
28+
color: '#6A6A6A',
29+
useGradient: false,
30+
opacity: 10,
31+
},
32+
dataLabel: {
33+
offsetX: -10,
34+
fontSize: 28,
35+
bold: false,
36+
color: '#FAFAFA',
37+
},
38+
line: {
39+
color: '#6A6A6A',
40+
},
41+
plot: {
42+
radius: 6,
43+
stroke: '#FAFAFA',
44+
},
45+
title: {
46+
text: lastDatapoint.value,
47+
fontSize: 12,
48+
color: '#666666',
49+
bold: false,
50+
},
51+
verticalIndicator: {
52+
strokeDasharray: 0,
53+
color: '#FAFAFA',
54+
},
55+
},
5556
}))
56-
5757
</script>
5858

5959
<template>
60-
<div class="space-y-8">
61-
<!-- Download stats -->
62-
<section>
63-
<div class="flex items-center justify-between mb-3">
64-
<h2
65-
id="dependencies-heading"
66-
class="text-xs text-fg-subtle uppercase tracking-wider"
67-
>
68-
Weekly Downloads
69-
</h2>
70-
</div>
71-
<div class="w-full">
72-
<ClientOnly>
73-
<VueUiSparkline
74-
:dataset
75-
:config
76-
/>
77-
</ClientOnly>
78-
</div>
79-
</section>
80-
</div>
60+
<div class="space-y-8">
61+
<!-- Download stats -->
62+
<section>
63+
<div class="flex items-center justify-between mb-3">
64+
<h2 id="dependencies-heading" class="text-xs text-fg-subtle uppercase tracking-wider">
65+
Weekly Downloads
66+
</h2>
67+
</div>
68+
<div class="w-full">
69+
<ClientOnly>
70+
<VueUiSparkline :dataset :config />
71+
</ClientOnly>
72+
</div>
73+
</section>
74+
</div>
8175
</template>
8276

8377
<style>
8478
/** Overrides */
8579
.vue-ui-sparkline-title span {
86-
padding: 0 !important;
87-
letter-spacing: 0.04rem;
80+
padding: 0 !important;
81+
letter-spacing: 0.04rem;
8882
}
8983
.vue-ui-sparkline text {
90-
font-family: Geist Mono, monospace !important;
84+
font-family:
85+
Geist Mono,
86+
monospace !important;
9187
}
92-
</style>
88+
</style>

app/composables/useCharts.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
import { createSharedComposable } from '@vueuse/core'
22

3-
export const useCharts = createSharedComposable(function useCharts() {
4-
5-
})
3+
export const useCharts = createSharedComposable(function useCharts() {})

app/composables/useNpmRegistry.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ type NpmDownloadsRangeResponse = {
145145
start: string
146146
end: string
147147
package: string
148-
downloads: Array<{ day: string, downloads: number }>
148+
downloads: Array<{ day: string; downloads: number }>
149149
}
150150

151151
async function fetchNpmDownloadsRange(
@@ -154,7 +154,9 @@ async function fetchNpmDownloadsRange(
154154
end: string,
155155
): Promise<NpmDownloadsRangeResponse> {
156156
const encodedName = encodePackageName(packageName)
157-
return await $fetch<NpmDownloadsRangeResponse>(`${NPM_API}/downloads/range/${start}:${end}/${encodedName}`)
157+
return await $fetch<NpmDownloadsRangeResponse>(
158+
`${NPM_API}/downloads/range/${start}:${end}/${encodedName}`,
159+
)
158160
}
159161

160162
export function usePackageWeeklyDownloadEvolution(
@@ -180,7 +182,11 @@ export function usePackageWeeklyDownloadEvolution(
180182
)
181183
}
182184

183-
const emptySearchResponse = { objects: [], total: 0, time: new Date().toISOString() } satisfies NpmSearchResponse
185+
const emptySearchResponse = {
186+
objects: [],
187+
total: 0,
188+
time: new Date().toISOString(),
189+
} satisfies NpmSearchResponse
184190

185191
export function useNpmSearch(
186192
query: MaybeRefOrGetter<string>,

app/pages/package/[...name].vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,7 @@ defineOgImageComponent('Package', {
568568
</section>
569569

570570
<!-- Donwload stats -->
571-
<PackageDownloadStats
572-
:downloads="weeklyDownloads"
573-
/>
571+
<PackageDownloadStats :downloads="weeklyDownloads" />
574572

575573
<section
576574
v-if="

app/utils/charts.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ export function chunkIntoWeeks<T>(items: T[], weekSize = 7): T[][] {
1111
}
1212

1313
export function buildWeeklyEvolutionFromDaily(
14-
daily: Array<{ day: string, downloads: number }>,
15-
): Array<{ weekStart: string, weekEnd: string, downloads: number }> {
14+
daily: Array<{ day: string; downloads: number }>,
15+
): Array<{ weekStart: string; weekEnd: string; downloads: number }> {
1616
const weeks = chunkIntoWeeks(daily, 7)
17-
return weeks.map((weekDays) => {
17+
return weeks.map(weekDays => {
1818
const weekStart = weekDays[0]?.day ?? ''
1919
const weekEnd = weekDays[weekDays.length - 1]?.day ?? ''
2020
const downloads = sum(weekDays.map(d => d.downloads))

0 commit comments

Comments
 (0)