Skip to content

Open-source status page, incident response and uptime monitoring

5.3 KB
Raw Blame
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["eslint", "typescript", "react", "unicorn", "oxc"],
  jsPlugins: ["./scripts/oxlint-plugin-openstatus.js"],
  categories: {
    correctness: "warn",
  },
  rules: {
    // Kept off for parity with the previous Biome config.
    "react/no-array-index-key": "off", // biome suspicious/noArrayIndexKey
    "no-case-declarations": "off", // biome correctness/noSwitchDeclarations
    // No oxlint equivalent, so dropped: biome performance/noAccumulatingSpread,
    // complexity/noForEach, a11y/noSvgWithoutTitle, a11y/useAltText,
    // a11y/useKeyWithClickEvents. Their suppressions are removed.

    // Mirror Biome's recommended set. Existing violations are suppressed in-code.
    "no-unused-vars": [
      "warn",
      {
        argsIgnorePattern: "^_",
        varsIgnorePattern: "^_",
        caughtErrors: "none",
      },
    ],
    "typescript/no-explicit-any": "error",
    "typescript/no-non-null-assertion": "error",
    "react/no-danger": "error",
    "react/exhaustive-deps": "warn",
    "unicorn/prefer-node-protocol": "error",
  },
  ignorePatterns: [
    "packages/ui/src/components/*.ts",
    "packages/ui/src/components/*.tsx",
    // Vendored from the data-table-filters shadcn registry — reformatting or
    // hand-patching these makes the next `shadcn add` a merge conflict.
    "packages/ui/src/components/data-table-filters/**",
    "packages/ui/src/lib/data-table-filters/**",
    "apps/dashboard/src/lib/react-table.d.ts",
    "packages/ui/src/react-table.d.ts",
    "apps/dashboard/src/scripts/*.ts",
    "packages/proto/gen/**",
    "**/*_pb.ts",
    "**/drizzle/meta/**",
    "**/.content-collections/**",
    ".devbox/**",
    "**/*.astro",
  ],
  overrides: [
    {
      // Ban @openstatus/db + drizzle imports in layers migrated onto
      // @openstatus/services. Scope grows one domain per migration PR.
      files: [
        "packages/api/src/router/statusReport.ts",
        "packages/api/src/router/maintenance.ts",
        "packages/api/src/router/incident.ts",
        "packages/api/src/router/monitor.ts",
        "packages/api/src/router/pageComponent.ts",
        "packages/api/src/router/page.ts",
        "packages/api/src/router/workspace.ts",
        "packages/api/src/router/user.ts",
        "packages/api/src/router/invitation.ts",
        "packages/api/src/router/apiKey.ts",
        "packages/api/src/router/import.ts",
        "apps/server/src/routes/rpc/handlers/health/**",
        "apps/server/src/routes/rpc/handlers/status-report/**",
        "apps/server/src/routes/rpc/handlers/maintenance/**",
        "apps/server/src/routes/rpc/handlers/notification/**",
        "apps/server/src/routes/rpc/handlers/incident/**",
        "apps/server/src/routes/slack/interactions.ts",
      ],
      excludeFiles: [
        "**/__tests__/**",
        "**/*.test.ts",
        // Still read db directly: limits.ts queries quotas, converters.ts needs
        // db enum shapes for proto round-trip. Exempt until they move to services.
        "apps/server/src/routes/rpc/handlers/notification/limits.ts",
        "apps/server/src/routes/rpc/handlers/notification/converters.ts",
      ],
      rules: {
        "no-restricted-imports": [
          "error",
          {
            paths: [
              {
                name: "@openstatus/db",
                message:
                  "Use @openstatus/services instead (domain has migrated to the service layer).",
              },
              {
                name: "@openstatus/db/src/schema",
                message: "Use @openstatus/services instead.",
              },
              {
                name: "@openstatus/db/src/schema/plan/utils",
                message: "Use @openstatus/services instead.",
              },
              {
                name: "@openstatus/db/src/schema/plan/schema",
                message: "Use @openstatus/services instead.",
              },
              {
                name: "@openstatus/db/src/schema/plan/config",
                message: "Use @openstatus/services instead.",
              },
              {
                name: "drizzle-orm",
                message: "Use @openstatus/services instead.",
              },
            ],
          },
        ],
      },
    },
    {
      // Tests legitimately use `any` for spies/fixtures.
      files: ["**/*.test.ts", "**/__tests__/**"],
      rules: {
        "typescript/no-explicit-any": "off",
      },
    },
    {
      // Behaviour-triggered, not filename-triggered: anything opening a
      // transaction in the services layer is a mutation.
      files: ["packages/services/src/**/*.ts"],
      excludeFiles: ["**/__tests__/**", "**/*.test.ts"],
      rules: {
        "openstatus/services-mutation-guards": "error",
        // The package stays Edge-safe by design.
        "no-restricted-imports": [
          "error",
          {
            patterns: [
              {
                group: ["node:*"],
                message:
                  "@openstatus/services must stay runtime-agnostic — no node built-ins. Hand-roll the helper (see deepEqual) or move the code to a Node-only package.",
              },
            ],
          },
        ],
      },
    },
    {
      files: ["apps/dashboard/src/**/*.tsx", "apps/dashboard/src/**/*.ts"],
      rules: {
        "openstatus/no-db-barrel-in-client": "error",
      },
    },
  ],
});