|
| 1 | +import { defineConfig } from 'eslint/config'; |
| 2 | +import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin'; |
| 3 | +import unusedImports from 'eslint-plugin-unused-imports'; |
| 4 | +import globals from 'globals'; |
| 5 | +import tsParser from '@typescript-eslint/parser'; |
| 6 | +import path from 'node:path'; |
| 7 | +import { fileURLToPath } from 'node:url'; |
| 8 | +import js from '@eslint/js'; |
| 9 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 10 | + |
| 11 | +const __filename = fileURLToPath(import.meta.url); |
| 12 | +const __dirname = path.dirname(__filename); |
| 13 | +const compat = new FlatCompat({ |
| 14 | + baseDirectory: __dirname, |
| 15 | + recommendedConfig: js.configs.recommended, |
| 16 | + allConfig: js.configs.all, |
| 17 | +}); |
| 18 | + |
| 19 | +export default defineConfig([ |
| 20 | + { |
| 21 | + extends: compat.extends( |
| 22 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 23 | + 'plugin:@typescript-eslint/recommended', |
| 24 | + 'prettier', |
| 25 | + 'prettier/@typescript-eslint' |
| 26 | + ), |
| 27 | + |
| 28 | + plugins: { |
| 29 | + '@typescript-eslint': typescriptEslintEslintPlugin, |
| 30 | + 'unused-imports': unusedImports, |
| 31 | + }, |
| 32 | + |
| 33 | + languageOptions: { |
| 34 | + globals: { |
| 35 | + ...globals.node, |
| 36 | + ...globals.jest, |
| 37 | + }, |
| 38 | + |
| 39 | + parser: tsParser, |
| 40 | + }, |
| 41 | + |
| 42 | + rules: { |
| 43 | + '@typescript-eslint/no-parameter-properties': 'off', |
| 44 | + '@typescript-eslint/interface-name-prefix': 'off', |
| 45 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 46 | + '@typescript-eslint/no-explicit-any': 'off', |
| 47 | + '@typescript-eslint/no-empty-function': 'off', |
| 48 | + '@typescript-eslint/no-unused-vars': 'off', |
| 49 | + 'unused-imports/no-unused-imports': 2, |
| 50 | + 'unused-imports/no-unused-vars': 1, |
| 51 | + }, |
| 52 | + }, |
| 53 | +]); |
0 commit comments