|
| 1 | +import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin'; |
| 2 | +import jest from 'eslint-plugin-jest'; |
| 3 | +import globals from 'globals'; |
| 4 | +import tsParser from '@typescript-eslint/parser'; |
| 5 | +import path from 'node:path'; |
| 6 | +import { fileURLToPath } from 'node:url'; |
| 7 | +import js from '@eslint/js'; |
| 8 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 9 | + |
| 10 | +const __filename = fileURLToPath(import.meta.url); |
| 11 | +const __dirname = path.dirname(__filename); |
| 12 | +const compat = new FlatCompat({ |
| 13 | + baseDirectory: __dirname, |
| 14 | + recommendedConfig: js.configs.recommended, |
| 15 | + allConfig: js.configs.all, |
| 16 | +}); |
| 17 | + |
| 18 | +export default [ |
| 19 | + { |
| 20 | + ignores: ['./eslint.eslintrc.mjs'], |
| 21 | + }, |
| 22 | + ...compat.extends( |
| 23 | + 'plugin:@typescript-eslint/recommended', |
| 24 | + 'plugin:prettier/recommended', |
| 25 | + 'prettier', |
| 26 | + ), |
| 27 | + { |
| 28 | + plugins: { |
| 29 | + '@typescript-eslint': typescriptEslintEslintPlugin, |
| 30 | + jest, |
| 31 | + }, |
| 32 | + |
| 33 | + languageOptions: { |
| 34 | + globals: { |
| 35 | + ...globals.node, |
| 36 | + ...globals.jest, |
| 37 | + }, |
| 38 | + |
| 39 | + parser: tsParser, |
| 40 | + ecmaVersion: 5, |
| 41 | + sourceType: 'module', |
| 42 | + |
| 43 | + parserOptions: { |
| 44 | + project: './tsconfig.json', |
| 45 | + tsconfigRootDir: './', |
| 46 | + }, |
| 47 | + }, |
| 48 | + files: ['src/**/*.ts', 'test/**/*.ts'], |
| 49 | + rules: { |
| 50 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 51 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 52 | + '@typescript-eslint/no-explicit-any': 'off', |
| 53 | + |
| 54 | + 'jest/expect-expect': [ |
| 55 | + 'error', |
| 56 | + { |
| 57 | + assertFunctionNames: ['expect', 'request.*.expect'], |
| 58 | + }, |
| 59 | + ], |
| 60 | + |
| 61 | + 'prettier/prettier': ['error'], |
| 62 | + }, |
| 63 | + }, |
| 64 | +]; |
0 commit comments