|
| 1 | +import { defineConfig, globalIgnores } from "eslint/config"; |
| 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 defineConfig([ |
| 18 | + globalIgnores(["**/node_modules/", "**/dist/", "**/webpack.config.js", "**/jest.config.js"]), |
| 19 | + { |
| 20 | + extends: compat.extends( |
| 21 | + "eslint:recommended", |
| 22 | + "plugin:@typescript-eslint/eslint-recommended", |
| 23 | + "plugin:@typescript-eslint/recommended", |
| 24 | + "plugin:@typescript-eslint/recommended-requiring-type-checking", |
| 25 | + ), |
| 26 | + |
| 27 | + plugins: { |
| 28 | + "@typescript-eslint": typescriptEslint, |
| 29 | + }, |
| 30 | + |
| 31 | + linterOptions: { |
| 32 | + reportUnusedDisableDirectives: true, |
| 33 | + }, |
| 34 | + |
| 35 | + languageOptions: { |
| 36 | + parser: tsParser, |
| 37 | + ecmaVersion: 5, |
| 38 | + sourceType: "script", |
| 39 | + |
| 40 | + parserOptions: { |
| 41 | + // project: path.join(__dirname, "tsconfig.json"), |
| 42 | + projectService: true, |
| 43 | + }, |
| 44 | + }, |
| 45 | + |
| 46 | + rules: { |
| 47 | + "@typescript-eslint/no-unused-vars": [ |
| 48 | + "error", |
| 49 | + { |
| 50 | + argsIgnorePattern: "^_", |
| 51 | + }, |
| 52 | + ], |
| 53 | + |
| 54 | + "@typescript-eslint/restrict-template-expressions": [ |
| 55 | + "error", |
| 56 | + { |
| 57 | + allowNullish: true, |
| 58 | + }, |
| 59 | + ], |
| 60 | + }, |
| 61 | + }, |
| 62 | +]); |
0 commit comments