refactor: update code style and improve ESLint rules for better consistency

This commit is contained in:
2026-02-26 13:29:53 -03:00
parent e60752743f
commit 1a38e0f3fb
16 changed files with 193 additions and 154 deletions

View File

@@ -27,9 +27,30 @@ export default tseslint.config(
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-floating-promises': 'error', // asegurar manejo de promesas
'@typescript-eslint/no-unsafe-argument': 'warn',
"prettier/prettier": ["error", { endOfLine: "auto" }],
'@typescript-eslint/prefer-nullish-coalescing': 'warn', // usar ?? en lugar de ||
'@typescript-eslint/prefer-optional-chain': 'warn', // usar ?. en lugar de && encadenados
'@typescript-eslint/no-unnecessary-condition': 'warn', // condiciones que siempre son true/false
'@typescript-eslint/switch-exhaustiveness-check': 'error', // switch sobre union types debe cubrir todos los casos
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'@typescript-eslint/await-thenable': 'error', // no hacer await de algo que no es Promise
'@typescript-eslint/no-misused-promises': 'error', // pasar promises donde no corresponde
'@typescript-eslint/explicit-function-return-type': ['off'],
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], // ignorar _variables
'@typescript-eslint/consistent-type-imports': 'error', // import type {} cuando corresponde
'no-console': 'warn', // evitar console.log olvidados
// NestJS específico
'@typescript-eslint/no-extraneous-class': 'off', // NestJS usa clases vacías (módulos)
'@typescript-eslint/no-unsafe-member-access': 'off', // decoradores de NestJS lo necesitan
'@typescript-eslint/no-unsafe-call': 'off', // ídem
'@typescript-eslint/naming-convention': ['warn',
{ selector: 'interface', format: ['PascalCase'] },
{ selector: 'typeAlias', format: ['PascalCase'] },
{ selector: 'enum', format: ['PascalCase'] },
],
},
},
);