|
1 |
| -import baseConfig from '@packages/eslint-config/base.mjs' |
2 |
| -import { resolve } from 'node:path' |
| 1 | +/* eslint-disable @typescript-eslint/no-require-imports */ |
| 2 | +const { resolve } = require('node:path') |
| 3 | +const { FlatCompat } = require('@eslint/eslintrc') |
| 4 | +const js = require('@eslint/js') |
3 | 5 |
|
4 |
| -const projectPath = resolve(process.cwd()) |
| 6 | +const projectPath = resolve(__dirname) |
| 7 | +const tsconfigPath = resolve(projectPath, 'tsconfig.json') |
5 | 8 |
|
6 |
| -/** @type {Linter.Config} */ |
7 |
| -export default [ |
8 |
| - ...baseConfig(projectPath), |
| 9 | +const compat = new FlatCompat({ |
| 10 | + baseDirectory: projectPath, |
| 11 | + resolvePluginsRelativeTo: projectPath, |
| 12 | + recommendedConfig: js.configs.recommended, |
| 13 | + allConfig: js.configs.all, |
| 14 | +}) |
| 15 | + |
| 16 | +/** @type {import('eslint').Linter.Config} */ |
| 17 | +const config = [ |
9 | 18 | {
|
10 | 19 | ignores: ['node_modules', 'dist'],
|
11 | 20 | },
|
| 21 | + ...compat.config({ |
| 22 | + parser: '@typescript-eslint/parser', |
| 23 | + parserOptions: { |
| 24 | + project: tsconfigPath, |
| 25 | + sourceType: 'module', |
| 26 | + tsconfigRootDir: projectPath, |
| 27 | + }, |
| 28 | + plugins: ['@typescript-eslint'], |
| 29 | + extends: ['plugin:@typescript-eslint/recommended'], |
| 30 | + root: true, |
| 31 | + env: { |
| 32 | + node: true, |
| 33 | + jest: true, |
| 34 | + }, |
| 35 | + rules: { |
| 36 | + '@typescript-eslint/interface-name-prefix': 'off', |
| 37 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 38 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 39 | + '@typescript-eslint/no-explicit-any': 'off', |
| 40 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 41 | + '@typescript-eslint/no-empty-interface': 'off', |
| 42 | + 'no-unused-vars': 'off', |
| 43 | + '@typescript-eslint/no-unused-vars': [ |
| 44 | + 'off', |
| 45 | + { |
| 46 | + ignoreRestSiblings: true, |
| 47 | + argsIgnorePattern: '^_', |
| 48 | + caughtErrors: 'all', |
| 49 | + caughtErrorsIgnorePattern: '^_', |
| 50 | + destructuredArrayIgnorePattern: '^_', |
| 51 | + varsIgnorePattern: '^_', |
| 52 | + }, |
| 53 | + ], |
| 54 | + }, |
| 55 | + }), |
12 | 56 | ]
|
| 57 | + |
| 58 | +module.exports = config |
0 commit comments