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,
  {
    rules: {
      "@typescript-eslint/no-unused-vars": ["error", {
        argsIgnorePattern: "^_",
        varsIgnorePattern: "^_",
        caughtErrorsIgnorePattern: "^_",
        destructuredArrayIgnorePattern: "^_",
      }],
      "@typescript-eslint/no-explicit-any": "error",
      "@typescript-eslint/no-require-imports": "error",
      "@next/next/no-html-link-for-pages": "off",
    }
  },
  // Override default ignores of eslint-config-next.
  globalIgnores([
    ".next/**",
    "out/**",
    "build/**",
    "next-env.d.ts",
    // Legacy utility scripts (non-application code)
    "*.js",
    "fix-*.ts",
    "alter*.js",
    "alter*.py",
    "check_*.py",
    "ssh_*.py",
    "deploy_*.py",
    "restart_*.py",
    "dump_*.py",
    "fetch_*.py",
    "fix_*.py",
  ]),
]);

export default eslintConfig;
