|
| 1 | +// eslint.config.js |
| 2 | + |
| 3 | +import { promises as fs } from 'node:fs'; |
| 4 | + |
| 5 | +import eslint from '@eslint/js'; |
| 6 | +import typescriptEslint from 'typescript-eslint'; |
| 7 | +import prettier from 'eslint-config-prettier'; |
| 8 | + |
| 9 | +const ignores = [ |
| 10 | + ...(await fs.readFile('.gitignore', 'utf-8')).split('\n').filter((path) => path.trim() !== ''), |
| 11 | + 'eslint.config.js', |
| 12 | +]; |
| 13 | + |
| 14 | +export default [ |
| 15 | + { ignores }, |
| 16 | + eslint.configs.all, |
| 17 | + ...typescriptEslint.configs.recommended, |
| 18 | + ...typescriptEslint.configs.recommendedTypeChecked, |
| 19 | + ...typescriptEslint.configs.strict, |
| 20 | + prettier, |
| 21 | + { |
| 22 | + languageOptions: { |
| 23 | + parserOptions: { |
| 24 | + project: './tsconfig.json', |
| 25 | + }, |
| 26 | + }, |
| 27 | + rules: { |
| 28 | + '@typescript-eslint/non-nullable-type-assertion-style': 'error', |
| 29 | + 'capitalized-comments': 'off', |
| 30 | + 'one-var': 'off', |
| 31 | + 'func-names': 'off', |
| 32 | + 'sort-keys': 'off', |
| 33 | + 'sort-imports': 'off', |
| 34 | + 'max-lines': [ |
| 35 | + 'error', |
| 36 | + { |
| 37 | + max: 500, |
| 38 | + skipBlankLines: true, |
| 39 | + skipComments: true, |
| 40 | + }, |
| 41 | + ], |
| 42 | + 'func-style': [ |
| 43 | + 'error', |
| 44 | + 'declaration', |
| 45 | + { |
| 46 | + allowArrowFunctions: true, |
| 47 | + }, |
| 48 | + ], |
| 49 | + 'no-magic-numbers': [ |
| 50 | + 'error', |
| 51 | + { |
| 52 | + ignore: [0, 1, 2], |
| 53 | + }, |
| 54 | + ], |
| 55 | + 'no-undefined': 'off', |
| 56 | + 'no-ternary': 'off', |
| 57 | + }, |
| 58 | + }, |
| 59 | + { |
| 60 | + files: ['**/*.spec.ts', '**/*.test.ts'], |
| 61 | + rules: { |
| 62 | + '@typescript-eslint/non-nullable-type-assertion-style': 'off', |
| 63 | + '@typescript-eslint/ban-types': 'off', |
| 64 | + '@typescript-eslint/require-await': 'off', |
| 65 | + '@typescript-eslint/consistent-type-definitions': 'off', |
| 66 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 67 | + '@typescript-eslint/no-unnecessary-condition': 'off', |
| 68 | + '@typescript-eslint/consistent-indexed-object-style': 'off', |
| 69 | + '@typescript-eslint/no-unused-vars': 'off', |
| 70 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 71 | + 'line-comment-position': 'off', |
| 72 | + 'no-fallthrough': 'off', |
| 73 | + 'no-inline-comments': 'off', |
| 74 | + 'no-param-reassign': 'off', |
| 75 | + 'id-length': 'off', |
| 76 | + 'no-magic-numbers': 'off', |
| 77 | + 'no-duplicate-imports': 'off', |
| 78 | + 'symbol-description': 'off', |
| 79 | + 'no-invalid-this': 'off', |
| 80 | + 'max-lines-per-function': 'off', |
| 81 | + 'max-lines': 'off', |
| 82 | + 'max-statements': 'off', |
| 83 | + 'no-await-in-loop': 'off', |
| 84 | + }, |
| 85 | + }, |
| 86 | +]; |
0 commit comments