|
| 1 | +import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'; |
| 2 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 3 | +import prettier from 'eslint-plugin-prettier'; |
| 4 | +import globals from 'globals'; |
| 5 | +import tsParser from '@typescript-eslint/parser'; |
| 6 | +import path from 'node:path'; |
| 7 | +import { fileURLToPath } from 'node:url'; |
| 8 | +import js from '@eslint/js'; |
| 9 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 10 | + |
| 11 | +const __filename = fileURLToPath(import.meta.url); |
| 12 | +const __dirname = path.dirname(__filename); |
| 13 | +const compat = new FlatCompat({ |
| 14 | + baseDirectory: __dirname, |
| 15 | + recommendedConfig: js.configs.recommended, |
| 16 | + allConfig: js.configs.all, |
| 17 | +}); |
| 18 | + |
| 19 | +export default [ |
| 20 | + ...fixupConfigRules( |
| 21 | + compat.extends( |
| 22 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 23 | + 'plugin:@typescript-eslint/recommended', |
| 24 | + 'plugin:prettier/recommended', |
| 25 | + 'plugin:import/recommended', |
| 26 | + 'plugin:import/typescript' |
| 27 | + ) |
| 28 | + ), |
| 29 | + { |
| 30 | + plugins: { |
| 31 | + '@typescript-eslint': fixupPluginRules(typescriptEslint), |
| 32 | + prettier: fixupPluginRules(prettier), |
| 33 | + }, |
| 34 | + |
| 35 | + languageOptions: { |
| 36 | + globals: { |
| 37 | + ...globals.browser, |
| 38 | + ...globals.jest, |
| 39 | + ...globals.node, |
| 40 | + expect: true, |
| 41 | + }, |
| 42 | + |
| 43 | + parser: tsParser, |
| 44 | + ecmaVersion: 2018, |
| 45 | + sourceType: 'module', |
| 46 | + }, |
| 47 | + |
| 48 | + settings: { |
| 49 | + 'import/resolver': { |
| 50 | + node: { |
| 51 | + extensions: ['.js', '.ts'], |
| 52 | + }, |
| 53 | + }, |
| 54 | + }, |
| 55 | + |
| 56 | + rules: { |
| 57 | + 'no-console': 'off', |
| 58 | + 'require-jsdoc': 0, |
| 59 | + indent: 'off', |
| 60 | + '@typescript-eslint/explicit-function-return-type': 0, |
| 61 | + '@typescript-eslint/no-explicit-any': 0, |
| 62 | + 'import/no-unresolved': 'warn', |
| 63 | + 'import/no-named-as-default': 'warn', |
| 64 | + 'no-multi-assign': 0, |
| 65 | + 'no-warning-comments': 0, |
| 66 | + 'prettier/prettier': 1, |
| 67 | + 'no-redeclare': 'off', |
| 68 | + '@typescript-eslint/no-redeclare': 'off', |
| 69 | + }, |
| 70 | + }, |
| 71 | +]; |
0 commit comments