Skip to content

Commit bfa902b

Browse files
authored
chore: enable more linters (#4080)
Re-enables ~15 oxlint rules that were blanket-disabled before.
1 parent baaecfc commit bfa902b

43 files changed

Lines changed: 74 additions & 271 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: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,19 @@
77
"**/*.d.ts",
88
"**/seed.js",
99
"**/seedCloud.ts",
10-
"**/populate.js"
10+
"**/populate.js",
11+
"internal-packages/tsql/src/grammar/"
1112
],
12-
// All rules below are disabled because they currently fire on the existing
13-
// codebase (1748 warnings across these 20 rules as of this commit). Disabled
14-
// to keep the lint baseline green; re-enable and fix incrementally.
1513
"rules": {
16-
// eslint
1714
"no-unused-vars": "off",
18-
"no-unused-expressions": "off",
19-
"no-control-regex": "off",
2015
"no-empty-pattern": "off",
21-
"no-unused-private-class-members": "off",
22-
"no-useless-catch": "off",
23-
"no-unsafe-optional-chaining": "off",
24-
"no-unreachable": "off",
25-
"require-yield": "off",
26-
"no-async-promise-executor": "off",
27-
"no-unsafe-finally": "off",
28-
"no-useless-escape": "off",
29-
// typescript
30-
"typescript/consistent-type-imports": "off",
31-
"typescript/no-this-alias": "off",
16+
"no-control-regex": "off",
3217
"typescript/no-non-null-asserted-optional-chain": "off",
33-
"typescript/no-unnecessary-parameter-property-assignment": "off",
34-
// import
18+
"no-unused-expressions": ["warn", { "allowShortCircuit": true, "allowTernary": true }],
19+
"typescript/consistent-type-imports": "off",
3520
"import/no-duplicates": "off",
3621
"import/namespace": "off",
37-
// react
38-
"react/jsx-key": "off",
39-
"react/no-children-prop": "off",
40-
// react-hooks
4122
"react-hooks/exhaustive-deps": "off",
42-
// oxlint treats any use*()/use() call as a React hook, producing false
43-
// positives in async/test code (testcontainers, cli-v3 e2e).
4423
"react-hooks/rules-of-hooks": "off"
4524
}
4625
}

apps/coordinator/src/checkpointer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ export class Checkpointer {
597597
if (signal.aborted) {
598598
this.#logger.error("Checkpoint canceled: Cleanup", { options });
599599

600-
// Overrides any prior return value
600+
// Overrides any prior return value (intentional use of return-in-finally)
601+
// eslint-disable-next-line no-unsafe-finally
601602
return { success: false, reason: "CANCELED" };
602603
}
603604
}

apps/kubernetes-provider/src/podCleaner.ts

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,6 @@ export class PodCleaner {
165165
this.logger.log("Deleting failed runs: Done", { total, elapsedMs });
166166
}
167167

168-
async #deleteUnrecoverableRuns() {
169-
await this.#deletePods({
170-
namespace: this.namespace,
171-
fieldSelector: "status.phase=?",
172-
labelSelector: "app=task-run",
173-
});
174-
}
175-
176168
async #deleteCompletedPrePulls() {
177169
this.logger.log("Deleting completed pre-pulls");
178170

@@ -256,68 +248,4 @@ export class PodCleaner {
256248
this.enabled = false;
257249
this.logger.log("Shutting down..");
258250
}
259-
260-
async #launchTests() {
261-
const createPod = async (
262-
container: k8s.V1Container,
263-
name: string,
264-
labels?: Record<string, string>
265-
) => {
266-
this.logger.log("Creating pod:", name);
267-
268-
const pod = {
269-
metadata: {
270-
name,
271-
labels,
272-
},
273-
spec: {
274-
restartPolicy: "Never",
275-
automountServiceAccountToken: false,
276-
terminationGracePeriodSeconds: 1,
277-
containers: [container],
278-
},
279-
} satisfies k8s.V1Pod;
280-
281-
await this.k8sClient.core
282-
.createNamespacedPod(this.namespace, pod)
283-
.catch(this.#handleK8sError.bind(this));
284-
};
285-
286-
const createIdlePod = async (name: string, labels?: Record<string, string>) => {
287-
const container = {
288-
name,
289-
image: "docker.io/library/busybox",
290-
command: ["sh"],
291-
args: ["-c", "sleep infinity"],
292-
} satisfies k8s.V1Container;
293-
294-
await createPod(container, name, labels);
295-
};
296-
297-
const createCompletedPod = async (name: string, labels?: Record<string, string>) => {
298-
const container = {
299-
name,
300-
image: "docker.io/library/busybox",
301-
command: ["sh"],
302-
args: ["-c", "true"],
303-
} satisfies k8s.V1Container;
304-
305-
await createPod(container, name, labels);
306-
};
307-
308-
const createFailedPod = async (name: string, labels?: Record<string, string>) => {
309-
const container = {
310-
name,
311-
image: "docker.io/library/busybox",
312-
command: ["sh"],
313-
args: ["-c", "false"],
314-
} satisfies k8s.V1Container;
315-
316-
await createPod(container, name, labels);
317-
};
318-
319-
await createIdlePod("test-idle-1", { app: "task-run" });
320-
await createFailedPod("test-failed-1", { app: "task-run" });
321-
await createCompletedPod("test-completed-1", { app: "task-run" });
322-
}
323251
}

apps/kubernetes-provider/src/taskMonitor.ts

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -379,81 +379,4 @@ export class TaskMonitor {
379379

380380
this.#printStats(true);
381381
}
382-
383-
async #launchTests() {
384-
const createPod = async (
385-
container: k8s.V1Container,
386-
name: string,
387-
labels?: Record<string, string>
388-
) => {
389-
this.#logger.log("Creating pod:", name);
390-
391-
const pod = {
392-
metadata: {
393-
name,
394-
labels,
395-
},
396-
spec: {
397-
restartPolicy: "Never",
398-
automountServiceAccountToken: false,
399-
terminationGracePeriodSeconds: 1,
400-
containers: [container],
401-
},
402-
} satisfies k8s.V1Pod;
403-
404-
await this.#k8sClient.core
405-
.createNamespacedPod(this.namespace, pod)
406-
.catch(this.#handleK8sError.bind(this));
407-
};
408-
409-
const createOomPod = async (name: string, labels?: Record<string, string>) => {
410-
const container = {
411-
name,
412-
image: "polinux/stress",
413-
resources: {
414-
limits: {
415-
memory: "100Mi",
416-
},
417-
},
418-
command: ["stress"],
419-
args: ["--vm", "1", "--vm-bytes", "150M", "--vm-hang", "1"],
420-
} satisfies k8s.V1Container;
421-
422-
await createPod(container, name, labels);
423-
};
424-
425-
const createNonZeroExitPod = async (name: string, labels?: Record<string, string>) => {
426-
const container = {
427-
name,
428-
image: "docker.io/library/busybox",
429-
command: ["sh"],
430-
args: ["-c", "exit 1"],
431-
} satisfies k8s.V1Container;
432-
433-
await createPod(container, name, labels);
434-
};
435-
436-
const createOoDiskPod = async (name: string, labels?: Record<string, string>) => {
437-
const container = {
438-
name,
439-
image: "docker.io/library/busybox",
440-
command: ["sh"],
441-
args: [
442-
"-c",
443-
"echo creating huge-file..; head -c 1000m /dev/zero > huge-file; ls -lh huge-file; sleep infinity",
444-
],
445-
resources: {
446-
limits: {
447-
"ephemeral-storage": "500Mi",
448-
},
449-
},
450-
} satisfies k8s.V1Container;
451-
452-
await createPod(container, name, labels);
453-
};
454-
455-
await createNonZeroExitPod("non-zero-exit-task", { app: "task-run", run: "123" });
456-
await createOomPod("oom-task", { app: "task-index", deployment: "456" });
457-
await createOoDiskPod("ood-task", { app: "task-run", run: "abc" });
458-
}
459382
}

apps/webapp/app/components/admin/debugRun.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ function DebugRunDataEngineV2({
388388
</Property.Value>
389389
</Property.Item>
390390
{keys.map((key) => (
391-
<Property.Item>
391+
<Property.Item key={key.key}>
392392
<Property.Label>{key.label}</Property.Label>
393393
<Property.Value className="flex items-center gap-2">
394394
<ClipboardField value={key.key} variant="tertiary/small" iconButton />

apps/webapp/app/components/primitives/Select.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,9 @@ export function Select<TValue extends string | string[], TItem>({
223223
{typeof children === "function" ? (
224224
matches.length > 0 ? (
225225
isSection(matches) ? (
226-
<SelectGroupedRenderer
227-
items={matches}
228-
children={children}
229-
enableItemShortcuts={enableItemShortcuts}
230-
/>
226+
<SelectGroupedRenderer items={matches} enableItemShortcuts={enableItemShortcuts}>
227+
{children}
228+
</SelectGroupedRenderer>
231229
) : (
232230
children(matches as ItemFromSection<TItem>[], {
233231
shortcutsEnabled: enableItemShortcuts,

apps/webapp/app/models/taskQueue.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ export async function findQueueInEnvironment(
5959

6060
// Only allow alphanumeric characters, underscores, hyphens, and slashes (and only the first 128 characters)
6161
export function sanitizeQueueName(queueName: string) {
62-
return queueName.replace(/[^a-zA-Z0-9_\-\/]/g, "").substring(0, 128);
62+
return queueName.replace(/[^a-zA-Z0-9_\-/]/g, "").substring(0, 128);
6363
}

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.models._index/route.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ function buildComparisonRows(
656656
const slug = c?.provider ?? dataMap.get(m)?.genAiSystem;
657657
if (!slug) return "—";
658658
return (
659-
<span className="flex items-center gap-1.5">
659+
<span key={m} className="flex items-center gap-1.5">
660660
{providerIcon(slug)}
661661
{formatProviderName(slug)}
662662
</span>
@@ -700,7 +700,10 @@ function buildComparisonRows(
700700
label: formatFeature(feature),
701701
values: models.map((m) =>
702702
getCatalog(m)?.features.includes(feature) ? (
703-
<CheckIcon className="size-4 text-success/70 group-hover/table-row:text-success" />
703+
<CheckIcon
704+
key={m}
705+
className="size-4 text-success/70 group-hover/table-row:text-success"
706+
/>
704707
) : (
705708
"—"
706709
)

apps/webapp/app/services/apiRateLimit.server.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ export const apiRateLimiter = authorizationRateLimitMiddleware({
5252
"/api/v1/token",
5353
"/api/v1/usage/ingest",
5454
"/api/v1/plain/customer-cards",
55-
/^\/api\/v1\/tasks\/[^\/]+\/callback\/[^\/]+$/, // /api/v1/tasks/$id/callback/$secret
56-
/^\/api\/v1\/runs\/[^\/]+\/tasks\/[^\/]+\/callback\/[^\/]+$/, // /api/v1/runs/$runId/tasks/$id/callback/$secret
57-
/^\/api\/v1\/http-endpoints\/[^\/]+\/env\/[^\/]+\/[^\/]+$/, // /api/v1/http-endpoints/$httpEndpointId/env/$envType/$shortcode
58-
/^\/api\/v1\/sources\/http\/[^\/]+$/, // /api/v1/sources/http/$id
59-
/^\/api\/v1\/endpoints\/[^\/]+\/[^\/]+\/index\/[^\/]+$/, // /api/v1/endpoints/$environmentId/$endpointSlug/index/$indexHookIdentifier
55+
/^\/api\/v1\/tasks\/[^/]+\/callback\/[^/]+$/, // /api/v1/tasks/$id/callback/$secret
56+
/^\/api\/v1\/runs\/[^/]+\/tasks\/[^/]+\/callback\/[^/]+$/, // /api/v1/runs/$runId/tasks/$id/callback/$secret
57+
/^\/api\/v1\/http-endpoints\/[^/]+\/env\/[^/]+\/[^/]+$/, // /api/v1/http-endpoints/$httpEndpointId/env/$envType/$shortcode
58+
/^\/api\/v1\/sources\/http\/[^/]+$/, // /api/v1/sources/http/$id
59+
/^\/api\/v1\/endpoints\/[^/]+\/[^/]+\/index\/[^/]+$/, // /api/v1/endpoints/$environmentId/$endpointSlug/index/$indexHookIdentifier
6060
"/api/v1/timezones",
6161
"/api/v1/usage/ingest",
6262
"/api/v1/auth/jwt/claims",
63-
/^\/api\/v1\/runs\/[^\/]+\/attempts$/, // /api/v1/runs/$runFriendlyId/attempts
64-
/^\/api\/v1\/waitpoints\/tokens\/[^\/]+\/callback\/[^\/]+$/, // /api/v1/waitpoints/tokens/$waitpointFriendlyId/callback/$hash
63+
/^\/api\/v1\/runs\/[^/]+\/attempts$/, // /api/v1/runs/$runFriendlyId/attempts
64+
/^\/api\/v1\/waitpoints\/tokens\/[^/]+\/callback\/[^/]+$/, // /api/v1/waitpoints/tokens/$waitpointFriendlyId/callback/$hash
6565
/^\/api\/v\d+\/deployments/, // /api/v{1,2,3,n}/deployments/*
6666
// Internal SDK plumbing — packets are presigned-URL handshakes for
6767
// payload uploads (v2 PUT) and downloads (v1 GET), authenticated via
@@ -70,7 +70,7 @@ export const apiRateLimiter = authorizationRateLimitMiddleware({
7070
// customer-facing surface so customer rate limits shouldn't apply.
7171
/^\/api\/v1\/packets\//,
7272
/^\/api\/v2\/packets\//,
73-
/^\/api\/v1\/sessions\/[^\/]+\/snapshot-url$/,
73+
/^\/api\/v1\/sessions\/[^/]+\/snapshot-url$/,
7474
],
7575
log: {
7676
rejections: env.API_RATE_LIMIT_REJECTION_LOGS_ENABLED === "1",

apps/webapp/app/utils/errorFingerprinting.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function normalizeErrorMessage(message: string): string {
5454
// Standalone numeric IDs (4+ digits)
5555
.replace(/\b\d{4,}\b/g, "<id>")
5656
// File paths (Unix style)
57-
.replace(/(?:\/[^\/\s]+){2,}/g, "<path>")
57+
.replace(/(?:\/[^/\s]+){2,}/g, "<path>")
5858
// File paths (Windows style)
5959
.replace(/[A-Z]:\\(?:[^\\]+\\)+[^\\]+/g, "<path>")
6060
// Email addresses
@@ -83,7 +83,7 @@ export function normalizeStackTrace(stack: string): string {
8383
// Remove standalone numbers
8484
line = line.replace(/\b\d+\b/g, "_");
8585
// Remove file paths but keep filename
86-
line = line.replace(/(?:\/[^\/\s]+)+\/([^\/\s]+)/g, "$1");
86+
line = line.replace(/(?:\/[^/\s]+)+\/([^/\s]+)/g, "$1");
8787
// Normalize whitespace
8888
line = line.trim();
8989
return line;

0 commit comments

Comments
 (0)