Skip to content

Commit

Permalink
chore: fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristiaanScheermeijer committed Dec 2, 2024
1 parent bc10616 commit 2a364f2
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 24 deletions.
5 changes: 1 addition & 4 deletions configs/eslint-config-jwp/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,14 @@ module.exports = {
},
rules: {
// `require` is still allowed/recommended in JS
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
},
{
files: ['*.ts', '*.tsx'],
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',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/types/testing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type CopyProperties<T, V> = { [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<T> = CopyProperties<T, Function>;
2 changes: 1 addition & 1 deletion packages/hooks-react/src/useEventCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const useEventCallback = <T extends (...args: any[]) => 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') {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-react/src/components/Adyen/Adyen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Adyen: React.FC<Props> = ({ configuration, error, type }) => {
color="primary"
size="large"
onClick={() => {
checkoutRef.current && checkoutRef.current.submit();
checkoutRef.current?.submit();
}}
fullWidth
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-react/src/components/Animation/Animation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Animation: React.FC<Props> = ({
timeout.current = window.setTimeout(() => setStatus('opening'), delay);
timeout2.current = window.setTimeout(() => {
setStatus('open');
onOpenAnimationEnd && onOpenAnimationEnd();
onOpenAnimationEnd?.();
}, duration + delay);
});

Expand All @@ -53,7 +53,7 @@ const Animation: React.FC<Props> = ({
timeout.current = window.setTimeout(() => setStatus('closing'), delay);
timeout2.current = window.setTimeout(() => {
setStatus('closed');
onCloseAnimationEnd && onCloseAnimationEnd();
onCloseAnimationEnd?.();
}, duration + delay);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const CollapsibleText: React.FC<Props> = ({ 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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('<CustomRegisterField>', () => {
});

test('renders and matches snapshot <Dropdown type="randomstring">', () => {
// @ts-ignore
// @ts-expect-error `type` typing mismatch
const { container } = render(<CustomRegisterField type="randomstring" label="label" name="name" value="value" onChange={vi.fn()} />);

expect(container).toMatchSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-react/src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function Form<TData extends GenericFormValues>({ isLoading, initialValues, onRes
errors: undefined,
};
});
onReset && onReset();
onReset?.();
},
[initialValues, onReset],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const LanguageMenu = ({ onClick, className, languages, currentLanguage, language

const handleLanguageSelect = (event: MouseEvent<HTMLElement>, code: string) => {
event.preventDefault();
onClick && onClick(code);
onClick?.(code);

closeLanguageMenu();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const PaymentMethodForm: React.FC<Props> = ({
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 (
Expand Down
8 changes: 4 additions & 4 deletions packages/ui-react/src/containers/Cinema/Cinema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ const Cinema: React.FC<Props> = ({

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), []);
Expand Down
2 changes: 1 addition & 1 deletion platforms/web/scripts/build-tools/buildTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const getFileCopyTargets = (mode: string): Target[] => {

export const getMetaTags = (tagData: Record<string, string | undefined>): HtmlTagDescriptor[] => {
return Object.entries(tagData)
.filter(([_, value]) => !!value)
.filter(([, value]) => !!value)
.map(([name, content]) => ({
tag: 'meta',
injectTo: 'head',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('<DemoConfigDialog>', () => {
refetch: () => Promise.resolve(null),
};

// @ts-expect-error
// @ts-expect-error the mocked query argument is not complete
const { container } = renderWithRouter(<DemoConfigDialog query={query} />);

expect(container).toMatchSnapshot();
Expand All @@ -28,7 +28,7 @@ describe('<DemoConfigDialog>', () => {
refetch: () => Promise.resolve(null),
};

// @ts-expect-error
// @ts-expect-error the mocked query argument is not complete
const { container } = renderWithRouter(<DemoConfigDialog query={query} />);

expect(container).toMatchSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion platforms/web/test-e2e/tests/home_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}

Expand Down
1 change: 0 additions & 1 deletion scripts/content-types/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-ignore
import read from 'read';

const ExitCodes = {
Expand Down
1 change: 0 additions & 1 deletion scripts/i18next/update-translations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as fs from 'fs';

// @ts-ignore
import { ColumnOption, parse } from 'csv-parse/sync';

interface Line {
Expand Down

0 comments on commit 2a364f2

Please sign in to comment.