|
| 1 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 2 | +import tsParser from "@typescript-eslint/parser"; |
| 3 | +import path from "node:path"; |
| 4 | +import { fileURLToPath } from "node:url"; |
| 5 | +import js from "@eslint/js"; |
| 6 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 7 | + |
| 8 | +const __filename = fileURLToPath(import.meta.url); |
| 9 | +const __dirname = path.dirname(__filename); |
| 10 | +const compat = new FlatCompat({ |
| 11 | + baseDirectory: __dirname, |
| 12 | + recommendedConfig: js.configs.recommended, |
| 13 | + allConfig: js.configs.all, |
| 14 | +}); |
| 15 | + |
| 16 | +export default [ |
| 17 | + { |
| 18 | + ignores: [ |
| 19 | + "examples/**/*", |
| 20 | + "tmp/**/*", |
| 21 | + "**/*.js", |
| 22 | + "**/*.d.ts", |
| 23 | + // Can possibly unignored once TypeScript configs becomes supported? Ref. https://github.com/eslint/eslint/pull/18134. |
| 24 | + "eslint.config.mjs", |
| 25 | + ], |
| 26 | + }, |
| 27 | + ...compat.extends( |
| 28 | + "eslint:recommended", |
| 29 | + "plugin:@typescript-eslint/recommended", |
| 30 | + ), |
| 31 | + { |
| 32 | + plugins: { |
| 33 | + "@typescript-eslint": typescriptEslint, |
| 34 | + }, |
| 35 | + |
| 36 | + languageOptions: { |
| 37 | + parser: tsParser, |
| 38 | + ecmaVersion: 5, |
| 39 | + sourceType: "script", |
| 40 | + |
| 41 | + parserOptions: { |
| 42 | + project: ["tsconfig.eslint.json"], |
| 43 | + }, |
| 44 | + }, |
| 45 | + |
| 46 | + rules: { |
| 47 | + "@typescript-eslint/no-unused-vars": [ |
| 48 | + "warn", |
| 49 | + { |
| 50 | + argsIgnorePattern: "^_", |
| 51 | + varsIgnorePattern: "^_", |
| 52 | + caughtErrorsIgnorePattern: "^_", |
| 53 | + }, |
| 54 | + ], |
| 55 | + |
| 56 | + "@typescript-eslint/no-explicit-any": 0, |
| 57 | + "@typescript-eslint/no-floating-promises": "error", |
| 58 | + }, |
| 59 | + }, |
| 60 | +]; |
0 commit comments