Skip to content

Commit d398e65

Browse files
committed
chore: fix the lint
1 parent 7eca435 commit d398e65

54 files changed

Lines changed: 114 additions & 100 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ module.exports = {
2929
semi: [2, 'always'],
3030
'react-hooks/rules-of-hooks': 2,
3131
'react-hooks/exhaustive-deps': 1,
32+
'@typescript-eslint/no-unused-vars': [1, { varsIgnorePattern: '^React$' }],
3233
},
3334
};

components/_utils/hooks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const useEventListener = (
2525
}, [eventName, target]);
2626
};
2727

28-
export const useClickOutside = (target: HTMLElement, handler: Function): void => {
28+
export const useClickOutside = (target: HTMLElement, handler: (event: MouseEvent) => void): void => {
2929
useEffect(() => {
3030
const listener = (event: MouseEvent): void => {
3131
if (!target || target.contains(event.target as HTMLElement)) {

components/anchor/__tests__/anchor.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('<Anchor />', () => {
2929
<Anchor.Link href="#s2" title="Link 2" />
3030
</Anchor>
3131
);
32-
expect(getByText('Link 1')).toBeTruthy();
33-
expect(getByText('Link 2')).toBeTruthy();
32+
expect(getByText('Link 1')).toBeInTheDocument();
33+
expect(getByText('Link 2')).toBeInTheDocument();
3434
});
3535
});

components/autocomplete/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function Autocomplete(props: AutoCompleteProps): React.ReactElement {
2525
}
2626
};
2727

28+
// eslint-disable-next-line @typescript-eslint/no-empty-function
2829
const onSelect = (): void => {};
2930

3031
return (

components/avatar/__tests__/avatar.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('<Avatar />', () => {
3030

3131
it('should render text content', () => {
3232
const { getByText } = render(<Avatar>AB</Avatar>);
33-
expect(getByText('AB')).toBeTruthy();
33+
expect(getByText('AB')).toBeInTheDocument();
3434
});
3535

3636
it('should render with custom size', () => {

components/badge/__tests__/badge.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ describe('<Badge />', () => {
1515

1616
it('should render count', () => {
1717
const { getByText } = render(<Badge count={5}><div>content</div></Badge>);
18-
expect(getByText('5')).toBeTruthy();
18+
expect(getByText('5')).toBeInTheDocument();
1919
});
2020

2121
it('should render max+ when count exceeds max', () => {
2222
const { getByText } = render(<Badge count={100} max={99}><div>content</div></Badge>);
23-
expect(getByText('99+')).toBeTruthy();
23+
expect(getByText('99+')).toBeInTheDocument();
2424
});
2525

2626
it('should render as dot', () => {
@@ -35,6 +35,6 @@ describe('<Badge />', () => {
3535

3636
it('should show zero when showZero is true', () => {
3737
const { getByText } = render(<Badge count={0} showZero><div>content</div></Badge>);
38-
expect(getByText('0')).toBeTruthy();
38+
expect(getByText('0')).toBeInTheDocument();
3939
});
4040
});

components/breadcrumb/__tests__/breadcrumb.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ describe('<Breadcrumb />', () => {
2929
<Breadcrumb.Item>Page</Breadcrumb.Item>
3030
</Breadcrumb>
3131
);
32-
expect(getByText('Home')).toBeTruthy();
33-
expect(getByText('Page')).toBeTruthy();
32+
expect(getByText('Home')).toBeInTheDocument();
33+
expect(getByText('Page')).toBeInTheDocument();
3434
});
3535

3636
it('should render custom separator', () => {
@@ -40,6 +40,6 @@ describe('<Breadcrumb />', () => {
4040
<Breadcrumb.Item>Page</Breadcrumb.Item>
4141
</Breadcrumb>
4242
);
43-
expect(container.textContent).toContain('>');
43+
expect(container).toHaveTextContent(/>/);
4444
});
4545
});

components/card/__tests__/card.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ describe('<Card />', () => {
2525

2626
it('should render title', () => {
2727
const { getByText } = render(<Card title="Title">Content</Card>);
28-
expect(getByText('Title')).toBeTruthy();
28+
expect(getByText('Title')).toBeInTheDocument();
2929
});
3030

3131
it('should render extra content', () => {
3232
const { getByText } = render(<Card title="Title" extra={<span>More</span>}>Content</Card>);
33-
expect(getByText('More')).toBeTruthy();
33+
expect(getByText('More')).toBeInTheDocument();
3434
});
3535

3636
it('should render footer', () => {
3737
const { getByText } = render(<Card footer={<div>Footer</div>}>Content</Card>);
38-
expect(getByText('Footer')).toBeTruthy();
38+
expect(getByText('Footer')).toBeInTheDocument();
3939
});
4040
});

components/carousel/__tests__/carousel.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ describe('<Carousel />', () => {
3131
<Carousel.Item><div>Slide B</div></Carousel.Item>
3232
</Carousel>
3333
);
34-
expect(getByText('Slide A')).toBeTruthy();
35-
expect(getByText('Slide B')).toBeTruthy();
34+
expect(getByText('Slide A')).toBeInTheDocument();
35+
expect(getByText('Slide B')).toBeInTheDocument();
3636
});
3737

3838
it('should render dots', () => {

components/checkbox/__tests__/checkbox.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('<Checkbox />', () => {
1515

1616
it('should render label', () => {
1717
const { getByText } = render(<Checkbox>Label</Checkbox>);
18-
expect(getByText('Label')).toBeTruthy();
18+
expect(getByText('Label')).toBeInTheDocument();
1919
});
2020

2121
it('should render disabled', () => {

0 commit comments

Comments
 (0)