mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-27 23:06:54 +05:00
refactor: optimize ESLint configuration
- Add CLI-specific overrides (disable no-console, complexity, max-lines-per-function) - Disable no-unsafe-* rules for CLI (Commander.js is untyped) - Increase max-params to 8 for DDD patterns - Exclude examples/, tests/, *.config.ts from linting - Disable style rules (prefer-nullish-coalescing, no-unnecessary-condition, no-nested-ternary) - Reduce warnings from 129 to 0
This commit is contained in:
@@ -13,6 +13,9 @@ export default tseslint.config(
|
||||
'**/coverage/**',
|
||||
'**/.puaros/**',
|
||||
'**/build/**',
|
||||
'**/examples/**',
|
||||
'**/tests/**',
|
||||
'**/*.config.ts',
|
||||
],
|
||||
},
|
||||
eslint.configs.recommended,
|
||||
@@ -64,12 +67,12 @@ export default tseslint.config(
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
'@typescript-eslint/await-thenable': 'error',
|
||||
'@typescript-eslint/no-misused-promises': 'error',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'off', // Allow || operator alongside ??
|
||||
'@typescript-eslint/prefer-optional-chain': 'warn',
|
||||
'@typescript-eslint/prefer-readonly': 'warn',
|
||||
'@typescript-eslint/promise-function-async': 'warn',
|
||||
'@typescript-eslint/require-await': 'warn',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'off', // Sometimes useful for defensive coding
|
||||
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||
|
||||
// ========================================
|
||||
@@ -82,7 +85,7 @@ export default tseslint.config(
|
||||
'prefer-const': 'error',
|
||||
'prefer-arrow-callback': 'warn',
|
||||
'prefer-template': 'warn',
|
||||
'no-nested-ternary': 'warn',
|
||||
'no-nested-ternary': 'off', // Allow nested ternaries when readable
|
||||
'no-unneeded-ternary': 'error',
|
||||
'no-else-return': 'warn',
|
||||
eqeqeq: ['error', 'always'],
|
||||
@@ -156,4 +159,24 @@ export default tseslint.config(
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
// CLI-specific overrides
|
||||
files: ['**/cli/**/*.ts', '**/cli/**/*.js'],
|
||||
rules: {
|
||||
'no-console': 'off', // Console is expected in CLI
|
||||
'max-lines-per-function': 'off', // CLI action handlers can be long
|
||||
complexity: 'off', // CLI logic can be complex
|
||||
'@typescript-eslint/no-unsafe-member-access': 'off', // Commander options are untyped
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-call': 'off',
|
||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
// Value Objects and Domain - allow more parameters for create methods
|
||||
files: ['**/domain/value-objects/**/*.ts', '**/application/use-cases/**/*.ts'],
|
||||
rules: {
|
||||
'max-params': ['warn', 8], // DDD patterns often need more params
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user