import js from "@eslint/js"; export default [ { ignores: ["build/**", "dist/**", "node_modules/**", ".playwright-mcp/**", "SOURCE_MANIFEST.txt"], }, { files: ["**/*.{js,cjs,mjs}"], languageOptions: { ecmaVersion: "latest", sourceType: "module", globals: { Buffer: "readonly", clearInterval: "readonly", clearTimeout: "readonly", console: "readonly", document: "readonly", fetch: "readonly", FormData: "readonly", globalThis: "readonly", process: "readonly", queueMicrotask: "readonly", requestAnimationFrame: "readonly", setInterval: "readonly", setTimeout: "readonly", URL: "readonly", URLSearchParams: "readonly", window: "readonly", confirm: "readonly", localStorage: "readonly", structuredClone: "readonly", }, }, rules: { ...js.configs.recommended.rules, "no-control-regex": "off", "no-empty": ["error", { allowEmptyCatch: true }], "no-undef": "off", "no-unused-vars": "off", "no-useless-escape": "off", "no-eval": "error", "no-implied-eval": "error", eqeqeq: ["error", "always", { null: "ignore" }], }, }, { // The main process and shared modules are plain CommonJS with an explicit // dependency graph, so undefined identifiers there are always real bugs // (missing require, missing injected dependency) rather than a global that // another script tag happens to define. files: ["src/main/**/*.cjs", "src/shared/**/*.cjs", "main.cjs", "preload.cjs"], languageOptions: { sourceType: "commonjs", globals: { require: "readonly", module: "writable", exports: "writable", __dirname: "readonly", __filename: "readonly", Buffer: "readonly", process: "readonly", console: "readonly", setTimeout: "readonly", clearTimeout: "readonly", setInterval: "readonly", clearInterval: "readonly", setImmediate: "readonly", queueMicrotask: "readonly", structuredClone: "readonly", globalThis: "readonly", URL: "readonly", URLSearchParams: "readonly", fetch: "readonly", FormData: "readonly", Blob: "readonly", AbortController: "readonly", AbortSignal: "readonly", TextEncoder: "readonly", TextDecoder: "readonly", }, }, rules: { "no-undef": "error", // Also catches code that a refactor left behind, such as a value computed // from a dependency that is no longer injected. "no-unused-vars": ["error", { args: "none", caughtErrors: "none", ignoreRestSiblings: true }], }, }, { files: ["tests/**/*.mjs"], rules: { "no-regex-spaces": "off", "no-unsafe-finally": "off", }, }, ];