diff --git a/packages/commerce-sdk-react/src/hooks/ShopperBaskets/cache.ts b/packages/commerce-sdk-react/src/hooks/ShopperBaskets/cache.ts index e6ece1907d..b727ac13bb 100644 --- a/packages/commerce-sdk-react/src/hooks/ShopperBaskets/cache.ts +++ b/packages/commerce-sdk-react/src/hooks/ShopperBaskets/cache.ts @@ -4,11 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { - ShopperBasketsTypes, - ShopperCustomers, - ShopperCustomersTypes -} from 'commerce-sdk-isomorphic' +import {ShopperBasketsTypes, ShopperCustomers, ShopperCustomersTypes} from 'commerce-sdk-isomorphic' import { ApiClients, Argument, diff --git a/packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/cache.ts b/packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/cache.ts index 9ba60a6164..b93b2eec07 100644 --- a/packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/cache.ts +++ b/packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/cache.ts @@ -4,7 +4,11 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import {ShopperBasketsV2Types, ShopperCustomers, ShopperCustomersTypes} from 'commerce-sdk-isomorphic' +import { + ShopperBasketsV2Types, + ShopperCustomers, + ShopperCustomersTypes +} from 'commerce-sdk-isomorphic' import { ApiClients, Argument, diff --git a/packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/query.ts b/packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/query.ts index ad41bf8dc9..88dfa965c5 100644 --- a/packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/query.ts +++ b/packages/commerce-sdk-react/src/hooks/ShopperBasketsV2/query.ts @@ -40,7 +40,10 @@ export const useBasket = ( // Parameters can be set in `apiOptions` or `client.clientConfig`; // we must merge them in order to generate the correct query key. const netOptions = omitNullableParameters(mergeOptions(client, apiOptions)) - const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName]) + const parameters = pickValidParams( + netOptions.parameters, + ShopperBasketsV2.paramKeys[methodName] + ) const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters) // We don't use `netOptions` here because we manipulate the options in `useQuery`. const method = async (options: Options) => await client[methodName](options) @@ -82,7 +85,10 @@ export const usePaymentMethodsForBasket = ( // Parameters can be set in `apiOptions` or `client.clientConfig`; // we must merge them in order to generate the correct query key. const netOptions = omitNullableParameters(mergeOptions(client, apiOptions)) - const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName]) + const parameters = pickValidParams( + netOptions.parameters, + ShopperBasketsV2.paramKeys[methodName] + ) const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters) // We don't use `netOptions` here because we manipulate the options in `useQuery`. const method = async (options: Options) => await client[methodName](options) @@ -124,7 +130,10 @@ export const usePriceBooksForBasket = ( // Parameters can be set in `apiOptions` or `client.clientConfig`; // we must merge them in order to generate the correct query key. const netOptions = omitNullableParameters(mergeOptions(client, apiOptions)) - const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName]) + const parameters = pickValidParams( + netOptions.parameters, + ShopperBasketsV2.paramKeys[methodName] + ) const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters) // We don't use `netOptions` here because we manipulate the options in `useQuery`. const method = async (options: Options) => await client[methodName](options) @@ -166,7 +175,10 @@ export const useShippingMethodsForShipment = ( // Parameters can be set in `apiOptions` or `client.clientConfig`; // we must merge them in order to generate the correct query key. const netOptions = omitNullableParameters(mergeOptions(client, apiOptions)) - const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName]) + const parameters = pickValidParams( + netOptions.parameters, + ShopperBasketsV2.paramKeys[methodName] + ) const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters) // We don't use `netOptions` here because we manipulate the options in `useQuery`. const method = async (options: Options) => await client[methodName](options) @@ -208,7 +220,10 @@ export const useTaxesFromBasket = ( // Parameters can be set in `apiOptions` or `client.clientConfig`; // we must merge them in order to generate the correct query key. const netOptions = omitNullableParameters(mergeOptions(client, apiOptions)) - const parameters = pickValidParams(netOptions.parameters, ShopperBasketsV2.paramKeys[methodName]) + const parameters = pickValidParams( + netOptions.parameters, + ShopperBasketsV2.paramKeys[methodName] + ) const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters) // We don't use `netOptions` here because we manipulate the options in `useQuery`. const method = async (options: Options) => await client[methodName](options) diff --git a/packages/commerce-sdk-react/src/hooks/ShopperCustomers/index.test.ts b/packages/commerce-sdk-react/src/hooks/ShopperCustomers/index.test.ts index 3796ed0d37..bb0dab1103 100644 --- a/packages/commerce-sdk-react/src/hooks/ShopperCustomers/index.test.ts +++ b/packages/commerce-sdk-react/src/hooks/ShopperCustomers/index.test.ts @@ -19,7 +19,7 @@ describe('Shopper Customers hooks', () => { expect(unimplemented).toEqual([ 'getExternalProfile', // TODO: Implement when the endpoint exits closed beta 'getPublicProductListItems', // TODO: Implement when the endpoint exits closed beta - 'registerExternalProfile', // TODO: Implement when the endpoint exits closed beta + 'registerExternalProfile' // TODO: Implement when the endpoint exits closed beta ]) }) test('all mutations have cache update logic', () => { diff --git a/packages/commerce-sdk-react/src/hooks/index.ts b/packages/commerce-sdk-react/src/hooks/index.ts index 96359cec55..f59fdd17c6 100644 --- a/packages/commerce-sdk-react/src/hooks/index.ts +++ b/packages/commerce-sdk-react/src/hooks/index.ts @@ -14,10 +14,10 @@ export { useTaxesFromBasket as useTaxesFromBasketV2, ShopperBasketsMutations as ShopperBasketsV2Mutations, useShopperBasketsMutation as useShopperBasketsV2Mutation, - useShopperBasketsMutationHelper as useShopperBasketsV2MutationHelper, + useShopperBasketsMutationHelper as useShopperBasketsV2MutationHelper } from './ShopperBasketsV2' // Only needed if consumers want to type-annotate variables with it. -export type { ShopperBasketsMutation as ShopperBasketsV2Mutation } from './ShopperBasketsV2' +export type {ShopperBasketsMutation as ShopperBasketsV2Mutation} from './ShopperBasketsV2' export * from './ShopperContexts' export * from './ShopperCustomers' diff --git a/packages/commerce-sdk-react/src/hooks/types.ts b/packages/commerce-sdk-react/src/hooks/types.ts index f567cdceda..04c32b1558 100644 --- a/packages/commerce-sdk-react/src/hooks/types.ts +++ b/packages/commerce-sdk-react/src/hooks/types.ts @@ -7,7 +7,6 @@ import {InvalidateQueryFilters, QueryFilters, Updater, UseQueryOptions} from '@tanstack/react-query' import { ShopperBaskets, - ShopperBasketsV2, ShopperConfigurations, ShopperContexts, ShopperCustomers, diff --git a/packages/template-retail-react-app/app/components/passwordless-login/index.jsx b/packages/template-retail-react-app/app/components/passwordless-login/index.jsx index 32a44efa57..0fa68de240 100644 --- a/packages/template-retail-react-app/app/components/passwordless-login/index.jsx +++ b/packages/template-retail-react-app/app/components/passwordless-login/index.jsx @@ -20,6 +20,7 @@ const PasswordlessLogin = ({ handlePasswordlessLoginClick, isSocialEnabled = false, idps = [], + // eslint-disable-next-line @typescript-eslint/no-unused-vars setLoginType: _setLoginType = noop }) => { const [showPasswordView, setShowPasswordView] = useState(false) diff --git a/packages/template-retail-react-app/app/components/sf-payments-express-buttons/index.test.js b/packages/template-retail-react-app/app/components/sf-payments-express-buttons/index.test.js index 6ee4cef91d..d68a48dec6 100644 --- a/packages/template-retail-react-app/app/components/sf-payments-express-buttons/index.test.js +++ b/packages/template-retail-react-app/app/components/sf-payments-express-buttons/index.test.js @@ -160,7 +160,7 @@ jest.mock('@salesforce/commerce-sdk-react', () => { ...actual, useShopperBasketsMutation: mockUseShopperBasketsMutation, useShopperBasketsV2Mutation: mockUseShopperBasketsMutation, - useShippingMethodsForShipment: (params, options) => { + useShippingMethodsForShipment: () => { if (mockValidateTestMocks && mockValidateTestMocks.refetchShippingMethods) { return {refetch: mockValidateTestMocks.refetchShippingMethods} } @@ -168,7 +168,7 @@ jest.mock('@salesforce/commerce-sdk-react', () => { refetch: jest.fn().mockResolvedValue({data: {applicableShippingMethods: []}}) } }, - useShippingMethodsForShipmentV2: (params, options) => { + useShippingMethodsForShipmentV2: () => { if (mockValidateTestMocks && mockValidateTestMocks.refetchShippingMethods) { return {refetch: mockValidateTestMocks.refetchShippingMethods} } diff --git a/packages/template-retail-react-app/app/components/shopper-agent/index.jsx b/packages/template-retail-react-app/app/components/shopper-agent/index.jsx index 2b7591cbac..d590fde6c9 100644 --- a/packages/template-retail-react-app/app/components/shopper-agent/index.jsx +++ b/packages/template-retail-react-app/app/components/shopper-agent/index.jsx @@ -5,7 +5,6 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import React, {useEffect} from 'react' -import {useLocation} from 'react-router-dom' import useScript from '@salesforce/retail-react-app/app/hooks/use-script' import {useUsid} from '@salesforce/commerce-sdk-react' import PropTypes from 'prop-types' @@ -157,7 +156,7 @@ const ShopperAgentWindow = ({commerceAgentConfiguration, domainUrl}) => { const theme = useTheme() // Multi-site hook for locale and currency information - const {locale, buildUrl} = useMultiSite() + const {locale} = useMultiSite() // Authentication hook for refresh token const refreshToken = useRefreshToken() diff --git a/packages/template-retail-react-app/app/hooks/use-auth-modal.test.js b/packages/template-retail-react-app/app/hooks/use-auth-modal.test.js index 6d94d4554f..7767c3ba65 100644 --- a/packages/template-retail-react-app/app/hooks/use-auth-modal.test.js +++ b/packages/template-retail-react-app/app/hooks/use-auth-modal.test.js @@ -140,6 +140,7 @@ test('Renders login modal by default', async () => { // TODO: Skipping this test because our jest version seems to too old and is run into issues with react-hooks-form // when trying to run jest.spyOn on useForm hook. Need to bump version for jest. +/* eslint-disable jest/no-disabled-tests */ test.skip('Renders check email modal on email mode', async () => { // Store the original useForm function const originalUseForm = ReactHookForm.useForm @@ -171,6 +172,7 @@ test.skip('Renders check email modal on email mode', async () => { }) mockUseForm.mockRestore() }) +/* eslint-enable jest/no-disabled-tests */ test('allows regular login via Enter key in password mode', async () => { const {user} = renderWithProviders() diff --git a/packages/template-retail-react-app/app/hooks/use-miaw.test.js b/packages/template-retail-react-app/app/hooks/use-miaw.test.js index 68ed595640..630b51540b 100644 --- a/packages/template-retail-react-app/app/hooks/use-miaw.test.js +++ b/packages/template-retail-react-app/app/hooks/use-miaw.test.js @@ -5,7 +5,6 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import React from 'react' import {renderHook} from '@testing-library/react' import useMiaw, { normalizeLocaleToSalesforce, diff --git a/packages/template-retail-react-app/app/hooks/use-variation-attributes.js b/packages/template-retail-react-app/app/hooks/use-variation-attributes.js index 62debca30a..ba07815f77 100644 --- a/packages/template-retail-react-app/app/hooks/use-variation-attributes.js +++ b/packages/template-retail-react-app/app/hooks/use-variation-attributes.js @@ -100,6 +100,7 @@ export const useVariationAttributes = ( isProductPartOfSet = false, isProductPartOfBundle = false, controlledVariationValues = null, + // eslint-disable-next-line @typescript-eslint/no-unused-vars onVariationChange = null ) => { const {variationAttributes = []} = product diff --git a/packages/template-retail-react-app/app/pages/cart/index.test.js b/packages/template-retail-react-app/app/pages/cart/index.test.js index 86a72b1833..8a19d6d02f 100644 --- a/packages/template-retail-react-app/app/pages/cart/index.test.js +++ b/packages/template-retail-react-app/app/pages/cart/index.test.js @@ -328,6 +328,7 @@ describe('Rendering tests', function () { }) // TODO: Investigate failures in Orphaned Bonus Products tests and re-enable +// eslint-disable-next-line jest/no-disabled-tests describe.skip('Orphaned Bonus Products', function () { test('renders orphaned bonus products (missing bonusDiscountLineItemId) as regular cart items', async () => { // Create a mock basket with an orphaned bonus product (bonusProductLineItem: true but no bonusDiscountLineItemId) diff --git a/packages/template-retail-react-app/app/pages/cart/partials/select-bonus-products-card.test.jsx b/packages/template-retail-react-app/app/pages/cart/partials/select-bonus-products-card.test.jsx index 97619019ac..55f6b0987b 100644 --- a/packages/template-retail-react-app/app/pages/cart/partials/select-bonus-products-card.test.jsx +++ b/packages/template-retail-react-app/app/pages/cart/partials/select-bonus-products-card.test.jsx @@ -111,6 +111,7 @@ const defaultProps = { // TODO: Fix import resolution issues causing "Element type is invalid" errors in Jest // These tests fail due to absolute import paths not resolving correctly in the test environment // The component imports correctly but dependencies resolve to undefined during render +// eslint-disable-next-line jest/no-disabled-tests describe.skip('SelectBonusProductsCard', () => { test('renders with selection counter by default', () => { renderWithProviders() diff --git a/packages/template-retail-react-app/app/pages/checkout/partials/contact-info.jsx b/packages/template-retail-react-app/app/pages/checkout/partials/contact-info.jsx index b7e6aa7af8..87e2fbc349 100644 --- a/packages/template-retail-react-app/app/pages/checkout/partials/contact-info.jsx +++ b/packages/template-retail-react-app/app/pages/checkout/partials/contact-info.jsx @@ -41,8 +41,6 @@ import { import useNavigation from '@salesforce/retail-react-app/app/hooks/use-navigation' import {useCurrentCustomer} from '@salesforce/retail-react-app/app/hooks/use-current-customer' import {useCurrentBasket} from '@salesforce/retail-react-app/app/hooks/use-current-basket' -import {isAbsoluteURL} from '@salesforce/retail-react-app/app/page-designer/utils' -import {useAppOrigin} from '@salesforce/retail-react-app/app/hooks/use-app-origin' import { AuthHelpers, useAuthHelper, diff --git a/packages/template-retail-react-app/app/pages/checkout/partials/sf-payments-sheet.test.js b/packages/template-retail-react-app/app/pages/checkout/partials/sf-payments-sheet.test.js index 11e1d2d232..e5be402c3f 100644 --- a/packages/template-retail-react-app/app/pages/checkout/partials/sf-payments-sheet.test.js +++ b/packages/template-retail-react-app/app/pages/checkout/partials/sf-payments-sheet.test.js @@ -186,7 +186,7 @@ jest.mock('@salesforce/retail-react-app/app/hooks/use-current-customer', () => { // eslint-disable-next-line @typescript-eslint/no-var-requires const mockUseCustomer = require('@salesforce/commerce-sdk-react').useCustomer return { - useCurrentCustomer: (expand) => { + useCurrentCustomer: () => { const query = mockUseCustomer() const data = query.data ? {...query.data, customerId: 'customer123', isRegistered: true, isGuest: false} diff --git a/packages/template-retail-react-app/app/pages/confirmation/index.test.js b/packages/template-retail-react-app/app/pages/confirmation/index.test.js index 1145580e4b..f5312bd452 100644 --- a/packages/template-retail-react-app/app/pages/confirmation/index.test.js +++ b/packages/template-retail-react-app/app/pages/confirmation/index.test.js @@ -6,7 +6,7 @@ */ import React from 'react' -import {screen, waitFor, within} from '@testing-library/react' +import {screen, waitFor} from '@testing-library/react' import {Route, Switch} from 'react-router-dom' import {rest} from 'msw' import { diff --git a/packages/template-retail-react-app/app/pages/login/index.jsx b/packages/template-retail-react-app/app/pages/login/index.jsx index 4cda8e3fa0..a7ae709999 100644 --- a/packages/template-retail-react-app/app/pages/login/index.jsx +++ b/packages/template-retail-react-app/app/pages/login/index.jsx @@ -45,7 +45,8 @@ const LOGIN_ERROR_MESSAGE = defineMessage({ const LOGIN_VIEW = 'login' const EMAIL_VIEW = 'email' -const Login = ({initialView = LOGIN_VIEW}) => { +// eslint-disable-next-line no-empty-pattern +const Login = ({}) => { const {formatMessage} = useIntl() const navigate = useNavigation() const form = useForm() diff --git a/packages/template-retail-react-app/app/utils/sf-payments-utils.test.js b/packages/template-retail-react-app/app/utils/sf-payments-utils.test.js index 971c14250f..b7ef50a97f 100644 --- a/packages/template-retail-react-app/app/utils/sf-payments-utils.test.js +++ b/packages/template-retail-react-app/app/utils/sf-payments-utils.test.js @@ -20,8 +20,6 @@ import { getExpressPaymentMethodType } from '@salesforce/retail-react-app/app/utils/sf-payments-utils' -import {PAYMENT_GATEWAYS} from '@salesforce/retail-react-app/app/constants' - describe('sf-payments-utils', () => { describe('getSFPaymentsInstrument', () => { test('returns undefined when basketOrOrder is undefined', () => {