Skip to content

Commit 80ddd4a

Browse files
author
Kubit
committed
Fix typescript and eslint errors
1 parent 74f3b9a commit 80ddd4a

File tree

8 files changed

+103
-9
lines changed

8 files changed

+103
-9
lines changed

src/components/inputCurrency/__tests__/inputCurrency.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react';
33

44
import { axe } from 'jest-axe';
55

6-
import { InputContentPosition, InputState } from '@/components/input/types';
6+
import { FormatNumber, InputContentPosition, InputState } from '@/components/input/types';
77
import { renderProvider } from '@/tests/renderProvider/renderProvider.utility';
88
import { POSITIONS } from '@/types/positions';
99

@@ -28,7 +28,7 @@ const format = {
2828
style: 'decimal',
2929
maximumFractionDigits: 3,
3030
minimumFractionDigits: 1,
31-
};
31+
} as FormatNumber;
3232

3333
describe('New Input Currency Component', () => {
3434
test('Should render InputCurrency component', async () => {

src/components/navigationCard/navigationCardStandAlone.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ const NavigationCardStandaloneComponent = (
3636
return (
3737
// Can not be spread -> styled component breaks
3838
<NavigationCardStyled
39-
ref={ref as React.ForwardedRef<HTMLButtonElement>}
39+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
40+
ref={ref as any}
4041
aria-disabled={props['aria-disabled']}
4142
as={props.url ? props.component : 'button'}
4243
className={props.className}

src/components/pillV2/pill.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getPillState } from './utils';
99

1010
const PillComponent = (
1111
{ variant, size, ctv, selected = false, disabled = false, ...props }: IPill,
12-
ref: React.ForwardedRef<HTMLDivElement>
12+
ref: React.ForwardedRef<HTMLButtonElement>
1313
) => {
1414
const variantStyles = useStylesV2<PillVariantPropsStylesType>({
1515
styleName: STYLES_NAME.PILL_V2,

src/components/pillV2/pillStandAlone.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { IPillStandAlone, PillType } from './types';
1818

1919
const PillStandAloneComponent = (
2020
{ dataTestId = 'pill', type = PillType.BUTTON, ...props }: IPillStandAlone,
21-
ref: React.ForwardedRef<HTMLDivElement> | undefined | null
21+
ref: React.ForwardedRef<HTMLButtonElement> | undefined | null
2222
): JSX.Element => {
2323
const id = useId('pill');
2424
const pillContentId = `${id}-content`;

src/constants/keyboardKeys.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ const ARROW_DOWN = {
6767

6868
const DELETE = {
6969
key: 'Delete',
70-
which: 8 || 46,
71-
keyCode: 8 || 46,
70+
which: 46,
71+
keyCode: 46,
7272
code: 'ArrowDecimal',
7373
};
7474

src/hooks/useInput/__tests__/useInput.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { act, renderHook } from '@testing-library/react-hooks';
22
import React, { ChangeEvent } from 'react';
33

4+
import { FormatNumber } from '@/components';
45
import * as validationsProvider from '@/provider/validations/validationsProvider';
56

67
import { useInput } from '../useInput';
78

89
describe('useInput Hook', () => {
910
it('useInput - on internal change should call parent onChange', () => {
1011
const onChange = jest.fn();
11-
const formatNumber = { style: 'decimal' };
12+
const formatNumber = { style: 'decimal' } as FormatNumber;
1213
const ref = React.createRef<HTMLInputElement | undefined>();
1314
const currentValue = '123234';
1415
const regex = new RegExp('^[0-9]*$');
@@ -43,7 +44,7 @@ describe('useInput Hook', () => {
4344
});
4445
it('useInput - on internal blur should call parent onBlur', () => {
4546
const onBlur = jest.fn();
46-
const formatNumber = { style: 'decimal' };
47+
const formatNumber = { style: 'decimal' } as FormatNumber;
4748
const { result } = renderHook(() => useInput({ onBlur, formatNumber }));
4849

4950
act(() => {

src/storybook/components/icons/icons.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { IconNameStyled, IconsDataStyled, IconsInputStyled, IconsStyled } from '
1010
export const Icons = (): JSX.Element => {
1111
const [searchValue, setSearchValue] = React.useState('');
1212

13+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
1314
const theme = localStorage.getItem('themeSelected') || 'kubit';
1415
const themeObject = themesObject[theme]['ICONS'];
1516

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import React from 'react';
2+
3+
import { UtilsProvider } from '@/provider';
4+
import { DateFormatOptions } from '@/provider/utils/types';
5+
import { FormatWeekdayOptionType } from '@/types';
6+
import {
7+
formatDate,
8+
getAddDays,
9+
getAddMonths,
10+
getAddYears,
11+
getAllMonthNames,
12+
getAllWeekdayNames,
13+
getSubDays,
14+
getSubMonths,
15+
getSubYears,
16+
isAfter,
17+
isBefore,
18+
isDatesEqual,
19+
transformDate,
20+
} from '@/utils/date';
21+
22+
//delete on kubit
23+
const folder = {
24+
santander: 'santander',
25+
modelbank: 'mb',
26+
santander_black: 'santander',
27+
modelbank_cc: 'mb',
28+
santander_cc: 'santander',
29+
};
30+
//delete on kubit
31+
32+
export const UtilsProviderDocStorybook = ({
33+
children,
34+
theme,
35+
}: {
36+
children: JSX.Element;
37+
theme: string;
38+
}): JSX.Element => {
39+
return (
40+
<UtilsProvider
41+
assets={{
42+
baseHost: `https://assets.dev.openbank.com/web/${folder[theme]}/icons/`,
43+
iconsBaseHost: `https://assets.dev.openbank.com/web/${folder[theme]}/icons/`,
44+
illutrationsBaseHost: `https://assets.dev.openbank.com/web/${folder[theme]}/illustrations/`,
45+
}}
46+
dateHelpers={{
47+
isAfter: (date1: Date, date2: Date) => {
48+
return isAfter(date1, date2);
49+
},
50+
isBefore: (date1: Date, date2: Date) => {
51+
return isBefore(date1, date2);
52+
},
53+
isDatesEqual: (firsDate: string | number | Date, secondDate: string | number | Date) => {
54+
return isDatesEqual(firsDate, secondDate);
55+
},
56+
getAddDays: (date: Date, days: number) => {
57+
return getAddDays(date, days);
58+
},
59+
getAddMonths: (date: Date, months: number) => {
60+
return getAddMonths(date, months);
61+
},
62+
getAddYears: (date: Date, years: number) => {
63+
return getAddYears(date, years);
64+
},
65+
getSubDays: (date: Date, days: number) => {
66+
return getSubDays(date, days);
67+
},
68+
getSubMonths: (date: Date, months: number) => {
69+
return getSubMonths(date, months);
70+
},
71+
getSubYears: (date: Date, years: number) => {
72+
return getSubYears(date, years);
73+
},
74+
getAllMonthName: () => {
75+
return getAllMonthNames();
76+
},
77+
getAllWeekdayName: (weekdayFormat: FormatWeekdayOptionType, isSundayFirst: boolean) => {
78+
return getAllWeekdayNames(weekdayFormat, isSundayFirst);
79+
},
80+
}}
81+
formatDate={(date: Date, format: string | DateFormatOptions) => {
82+
return formatDate(date, format);
83+
}}
84+
transformDate={(date: string | number, format: string | undefined) => {
85+
return transformDate(date, format);
86+
}}
87+
>
88+
{children}
89+
</UtilsProvider>
90+
);
91+
};

0 commit comments

Comments
 (0)