diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..5d74c6d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,44 @@ +// ESLint 9+ flat config format (global default) +// See: https://eslint.org/docs/latest/use/configure/configuration-files + +export default [ + { + files: ["**/*.js", "**/*.mjs", "**/*.cjs"], + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + globals: { + // Browser globals + console: "readonly", + window: "readonly", + document: "readonly", + navigator: "readonly", + // Node.js globals + process: "readonly", + __dirname: "readonly", + __filename: "readonly", + require: "readonly", + module: "readonly", + exports: "readonly", + global: "readonly", + Buffer: "readonly", + }, + }, + rules: { + // Recommended rules + "no-undef": "error", + "no-unused-vars": "warn", + "no-unreachable": "warn", + "no-constant-condition": "error", + "no-duplicate-case": "error", + + // Best practices + "eqeqeq": ["warn", "always"], + "no-implicit-globals": "warn", + + // Style (minimal) + "semi": ["warn", "always"], + "quotes": ["warn", "double", { "avoidEscape": true }], + }, + }, +];