import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; import sortImportsEs6Autofix from "eslint-plugin-sort-imports-es6-autofix"; import typescriptEslint from "@typescript-eslint/eslint-plugin"; import prettier from "eslint-plugin-prettier"; 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 [...fixupConfigRules(compat.extends( "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking", "prettier", )), { plugins: { "sort-imports-es6-autofix": sortImportsEs6Autofix, "@typescript-eslint": fixupPluginRules(typescriptEslint), prettier, }, languageOptions: { globals: { ...globals.browser, pageContent: "writable", module: "writable", process: "writable", BUILD_STRING: "writable", }, parser: tsParser, ecmaVersion: 12, sourceType: "module", parserOptions: { experimentalObjectRestSpread: true, project: "./tsconfig.json", }, }, settings: { "import/ignore": ["preact"], "import/resolver": { node: { extensions: [".js", ".ts", ".tsx"], }, }, }, rules: { "import/no-named-as-default-member": "off", "no-unused-vars": ["off"], "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", }], "@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false, }], "@typescript-eslint/require-await": ["off"], "@typescript-eslint/no-empty-function": ["off"], "@typescript-eslint/ban-ts-comment": ["off"], "sort-imports-es6-autofix/sort-imports-es6": [2], "@typescript-eslint/no-explicit-any": [2], "prettier/prettier": 2, }, }];