diff --git a/eslint.config.mjs b/eslint.config.mjs
index fd33ed836..5ed642847 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -179,6 +179,7 @@ export default [{
}],
'unicorn/prefer-code-point': 'warn',
+ 'unicorn/prefer-global-this': 'off',
'unicorn/prefer-logical-operator-over-ternary': 'warn',
'unicorn/prefer-module': 'off',
'unicorn/prefer-node-protocol': 'off',
diff --git a/lib/routes/chinanews/index.ts b/lib/routes/chinanews/index.ts
index c9f2e470b..3a66077f2 100644
--- a/lib/routes/chinanews/index.ts
+++ b/lib/routes/chinanews/index.ts
@@ -34,7 +34,7 @@ async function handler(ctx) {
title: $(item).text(),
}))
.get()
- .slice(0, ctx.req.query('limit') ? (Number.parseInt(ctx.req.query('limit')) > 125 ? 125 : Number.parseInt(ctx.req.query('limit'))) : 50);
+ .slice(0, ctx.req.query('limit') ? Math.min(Number.parseInt(ctx.req.query('limit')), 125) : 50);
const items = await Promise.all(
list.map((item) =>
diff --git a/lib/routes/chinaventure/index.ts b/lib/routes/chinaventure/index.ts
index fa99ff0e4..ce56b8934 100644
--- a/lib/routes/chinaventure/index.ts
+++ b/lib/routes/chinaventure/index.ts
@@ -64,7 +64,7 @@ async function handler(ctx) {
link: rootUrl + $(item).attr('href'),
}))
.get()
- .slice(0, ctx.req.query('limit') ? (Number.parseInt(ctx.req.query('limit')) > 20 ? 20 : Number.parseInt(ctx.req.query('limit'))) : 20);
+ .slice(0, ctx.req.query('limit') ? Math.min(Number.parseInt(ctx.req.query('limit')), 20) : 20);
const items = await Promise.all(
list.map((item) =>
diff --git a/lib/routes/github/issue.ts b/lib/routes/github/issue.ts
index 319aaa5d8..641b78917 100644
--- a/lib/routes/github/issue.ts
+++ b/lib/routes/github/issue.ts
@@ -53,7 +53,7 @@ async function handler(ctx) {
const repo = ctx.req.param('repo');
const state = ctx.req.param('state');
const labels = ctx.req.param('labels');
- const limit = ctx.req.query('limit') ? (Number.parseInt(ctx.req.query('limit')) > 100 ? 100 : Number.parseInt(ctx.req.query('limit'))) : 100;
+ const limit = ctx.req.query('limit') ? Math.min(Number.parseInt(ctx.req.query('limit')), 100) : 100;
const host = `https://github.com/${user}/${repo}/issues`;
const url = `https://api.github.com/repos/${user}/${repo}/issues`;
diff --git a/lib/routes/github/pulls.ts b/lib/routes/github/pulls.ts
index db5b260a7..a4ccb97f2 100644
--- a/lib/routes/github/pulls.ts
+++ b/lib/routes/github/pulls.ts
@@ -51,7 +51,7 @@ async function handler(ctx) {
labels,
sort: 'created',
direction: 'desc',
- per_page: ctx.req.query('limit') ? (Number.parseInt(ctx.req.query('limit')) <= 100 ? Number.parseInt(ctx.req.query('limit')) : 100) : 100,
+ per_page: ctx.req.query('limit') ? Math.min(Number.parseInt(ctx.req.query('limit')), 100) : 100,
},
headers,
});
diff --git a/lib/routes/guancha/member.ts b/lib/routes/guancha/member.ts
index 1f8802152..e80fc3cd2 100644
--- a/lib/routes/guancha/member.ts
+++ b/lib/routes/guancha/member.ts
@@ -68,7 +68,7 @@ async function handler(ctx) {
for (const i of item.items) {
const newPubDate = new Date(i.publish_time);
- pubDate = pubDate > newPubDate ? pubDate : newPubDate;
+ pubDate = Math.max(pubDate, newPubDate);
description += `${i.title}
`;
}
diff --git a/lib/routes/manhuagui/comic.ts b/lib/routes/manhuagui/comic.ts
index 88c638aa1..32a4dd41a 100644
--- a/lib/routes/manhuagui/comic.ts
+++ b/lib/routes/manhuagui/comic.ts
@@ -126,7 +126,7 @@ async function handler(ctx) {
const items = chapters.map((element) => genResult(element));
let itemsLen = items.length;
if (chapterCnt > 0) {
- itemsLen = chapterCnt < $.newChapterCnt ? $.newChapterCnt : chapterCnt;
+ itemsLen = Math.max(chapterCnt, $.newChapterCnt);
}
return {
diff --git a/package.json b/package.json
index 1ce2d13d3..d05f33869 100644
--- a/package.json
+++ b/package.json
@@ -173,7 +173,7 @@
"eslint-nibble": "8.1.0",
"eslint-plugin-n": "17.10.3",
"eslint-plugin-prettier": "5.2.1",
- "eslint-plugin-unicorn": "55.0.0",
+ "eslint-plugin-unicorn": "56.0.0",
"eslint-plugin-yml": "1.14.0",
"fs-extra": "11.2.0",
"globals": "15.10.0",
@@ -192,7 +192,7 @@
"vitest": "2.0.5",
"yaml-eslint-parser": "1.2.3"
},
- "packageManager": "pnpm@9.11.0",
+ "packageManager": "pnpm@9.12.0",
"engines": {
"node": ">=22"
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5a92f83a2..cfad56a8d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -373,8 +373,8 @@ importers:
specifier: 5.2.1
version: 5.2.1(@types/eslint@9.6.1)(eslint-config-prettier@9.1.0(eslint@9.11.1))(eslint@9.11.1)(prettier@3.3.3)
eslint-plugin-unicorn:
- specifier: 55.0.0
- version: 55.0.0(eslint@9.11.1)
+ specifier: 56.0.0
+ version: 56.0.0(eslint@9.11.1)
eslint-plugin-yml:
specifier: 1.14.0
version: 1.14.0(eslint@9.11.1)
@@ -2997,8 +2997,8 @@ packages:
eslint-config-prettier:
optional: true
- eslint-plugin-unicorn@55.0.0:
- resolution: {integrity: sha512-n3AKiVpY2/uDcGrS3+QsYDkjPfaOrNrsfQxU9nt5nitd9KuvVXrfAvgCO9DYPSfap+Gqjw9EOrXIsBp5tlHZjA==}
+ eslint-plugin-unicorn@56.0.0:
+ resolution: {integrity: sha512-aXpddVz/PQMmd69uxO98PA4iidiVNvA0xOtbpUoz1WhBd4RxOQQYqN618v68drY0hmy5uU2jy1bheKEVWBjlPw==}
engines: {node: '>=18.18'}
peerDependencies:
eslint: '>=8.56.0'
@@ -8678,7 +8678,7 @@ snapshots:
'@types/eslint': 9.6.1
eslint-config-prettier: 9.1.0(eslint@9.11.1)
- eslint-plugin-unicorn@55.0.0(eslint@9.11.1):
+ eslint-plugin-unicorn@56.0.0(eslint@9.11.1):
dependencies:
'@babel/helper-validator-identifier': 7.25.7
'@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1)