c128ebf5a0
Co-Authored-By: Claude Code <noreply@anthropic.com>
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
// eslint 9 flat config(Task 14):最小保守集——JS/TS recommended + 少量明显增益规则。
|
||
// 原则:不做风格警察;现有代码若对某规则大面积误报则降级该规则,而非批量改代码。
|
||
import eslint from '@eslint/js'
|
||
import tseslint from 'typescript-eslint'
|
||
|
||
export default tseslint.config(
|
||
// 依赖与构建产物不参与 lint
|
||
{ ignores: ['**/node_modules/**', '**/dist/**', 'coverage/**', '.artifacts/**'] },
|
||
eslint.configs.recommended,
|
||
...tseslint.configs.recommended,
|
||
{
|
||
rules: {
|
||
// 未用变量报错,但允许下划线前缀显式豁免(测试/签名对齐常见)
|
||
'@typescript-eslint/no-unused-vars': [
|
||
'error',
|
||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
||
],
|
||
},
|
||
},
|
||
{
|
||
// 测试代码放宽 no-explicit-any:夹具行插入用 `as any` 表达"部分列 + 任意宽松形状"、
|
||
// catch (e: any) 取 postgres.js 错误细节,均为有意为之(49 处违例集中于此)。
|
||
// 生产代码(src/)保持该规则严格。
|
||
files: ['tests/**/*.ts', '**/test/**/*.ts'],
|
||
rules: {
|
||
'@typescript-eslint/no-explicit-any': 'off',
|
||
},
|
||
},
|
||
)
|