Skip to content

Commit

Permalink
Fix eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavithra Kodmad authored and Pavithra Kodmad committed Nov 8, 2021
1 parent 79c652c commit 9fbfd1e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from 'styled-components'
import React, {ReactElement, useEffect, useRef} from 'react'
import {get, COMMON, SystemPositionProps, SystemCommonProps} from './constants'
import {ComponentProps} from './utils/types'
import { useIsomorphicEffect } from './utils/useIsoMorphicEffect'
import {useIsomorphicEffect} from './utils/useIsomorphicEffect'
import {useOverlay, TouchOrMouseEvent} from './hooks'
import Portal from './Portal'
import sx, {SxProp} from './sx'
Expand Down
2 changes: 0 additions & 2 deletions src/Portal/Portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import {createPortal} from 'react-dom'
import {useIsomorphicEffect} from '../utils/useIsomorphicEffect'


const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__'
const DEFAULT_PORTAL_CONTAINER_NAME = '__default__'

Expand Down Expand Up @@ -91,7 +90,6 @@ export const Portal: React.FC<PortalProps> = ({children, onMount, containerName:
return () => {
parentElement.removeChild(element)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [elementRef])

return createPortal(children, elementRef.current)
Expand Down
5 changes: 1 addition & 4 deletions src/hooks/useCombinedRefs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ForwardedRef, useRef} from 'react'
import {ForwardedRef, useRef} from 'react'
import {useIsomorphicEffect} from '../utils/useIsomorphicEffect'

/**
Expand Down Expand Up @@ -30,11 +30,8 @@ export function useCombinedRefs<T>(...refs: (ForwardedRef<T> | null | undefined)

return () => {
// ensure the refs get updated on unmount
// eslint-disable-next-line react-hooks/exhaustive-deps
setRefs(combinedRef.current)
}

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [...refs, combinedRef.current])

return combinedRef
Expand Down
2 changes: 0 additions & 2 deletions src/hooks/useResizeObserver.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react'
import {useIsomorphicEffect} from '../utils/useIsomorphicEffect'


export function useResizeObserver(callback: () => void) {
useIsomorphicEffect(() => {
const observer = new window.ResizeObserver(() => callback())
Expand Down
4 changes: 2 additions & 2 deletions src/utils/useIsoMorphicEffect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useLayoutEffect } from 'react'
import {useEffect, useLayoutEffect} from 'react'

export const useIsomorphicEffect = () => {
return typeof window !== 'undefined' ? useLayoutEffect : useEffect
}
}

0 comments on commit 9fbfd1e

Please sign in to comment.