Skip to content

Commit b331976

Browse files
authored
chore: enforce no unused deps or code in ci (#4654)
1 parent 40c4064 commit b331976

498 files changed

Lines changed: 813 additions & 9491 deletions

File tree

Some content is hidden

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

.github/workflows/code-quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ jobs:
3636

3737
- name: 🔎 Lint
3838
run: pnpm exec oxlint .
39+
40+
- name: ✂️ Check unused code and dependencies
41+
run: pnpm run knip

AGENTS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ pnpm run lint:fix # oxlint — auto-fixes lint violations
8181
pnpm run lint # oxlint — check only (no fixes)
8282
```
8383

84+
### Dead code
85+
86+
We use knip to control unused dependencies and code. It is enforced by CI `code-quality`.
87+
88+
Scan your code before pushing with:
89+
90+
```bash
91+
pnpm run knip
92+
```
93+
94+
If there are false positives, edit ./knip.json so that it passes.
95+
8496
### Imports
8597

8698
**Prefer static imports over dynamic imports.** Only use dynamic `import()` when:

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,11 @@ This never affects correctness — CI enforces the same checks on every PR; the
238238
1. **Always open your PR in draft status first.** Do not mark it as "Ready for Review" until the steps below are complete.
239239
2. **Run format and lint locally before pushing:**
240240
```bash
241-
pnpm run format # auto-fixes formatting (oxfmt)
242-
pnpm run lint:fix # auto-fixes lint violations (oxlint)
241+
pnpm run format
242+
pnpm run lint
243+
pnpm run knip
243244
```
244-
Both are enforced by CI — the `code-quality` check will fail if either produces a diff or errors.
245+
These are enforced by CI — the `code-quality` check will fail if either produces a diff or errors.
245246
3. **Address all CodeRabbit code review comments.** Our CI runs an automated code review via CodeRabbit. Go through each comment and either fix the issue or resolve it with a comment explaining why no change is needed.
246247
4. **Wait for all CI checks to pass.** Do not mark the PR as "Ready for Review" until every check is green.
247248
5. **Then mark the PR as "Ready for Review"** so a maintainer can take a look.

apps/supervisor/src/backpressure/backpressureMonitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BackpressureMetrics } from "./backpressureMetrics.js";
22

3-
export interface BackpressureLogger {
3+
interface BackpressureLogger {
44
info(message: string, meta?: Record<string, unknown>): void;
55
error(message: string, meta?: Record<string, unknown>): void;
66
}

apps/supervisor/src/clients/kubernetes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Informer, KubernetesObject, ListPromise } from "@kubernetes/client
33
import { assertExhaustive } from "@trigger.dev/core/utils";
44
import { SimpleStructuredLogger } from "@trigger.dev/core/v3/utils/structuredLogger";
55

6-
export const RUNTIME_ENV = process.env.KUBERNETES_PORT ? "kubernetes" : "local";
6+
const RUNTIME_ENV = process.env.KUBERNETES_PORT ? "kubernetes" : "local";
77

88
const logger = new SimpleStructuredLogger("kubernetes-client");
99

apps/supervisor/src/wideEvents/index.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@
77
* Off by default behind a kill switch - the dispatch hotpath runs at high
88
* QPS, so logging pressure must be cleanly removable.
99
*/
10-
export { type Env, isValidRequestId, newState, type NewStateOptions } from "./new.js";
11-
export { emit, EmitMessage } from "./emit.js";
12-
export { parseTraceId } from "./traceparent.js";
13-
export { fromContext, wideEventStorage } from "./context.js";
14-
export { type PhaseOpt, recordPhase, recordPhaseSince, timePhase } from "./record.js";
10+
export { fromContext } from "./context.js";
11+
export { recordPhaseSince } from "./record.js";
1512
export {
1613
emitOneShot,
1714
runWideEvent,
1815
setExtra,
1916
setMeta,
20-
type WideEventLifecycleOptions,
2117
type WideEventOptions,
2218
} from "./middleware.js";
23-
export type { ErrorInfo, PhaseRecord, State } from "./state.js";
19+
export type { State } from "./state.js";
2420
export { encodeBaggage } from "./baggage.js";

apps/supervisor/src/wideEvents/state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type PhaseRecord = {
7676
};
7777

7878
/** Top-level error summary for a failed operation. */
79-
export type ErrorInfo = {
79+
type ErrorInfo = {
8080
code: string;
8181
message: string;
8282
/** Coarse classification - "client" | "upstream" | "internal" | "timeout". */

apps/supervisor/src/workloadToken.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const mintCounter = new Counter({
2828
});
2929

3030
export type WorkloadAuthTransport = "http" | "ws";
31-
export type WorkloadAuthOutcome = "jwt_valid" | "jwt_invalid" | "legacy_bare" | "token_absent";
3231

3332
const verifyCounter = new Counter({
3433
name: "workload_auth_verify_total",

apps/webapp/app/assets/logos/ATAndTLogo.tsx

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

apps/webapp/app/assets/logos/AstroLogo.tsx

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

0 commit comments

Comments
 (0)