From 608f1f7aceaffeae3aa5751f912ee10fb18cd5a6 Mon Sep 17 00:00:00 2001 From: openhands Date: Tue, 10 Dec 2024 20:04:35 +0000 Subject: [PATCH] Fix lint and type errors --- scripts/src/github-api.ts | 4 ++-- scripts/src/types.ts | 2 +- src/__integration_tests__/github.test.ts | 1 + src/components/ActivityList.test.tsx | 6 +++--- src/components/ActivityList.tsx | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/src/github-api.ts b/scripts/src/github-api.ts index 300447a..35c77a1 100644 --- a/scripts/src/github-api.ts +++ b/scripts/src/github-api.ts @@ -57,7 +57,7 @@ async function fetchAllPages(url: string): Promise { pageCount++; console.log(`Fetching page ${pageCount.toString()} from ${currentUrl}`); const response = await fetchWithAuth(currentUrl); - console.log(`Got ${response.data.length.toString()} items`); + console.log(`Got ${String(response.data.length)} items`); allItems.push(...(response.data as T[])); currentUrl = response.nextUrl ?? ''; } @@ -155,7 +155,7 @@ async function processIssueComments(issue: GitHubIssue): Promise { let prNumber: string | undefined; // Try full PR URL format - const fullUrlMatch = successComment.body.match(/https:\/\/github\.com\/[^\/]+\/[^\/]+\/pull\/(\d+)/); + const fullUrlMatch = successComment.body.match(/https:\/\/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/); if (fullUrlMatch) { prNumber = fullUrlMatch[1]; } diff --git a/scripts/src/types.ts b/scripts/src/types.ts index 1c50c80..019abaa 100644 --- a/scripts/src/types.ts +++ b/scripts/src/types.ts @@ -34,7 +34,7 @@ export interface GitHubPRResponse { } export interface ApiResponse { - data: any[] | any; + data: unknown[]; hasNextPage: boolean; nextUrl: string | null; } diff --git a/src/__integration_tests__/github.test.ts b/src/__integration_tests__/github.test.ts index 134f616..3b5820e 100644 --- a/src/__integration_tests__/github.test.ts +++ b/src/__integration_tests__/github.test.ts @@ -58,6 +58,7 @@ describe('GitHub Service Integration Tests', () => { url: expect.stringMatching(/^https:\/\/github\.com\//), title: expect.any(String), description: expect.any(String), + prUrl: expect.any(String), }; for (const activity of activities) { diff --git a/src/components/ActivityList.test.tsx b/src/components/ActivityList.test.tsx index 7cd40a6..e733e4f 100644 --- a/src/components/ActivityList.test.tsx +++ b/src/components/ActivityList.test.tsx @@ -1,5 +1,5 @@ import { render, screen, fireEvent } from '@testing-library/react'; -import { describe, it, expect, beforeEach } from 'vitest'; +import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { ActivityList } from './ActivityList'; import { BotActivity } from '../types'; import { getComputedStyle } from '../test/testUtils'; @@ -137,7 +137,7 @@ describe('ActivityList', () => { afterEach(() => { // Clean up styles const styles = document.head.getElementsByTagName('style'); - Array.from(styles).forEach(style => style.remove()); + Array.from(styles).forEach((style) => { style.remove(); }); }); const issueStatuses = [ @@ -248,7 +248,7 @@ describe('ActivityList', () => { afterEach(() => { // Clean up styles const styles = document.head.getElementsByTagName('style'); - Array.from(styles).forEach(style => style.remove()); + Array.from(styles).forEach((style) => { style.remove(); }); }); describe('pagination styling', () => { diff --git a/src/components/ActivityList.tsx b/src/components/ActivityList.tsx index ddff047..0564f0c 100644 --- a/src/components/ActivityList.tsx +++ b/src/components/ActivityList.tsx @@ -1,4 +1,4 @@ -import { BotActivity, IssueActivityStatus } from '../types'; +import { BotActivity } from '../types'; import { useState } from 'react'; interface ActivityListProps {