diff --git a/.eslintrc.js b/.eslintrc.js index d747db8e..2db5d047 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,12 +6,18 @@ module.exports = { // necessary to pickup project-specific overrides in prettierrc.js 'prettier', ], + parser: '@typescript-eslint/parser', + parserOptions: { + project: './tsconfig.json', // Adjust the path if necessary + tsconfigRootDir: __dirname, + }, plugins: ['react-hooks', 'jsx-a11y'], rules: { 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unnecessary-condition': 'error', 'react/no-unescaped-entities': 'off', }, }; diff --git a/src/app/LayoutUI.tsx b/src/app/LayoutUI.tsx index 449706e8..491d56b2 100644 --- a/src/app/LayoutUI.tsx +++ b/src/app/LayoutUI.tsx @@ -10,7 +10,7 @@ import styles from './LayoutUI.module.scss'; export function LayoutUI({ children }: { children: React.ReactNode }) { const segments = useSelectedLayoutSegments(); - const embed = Boolean(segments?.includes('embed')); + const embed = Boolean(segments.includes('embed')); return (
{embed ? null :
} diff --git a/src/app/api/admin/reset/route.ts b/src/app/api/admin/reset/route.ts index fea10ccf..dfb35866 100644 --- a/src/app/api/admin/reset/route.ts +++ b/src/app/api/admin/reset/route.ts @@ -33,7 +33,7 @@ export async function POST(req: NextRequest): Promise { - {botVisits?.slice(0, displayedVisits).map((botVisit) => { + {botVisits.slice(0, displayedVisits).map((botVisit) => { return ( - - {formatDate(botVisit?.timestamp)} - {botVisit?.requestId} + + {formatDate(botVisit.timestamp)} + {botVisit.requestId} - {botVisit?.botResult} ({botVisit.botType}) + {botVisit.botResult} ({botVisit.botType}) - {botVisit?.ip} + {botVisit.ip} @@ -197,32 +197,32 @@ export const BotFirewall: FunctionComponent = () => { {/* Display bot visits as **CARDS** only on small screens */}
- {botVisits?.slice(0, displayedVisits).map((botVisit) => { + {botVisits.slice(0, displayedVisits).map((botVisit) => { return (
Timestamp
-
{formatDate(botVisit?.timestamp)}
+
{formatDate(botVisit.timestamp)}
Request ID
-
{botVisit?.requestId}
+
{botVisit.requestId}
Bot Type
- {botVisit?.botResult} ({botVisit.botType}) + {botVisit.botResult} ({botVisit.botType})
IP Address
-
{botVisit?.ip}
+
{botVisit.ip}
); @@ -268,13 +268,13 @@ export const BotFirewall: FunctionComponent = () => { {content} {/* Display load older bot visits button if necessary */} - {botVisits && botVisits?.length > DEFAULT_DISPLAYED_VISITS ? ( + {botVisits && botVisits.length > DEFAULT_DISPLAYED_VISITS ? ( diff --git a/src/app/bot-firewall/api/get-bot-visits/botVisitDatabase.ts b/src/app/bot-firewall/api/get-bot-visits/botVisitDatabase.ts index 01babcd8..b935ce43 100644 --- a/src/app/bot-firewall/api/get-bot-visits/botVisitDatabase.ts +++ b/src/app/bot-firewall/api/get-bot-visits/botVisitDatabase.ts @@ -53,12 +53,12 @@ export const saveBotVisit = async (botData: EventResponseBotData, visitorId: str BotVisitDbModel.create({ ip: botData.ip, visitorId: visitorId, - requestId: botData.requestId ?? 'N/A', - timestamp: botData.time ?? 'N/A', - botResult: botData.bot.result ?? 'N/A', - botType: botData.bot.type ?? 'N/A', - userAgent: botData.userAgent ?? 'N/A', - url: botData.url ?? 'N/A', + requestId: botData.requestId, + timestamp: botData.time, + botResult: botData.bot.result, + botType: botData.bot.type ?? '', + userAgent: botData.userAgent, + url: botData.url, }); }; diff --git a/src/app/coupon-fraud/CouponFraud.tsx b/src/app/coupon-fraud/CouponFraud.tsx index 45f1b40c..44d879df 100644 --- a/src/app/coupon-fraud/CouponFraud.tsx +++ b/src/app/coupon-fraud/CouponFraud.tsx @@ -110,7 +110,7 @@ export function CouponFraudUseCase() { {isLoading ? 'Processing...' : 'Apply'}
- {claimResponse?.message && !isLoading && ( + {claimResponse?.message && (
{claimResponse.message}
diff --git a/src/app/coupon-fraud/api/claim/route.ts b/src/app/coupon-fraud/api/claim/route.ts index d0f0b095..aecd70c2 100644 --- a/src/app/coupon-fraud/api/claim/route.ts +++ b/src/app/coupon-fraud/api/claim/route.ts @@ -28,7 +28,7 @@ export async function POST(req: Request): Promise {loginNetworkError && {loginNetworkError.message}} - {loginResponse?.message && !isLoading && ( + {loginResponse?.message && ( {loginResponse.message} diff --git a/src/app/credential-stuffing/api/authenticate/route.ts b/src/app/credential-stuffing/api/authenticate/route.ts index c621e91f..60ea62bc 100644 --- a/src/app/credential-stuffing/api/authenticate/route.ts +++ b/src/app/credential-stuffing/api/authenticate/route.ts @@ -44,7 +44,7 @@ export async function POST(req: Request): Promise> { } // Get visitorId from the Server API Identification event - const visitorId = fingerprintResult.data.products?.identification?.data?.visitorId; + const visitorId = fingerprintResult.data.products.identification?.data?.visitorId; if (!visitorId) { logLoginAttempt(clientVisitorId, username, 'RequestIdValidationFailed'); return NextResponse.json({ message: 'Visitor ID not found.', severity: 'error' }, { status: 403 }); diff --git a/src/app/loan-risk/LoanRisk.tsx b/src/app/loan-risk/LoanRisk.tsx index e927f342..fe6c32f8 100644 --- a/src/app/loan-risk/LoanRisk.tsx +++ b/src/app/loan-risk/LoanRisk.tsx @@ -196,7 +196,7 @@ export function LoanRisk() {
{loanRequestNetworkError && {loanRequestNetworkError.message}} - {loanRequestResponse?.message && !isLoanRequestLoading && ( + {loanRequestResponse?.message && ( {loanRequestResponse.message} )}