diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 81ed2cc471..6302a71b71 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,5 +26,5 @@ jobs: - name: Semantic Release uses: cycjimmy/semantic-release-action@v4 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/docs/useEnsuredForwardedRef.md b/docs/useEnsuredForwardedRef.md index b094a284bc..d7ab7aebcc 100644 --- a/docs/useEnsuredForwardedRef.md +++ b/docs/useEnsuredForwardedRef.md @@ -59,5 +59,5 @@ const Child = React.forwardRef((props, ref) => { ```ts ensuredForwardRef(Component: RefForwardingComponent): ForwardRefExoticComponent & RefAttributes>; -useEnsuredForwardedRef(ref: React.MutableRefObject): React.MutableRefObject; +useEnsuredForwardedRef(ref: React.MutableRefObject): React.MutableRefObject; ``` diff --git a/docs/useIntersection.md b/docs/useIntersection.md index 802ee1da6a..d1fceefa42 100644 --- a/docs/useIntersection.md +++ b/docs/useIntersection.md @@ -30,7 +30,7 @@ const Demo = () => { ```ts useIntersection( - ref: RefObject, + ref: RefObject, options: IntersectionObserverInit, ): IntersectionObserverEntry | null; ``` diff --git a/docs/useLatest.md b/docs/useLatest.md index cf1cc752dc..fe28a20631 100644 --- a/docs/useLatest.md +++ b/docs/useLatest.md @@ -32,5 +32,5 @@ const Demo = () => { ## Reference ```ts -const latestState = useLatest = (state: T): MutableRefObject; +const latestState = useLatest = (state: T): MutableRefObject; ``` diff --git a/docs/useLockBodyScroll.md b/docs/useLockBodyScroll.md index ee2f819713..ab69a68654 100644 --- a/docs/useLockBodyScroll.md +++ b/docs/useLockBodyScroll.md @@ -30,7 +30,7 @@ const Demo = () => { ## Reference ```ts -useLockBodyScroll(locked: boolean = true, elementRef?: RefObject); +useLockBodyScroll(locked: boolean = true, elementRef?: RefObject); ``` - `locked` — Hook will lock scrolling on the body element if `true`, defaults to `true` diff --git a/docs/useScroll.md b/docs/useScroll.md index 0139b3dcd3..5a42e4bed8 100644 --- a/docs/useScroll.md +++ b/docs/useScroll.md @@ -23,5 +23,5 @@ const Demo = () => { ## Reference ```ts -useScroll(ref: RefObject); +useScroll(ref: RefObject); ``` diff --git a/docs/useScrolling.md b/docs/useScrolling.md index 346da07c0b..54712483bc 100644 --- a/docs/useScrolling.md +++ b/docs/useScrolling.md @@ -22,5 +22,5 @@ const Demo = () => { ## Reference ```ts -useScrolling(ref: RefObject); +useScrolling(ref: RefObject); ``` diff --git a/src/factory/createHTMLMediaHook.ts b/src/factory/createHTMLMediaHook.ts index 92d62c9d79..a3c155d2e3 100644 --- a/src/factory/createHTMLMediaHook.ts +++ b/src/factory/createHTMLMediaHook.ts @@ -28,7 +28,7 @@ export interface HTMLMediaControls { seek: (time: number) => void; } -type MediaPropsWithRef = HTMLMediaProps & { ref?: React.MutableRefObject }; +type MediaPropsWithRef = HTMLMediaProps & { ref?: React.MutableRefObject }; export default function createHTMLMediaHook( tag: 'audio' | 'video' diff --git a/src/useEnsuredForwardedRef.ts b/src/useEnsuredForwardedRef.ts index ad26fd1a72..d959f20ad5 100644 --- a/src/useEnsuredForwardedRef.ts +++ b/src/useEnsuredForwardedRef.ts @@ -11,8 +11,8 @@ import { } from 'react'; export default function useEnsuredForwardedRef( - forwardedRef: MutableRefObject -): MutableRefObject { + forwardedRef: MutableRefObject +): MutableRefObject { const ensuredRef = useRef(forwardedRef && forwardedRef.current); useEffect(() => { @@ -29,7 +29,7 @@ export function ensuredForwardRef( Component: RefForwardingComponent ): ForwardRefExoticComponent & RefAttributes> { return forwardRef((props: PropsWithChildren

, ref) => { - const ensuredRef = useEnsuredForwardedRef(ref as MutableRefObject); + const ensuredRef = useEnsuredForwardedRef(ref as MutableRefObject); return Component(props, ensuredRef); }); } diff --git a/src/useFullscreen.ts b/src/useFullscreen.ts index f795bb3b14..040d0b59ee 100644 --- a/src/useFullscreen.ts +++ b/src/useFullscreen.ts @@ -11,7 +11,7 @@ export interface FullScreenOptions { } const useFullscreen = ( - ref: RefObject, + ref: RefObject, enabled: boolean, options: FullScreenOptions = {} ): boolean => { diff --git a/src/useIntersection.ts b/src/useIntersection.ts index f5b833649d..4bd249f822 100644 --- a/src/useIntersection.ts +++ b/src/useIntersection.ts @@ -1,7 +1,7 @@ import { RefObject, useEffect, useState } from 'react'; const useIntersection = ( - ref: RefObject, + ref: RefObject, options: IntersectionObserverInit ): IntersectionObserverEntry | null => { const [intersectionObserverEntry, setIntersectionObserverEntry] = diff --git a/src/useLockBodyScroll.ts b/src/useLockBodyScroll.ts index fd48658917..b8fb04faec 100644 --- a/src/useLockBodyScroll.ts +++ b/src/useLockBodyScroll.ts @@ -46,8 +46,11 @@ const doc: Document | undefined = typeof document === 'object' ? document : unde let documentListenerAdded = false; export default !doc - ? function useLockBodyMock(_locked: boolean = true, _elementRef?: RefObject) {} - : function useLockBody(locked: boolean = true, elementRef?: RefObject) { + ? function useLockBodyMock( + _locked: boolean = true, + _elementRef?: RefObject + ) {} + : function useLockBody(locked: boolean = true, elementRef?: RefObject) { const bodyRef = useRef(doc!.body); elementRef = elementRef || bodyRef; diff --git a/src/useMeasureDirty.ts b/src/useMeasureDirty.ts index 4d5ca794ec..b3a57bbbcb 100644 --- a/src/useMeasureDirty.ts +++ b/src/useMeasureDirty.ts @@ -10,7 +10,7 @@ export interface ContentRect { bottom: number; } -const useMeasureDirty = (ref: RefObject): ContentRect => { +const useMeasureDirty = (ref: RefObject): ContentRect => { const frame = useRef(0); const [rect, set] = useState({ width: 0, diff --git a/src/useMouse.ts b/src/useMouse.ts index cbebbba4ef..2cc0517b1d 100644 --- a/src/useMouse.ts +++ b/src/useMouse.ts @@ -14,7 +14,7 @@ export interface State { elW: number; } -const useMouse = (ref: RefObject): State => { +const useMouse = (ref: RefObject): State => { if (process.env.NODE_ENV === 'development') { if (typeof ref !== 'object' || typeof ref.current === 'undefined') { console.error('useMouse expects a single ref argument.'); diff --git a/src/useMouseHovered.ts b/src/useMouseHovered.ts index de736afa85..765966b4fc 100644 --- a/src/useMouseHovered.ts +++ b/src/useMouseHovered.ts @@ -9,7 +9,10 @@ export interface UseMouseHoveredOptions { const nullRef = { current: null }; -const useMouseHovered = (ref: RefObject, options: UseMouseHoveredOptions = {}): State => { +const useMouseHovered = ( + ref: RefObject, + options: UseMouseHoveredOptions = {} +): State => { const whenHovered = !!options.whenHovered; const bound = !!options.bound; diff --git a/src/usePinchZoom.ts b/src/usePinchZoom.ts index 330c2052d5..75290bd180 100644 --- a/src/usePinchZoom.ts +++ b/src/usePinchZoom.ts @@ -12,7 +12,7 @@ export enum ZoomState { export type ZoomStateType = ZoomState.ZOOMING_IN | ZoomState.ZOOMING_OUT; -const usePinchZoom = (ref: RefObject) => { +const usePinchZoom = (ref: RefObject) => { const cacheRef = useMemo( () => ({ evCache: [], diff --git a/src/useScroll.ts b/src/useScroll.ts index 3b8dab2174..c4b31fd446 100644 --- a/src/useScroll.ts +++ b/src/useScroll.ts @@ -8,7 +8,7 @@ export interface State { y: number; } -const useScroll = (ref: RefObject): State => { +const useScroll = (ref: RefObject): State => { if (process.env.NODE_ENV === 'development') { if (typeof ref !== 'object' || typeof ref.current === 'undefined') { console.error('`useScroll` expects a single ref argument.'); diff --git a/src/useScrolling.ts b/src/useScrolling.ts index 2e2ddbef9a..90b6a1e4e3 100644 --- a/src/useScrolling.ts +++ b/src/useScrolling.ts @@ -1,7 +1,7 @@ import { RefObject, useEffect, useState } from 'react'; import { off, on } from './misc/util'; -const useScrolling = (ref: RefObject): boolean => { +const useScrolling = (ref: RefObject): boolean => { const [scrolling, setScrolling] = useState(false); useEffect(() => { diff --git a/src/useSlider.ts b/src/useSlider.ts index b7826827e8..82db10834f 100644 --- a/src/useSlider.ts +++ b/src/useSlider.ts @@ -17,7 +17,7 @@ export interface Options { vertical?: boolean; } -const useSlider = (ref: RefObject, options: Partial = {}): State => { +const useSlider = (ref: RefObject, options: Partial = {}): State => { const isMounted = useMountedState(); const isSliding = useRef(false); const valueRef = useRef(0); diff --git a/stories/useEnsuredForwardedRef.story.tsx b/stories/useEnsuredForwardedRef.story.tsx index 1ce4ec3953..40714a6ba7 100644 --- a/stories/useEnsuredForwardedRef.story.tsx +++ b/stories/useEnsuredForwardedRef.story.tsx @@ -43,7 +43,7 @@ const Demo = ({ activeForwardRef }) => { ); }; -const Child = forwardRef(({}, ref: MutableRefObject) => { +const Child = forwardRef(({}, ref: MutableRefObject) => { const ensuredForwardRef = useEnsuredForwardedRef(ref); const [size, setSize] = useState(INITIAL_SIZE); diff --git a/tests/useEnsuredForwardedRef.test.tsx b/tests/useEnsuredForwardedRef.test.tsx index d6ba4fe63c..1fe873b430 100644 --- a/tests/useEnsuredForwardedRef.test.tsx +++ b/tests/useEnsuredForwardedRef.test.tsx @@ -49,7 +49,7 @@ test('should return a valid ref when the forwarded ref is undefined', () => { const { ensuredRef } = result.current; - expect(ensuredRef.current.id).toBe('test_id'); + expect(ensuredRef.current?.id).toBe('test_id'); }); test('should return a valid ref when using the wrapper function style', () => {