|
| 1 | +// @ts-check |
| 2 | +import { builtinModules } from 'node:module'; |
| 3 | +import tseslint from 'typescript-eslint'; |
| 4 | +import importX from 'eslint-plugin-import-x'; |
| 5 | +// @ts-expect-error missing types |
| 6 | +import eslint from '@eslint/js'; |
| 7 | +// @ts-expect-error missing types |
| 8 | +import eslintConfigPrettier from 'eslint-config-prettier'; |
| 9 | + |
| 10 | +export default tseslint.config( |
| 11 | + eslint.configs.recommended, |
| 12 | + { |
| 13 | + files: ['**/*.js', '**/*.ts', '**/*.tsx'], |
| 14 | + extends: [...tseslint.configs.recommended], |
| 15 | + plugins: { |
| 16 | + import: importX, |
| 17 | + }, |
| 18 | + |
| 19 | + languageOptions: { |
| 20 | + parserOptions: { |
| 21 | + sourceType: 'module', |
| 22 | + ecmaFeatures: { |
| 23 | + jsx: true, |
| 24 | + }, |
| 25 | + }, |
| 26 | + }, |
| 27 | + |
| 28 | + rules: { |
| 29 | + eqeqeq: ['warn', 'always', { null: 'never' }], |
| 30 | + 'no-debugger': ['error'], |
| 31 | + 'no-empty': ['warn', { allowEmptyCatch: true }], |
| 32 | + 'prefer-const': [ |
| 33 | + 'warn', |
| 34 | + { |
| 35 | + destructuring: 'all', |
| 36 | + }, |
| 37 | + ], |
| 38 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 39 | + '@typescript-eslint/no-var-requires': 'off', |
| 40 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 41 | + '@typescript-eslint/no-explicit-any': 'off', |
| 42 | + '@typescript-eslint/consistent-type-imports': [ |
| 43 | + 'error', |
| 44 | + { prefer: 'type-imports', fixStyle: 'inline-type-imports' }, |
| 45 | + ], |
| 46 | + |
| 47 | + 'import/no-nodejs-modules': [ |
| 48 | + 'error', |
| 49 | + { allow: builtinModules.map((mod) => `node:${mod}`) }, |
| 50 | + ], |
| 51 | + 'import/no-duplicates': 'error', |
| 52 | + 'import/order': 'error', |
| 53 | + 'sort-imports': [ |
| 54 | + 'error', |
| 55 | + { |
| 56 | + ignoreCase: false, |
| 57 | + ignoreDeclarationSort: true, |
| 58 | + ignoreMemberSort: false, |
| 59 | + memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], |
| 60 | + allowSeparatedGroups: false, |
| 61 | + }, |
| 62 | + ], |
| 63 | + }, |
| 64 | + }, |
| 65 | + eslintConfigPrettier, |
| 66 | + { |
| 67 | + ignores: ['**/dist/', '**/coverage/'], |
| 68 | + } |
| 69 | +); |
0 commit comments