Skip to content

Commit ad2a64f

Browse files
committed
Add type checking
1 parent 412d780 commit ad2a64f

File tree

12 files changed

+350
-77
lines changed

12 files changed

+350
-77
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ jobs:
2626
- name: Setup Node
2727
uses: actions/setup-node@v4
2828
with:
29-
node-version: '20'
30-
cache: 'npm'
29+
node-version: "20"
30+
cache: "npm"
3131

3232
- run: npm install
3333
- name: Lint
3434
run: npm run lint
3535

36+
- name: Type check
37+
run: npm run type-check
38+
3639
- name: Setup Pages
3740
id: pages
3841
uses: actions/configure-pages@v5

env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

package-lock.json

Lines changed: 213 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,27 @@
77
"dev": "vite",
88
"build": "vite build",
99
"preview": "vite preview",
10-
"lint": "markdownlint src/pages"
10+
"lint": "markdownlint src/pages",
11+
"type-check": "vue-tsc --build --force"
1112
},
1213
"devDependencies": {
1314
"@rollup/pluginutils": "^5.1.3",
15+
"@tsconfig/node20": "^20.1.4",
1416
"@types/markdown-it": "^14.1.2",
17+
"@types/markdown-it-attrs": "^4.1.3",
1518
"@types/node": "^22.9.1",
1619
"@vitejs/plugin-vue": "^5.2.0",
20+
"@vue/tsconfig": "^0.6.0",
1721
"gray-matter": "^4.0.3",
1822
"markdown-it": "^14.1.0",
1923
"markdown-it-attrs": "^4.2.0",
2024
"markdown-it-highlightjs": "^4.2.0",
2125
"markdown-it-replace-link": "^1.2.1",
2226
"markdownlint-cli": "^0.42.0",
2327
"sass": "^1.81.0",
28+
"typescript": "^5.6.3",
2429
"vite": "^5.4.11",
25-
"vue": "^3.5.13"
30+
"vue": "^3.5.13",
31+
"vue-tsc": "^2.1.10"
2632
}
2733
}

plugins/troubleshooter/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { dataToEsm } from "@rollup/pluginutils"
2-
import { Plugin, Logger, ViteDevServer } from "vite"
2+
import type { Plugin, Logger, ViteDevServer } from "vite"
33

4-
import { Page } from "./pages"
4+
import type { Page } from "./pages"
55
import { getErrors } from "./validation"
6-
import { PageLoader, LoaderConfig, PageFile } from "./loader"
6+
import { PageLoader, type LoaderConfig, type PageFile } from "./loader"
77

88
type UserOptions = LoaderConfig
99

@@ -63,7 +63,7 @@ export default function TroubleshooterPlugin(
6363
if (file.options)
6464
page.options = file.options.map((option) => ({
6565
id: option.id,
66-
page: files.findIndex((f) => (f.filename == option.page)),
66+
page: files.findIndex((f) => f.filename == option.page),
6767
label: option.label,
6868
summary: option.summary
6969
}))

0 commit comments

Comments
 (0)