Skip to content

Commit 0361d1b

Browse files
committed
W-21354832: fixing lint errors
1 parent 3b1c308 commit 0361d1b

File tree

19 files changed

+42
-27
lines changed

19 files changed

+42
-27
lines changed

packages/commerce-sdk-react/src/hooks/ShopperBaskets/cache.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
* SPDX-License-Identifier: BSD-3-Clause
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import {
8-
ShopperBasketsTypes,
9-
ShopperCustomers,
10-
ShopperCustomersTypes
11-
} from 'commerce-sdk-isomorphic'
7+
import {ShopperBasketsTypes, ShopperCustomers, ShopperCustomersTypes} from 'commerce-sdk-isomorphic'
128
import {
139
ApiClients,
1410
Argument,

packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/cache.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
* SPDX-License-Identifier: BSD-3-Clause
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import {ShopperBasketsV2Types, ShopperCustomers, ShopperCustomersTypes} from 'commerce-sdk-isomorphic'
7+
import {
8+
ShopperBasketsV2Types,
9+
ShopperCustomers,
10+
ShopperCustomersTypes
11+
} from 'commerce-sdk-isomorphic'
812
import {
913
ApiClients,
1014
Argument,

packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/query.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export const useBasket = (
4040
// Parameters can be set in `apiOptions` or `client.clientConfig`;
4141
// we must merge them in order to generate the correct query key.
4242
const netOptions = omitNullableParameters(mergeOptions(client, apiOptions))
43-
const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName])
43+
const parameters = pickValidParams(
44+
netOptions.parameters,
45+
ShopperBasketsV2.paramKeys[methodName]
46+
)
4447
const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters)
4548
// We don't use `netOptions` here because we manipulate the options in `useQuery`.
4649
const method = async (options: Options) => await client[methodName](options)
@@ -82,7 +85,10 @@ export const usePaymentMethodsForBasket = (
8285
// Parameters can be set in `apiOptions` or `client.clientConfig`;
8386
// we must merge them in order to generate the correct query key.
8487
const netOptions = omitNullableParameters(mergeOptions(client, apiOptions))
85-
const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName])
88+
const parameters = pickValidParams(
89+
netOptions.parameters,
90+
ShopperBasketsV2.paramKeys[methodName]
91+
)
8692
const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters)
8793
// We don't use `netOptions` here because we manipulate the options in `useQuery`.
8894
const method = async (options: Options) => await client[methodName](options)
@@ -124,7 +130,10 @@ export const usePriceBooksForBasket = (
124130
// Parameters can be set in `apiOptions` or `client.clientConfig`;
125131
// we must merge them in order to generate the correct query key.
126132
const netOptions = omitNullableParameters(mergeOptions(client, apiOptions))
127-
const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName])
133+
const parameters = pickValidParams(
134+
netOptions.parameters,
135+
ShopperBasketsV2.paramKeys[methodName]
136+
)
128137
const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters)
129138
// We don't use `netOptions` here because we manipulate the options in `useQuery`.
130139
const method = async (options: Options) => await client[methodName](options)
@@ -166,7 +175,10 @@ export const useShippingMethodsForShipment = (
166175
// Parameters can be set in `apiOptions` or `client.clientConfig`;
167176
// we must merge them in order to generate the correct query key.
168177
const netOptions = omitNullableParameters(mergeOptions(client, apiOptions))
169-
const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName])
178+
const parameters = pickValidParams(
179+
netOptions.parameters,
180+
ShopperBasketsV2.paramKeys[methodName]
181+
)
170182
const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters)
171183
// We don't use `netOptions` here because we manipulate the options in `useQuery`.
172184
const method = async (options: Options) => await client[methodName](options)
@@ -208,7 +220,10 @@ export const useTaxesFromBasket = (
208220
// Parameters can be set in `apiOptions` or `client.clientConfig`;
209221
// we must merge them in order to generate the correct query key.
210222
const netOptions = omitNullableParameters(mergeOptions(client, apiOptions))
211-
const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName])
223+
const parameters = pickValidParams(
224+
netOptions.parameters,
225+
ShopperBasketsV2.paramKeys[methodName]
226+
)
212227
const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters)
213228
// We don't use `netOptions` here because we manipulate the options in `useQuery`.
214229
const method = async (options: Options) => await client[methodName](options)

packages/commerce-sdk-react/src/hooks/ShopperCustomers/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Shopper Customers hooks', () => {
1919
expect(unimplemented).toEqual([
2020
'getExternalProfile', // TODO: Implement when the endpoint exits closed beta
2121
'getPublicProductListItems', // TODO: Implement when the endpoint exits closed beta
22-
'registerExternalProfile', // TODO: Implement when the endpoint exits closed beta
22+
'registerExternalProfile' // TODO: Implement when the endpoint exits closed beta
2323
])
2424
})
2525
test('all mutations have cache update logic', () => {

packages/commerce-sdk-react/src/hooks/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export {
1414
useTaxesFromBasket as useTaxesFromBasketV2,
1515
ShopperBasketsMutations as ShopperBasketsV2Mutations,
1616
useShopperBasketsMutation as useShopperBasketsV2Mutation,
17-
useShopperBasketsMutationHelper as useShopperBasketsV2MutationHelper,
17+
useShopperBasketsMutationHelper as useShopperBasketsV2MutationHelper
1818
} from './ShopperBasketsV2'
1919
// Only needed if consumers want to type-annotate variables with it.
20-
export type { ShopperBasketsMutation as ShopperBasketsV2Mutation } from './ShopperBasketsV2'
20+
export type {ShopperBasketsMutation as ShopperBasketsV2Mutation} from './ShopperBasketsV2'
2121

2222
export * from './ShopperContexts'
2323
export * from './ShopperCustomers'

packages/commerce-sdk-react/src/hooks/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import {InvalidateQueryFilters, QueryFilters, Updater, UseQueryOptions} from '@tanstack/react-query'
88
import {
99
ShopperBaskets,
10-
ShopperBasketsV2,
1110
ShopperConfigurations,
1211
ShopperContexts,
1312
ShopperCustomers,

packages/template-retail-react-app/app/components/passwordless-login/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const PasswordlessLogin = ({
2020
handlePasswordlessLoginClick,
2121
isSocialEnabled = false,
2222
idps = [],
23+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2324
setLoginType: _setLoginType = noop
2425
}) => {
2526
const [showPasswordView, setShowPasswordView] = useState(false)

packages/template-retail-react-app/app/components/sf-payments-express-buttons/index.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ jest.mock('@salesforce/commerce-sdk-react', () => {
160160
...actual,
161161
useShopperBasketsMutation: mockUseShopperBasketsMutation,
162162
useShopperBasketsV2Mutation: mockUseShopperBasketsMutation,
163-
useShippingMethodsForShipment: (params, options) => {
163+
useShippingMethodsForShipment: () => {
164164
if (mockValidateTestMocks && mockValidateTestMocks.refetchShippingMethods) {
165165
return {refetch: mockValidateTestMocks.refetchShippingMethods}
166166
}
167167
return {
168168
refetch: jest.fn().mockResolvedValue({data: {applicableShippingMethods: []}})
169169
}
170170
},
171-
useShippingMethodsForShipmentV2: (params, options) => {
171+
useShippingMethodsForShipmentV2: () => {
172172
if (mockValidateTestMocks && mockValidateTestMocks.refetchShippingMethods) {
173173
return {refetch: mockValidateTestMocks.refetchShippingMethods}
174174
}

packages/template-retail-react-app/app/components/shopper-agent/index.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
import React, {useEffect} from 'react'
8-
import {useLocation} from 'react-router-dom'
98
import useScript from '@salesforce/retail-react-app/app/hooks/use-script'
109
import {useUsid} from '@salesforce/commerce-sdk-react'
1110
import PropTypes from 'prop-types'
@@ -157,7 +156,7 @@ const ShopperAgentWindow = ({commerceAgentConfiguration, domainUrl}) => {
157156
const theme = useTheme()
158157

159158
// Multi-site hook for locale and currency information
160-
const {locale, buildUrl} = useMultiSite()
159+
const {locale} = useMultiSite()
161160

162161
// Authentication hook for refresh token
163162
const refreshToken = useRefreshToken()

packages/template-retail-react-app/app/hooks/use-auth-modal.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ test('Renders login modal by default', async () => {
140140

141141
// TODO: Skipping this test because our jest version seems to too old and is run into issues with react-hooks-form
142142
// when trying to run jest.spyOn on useForm hook. Need to bump version for jest.
143+
/* eslint-disable jest/no-disabled-tests */
143144
test.skip('Renders check email modal on email mode', async () => {
144145
// Store the original useForm function
145146
const originalUseForm = ReactHookForm.useForm
@@ -171,6 +172,7 @@ test.skip('Renders check email modal on email mode', async () => {
171172
})
172173
mockUseForm.mockRestore()
173174
})
175+
/* eslint-enable jest/no-disabled-tests */
174176

175177
test('allows regular login via Enter key in password mode', async () => {
176178
const {user} = renderWithProviders(<MockedComponent isPasswordlessEnabled={true} />)

0 commit comments

Comments
 (0)