Linting Fixes Summary
Date: January 16, 2026 Issue: Pre-commit hook failing due to linting errors
Critical Error Fixed ✅
1. bodyParser Import Error (BLOCKING)
File: apps/payment-service/src/middleware/raw-body.middleware.ts
Error:
'json' not found in imported namespace 'bodyParser'
Fix:
- Removed
body-parserimport (not needed) - Configured NestJS to preserve raw body via
NestFactory.create({ rawBody: true })inmain.ts - Simplified middleware to pass-through (raw body handled by NestJS config)
Before:
import * as bodyParser from 'body-parser';
bodyParser.json({ verify: ... })
After:
// No body-parser import needed
// Raw body configured in main.ts
Warnings Fixed ✅
2. Missing Return Types
Files Fixed:
apps/payment-service/src/webhooks/stripe-webhook.controller.ts- AddedPromise<{ received: boolean }>apps/payment-service/src/webhooks/vnpay-webhook.controller.ts- Added return types to all methodsapps/payment-service/src/payments/payments.controller.ts- AddedPromise<PaymentTransaction[]>apps/payment-service/src/main.ts- AddedPromise<void>apps/payment-service/src/app.module.ts- Addedvoidreturn typeapps/booking-service/src/events/payment.listener.ts- AddedPromise<void>to all 4 handlers
3. Missing JSDoc Comments
Files Fixed:
apps/payment-service/src/middleware/raw-body.middleware.tsapps/payment-service/src/app.module.tsapps/payment-service/src/webhooks/stripe-webhook.controller.tsapps/payment-service/src/webhooks/vnpay-webhook.controller.tsapps/payment-service/src/migrations/1736960000000-CreatePaymentTables.tsapps/payment-service/src/services/stripe.service.tsapps/payment-service/src/services/vnpay.service.tsapps/payment-service/src/services/payment.service.tsapps/payment-service/src/payments/payments.service.tsapps/payment-service/src/payments/payments.controller.tsapps/booking-service/src/events/payment.listener.ts
4. Code Quality Improvements
Files Fixed:
apps/payment-service/src/main.ts:- Added
voidto bootstrap call - Added eslint-disable for console.log (acceptable in bootstrap)
-
Fixed import order warning
-
apps/payment-service/src/webhooks/vnpay-webhook.controller.ts: - Changed
anytoRecord<string, string>for query/body parameters - Added proper return types
Remaining Warnings (Acceptable)
The following warnings remain but are acceptable and won't block commits:
anytypes in webhook handlers - Required for dynamic webhook payloads from Stripe/VNPay- Unsafe assignments - Necessary for webhook payload processing
- Missing JSDoc in test files - Test files are less strict
- Console statements - Acceptable in bootstrap/main files
These are within the max-warnings=9999 limit configured in the pre-commit hook.
Test Results
Payment Service Linting
yarn nx lint payment-service --fix
✅ 0 errors, 138 warnings (all acceptable)
Booking Service Linting
yarn nx lint booking-service --fix
✅ 0 errors, 88 warnings (all acceptable)
Files Modified
apps/payment-service/src/middleware/raw-body.middleware.ts✅apps/payment-service/src/main.ts✅apps/payment-service/src/app.module.ts✅apps/payment-service/src/webhooks/stripe-webhook.controller.ts✅apps/payment-service/src/webhooks/vnpay-webhook.controller.ts✅apps/payment-service/src/payments/payments.controller.ts✅apps/payment-service/src/services/payment.service.ts✅apps/payment-service/src/services/stripe.service.ts✅apps/payment-service/src/services/vnpay.service.ts✅apps/payment-service/src/payments/payments.service.ts✅apps/payment-service/src/migrations/1736960000000-CreatePaymentTables.ts✅apps/booking-service/src/events/payment.listener.ts✅
Commit Status
✅ Ready to Commit
The critical error has been fixed and all important warnings addressed. The commit should now pass the pre-commit hook.
To commit:
git commit -m "feat: phase 04 - implement payment integration api"
The pre-commit hook will run with max-warnings=9999, so the remaining warnings (mostly about any types in webhook handlers) are acceptable.