|
| 1 | +import globals from "globals"; |
| 2 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 3 | +import tsParser from "@typescript-eslint/parser"; |
| 4 | +import path from "node:path"; |
| 5 | +import { fileURLToPath } from "node:url"; |
| 6 | +import js from "@eslint/js"; |
| 7 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 8 | + |
| 9 | +const __filename = fileURLToPath(import.meta.url); |
| 10 | +const __dirname = path.dirname(__filename); |
| 11 | +const compat = new FlatCompat({ |
| 12 | + baseDirectory: __dirname, |
| 13 | + recommendedConfig: js.configs.recommended, |
| 14 | + allConfig: js.configs.all |
| 15 | +}); |
| 16 | + |
| 17 | +export default [{ |
| 18 | + ignores: ["node_modules", "index.js"], |
| 19 | +}, ...compat.extends("eslint:recommended"), { |
| 20 | + languageOptions: { |
| 21 | + globals: { |
| 22 | + ...globals.browser, |
| 23 | + ...globals.node, |
| 24 | + }, |
| 25 | + |
| 26 | + ecmaVersion: "latest", |
| 27 | + sourceType: "module", |
| 28 | + }, |
| 29 | + |
| 30 | + rules: { |
| 31 | + "no-constant-condition": "off", |
| 32 | + "no-sparse-arrays": "off", |
| 33 | + }, |
| 34 | +}, ...compat.extends( |
| 35 | + "plugin:@typescript-eslint/eslint-recommended", |
| 36 | + "plugin:@typescript-eslint/recommended", |
| 37 | +).map(config => ({ |
| 38 | + ...config, |
| 39 | + files: ["**/*.ts", "**/*.tsx"], |
| 40 | +})), { |
| 41 | + files: ["**/*.ts", "**/*.tsx"], |
| 42 | + |
| 43 | + plugins: { |
| 44 | + "@typescript-eslint": typescriptEslint, |
| 45 | + }, |
| 46 | + |
| 47 | + languageOptions: { |
| 48 | + parser: tsParser, |
| 49 | + }, |
| 50 | + |
| 51 | + rules: { |
| 52 | + "@typescript-eslint/no-empty-object-type": "off", |
| 53 | + "@typescript-eslint/no-unsafe-function-type": "error", |
| 54 | + "@typescript-eslint/no-wrapper-object-types": "error", |
| 55 | + |
| 56 | + semi: [2, "always"], |
| 57 | + }, |
| 58 | +}]; |
0 commit comments