Skip to content

Commit 8bae761

Browse files
feat(): SMX-242 - migrate to ESLint 9 flat config
1 parent eab0b9b commit 8bae761

File tree

78 files changed

+2956
-1017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2956
-1017
lines changed

core/.eslintrc.cjs

Lines changed: 0 additions & 69 deletions
This file was deleted.

core/app/[locale]/(default)/(faceted)/_components/facets.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ export const Facets = ({ facets, pageType }: Props) => {
6060
const sortParam = searchParams.get('sort');
6161
const searchParam = searchParams.get('term');
6262
const filteredSearchParams = Array.from(formData.entries())
63-
.filter((entry): entry is [string, string] => {
64-
return !(entry instanceof File);
65-
})
63+
.filter((entry): entry is [string, string] => !(entry instanceof File))
6664
.filter(([, value]) => value !== '');
6765

6866
const newSearchParams = new URLSearchParams(filteredSearchParams);

core/app/[locale]/(default)/(faceted)/_components/refine-by.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,11 @@ const mapFacetsToRefinements = ({ facets, pageType }: Props) =>
6262
case 'ProductAttributeSearchFilter':
6363
return facet.attributes
6464
.filter(({ isSelected }) => isSelected)
65-
.map<FacetProps<string>>(({ value }) => {
66-
return {
67-
key: `attr_${facet.filterName}`,
68-
display_name: value,
69-
value,
70-
};
71-
});
65+
.map<FacetProps<string>>(({ value }) => ({
66+
key: `attr_${facet.filterName}`,
67+
display_name: value,
68+
value,
69+
}));
7270

7371
case 'OtherSearchFilter': {
7472
const { freeShipping, isFeatured, isInStock } = facet;

core/app/[locale]/(default)/(faceted)/brand/[slug]/static/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ const getBrands = cache(async (variables: Variables = {}) => {
4343
export async function generateStaticParams() {
4444
const brands = await getBrands();
4545

46-
return locales.map((locale) => {
47-
return brands.map((brand) => ({
46+
return locales.map((locale) =>
47+
brands.map((brand) => ({
4848
locale,
4949
slug: brand.entityId.toString(),
50-
}));
51-
});
50+
})),
51+
);
5252
}
5353

5454
export const dynamic = 'force-static';

core/app/[locale]/(default)/(faceted)/category/[slug]/_components/sub-categories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface Props {
3333
export function SubCategories({ categoryTree }: Props) {
3434
const t = useTranslations('FacetedGroup.MobileSideNav');
3535

36-
if (!categoryTree[0]?.children?.length) {
36+
if (!categoryTree[0].children?.length) {
3737
return null;
3838
}
3939

core/app/[locale]/(default)/(faceted)/category/[slug]/static/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ export async function generateStaticParams() {
5252

5353
const entityIds = getEntityIdsOfChildren(categories);
5454

55-
return locales.map((locale) => {
56-
return entityIds.map((entityId) => ({
55+
return locales.map((locale) =>
56+
entityIds.map((entityId) => ({
5757
locale,
5858
slug: entityId.toString(),
59-
}));
60-
});
59+
})),
60+
);
6161
}
6262

6363
export const dynamic = 'force-static';

core/app/[locale]/(default)/(faceted)/fetch-faceted-search.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ export const PublicSearchParamsSchema = z.object({
320320
term: z.string().optional(),
321321
});
322322

323-
const AttributeKey = z.custom<`attr_${string}`>((val) => {
324-
return typeof val === 'string' ? /^attr_\w+$/.test(val) : false;
325-
});
323+
const AttributeKey = z.custom<`attr_${string}`>((val) =>
324+
typeof val === 'string' ? /^attr_\w+$/.test(val) : false,
325+
);
326326

327327
const PublicToPrivateParams = PublicSearchParamsSchema.catchall(SearchParamToArray)
328328
.transform((publicParams) => {

core/app/[locale]/(default)/account/addresses/add/_components/add-address-form.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,12 @@ export const AddAddressForm = ({ addressFields, countries, defaultCountry }: Add
276276
<PicklistOrText
277277
defaultValue={
278278
fieldId === FieldNameToFieldId.stateOrProvince
279-
? countryStates[0]?.name
279+
? countryStates[0].name
280280
: undefined
281281
}
282282
field={field}
283283
name={fieldName}
284-
options={countryStates.map(({ name }) => {
285-
return { entityId: name, label: name };
286-
})}
284+
options={countryStates.map(({ name }) => ({ entityId: name, label: name }))}
287285
/>
288286
</FieldWrapper>
289287
);

core/app/[locale]/(default)/account/order/[slug]/_components/order-details.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -261,20 +261,18 @@ export const OrderDetails = async ({ data }: { data: OrderDataType }) => {
261261
/>
262262
)}
263263
<ul className="my-4 flex flex-col gap-4">
264-
{lineItems.map((shipment) => {
265-
return (
266-
<li key={shipment.entityId}>
267-
<Suspense fallback={<ProductSnippetSkeleton isExtended={true} />}>
268-
<ProductSnippet
269-
imagePriority={true}
270-
imageSize="square"
271-
isExtended={true}
272-
product={assembleProductData(shipment)}
273-
/>
274-
</Suspense>
275-
</li>
276-
);
277-
})}
264+
{lineItems.map((shipment) => (
265+
<li key={shipment.entityId}>
266+
<Suspense fallback={<ProductSnippetSkeleton isExtended={true} />}>
267+
<ProductSnippet
268+
imagePriority={true}
269+
imageSize="square"
270+
isExtended={true}
271+
product={assembleProductData(shipment)}
272+
/>
273+
</Suspense>
274+
</li>
275+
))}
278276
</ul>
279277
</div>
280278
);

core/app/[locale]/(default)/account/orders/_components/orders-list.tsx

Lines changed: 70 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -158,85 +158,81 @@ const OrderDetails = async ({
158158
);
159159
};
160160

161-
export const OrdersList = ({ customerOrders }: OrdersListProps) => {
162-
return (
163-
<ul className="flex w-full flex-col">
164-
{customerOrders.map(({ entityId, orderedAt, status, totalIncTax, consignments }) => {
165-
const shippingConsignments = consignments.shipping
166-
? consignments.shipping.map(({ lineItems, shipments }) => ({
167-
lineItems: removeEdgesAndNodes(lineItems),
168-
shipments: removeEdgesAndNodes(shipments),
169-
}))
170-
: undefined;
171-
// NOTE: tracking url will be supported later
172-
const trackingUrl = shippingConsignments
173-
? shippingConsignments
174-
.flatMap(({ shipments }) =>
175-
shipments.map((shipment) => {
176-
if (
177-
shipment.tracking?.__typename === 'OrderShipmentNumberAndUrlTracking' ||
178-
shipment.tracking?.__typename === 'OrderShipmentUrlOnlyTracking'
179-
) {
180-
return shipment.tracking.url;
181-
}
161+
export const OrdersList = ({ customerOrders }: OrdersListProps) => (
162+
<ul className="flex w-full flex-col">
163+
{customerOrders.map(({ entityId, orderedAt, status, totalIncTax, consignments }) => {
164+
const shippingConsignments = consignments.shipping
165+
? consignments.shipping.map(({ lineItems, shipments }) => ({
166+
lineItems: removeEdgesAndNodes(lineItems),
167+
shipments: removeEdgesAndNodes(shipments),
168+
}))
169+
: undefined;
170+
// NOTE: tracking url will be supported later
171+
const trackingUrl = shippingConsignments
172+
? shippingConsignments
173+
.flatMap(({ shipments }) =>
174+
shipments.map((shipment) => {
175+
if (
176+
shipment.tracking?.__typename === 'OrderShipmentNumberAndUrlTracking' ||
177+
shipment.tracking?.__typename === 'OrderShipmentUrlOnlyTracking'
178+
) {
179+
return shipment.tracking.url;
180+
}
182181

183-
return null;
184-
}),
185-
)
186-
.find((url) => url !== null)
187-
: undefined;
182+
return null;
183+
}),
184+
)
185+
.find((url) => url !== null)
186+
: undefined;
188187

189-
return (
190-
<li
191-
className="inline-flex border-collapse flex-col gap-y-6 border-t border-gray-200 py-6 last:border-b"
192-
key={entityId}
193-
>
194-
<OrderDetails
195-
orderDate={orderedAt.utc}
196-
orderId={entityId}
197-
orderPrice={totalIncTax}
198-
orderStatus={status.label}
188+
return (
189+
<li
190+
className="inline-flex border-collapse flex-col gap-y-6 border-t border-gray-200 py-6 last:border-b"
191+
key={entityId}
192+
>
193+
<OrderDetails
194+
orderDate={orderedAt.utc}
195+
orderId={entityId}
196+
orderPrice={totalIncTax}
197+
orderStatus={status.label}
198+
/>
199+
<div className="flex gap-4">
200+
<ul className="inline-flex gap-4 [&>*:nth-child(n+2)]:hidden md:[&>*:nth-child(n+2)]:list-item md:[&>*:nth-child(n+4)]:hidden lg:[&>*:nth-child(n+4)]:list-item lg:[&>*:nth-child(n+5)]:hidden xl:[&>*:nth-child(n+5)]:list-item lg:[&>*:nth-child(n+7)]:hidden">
201+
{(shippingConsignments ?? []).map(({ lineItems }) =>
202+
lineItems.slice(0, VisibleListItemsPerDevice.xl).map((shippedProduct) => (
203+
<li className="w-36" key={shippedProduct.entityId}>
204+
<Suspense fallback={<ProductSnippetSkeleton />}>
205+
<ProductSnippet
206+
imagePriority={true}
207+
imageSize="square"
208+
product={assembleProductData({ ...shippedProduct, productOptions: [] })}
209+
/>
210+
</Suspense>
211+
</li>
212+
)),
213+
)}
214+
</ul>
215+
<TruncatedCard
216+
itemsQuantity={(shippingConsignments ?? []).reduce(
217+
(orderItems, shipment) => orderItems + shipment.lineItems.length,
218+
0,
219+
)}
199220
/>
200-
<div className="flex gap-4">
201-
<ul className="inline-flex gap-4 [&>*:nth-child(n+2)]:hidden md:[&>*:nth-child(n+2)]:list-item md:[&>*:nth-child(n+4)]:hidden lg:[&>*:nth-child(n+4)]:list-item lg:[&>*:nth-child(n+5)]:hidden xl:[&>*:nth-child(n+5)]:list-item lg:[&>*:nth-child(n+7)]:hidden">
202-
{(shippingConsignments ?? []).map(({ lineItems }) => {
203-
return lineItems.slice(0, VisibleListItemsPerDevice.xl).map((shippedProduct) => {
204-
return (
205-
<li className="w-36" key={shippedProduct.entityId}>
206-
<Suspense fallback={<ProductSnippetSkeleton />}>
207-
<ProductSnippet
208-
imagePriority={true}
209-
imageSize="square"
210-
product={assembleProductData({ ...shippedProduct, productOptions: [] })}
211-
/>
212-
</Suspense>
213-
</li>
214-
);
215-
});
216-
})}
217-
</ul>
218-
<TruncatedCard
219-
itemsQuantity={(shippingConsignments ?? []).reduce(
220-
(orderItems, shipment) => orderItems + shipment.lineItems.length,
221-
0,
222-
)}
223-
/>
224-
<ManageOrderButtons
225-
className="hidden lg:ms-auto lg:inline-flex lg:flex-col lg:gap-2"
226-
orderId={entityId}
227-
orderStatus={status.value}
228-
orderTrackingUrl={trackingUrl}
229-
/>
230-
</div>
231221
<ManageOrderButtons
232-
className="inline-flex flex-col gap-2 md:flex-row lg:hidden"
222+
className="hidden lg:ms-auto lg:inline-flex lg:flex-col lg:gap-2"
233223
orderId={entityId}
234224
orderStatus={status.value}
235225
orderTrackingUrl={trackingUrl}
236226
/>
237-
</li>
238-
);
239-
})}
240-
</ul>
241-
);
242-
};
227+
</div>
228+
<ManageOrderButtons
229+
className="inline-flex flex-col gap-2 md:flex-row lg:hidden"
230+
orderId={entityId}
231+
orderStatus={status.value}
232+
orderTrackingUrl={trackingUrl}
233+
/>
234+
</li>
235+
);
236+
})}
237+
</ul>
238+
);

0 commit comments

Comments
 (0)