|
| 1 | +const { fixupPluginRules } = require('@eslint/compat') |
| 2 | +const { FlatCompat } = require('@eslint/eslintrc') |
| 3 | +const js = require('@eslint/js') |
| 4 | +const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin') |
| 5 | +const tsParser = require('@typescript-eslint/parser') |
| 6 | +const _import = require('eslint-plugin-import') |
| 7 | +const globals = require('globals') |
| 8 | + |
| 9 | +const compat = new FlatCompat({ |
| 10 | + baseDirectory: __dirname, |
| 11 | + recommendedConfig: js.configs.recommended, |
| 12 | + allConfig: js.configs.all, |
| 13 | +}) |
| 14 | + |
| 15 | +module.exports = [ |
| 16 | + { |
| 17 | + ignores: ['**/eslint.config.js'], |
| 18 | + }, |
| 19 | + ...compat.extends('plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'), |
| 20 | + { |
| 21 | + plugins: { |
| 22 | + '@typescript-eslint': typescriptEslintEslintPlugin, |
| 23 | + import: fixupPluginRules(_import), |
| 24 | + }, |
| 25 | + |
| 26 | + languageOptions: { |
| 27 | + globals: { |
| 28 | + ...globals.node, |
| 29 | + ...globals.jest, |
| 30 | + }, |
| 31 | + |
| 32 | + parser: tsParser, |
| 33 | + ecmaVersion: 5, |
| 34 | + sourceType: 'module', |
| 35 | + |
| 36 | + parserOptions: { |
| 37 | + project: 'tsconfig.json', |
| 38 | + }, |
| 39 | + }, |
| 40 | + |
| 41 | + rules: { |
| 42 | + '@typescript-eslint/interface-name-prefix': 'off', |
| 43 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 44 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 45 | + '@typescript-eslint/no-explicit-any': 'off', |
| 46 | + |
| 47 | + 'import/order': [ |
| 48 | + 'error', |
| 49 | + { |
| 50 | + alphabetize: { |
| 51 | + order: 'asc', |
| 52 | + }, |
| 53 | + |
| 54 | + groups: [ |
| 55 | + ['builtin', 'external'], |
| 56 | + ['internal', 'parent', 'sibling', 'index'], |
| 57 | + ], |
| 58 | + 'newlines-between': 'never', |
| 59 | + }, |
| 60 | + ], |
| 61 | + }, |
| 62 | + }, |
| 63 | +] |
0 commit comments