|
| 1 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 2 | +import js from '@eslint/js'; |
| 3 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 4 | +import { defineConfig, globalIgnores } from 'eslint/config'; |
| 5 | +import globals from 'globals'; |
| 6 | +import path from 'node:path'; |
| 7 | +import { fileURLToPath } from 'node:url'; |
| 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(['dist/**', 'node_modules/**', '**/generated/**']), |
| 19 | + { |
| 20 | + files: ['**/*.ts'], |
| 21 | + extends: compat.extends( |
| 22 | + 'eslint:recommended', |
| 23 | + 'plugin:@typescript-eslint/recommended' |
| 24 | + ), |
| 25 | + |
| 26 | + plugins: { |
| 27 | + '@typescript-eslint': typescriptEslint, |
| 28 | + }, |
| 29 | + |
| 30 | + languageOptions: { |
| 31 | + globals: { |
| 32 | + ...globals.node, |
| 33 | + }, |
| 34 | + |
| 35 | + ecmaVersion: 2020, |
| 36 | + sourceType: 'module', |
| 37 | + |
| 38 | + parserOptions: { |
| 39 | + parser: '@typescript-eslint/parser', |
| 40 | + }, |
| 41 | + }, |
| 42 | + |
| 43 | + rules: { |
| 44 | + '@typescript-eslint/consistent-type-imports': 'error', |
| 45 | + |
| 46 | + '@typescript-eslint/no-unused-vars': [ |
| 47 | + 'warn', |
| 48 | + { |
| 49 | + argsIgnorePattern: '^_', |
| 50 | + }, |
| 51 | + ], |
| 52 | + |
| 53 | + 'guard-for-in': 'error', |
| 54 | + 'no-prototype-builtins': 'off', |
| 55 | + 'semi': ['error', 'always'], |
| 56 | + }, |
| 57 | + }, |
| 58 | +]); |
0 commit comments