courtmitra / eslint.config.mjs
Hetansh Waghela
Phase 1 complete: guided frontend + adversarial API fixes + i18n
d0de93d
Raw
History Blame Contribute Delete
2.27 kB
// @ts-check
import tseslint from "typescript-eslint";
/**
* Hexagonal dependency boundary (CLAUDE.md #1): packages/domain + packages/ports
* are PURE — no framework/SDK, no adapters, no db. They may import only
* packages/ports and packages/contracts.
*
* Uses glob `patterns` (not `paths`) so subpath imports like
* "drizzle-orm/node-postgres" or "@nestjs/common" are also caught.
*/
const FORBIDDEN_PATTERNS = [
{ group: ["@nestjs/*"], message: "domain/ports must not import NestJS." },
{ group: ["next", "next/*"], message: "domain/ports must not import Next.js." },
{ group: ["react", "react/*", "react-dom", "react-dom/*"], message: "domain/ports must not import React." },
{ group: ["ai", "ai/*", "openai", "openai/*", "@ai-sdk/*"], message: "domain/ports must not import AI SDKs (use LlmPort)." },
{ group: ["drizzle-orm", "drizzle-orm/*", "pg", "pg/*"], message: "domain/ports must not import the DB layer (use a port)." },
{ group: ["resend", "grammy", "grammy/*"], message: "domain/ports must not import channel/email SDKs (use ports)." },
{ group: ["playwright", "playwright/*"], message: "domain/ports must not import playwright." },
{ group: ["@supabase/*"], message: "domain/ports must not import supabase." },
{ group: ["inngest", "inngest/*"], message: "domain/ports must not import inngest (use WorkflowPort)." },
{ group: ["@aws-sdk/*"], message: "domain/ports must not import the AWS SDK (use a port)." },
{
group: ["@courtmitra/adapters", "@courtmitra/adapters/*", "@courtmitra/db", "@courtmitra/db/*"],
message: "domain/ports must not import adapters or the db package.",
},
];
export default tseslint.config(
{
ignores: ["**/dist/**", "**/.next/**", "**/node_modules/**", "**/.turbo/**", "**/*.config.*", "**/next-env.d.ts", "**/evaluate/**"],
},
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
},
},
{
files: ["packages/domain/**/*.ts", "packages/ports/**/*.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "error",
"no-restricted-imports": ["error", { patterns: FORBIDDEN_PATTERNS }],
},
},
);