|
| 1 | +const tseslint = require('typescript-eslint'); |
| 2 | +const importX = require('eslint-plugin-import-x'); |
| 3 | +const jest = require('eslint-plugin-jest'); |
| 4 | +const prettier = require('eslint-config-prettier'); |
| 5 | + |
| 6 | +module.exports = tseslint.config( |
| 7 | + { |
| 8 | + ignores: ['dist/**', 'node_modules/**'], |
| 9 | + }, |
| 10 | + ...tseslint.configs.recommended, |
| 11 | + prettier, |
| 12 | + { |
| 13 | + files: ['src/**/*.ts'], |
| 14 | + plugins: { |
| 15 | + 'import-x': importX, |
| 16 | + }, |
| 17 | + settings: { |
| 18 | + 'import-x/resolver': { |
| 19 | + typescript: { |
| 20 | + project: './tsconfig.json', |
| 21 | + }, |
| 22 | + }, |
| 23 | + }, |
| 24 | + languageOptions: { |
| 25 | + parserOptions: { |
| 26 | + ecmaVersion: 2018, |
| 27 | + sourceType: 'module', |
| 28 | + project: './tsconfig.json', |
| 29 | + }, |
| 30 | + }, |
| 31 | + rules: { |
| 32 | + 'no-console': 'error', |
| 33 | + 'import-x/prefer-default-export': 'off', |
| 34 | + '@typescript-eslint/no-explicit-any': 'error', |
| 35 | + }, |
| 36 | + }, |
| 37 | + { |
| 38 | + files: ['src/**/*.test.ts', 'src/**/*.spec.ts'], |
| 39 | + ...jest.configs['flat/recommended'], |
| 40 | + rules: { |
| 41 | + ...jest.configs['flat/recommended'].rules, |
| 42 | + 'no-unused-expressions': 'off', |
| 43 | + '@typescript-eslint/no-explicit-any': 'off', |
| 44 | + 'jest/no-disabled-tests': 'warn', |
| 45 | + 'jest/no-focused-tests': 'warn', |
| 46 | + 'jest/no-identical-title': 'error', |
| 47 | + 'jest/prefer-to-have-length': 'error', |
| 48 | + }, |
| 49 | + }, |
| 50 | + { |
| 51 | + files: ['src/bin/*.ts'], |
| 52 | + rules: { |
| 53 | + 'no-console': 'off', |
| 54 | + }, |
| 55 | + } |
| 56 | +); |
0 commit comments