diff --git a/configs/eslint-config-jwp/typescript.js b/configs/eslint-config-jwp/typescript.js index 5ffa0dede..3931aa87e 100644 --- a/configs/eslint-config-jwp/typescript.js +++ b/configs/eslint-config-jwp/typescript.js @@ -71,7 +71,7 @@ module.exports = { }, rules: { // `require` is still allowed/recommended in JS - '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-require-imports': 'off', }, }, { @@ -79,9 +79,6 @@ module.exports = { rules: { // These are handled by TS '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }], - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-inferrable-types': 'off', - '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-unused-vars': 'off', 'import/no-unresolved': 'off', }, diff --git a/packages/common/types/testing.ts b/packages/common/types/testing.ts index 2b84dd6db..82ce3da9c 100644 --- a/packages/common/types/testing.ts +++ b/packages/common/types/testing.ts @@ -1,4 +1,4 @@ export type CopyProperties = { [K in keyof T as T[K] extends V ? K : never]: T[K] }; -// eslint-disable-next-line @typescript-eslint/ban-types +// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type export type MockedService = CopyProperties; diff --git a/packages/hooks-react/src/useEventCallback.ts b/packages/hooks-react/src/useEventCallback.ts index 3c4d772b7..1ae643bf4 100644 --- a/packages/hooks-react/src/useEventCallback.ts +++ b/packages/hooks-react/src/useEventCallback.ts @@ -19,7 +19,7 @@ const useEventCallback = unknown>(callback?: T): fnRef.current = callback; }, [callback]); - // @ts-ignore + // @ts-expect-error type mismatch // ignore since we just want to pass all arguments to the callback function (which we don't know) return useCallback((...args) => { if (typeof fnRef.current === 'function') { diff --git a/packages/ui-react/src/components/Adyen/Adyen.tsx b/packages/ui-react/src/components/Adyen/Adyen.tsx index 506fddc6e..50d156942 100644 --- a/packages/ui-react/src/components/Adyen/Adyen.tsx +++ b/packages/ui-react/src/components/Adyen/Adyen.tsx @@ -53,7 +53,7 @@ const Adyen: React.FC = ({ configuration, error, type }) => { color="primary" size="large" onClick={() => { - checkoutRef.current && checkoutRef.current.submit(); + checkoutRef.current?.submit(); }} fullWidth /> diff --git a/packages/ui-react/src/components/Animation/Animation.tsx b/packages/ui-react/src/components/Animation/Animation.tsx index 250de7d91..8f46179be 100644 --- a/packages/ui-react/src/components/Animation/Animation.tsx +++ b/packages/ui-react/src/components/Animation/Animation.tsx @@ -44,7 +44,7 @@ const Animation: React.FC = ({ timeout.current = window.setTimeout(() => setStatus('opening'), delay); timeout2.current = window.setTimeout(() => { setStatus('open'); - onOpenAnimationEnd && onOpenAnimationEnd(); + onOpenAnimationEnd?.(); }, duration + delay); }); @@ -53,7 +53,7 @@ const Animation: React.FC = ({ timeout.current = window.setTimeout(() => setStatus('closing'), delay); timeout2.current = window.setTimeout(() => { setStatus('closed'); - onCloseAnimationEnd && onCloseAnimationEnd(); + onCloseAnimationEnd?.(); }, duration + delay); } }); diff --git a/packages/ui-react/src/components/CollapsibleText/CollapsibleText.tsx b/packages/ui-react/src/components/CollapsibleText/CollapsibleText.tsx index fc9c1582c..4e0804f53 100644 --- a/packages/ui-react/src/components/CollapsibleText/CollapsibleText.tsx +++ b/packages/ui-react/src/components/CollapsibleText/CollapsibleText.tsx @@ -26,7 +26,9 @@ const CollapsibleText: React.FC = ({ text, className }: Props) => { const maxHeight = 60; useEffect(() => { - divRef.current && setDoesFlowOver(divRef.current.scrollHeight > divRef.current.offsetHeight + clippablePixels || maxHeight < divRef.current.offsetHeight); + if (divRef.current) { + setDoesFlowOver(divRef.current.scrollHeight > divRef.current.offsetHeight + clippablePixels || maxHeight < divRef.current.offsetHeight); + } }, [maxHeight, text, breakpoint]); return ( diff --git a/packages/ui-react/src/components/CustomRegisterField/CustomRegisterField.test.tsx b/packages/ui-react/src/components/CustomRegisterField/CustomRegisterField.test.tsx index 6f4517979..e1de19017 100644 --- a/packages/ui-react/src/components/CustomRegisterField/CustomRegisterField.test.tsx +++ b/packages/ui-react/src/components/CustomRegisterField/CustomRegisterField.test.tsx @@ -48,7 +48,7 @@ describe('', () => { }); test('renders and matches snapshot ', () => { - // @ts-ignore + // @ts-expect-error `type` typing mismatch const { container } = render(); expect(container).toMatchSnapshot(); diff --git a/packages/ui-react/src/components/Form/Form.tsx b/packages/ui-react/src/components/Form/Form.tsx index c2c3591b1..5872f3909 100644 --- a/packages/ui-react/src/components/Form/Form.tsx +++ b/packages/ui-react/src/components/Form/Form.tsx @@ -48,7 +48,7 @@ function Form({ isLoading, initialValues, onRes errors: undefined, }; }); - onReset && onReset(); + onReset?.(); }, [initialValues, onReset], ); diff --git a/packages/ui-react/src/components/LanguageMenu/LanguageMenu.tsx b/packages/ui-react/src/components/LanguageMenu/LanguageMenu.tsx index 1faccb7cd..bfe5db82b 100644 --- a/packages/ui-react/src/components/LanguageMenu/LanguageMenu.tsx +++ b/packages/ui-react/src/components/LanguageMenu/LanguageMenu.tsx @@ -28,7 +28,7 @@ const LanguageMenu = ({ onClick, className, languages, currentLanguage, language const handleLanguageSelect = (event: MouseEvent, code: string) => { event.preventDefault(); - onClick && onClick(code); + onClick?.(code); closeLanguageMenu(); }; diff --git a/packages/ui-react/src/components/PaymentMethodForm/PaymentMethodForm.tsx b/packages/ui-react/src/components/PaymentMethodForm/PaymentMethodForm.tsx index 1cb8cefd7..0b25a7c7e 100644 --- a/packages/ui-react/src/components/PaymentMethodForm/PaymentMethodForm.tsx +++ b/packages/ui-react/src/components/PaymentMethodForm/PaymentMethodForm.tsx @@ -38,7 +38,9 @@ const PaymentMethodForm: React.FC = ({ const paypalPaymentMethod = paymentMethods?.find((method) => method.methodName === 'paypal'); useEffect(() => { - updateSuccess && announce(t('checkout.payment_success'), 'success'); + if (updateSuccess) { + announce(t('checkout.payment_success'), 'success'); + } }, [updateSuccess, announce, t]); return ( diff --git a/packages/ui-react/src/containers/Cinema/Cinema.tsx b/packages/ui-react/src/containers/Cinema/Cinema.tsx index 0449a15c0..fdd0368b4 100644 --- a/packages/ui-react/src/containers/Cinema/Cinema.tsx +++ b/packages/ui-react/src/containers/Cinema/Cinema.tsx @@ -55,20 +55,20 @@ const Cinema: React.FC = ({ const handlePlay = useCallback(() => { setIsPlaying(true); - onPlay && onPlay(); + onPlay?.(); }, [onPlay]); const handlePause = useCallback(() => { setIsPlaying(false); - onPause && onPause(); + onPause?.(); }, [onPause]); const handleComplete = useCallback(() => { - onComplete && onComplete(); + onComplete?.(); }, [onComplete]); const handleNext = useCallback(() => { - onNext && onNext(); + onNext?.(); }, [onNext]); const handleUserActive = useCallback(() => setUserActive(true), []); diff --git a/platforms/web/scripts/build-tools/buildTools.ts b/platforms/web/scripts/build-tools/buildTools.ts index 9f6a2e399..2416f8c07 100644 --- a/platforms/web/scripts/build-tools/buildTools.ts +++ b/platforms/web/scripts/build-tools/buildTools.ts @@ -42,7 +42,7 @@ export const getFileCopyTargets = (mode: string): Target[] => { export const getMetaTags = (tagData: Record): HtmlTagDescriptor[] => { return Object.entries(tagData) - .filter(([_, value]) => !!value) + .filter(([, value]) => !!value) .map(([name, content]) => ({ tag: 'meta', injectTo: 'head', diff --git a/platforms/web/src/components/DemoConfigDialog/DemoConfigDialog.test.tsx b/platforms/web/src/components/DemoConfigDialog/DemoConfigDialog.test.tsx index 686785fd6..513afac00 100644 --- a/platforms/web/src/components/DemoConfigDialog/DemoConfigDialog.test.tsx +++ b/platforms/web/src/components/DemoConfigDialog/DemoConfigDialog.test.tsx @@ -13,7 +13,7 @@ describe('', () => { refetch: () => Promise.resolve(null), }; - // @ts-expect-error + // @ts-expect-error the mocked query argument is not complete const { container } = renderWithRouter(); expect(container).toMatchSnapshot(); @@ -28,7 +28,7 @@ describe('', () => { refetch: () => Promise.resolve(null), }; - // @ts-expect-error + // @ts-expect-error the mocked query argument is not complete const { container } = renderWithRouter(); expect(container).toMatchSnapshot(); diff --git a/platforms/web/test-e2e/tests/home_test.ts b/platforms/web/test-e2e/tests/home_test.ts index 563b64993..b29c66cdd 100644 --- a/platforms/web/test-e2e/tests/home_test.ts +++ b/platforms/web/test-e2e/tests/home_test.ts @@ -49,7 +49,7 @@ Scenario.skip('I can slide within the hero shelf', async ({ I }) => { if (isDesktop) { I.click({ css: `button[aria-label="${forward ? 'Next' : 'Previous'} slide"]` }); } else { - forward ? await I.swipeLeft({ text: swipeText }) : await I.swipeRight({ text: swipeText }); + await I[forward ? 'swipeLeft' : 'swipeRight']({ text: swipeText }); } } diff --git a/scripts/content-types/lib/utils.ts b/scripts/content-types/lib/utils.ts index d392406c2..c4b76b603 100644 --- a/scripts/content-types/lib/utils.ts +++ b/scripts/content-types/lib/utils.ts @@ -1,4 +1,3 @@ -// @ts-ignore import read from 'read'; const ExitCodes = { diff --git a/scripts/i18next/update-translations.ts b/scripts/i18next/update-translations.ts index 0114ac18e..21cf211f9 100644 --- a/scripts/i18next/update-translations.ts +++ b/scripts/i18next/update-translations.ts @@ -1,6 +1,5 @@ import * as fs from 'fs'; -// @ts-ignore import { ColumnOption, parse } from 'csv-parse/sync'; interface Line {