Skip to content

Commit c7861be

Browse files
authored
chore: activate no-unused-vars and import linters (#4096)
Once this is merged, oxlint is at a pretty sensible baseline. **Enable `no-unused-vars`, `typescript/consistent-type-imports`, and `import/no-duplicates` lint rules** Turns on three previously-disabled oxlint rules across the monorepo and fixes all violations: - **`no-unused-vars`** – enabled as an error with standard ignore patterns: unused function arguments are ignored by default (`args: "none"`), variables/caught errors/destructured array elements prefixed with `_` are allowed, and rest siblings are permitted. - **`typescript/consistent-type-imports`** – enforced as an error; all type-only imports now use the `import type` syntax. - **`import/no-duplicates`** – enforced as an error; duplicate import statements from the same module have been merged. The remaining commits clean up the violations found across the codebase: removing unused variables/imports/type aliases, adding `_` prefixes to intentionally unused bindings, fixing duplicate imports, and converting value imports to `import type` where appropriate.
1 parent 86ef3c4 commit c7861be

846 files changed

Lines changed: 3194 additions & 3571 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.

.oxlintrc.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,24 @@
1111
"internal-packages/tsql/src/grammar/"
1212
],
1313
"rules": {
14-
"no-unused-vars": "off",
14+
"no-unused-vars": [
15+
"error",
16+
{
17+
"args": "none",
18+
"argsIgnorePattern": "^_",
19+
"varsIgnorePattern": "^_",
20+
"caughtErrors": "all",
21+
"caughtErrorsIgnorePattern": "^_",
22+
"destructuredArrayIgnorePattern": "^_",
23+
"ignoreRestSiblings": true
24+
}
25+
],
1526
"no-empty-pattern": "off",
1627
"no-control-regex": "off",
1728
"typescript/no-non-null-asserted-optional-chain": "off",
1829
"no-unused-expressions": ["warn", { "allowShortCircuit": true, "allowTernary": true }],
19-
"typescript/consistent-type-imports": "off",
20-
"import/no-duplicates": "off",
30+
"typescript/consistent-type-imports": "error",
31+
"import/no-duplicates": "error",
2132
"import/namespace": "off",
2233
"react-hooks/exhaustive-deps": "off",
2334
"react-hooks/rules-of-hooks": "off"

apps/coordinator/src/checkpointer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export class Checkpointer {
334334

335335
try {
336336
await setTimeout(delayMs, undefined, { signal });
337-
} catch (error) {
337+
} catch (_error) {
338338
this.#logger.log("Checkpoint canceled during initial delay", { runId });
339339
return { success: false, reason: "CANCELED" };
340340
}
@@ -364,7 +364,7 @@ export class Checkpointer {
364364

365365
try {
366366
await setTimeout(delay.milliseconds, undefined, { signal });
367-
} catch (error) {
367+
} catch (_error) {
368368
this.#logger.log("Checkpoint canceled during retry delay", { runId });
369369
return { success: false, reason: "CANCELED" };
370370
}

apps/coordinator/src/exec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class Buildah {
208208
try {
209209
await x("buildah", ["login", "--get-login", registryHost], { throwOnError: true });
210210
return true;
211-
} catch (error) {
211+
} catch (_error) {
212212
return false;
213213
}
214214
}

apps/coordinator/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { createServer } from "node:http";
22
import { Server } from "socket.io";
3+
import type { WaitReason } from "@trigger.dev/core/v3";
34
import {
45
CoordinatorToPlatformMessages,
56
CoordinatorToProdWorkerMessages,
67
omit,
78
PlatformToCoordinatorMessages,
89
ProdWorkerSocketData,
910
ProdWorkerToCoordinatorMessages,
10-
WaitReason,
1111
} from "@trigger.dev/core/v3";
1212
import { ZodNamespace } from "@trigger.dev/core/v3/zodNamespace";
1313
import { ZodSocketConnection } from "@trigger.dev/core/v3/zodSocket";

apps/coordinator/src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function safeJsonParse(json?: string): unknown {
2525

2626
try {
2727
return JSON.parse(json);
28-
} catch (e) {
28+
} catch (_e) {
2929
return null;
3030
}
3131
}

apps/docker-provider/src/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import { $, type ExecaChildProcess, execa } from "execa";
2-
import {
3-
ProviderShell,
1+
import type { PostStartCauses, PreStopCauses } from "@trigger.dev/core/v3";
2+
import type {
43
TaskOperations,
54
TaskOperationsCreateOptions,
65
TaskOperationsIndexOptions,
76
TaskOperationsRestoreOptions,
87
} from "@trigger.dev/core/v3/apps";
9-
import { SimpleLogger } from "@trigger.dev/core/v3/apps";
10-
import { isExecaChildProcess } from "@trigger.dev/core/v3/apps";
8+
import { ProviderShell, SimpleLogger, isExecaChildProcess } from "@trigger.dev/core/v3/apps";
119
import { testDockerCheckpoint } from "@trigger.dev/core/v3/serverOnly";
10+
import { $, type ExecaChildProcess, execa } from "execa";
1211
import { setTimeout } from "node:timers/promises";
13-
import { PostStartCauses, PreStopCauses } from "@trigger.dev/core/v3";
1412

1513
const MACHINE_NAME = process.env.MACHINE_NAME || "local";
1614
const COORDINATOR_PORT = process.env.COORDINATOR_PORT || 8020;

apps/kubernetes-provider/src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import * as k8s from "@kubernetes/client-node";
2-
import {
2+
import type {
33
EnvironmentType,
44
MachinePreset,
55
PostStartCauses,
66
PreStopCauses,
77
} from "@trigger.dev/core/v3";
8-
import {
9-
ProviderShell,
10-
SimpleLogger,
8+
import type {
119
TaskOperations,
1210
TaskOperationsCreateOptions,
1311
TaskOperationsIndexOptions,
1412
TaskOperationsPrePullDeploymentOptions,
1513
TaskOperationsRestoreOptions,
1614
} from "@trigger.dev/core/v3/apps";
15+
import { ProviderShell, SimpleLogger } from "@trigger.dev/core/v3/apps";
1716
import { PodCleaner } from "./podCleaner";
1817
import { TaskMonitor } from "./taskMonitor";
1918
import { UptimeHeartbeat } from "./uptimeHeartbeat";

apps/kubernetes-provider/src/taskMonitor.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import * as k8s from "@kubernetes/client-node";
2-
import { SimpleLogger } from "@trigger.dev/core/v3/apps";
3-
import { EXIT_CODE_ALREADY_HANDLED, EXIT_CODE_CHILD_NONZERO } from "@trigger.dev/core/v3/apps";
4-
import { setTimeout } from "timers/promises";
5-
import PQueue from "p-queue";
62
import { TaskRunErrorCodes, type Prettify, type TaskRunInternalError } from "@trigger.dev/core/v3";
3+
import {
4+
EXIT_CODE_ALREADY_HANDLED,
5+
EXIT_CODE_CHILD_NONZERO,
6+
SimpleLogger,
7+
} from "@trigger.dev/core/v3/apps";
8+
import PQueue from "p-queue";
9+
import { setTimeout } from "timers/promises";
710

811
type FailureDetails = Prettify<{
912
exitCode: number;

apps/supervisor/src/clients/kubernetes.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import * as https from "node:https";
21
import * as k8s from "@kubernetes/client-node";
3-
import { Informer } from "@kubernetes/client-node";
4-
import { ListPromise } from "@kubernetes/client-node";
5-
import { KubernetesObject } from "@kubernetes/client-node";
2+
import type { Informer, KubernetesObject, ListPromise } from "@kubernetes/client-node";
63
import { assertExhaustive } from "@trigger.dev/core/utils";
74
import { SimpleStructuredLogger } from "@trigger.dev/core/v3/utils/structuredLogger";
5+
import * as https from "node:https";
86

97
export const RUNTIME_ENV = process.env.KUBERNETES_PORT ? "kubernetes" : "local";
108

apps/supervisor/src/services/failedPodHandler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe.skipIf(!process.env.K8S_INTEGRATION_TESTS)("FailedPodHandler Integratio
1414
// Create the test namespace if it doesn't exist
1515
try {
1616
await k8s.core.readNamespace({ name: namespace });
17-
} catch (error) {
17+
} catch (_error) {
1818
await k8s.core.createNamespace({
1919
body: {
2020
metadata: {

0 commit comments

Comments
 (0)