import { defineConfig, globalIgnores } from "eslint/config"; import nextVitals from "eslint-config-next/core-web-vitals"; import nextTs from "eslint-config-next/typescript"; const eslintConfig = defineConfig([ ...nextVitals, ...nextTs, // Override default ignores of eslint-config-next. globalIgnores([ // Default ignores of eslint-config-next: ".next/**", "out/**", "build/**", "next-env.d.ts", // Bundled worker output "dist/**", ]), // A value import from the schema in a client component puts drizzle-orm and every table // definition into the browser bundle. Enums are in @/lib/db/enums; types are fine. Pages, layouts // and route handlers run on the server only. { files: ["src/components/**/*.{ts,tsx}", "src/hooks/**/*.{ts,tsx}", "src/app/**/*.{ts,tsx}"], ignores: ["src/app/**/page.tsx", "src/app/**/layout.tsx", "src/app/**/route.ts"], rules: { "@typescript-eslint/no-restricted-imports": [ "error", { paths: [ { name: "@/lib/db/schema", allowTypeImports: true, message: "In client code this bundles drizzle-orm and every table. Import enums from @/lib/db/enums.", }, ], }, ], }, }, ]); export default eslintConfig;