mirror of
https://github.com/Afilmory/afilmory
synced 2026-02-01 22:48:17 +00:00
chore: disable specific react-hooks rules in ESLint configuration
- Temporarily turned off various react-hooks rules in the ESLint configuration to address current development needs. - Updated the usePhotoViewerTransitions hook to encapsulate visibility handling in a new hideTriggerElement function for improved code clarity and reusability. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -66,7 +66,7 @@ export const usePhotoViewerTransitions = ({
|
||||
const trigger = hiddenTriggerRef.current
|
||||
if (trigger) {
|
||||
const prevVisibility = hiddenTriggerPrevVisibilityRef.current
|
||||
if (prevVisibility !== null && prevVisibility !== undefined) {
|
||||
if (prevVisibility != null) {
|
||||
trigger.style.visibility = prevVisibility
|
||||
} else {
|
||||
trigger.style.removeProperty('visibility')
|
||||
@@ -76,6 +76,12 @@ export const usePhotoViewerTransitions = ({
|
||||
hiddenTriggerPrevVisibilityRef.current = null
|
||||
}, [])
|
||||
|
||||
const hideTriggerElement = useCallback((element: HTMLElement) => {
|
||||
hiddenTriggerRef.current = element
|
||||
hiddenTriggerPrevVisibilityRef.current = element.style.visibility || null
|
||||
element.style.visibility = 'hidden'
|
||||
}, [])
|
||||
|
||||
const resolveTriggerElement = useCallback((): HTMLElement | null => {
|
||||
if (!currentPhoto) return null
|
||||
|
||||
@@ -175,9 +181,7 @@ export const usePhotoViewerTransitions = ({
|
||||
return
|
||||
}
|
||||
|
||||
hiddenTriggerRef.current = triggerEl
|
||||
hiddenTriggerPrevVisibilityRef.current = triggerEl.style.visibility || null
|
||||
triggerEl.style.visibility = 'hidden'
|
||||
hideTriggerElement(triggerEl)
|
||||
|
||||
const triggerBorderRadius = getBorderRadius(
|
||||
triggerEl instanceof HTMLImageElement && triggerEl.parentElement
|
||||
@@ -225,6 +229,7 @@ export const usePhotoViewerTransitions = ({
|
||||
currentBlobSrc,
|
||||
isMobile,
|
||||
resolveTriggerElement,
|
||||
hideTriggerElement,
|
||||
])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -309,9 +314,7 @@ export const usePhotoViewerTransitions = ({
|
||||
}
|
||||
|
||||
restoreTriggerElementVisibility()
|
||||
hiddenTriggerRef.current = triggerEl
|
||||
hiddenTriggerPrevVisibilityRef.current = triggerEl.style.visibility || null
|
||||
triggerEl.style.visibility = 'hidden'
|
||||
hideTriggerElement(triggerEl)
|
||||
|
||||
const transitionState: PhotoViewerTransitionState = {
|
||||
photoId: currentPhoto.id,
|
||||
@@ -343,6 +346,7 @@ export const usePhotoViewerTransitions = ({
|
||||
isMobile,
|
||||
resolveTriggerElement,
|
||||
restoreTriggerElementVisibility,
|
||||
hideTriggerElement,
|
||||
])
|
||||
|
||||
useLayoutEffect(() => {
|
||||
|
||||
@@ -31,6 +31,24 @@ export default defineConfig(
|
||||
// NOTE: Disable this temporarily
|
||||
'react-compiler/react-compiler': 0,
|
||||
'no-restricted-syntax': 0,
|
||||
|
||||
// disable react compiler rules for now
|
||||
'react-hooks/no-unused-directives': 'off',
|
||||
'react-hooks/static-components': 'off',
|
||||
'react-hooks/use-memo': 'off',
|
||||
'react-hooks/component-hook-factories': 'off',
|
||||
'react-hooks/preserve-manual-memoization': 'off',
|
||||
'react-hooks/immutability': 'off',
|
||||
'react-hooks/globals': 'off',
|
||||
'react-hooks/refs': 'off',
|
||||
'react-hooks/set-state-in-effect': 'off',
|
||||
'react-hooks/error-boundaries': 'off',
|
||||
'react-hooks/purity': 'off',
|
||||
'react-hooks/set-state-in-render': 'off',
|
||||
'react-hooks/unsupported-syntax': 'off',
|
||||
'react-hooks/config': 'off',
|
||||
'react-hooks/gating': 'off',
|
||||
|
||||
'no-restricted-globals': [
|
||||
'error',
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user