Skip to content

Commit

Permalink
fix: eslint and prettier formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Dec 9, 2024
1 parent 9bdea6b commit 9bbd5cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 2 additions & 3 deletions frontend/src/api/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ export const searchGitHubRepositories = async (query: string) => {
sort: "stars",
},
transformResponse: (data) => {
const parsedData:
| { items: GitHubRepository[] }
| GitHubErrorReponse = JSON.parse(data);
const parsedData: { items: GitHubRepository[] } | GitHubErrorReponse =
JSON.parse(data);

if (isGitHubErrorReponse(parsedData)) {
throw new Error(parsedData.message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Autocomplete, AutocompleteItem } from "@nextui-org/react";
import { useDispatch } from "react-redux";
import posthog from "posthog-js";
import { useState } from "react";
import { setSelectedRepository } from "#/state/initial-query-slice";
import { useRepositorySearch } from "#/hooks/query/use-repository-search";
import { useState } from "react";

interface GitHubRepositorySelectorProps {
onSelect: () => void;
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/hooks/query/use-repository-search.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
import { useEffect, useState } from "react";
import { retrieveGitHubUserRepositories, searchGitHubRepositories } from "#/api/github";
import { useAuth } from "#/context/auth-context";
import debounce from "lodash/debounce";
import {
retrieveGitHubUserRepositories,
searchGitHubRepositories,
} from "#/api/github";
import { useAuth } from "#/context/auth-context";

export const useRepositorySearch = (searchQuery: string) => {
const { gitHubToken } = useAuth();
Expand Down Expand Up @@ -41,7 +44,7 @@ export const useRepositorySearch = (searchQuery: string) => {
// Remove duplicates based on full_name, preferring public repos with stars
const uniqueRepositories = repositories.filter(
(repo, index, self) =>
index === self.findIndex((r) => r.full_name === repo.full_name)
index === self.findIndex((r) => r.full_name === repo.full_name),
);

// Sort repositories: prefix matches first, then by stars, then alphabetically
Expand Down Expand Up @@ -69,4 +72,4 @@ export const useRepositorySearch = (searchQuery: string) => {
isLoading: userRepos.isLoading || searchResults.isLoading,
error: userRepos.error || searchResults.error,
};
};
};

0 comments on commit 9bbd5cc

Please sign in to comment.