hello there
{checked ?
checked
:
unchecked
}
', () => {
})
it('should pass a ref down', async () => {
- const ref = { current: null } as React.RefObject
+ const ref = { current: null } as React.RefObject
render()
await waitFor(() => {
expect(ref.current).toBeInstanceOf(HTMLInputElement)
diff --git a/components/src/components/molecules/RadioButtonGroup/RadioButtonGroup.test.tsx b/components/src/components/molecules/RadioButtonGroup/RadioButtonGroup.test.tsx
index 38d0b478..2c017621 100644
--- a/components/src/components/molecules/RadioButtonGroup/RadioButtonGroup.test.tsx
+++ b/components/src/components/molecules/RadioButtonGroup/RadioButtonGroup.test.tsx
@@ -87,7 +87,7 @@ describe('', () => {
})
it('should fire onChange when checked value does not match value', () => {
- const mockCallback = vi.fn((e: any) => {
+ const mockCallback = vi.fn>((e) => {
return e.target.value
})
render(
diff --git a/components/src/components/molecules/Select/Select.test.tsx b/components/src/components/molecules/Select/Select.test.tsx
index 50edc7cf..e9491b1a 100644
--- a/components/src/components/molecules/Select/Select.test.tsx
+++ b/components/src/components/molecules/Select/Select.test.tsx
@@ -2,7 +2,6 @@ import * as React from 'react'
import {
cleanup,
- getPropertyValue,
render,
screen,
userEvent,
@@ -46,7 +45,7 @@ describe('', () => {
})
it('should call onChange when selection made', async () => {
- const mockCallback = vi.fn((e: any) => [
+ const mockCallback = vi.fn<((e: React.ChangeEvent) => void)>(e => [
e.target.value,
e.currentTarget.value,
])
diff --git a/components/src/components/molecules/Textarea/Textarea.test.tsx b/components/src/components/molecules/Textarea/Textarea.test.tsx
index de6533e3..4971f89a 100644
--- a/components/src/components/molecules/Textarea/Textarea.test.tsx
+++ b/components/src/components/molecules/Textarea/Textarea.test.tsx
@@ -55,7 +55,7 @@ describe('', () => {
})
it('should pass a ref down', async () => {
- const ref = { current: null } as React.RefObject
+ const ref = { current: null } as React.RefObject
render()
await waitFor(() => {
expect(ref.current).toBeInstanceOf(HTMLTextAreaElement)
diff --git a/components/src/hooks/useCopied.ts b/components/src/hooks/useCopied.ts
index 567c871c..fe000fa0 100644
--- a/components/src/hooks/useCopied.ts
+++ b/components/src/hooks/useCopied.ts
@@ -9,9 +9,9 @@ export const useCopied = () => {
}
useEffect(() => {
- let timeout: any
+ let timeout: number
if (copied) {
- timeout = setTimeout(() => setCopied(false), 1500)
+ timeout = window.setTimeout(() => setCopied(false), 1500)
}
return () => clearTimeout(timeout)
}, [copied])
diff --git a/components/src/hooks/useDocumentEvent.ts b/components/src/hooks/useDocumentEvent.ts
index 2a0a9ca1..8238dc50 100644
--- a/components/src/hooks/useDocumentEvent.ts
+++ b/components/src/hooks/useDocumentEvent.ts
@@ -2,7 +2,7 @@ import type { RefObject } from 'react'
import { useEffect } from 'react'
export const useDocumentEvent = (
- ref: RefObject,
+ ref: RefObject,
event: keyof DocumentEventMap,
_callback: () => void,
shouldCallback?: boolean,
diff --git a/components/src/utils/debounce.ts b/components/src/utils/debounce.ts
index 7579864a..8e2e5f21 100644
--- a/components/src/utils/debounce.ts
+++ b/components/src/utils/debounce.ts
@@ -2,7 +2,8 @@ type DebounceOptions = {
maxWait?: number
}
-export function debounce any>(
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export function debounce unknown>(
func: T,
wait: number,
options?: DebounceOptions,
diff --git a/components/test/utils.ts b/components/test/utils.ts
index 00cd2935..4cd86079 100644
--- a/components/test/utils.ts
+++ b/components/test/utils.ts
@@ -6,17 +6,17 @@ type DeepPartial = T extends object
}
: T
-export type PartialMockedFunction any> = (
+export type PartialMockedFunction unknown> = (
...args: Parameters
) => DeepPartial>
-export const mockFunction = any>(func: T) =>
+export const mockFunction = unknown>(func: T) =>
func as unknown as MockedFunction>
export const makeMockIntersectionObserver
= (
mockIntersectionObserverCls: MockedFunction,
- mockObserve: MockedFunction,
+ mockObserve: MockedFunction<(t: Element) => void>,
mockDisconnect: MockedFunction,
) =>
(intersectTop: boolean, intersectBottom: boolean) => {
@@ -30,6 +30,7 @@ export const makeMockIntersectionObserver
})
const els: HTMLElement[] = []
window.IntersectionObserver = mockIntersectionObserverCls
+
mockObserve.mockImplementation((el) => {
if (intersectTop && intersectBottom) {
els.push(el as HTMLElement)
diff --git a/docs/src/pages/guides/[slug].tsx b/docs/src/pages/guides/[slug].tsx
index 5b71282a..fff6f8a9 100644
--- a/docs/src/pages/guides/[slug].tsx
+++ b/docs/src/pages/guides/[slug].tsx
@@ -29,6 +29,7 @@ export const getStaticPaths: GetStaticPaths = async () => ({
type StaticProps = {
docsLink: string
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
frontMatter: Record
source: MDXRemoteSerializeResult
}