|
| 1 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 2 | +import globals from "globals"; |
| 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 | +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call |
| 12 | +const compat = new FlatCompat({ |
| 13 | + baseDirectory: __dirname, |
| 14 | + recommendedConfig: js.configs.recommended, |
| 15 | + allConfig: js.configs.all, |
| 16 | +}); |
| 17 | + |
| 18 | +export default [ |
| 19 | + { |
| 20 | + ignores: ["**/dist", "**/coverage"], |
| 21 | + }, |
| 22 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access |
| 23 | + ...compat.extends( |
| 24 | + "plugin:@typescript-eslint/recommended-type-checked", |
| 25 | + "plugin:@typescript-eslint/strict-type-checked", |
| 26 | + "plugin:@typescript-eslint/stylistic-type-checked", |
| 27 | + "prettier", |
| 28 | + ), |
| 29 | + { |
| 30 | + plugins: { |
| 31 | + "@typescript-eslint": typescriptEslint, |
| 32 | + }, |
| 33 | + |
| 34 | + languageOptions: { |
| 35 | + globals: { |
| 36 | + ...globals.browser, |
| 37 | + ...globals.node, |
| 38 | + }, |
| 39 | + |
| 40 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment |
| 41 | + parser: tsParser, |
| 42 | + ecmaVersion: 5, |
| 43 | + sourceType: "commonjs", |
| 44 | + |
| 45 | + parserOptions: { |
| 46 | + project: path.join(__dirname, "tsconfig.lint.json"), |
| 47 | + tsconfigRootDir: __dirname, |
| 48 | + }, |
| 49 | + }, |
| 50 | + |
| 51 | + rules: { |
| 52 | + "@typescript-eslint/no-unused-vars": [ |
| 53 | + "warn", |
| 54 | + { |
| 55 | + argsIgnorePattern: "^_", |
| 56 | + }, |
| 57 | + ], |
| 58 | + |
| 59 | + "@typescript-eslint/no-unsafe-argument": "off", |
| 60 | + }, |
| 61 | + }, |
| 62 | +]; |
0 commit comments