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:
@@ -21,8 +21,8 @@ import { GetUserDetailHandler } from './application/queries/get-user-detail/get-
|
||||
import { GetUsersHandler } from './application/queries/get-users/get-users.handler';
|
||||
import { ADMIN_QUERY_REPOSITORY } from './domain/repositories/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 { AdminController } from './presentation/controllers/admin.controller';
|
||||
|
||||
const CommandHandlers = [
|
||||
ApproveListingHandler,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Inject } from '@nestjs/common';
|
||||
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 {
|
||||
MARKET_INDEX_REPOSITORY,
|
||||
type IMarketIndexRepository,
|
||||
|
||||
@@ -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 { ForceDeleteUserCommand } from '../commands/force-delete-user/force-delete-user.command';
|
||||
|
||||
describe('ProcessScheduledDeletionsHandler', () => {
|
||||
let handler: ProcessScheduledDeletionsHandler;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
|
||||
import { type LoggerService, type PrismaService } from '@modules/shared';
|
||||
import { NotFoundException, ValidationException } from '@modules/shared';
|
||||
import { type LoggerService, type PrismaService, NotFoundException, ValidationException } from '@modules/shared';
|
||||
import { CancelUserDeletionCommand } from './cancel-user-deletion.command';
|
||||
|
||||
@CommandHandler(CancelUserDeletionCommand)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
|
||||
import { type LoggerService, type PrismaService } from '@modules/shared';
|
||||
import { NotFoundException } from '@modules/shared';
|
||||
import { type LoggerService, type PrismaService, NotFoundException } from '@modules/shared';
|
||||
import { ExportUserDataCommand } from './export-user-data.command';
|
||||
|
||||
export interface UserDataExport {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { type LoggerService, type PrismaService } from '@modules/shared';
|
||||
import { NotFoundException } from '@modules/shared';
|
||||
import { type LoggerService, type PrismaService, NotFoundException } from '@modules/shared';
|
||||
import { ForceDeleteUserCommand } from './force-delete-user.command';
|
||||
|
||||
@CommandHandler(ForceDeleteUserCommand)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { Inject } from '@nestjs/common';
|
||||
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
|
||||
import { type LoggerService, type PrismaService } from '@modules/shared';
|
||||
import { NotFoundException, ValidationException } from '@modules/shared';
|
||||
import { type LoggerService, type PrismaService, NotFoundException, ValidationException } from '@modules/shared';
|
||||
import { RequestUserDeletionCommand } from './request-user-deletion.command';
|
||||
|
||||
const DELETION_GRACE_PERIOD_DAYS = 30;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IsString, MinLength } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, MinLength } from 'class-validator';
|
||||
|
||||
export class ForceDeleteUserDto {
|
||||
@ApiProperty({ description: 'Lý do xóa tài khoản' })
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IsOptional, IsString, MaxLength } from 'class-validator';
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsOptional, IsString, MaxLength } from 'class-validator';
|
||||
|
||||
export class RequestDeletionDto {
|
||||
@ApiPropertyOptional({ description: 'Lý do xóa tài khoản', maxLength: 500 })
|
||||
|
||||
@@ -139,7 +139,7 @@ export class CreateListingHandler implements ICommandHandler<CreateListingComman
|
||||
distanceMeters: c.distanceMeters,
|
||||
titleSimilarity: c.titleSimilarity,
|
||||
}));
|
||||
} catch (err) {
|
||||
} catch {
|
||||
this.logger.warn('Duplicate detection failed — listing created without warnings', 'CreateListingHandler');
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ export class CreateListingHandler implements ICommandHandler<CreateListingComman
|
||||
reason: priceResult.reason!,
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
this.logger.warn('Price validation failed — listing created without price warning', 'CreateListingHandler');
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||
import { type Listing as PrismaListing, type ListingStatus } from '@prisma/client';
|
||||
import { type PrismaService } from '@modules/shared';
|
||||
import { ListingEntity, type ListingProps } from '../../domain/entities/listing.entity';
|
||||
import { type ListingDetailData } from '../../domain/repositories/listing-read.dto';
|
||||
import { type ListingSearchItem, type ListingSellerItem } from '../../domain/repositories/listing-read.dto';
|
||||
import { type ListingDetailData, type ListingSearchItem, type ListingSellerItem } from '../../domain/repositories/listing-read.dto';
|
||||
import { type IListingRepository, type ListingSearchParams, type PaginatedResult } from '../../domain/repositories/listing.repository';
|
||||
import { Price } from '../../domain/value-objects/price.vo';
|
||||
import { findByIdWithProperty, searchListings, findBySellerIdQuery } from './listing-read.queries';
|
||||
|
||||
@@ -113,7 +113,7 @@ export class PrismaPriceValidator implements IPriceValidator {
|
||||
return { min: rows[0]!.min_price, max: rows[0]!.max_price };
|
||||
}
|
||||
return null;
|
||||
} catch (err) {
|
||||
} catch {
|
||||
this.logger.warn('Failed to fetch market range, using defaults', 'PrismaPriceValidator');
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dev": "next dev --port 3000",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"lint": "eslint src/ app/ components/ lib/ hooks/ i18n/ --no-error-on-unmatched-pattern",
|
||||
"test": "vitest run",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user