Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ jobs:

- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c # 1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
name: 🟧 Install pnpm
# pnpm cache skipped deliberately as the project is not actually installed here
with:
cache: true

- name: 📦 Install dependencies (root only, no scripts)
run: pnpm install --filter . --ignore-scripts

- name: 🔠 Lint project
run: node scripts/lint.ts
run: pnpm lint

types:
name: 💪 Type check
Expand Down
22 changes: 21 additions & 1 deletion .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://unpkg.com/oxlint/configuration_schema.json",
"plugins": ["unicorn", "typescript", "oxc", "vue", "vitest"],
"jsPlugins": ["@e18e/eslint-plugin"],
"categories": {
"correctness": "error",
"suspicious": "warn",
Expand All @@ -11,8 +12,27 @@
"no-await-in-loop": "off",
"unicorn/no-array-sort": "off",
"no-restricted-globals": "error",
"typescript/consistent-type-imports": "error"
"typescript/consistent-type-imports": "error",
"e18e/prefer-array-from-map": "error",
"e18e/prefer-timer-args": "error",
"e18e/prefer-date-now": "error",
"e18e/prefer-regex-test": "error",
"e18e/prefer-array-some": "error"
},
"overrides": [
{
"files": [
"server/**/*",
"cli/**/*",
"scripts/**/*",
"modules/**/*",
"app/components/OgImage/*"
],
"rules": {
"no-console": "off"
}
}
],
"ignorePatterns": [
".output/**",
".data/**",
Expand Down
3 changes: 3 additions & 0 deletions knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const config: KnipConfig = {

/** Some components import types from here, but installing it directly could lead to a version mismatch */
'vue-router',

/** Oxlint plugins don't get picked up yet */
'@e18e/eslint-plugin',
],
ignoreUnresolved: ['#components', '#oauth/config'],
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"vue-data-ui": "3.14.7"
},
"devDependencies": {
"@e18e/eslint-plugin": "0.1.4",
"@intlify/core-base": "11.2.8",
"@npm/types": "2.1.0",
"@playwright/test": "1.58.1",
Expand Down
22 changes: 22 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 0 additions & 33 deletions scripts/lint.ts

This file was deleted.

19 changes: 9 additions & 10 deletions server/api/atproto/author-profiles.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ export default defineCachedEventHandler(

if (handles.length === 0) {
return {
authors: authors.map(author => ({
...author,
avatar: null,
profileUrl: null,
})),
authors: authors.map(author => Object.assign(author, { avatar: null, profileUrl: null })),
}
}

Expand All @@ -68,11 +64,14 @@ export default defineCachedEventHandler(
}
}

const resolvedAuthors: ResolvedAuthor[] = authors.map(author => ({
...author,
avatar: author.blueskyHandle ? avatarMap.get(author.blueskyHandle) || null : null,
profileUrl: author.blueskyHandle ? `https://bsky.app/profile/${author.blueskyHandle}` : null,
}))
const resolvedAuthors: ResolvedAuthor[] = authors.map(author =>
Object.assign(author, {
avatar: author.blueskyHandle ? avatarMap.get(author.blueskyHandle) || null : null,
profileUrl: author.blueskyHandle
? `https://bsky.app/profile/${author.blueskyHandle}`
: null,
}),
)

return { authors: resolvedAuthors }
},
Expand Down
2 changes: 1 addition & 1 deletion server/utils/dependency-analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const analyzeDependencyTree = defineCachedFunction(
const resolved = await resolveDependencyTree(name, version, { trackDepth: true })

// Convert to array with query info
const packages: PackageQueryInfo[] = [...resolved.values()].map(pkg => ({
const packages: PackageQueryInfo[] = Array.from(resolved.values(), pkg => ({
name: pkg.name,
version: pkg.version,
depth: pkg.depth!,
Expand Down
16 changes: 8 additions & 8 deletions server/utils/readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ function resolveImageUrl(url: string, packageName: string, repoInfo?: Repository
return resolved
}

// Helper to prefix id attributes with 'user-content-'
function prefixId(tagName: string, attribs: sanitizeHtml.Attributes) {
if (attribs.id && !attribs.id.startsWith('user-content-')) {
attribs.id = `user-content-${attribs.id}`
}
return { tagName, attribs }
}

export async function renderReadmeHtml(
content: string,
packageName: string,
Expand Down Expand Up @@ -398,14 +406,6 @@ ${html}

const rawHtml = marked.parse(content) as string

// Helper to prefix id attributes with 'user-content-'
const prefixId = (tagName: string, attribs: sanitizeHtml.Attributes) => {
if (attribs.id && !attribs.id.startsWith('user-content-')) {
attribs.id = `user-content-${attribs.id}`
}
return { tagName, attribs }
}

const sanitized = sanitizeHtml(rawHtml, {
allowedTags: ALLOWED_TAGS,
allowedAttributes: ALLOWED_ATTR,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ async function handleJsdelivrCdn(route: Route): Promise<boolean> {
const pathname = decodeURIComponent(url.pathname)

// README file requests - return 404 (package pages work fine without README)
if (pathname.match(/readme/i)) {
if (/readme/i.test(pathname)) {
await route.fulfill({ status: 404, body: 'Not found' })
return true
}
Expand Down
Loading