|
| 1 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 2 | +import promise from 'eslint-plugin-promise'; |
| 3 | +import tsParser from '@typescript-eslint/parser'; |
| 4 | +import js from '@eslint/js'; |
| 5 | +import {FlatCompat} from '@eslint/eslintrc'; |
| 6 | + |
| 7 | +const compat = new FlatCompat({ |
| 8 | + // baseDirectory: import.meta.dirname, |
| 9 | + recommendedConfig: js.configs.recommended, |
| 10 | + allConfig: js.configs.all, |
| 11 | +}); |
| 12 | + |
| 13 | +export default [ |
| 14 | + ...compat.extends( |
| 15 | + 'eslint:recommended', |
| 16 | + 'plugin:@typescript-eslint/recommended' |
| 17 | + ), |
| 18 | + { |
| 19 | + plugins: { |
| 20 | + '@typescript-eslint': typescriptEslint, |
| 21 | + promise, |
| 22 | + }, |
| 23 | + |
| 24 | + languageOptions: { |
| 25 | + parser: tsParser, |
| 26 | + ecmaVersion: 2022, |
| 27 | + sourceType: 'script', |
| 28 | + |
| 29 | + parserOptions: { |
| 30 | + project: ['./tsconfig.json'], |
| 31 | + }, |
| 32 | + }, |
| 33 | + |
| 34 | + rules: { |
| 35 | + 'quotes': [2, 'single', 'avoid-escape'], |
| 36 | + 'no-console': 'error', |
| 37 | + 'camelcase': 2, |
| 38 | + 'promise/catch-or-return': 'error', |
| 39 | + 'promise/prefer-await-to-then': 'error', |
| 40 | + 'promise/prefer-await-to-callbacks': 'warn', |
| 41 | + 'promise/always-return': 'error', |
| 42 | + '@typescript-eslint/no-inferrable-types': 'off', |
| 43 | + '@typescript-eslint/no-floating-promises': 'error', |
| 44 | + 'no-implicit-coercion': [2], |
| 45 | + '@typescript-eslint/no-explicit-any': 'off', |
| 46 | + }, |
| 47 | + |
| 48 | + ignores: ['dist/', 'node_modules/', '**/*.js', '**/*.mjs'], |
| 49 | + }, |
| 50 | +]; |
0 commit comments