diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..b61980a --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,42 @@ +import { defineConfig } from "eslint/config"; +import { fixupConfigRules } from "@eslint/compat"; +import globals from "globals"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +export default defineConfig([ + { + extends: fixupConfigRules( + compat.extends( + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:import/recommended", + "plugin:import/electron", + "plugin:import/typescript", + ), + ), + + ignores: [".vite/**"], + + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + + parser: tsParser, + }, + }, +]); diff --git a/package-lock.json b/package-lock.json index 1de731d..b3c5fcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,9 @@ "@electron-forge/plugin-fuses": "^7.10.2", "@electron-forge/plugin-vite": "^7.10.2", "@electron/fuses": "^1.8.0", + "@eslint/compat": "^1.4.1", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "^9.39.1", "@tailwindcss/vite": "^4.1.17", "@types/electron-squirrel-startup": "^1.0.2", "@typescript-eslint/eslint-plugin": "^8.46.3", @@ -31,6 +34,7 @@ "electron": "39.1.1", "eslint": "^9.39.1", "eslint-plugin-import": "^2.32.0", + "globals": "^16.5.0", "prettier": "^3.6.2", "tailwindcss": "^4.1.17", "typescript": "~5.9.3", @@ -1778,6 +1782,27 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/compat": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-1.4.1.tgz", + "integrity": "sha512-cfO82V9zxxGBxcQDr1lfaYB7wykTa0b00mGa36FrJl7iTFd0Z2cHfEYuxcBRP/iNijCsWsEkA+jzT8hGYmv33w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": "^8.40 || 9" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, "node_modules/@eslint/config-array": { "version": "0.21.1", "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", @@ -1843,6 +1868,19 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/eslintrc/node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -7067,9 +7105,9 @@ } }, "node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 22ea1d4..8b28366 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,9 @@ "@electron-forge/plugin-fuses": "^7.10.2", "@electron-forge/plugin-vite": "^7.10.2", "@electron/fuses": "^1.8.0", + "@eslint/compat": "^1.4.1", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "^9.39.1", "@tailwindcss/vite": "^4.1.17", "@types/electron-squirrel-startup": "^1.0.2", "@typescript-eslint/eslint-plugin": "^8.46.3", @@ -38,6 +41,7 @@ "electron": "39.1.1", "eslint": "^9.39.1", "eslint-plugin-import": "^2.32.0", + "globals": "^16.5.0", "prettier": "^3.6.2", "tailwindcss": "^4.1.17", "typescript": "~5.9.3",