mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 08:52:21 +00:00
fix(ci): satisfy format check and knip on profile polish branch
Run oxfmt across touched UI files, stop exporting the unused inline-code summary segment type, and type the malformed-topic hook test so types-build passes.
This commit is contained in:
committed by
Patrick Erichsen
parent
e095e4b0ae
commit
2aa8af1e7b
@@ -280,7 +280,9 @@ export function SkillFilesPanel({ versionId, latestFiles }: SkillFilesPanelProps
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className={`file-viewer-body${isViewerLoading ? " file-viewer-body-loading" : ""}`}>
|
||||
<div
|
||||
className={`file-viewer-body${isViewerLoading ? " file-viewer-body-loading" : ""}`}
|
||||
>
|
||||
{isViewerLoading ? (
|
||||
<FileViewerSkeleton />
|
||||
) : fileError ? (
|
||||
|
||||
@@ -7,7 +7,12 @@ import type { Doc, Id } from "../../convex/_generated/dataModel";
|
||||
import type { ActivityTrend } from "../lib/activityTrend";
|
||||
import { getSkillBadges, isSkillOfficial } from "../lib/badges";
|
||||
import { BrowseCategoryIcon } from "../lib/browseCategoryIcons";
|
||||
import { buildSkillCategoryBrowseHref, buildSkillTopicBrowseHref, formatCatalogTopicLabel, type SkillCategory } from "../lib/categories";
|
||||
import {
|
||||
buildSkillCategoryBrowseHref,
|
||||
buildSkillTopicBrowseHref,
|
||||
formatCatalogTopicLabel,
|
||||
type SkillCategory,
|
||||
} from "../lib/categories";
|
||||
import { formatSkillStatsTriplet } from "../lib/numberFormat";
|
||||
import { buildPublisherProfileHref } from "../lib/ownerRoute";
|
||||
import type { PublicPublisher, PublicSkill } from "../lib/publicUser";
|
||||
@@ -15,10 +20,10 @@ import { timeAgo } from "../lib/timeAgo";
|
||||
import { useHeroCreatorPublisher } from "../lib/useHeroCreatorPublisher";
|
||||
import { useMediaQuery } from "../lib/useMediaQuery";
|
||||
import { ActivityMetricLabel } from "./ActivityMetricLabel";
|
||||
import { InlineCodeSummary } from "./InlineCodeSummary";
|
||||
import { DetailHero, DETAIL_HERO_TOPIC_LIMIT } from "./DetailPageShell";
|
||||
import { DetailSecuritySummaryLabel } from "./DetailSecuritySummary";
|
||||
import { useDownloadsSidebarMetricBlock } from "./DownloadsMetricCard";
|
||||
import { InlineCodeSummary } from "./InlineCodeSummary";
|
||||
import { SidebarMetadata } from "./SidebarMetadata";
|
||||
import { buildSkillHref } from "./skillDetailUtils";
|
||||
import { SkillCommandLineCard } from "./SkillInstallSurface";
|
||||
|
||||
@@ -21,7 +21,9 @@ describe("browseTopicSearch", () => {
|
||||
});
|
||||
|
||||
it("removes malformed topic keys when sanitizing search state", () => {
|
||||
expect(sanitizeBrowseTopicSearch({ "topic=github": "", category: "development" }, "github")).toEqual({
|
||||
expect(
|
||||
sanitizeBrowseTopicSearch({ "topic=github": "", category: "development" }, "github"),
|
||||
).toEqual({
|
||||
category: "development",
|
||||
topic: "github",
|
||||
});
|
||||
|
||||
@@ -55,10 +55,7 @@ export function parseBrowseTopicFromSearchString(searchStr: string | undefined)
|
||||
return parseTopicFromSearchParams(new URLSearchParams(normalized));
|
||||
}
|
||||
|
||||
export function hasMalformedBrowseTopicSearch(
|
||||
search: Record<string, unknown>,
|
||||
searchStr?: string,
|
||||
) {
|
||||
export function hasMalformedBrowseTopicSearch(search: Record<string, unknown>, searchStr?: string) {
|
||||
if (Object.keys(search).some((key) => key.startsWith("topic="))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
export type InlineCodeSummarySegment =
|
||||
| { type: "text"; value: string }
|
||||
| { type: "code"; value: string };
|
||||
type InlineCodeSummarySegment = { type: "text"; value: string } | { type: "code"; value: string };
|
||||
|
||||
const INLINE_CODE_PATTERN = /`([^`\n]+)`/g;
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ import { loader } from "@monaco-editor/react";
|
||||
import * as monaco from "monaco-editor";
|
||||
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
||||
|
||||
type MonacoWindow = Window & typeof globalThis & {
|
||||
MonacoEnvironment?: {
|
||||
getWorker: () => Worker;
|
||||
type MonacoWindow = Window &
|
||||
typeof globalThis & {
|
||||
MonacoEnvironment?: {
|
||||
getWorker: () => Worker;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
const browserWindow = typeof window !== "undefined" ? (window as MonacoWindow) : undefined;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import { useBrowseTopicSearch } from "./useBrowseTopicSearch";
|
||||
|
||||
const useRouterStateMock = vi.fn();
|
||||
const navigateMock = vi.fn();
|
||||
|
||||
vi.mock("@tanstack/react-router", () => ({
|
||||
useRouterState: (options: { select: (state: unknown) => unknown }) =>
|
||||
@@ -23,7 +22,9 @@ describe("useBrowseTopicSearch", () => {
|
||||
|
||||
it("falls back to malformed topic%3Dgithub query strings", () => {
|
||||
useRouterStateMock.mockReturnValue("?topic%3Dgithub");
|
||||
const { result } = renderHook(() => useBrowseTopicSearch({ "topic=github": "" }));
|
||||
const { result } = renderHook(() =>
|
||||
useBrowseTopicSearch<{ topic?: string; "topic=github"?: string }>({ "topic=github": "" }),
|
||||
);
|
||||
expect(result.current.activeTopic).toBe("github");
|
||||
expect(result.current.search.topic).toBe("github");
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createFileRoute, Link, redirect } from "@tanstack/react-router";
|
||||
import { isPluginCategorySlug, normalizeCatalogTopic } from "clawhub-schema";
|
||||
import { isPluginCategorySlug } from "clawhub-schema";
|
||||
import { useQuery } from "convex/react";
|
||||
import { BadgeCheck, PackageSearch, Plus } from "lucide-react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
@@ -21,14 +21,17 @@ import { PluginListItem } from "../../components/PluginListItem";
|
||||
import { BrowseResultsSkeleton } from "../../components/skeletons/BrowseResultsSkeleton";
|
||||
import { Button } from "../../components/ui/button";
|
||||
import { formatBrowseCount } from "../../lib/browseCount";
|
||||
import {
|
||||
parseBrowseTopicFromSearchInput,
|
||||
sanitizeBrowseTopicSearch,
|
||||
} from "../../lib/browseTopicSearch";
|
||||
import { PLUGIN_CATEGORIES, resolvePluginBrowseCategorySlug } from "../../lib/categories";
|
||||
import { parseBrowseTopicFromSearchInput, sanitizeBrowseTopicSearch } from "../../lib/browseTopicSearch";
|
||||
import { useBrowseTopicSearch } from "../../lib/useBrowseTopicSearch";
|
||||
import {
|
||||
fetchPluginCatalog,
|
||||
isRateLimitedPackageApiError,
|
||||
type PackageListItem,
|
||||
} from "../../lib/packageApi";
|
||||
import { useBrowseTopicSearch } from "../../lib/useBrowseTopicSearch";
|
||||
import { useMediaQuery } from "../../lib/useMediaQuery";
|
||||
|
||||
type VisiblePluginSort = "recommended" | "updated" | "downloads" | "trending";
|
||||
|
||||
@@ -18,11 +18,11 @@ import {
|
||||
useBrowseSearchDisclosure,
|
||||
} from "../../components/BrowseControls";
|
||||
import { formatBrowseCount } from "../../lib/browseCount";
|
||||
import { parseBrowseTopicFromSearchInput, sanitizeBrowseTopicSearch } from "../../lib/browseTopicSearch";
|
||||
import {
|
||||
resolveSkillBrowseCategorySlug,
|
||||
SKILL_CATEGORIES,
|
||||
} from "../../lib/categories";
|
||||
parseBrowseTopicFromSearchInput,
|
||||
sanitizeBrowseTopicSearch,
|
||||
} from "../../lib/browseTopicSearch";
|
||||
import { resolveSkillBrowseCategorySlug, SKILL_CATEGORIES } from "../../lib/categories";
|
||||
import { useBrowseTopicSearch } from "../../lib/useBrowseTopicSearch";
|
||||
import { parseDir, parseSort } from "./-params";
|
||||
import { SkillsResults } from "./-SkillsResults";
|
||||
@@ -101,10 +101,7 @@ export function SkillsIndex() {
|
||||
: "all";
|
||||
const activeSort = ["updated", "newest", "name"].includes(model.sort) ? model.sort : undefined;
|
||||
const hasActiveFilters =
|
||||
model.hasQuery ||
|
||||
Boolean(model.activeCategory) ||
|
||||
Boolean(activeTopic) ||
|
||||
model.featuredOnly;
|
||||
model.hasQuery || Boolean(model.activeCategory) || Boolean(activeTopic) || model.featuredOnly;
|
||||
const totalSkillsCount = useQuery(api.skills.countPublicSkills, {});
|
||||
const categoryTopics = useQuery(
|
||||
api.catalogTopics.listTopByCategory,
|
||||
|
||||
Reference in New Issue
Block a user