SurfSense/surfsense_web/eslint.config.mjs

42 lines
1,002 B
JavaScript
Raw Normal View History

2025-07-27 11:47:38 -07:00
import { FlatCompat } from "@eslint/eslintrc";
2025-04-07 23:47:06 -07:00
import { dirname } from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
2025-07-27 10:05:37 -07:00
baseDirectory: __dirname,
2025-04-07 23:47:06 -07:00
});
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
{
rules: {
"no-restricted-imports": [
"error",
{
paths: [
{
name: "@/lib/env-config",
importNames: ["BACKEND_URL"],
message:
"Use buildBackendUrl(path, params) for browser-facing backend URLs. BACKEND_URL is empty in proxy mode; importing it bypasses the single URL seam.",
},
],
patterns: [
{
group: ["**/env-config", "**/env-config.ts"],
importNames: ["BACKEND_URL"],
message:
"Use buildBackendUrl(path, params). Import BACKEND_URL only inside lib/env-config.ts.",
},
],
},
],
},
},
];
2025-04-07 23:47:06 -07:00
export default eslintConfig;