diff --git a/.oxlintrc.jsonc b/.oxlintrc.jsonc index b8a9eeac4a..1c196ee2ed 100644 --- a/.oxlintrc.jsonc +++ b/.oxlintrc.jsonc @@ -6,19 +6,43 @@ "oxc", "react", "react-perf", + "import", + // TODO: - // "vitest", + // "jsx-a11y", + "vitest", // "jsdoc", ], "categories": { "correctness": "error", - "perf": "warn", + // "suspicious": "error", + // "restriction": "error", + // "perf": "warn", }, "rules": { - "typescript/no-explicit-any": "error", // ====================================== // grida-specific overrides: - "typescript/no-namespace": "off", + "no-namespace": "off", + + // `test.todo` / `it.todo` is Vitest's sanctioned way to track planned- + // but-not-yet-written tests. We prefer it over `.skip` + TODO comments + // (`jest/no-disabled-tests` rejects those). The `vitest/warn-todo` rule + // is opinionated the other way; keep it at warn so CI doesn't fail on + // legitimate todos while still surfacing them during local development. + "vitest/warn-todo": "warn", + + // ====================================== + // restriction + "no-explicit-any": "error", + "no-import-type-side-effects": "error", + "no-var": "error", + // + // "no-invalid-void-type": "error", + // "no-empty-function": "error", + // "no-optional-chaining": "error", + // "no-alert": "error", + // "default-case": "error", + // }, "env": { "builtin": true, @@ -36,4 +60,20 @@ "worker-configuration.d.ts", "database-generated.types.ts", ], + "overrides": [ + { + // Benchmark / perf test files intentionally measure timing and do not + // assert correctness. They log results to stdout and surface failures + // by throwing on regressions, not via `expect(...)`. Exempt them from + // the `expect-expect` rule only. + "files": [ + "**/__tests__/bench/**", + "**/*.bench.test.ts", + "**/bench-*.test.ts", + ], + "rules": { + "jest/expect-expect": "off", + }, + }, + ], } diff --git a/apps/viewer/app/v1/pdf/[[...file]]/viewer.tsx b/apps/viewer/app/v1/pdf/[[...file]]/viewer.tsx index 3fa22bc083..e17688c720 100644 --- a/apps/viewer/app/v1/pdf/[[...file]]/viewer.tsx +++ b/apps/viewer/app/v1/pdf/[[...file]]/viewer.tsx @@ -29,6 +29,7 @@ export default function PDFViewer({ return (
{ }, 120_000); } - if (fixtures.length === 0) { - it("no .grida fixtures found (skipped)", () => { - console.log( - "[wasm-bench] No .grida fixtures in lib/__test__/fixtures/local/. " + - "Place .grida files there to benchmark real scenes." - ); - }); - } + it.skipIf(fixtures.length > 0)("no .grida fixtures found (skipped)", () => { + console.log( + "[wasm-bench] No .grida fixtures in lib/__test__/fixtures/local/. " + + "Place .grida files there to benchmark real scenes." + ); + }); }); describe("cross-boundary: TS encode → WASM decode", () => { @@ -201,7 +199,8 @@ describe("cross-boundary: TS encode → WASM decode", () => { }); } - if (sharedFixtures.length === 0) { - it("no shared .grida fixtures found (skipped)", () => {}); - } + it.skipIf(sharedFixtures.length > 0)( + "no shared .grida fixtures found (skipped)", + () => {} + ); }); diff --git a/editor/app/(api)/private/west/campaigns/[campaign_id]/participants/import/route.ts b/editor/app/(api)/private/west/campaigns/[campaign_id]/participants/import/route.ts index 6847c16754..6bf7c34e2e 100644 --- a/editor/app/(api)/private/west/campaigns/[campaign_id]/participants/import/route.ts +++ b/editor/app/(api)/private/west/campaigns/[campaign_id]/participants/import/route.ts @@ -1,4 +1,4 @@ -import { type Platform } from "@/lib/platform"; +import type { Platform } from "@/lib/platform"; import { createWestReferralClient } from "@/lib/supabase/server"; import { NextRequest, NextResponse } from "next/server"; diff --git a/editor/app/(canvas)/canvas/tools/ai/_components/canvas.tsx b/editor/app/(canvas)/canvas/tools/ai/_components/canvas.tsx index e44d440b4b..40083519a3 100644 --- a/editor/app/(canvas)/canvas/tools/ai/_components/canvas.tsx +++ b/editor/app/(canvas)/canvas/tools/ai/_components/canvas.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef } from "react"; import { cn } from "@/components/lib/utils"; -import { type DeepPartial } from "ai"; -import { type PortableNode } from "../schema"; +import type { DeepPartial } from "ai"; +import type { PortableNode } from "../schema"; const DEFAULT_IFRAME_HTML = ` @@ -51,6 +51,7 @@ export function Canvas({ return (