diff --git a/eslint.config.mjs b/eslint.config.mjs index bb22f4fc2..fd33ed836 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -24,6 +24,7 @@ export default [{ '**/.vscode', '**/docker-compose.yml', '!.github', + 'assets/build/radar-rules.js', 'lib/routes-deprecated', 'lib/router.js', '**/babel.config.js', @@ -123,6 +124,11 @@ export default [{ '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-unused-expressions': ['error', { + allowShortCircuit: true, + allowTernary: true, + }], + // unicorn 'unicorn/consistent-destructuring': 'warn', 'unicorn/consistent-function-scoping': 'warn', @@ -246,6 +252,11 @@ export default [{ 'yml/no-empty-mapping-value': 'off', }, +}, { + files: ['.puppeteerrc.cjs', 'api/vercel.ts'], + rules: { + '@typescript-eslint/no-require-imports': 'off', + } }, { files: ['**/*.yaml', '**/*.yml'], diff --git a/lib/routes/bilibili/api-interface.d.ts b/lib/routes/bilibili/api-interface.d.ts index 232bd7a3b..89b2038ee 100644 --- a/lib/routes/bilibili/api-interface.d.ts +++ b/lib/routes/bilibili/api-interface.d.ts @@ -28,6 +28,7 @@ interface Generalspec { render_spec: Renderspec; size_spec: Containersize; } +/* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ interface AVATARLAYER {} interface Webcssstyle { borderRadius: string; diff --git a/lib/routes/gdut/oa-news.ts b/lib/routes/gdut/oa-news.ts index 84e10ef4a..58c8128b8 100644 --- a/lib/routes/gdut/oa-news.ts +++ b/lib/routes/gdut/oa-news.ts @@ -1,7 +1,6 @@ import { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import wait from '@/utils/wait'; import { load } from 'cheerio'; import { CookieJar } from 'tough-cookie'; import { parseDate } from '@/utils/parse-date'; @@ -81,7 +80,7 @@ export const route: Route = { }, ], name: 'Unknown', - maintainers: ['Jim Kirisame'], + maintainers: ['jim-kirisame'], handler, url: 'oas.gdut.edu.cn/seeyon', }; @@ -115,18 +114,16 @@ async function handler(ctx) { } // 构造文章数组 - const articles = []; - for (const item of resp.data.list) { - articles.push({ - title: item.title, - guid: item.id, - link: site + '/newsData.do?method=newsView&newsId=' + item.id, - pubDate: timezone(parseDate(item.publishDate1), +8), - author: item.publishUserDepart, - category: item.typeName, - }); - } + const articles = resp.data.list.map((item) => ({ + title: item.title, + guid: item.id, + link: site + '/newsData.do?method=newsView&newsId=' + item.id, + pubDate: timezone(parseDate(item.publishDate1), +8), + author: item.publishUserDepart, + category: item.typeName, + })); + const results = []; // 获取实际的文章内容 for await (const data of asyncPool(2, articles, async (data) => { const link = data.link; @@ -209,18 +206,16 @@ async function handler(ctx) { } }); - // 防止太快被Ban - await wait(500); return node.html(); }); })) { - data; + results.push(data); } return { title: `广东工业大学新闻通知网 - ` + type.name, link: site, description: `广东工业大学新闻通知网`, - item: articles, + item: results, }; } diff --git a/lib/routes/zhihu/execlib/x-zse-96-v3.ts b/lib/routes/zhihu/execlib/x-zse-96-v3.ts index 42c5cc578..bdaf9304d 100644 --- a/lib/routes/zhihu/execlib/x-zse-96-v3.ts +++ b/lib/routes/zhihu/execlib/x-zse-96-v3.ts @@ -2,6 +2,8 @@ // https://blog.csdn.net/zjq592767809/article/details/126512798 // https://blog.csdn.net/zhoumi_/article/details/126659351 +/* eslint-disable @typescript-eslint/no-unused-expressions */ + function i(e, t, n) { (t[n] = 255 & (e >>> 24)), (t[n + 1] = 255 & (e >>> 16)), (t[n + 2] = 255 & (e >>> 8)), (t[n + 3] = 255 & e); }