Skip to content

Commit 904138e

Browse files
committed
chore: use oxlint + oxfmt
1 parent 2381561 commit 904138e

67 files changed

Lines changed: 1472 additions & 2845 deletions

Some content is hidden

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

.github/workflows/autofix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/setup-node@v6
2020
with:
2121
node-version: lts/*
22-
cache: "pnpm"
22+
cache: 'pnpm'
2323

2424
- name: 📦 Install dependencies
2525
run: pnpm install

.oxfmtrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"semi": false,
4+
"singleQuote": true,
5+
"arrowParens": "avoid",
6+
"quoteProps": "consistent",
7+
"experimentalSortPackageJson": false
8+
}

.oxlintrc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["unicorn", "typescript", "oxc", "vue", "vitest"],
4+
"categories": {
5+
"correctness": "error",
6+
"suspicious": "warn",
7+
"perf": "warn"
8+
},
9+
"rules": {
10+
"no-console": "warn",
11+
"no-await-in-loop": "off",
12+
"unicorn/no-array-sort": "off"
13+
},
14+
"ignorePatterns": [
15+
".output/**",
16+
".data/**",
17+
".nuxt/**",
18+
".nitro/**",
19+
".cache/**",
20+
"dist/**",
21+
"node_modules/**",
22+
"coverage/**",
23+
"playwright-report/**",
24+
"test-results/**"
25+
]
26+
}

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["oxc.oxc-vscode", "Vue.volar"]
3+
}

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ The aim of [npmx.dev](https://npmx.dev) is to provide a better browser for the n
3131

3232
npmx.dev supports npm permalink patterns:
3333

34-
| Pattern | Example |
35-
|---------|---------|
36-
| `/package/<name>` | [`/package/nuxt`](https://npmx.dev/package/nuxt) |
37-
| `/package/@scope/name` | [`/package/@nuxt/kit`](https://npmx.dev/package/@nuxt/kit) |
34+
| Pattern | Example |
35+
| ----------------------------- | -------------------------------------------------------------- |
36+
| `/package/<name>` | [`/package/nuxt`](https://npmx.dev/package/nuxt) |
37+
| `/package/@scope/name` | [`/package/@nuxt/kit`](https://npmx.dev/package/@nuxt/kit) |
3838
| `/package/<name>/v/<version>` | [`/package/vue/v/3.4.0`](https://npmx.dev/package/vue/v/3.4.0) |
39-
| `/search?q=<query>` | [`/search?q=vue`](https://npmx.dev/search?q=vue) |
40-
| `/~<username>` | [`/~sindresorhus`](https://npmx.dev/~sindresorhus) |
41-
| `/org/<name>` | [`/org/nuxt`](https://npmx.dev/org/nuxt) |
39+
| `/search?q=<query>` | [`/search?q=vue`](https://npmx.dev/search?q=vue) |
40+
| `/~<username>` | [`/~sindresorhus`](https://npmx.dev/~sindresorhus) |
41+
| `/org/<name>` | [`/org/nuxt`](https://npmx.dev/org/nuxt) |
4242

4343
## Tech stack
4444

app/app.vue

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const router = useRouter()
55
const isHomepage = computed(() => route.path === '/')
66
77
useHead({
8-
titleTemplate: (titleChunk) => {
8+
titleTemplate: titleChunk => {
99
return titleChunk ? titleChunk : 'npmx - Better npm Package Browser'
1010
},
1111
})
@@ -14,11 +14,7 @@ useHead({
1414
function handleGlobalKeydown(e: KeyboardEvent) {
1515
// Ignore if user is typing in an input, textarea, or contenteditable
1616
const target = e.target as HTMLElement
17-
if (
18-
target.tagName === 'INPUT'
19-
|| target.tagName === 'TEXTAREA'
20-
|| target.isContentEditable
21-
) {
17+
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {
2218
return
2319
}
2420
@@ -32,8 +28,7 @@ function handleGlobalKeydown(e: KeyboardEvent) {
3228
3329
if (searchInput) {
3430
searchInput.focus()
35-
}
36-
else {
31+
} else {
3732
// Navigate to search page
3833
router.push('/search')
3934
}
@@ -51,17 +46,11 @@ onUnmounted(() => {
5146

5247
<template>
5348
<div class="min-h-screen flex flex-col bg-bg text-fg">
54-
<a
55-
href="#main-content"
56-
class="skip-link font-mono"
57-
>Skip to main content</a>
49+
<a href="#main-content" class="skip-link font-mono">Skip to main content</a>
5850

5951
<AppHeader :show-logo="!isHomepage" />
6052

61-
<div
62-
id="main-content"
63-
class="flex-1"
64-
>
53+
<div id="main-content" class="flex-1">
6554
<NuxtPage />
6655
</div>
6756

@@ -71,7 +60,9 @@ onUnmounted(() => {
7160

7261
<style>
7362
/* Base reset and defaults */
74-
*, *::before, *::after {
63+
*,
64+
*::before,
65+
*::after {
7566
box-sizing: border-box;
7667
}
7768
@@ -94,7 +85,9 @@ a {
9485
text-decoration: underline;
9586
text-underline-offset: 3px;
9687
text-decoration-color: #404040;
97-
transition: color 0.2s ease, text-decoration-color 0.2s ease;
88+
transition:
89+
color 0.2s ease,
90+
text-decoration-color 0.2s ease;
9891
}
9992
10093
a:hover {
@@ -190,12 +183,26 @@ button {
190183
}
191184
192185
/* Visual styling based on original README heading level */
193-
.readme-content [data-level="1"] { font-size: 1.5rem; }
194-
.readme-content [data-level="2"] { font-size: 1.25rem; padding-bottom: 0.5rem; border-bottom: 1px solid #262626; }
195-
.readme-content [data-level="3"] { font-size: 1.125rem; }
196-
.readme-content [data-level="4"] { font-size: 1rem; }
197-
.readme-content [data-level="5"] { font-size: 0.925rem; }
198-
.readme-content [data-level="6"] { font-size: 0.875rem; }
186+
.readme-content [data-level='1'] {
187+
font-size: 1.5rem;
188+
}
189+
.readme-content [data-level='2'] {
190+
font-size: 1.25rem;
191+
padding-bottom: 0.5rem;
192+
border-bottom: 1px solid #262626;
193+
}
194+
.readme-content [data-level='3'] {
195+
font-size: 1.125rem;
196+
}
197+
.readme-content [data-level='4'] {
198+
font-size: 1rem;
199+
}
200+
.readme-content [data-level='5'] {
201+
font-size: 0.925rem;
202+
}
203+
.readme-content [data-level='6'] {
204+
font-size: 0.875rem;
205+
}
199206
200207
.readme-content p {
201208
margin-bottom: 1rem;
@@ -310,52 +317,52 @@ button {
310317
}
311318
312319
/* Note - blue */
313-
.readme-content blockquote[data-callout="note"] {
320+
.readme-content blockquote[data-callout='note'] {
314321
border-left-color: #3b82f6;
315322
background: rgba(59, 130, 246, 0.05);
316323
}
317-
.readme-content blockquote[data-callout="note"]::before {
318-
content: "Note";
324+
.readme-content blockquote[data-callout='note']::before {
325+
content: 'Note';
319326
color: #3b82f6;
320327
}
321328
322329
/* Tip - green */
323-
.readme-content blockquote[data-callout="tip"] {
330+
.readme-content blockquote[data-callout='tip'] {
324331
border-left-color: #22c55e;
325332
background: rgba(34, 197, 94, 0.05);
326333
}
327-
.readme-content blockquote[data-callout="tip"]::before {
328-
content: "Tip";
334+
.readme-content blockquote[data-callout='tip']::before {
335+
content: 'Tip';
329336
color: #22c55e;
330337
}
331338
332339
/* Important - purple */
333-
.readme-content blockquote[data-callout="important"] {
340+
.readme-content blockquote[data-callout='important'] {
334341
border-left-color: #a855f7;
335342
background: rgba(168, 85, 247, 0.05);
336343
}
337-
.readme-content blockquote[data-callout="important"]::before {
338-
content: "Important";
344+
.readme-content blockquote[data-callout='important']::before {
345+
content: 'Important';
339346
color: #a855f7;
340347
}
341348
342349
/* Warning - yellow/orange */
343-
.readme-content blockquote[data-callout="warning"] {
350+
.readme-content blockquote[data-callout='warning'] {
344351
border-left-color: #eab308;
345352
background: rgba(234, 179, 8, 0.05);
346353
}
347-
.readme-content blockquote[data-callout="warning"]::before {
348-
content: "Warning";
354+
.readme-content blockquote[data-callout='warning']::before {
355+
content: 'Warning';
349356
color: #eab308;
350357
}
351358
352359
/* Caution - red */
353-
.readme-content blockquote[data-callout="caution"] {
360+
.readme-content blockquote[data-callout='caution'] {
354361
border-left-color: #ef4444;
355362
background: rgba(239, 68, 68, 0.05);
356363
}
357-
.readme-content blockquote[data-callout="caution"]::before {
358-
content: "Caution";
364+
.readme-content blockquote[data-callout='caution']::before {
365+
content: 'Caution';
359366
color: #ef4444;
360367
}
361368
@@ -424,15 +431,15 @@ p > span > code,
424431
}
425432
426433
/* Safari search input fixes */
427-
input[type="search"] {
434+
input[type='search'] {
428435
-webkit-appearance: none;
429436
appearance: none;
430437
}
431438
432-
input[type="search"]::-webkit-search-decoration,
433-
input[type="search"]::-webkit-search-cancel-button,
434-
input[type="search"]::-webkit-search-results-button,
435-
input[type="search"]::-webkit-search-results-decoration {
439+
input[type='search']::-webkit-search-decoration,
440+
input[type='search']::-webkit-search-cancel-button,
441+
input[type='search']::-webkit-search-results-button,
442+
input[type='search']::-webkit-search-results-decoration {
436443
-webkit-appearance: none;
437444
appearance: none;
438445
}

app/components/AppFooter.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
<footer class="border-t border-border mt-auto">
33
<div class="container py-8 flex flex-col gap-4 text-fg-subtle text-sm">
44
<div class="flex flex-col sm:flex-row items-center justify-between gap-4">
5-
<p class="font-mono m-0">
6-
a better browser for the npm registry
7-
</p>
5+
<p class="font-mono m-0">a better browser for the npm registry</p>
86
<div class="flex items-center gap-6">
97
<a
108
href="https://github.com/danielroe/npmx.dev"
@@ -14,11 +12,7 @@
1412
source
1513
</a>
1614
<span class="text-border">|</span>
17-
<a
18-
href="https://roe.dev"
19-
rel="noopener noreferrer"
20-
class="link-subtle font-mono text-xs"
21-
>
15+
<a href="https://roe.dev" rel="noopener noreferrer" class="link-subtle font-mono text-xs">
2216
@danielroe
2317
</a>
2418
</div>

app/components/AppHeader.vue

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
<script setup lang="ts">
2-
withDefaults(defineProps<{
3-
showLogo?: boolean
4-
showConnector?: boolean
5-
}>(), {
6-
showLogo: true,
7-
showConnector: true,
8-
})
2+
withDefaults(
3+
defineProps<{
4+
showLogo?: boolean
5+
showConnector?: boolean
6+
}>(),
7+
{
8+
showLogo: true,
9+
showConnector: true,
10+
},
11+
)
912
</script>
1013

1114
<template>
1215
<header class="sticky top-0 z-50 bg-bg/80 backdrop-blur-md border-b border-border">
13-
<nav
14-
aria-label="Main navigation"
15-
class="container h-14 flex items-center justify-between"
16-
>
16+
<nav aria-label="Main navigation" class="container h-14 flex items-center justify-between">
1717
<NuxtLink
1818
v-if="showLogo"
1919
to="/"
2020
aria-label="npmx home"
2121
class="header-logo font-mono text-lg font-medium text-fg hover:text-fg transition-colors duration-200 focus-ring rounded"
2222
>
23-
<span class="text-fg-subtle"><span style="letter-spacing: -0.2em;">.</span>/</span>npmx
23+
<span class="text-fg-subtle"><span style="letter-spacing: -0.2em">.</span>/</span>npmx
2424
</NuxtLink>
2525
<!-- Spacer when logo is hidden -->
26-
<span
27-
v-else
28-
class="w-1"
29-
/>
26+
<span v-else class="w-1" />
3027

3128
<ul class="flex items-center gap-4 sm:gap-6 list-none m-0 p-0">
3229
<li class="flex">
@@ -35,19 +32,16 @@ withDefaults(defineProps<{
3532
class="link-subtle font-mono text-sm inline-flex items-center gap-2"
3633
>
3734
search
38-
<kbd class="hidden sm:inline-flex items-center justify-center w-5 h-5 text-xs bg-bg-muted border border-border rounded">/</kbd>
35+
<kbd
36+
class="hidden sm:inline-flex items-center justify-center w-5 h-5 text-xs bg-bg-muted border border-border rounded"
37+
>/</kbd
38+
>
3939
</NuxtLink>
4040
</li>
41-
<li
42-
v-if="showConnector"
43-
class="flex"
44-
>
41+
<li v-if="showConnector" class="flex">
4542
<ConnectorStatus />
4643
</li>
47-
<li
48-
v-else
49-
class="flex"
50-
>
44+
<li v-else class="flex">
5145
<a
5246
href="https://github.com/danielroe/npmx.dev"
5347
rel="noopener noreferrer"

app/components/CodeDirectoryListing.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,12 @@ function formatBytes(bytes: number): string {
4747
<template>
4848
<div class="directory-listing">
4949
<!-- Empty state -->
50-
<div
51-
v-if="currentContents.length === 0"
52-
class="py-20 text-center text-fg-muted"
53-
>
50+
<div v-if="currentContents.length === 0" class="py-20 text-center text-fg-muted">
5451
<p>No files in this directory</p>
5552
</div>
5653

5754
<!-- File list -->
58-
<table
59-
v-else
60-
class="w-full"
61-
>
55+
<table v-else class="w-full">
6256
<thead class="sr-only">
6357
<tr>
6458
<th>Name</th>
@@ -99,11 +93,7 @@ function formatBytes(bytes: number): string {
9993
v-if="node.type === 'directory'"
10094
class="i-carbon-folder w-4 h-4 text-yellow-600"
10195
/>
102-
<span
103-
v-else
104-
class="w-4 h-4"
105-
:class="getFileIcon(node.name)"
106-
/>
96+
<span v-else class="w-4 h-4" :class="getFileIcon(node.name)" />
10797
<span>{{ node.name }}</span>
10898
</NuxtLink>
10999
</td>

0 commit comments

Comments
 (0)