Skip to content

Commit f6154c8

Browse files
carderneTrigger.dev RepoOps
authored andcommitted
chore: treat knip configuration and tag hints as errors
Make Knip configuration and tag hints fail with a non-zero exit code instead of passing with warnings. Remove the redundant `agentcrumbs` dependency ignore. Use a TypeScript config to ignore `lefthook` only outside CI, matching Knip's environment-dependent Lefthook detection. Verified formatting, lint, and Knip locally, including an uncached CI-mode check. Mono-RevId: 3e0d4d6bb8512594d5606b6f0bf07df73e771a5f
1 parent b59385d commit f6154c8

4 files changed

Lines changed: 104 additions & 99 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Scan your code before pushing with:
9191
pnpm run knip
9292
```
9393

94-
If there are false positives, edit ./knip.json so that it passes.
94+
If there are false positives, edit ./knip.ts so that it passes.
9595

9696
### Imports
9797

‎knip.json‎

Lines changed: 0 additions & 97 deletions
This file was deleted.

‎knip.ts‎

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import type { KnipConfig } from "knip";
2+
3+
export default {
4+
tags: ["-knipignore"],
5+
treatConfigHintsAsErrors: true,
6+
treatTagHintsAsErrors: true,
7+
workspaces: {
8+
".": {
9+
entry: [
10+
"scripts/**/*.{js,mjs,cjs,ts,mts,cts}",
11+
"vitest.internal.config.ts",
12+
"vitest.internal-reports.config.mjs",
13+
],
14+
// Analyze the shared hook config, not generated hooks that vary between checkouts.
15+
lefthook: { config: ["lefthook.yml"] },
16+
ignoreDependencies: process.env.CI ? ["eslint"] : ["eslint", "lefthook"],
17+
ignoreBinaries: ["infisical", "prisma"],
18+
},
19+
"apps/webapp": {
20+
entry: [
21+
"evalite.config.ts",
22+
"vitest.*.config.ts",
23+
"evals/**/*.eval.ts",
24+
"memory-leak-detector.js",
25+
"prisma/populate.ts",
26+
"seed*.{ts,mts}",
27+
"scripts/**/*.{js,mjs,cjs,ts,mts,cts}",
28+
"test/**/*.producer.ts",
29+
"test/bench/analyzeProfile.ts",
30+
"test/types/**/*.types.ts",
31+
"test/setup/global-e2e-full-setup.ts",
32+
"vite/node-globals-shim.js",
33+
"app/v3/otlpTransformWorker.ts",
34+
],
35+
ignoreDependencies: ["@sentry/cli", "assert", "util"],
36+
},
37+
"internal-packages/dashboard-agent": {
38+
entry: ["trigger.config.ts", "src/investigation-sweep.ts", "src/maintenance.ts"],
39+
ignoreBinaries: ["rg"],
40+
},
41+
"internal-packages/observability-map": {
42+
entry: ["src/index.ts", "fixtures/**/*.{js,mjs,cjs,ts,mts,cts,tsx}"],
43+
},
44+
"internal-packages/otlp-importer": {
45+
ignoreDependencies: ["ts-proto"],
46+
},
47+
"internal-packages/run-engine": {
48+
entry: ["harness/**/*.ts"],
49+
},
50+
"internal-packages/run-ops-database": {
51+
ignoreDependencies: ["@prisma/client", "prisma"],
52+
},
53+
"internal-packages/sdk-compat-tests": {
54+
entry: ["src/fixtures/**/*.{js,mjs,cjs,ts,mts,cts,tsx}"],
55+
},
56+
"internal-packages/testcontainers": {
57+
entry: ["scripts/**/*.{js,mjs,cjs,ts,mts,cts}"],
58+
},
59+
"internal-packages/tsql": {
60+
ignoreBinaries: ["tail"],
61+
},
62+
"internal-packages/webhook-sources": {
63+
entry: ["catalog/**/*.{js,mjs,cjs,ts,mts,cts}"],
64+
},
65+
"packages/build": {
66+
ignoreFiles: ["src/**/*-cjs.cts"],
67+
ignoreDependencies: ["@typescript/typescript6"],
68+
},
69+
"packages/cli-v3": {
70+
entry: [
71+
"src/index.ts",
72+
"src/entryPoints/**/*.ts",
73+
"src/**/*-cjs.cts",
74+
"src/dev/devWatchdog.ts",
75+
"src/shims/esm.ts",
76+
],
77+
ignoreDependencies: ["@epic-web/test-server", "execa", "find-up"],
78+
ignoreBinaries: ["xdg-open"],
79+
},
80+
"packages/core": {
81+
ignoreFiles: ["src/**/*-cjs.cts"],
82+
ignoreDependencies: ["ai-v7"],
83+
},
84+
"packages/react-hooks": {
85+
ignoreDependencies: ["@types/react-dom"],
86+
},
87+
"packages/rsc": {
88+
ignoreFiles: ["src/**/*-cjs.cts"],
89+
ignoreDependencies: ["react", "react-dom"],
90+
},
91+
"packages/schema-to-json": {
92+
ignoreDependencies: ["runtypes", "superstruct", "valibot"],
93+
},
94+
"packages/trigger-sdk": {
95+
ignoreFiles: ["src/**/*-cjs.cts", "src/v3/index-browser.mts"],
96+
ignoreDependencies: ["ai-v7", "react"],
97+
},
98+
docs: {
99+
ignoreFiles: ["style.css"],
100+
},
101+
},
102+
} satisfies KnipConfig;

‎lefthook.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pre-push:
4444
echo ""
4545
echo " pnpm run knip"
4646
echo ""
47-
echo " then remove the unused items or update knip.json and re-push."
47+
echo " then remove the unused items or update knip.ts and re-push."
4848
echo ""
4949
exit 1
5050
}

0 commit comments

Comments
 (0)