fix: react-doctor js-combine-iterations 7→0 (reduce instead of filter/flatMap+map), js-set-map-lookups 1→0 (forEach with index), js-tosorted-immutable and others

This commit is contained in:
Nora
2026-06-26 06:12:04 -06:00
parent d6d6a366e3
commit adce211480
8 changed files with 45 additions and 38 deletions
@@ -42,15 +42,15 @@ type ShippingFulfillmentPanelProps = {
canManageOrders: boolean;
};
const SHIPPING_STATUSES = [
const SHIPPING_STATUSES: Array<{ value: ShippingStatus; label: string }> = [
{ value: "pending", label: "Pending" },
{ value: "label_created", label: "Label Created" },
{ value: "shipped", label: "Shipped" },
{ value: "delivered", label: "Delivered" },
{ value: "returned", label: "Returned" },
] as const;
];
type ShippingStatus = (typeof SHIPPING_STATUSES)[number]["value"];
type ShippingStatus = "pending" | "label_created" | "shipped" | "delivered" | "returned";
const SERVICE_LABELS: Record<FedExServiceType, string> = {
FEDEX_OVERNIGHT: "FedEx Overnight",
@@ -526,9 +526,10 @@ function OrderCard({
/>
)}
{SHIPPING_STATUSES.flatMap((s) =>
s.value !== order.shipping_status && s.value !== "label_created" ? [s] : []
).map((s) => {
{SHIPPING_STATUSES.reduce<typeof SHIPPING_STATUSES>((acc, s) => {
if (s.value !== order.shipping_status && s.value !== "label_created") acc.push(s);
return acc;
}, []).map((s) => {
const isDanger = s.value === "returned";
return (
<AdminButton
@@ -758,9 +758,10 @@ export default function LotDetailPanel({
className="w-full rounded-xl border border-[var(--admin-border)] bg-[var(--admin-bg-subtle)]/50 px-3 py-3 text-sm text-[var(--admin-text-primary)] outline-none focus:border-[var(--admin-accent)] focus:ring-2 focus:ring-[var(--admin-accent)]/20 transition-all"
>
<option value="">Select status...</option>
{STATUS_FLOW.flatMap((s) =>
s !== lot.status ? [s] : []
).map((s) => {
{STATUS_FLOW.reduce<typeof STATUS_FLOW>((acc, s) => {
if (s !== lot.status) acc.push(s);
return acc;
}, []).map((s) => {
const c = EVENT_CONFIG[s];
return (
<option key={s} value={s}>