fix linting errors

This commit is contained in:
SwiftyOS
2024-12-05 09:46:31 +01:00
parent ab4f4549d6
commit fa871073ca
6 changed files with 72 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ const nextConfig = {
// TODO: Re-enable TypeScript checks once current issues are resolved
typescript: {
ignoreBuildErrors: true,
}
},
};
export default withSentryConfig(nextConfig, {

View File

@@ -17,7 +17,10 @@ import { Separator } from "@/components/ui/separator";
import AutoGPTServerAPIServerSide from "@/lib/autogpt-server-api";
import { Metadata } from "next";
import { createServerClient } from "@/lib/supabase/server";
import { StoreAgentsResponse, CreatorsResponse } from "@/lib/autogpt-server-api/types";
import {
StoreAgentsResponse,
CreatorsResponse,
} from "@/lib/autogpt-server-api/types";
async function getStoreData() {
try {
@@ -33,12 +36,36 @@ async function getStoreData() {
);
// Add error handling and default values
let featuredAgents: StoreAgentsResponse = { agents: [], pagination: { total_items: 0, total_pages: 0, current_page: 0, page_size: 0 } };
let topAgents: StoreAgentsResponse = { agents: [], pagination: { total_items: 0, total_pages: 0, current_page: 0, page_size: 0 } };
let featuredCreators: CreatorsResponse = { creators: [], pagination: { total_items: 0, total_pages: 0, current_page: 0, page_size: 0 } };
let featuredAgents: StoreAgentsResponse = {
agents: [],
pagination: {
total_items: 0,
total_pages: 0,
current_page: 0,
page_size: 0,
},
};
let topAgents: StoreAgentsResponse = {
agents: [],
pagination: {
total_items: 0,
total_pages: 0,
current_page: 0,
page_size: 0,
},
};
let featuredCreators: CreatorsResponse = {
creators: [],
pagination: {
total_items: 0,
total_pages: 0,
current_page: 0,
page_size: 0,
},
};
try {
[featuredAgents, topAgents, featuredCreators] = await Promise.all([
[featuredAgents, topAgents, featuredCreators] = await Promise.all([
api.getStoreAgents({ featured: true }),
api.getStoreAgents({ sorted_by: "runs" }),
api.getStoreCreators({ featured: true, sorted_by: "num_agents" }),
@@ -55,9 +82,33 @@ async function getStoreData() {
} catch (error) {
console.error("Error in getStoreData:", error);
return {
featuredAgents: { agents: [], pagination: { total_items: 0, total_pages: 0, current_page: 0, page_size: 0 } },
topAgents: { agents: [], pagination: { total_items: 0, total_pages: 0, current_page: 0, page_size: 0 } },
featuredCreators: { creators: [], pagination: { total_items: 0, total_pages: 0, current_page: 0, page_size: 0 } },
featuredAgents: {
agents: [],
pagination: {
total_items: 0,
total_pages: 0,
current_page: 0,
page_size: 0,
},
},
topAgents: {
agents: [],
pagination: {
total_items: 0,
total_pages: 0,
current_page: 0,
page_size: 0,
},
},
featuredCreators: {
creators: [],
pagination: {
total_items: 0,
total_pages: 0,
current_page: 0,
page_size: 0,
},
},
};
}
}

View File

@@ -124,7 +124,7 @@ export const Sizes: Story = {
await expect(buttons).toHaveLength(5);
const sizeClasses = [
"h-8 px-3 py-1.5 text-xs",
"h-10 px-4 py-2 text-sm",
"h-10 px-4 py-2 text-sm",
"h-12 px-5 py-2.5 text-lg",
"h-10 w-28",
"h-10 w-10",
@@ -132,7 +132,7 @@ export const Sizes: Story = {
for (let i = 0; i < buttons.length; i++) {
await expect(buttons[i]).toHaveAttribute(
"class",
expect.stringContaining(sizeClasses[i])
expect.stringContaining(sizeClasses[i]),
);
}
},

View File

@@ -75,7 +75,7 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
setOpen(openPopout);
setStep(inputStep);
setPublishData(submissionData);
}, [openPopout]);
}, [openPopout]); // eslint-disable-line react-hooks/exhaustive-deps
React.useEffect(() => {
console.log("LoadMyAgents Effect");
@@ -91,7 +91,7 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
loadMyAgents();
}
}, [open]);
}, [open, api]);
const handleClose = () => {
setStep("select");

View File

@@ -3,7 +3,13 @@ import { NextResponse, type NextRequest } from "next/server";
import { LOCALES } from "@/lib/utils";
// TODO: Update the protected pages list
const PROTECTED_PAGES = ["/monitor", "/build", "/store/profile", "/store/settings", "/store/dashboard"];
const PROTECTED_PAGES = [
"/monitor",
"/build",
"/store/profile",
"/store/settings",
"/store/dashboard",
];
const ADMIN_PAGES = ["/admin"];
export async function updateSession(request: NextRequest, locale: string) {

View File

@@ -244,7 +244,7 @@ export function getBehaveAs(): BehaveAs {
: BehaveAs.LOCAL;
}
export const LOCALES = process.env.NEXT_PUBLIC_LOCALES
export const LOCALES = process.env.NEXT_PUBLIC_LOCALES
? process.env.NEXT_PUBLIC_LOCALES.split(",").filter(Boolean)
: ["en"];
export const DEFAULT_LOCALE = process.env.NEXT_PUBLIC_DEFAULT_LOCALE || "en";