Files
cozsweet-frontend-nextjs/eslint.config.mjs
T

72 lines
1.9 KiB
JavaScript

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,
{
files: ["src/**/*.{ts,tsx}"],
rules: {
"no-restricted-imports": [
"error",
{
paths: [
{
name: "@/data/repositories",
message:
"Import the concrete repository module so unrelated browser storage stays out of the client graph.",
},
{
name: "@/data/storage",
message:
"Import the concrete storage module so unrelated persistence code stays out of the client graph.",
},
],
},
],
},
},
{
files: ["src/app/**/*.{ts,tsx}"],
ignores: ["src/app/api/**", "src/app/**/route.ts"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: [
"@/data/repositories",
"@/data/repositories/*",
"@/data/repositories/**",
],
message:
"App UI should depend on stores or lib use-case helpers instead of repositories.",
},
{
group: [
"@/data/storage",
"@/data/storage/*",
"@/data/storage/**",
],
message:
"App UI should not access storage directly; move persistence behind lib or stores.",
},
],
},
],
},
},
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);
export default eslintConfig;