diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 4fbb3ca..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "env": { - "es2022": true, - "node": true - }, - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": ["@typescript-eslint", "import"], - "rules": { - "import/no-duplicates": "error" - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..e73de31 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,42 @@ +import { defineConfig } from "eslint/config"; +import typescriptEslint from "@typescript-eslint/eslint-plugin"; +import _import from "eslint-plugin-import"; +import { fixupPluginRules } 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: compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), + + plugins: { + "@typescript-eslint": typescriptEslint, + import: fixupPluginRules(_import), + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.sourceType, + }, + + parser: tsParser, + ecmaVersion: "latest", + sourceType: "module", + }, + + rules: { + "import/no-duplicates": "error", + }, +}]); \ No newline at end of file diff --git a/package.json b/package.json index fced57a..04f899a 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,15 @@ "lint:fix": "eslint ./workbench/resources/js --ext .ts,.tsx --fix" }, "devDependencies": { + "@eslint/compat": "^1.3.0", + "@eslint/js": "^9.29.0", "@types/node": "^22.7.5", - "@typescript-eslint/eslint-plugin": "^7.0.0", - "@typescript-eslint/parser": "^7.0.0", - "eslint": "^8.56.0", - "eslint-plugin-import": "^2.29.1", - "happy-dom": "^15.11.7", - "vitest": "^2.1.3" + "@typescript-eslint/eslint-plugin": "^8.34.1", + "@typescript-eslint/parser": "^8.34.1", + "eslint": "^9.29.0", + "eslint-plugin-import": "^2.31.0", + "globals": "^16.2.0", + "happy-dom": "^18.0.1", + "vitest": "^3.2.3" } }