fix: resolve all ESLint errors across API and web packages

Fix 19+ lint errors: unused imports (Phone, DuplicateCandidate, listingDetailsSchema),
import ordering violations, consistent-type-imports, and constant binary expression
in test file.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-08 16:29:44 +07:00
parent cd2abdba7b
commit 8705a2d9a8
15 changed files with 18 additions and 18 deletions

View File

@@ -7,8 +7,8 @@ import {
import { type QueryBus } from '@nestjs/cqrs';
import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth } from '@nestjs/swagger';
import { JwtAuthGuard } from '@modules/auth/presentation/guards/jwt-auth.guard';
import { QuotaGuard } from '@modules/subscriptions/presentation/guards/quota.guard';
import { RequireQuota } from '@modules/subscriptions/presentation/decorators/require-quota.decorator';
import { QuotaGuard } from '@modules/subscriptions/presentation/guards/quota.guard';
import { type DistrictStatsDto } from '../../application/queries/get-district-stats/get-district-stats.handler';
import { GetDistrictStatsQuery } from '../../application/queries/get-district-stats/get-district-stats.query';
import { type HeatmapDto } from '../../application/queries/get-heatmap/get-heatmap.handler';

View File

@@ -1,7 +1,7 @@
import { Phone } from '../../domain/value-objects/phone.vo';
import { UserEntity } from '../../domain/entities/user.entity';
import { HashedPassword } from '../../domain/value-objects/hashed-password.vo';
import { type IUserRepository } from '../../domain/repositories/user.repository';
import { type HashedPassword } from '../../domain/value-objects/hashed-password.vo';
import { Phone } from '../../domain/value-objects/phone.vo';
import { RefreshTokenCommand } from '../commands/refresh-token/refresh-token.command';
import { RefreshTokenHandler } from '../commands/refresh-token/refresh-token.handler';

View File

@@ -1,5 +1,4 @@
import { type IUserRepository } from '../../domain/repositories/user.repository';
import { Phone } from '../../domain/value-objects/phone.vo';
import { RegisterUserCommand } from '../commands/register-user/register-user.command';
import { RegisterUserHandler } from '../commands/register-user/register-user.handler';

View File

@@ -1,6 +1,6 @@
import { type OAuthProvider } from '@prisma/client';
import { type IUserRepository } from '../../domain/repositories/user.repository';
import { UserEntity } from '../../domain/entities/user.entity';
import { type IUserRepository } from '../../domain/repositories/user.repository';
import { Email } from '../../domain/value-objects/email.vo';
import { Phone } from '../../domain/value-objects/phone.vo';
import { OAuthService, type OAuthUserProfile } from '../services/oauth.service';

View File

@@ -1,6 +1,6 @@
import { type OAuthService } from '../services/oauth.service';
import { ZaloOAuthStrategy } from '../strategies/zalo-oauth.strategy';
import { type TokenPair } from '../services/token.service';
import { ZaloOAuthStrategy } from '../strategies/zalo-oauth.strategy';
describe('ZaloOAuthStrategy', () => {
const mockTokenPair: TokenPair = {

View File

@@ -1,13 +1,13 @@
import { Inject, Injectable, Logger } from '@nestjs/common';
import { type EventBus } from '@nestjs/cqrs';
import { type OAuthProvider, type Prisma } from '@prisma/client';
import { createId } from '@paralleldrive/cuid2';
import { type OAuthProvider, type Prisma } from '@prisma/client';
import { type PrismaService } from '@modules/shared/infrastructure/prisma.service';
import { UserEntity } from '../../domain/entities/user.entity';
import { UserRegisteredEvent } from '../../domain/events/user-registered.event';
import { USER_REPOSITORY, type IUserRepository } from '../../domain/repositories/user.repository';
import { Email } from '../../domain/value-objects/email.vo';
import { Phone } from '../../domain/value-objects/phone.vo';
import { UserRegisteredEvent } from '../../domain/events/user-registered.event';
import { type TokenService, type TokenPair } from './token.service';
export interface OAuthUserProfile {

View File

@@ -1,5 +1,6 @@
import { Injectable, Logger } from '@nestjs/common';
import { type OAuthService, type OAuthUserProfile } from '../services/oauth.service';
import { type TokenPair } from '../services/token.service';
/**
* Zalo OAuth2 integration.
@@ -70,7 +71,7 @@ export class ZaloOAuthStrategy {
* Handle the OAuth callback: exchange code for tokens, fetch profile,
* and authenticate via OAuthService.
*/
async handleCallback(code: string, codeVerifier?: string): Promise<{ tokens: import('../services/token.service').TokenPair }> {
async handleCallback(code: string, codeVerifier?: string): Promise<{ tokens: TokenPair }> {
// 1. Exchange authorization code for access token
const tokenData = await this.exchangeCode(code, codeVerifier);

View File

@@ -11,7 +11,7 @@ import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { Throttle } from '@nestjs/throttler';
import type { Request, Response } from 'express';
import { type TokenPair } from '../../infrastructure/services/token.service';
import { ZaloOAuthStrategy } from '../../infrastructure/strategies/zalo-oauth.strategy';
import { type ZaloOAuthStrategy } from '../../infrastructure/strategies/zalo-oauth.strategy';
import { GoogleOAuthGuard } from '../guards/google-oauth.guard';
const IS_PRODUCTION = process.env['NODE_ENV'] === 'production';

View File

@@ -7,7 +7,7 @@ import { ListingEntity } from '../../../domain/entities/listing.entity';
import { PropertyEntity } from '../../../domain/entities/property.entity';
import { LISTING_REPOSITORY, type IListingRepository } from '../../../domain/repositories/listing.repository';
import { PROPERTY_REPOSITORY, type IPropertyRepository } from '../../../domain/repositories/property.repository';
import { DUPLICATE_DETECTOR, type IDuplicateDetector, type DuplicateCandidate } from '../../../domain/services/duplicate-detector';
import { DUPLICATE_DETECTOR, type IDuplicateDetector } from '../../../domain/services/duplicate-detector';
import { Address } from '../../../domain/value-objects/address.vo';
import { GeoPoint } from '../../../domain/value-objects/geo-point.vo';
import { Price } from '../../../domain/value-objects/price.vo';

View File

@@ -26,9 +26,9 @@ import { CurrentUser } from '@modules/auth/presentation/decorators/current-user.
import { Roles } from '@modules/auth/presentation/decorators/roles.decorator';
import { JwtAuthGuard } from '@modules/auth/presentation/guards/jwt-auth.guard';
import { RolesGuard } from '@modules/auth/presentation/guards/roles.guard';
import { QuotaGuard } from '@modules/subscriptions/presentation/guards/quota.guard';
import { RequireQuota } from '@modules/subscriptions/presentation/decorators/require-quota.decorator';
import { FileValidationPipe, type UploadedFile as ValidatedFile } from '@modules/shared/infrastructure/pipes/file-validation.pipe';
import { RequireQuota } from '@modules/subscriptions/presentation/decorators/require-quota.decorator';
import { QuotaGuard } from '@modules/subscriptions/presentation/guards/quota.guard';
import { CreateListingCommand } from '../../application/commands/create-listing/create-listing.command';
import { type CreateListingResult } from '../../application/commands/create-listing/create-listing.handler';
import { ModerateListingCommand } from '../../application/commands/moderate-listing/moderate-listing.command';

View File

@@ -6,7 +6,7 @@ import {
} from '@nestjs/common';
import { type Reflector } from '@nestjs/core';
import { type QueryBus } from '@nestjs/cqrs';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { type EventEmitter2 } from '@nestjs/event-emitter';
import { type QuotaCheckResult } from '../../application/queries/check-quota/check-quota.handler';
import { CheckQuotaQuery } from '../../application/queries/check-quota/check-quota.query';
import { QuotaExceededEvent } from '../../domain/events/quota-exceeded.event';

View File

@@ -8,8 +8,8 @@ import { CheckQuotaHandler } from './application/queries/check-quota/check-quota
import { GetBillingHistoryHandler } from './application/queries/get-billing-history/get-billing-history.handler';
import { GetPlanHandler } from './application/queries/get-plan/get-plan.handler';
import { SUBSCRIPTION_REPOSITORY } from './domain/repositories/subscription.repository';
import { PrismaSubscriptionRepository } from './infrastructure/repositories/prisma-subscription.repository';
import { ListingCreatedUsageHandler } from './infrastructure/event-handlers/listing-created-usage.handler';
import { PrismaSubscriptionRepository } from './infrastructure/repositories/prisma-subscription.repository';
import { SubscriptionsController } from './presentation/controllers/subscriptions.controller';
import { QuotaGuard } from './presentation/guards/quota.guard';

View File

@@ -2,7 +2,6 @@ import { describe, it, expect } from 'vitest';
import {
listingBasicSchema,
listingLocationSchema,
listingDetailsSchema,
listingPricingSchema,
createListingSchema,
TRANSACTION_TYPES,

View File

@@ -7,7 +7,8 @@ describe('cn', () => {
});
it('should handle conditional classes', () => {
expect(cn('base', false && 'hidden', 'visible')).toBe('base visible');
const isHidden = false;
expect(cn('base', isHidden && 'hidden', 'visible')).toBe('base visible');
});
it('should merge conflicting Tailwind classes', () => {

View File

@@ -1,5 +1,5 @@
import { defineConfig } from 'vitest/config';
import path from 'path';
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {