|
| 1 | +const js = require('@eslint/js'); |
| 2 | +const tseslint = require('typescript-eslint'); |
| 3 | +const jestPlugin = require('eslint-plugin-jest'); |
| 4 | +const importPlugin = require('eslint-plugin-import-x'); |
| 5 | +const prettierConfig = require('eslint-config-prettier'); |
| 6 | +const globals = require('globals'); |
| 7 | + |
| 8 | +module.exports = tseslint.config( |
| 9 | + { |
| 10 | + ignores: [ |
| 11 | + 'dist/**', |
| 12 | + 'coverage/**', |
| 13 | + 'build/**', |
| 14 | + 'tmp/**', |
| 15 | + '.github/test-stacks/**', |
| 16 | + ], |
| 17 | + }, |
| 18 | + |
| 19 | + js.configs.recommended, |
| 20 | + |
| 21 | + { |
| 22 | + files: ['**/*.js', '**/*.cjs'], |
| 23 | + languageOptions: { |
| 24 | + sourceType: 'commonjs', |
| 25 | + globals: { |
| 26 | + ...globals.node, |
| 27 | + }, |
| 28 | + }, |
| 29 | + }, |
| 30 | + |
| 31 | + { |
| 32 | + files: ['**/*.ts', '**/*.tsx'], |
| 33 | + extends: [...tseslint.configs.recommended], |
| 34 | + languageOptions: { |
| 35 | + parserOptions: { |
| 36 | + project: 'tsconfig.json', |
| 37 | + sourceType: 'module', |
| 38 | + }, |
| 39 | + globals: { |
| 40 | + ...globals.node, |
| 41 | + }, |
| 42 | + }, |
| 43 | + plugins: { |
| 44 | + jest: jestPlugin, |
| 45 | + import: importPlugin, |
| 46 | + }, |
| 47 | + rules: { |
| 48 | + ...jestPlugin.configs['flat/recommended'].rules, |
| 49 | + 'sort-imports': ['error', { ignoreDeclarationSort: true }], |
| 50 | + 'import/order': [ |
| 51 | + 'error', |
| 52 | + { alphabetize: { order: 'asc' }, 'newlines-between': 'never' }, |
| 53 | + ], |
| 54 | + 'no-return-await': 'error', |
| 55 | + 'no-console': 'error', |
| 56 | + 'import/no-default-export': 'error', |
| 57 | + 'import/no-extraneous-dependencies': 'error', |
| 58 | + 'import/no-unassigned-import': 'error', |
| 59 | + '@typescript-eslint/no-unused-vars': [ |
| 60 | + 'error', |
| 61 | + { argsIgnorePattern: '^_', caughtErrors: 'all' }, |
| 62 | + ], |
| 63 | + '@typescript-eslint/no-unused-expressions': 'error', |
| 64 | + }, |
| 65 | + }, |
| 66 | + |
| 67 | + { |
| 68 | + files: ['**/*.test.ts'], |
| 69 | + rules: { |
| 70 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 71 | + '@typescript-eslint/no-explicit-any': 'off', |
| 72 | + '@typescript-eslint/no-unused-vars': 'off', |
| 73 | + '@typescript-eslint/no-require-imports': 'off', |
| 74 | + }, |
| 75 | + }, |
| 76 | + |
| 77 | + prettierConfig, |
| 78 | +); |
0 commit comments