|
| 1 | +import path from 'node:path' |
| 2 | +import { fileURLToPath } from 'node:url' |
| 3 | +import { FlatCompat } from '@eslint/eslintrc' |
| 4 | +import js from '@eslint/js' |
| 5 | + |
| 6 | +const __filename = fileURLToPath(import.meta.url) |
| 7 | +const __dirname = path.dirname(__filename) |
| 8 | + |
| 9 | +const compat = new FlatCompat({ |
| 10 | + baseDirectory: __dirname, |
| 11 | + recommendedConfig: js.configs.recommended, |
| 12 | + allConfig: js.configs.all, |
| 13 | +}) |
| 14 | + |
| 15 | +export default [ |
| 16 | + ...compat.config({ |
| 17 | + root: true, |
| 18 | + env: { |
| 19 | + node: true, |
| 20 | + es6: true, |
| 21 | + }, |
| 22 | + ignorePatterns: [ |
| 23 | + 'node_modules/*', |
| 24 | + 'build/*', |
| 25 | + 'coverage/*', |
| 26 | + 'example/*', |
| 27 | + 'tsdown.config.ts', |
| 28 | + ], |
| 29 | + parser: '@typescript-eslint/parser', |
| 30 | + parserOptions: { |
| 31 | + ecmaVersion: 2022, |
| 32 | + project: './tsconfig.json', |
| 33 | + tsconfigRootDir: __dirname, |
| 34 | + }, |
| 35 | + extends: [ |
| 36 | + 'eslint:recommended', |
| 37 | + 'plugin:@typescript-eslint/recommended', |
| 38 | + 'plugin:@typescript-eslint/stylistic', |
| 39 | + 'plugin:eslint-comments/recommended', |
| 40 | + 'plugin:prettier/recommended', |
| 41 | + ], |
| 42 | + plugins: ['eslint-comments', '@typescript-eslint'], |
| 43 | + rules: { |
| 44 | + camelcase: 'warn', |
| 45 | + '@typescript-eslint/no-unused-vars': [ |
| 46 | + 'warn', |
| 47 | + { |
| 48 | + args: 'none', |
| 49 | + varsIgnorePattern: '^_', |
| 50 | + argsIgnorePattern: '^_', |
| 51 | + }, |
| 52 | + ], |
| 53 | + 'prefer-const': [ |
| 54 | + 'error', |
| 55 | + { |
| 56 | + destructuring: 'any', |
| 57 | + ignoreReadBeforeAssign: false, |
| 58 | + }, |
| 59 | + ], |
| 60 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 61 | + '@typescript-eslint/no-var-requires': 'off', |
| 62 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 63 | + '@typescript-eslint/no-explicit-any': 'off', |
| 64 | + '@typescript-eslint/consistent-type-definitions': 'off', |
| 65 | + '@typescript-eslint/consistent-indexed-object-style': 'off', |
| 66 | + '@typescript-eslint/no-require-imports': 'off', |
| 67 | + }, |
| 68 | + }), |
| 69 | +] |
0 commit comments