chore: format description in lint-staged

This commit is contained in:
Tony 2026-05-08 05:59:53 +08:00
parent a4b9d76776
commit c2b00f6090
8 changed files with 20 additions and 34 deletions

View File

@ -17,11 +17,9 @@ export const route: Route = {
categories: ['traditional-media'],
description: `Provides a better reading experience (full text articles) over the official ones.
\`\`\`
Support major channels, refer to [BBC RSS feeds](https://www.bbc.co.uk/news/10628494). Eg, \`business\` for \`https://feeds.bbci.co.uk/news/business/rss.xml\`.
- Channel contains sub-directories, such as \`https://feeds.bbci.co.uk/news/world/asia/rss.xml\`, replace \`/\` with \`-\`, \`/bbc/world-asia\`.
\`\`\``,
- Channel contains sub-directories, such as \`https://feeds.bbci.co.uk/news/world/asia/rss.xml\`, replace \`/\` with \`-\`, \`/bbc/world-asia\`.`,
};
async function handler(ctx) {

View File

@ -46,9 +46,7 @@ export const route: Route = {
name: 'Channels',
description: `Get the channel from the Castbox channel URL. For example, the URL of the channel "Lemonade Stand" is \`https://castbox.fm/channel/Lemonade-Stand-id6776228\`, where \`Lemonade-Stand-id6776228\` is the \`channel\` parameter.
\`\`\`
You can use the RSSHub global \`limit\` query parameter to specify the maximum number of episodes to fetch from the Castbox API (defaults to 50). For example: \`/castbox/channel/Lemonade-Stand-id6776228?limit=100\`.
\`\`\``,
You can use the RSSHub global \`limit\` query parameter to specify the maximum number of episodes to fetch from the Castbox API (defaults to 50). For example: \`/castbox/channel/Lemonade-Stand-id6776228?limit=100\`.`,
maintainers: ['ananyatimalsina'],
handler: async (ctx) => {
const { channel } = ctx.req.param();

View File

@ -27,25 +27,19 @@ export const route: Route = {
description: `<details>
<summary></summary>
\`\`\`
\`\`\`
| | | | |
| ---- | ------------ | ------------ | ------------ |
| 2834 | 2835 | 2836 | 2837 |
\`\`\`
\`\`\`
| | | | |
| -------------- | ------------ | ------------ | ------------ |
| 2839,2840,2841 | 2839 | 2840 | 2841 |
\`\`\`
\`\`\`
| | | |
| --------- | ------------ | ---------------- |
@ -56,9 +50,7 @@ export const route: Route = {
<details>
<summary></summary>
\`\`\`
\`\`\`
| LPR |
| ------------ |

View File

@ -3,9 +3,7 @@ import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'DeadbyDaylight',
url: 'deadbydaylight.com',
description: `\`\`\`
DeadbyDaylight Official
\`\`\``,
description: 'DeadbyDaylight Official',
zh: {
name: '黎明杀机',
},

View File

@ -30,49 +30,37 @@ export const route: Route = {
description: `<details>
<summary> ID</summary>
\`\`\`
\`\`\`
| itch | | | | | | Indie Focus | indienova Picks |
| --------------- | ---------------------- | -------- | ---------------- | ------------ | ------------ | -------------------- | -------------------- |
| 52 | 29 | 41 | 43 | 45 | 39 | 1 | 8 |
\`\`\`
\`\`\`
| Podcast | RED |
| ---------------- | ----------------- |
| 6 | 3 |
\`\`\`
\`\`\`
| | Roguelike | GMS |
| ------------ | -------------- | ------------ |
| 15 | 14 | 7 |
\`\`\`
\`\`\`
| | | | | | | | | | | | | |
| ---------- | ---------------------- | ------------ | ------------ | ------------ | ---------------- | ------------ | ------------ | ------------ | ------------ | -------- | ---------------- | -------- |
| 10 | 33 | 17 | 4 | 22 | 11 | 24 | 26 | 27 | 28 | 38 | 9 | 19 |
\`\`\`
\`\`\`
| NOVA | 访 | indie Figure | | | | RPG | ALT. CTRL. GAMING |
| --------------------- | ---------- | ------------------- | ---------- | ---------------- | -------- | --------------- | ----------------- |
| 53 | 23 | 5 | 44 | 18 | 21 | 16 | 2 |
\`\`\`
Game Jam
\`\`\`
| Ludum Dare | Global Game Jam |
| ---------- | --------------- |

View File

@ -33,11 +33,9 @@ export const route: Route = {
name: '用户作品',
description: `例如:
\`\`\`
\`https://baiyong.zcool.com.cn\` 对应 rss 路径 \`/zcool/user/baiyong\`
\`https://www.zcool.com.cn/u/568339\` 对应 rss 路径 \`/zcool/user/568339\`
\`\`\``,
\`https://www.zcool.com.cn/u/568339\` 对应 rss 路径 \`/zcool/user/568339\``,
maintainers: ['junbaor'],
handler,
};

View File

@ -213,6 +213,7 @@
"oxfmt --no-error-on-unmatched-pattern"
],
"*.{ts,tsx,js,cjs,mjs}": [
"tsx scripts/workflow/format-description.ts",
"oxlint --type-aware --fix",
"eslint --cache --fix --concurrency auto",
"oxfmt --no-error-on-unmatched-pattern"

View File

@ -267,10 +267,23 @@ async function processFile(filePath: string): Promise<void> {
}
}
function isRouteFile(filePath: string): boolean {
const abs = path.resolve(filePath);
if (!abs.startsWith(routesDir + path.sep)) {
return false;
}
const base = path.basename(abs);
return /\.tsx?$/.test(base) && !base.endsWith('.d.ts');
}
async function main() {
const started = performance.now();
// @ts-ignore ts(2550)
const files: string[] = await Array.fromAsync(walk(routesDir));
const args = process.argv.slice(2);
const files: string[] =
args.length > 0
? args.map((f) => path.resolve(f)).filter((f) => isRouteFile(f))
: // @ts-ignore ts(2550)
await Array.fromAsync(walk(routesDir));
await Promise.all(files.map((f) => processFile(f)));