chore: update lint config

This commit is contained in:
Tony 2024-08-12 21:18:14 +08:00
parent 0b6a79f16b
commit 665124e0d3
4 changed files with 26 additions and 17 deletions

View File

@ -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'],

View File

@ -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;

View File

@ -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,
};
}

View File

@ -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);
}