fix: resolve 21 lint errors from GDPR/logger/caching commits and fix web lint

- Fix import ordering in auth DTOs, admin module, and test files
- Merge duplicate @modules/shared imports (no-duplicates with prefer-inline)
- Remove unused imports (ForceDeleteUserCommand, Inject)
- Use parameterless catch for unused error bindings
- Switch web lint from `next lint` to `eslint` (flat config compatibility)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-10 18:00:37 +07:00
parent ab478a565a
commit 4c432c7ff9
13 changed files with 13 additions and 21 deletions

View File

@@ -21,8 +21,8 @@ import { GetUserDetailHandler } from './application/queries/get-user-detail/get-
import { GetUsersHandler } from './application/queries/get-users/get-users.handler'; import { GetUsersHandler } from './application/queries/get-users/get-users.handler';
import { ADMIN_QUERY_REPOSITORY } from './domain/repositories/admin-query.repository'; import { ADMIN_QUERY_REPOSITORY } from './domain/repositories/admin-query.repository';
import { PrismaAdminQueryRepository } from './infrastructure/repositories/prisma-admin-query.repository'; import { PrismaAdminQueryRepository } from './infrastructure/repositories/prisma-admin-query.repository';
import { AdminController } from './presentation/controllers/admin.controller';
import { AdminModerationController } from './presentation/controllers/admin-moderation.controller'; import { AdminModerationController } from './presentation/controllers/admin-moderation.controller';
import { AdminController } from './presentation/controllers/admin.controller';
const CommandHandlers = [ const CommandHandlers = [
ApproveListingHandler, ApproveListingHandler,

View File

@@ -1,6 +1,6 @@
import { Inject } from '@nestjs/common'; import { Inject } from '@nestjs/common';
import { QueryHandler, type IQueryHandler } from '@nestjs/cqrs'; import { QueryHandler, type IQueryHandler } from '@nestjs/cqrs';
import { CacheService, CachePrefix, CacheTTL, Cacheable } from '@modules/shared'; import { type CacheService, CachePrefix, CacheTTL, Cacheable } from '@modules/shared';
import { import {
MARKET_INDEX_REPOSITORY, MARKET_INDEX_REPOSITORY,
type IMarketIndexRepository, type IMarketIndexRepository,

View File

@@ -1,6 +1,4 @@
import { ProcessScheduledDeletionsCommand } from '../commands/process-scheduled-deletions/process-scheduled-deletions.command';
import { ProcessScheduledDeletionsHandler } from '../commands/process-scheduled-deletions/process-scheduled-deletions.handler'; import { ProcessScheduledDeletionsHandler } from '../commands/process-scheduled-deletions/process-scheduled-deletions.handler';
import { ForceDeleteUserCommand } from '../commands/force-delete-user/force-delete-user.command';
describe('ProcessScheduledDeletionsHandler', () => { describe('ProcessScheduledDeletionsHandler', () => {
let handler: ProcessScheduledDeletionsHandler; let handler: ProcessScheduledDeletionsHandler;

View File

@@ -1,6 +1,5 @@
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs'; import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { type LoggerService, type PrismaService } from '@modules/shared'; import { type LoggerService, type PrismaService, NotFoundException, ValidationException } from '@modules/shared';
import { NotFoundException, ValidationException } from '@modules/shared';
import { CancelUserDeletionCommand } from './cancel-user-deletion.command'; import { CancelUserDeletionCommand } from './cancel-user-deletion.command';
@CommandHandler(CancelUserDeletionCommand) @CommandHandler(CancelUserDeletionCommand)

View File

@@ -1,6 +1,5 @@
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs'; import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { type LoggerService, type PrismaService } from '@modules/shared'; import { type LoggerService, type PrismaService, NotFoundException } from '@modules/shared';
import { NotFoundException } from '@modules/shared';
import { ExportUserDataCommand } from './export-user-data.command'; import { ExportUserDataCommand } from './export-user-data.command';
export interface UserDataExport { export interface UserDataExport {

View File

@@ -1,7 +1,6 @@
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs'; import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { Prisma } from '@prisma/client'; import { Prisma } from '@prisma/client';
import { type LoggerService, type PrismaService } from '@modules/shared'; import { type LoggerService, type PrismaService, NotFoundException } from '@modules/shared';
import { NotFoundException } from '@modules/shared';
import { ForceDeleteUserCommand } from './force-delete-user.command'; import { ForceDeleteUserCommand } from './force-delete-user.command';
@CommandHandler(ForceDeleteUserCommand) @CommandHandler(ForceDeleteUserCommand)

View File

@@ -1,7 +1,5 @@
import { Inject } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs'; import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { type LoggerService, type PrismaService } from '@modules/shared'; import { type LoggerService, type PrismaService, NotFoundException, ValidationException } from '@modules/shared';
import { NotFoundException, ValidationException } from '@modules/shared';
import { RequestUserDeletionCommand } from './request-user-deletion.command'; import { RequestUserDeletionCommand } from './request-user-deletion.command';
const DELETION_GRACE_PERIOD_DAYS = 30; const DELETION_GRACE_PERIOD_DAYS = 30;

View File

@@ -1,5 +1,5 @@
import { IsString, MinLength } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { IsString, MinLength } from 'class-validator';
export class ForceDeleteUserDto { export class ForceDeleteUserDto {
@ApiProperty({ description: 'Lý do xóa tài khoản' }) @ApiProperty({ description: 'Lý do xóa tài khoản' })

View File

@@ -1,5 +1,5 @@
import { IsOptional, IsString, MaxLength } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger'; import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsString, MaxLength } from 'class-validator';
export class RequestDeletionDto { export class RequestDeletionDto {
@ApiPropertyOptional({ description: 'Lý do xóa tài khoản', maxLength: 500 }) @ApiPropertyOptional({ description: 'Lý do xóa tài khoản', maxLength: 500 })

View File

@@ -139,7 +139,7 @@ export class CreateListingHandler implements ICommandHandler<CreateListingComman
distanceMeters: c.distanceMeters, distanceMeters: c.distanceMeters,
titleSimilarity: c.titleSimilarity, titleSimilarity: c.titleSimilarity,
})); }));
} catch (err) { } catch {
this.logger.warn('Duplicate detection failed — listing created without warnings', 'CreateListingHandler'); this.logger.warn('Duplicate detection failed — listing created without warnings', 'CreateListingHandler');
} }
@@ -161,7 +161,7 @@ export class CreateListingHandler implements ICommandHandler<CreateListingComman
reason: priceResult.reason!, reason: priceResult.reason!,
}; };
} }
} catch (err) { } catch {
this.logger.warn('Price validation failed — listing created without price warning', 'CreateListingHandler'); this.logger.warn('Price validation failed — listing created without price warning', 'CreateListingHandler');
} }

View File

@@ -2,8 +2,7 @@ import { Injectable } from '@nestjs/common';
import { type Listing as PrismaListing, type ListingStatus } from '@prisma/client'; import { type Listing as PrismaListing, type ListingStatus } from '@prisma/client';
import { type PrismaService } from '@modules/shared'; import { type PrismaService } from '@modules/shared';
import { ListingEntity, type ListingProps } from '../../domain/entities/listing.entity'; import { ListingEntity, type ListingProps } from '../../domain/entities/listing.entity';
import { type ListingDetailData } from '../../domain/repositories/listing-read.dto'; import { type ListingDetailData, type ListingSearchItem, type ListingSellerItem } from '../../domain/repositories/listing-read.dto';
import { type ListingSearchItem, type ListingSellerItem } from '../../domain/repositories/listing-read.dto';
import { type IListingRepository, type ListingSearchParams, type PaginatedResult } from '../../domain/repositories/listing.repository'; import { type IListingRepository, type ListingSearchParams, type PaginatedResult } from '../../domain/repositories/listing.repository';
import { Price } from '../../domain/value-objects/price.vo'; import { Price } from '../../domain/value-objects/price.vo';
import { findByIdWithProperty, searchListings, findBySellerIdQuery } from './listing-read.queries'; import { findByIdWithProperty, searchListings, findBySellerIdQuery } from './listing-read.queries';

View File

@@ -113,7 +113,7 @@ export class PrismaPriceValidator implements IPriceValidator {
return { min: rows[0]!.min_price, max: rows[0]!.max_price }; return { min: rows[0]!.min_price, max: rows[0]!.max_price };
} }
return null; return null;
} catch (err) { } catch {
this.logger.warn('Failed to fetch market range, using defaults', 'PrismaPriceValidator'); this.logger.warn('Failed to fetch market range, using defaults', 'PrismaPriceValidator');
return null; return null;
} }

View File

@@ -6,7 +6,7 @@
"dev": "next dev --port 3000", "dev": "next dev --port 3000",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "eslint src/ app/ components/ lib/ hooks/ i18n/ --no-error-on-unmatched-pattern",
"test": "vitest run", "test": "vitest run",
"typecheck": "tsc --noEmit" "typecheck": "tsc --noEmit"
}, },