diff --git a/lib/registry.ts b/lib/registry.ts index 452cdd2b6..74f42e876 100644 --- a/lib/registry.ts +++ b/lib/registry.ts @@ -223,13 +223,15 @@ for (const namespace in namespaces) { continue; } - const sortedRoutes = Object.entries(namespaceData.apiRoutes) as Array<[ - string, - APIRoute & { - location: string; - module?: () => Promise<{ apiRoute: APIRoute }>; - }, - ]>; + const sortedRoutes = Object.entries(namespaceData.apiRoutes) as Array< + [ + string, + APIRoute & { + location: string; + module?: () => Promise<{ apiRoute: APIRoute }>; + }, + ] + >; for (const [path, routeData] of sortedRoutes) { const wrappedHandler: Handler = async (ctx) => { diff --git a/lib/routes/asmr-200/type.ts b/lib/routes/asmr-200/type.ts index 0961c9ded..a9ebf6bc0 100644 --- a/lib/routes/asmr-200/type.ts +++ b/lib/routes/asmr-200/type.ts @@ -43,14 +43,12 @@ export interface Work { }>; playlistStatus: any; price: number; - rank: - | Array<{ - category: string; - rank: number; - rank_date: string; - term: string; - }> - | null; + rank: Array<{ + category: string; + rank: number; + rank_date: string; + term: string; + }> | null; rate_average_2dp: number | number; rate_count: number; rate_count_detail: Array<{ diff --git a/lib/routes/cool18/index.ts b/lib/routes/cool18/index.ts index 6f4b5d704..f6a1bea15 100644 --- a/lib/routes/cool18/index.ts +++ b/lib/routes/cool18/index.ts @@ -51,7 +51,7 @@ async function handler(ctx: Context) { const $ = load(response); - const limit = ctx.req.query('limit') ? Number.parseInt((ctx.req.query('limit') as string)) : 20; + const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit') as string) : 20; const list = type === 'home' diff --git a/lib/routes/javtiful/actress.ts b/lib/routes/javtiful/actress.ts index 6e1dd5dc4..bff0a633b 100644 --- a/lib/routes/javtiful/actress.ts +++ b/lib/routes/javtiful/actress.ts @@ -27,7 +27,7 @@ export const route: Route = { async function handler(ctx): Promise { const { id } = ctx.req.param(); const html = await ofetch(`https://javtiful.com/actress/${id}`); - const $ = load((html as string)); + const $ = load(html as string); const items: DataItem[] = $('section .card:not(:has(.bg-danger))') .toArray() .map((item) => parseItems($(item))); diff --git a/lib/routes/javtiful/channel.ts b/lib/routes/javtiful/channel.ts index 917513a61..6915a5993 100644 --- a/lib/routes/javtiful/channel.ts +++ b/lib/routes/javtiful/channel.ts @@ -27,7 +27,7 @@ export const route: Route = { async function handler(ctx): Promise { const { id } = ctx.req.param(); const html = await ofetch(`https://javtiful.com/channel/${id}`); - const $ = load((html as string)); + const $ = load(html as string); const items: DataItem[] = $('section .card:not(:has(.bg-danger))') .toArray() .map((item) => parseItems($(item))); diff --git a/lib/routes/qiche365/recall.ts b/lib/routes/qiche365/recall.ts index 7a07881f0..397d44782 100644 --- a/lib/routes/qiche365/recall.ts +++ b/lib/routes/qiche365/recall.ts @@ -31,7 +31,7 @@ async function handler(ctx): Promise { }, }); - const $ = load((html as string)); + const $ = load(html as string); const items: DataItem[] = $('li') .toArray() .map((item) => { diff --git a/lib/routes/stdaily/types.ts b/lib/routes/stdaily/types.ts index ed90286dc..4b0092228 100644 --- a/lib/routes/stdaily/types.ts +++ b/lib/routes/stdaily/types.ts @@ -28,12 +28,10 @@ export interface ArticleDetailResponse { subtitle: string; content: string; editionName: string; - picList: - | null - | Array<{ - url: string; - picText: string; - }>; + picList: null | Array<{ + url: string; + picText: string; + }>; periodTime: string; author: string; }; diff --git a/lib/utils/wechat-mp.test.ts b/lib/utils/wechat-mp.test.ts index 0361de59f..5fd870557 100644 --- a/lib/utils/wechat-mp.test.ts +++ b/lib/utils/wechat-mp.test.ts @@ -58,7 +58,7 @@ const testFetchArticleFinishArticleItem = async (path: string, { setMpNameAsAuth const ToBeFinishedArticleItem = { link: httpUrl }; const expectedFinishedArticleItem = { ...fetchArticleItem }; - expectedFinishedArticleItem.author = setMpNameAsAuthor ? expectedFinishedArticleItem.mpName as string : expectedFinishedArticleItem.author; + expectedFinishedArticleItem.author = setMpNameAsAuthor ? (expectedFinishedArticleItem.mpName as string) : expectedFinishedArticleItem.author; expectedFinishedArticleItem.link = skipLink ? ToBeFinishedArticleItem.link : expectedFinishedArticleItem.link; const finishedArticleItem = await finishArticleItem(ToBeFinishedArticleItem, setMpNameAsAuthor, skipLink); diff --git a/lib/utils/wechat-mp.ts b/lib/utils/wechat-mp.ts index 137be65f1..2014d6919 100644 --- a/lib/utils/wechat-mp.ts +++ b/lib/utils/wechat-mp.ts @@ -356,7 +356,7 @@ const fixArticleContent = (html?: string | Cheerio, skipImg = false) => const dataSrc = $iframe.attr('data-src') as string; const srcUrlObj = new URL(dataSrc); if (srcUrlObj.host === 'v.qq.com' && srcUrlObj.searchParams.has('vid')) { - const newSrc = genVideoSrc((srcUrlObj.searchParams.get('vid') as string)); + const newSrc = genVideoSrc(srcUrlObj.searchParams.get('vid') as string); $iframe.attr('src', newSrc); $iframe.removeAttr('data-src'); const width = $iframe.attr('data-w'); @@ -576,7 +576,7 @@ const redirectHelper = async (url: string, maxRedirects: number = 5) => { } else if (maxRedirects <= 0) { error('too many redirects', url); } - return await redirectHelper((raw.headers.get('location') as string), maxRedirects); + return await redirectHelper(raw.headers.get('location') as string, maxRedirects); } return raw; };