Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: esm, typescript, replace jest with vitest #14632

Merged
merged 21 commits into from
Mar 3, 2024
Merged

feat: esm, typescript, replace jest with vitest #14632

merged 21 commits into from
Mar 3, 2024

Conversation

DIYgod
Copy link
Owner

@DIYgod DIYgod commented Mar 3, 2024

Involved Issue / 该 PR 相关 Issue

Close #

Example for the Proposed Route(s) / 路由地址示例

NOROUTE

New RSS Route Checklist / 新 RSS 路由检查表

  • New Route / 新的路由
  • Documentation / 文档说明
  • Full text / 全文获取
    • Use cache / 使用缓存
  • Anti-bot or rate limit / 反爬/频率限制
    • If yes, do your code reflect this sign? / 如果有, 是否有对应的措施?
  • Date and time / 日期和时间
    • Parsed / 可以解析
    • Correct time zone / 时区正确
  • New package added / 添加了新的包
  • Puppeteer

Note / 说明

@github-actions github-actions bot added dependencies This PR involves changes to dependencies core enhancement labels Mar 3, 2024
lib/views/index.tsx Fixed Show fixed Hide fixed
@github-actions github-actions bot added the Auto: Route Test Skipped PR involves no routes label Mar 3, 2024
@DIYgod DIYgod changed the title feat: replace jest with vitest feat: esm, typescript, replace jest with vitest Mar 3, 2024
@github-actions github-actions bot added the Route label Mar 3, 2024
list.map(async (info) => {
const title = info.title;
const date = info.date;
const itemUrl = url.resolve(link, info.link);

Check warning

Code scanning / ESLint

disallow deprecated APIs Warning

'url.resolve' was deprecated since v11.0.0. Use 'url.URL' constructor instead.
const response = await got.get(itemUrl);
const $ = load(response.data);
let description = $('.article-box').html();
description = description ? description.replaceAll('src="', `src="${url.resolve(itemUrl, '.')}`).trim() : $('.content_text').html() || '文章已被删除';

Check warning

Code scanning / ESLint

disallow deprecated APIs Warning

'url.resolve' was deprecated since v11.0.0. Use 'url.URL' constructor instead.
const order = ctx.req.param('order') ?? '';
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10;

const currentUrl = `${rootUrl}${id ? (isNaN(id) ? `/category/${id}` : `/section/${id}`) : ''}`;

Check warning

Code scanning / ESLint

Prefer `Number` static properties over global ones. Warning

Prefer Number.isNaN over isNaN.
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10;

const currentUrl = `${rootUrl}${id ? (isNaN(id) ? `/category/${id}` : `/section/${id}`) : ''}`;
const apiUrl = `${apiRootUrl}/api${id ? (isNaN(id) ? `/tags/${id}/` : `/forums/${id}/`) : ''}threads?type=${type}&includes=tags,forum_name,summary&ps=${limit}&pg=1&order=${order === '' ? '' : 'time_desc'}&is_groupid=1`;

Check warning

Code scanning / ESLint

Prefer `Number` static properties over global ones. Warning

Prefer Number.isNaN over isNaN.
url: currentUrl,
});

const getProperty = (object, key) => key.split('.').reduce((o, k) => o && o[k], object);

Check warning

Code scanning / ESLint

Move function definitions to the highest possible scope. Warning

Move arrow function 'getProperty' to the outer scope.
url: currentUrl,
});

const getProperty = (object, key) => key.split('.').reduce((o, k) => o && o[k], object);

Check warning

Code scanning / ESLint

Disallow `Array#reduce()` and `Array#reduceRight()`. Warning

Array#reduce() is not allowed

export default async (ctx) => {
const { category = '' } = ctx.req.param();
const isArcPost = category && !isNaN(category); // https://www.3dmgame.com/news/\d+/

Check warning

Code scanning / ESLint

Prefer `Number` static properties over global ones. Warning

Prefer Number.isNaN over isNaN.
// @ts-nocheck
const getAcwScV2ByArg1 = (arg1) => {
const pwd = '3000176000856006061501533003690027800375';
const hexXor = function (box, pwd) {

Check warning

Code scanning / ESLint

Move function definitions to the highest possible scope. Warning

Move function 'hexXor' to the outer scope.
}
return res;
};
const unsbox = function (str) {

Check warning

Code scanning / ESLint

Move function definitions to the highest possible scope. Warning

Move function 'unsbox' to the outer scope.

const rootUrl = `https://${isLocal ? site : 'www'}.6parknews.com`;
const indexUrl = `${rootUrl}${isLocal ? '' : '/newspark'}/index.php`;
const currentUrl = `${indexUrl}${keyword ? `?act=newssearch&app=news&keywords=${keyword}&submit=查询` : id ? (isNaN(id) ? `?act=${id}` : isLocal ? `?type_id=${id}` : `?type=${id}`) : ''}`;

Check warning

Code scanning / ESLint

Prefer `Number` static properties over global ones. Warning

Prefer Number.isNaN over isNaN.
@DIYgod DIYgod merged commit 4bbf7d6 into master Mar 3, 2024
54 of 56 checks passed
@DIYgod DIYgod deleted the feature/vitest branch March 12, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto: Route Test Skipped PR involves no routes core enhancement dependencies This PR involves changes to dependencies Route
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant