Skip to content

Commit 3153e59

Browse files
JounQinCopilot
andauthored
feat: support check dead links in lint command (#184)
Co-authored-by: Copilot <[email protected]>
1 parent a08700e commit 3153e59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+912
-651
lines changed

.changeset/metal-turkeys-pay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom-export": patch
3+
---
4+
5+
chore(deps): lock playwright version

.changeset/silly-rabbits-invite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom": patch
3+
---
4+
5+
feat: support check dead links in lint command

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@
3333
"devDependencies": {
3434
"@changesets/changelog-github": "^0.5.1",
3535
"@changesets/cli": "^2.29.7",
36-
"@eslint/js": "^9.35.0",
36+
"@eslint/js": "^9.36.0",
3737
"@swc-node/register": "^1.11.1",
38-
"@swc/core": "1.13.5",
38+
"@swc/core": "^1.13.20",
3939
"@types/cli-progress": "^3.11.6",
4040
"@types/ejs": "^3.1.5",
4141
"@types/mdast": "^4.0.4",
42-
"@types/node": "^22.18.5",
42+
"@types/node": "^22.18.6",
4343
"@types/picomatch": "^4.0.2",
4444
"@types/pluralize": "^0.0.33",
45-
"@types/react": "^19.1.13",
45+
"@types/react": "^19.1.15",
4646
"@types/react-dom": "^19.1.9",
4747
"@types/swagger2openapi": "^7.0.4",
4848
"@unts/patch-package": "^8.1.1",
49-
"eslint": "^9.35.0",
49+
"eslint": "^9.36.0",
5050
"eslint-import-resolver-typescript": "^4.4.4",
5151
"eslint-plugin-import-x": "^4.16.1",
5252
"eslint-plugin-react-hooks": "^5.2.0",

packages/doom/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,25 @@
4545
"@eslint-react/eslint-plugin": "^1.53.1",
4646
"@inquirer/prompts": "^7.8.6",
4747
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
48-
"@playwright/browser-chromium": "^1.55.0",
49-
"@rsbuild/plugin-react": "^1.4.0",
48+
"@playwright/browser-chromium": "^1.55.1",
49+
"@rsbuild/plugin-react": "^1.4.1",
5050
"@rsbuild/plugin-sass": "^1.4.0",
5151
"@rsbuild/plugin-svgr": "^1.2.2",
5252
"@rsbuild/plugin-yaml": "^1.0.3",
53-
"@rspress/core": "2.0.0-beta.32",
54-
"@rspress/plugin-algolia": "2.0.0-beta.32",
55-
"@rspress/plugin-llms": "2.0.0-beta.32",
56-
"@rspress/plugin-sitemap": "2.0.0-beta.32",
57-
"@rspress/shared": "2.0.0-beta.32",
58-
"@shikijs/transformers": "^3.12.2",
53+
"@rspress/core": "2.0.0-beta.34",
54+
"@rspress/plugin-algolia": "2.0.0-beta.34",
55+
"@rspress/plugin-llms": "2.0.0-beta.34",
56+
"@rspress/plugin-sitemap": "2.0.0-beta.34",
57+
"@rspress/shared": "2.0.0-beta.34",
58+
"@shikijs/transformers": "^3.13.0",
5959
"@total-typescript/ts-reset": "^0.6.1",
6060
"ab64": "^0.1.6",
6161
"chokidar": "^4.0.3",
6262
"clsx": "^2.1.1",
6363
"commander": "^13.1.0 || ^14.0.1",
6464
"ejs": "^3.1.10",
6565
"es-toolkit": "^1.39.10",
66-
"eslint": "^9.35.0",
66+
"eslint": "^9.36.0",
6767
"eslint-plugin-mdx": "^3.6.2",
6868
"globals": "^16.4.0",
6969
"html-tag-names": "^2.1.0",
@@ -74,8 +74,8 @@
7474
"mdast-util-phrasing": "^4.1.0",
7575
"mdast-util-to-markdown": "^2.1.2",
7676
"mdast-util-to-string": "^4.0.0",
77-
"mermaid": "^11.11.0",
78-
"openai": "^5.20.3",
77+
"mermaid": "^11.12.0",
78+
"openai": "^5.23.1",
7979
"openapi-types": "^12.1.3",
8080
"p-ratelimit": "^1.0.1",
8181
"picomatch": "^4.0.3",
@@ -96,14 +96,14 @@
9696
"remark-mdx": "^3.1.1",
9797
"remark-message-control": "^8.0.0",
9898
"remark-stringify": "^11.0.0",
99-
"shiki": "^3.12.2",
99+
"shiki": "^3.13.0",
100100
"simple-git": "^3.28.0",
101101
"string-width": "^7.2.0",
102102
"swagger2openapi": "^7.0.8",
103103
"tinyglobby": "^0.2.15",
104104
"type-fest": "^4.41.0 || ^5.0.0",
105105
"typescript": "^5.9.2",
106-
"typescript-eslint": "^8.44.0",
106+
"typescript-eslint": "^8.44.1",
107107
"unified": "^11.0.5",
108108
"unified-lint-rule": "^3.0.1",
109109
"unist-util-position": "^5.0.0",

packages/doom/src/cli/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { glob } from 'tinyglobby'
44
import { xfetch } from 'x-fetch'
55
import { parse } from 'yaml'
66

7-
import { FALSY_VALUES, TRUTHY_VALUES } from '../shared/index.js'
8-
import type { NormalizedTermItem } from '../terms.js'
7+
import { FALSY_VALUES, TRUTHY_VALUES } from '../shared/index.ts'
8+
import type { NormalizedTermItem } from '../terms.ts'
99

1010
export const parseBoolean = (value?: string) =>
1111
value === undefined || !FALSY_VALUES.has(value)

packages/doom/src/cli/lint.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1+
import fs from 'node:fs/promises'
12
import path from 'node:path'
23

34
import { logger } from '@rspress/core'
45
import { Command } from 'commander'
56
import { ESLint } from 'eslint'
67
import { cyan } from 'yoctocolors'
78

8-
import doom from '../eslint.js'
9-
import type { GlobalCliOptions } from '../types.js'
9+
import doom from '../eslint.ts'
10+
import type { GlobalCliOptions } from '../types.ts'
11+
import { OPTIONS_FILE, STORAGE_DIR } from '../utils/index.ts'
1012

11-
import { loadConfig } from './load-config.js'
13+
import { loadConfig } from './load-config.ts'
1214

1315
export interface LintCommandOptions {
1416
cspell?: boolean
1517
glob: string | string[]
18+
debug?: boolean
1619
}
1720

1821
export const lintCommand = new Command('lint')
@@ -24,10 +27,22 @@ export const lintCommand = new Command('lint')
2427
'**/*.{js,jsx,ts,tsx,md,mdx}',
2528
)
2629
.option('--no-cspell', 'Disable cspell linting')
30+
.option('--debug', 'Show debug logs', false)
2731
.action(async function (root?: string) {
28-
const { cspell, glob, ...globalOptions } = this.optsWithGlobals<
29-
LintCommandOptions & GlobalCliOptions
30-
>()
32+
const {
33+
cspell,
34+
glob,
35+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
36+
debug,
37+
...globalOptions
38+
} = this.optsWithGlobals<LintCommandOptions & GlobalCliOptions>()
39+
40+
await fs.mkdir(STORAGE_DIR, { recursive: true })
41+
42+
await fs.writeFile(
43+
OPTIONS_FILE,
44+
JSON.stringify({ root, globalOptions }, null, 2),
45+
)
3146

3247
const { config } = await loadConfig(root, globalOptions)
3348

packages/doom/src/cli/load-config.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { difference } from 'es-toolkit'
3131
import { glob } from 'tinyglobby'
3232
import { cyan } from 'yoctocolors'
3333

34-
import { attributesPlugin } from '../plugins/attributes/index.js'
34+
import { attributesPlugin } from '../plugins/attributes/index.ts'
3535
import {
3636
apiPlugin,
3737
autoSidebarPlugin,
@@ -42,24 +42,24 @@ import {
4242
mermaidPlugin,
4343
permissionPlugin,
4444
replacePlugin,
45-
} from '../plugins/index.js'
45+
} from '../plugins/index.ts'
4646
import {
4747
isExplicitlyUnversioned,
4848
normalizeSlash,
4949
UNVERSIONED,
5050
type DoomSite,
51-
} from '../shared/index.js'
52-
import type { AlgoliaOptions, ExportItem, GlobalCliOptions } from '../types.js'
53-
import { pathExists, pkgResolve, resolveStaticConfig } from '../utils/index.js'
51+
} from '../shared/index.ts'
52+
import type { AlgoliaOptions, ExportItem, GlobalCliOptions } from '../types.ts'
53+
import { pathExists, pkgResolve, resolveStaticConfig } from '../utils/index.ts'
5454

5555
import {
5656
DEFAULT_CONFIG_NAME,
5757
DEFAULT_EXTENSIONS,
5858
I18N_FILE,
5959
SITES_FILE,
6060
YAML_EXTENSIONS,
61-
} from './constants.js'
62-
import { defaultGitHubUrl, isDoc } from './helpers.js'
61+
} from './constants.ts'
62+
import { defaultGitHubUrl, isDoc } from './helpers.ts'
6363

6464
const DEFAULT_LOGO = '/logo.svg'
6565

packages/doom/src/plugins/api/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import type { RspressPlugin } from '@rspress/core'
33
import type { OpenAPI, OpenAPIV3_1 } from 'openapi-types'
44
import { convertObj } from 'swagger2openapi'
55

6-
import { generateRuntimeModule } from '../../utils/index.js'
6+
import { generateRuntimeModule } from '../../utils/index.ts'
77

8-
import type { ApiPluginOptions, CustomResourceDefinition } from './types.js'
8+
import type { ApiPluginOptions, CustomResourceDefinition } from './types.ts'
99

10-
export type * from './types.js'
10+
export type * from './types.ts'
1111

1212
// @internal
1313
declare module 'doom-@api-crdsMap' {

packages/doom/src/plugins/attributes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { RspressPlugin } from '@rspress/core'
22

3-
import { remarkAttributes } from './remark-attributes/index.js'
3+
import { remarkAttributes } from './remark-attributes/index.ts'
44

55
export const attributesPlugin = (): RspressPlugin => {
66
return {

packages/doom/src/plugins/attributes/remark-attributes/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import type { Root } from 'mdast'
22
import type { Extension as FromMarkdownExtension } from 'mdast-util-from-markdown'
33
import type { Plugin } from 'unified'
44

5-
import { attributesTransformer } from './attributes-transformer.js'
6-
import { mdastAttributes } from './mdast-attributes.js'
7-
import { micromarkAttributes } from './micromark-attributes.js'
8-
import type { AttributesExtension } from './types.js'
5+
import { attributesTransformer } from './attributes-transformer.ts'
6+
import { mdastAttributes } from './mdast-attributes.ts'
7+
import { micromarkAttributes } from './micromark-attributes.ts'
8+
import type { AttributesExtension } from './types.ts'
99

1010
export interface AttributesData {
1111
micromarkExtensions?: AttributesExtension[]

0 commit comments

Comments
 (0)