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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user