Skip to content

Commit 91f3015

Browse files
committed
fix: enforce check for require-await and remove useless async
1 parent ed9a53f commit 91f3015

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"no-var": "error",
4141
"no-param-reassign": "error",
4242
"prefer-const": "error",
43+
"require-await": "error",
4344
"sort-imports": "off",
4445
"camelcase": "off",
4546
"import/named": "off",

components/composite/StepPayment/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ export const StepPayment: React.FC = () => {
112112

113113
const { isGuest, isPaymentRequired, setPayment } = appCtx
114114

115-
const selectPayment: THandleClick = async ({ payment, paymentSource }) => {
115+
const selectPayment: THandleClick = ({ payment, paymentSource }) => {
116116
if (paymentSource?.payment_methods?.paymentMethods?.length > 1) {
117117
setHasMultiplePaymentMethods(true)
118118
}
119119
setPayment({ payment: payment as PaymentMethodType })
120120
}
121121

122-
const autoSelectCallback = async () => {
122+
const autoSelectCallback = () => {
123123
setAutoselected(true)
124124
}
125125

components/data/AppProvider/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function isBillingAddressSameAsShippingAddress({
234234
return true
235235
}
236236

237-
export const fetchOrder = async (cl: CommerceLayerClient, orderId: string) => {
237+
export const fetchOrder = (cl: CommerceLayerClient, orderId: string) => {
238238
return cl.orders.retrieve(orderId, {
239239
fields: {
240240
orders: [

components/data/GTMProvider/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { LINE_ITEMS_SHOPPABLE } from "components/utils/constants"
99
import { DataLayerItemProps, DataLayerProps } from "./typings"
1010

1111
interface GTMProviderData {
12-
fireAddShippingInfo: (order: Order) => Promise<void>
13-
fireAddPaymentInfo: () => Promise<void>
14-
firePurchase: () => Promise<void>
12+
fireAddShippingInfo: (order: Order) => void
13+
fireAddPaymentInfo: () => void
14+
firePurchase: () => void
1515
}
1616

1717
export const GTMContext = createContext<GTMProviderData | null>(null)
@@ -76,7 +76,7 @@ export const GTMProvider: React.FC<GTMProviderProps> = ({
7676
}
7777
}
7878

79-
const fireBeginCheckout = async (order: Order) => {
79+
const fireBeginCheckout = (order: Order) => {
8080
const lineItems = order.line_items?.filter((line_item) => {
8181
return LINE_ITEMS_SHOPPABLE.includes(line_item.item_type as TypeAccepted)
8282
})
@@ -92,10 +92,10 @@ export const GTMProvider: React.FC<GTMProviderProps> = ({
9292
})
9393
}
9494

95-
const fireAddShippingInfo = async (order: Order) => {
95+
const fireAddShippingInfo = (order: Order) => {
9696
const shipments = order?.shipments
9797

98-
shipments?.forEach(async (shipment) => {
98+
shipments?.forEach((shipment) => {
9999
const lineItems = shipment.stock_line_items?.map(
100100
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
101101
// @ts-ignore
@@ -115,7 +115,7 @@ export const GTMProvider: React.FC<GTMProviderProps> = ({
115115
})
116116
}
117117

118-
const fireAddPaymentInfo = async () => {
118+
const fireAddPaymentInfo = () => {
119119
const lineItems = order?.line_items?.filter((line_item) => {
120120
return LINE_ITEMS_SHOPPABLE.includes(line_item.item_type as TypeAccepted)
121121
})
@@ -134,7 +134,7 @@ export const GTMProvider: React.FC<GTMProviderProps> = ({
134134
})
135135
}
136136

137-
const firePurchase = async () => {
137+
const firePurchase = () => {
138138
const lineItems = order?.line_items?.filter((line_item) => {
139139
return LINE_ITEMS_SHOPPABLE.includes(line_item.item_type as TypeAccepted)
140140
})

0 commit comments

Comments
 (0)