Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
11 changes: 9 additions & 2 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{
"$schema": "https://unpkg.com/oxlint/configuration_schema.json",
"plugins": ["unicorn", "typescript", "oxc", "vue", "vitest"],
"jsPlugins": ["@e18e/eslint-plugin"],
"categories": {
"correctness": "error",
"suspicious": "warn",
"perf": "warn"
},
"rules": {
"no-console": "warn",
"no-console": "off",
Copy link
Copy Markdown
Member

@serhalp serhalp Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never understood the purpose of warns, so I'm good with this 😁. Longer term should we be using a li'l logger module and turning this to "error"? (maybe keep off for scripts/)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we really need to review logging overall.

only truly error-level things should be logged at error level, for example. this isn't currently the case iirc

i'll start a discussion around this 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to disable this just on a per-directory case? so we disable it for server/ and cli/ but keep it for app/ ?

"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": [],
"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.

28 changes: 25 additions & 3 deletions scripts/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
* It's "stupid by design" so it could work in minimal Node.js environments.
*/

import { cpSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { spawnSync } from 'node:child_process'
import { tmpdir } from 'node:os'
import { join } from 'node:path'

const projectDir = process.cwd()

function getDependencyVersion(dependencyName: string): string {
const result = spawnSync('npm', ['pkg', 'get', `devDependencies.${dependencyName}`], {
Expand All @@ -18,8 +23,8 @@ function getDependencyVersion(dependencyName: string): string {
return JSON.parse(result.stdout)
}

function runCommand(command: string, args: string[]) {
const result = spawnSync(command, args, { stdio: 'inherit' })
function runCommand(command: string, args: string[], cwd?: string) {
const result = spawnSync(command, args, { stdio: 'inherit', cwd })

if (result.status) {
throw new Error(`Command failed: ${command} ${args.join(' ')}`)
Expand All @@ -28,6 +33,23 @@ function runCommand(command: string, args: string[]) {

const oxlintVersion = getDependencyVersion('oxlint')
const oxfmtVersion = getDependencyVersion('oxfmt')
const e18eVersion = getDependencyVersion('@e18e/eslint-plugin')

// Create a temp dir because:
// 1. oxlint seems to try to resolve plugins from the dir of the config file
// 2. pnpx/pnpm dlx doesn't have a clue about peers (plugins here), so doesn't have a way to install them
const tempDir = mkdtempSync(join(tmpdir(), 'oxlint-'))
try {
writeFileSync(join(tempDir, 'package.json'), '{"name": "temp", "version": "1.0.0"}')
cpSync('.oxlintrc.json', join(tempDir, '.oxlintrc.json'))
Comment thread
43081j marked this conversation as resolved.
Outdated
runCommand(
'pnpm',
['install', '-D', `oxlint@${oxlintVersion}`, `@e18e/eslint-plugin@${e18eVersion}`],
tempDir,
)
runCommand('pnpm', ['exec', 'oxlint', '-c', join(tempDir, '.oxlintrc.json'), projectDir], tempDir)
} finally {
rmSync(tempDir, { recursive: true, force: true })
}

runCommand('pnpx', [`oxlint@${oxlintVersion}`])
runCommand('pnpx', [`oxfmt@${oxfmtVersion}`, '--check'])
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