Refactor password reset flow and improve ESLint integration

- Extracted password reset logic into `PasswordResetConfirmContent` wrapped in `Suspense` for cleaner and more modular component structure.
- Updated ESLint config to ignore generated files and added rules for stricter code quality (`eslint-comments`, `@typescript-eslint` adjustments).
- Automated insertion of `eslint-disable` in auto-generated TypeScript files through `generate-api-client.sh`.
- Replaced unsafe `any` type casts with safer `Record<string, unknown>` type assertions for TypeScript compliance.
- Added `lint:tests` script for pre-commit test coverage checks.
- Improved `useAuth` hooks and related type guards for better runtime safety and maintainability.
This commit is contained in:
Felipe Cardoso
2025-11-01 06:04:35 +01:00
parent a062daddc5
commit b8d3248a48
17 changed files with 171 additions and 86 deletions

View File

@@ -23,7 +23,7 @@ import {
import { useAuthStore } from '@/stores/authStore';
import type { User } from '@/stores/authStore';
import { parseAPIError, getGeneralError } from '../errors';
import { isTokenWithUser, type TokenWithUser } from '../types';
import { isTokenWithUser } from '../types';
import config from '@/config/app.config';
// ============================================================================
@@ -359,8 +359,8 @@ export function usePasswordResetRequest(onSuccess?: (message: string) => void) {
typeof data === 'object' &&
data !== null &&
'message' in data &&
typeof (data as any).message === 'string'
? (data as any).message
typeof (data as Record<string, unknown>).message === 'string'
? (data as { message: string }).message
: 'Password reset email sent successfully';
if (onSuccess) {
@@ -406,8 +406,8 @@ export function usePasswordResetConfirm(onSuccess?: (message: string) => void) {
typeof data === 'object' &&
data !== null &&
'message' in data &&
typeof (data as any).message === 'string'
? (data as any).message
typeof (data as Record<string, unknown>).message === 'string'
? (data as { message: string }).message
: 'Password reset successful';
if (onSuccess) {
@@ -456,8 +456,8 @@ export function usePasswordChange(onSuccess?: (message: string) => void) {
typeof data === 'object' &&
data !== null &&
'message' in data &&
typeof (data as any).message === 'string'
? (data as any).message
typeof (data as Record<string, unknown>).message === 'string'
? (data as { message: string }).message
: 'Password changed successfully';
if (onSuccess) {