WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 1e5227e

Browse files
authored
Add knip for detecting unused files and dependencies (#638)
1 parent f5e6971 commit 1e5227e

File tree

4 files changed

+401
-33
lines changed

4 files changed

+401
-33
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
2929
- run: pnpm run lint --format github
3030
- run: pnpm run fmt
31+
- run: pnpm run knip
3132
- run: git diff --exit-code # Must commit everything
3233
- uses: crate-ci/typos@626c4bedb751ce0b7f03262ca97ddda9a076ae1c # v1.39.2
3334
with:

knip.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"entry": [
4+
".vitepress/config/index.ts",
5+
".vitepress/theme/index.ts",
6+
"src/**/*.md!",
7+
".vitepress/theme/components/**/*.vue!"
8+
],
9+
"project": [
10+
".vitepress/**/*.{ts,vue}",
11+
"src/**/*.md"
12+
],
13+
"ignore": [
14+
".vitepress/cache/**",
15+
".vitepress/dist/**",
16+
"build/**"
17+
],
18+
"ignoreDependencies": [
19+
"esbuild"
20+
],
21+
"ignoreBinaries": [
22+
"typos"
23+
],
24+
"ignoreExportsUsedInFile": true,
25+
"ignoreIssues": {
26+
".vitepress/theme/constants/team.ts": ["exports", "types"]
27+
}
28+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"lint:fix": "pnpm lint --fix && typos -w && pnpm fmt --write .",
1313
"typecheck": "tsc && vue-tsc",
1414
"fmt": "dprint fmt",
15+
"knip": "knip",
1516
"sponsors": "degit Boshen/sponsors temp --force && mv temp/sponsors.svg public/sponsors.svg",
1617
"prepare": "husky"
1718
},
@@ -25,6 +26,7 @@
2526
"esbuild": "0.27.0",
2627
"feed": "^5.1.0",
2728
"husky": "^9.1.7",
29+
"knip": "^5.69.1",
2830
"lint-staged": "16.2.6",
2931
"markdown-it-container": "^4.0.0",
3032
"oxc-minify": "^0.97.0",

0 commit comments

Comments
 (0)