refactor: clean up duplicate imports and dead code

- Merge type and value imports from the same module into single imports
- Remove dead import-badges action (flow uses /api/admin/import/badges)
- Remove unused babel-plugin-react-compiler devDependency
- Remove stray test.txt file
- Update knip config: track css imports, drop redundant ignore entries
- Update contract test to drop obsolete dead-action assertion
This commit is contained in:
openhands committed 2026-08-09 11:51:26 +02:00
1 parent 76730b84cf
commit ae1393d3e3
15 files changed
+45 -75

No files matched your search

+2 -11
View File
@@ -7,16 +7,7 @@
"src/app/**/{error,not-found,loading,template,default,global-error}.{ts,tsx}",
"scripts/migrate-aes-cbc-to-gcm.ts"
],
"project": ["src/**/*.{ts,tsx}", "scripts/**/*.{ts,js}"],
"ignoreDependencies": [
"tailwindcss-animate",
"@tailwindcss/forms",
"@tailwindcss/typography",
"pino-pretty",
"tailwindcss",
"husky",
"@sentry/nextjs"
],
"ignore": ["src/actions/import-badges.ts"],
"project": ["src/**/*.{ts,tsx,css}", "scripts/**/*.{ts,js}"],
"ignoreDependencies": ["@sentry/nextjs", "pino-pretty", "husky"],
"ignoreBinaries": ["sendmail"]
}
-1
View File
@@ -75,7 +75,6 @@
"@types/react": "19.2.18",
"@types/react-dom": "19.2.4",
"@vitest/coverage-v8": "4.1.10",
"babel-plugin-react-compiler": "^1.0.0",
"dotenv": "^17.4.2",
"drizzle-kit": "^0.31.10",
"husky": "^9.1.7",
+1 -3
View File
@@ -164,9 +164,6 @@ importers:
'@vitest/coverage-v8':
specifier: 4.1.10
version: 4.1.10([email protected])
babel-plugin-react-compiler:
specifier: ^1.0.0
version: 1.0.0
dotenv:
specifier: ^17.4.2
version: 17.4.2
@@ -4318,6 +4315,7 @@ snapshots:
[email protected]:
dependencies:
'@babel/types': 7.29.8
optional: true
[email protected]: {}
-22
View File
@@ -1,22 +0,0 @@
"use server";
import { requirePermission } from "@/lib/admin/guard";
import { PERMS } from "@/lib/permissions";
import { importBadgeSynced } from "@/lib/services/import-badge";
export async function importBadgeFromRemote({
code,
name,
description,
}: {
code: string;
name: string;
description: string;
}) {
await requirePermission(PERMS.ASSETS_IMPORT);
const result = await importBadgeSynced({ code, name, description });
if (!result.ok) {
return { ok: false as const, error: result.error };
}
return { ok: true as const };
}
@@ -2,8 +2,7 @@
import { Languages, Package, Settings } from "lucide-react";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import type { CatalogItemData } from "./catalog-items-table";
import { CatalogItemsTable } from "./catalog-items-table";
import { type CatalogItemData, CatalogItemsTable } from "./catalog-items-table";
import { CatalogPageForm } from "./catalog-page-form";
import { CatalogTranslateTab } from "./catalog-translate-tab";
@@ -90,8 +90,14 @@ import {
} from "./field-helpers";
import { FurniIcon } from "./furni-icon";
import { SongPicker } from "./song-picker";
import type { BaseItemData, CatalogItemData, InlineEdit } from "./types";
import { DEFAULT_NEW_ITEM, getPointsLabel, POINTS_TYPES } from "./types";
import {
type BaseItemData,
type CatalogItemData,
DEFAULT_NEW_ITEM,
getPointsLabel,
type InlineEdit,
POINTS_TYPES,
} from "./types";
export type { BaseItemData, CatalogItemData };
@@ -11,13 +11,14 @@ import {
} from "@/components/ui/select";
import {
getCachedSongPickerOptions,
invalidateSongPickerCache,
loadSongPickerOptions,
type SoundtrackOption,
} from "@/lib/client-cache/song-picker-cache";
// Re-export so existing `import { invalidateSongPickerCache } from '.../song-picker'`
// callsites keep working. New code should import from the lib module directly.
export { invalidateSongPickerCache } from "@/lib/client-cache/song-picker-cache";
export { invalidateSongPickerCache };
interface Props {
value: number;
@@ -16,8 +16,10 @@ import { useCallback, useEffect, useMemo, useState } from "react";
import { toast } from "sonner";
import { updateCatalogPage } from "@/actions/catalog";
import { updateBcPage } from "@/actions/catalog-bc";
import type { CatalogItemData } from "@/app/admin/catalog/[id]/catalog-items-table";
import { CatalogItemsTable } from "@/app/admin/catalog/[id]/catalog-items-table";
import {
type CatalogItemData,
CatalogItemsTable,
} from "@/app/admin/catalog/[id]/catalog-items-table";
import { CatalogTranslateTab } from "@/app/admin/catalog/[id]/catalog-translate-tab";
import { BulkImportItems } from "@/components/admin/catalog/bulk-import-items";
import { CatalogImagePicker } from "@/components/admin/catalog/catalog-image-picker";
@@ -1,8 +1,10 @@
"use client";
import { Crown, Image as ImageIcon, Package, Sparkles } from "lucide-react";
import type { CatalogItemData } from "@/app/admin/catalog/[id]/catalog-items-table/types";
import { getPointsLabel } from "@/app/admin/catalog/[id]/catalog-items-table/types";
import {
type CatalogItemData,
getPointsLabel,
} from "@/app/admin/catalog/[id]/catalog-items-table/types";
import {
CurrencyIcon,
currencyKindFromPointsType,
+1 -1
View File
@@ -1,4 +1,3 @@
import type { LucideIcon } from "lucide-react";
import {
Activity,
AlertTriangle,
@@ -19,6 +18,7 @@ import {
Languages,
LayoutDashboard,
ListOrdered,
type LucideIcon,
Megaphone,
Monitor,
Newspaper,
+1 -2
View File
@@ -1,5 +1,4 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { type NextRequest, NextResponse } from "next/server";
import { logAuthorizationEvent } from "@/lib/admin/authorization-events";
import { validateCsrfToken } from "@/lib/foundation/security";
import { canAccess, getApiAdminContext } from "@/lib/permissions";
-3
View File
@@ -45,9 +45,6 @@ describe("admin import backend contract", () => {
expect(service).toContain("ExternalTexts.json");
expect(service).toContain("WebsiteBadges");
expect(service).toContain("importBadgeSynced");
expect(readFileSync("src/actions/import-badges.ts", "utf8")).toContain(
"importBadgeSynced",
);
expect(
readFileSync("src/app/api/admin/import/badges/route.ts", "utf8"),
).toContain("importBadgeSynced");
+20 -19
View File
@@ -4,23 +4,6 @@ import { and, eq, type SQL, sql } from "drizzle-orm";
import { CatalogPages, db, ItemsBase } from "@/lib/db";
import { officialHabboEnrichmentWarning } from "@/lib/habbo-gamedata-hotel";
import { logger } from "@/lib/logger";
import {
appendFurniEntry,
buildFurniEntry,
removeFurniEntry,
} from "@/lib/services/furni-data";
import type { OfficialHabboFurniEntry } from "@/lib/services/habbo-furnidata-cache";
import { lookupOfficialHabboFurni } from "@/lib/services/habbo-furnidata-cache";
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
// Re-export the download helpers now owned by the shared import core.
// Existing furni callers keep importing them from here.
export {
downloadFile,
validatePngBytes,
validateSwfBytes,
} from "@/lib/services/import/core/download";
import {
DEFAULT_FURNI_ICON_DIR,
DEFAULT_FURNI_NITRO_DIR,
@@ -28,14 +11,32 @@ import {
getFurniAssetDirs,
getFurniAssetWriteTargets,
} from "@/lib/services/furni-asset-dirs";
import { downloadFile } from "@/lib/services/import/core/download";
import type { ConversionResult } from "@/lib/services/swf-to-nitro";
import {
appendFurniEntry,
buildFurniEntry,
removeFurniEntry,
} from "@/lib/services/furni-data";
import {
lookupOfficialHabboFurni,
type OfficialHabboFurniEntry,
} from "@/lib/services/habbo-furnidata-cache";
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
import {
downloadFile,
validatePngBytes,
validateSwfBytes,
} from "@/lib/services/import/core/download";
import {
type ConversionResult,
convertSwfToNitro,
extractIconFromSwf,
} from "@/lib/services/swf-to-nitro";
import type { ImportSingleResult } from "@/types/furni";
// Re-export the download helpers now owned by the shared import core.
// Existing furni callers keep importing them from here.
export { downloadFile, validatePngBytes, validateSwfBytes };
// ── Constants ────────────────────────────────────────────────────────
// turbopackIgnore hints: this module is reached by App Router routes; without
+1 -3
View File
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from "vitest";
import type { CurrencyDb } from "./send-currency";
import { type CurrencyDb, sendCurrency } from "./send-currency";
vi.mock("@/lib/db", () => ({
db: {},
@@ -9,8 +9,6 @@ vi.mock("@/lib/db", () => ({
vi.mock("@/lib/services/rcon", () => ({}));
import { sendCurrency } from "./send-currency";
const mockDb = {} as CurrencyDb;
describe("sendCurrency", () => {
-1
View File
@@ -1 +0,0 @@
cleanup