Skip to content

Commit d99fac8

Browse files
committed
chore: add knip
1 parent 5723837 commit d99fac8

File tree

4 files changed

+309
-0
lines changed

4 files changed

+309
-0
lines changed

.github/workflows/knip.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Knip
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
knip:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v6
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v6
19+
with:
20+
node-version: 24.x
21+
- name: Set up PNPM
22+
run: corepack enable
23+
- run: pnpm install
24+
25+
- run: pnpm run knip

knip.config.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { KnipConfig } from "knip";
2+
3+
export default {
4+
entry: ["eslint.config.mjs"],
5+
// knip's Nuxt plugin doesn't support the Nuxt 4 app/ directory convention yet.
6+
// Note: custom entry replaces (not merges with) the plugin defaults.
7+
nuxt: {
8+
entry: [
9+
"app/app.vue",
10+
"app/error.vue",
11+
"app/pages/**/*.vue",
12+
"app/components/**/*.vue",
13+
"app/composables/**/*.ts",
14+
"app/utils/**/*.ts",
15+
"app/layouts/**/*.vue",
16+
"app/middleware/**/*.ts",
17+
"server/api/**/*.ts",
18+
"server/routes/**/*.ts",
19+
"server/middleware/**/*.ts",
20+
"server/plugins/**/*.ts",
21+
"server/**/*.ts",
22+
],
23+
config: ["nuxt.config.ts"],
24+
},
25+
ignoreDependencies: [
26+
"vue",
27+
"vue-router",
28+
"vue-tsc",
29+
"vitest-environment-nuxt",
30+
],
31+
ignoreBinaries: ["eslint"],
32+
} satisfies KnipConfig;

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"preview": "nuxt preview",
1616
"postinstall": "nuxt prepare",
1717
"test:unit": "vitest run",
18+
"knip": "knip",
1819
"test": "pnpm run typecheck && pnpm run lint && pnpm run test:unit",
1920
"typecheck": "nuxi typecheck"
2021
},
@@ -32,6 +33,7 @@
3233
"@nuxt/test-utils": "^4.0.0",
3334
"@vue/test-utils": "^2.4.6",
3435
"happy-dom": "^20.6.2",
36+
"knip": "^5.83.1",
3537
"typescript": "^5.6.2",
3638
"vitest": "^4.0.18",
3739
"vue-tsc": "^3.2.4"

0 commit comments

Comments
 (0)