/**
 * Root ESLint config — covers scripts/ and any other plain-JS files at the
 * repo root. Package-level configs (packages/*, apps/*) define their own
 * eslint.config.js and take precedence for files inside those directories.
 */
import js from "@eslint/js";

// Minimal Node.js globals for scripts — avoids a peer-dep on `globals`.
const nodeGlobals = {
  process: "readonly",
  console: "readonly",
  URL: "readonly",
  Buffer: "readonly",
  __dirname: "readonly",
  __filename: "readonly",
  setTimeout: "readonly",
  clearTimeout: "readonly",
  setInterval: "readonly",
  clearInterval: "readonly",
};

export default [
  {
    ignores: [
      "node_modules/**",
      "packages/**",
      "apps/**",
      "turbo/**",
      "playwright.config.ts",
    ],
  },
  js.configs.recommended,
  {
    files: ["scripts/**/*.{mjs,cjs,js}"],
    languageOptions: {
      ecmaVersion: 2022,
      sourceType: "module",
      globals: nodeGlobals,
    },
  },
];
