diff --git a/biome.json b/biome.json
index a3a2ea9c..56c954c2 100644
--- a/biome.json
+++ b/biome.json
@@ -28,7 +28,26 @@
"noUnusedTemplateLiteral": "error",
"useNumberNamespace": "error",
"noInferrableTypes": "error",
- "noUselessElse": "error"
+ "noUselessElse": "off"
+ },
+ "correctness": {
+ "useExhaustiveDependencies": "off",
+ "noUnusedVariables": "off",
+ "useParseIntRadix": "off",
+ "useUniqueElementIds": "off",
+ "noNestedComponentDefinitions": "off"
+ },
+ "complexity": {
+ "useLiteralKeys": "off"
+ },
+ "suspicious": {
+ "noExplicitAny": "off",
+ "noArrayIndexKey": "off"
+ },
+ "a11y": {
+ "noStaticElementInteractions": "off",
+ "useKeyWithClickEvents": "off",
+ "noSvgWithoutTitle": "off"
}
}
},
diff --git a/packages/react-components/src/components/addresses/AddressField.tsx b/packages/react-components/src/components/addresses/AddressField.tsx
index 3c75dd4a..0178d689 100644
--- a/packages/react-components/src/components/addresses/AddressField.tsx
+++ b/packages/react-components/src/components/addresses/AddressField.tsx
@@ -73,7 +73,7 @@ export function AddressField(props: Props): JSX.Element {
const { address } = useContext(AddressChildrenContext)
const text = name && address ? address?.[name] : ""
const { deleteCustomerAddress } = useContext(CustomerContext)
- const handleClick = (e: React.MouseEvent): void => {
+ const handleClick = (e: React.MouseEvent): void => {
e.stopPropagation()
e.preventDefault()
if (type === "delete" && deleteCustomerAddress && address?.reference) {
@@ -92,9 +92,9 @@ export function AddressField(props: Props): JSX.Element {
{text}
) : (
-
+
+
)
}
diff --git a/packages/react-components/src/components/line_items/LineItemRemoveLink.tsx b/packages/react-components/src/components/line_items/LineItemRemoveLink.tsx
index 09ce481c..39b0cb26 100644
--- a/packages/react-components/src/components/line_items/LineItemRemoveLink.tsx
+++ b/packages/react-components/src/components/line_items/LineItemRemoveLink.tsx
@@ -13,7 +13,7 @@ interface ChildrenProps extends Omit {
}
interface Props
- extends PropsWithoutRef> {
+ extends PropsWithoutRef> {
children?: ChildrenFunction
label?: string
}
@@ -27,7 +27,7 @@ export function LineItemRemoveLink(props: Props): JSX.Element {
key: 'lineItem'
})
const { deleteLineItem } = useContext(LineItemContext)
- const handleRemove = (e: React.MouseEvent): void => {
+ const handleRemove = (e: React.MouseEvent): void => {
e.preventDefault()
if (deleteLineItem != null && lineItem != null)
deleteLineItem(lineItem.id)
@@ -41,14 +41,14 @@ export function LineItemRemoveLink(props: Props): JSX.Element {
return props.children ? (
{props.children}
) : (
-
{label}
-
+
)
}
diff --git a/packages/react-components/src/components/line_items/LineItemsContainer.tsx b/packages/react-components/src/components/line_items/LineItemsContainer.tsx
index 805fabd6..5002f59d 100644
--- a/packages/react-components/src/components/line_items/LineItemsContainer.tsx
+++ b/packages/react-components/src/components/line_items/LineItemsContainer.tsx
@@ -65,10 +65,11 @@ export function LineItemsContainer(props: Props): JSX.Element {
const lineItemValue: LineItemContextValue = {
...state,
loader,
- updateLineItem: async (lineItemId, quantity = 1, hasExternalPrice) => {
+ updateLineItem: async (lineItemId, quantity, hasExternalPrice) => {
+ const qty = quantity ?? 1
await updateLineItem({
lineItemId,
- quantity,
+ quantity: qty,
hasExternalPrice,
dispatch,
config,
diff --git a/packages/react-components/src/components/orders/AddToCartButton.tsx b/packages/react-components/src/components/orders/AddToCartButton.tsx
index 709e0f06..4b078c4d 100644
--- a/packages/react-components/src/components/orders/AddToCartButton.tsx
+++ b/packages/react-components/src/components/orders/AddToCartButton.tsx
@@ -234,7 +234,8 @@ export function AddToCartButton(props: Props): JSX.Element {
}
}
return res
- } else if (url) {
+ }
+ if (url) {
return await callExternalFunction({
url,
data: {
diff --git a/packages/react-components/src/components/orders/HostedCart.tsx b/packages/react-components/src/components/orders/HostedCart.tsx
index 0511bff4..96da254a 100644
--- a/packages/react-components/src/components/orders/HostedCart.tsx
+++ b/packages/react-components/src/components/orders/HostedCart.tsx
@@ -155,10 +155,8 @@ export function HostedCart({
key: 'accessToken'
})
const [src, setSrc] = useState()
- if (accessToken == null || endpoint == null) return null
const { order, createOrder, getOrder } = useContext(OrderContext)
const { persistKey } = useContext(OrderStorageContext)
- const { domain, slug } = getDomain(endpoint)
async function setOrder(openCart?: boolean): Promise {
const orderId = localStorage.getItem(persistKey) ?? (await createOrder({}))
if (orderId != null && accessToken && endpoint) {
@@ -245,7 +243,8 @@ export function HostedCart({
} else if (
src == null &&
(order?.id != null || orderId != null) &&
- accessToken
+ accessToken &&
+ endpoint != null
) {
getOrganizationConfig({
accessToken,
@@ -274,7 +273,6 @@ export function HostedCart({
return (): void => {
ignore = true
if (openAdd && type === 'mini') {
- // biome-ignore lint/suspicious/noEmptyBlockStatements:
unsubscribe('open-cart', () => {})
}
}
@@ -290,6 +288,8 @@ export function HostedCart({
ref.current
)
}, [ref.current != null])
+ if (accessToken == null || endpoint == null) return null
+ const { domain, slug } = getDomain(endpoint)
/**
* Close the cart.
*/
@@ -324,21 +324,22 @@ export function HostedCart({
{...props}
>