diff --git a/lib/routes/cnbc/rss.ts b/lib/routes/cnbc/rss.ts index 5e81b99d0..ecc6620f1 100644 --- a/lib/routes/cnbc/rss.ts +++ b/lib/routes/cnbc/rss.ts @@ -65,7 +65,7 @@ async function handler(ctx) { } const meta = JSON.parse($('[type=application/ld+json]').last().text()); - item.author = meta.author ? meta.author.name ?? meta.author.map((a) => a.name).join(', ') : null; + item.author = meta.author ? (meta.author.name ?? meta.author.map((a) => a.name).join(', ')) : null; item.category = meta.keywords; return item; diff --git a/lib/routes/epicgames/index.ts b/lib/routes/epicgames/index.ts index 2fbf1e239..c30f963bc 100644 --- a/lib/routes/epicgames/index.ts +++ b/lib/routes/epicgames/index.ts @@ -72,7 +72,7 @@ async function handler(ctx) { ? item.catalogNs.mappings[0].pageSlug : item.offerMappings && item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug - : item.productSlug ?? item.urlSlug; + : (item.productSlug ?? item.urlSlug); if (item.offerType === 'ADD_ON') { linkSlug = item.offerMappings[0].pageSlug; } diff --git a/lib/routes/foresightnews/util.ts b/lib/routes/foresightnews/util.ts index f9d1f7241..f26584013 100644 --- a/lib/routes/foresightnews/util.ts +++ b/lib/routes/foresightnews/util.ts @@ -61,7 +61,7 @@ const processItems = async (apiUrl, limit, ...searchParams) => { column, item.event_type, item.is_hot ? constants.labelHot : undefined, - item.is_important ? item.important_tag?.name ?? constants.labelImportant : '', + item.is_important ? (item.important_tag?.name ?? constants.labelImportant) : '', item.label, ...(item.tags?.map((c) => c.name) ?? []), ].filter((v, index, self) => v && self.indexOf(v) === index); diff --git a/lib/routes/getitfree/util.ts b/lib/routes/getitfree/util.ts index a15ec88e3..2915c11dd 100644 --- a/lib/routes/getitfree/util.ts +++ b/lib/routes/getitfree/util.ts @@ -234,7 +234,7 @@ const getFilterByKeyAndKeyword = async (key, keyword) => { const getFilterKeyForSearchParams = (key, isApi = false) => { const keys = isApi ? filterApiKeys : filterKeys; - return Object.hasOwn(keys, key) ? keys[key] ?? key : undefined; + return Object.hasOwn(keys, key) ? (keys[key] ?? key) : undefined; }; /** diff --git a/lib/routes/hitcon/zeroday.ts b/lib/routes/hitcon/zeroday.ts index ce3aa2a29..d5acb0535 100644 --- a/lib/routes/hitcon/zeroday.ts +++ b/lib/routes/hitcon/zeroday.ts @@ -101,7 +101,7 @@ async function handler(ctx: Context): Promise { }); return { - title: status ? titleMap[status] ?? 'ZeroDay' : '活動中', + title: status ? (titleMap[status] ?? 'ZeroDay') : '活動中', link: url, item: items, image: 'https://zeroday.hitcon.org/images/favicon/favicon.png', diff --git a/lib/routes/huxiu/util.ts b/lib/routes/huxiu/util.ts index 216865a44..005feb2c8 100644 --- a/lib/routes/huxiu/util.ts +++ b/lib/routes/huxiu/util.ts @@ -376,7 +376,7 @@ const processItems = async (items, limit, tryGet) => { }), author: item.user_info?.username ?? item.brief_column?.name ?? item.author_info?.username ?? item.author, guid, - pubDate: item.publish_time ?? item.dateline ? parseDate(item.publish_time ?? item.dateline, 'X') : undefined, + pubDate: (item.publish_time ?? item.dateline) ? parseDate(item.publish_time ?? item.dateline, 'X') : undefined, upvotes: Number.parseInt(upvotes, 10), downvotes: Number.parseInt(downvotes, 10), comments: Number.parseInt(comments, 10), diff --git a/lib/routes/kyodonews/index.ts b/lib/routes/kyodonews/index.ts index a3f7cd84c..8277b4b88 100644 --- a/lib/routes/kyodonews/index.ts +++ b/lib/routes/kyodonews/index.ts @@ -35,7 +35,7 @@ export const route: Route = { async function handler(ctx) { const language = ctx.req.param('language') ?? 'china'; - const keyword = ctx.req.param('keyword') === 'RSS' ? 'rss' : ctx.req.param('keyword') ?? ''; + const keyword = ctx.req.param('keyword') === 'RSS' ? 'rss' : (ctx.req.param('keyword') ?? ''); // raise error for invalid languages if (!['china', 'tchina'].includes(language)) { diff --git a/lib/routes/minecraft/version.ts b/lib/routes/minecraft/version.ts index f53a6c38c..a8c7c279e 100644 --- a/lib/routes/minecraft/version.ts +++ b/lib/routes/minecraft/version.ts @@ -120,7 +120,7 @@ async function handler(ctx?: Context) { data = data.filter((item) => item.type === versionType); } - const title = `Minecraft Java版${versionType === 'all' ? '' : typeName[versionType] ?? versionType}游戏更新`; + const title = `Minecraft Java版${versionType === 'all' ? '' : (typeName[versionType] ?? versionType)}游戏更新`; return { title, diff --git a/lib/routes/wordpress/util.ts b/lib/routes/wordpress/util.ts index b7152a536..b0e712961 100644 --- a/lib/routes/wordpress/util.ts +++ b/lib/routes/wordpress/util.ts @@ -239,7 +239,7 @@ const getFilterByKeyAndKeyword = async (key: string, keyword: string, rootUrl: s const getFilterKeyForSearchParams = (key: string, isApi: boolean = false): string | undefined => { const keys = isApi ? filterApiKeys : filterKeys; - return Object.hasOwn(keys, key) ? keys[key] ?? key : undefined; + return Object.hasOwn(keys, key) ? (keys[key] ?? key) : undefined; }; /**