Skip to content

Commit 74fc8e0

Browse files
committed
chore: add e18e lint plugin
This also disables `no-console` since pretty much everything in this repo can run server-side, where console logs are valuable when done right.
1 parent 508505a commit 74fc8e0

File tree

6 files changed

+42
-12
lines changed

6 files changed

+42
-12
lines changed

.oxlintrc.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
{
22
"$schema": "https://unpkg.com/oxlint/configuration_schema.json",
33
"plugins": ["unicorn", "typescript", "oxc", "vue", "vitest"],
4+
"jsPlugins": ["@e18e/eslint-plugin"],
45
"categories": {
56
"correctness": "error",
67
"suspicious": "warn",
78
"perf": "warn"
89
},
910
"rules": {
10-
"no-console": "warn",
11+
"no-console": "off",
1112
"no-await-in-loop": "off",
1213
"unicorn/no-array-sort": "off",
1314
"no-restricted-globals": "error",
14-
"typescript/consistent-type-imports": "error"
15+
"typescript/consistent-type-imports": "error",
16+
"e18e/prefer-array-from-map": "error",
17+
"e18e/prefer-timer-args": "error",
18+
"e18e/prefer-date-now": "error",
19+
"e18e/prefer-regex-test": "error",
20+
"e18e/prefer-array-some": "error"
1521
},
22+
"overrides": [],
1623
"ignorePatterns": [
1724
".output/**",
1825
".data/**",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"vue-data-ui": "3.14.7"
102102
},
103103
"devDependencies": {
104+
"@e18e/eslint-plugin": "0.1.4",
104105
"@intlify/core-base": "11.2.8",
105106
"@npm/types": "2.1.0",
106107
"@playwright/test": "1.58.1",

pnpm-lock.yaml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/utils/dependency-analysis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export const analyzeDependencyTree = defineCachedFunction(
179179
const resolved = await resolveDependencyTree(name, version, { trackDepth: true })
180180

181181
// Convert to array with query info
182-
const packages: PackageQueryInfo[] = [...resolved.values()].map(pkg => ({
182+
const packages: PackageQueryInfo[] = Array.from(resolved.values(), pkg => ({
183183
name: pkg.name,
184184
version: pkg.version,
185185
depth: pkg.depth!,

server/utils/readme.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,14 @@ function resolveImageUrl(url: string, packageName: string, repoInfo?: Repository
264264
return resolved
265265
}
266266

267+
// Helper to prefix id attributes with 'user-content-'
268+
function prefixId(tagName: string, attribs: sanitizeHtml.Attributes) {
269+
if (attribs.id && !attribs.id.startsWith('user-content-')) {
270+
attribs.id = `user-content-${attribs.id}`
271+
}
272+
return { tagName, attribs }
273+
}
274+
267275
export async function renderReadmeHtml(
268276
content: string,
269277
packageName: string,
@@ -398,14 +406,6 @@ ${html}
398406

399407
const rawHtml = marked.parse(content) as string
400408

401-
// Helper to prefix id attributes with 'user-content-'
402-
const prefixId = (tagName: string, attribs: sanitizeHtml.Attributes) => {
403-
if (attribs.id && !attribs.id.startsWith('user-content-')) {
404-
attribs.id = `user-content-${attribs.id}`
405-
}
406-
return { tagName, attribs }
407-
}
408-
409409
const sanitized = sanitizeHtml(rawHtml, {
410410
allowedTags: ALLOWED_TAGS,
411411
allowedAttributes: ALLOWED_ATTR,

test/e2e/test-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ async function handleJsdelivrCdn(route: Route): Promise<boolean> {
313313
const pathname = decodeURIComponent(url.pathname)
314314

315315
// README file requests - return 404 (package pages work fine without README)
316-
if (pathname.match(/readme/i)) {
316+
if (/readme/i.test(pathname)) {
317317
await route.fulfill({ status: 404, body: 'Not found' })
318318
return true
319319
}

0 commit comments

Comments
 (0)