Skip to content

Commit 70fd50f

Browse files
committed
Fix lint errors in web: empty blocks, conditional hooks, const conditions, displayName, type annotations
1 parent 5f5ede5 commit 70fd50f

File tree

36 files changed

+440
-274
lines changed

36 files changed

+440
-274
lines changed

web/src/__tests__/e2e/store-hydration.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { test, expect } from '@playwright/test'
22

3-
test('store hydrates agents via client fetch when SSR is empty', async ({ page }) => {
3+
test('store hydrates agents via client fetch when SSR is empty', async ({
4+
page,
5+
}) => {
46
const agents = [
57
{
68
id: 'base',
79
name: 'Base',
810
description: 'desc',
9-
publisher: { id: 'codebuff', name: 'Codebuff', verified: true, avatar_url: null },
11+
publisher: {
12+
id: 'codebuff',
13+
name: 'Codebuff',
14+
verified: true,
15+
avatar_url: null,
16+
},
1017
version: '1.2.3',
1118
created_at: new Date().toISOString(),
1219
weekly_spent: 10,

web/src/__tests__/e2e/store-ssr.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ test('SSR HTML contains at least one agent card', async ({ page }) => {
99
id: 'base',
1010
name: 'Base',
1111
description: 'desc',
12-
publisher: { id: 'codebuff', name: 'Codebuff', verified: true, avatar_url: null },
12+
publisher: {
13+
id: 'codebuff',
14+
name: 'Codebuff',
15+
verified: true,
16+
avatar_url: null,
17+
},
1318
version: '1.2.3',
1419
created_at: new Date().toISOString(),
1520
weekly_spent: 10,

web/src/app/admin/traces/utils/trace-processing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ export function extractActualAssistantResponse(response: any): string {
446446
if (!response) return ''
447447

448448
// Extract the raw response content first
449-
let responseContent = extractAssistantResponseFromResponse(response)
449+
const responseContent = extractAssistantResponseFromResponse(response)
450450

451451
if (!responseContent) return ''
452452

web/src/app/analytics.knowledge.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,49 +44,41 @@ Important event tracking considerations:
4444
The application uses the following event categories for consistent tracking:
4545

4646
1. Home Page Events (`home.*`)
47-
4847
- home.cta_clicked
4948
- home.video_opened
5049
- home.testimonial_clicked
5150

5251
2. Demo Terminal Events (`demo_terminal.*`)
53-
5452
- demo_terminal.command_executed
5553
- demo_terminal.help_viewed
5654
- demo_terminal.theme_changed
5755
- demo_terminal.bug_fixed
5856
- demo_terminal.rainbow_added
5957

6058
3. Authentication Events (`auth.*`)
61-
6259
- auth.login_started
6360
- auth.login_completed
6461
- auth.logout_completed
6562

6663
4. Cookie Consent Events (`cookie_consent.*`)
67-
6864
- cookie_consent.accepted
6965
- cookie_consent.declined
7066

7167
5. Subscription Events (`subscription.*`)
72-
7368
- subscription.plan_viewed
7469
- subscription.upgrade_started
7570
- subscription.payment_completed
7671
- subscription.change_confirmed
7772

7873
6. Referral Events (`referral.*`)
79-
8074
- referral.link_copied
8175
- referral.code_redeemed
8276
- referral.invite_sent
8377

8478
7. Documentation Events (`docs.*`)
85-
8679
- docs.viewed
8780

8881
8. Banner Events (`banner.*`)
89-
9082
- banner.clicked
9183

9284
9. Usage Events (`usage.*`)
@@ -100,7 +92,6 @@ Progress bar color coding:
10092
- Shows warning message when exceeding quota with overage rate details
10193

10294
9. Navigation Events (`navigation.*`)
103-
10495
- navigation.docs_clicked
10596
- navigation.pricing_clicked
10697

@@ -249,7 +240,6 @@ Example event properties:
249240
1. **Consistent Categories**: Use established categories (demo_terminal, auth, subscription, etc.) for all new events
250241

251242
2. **Event Properties**:
252-
253243
- Include theme in all UI events
254244
- Add source/location for user actions
255245
- Include error details for failure cases
@@ -310,7 +300,6 @@ export function PostHogProvider({ children }) {
310300
The application implements LinkedIn conversion tracking using a multi-step flow:
311301

312302
1. Initial Visit:
313-
314303
- Capture `li_fat_id` from URL query parameters
315304
- Store in localStorage
316305
- Clear from URL for cleaner user experience
@@ -332,7 +321,6 @@ Important: This pattern ensures accurate attribution even when users don't conve
332321
## Implementation Guidelines
333322

334323
1. Centralize Tracking Logic:
335-
336324
- Keep tracking code DRY by centralizing in shared functions
337325
- Multiple UI components may trigger the same conversion event
338326
- Maintain consistent tracking parameters across all conversion points

web/src/app/api/admin/admin-auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export async function checkAdminAuth(): Promise<
2323
'Unauthorized access attempt to admin endpoint',
2424
)
2525
}
26-
return NextResponse.json({ error: 'Forbidden - not an admin' }, { status: 403 })
26+
return NextResponse.json(
27+
{ error: 'Forbidden - not an admin' },
28+
{ status: 403 },
29+
)
2730
}
2831

2932
return adminUser

web/src/app/api/agents/publish/route.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ export async function POST(request: NextRequest) {
6060

6161
// DEPRECATED: authToken in body is for backwards compatibility with older CLI versions.
6262
// New clients should use the Authorization header instead.
63-
const { data, authToken: bodyAuthToken, allLocalAgentIds } = parseResult.data
63+
const {
64+
data,
65+
authToken: bodyAuthToken,
66+
allLocalAgentIds,
67+
} = parseResult.data
6468
const agentDefinitions = data
6569

6670
// Prefer Authorization header, fall back to body authToken for backwards compatibility
@@ -248,10 +252,10 @@ export async function POST(request: NextRequest) {
248252
const existsInSamePublisher = (full: string) =>
249253
publishingAgentIds.has(full) || publishedAgentIds.has(full)
250254

251-
async function getLatestPublishedVersion(
255+
const getLatestPublishedVersion = async (
252256
publisherId: string,
253257
agentId: string,
254-
): Promise<string | null> {
258+
): Promise<string | null> => {
255259
const latest = await db
256260
.select({ version: schema.agentConfig.version })
257261
.from(schema.agentConfig)

web/src/app/api/agents/validate/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ interface ValidateAgentsRequest {
1414
export async function POST(request: NextRequest): Promise<NextResponse> {
1515
try {
1616
const body = (await request.json()) as ValidateAgentsRequest
17-
let { agentConfigs, agentDefinitions } = body
17+
const { agentConfigs } = body
18+
let { agentDefinitions } = body
1819

1920
if (!agentDefinitions || !Array.isArray(agentDefinitions)) {
2021
agentDefinitions = agentConfigs

web/src/app/api/auth/[...nextauth]/auth-options.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ export const authOptions: NextAuthOptions = {
162162

163163
const potentialRedirectUrl = new URL(url, baseUrl)
164164
const authCode = potentialRedirectUrl.searchParams.get('auth_code')
165-
let referralCode = potentialRedirectUrl.searchParams.get('referral_code')
165+
const referralCode =
166+
potentialRedirectUrl.searchParams.get('referral_code')
166167

167168
console.log('🟡 NextAuth redirect parsed params:', {
168169
authCode: !!authCode,

web/src/app/api/healthz/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const GET = async () => {
1010
return NextResponse.json({
1111
status: 'ok',
1212
cached_agents: agents.length,
13-
timestamp: new Date().toISOString()
13+
timestamp: new Date().toISOString(),
1414
})
1515
} catch (error) {
1616
console.error('[Healthz] Failed to warm cache:', error)
@@ -19,7 +19,7 @@ export const GET = async () => {
1919
return NextResponse.json({
2020
status: 'ok',
2121
cache_warm: false,
22-
error: error instanceof Error ? error.message : 'Unknown error'
22+
error: error instanceof Error ? error.message : 'Unknown error',
2323
})
2424
}
2525
}

web/src/app/api/user/sessions/logout-all/route.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ function isSameOrigin(request: NextRequest) {
2828
const referer = request.headers.get('referer')
2929
if (origin && new URL(origin).origin === base) return true
3030
if (referer && new URL(referer).origin === base) return true
31-
} catch {}
31+
} catch {
32+
// Ignore URL parsing errors
33+
}
3234
return false
3335
}
3436

@@ -39,7 +41,10 @@ export async function POST(request: NextRequest) {
3941
}
4042

4143
if (!isSameOrigin(request)) {
42-
return NextResponse.json({ error: 'Forbidden - not same origin, cannot logout all sessions' }, { status: 403 })
44+
return NextResponse.json(
45+
{ error: 'Forbidden - not same origin, cannot logout all sessions' },
46+
{ status: 403 },
47+
)
4348
}
4449

4550
const currentToken = getCurrentSessionTokenFromCookies()

0 commit comments

Comments
 (0)