|
| 1 | +import { defineConfig, globalIgnores } from 'eslint/config' |
| 2 | +import typescriptEslint from '@typescript-eslint/eslint-plugin' |
| 3 | +import _import from 'eslint-plugin-import' |
| 4 | +import jest from 'eslint-plugin-jest' |
| 5 | +import prettier from 'eslint-plugin-prettier' |
| 6 | +import { fixupPluginRules } from '@eslint/compat' |
| 7 | +import globals from 'globals' |
| 8 | +import tsParser from '@typescript-eslint/parser' |
| 9 | +import path from 'node:path' |
| 10 | +import { fileURLToPath } from 'node:url' |
| 11 | +import js from '@eslint/js' |
| 12 | +import { FlatCompat } from '@eslint/eslintrc' |
| 13 | + |
| 14 | +const __filename = fileURLToPath(import.meta.url) |
| 15 | +const __dirname = path.dirname(__filename) |
| 16 | +const compat = new FlatCompat({ |
| 17 | + baseDirectory: __dirname, |
| 18 | + recommendedConfig: js.configs.recommended, |
| 19 | + allConfig: js.configs.all |
| 20 | +}) |
| 21 | + |
| 22 | +export default defineConfig([ |
| 23 | + globalIgnores([ |
| 24 | + '**/coverage', |
| 25 | + '**/dist', |
| 26 | + '**/megalinter-reports', |
| 27 | + '**/node_modules' |
| 28 | + ]), |
| 29 | + { |
| 30 | + extends: compat.extends( |
| 31 | + 'eslint:recommended', |
| 32 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 33 | + 'plugin:@typescript-eslint/recommended', |
| 34 | + 'plugin:jest/recommended', |
| 35 | + 'plugin:prettier/recommended' |
| 36 | + ), |
| 37 | + |
| 38 | + plugins: { |
| 39 | + '@typescript-eslint': typescriptEslint, |
| 40 | + import: fixupPluginRules(_import), |
| 41 | + jest, |
| 42 | + prettier |
| 43 | + }, |
| 44 | + |
| 45 | + languageOptions: { |
| 46 | + globals: { |
| 47 | + ...globals.node, |
| 48 | + ...globals.jest, |
| 49 | + Atomics: 'readonly', |
| 50 | + SharedArrayBuffer: 'readonly' |
| 51 | + }, |
| 52 | + |
| 53 | + parser: tsParser, |
| 54 | + ecmaVersion: 2023, |
| 55 | + sourceType: 'module', |
| 56 | + |
| 57 | + parserOptions: { |
| 58 | + project: ['tsconfig.eslint.json'], |
| 59 | + tsconfigRootDir: '.' |
| 60 | + } |
| 61 | + }, |
| 62 | + |
| 63 | + settings: { |
| 64 | + 'import/resolver': { |
| 65 | + typescript: { |
| 66 | + alwaysTryTypes: true, |
| 67 | + project: 'tsconfig.eslint.json' |
| 68 | + } |
| 69 | + } |
| 70 | + }, |
| 71 | + |
| 72 | + rules: { |
| 73 | + '@typescript-eslint/no-explicit-any': 'off', |
| 74 | + '@typescript-eslint/no-unused-vars': 'off', |
| 75 | + 'import/no-namespace': 'off', |
| 76 | + 'prettier/prettier': 'error' |
| 77 | + } |
| 78 | + } |
| 79 | +]) |
0 commit comments