Skip to content

Commit 242a2ca

Browse files
authored
refactor: do typecheck, fix type issues (#407)
* refactor: do typecheck, fix type issues * fix: lib * fix: downgrade vite-plugin-inspect
1 parent 1d54768 commit 242a2ca

File tree

59 files changed

+340
-410
lines changed

Some content is hidden

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

59 files changed

+340
-410
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,32 @@ jobs:
7373
- name: Lint
7474
run: pnpm run lint
7575

76+
typecheck:
77+
name: TypeCheck
78+
runs-on: 'ubuntu-latest'
79+
80+
steps:
81+
- name: Checkout
82+
uses: actions/checkout@v4
83+
84+
- name: Setup pnpm
85+
uses: pnpm/action-setup@v4
86+
87+
- name: Install Node.js 22.x
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: 22.x
91+
# registry-url required. Learn more at
92+
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
93+
registry-url: 'https://registry.npmjs.org'
94+
cache: pnpm
95+
96+
- name: Install dependencies
97+
run: pnpm install --frozen-lockfile
98+
99+
- name: TypeCheck
100+
run: pnpm run packages:stub && pnpm run typecheck
101+
76102
package-build-test:
77103
name: Packages Build Test
78104
runs-on: 'ubuntu-latest'

docs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"preview": "pnpm run docs:preview",
99
"docs:dev": "vitepress dev",
1010
"docs:build": "vitepress build",
11-
"docs:preview": "vitepress preview"
11+
"docs:preview": "vitepress preview",
12+
"typecheck": "vue-tsc --noEmit"
1213
},
1314
"devDependencies": {
1415
"@iconify-json/carbon": "^1.2.6",

docs/tsconfig.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"types": [
5+
"./yaml.d.ts",
6+
"node",
7+
"vite/client",
8+
"@nolebase/vitepress-plugin-git-changelog/types/virtual.d.ts",
9+
"@nolebase/vitepress-plugin-page-properties/client/virtual.d.ts"
10+
],
11+
"noImplicitAny": false,
12+
"declaration": true,
13+
"noEmit": false,
14+
"outDir": "./.vitepress/dist"
15+
},
16+
"include": [
17+
"./.vitepress/**/*.ts",
18+
"./.vitepress/**/*.mts",
19+
"./.vitepress/**/*.tsx",
20+
"./.vitepress/**/*.d.ts",
21+
"./.vitepress/**/*.vue"
22+
],
23+
"exclude": [
24+
"**/.vitepress/dist/**",
25+
"node_modules"
26+
]
27+
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"stub": "pnpm -r --filter=./packages/* --parallel run stub",
2323
"lint": "eslint --cache .",
2424
"lint:fix": "eslint --cache --fix .",
25+
"typecheck": "pnpm -r --filter './packages/*' --filter '@nolebase/integrations-docs' run typecheck",
2526
"dev": "pnpm run packages:stub && pnpm run docs:dev",
2627
"build": "pnpm run packages:build && pnpm run docs:build",
2728
"preview": "pnpm run docs:preview",
@@ -70,7 +71,7 @@
7071
"unocss": "^65.4.3",
7172
"unplugin-vue-macros": "^2.14.2",
7273
"vite": "catalog:",
73-
"vite-plugin-inspect": "^10.1.1",
74+
"vite-plugin-inspect": "^10.0.7",
7475
"vitest": "^3.0.5",
7576
"vue": "catalog:",
7677
"vue-tsc": "^2.2.0"
@@ -86,7 +87,7 @@
8687
"neverBuiltDependencies": []
8788
},
8889
"simple-git-hooks": {
89-
"pre-commit": "pnpm packages:stub && pnpm lint-staged"
90+
"pre-commit": "pnpm packages:stub && pnpm lint-staged && pnpm typecheck"
9091
},
9192
"lint-staged": {
9293
"*": "eslint --fix"

packages/markdown-it-bi-directional-links/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"scripts": {
4242
"stub": "unbuild --stub",
4343
"dev": "unbuild --stub",
44-
"build": "unbuild"
44+
"build": "unbuild",
45+
"typecheck": "tsc --noEmit"
4546
},
4647
"peerDependencies": {
4748
"markdown-it": ">=14.1.0"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"noEmit": false,
6+
"outDir": "./dist"
7+
},
8+
"include": [
9+
"./src/**/*.ts",
10+
"./src/**/*.mts",
11+
"./src/**/*.d.ts"
12+
],
13+
"exclude": [
14+
"**/dist/**",
15+
"node_modules"
16+
]
17+
}

packages/markdown-it-element-transform/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"scripts": {
4242
"stub": "unbuild --stub",
4343
"dev": "unbuild --stub",
44-
"build": "unbuild"
44+
"build": "unbuild",
45+
"typecheck": "tsc --noEmit"
4546
},
4647
"peerDependencies": {
4748
"markdown-it": ">=14.1.0"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"noEmit": false,
6+
"outDir": "./dist"
7+
},
8+
"include": [
9+
"./src/**/*.ts",
10+
"./src/**/*.mts",
11+
"./src/**/*.d.ts"
12+
],
13+
"exclude": [
14+
"**/dist/**",
15+
"node_modules"
16+
]
17+
}

packages/markdown-it-unlazy-img/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"scripts": {
4545
"stub": "unbuild --stub",
4646
"dev": "unbuild --stub",
47-
"build": "unbuild"
47+
"build": "unbuild",
48+
"typecheck": "tsc --noEmit"
4849
},
4950
"peerDependencies": {
5051
"markdown-it": ">=14.1.0"

0 commit comments

Comments
 (0)