diff --git a/packages/block-editor/src/components/block-list/block.native.js b/packages/block-editor/src/components/block-list/block.native.js index 4112d614da35fc..9f34195e50e040 100644 --- a/packages/block-editor/src/components/block-list/block.native.js +++ b/packages/block-editor/src/components/block-list/block.native.js @@ -320,7 +320,6 @@ function BlockListBlock( { name, fontSizes || EMPTY_ARRAY ); - // eslint-disable-next-line react-hooks/exhaustive-deps }, [ // It is crucial to keep the dependencies array minimal to prevent unnecessary calls that could negatively impact performance. // JSON.stringify is used for the following purposes: @@ -329,11 +328,8 @@ function BlockListBlock( { // 2. To filter the attributes object, ensuring that only the relevant attributes (included in // GlobalStylesContext.BLOCK_STYLE_ATTRIBUTES) are considered as dependencies. This reduces the likelihood of // unnecessary useMemo calls when other, unrelated attributes change. - // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify( globalStyle ), - // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify( wrapperProps?.style ), - // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify( Object.fromEntries( Object.entries( attributes ?? {} ).filter( ( [ key ] ) => diff --git a/packages/block-editor/src/components/inserter/block-patterns-tab/pattern-category-previews.js b/packages/block-editor/src/components/inserter/block-patterns-tab/pattern-category-previews.js index 835015704c944b..fcb6c7601fcf7f 100644 --- a/packages/block-editor/src/components/inserter/block-patterns-tab/pattern-category-previews.js +++ b/packages/block-editor/src/components/inserter/block-patterns-tab/pattern-category-previews.js @@ -117,7 +117,6 @@ export function PatternCategoryPreviews( { const { changePage } = pagingProps; // Hide block pattern preview on unmount. - // eslint-disable-next-line react-hooks/exhaustive-deps useEffect( () => () => onHover( null ), [] ); const onSetPatternSyncFilter = useCallback( diff --git a/packages/block-editor/src/components/list-view/index.js b/packages/block-editor/src/components/list-view/index.js index 87599ea870913b..d7961bd6c02f3d 100644 --- a/packages/block-editor/src/components/list-view/index.js +++ b/packages/block-editor/src/components/list-view/index.js @@ -185,8 +185,7 @@ function ListViewComponent( if ( selectedClientIds?.length ) { focusListItem( selectedClientIds[ 0 ], elementRef?.current ); } - // Disable reason: Only focus on the selected item when the list view is mounted. - // eslint-disable-next-line react-hooks/exhaustive-deps + // Only focus on the selected item when the list view is mounted. }, [] ); const expand = useCallback( diff --git a/packages/block-editor/src/components/rich-text/index.native.js b/packages/block-editor/src/components/rich-text/index.native.js index 4899d49b8c8eb0..687c2759c05de2 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -212,7 +212,6 @@ export function RichTextWrapper( selectionChangeEnd ); }, - // eslint-disable-next-line react-hooks/exhaustive-deps [ clientId, identifier ] ); @@ -368,7 +367,6 @@ export function RichTextWrapper( onChange( insert( value, '\n' ) ); } }, - // eslint-disable-next-line react-hooks/exhaustive-deps [ onReplace, onSplit, diff --git a/packages/block-editor/src/components/use-block-drop-zone/index.native.js b/packages/block-editor/src/components/use-block-drop-zone/index.native.js index 4f00880873c2fa..f40900ec7db970 100644 --- a/packages/block-editor/src/components/use-block-drop-zone/index.native.js +++ b/packages/block-editor/src/components/use-block-drop-zone/index.native.js @@ -132,7 +132,6 @@ export default function useBlockDropZone( { const getSortedBlocksLayouts = useCallback( () => { return getBlockLayoutsOrderedByYCoord( blocksLayouts.current ); // We use the value of `blocksLayouts` as the dependency. - // eslint-disable-next-line react-hooks/exhaustive-deps }, [ blocksLayouts.current ] ); const isRTL = getSettings().isRTL; diff --git a/packages/block-editor/src/components/use-moving-animation/index.js b/packages/block-editor/src/components/use-moving-animation/index.js index a6ac0968ca16fc..602b683150d0cc 100644 --- a/packages/block-editor/src/components/use-moving-animation/index.js +++ b/packages/block-editor/src/components/use-moving-animation/index.js @@ -61,7 +61,6 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) { previous: ref.current && getAbsolutePosition( ref.current ), prevRect: ref.current && ref.current.getBoundingClientRect(), } ), - // eslint-disable-next-line react-hooks/exhaustive-deps [ triggerAnimationOnChange ] ); diff --git a/packages/block-editor/src/components/use-settings/index.js b/packages/block-editor/src/components/use-settings/index.js index e356260c2d6b38..072653b913c304 100644 --- a/packages/block-editor/src/components/use-settings/index.js +++ b/packages/block-editor/src/components/use-settings/index.js @@ -32,7 +32,6 @@ export function useSettings( ...paths ) { clientId, ...paths ), - // eslint-disable-next-line react-hooks/exhaustive-deps [ clientId, ...paths ] ); } diff --git a/packages/block-editor/src/hooks/contrast-checker.js b/packages/block-editor/src/hooks/contrast-checker.js index 6e503ae8f3319d..368e2e75264858 100644 --- a/packages/block-editor/src/hooks/contrast-checker.js +++ b/packages/block-editor/src/hooks/contrast-checker.js @@ -21,7 +21,6 @@ export default function BlockColorContrastChecker( { clientId } ) { // There are so many things that can change the color of a block // So we perform this check on every render. - // eslint-disable-next-line react-hooks/exhaustive-deps useEffect( () => { if ( ! blockEl ) { return; diff --git a/packages/block-library/src/cover/edit/index.js b/packages/block-library/src/cover/edit/index.js index 88a47f566987c6..77ce9e62d9eb09 100644 --- a/packages/block-library/src/cover/edit/index.js +++ b/packages/block-library/src/cover/edit/index.js @@ -152,8 +152,7 @@ function CoverEdit( { isUserOverlayColor: isUserOverlayColor || false, } ); } )(); - // Disable reason: Update the block only when the featured image changes. - // eslint-disable-next-line react-hooks/exhaustive-deps + // Update the block only when the featured image changes. }, [ mediaUrl ] ); // instead of destructuring the attributes diff --git a/packages/block-library/src/file/edit.js b/packages/block-library/src/file/edit.js index be061d357bffd1..59e660dd3211f1 100644 --- a/packages/block-library/src/file/edit.js +++ b/packages/block-library/src/file/edit.js @@ -103,8 +103,7 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) { downloadButtonText: _x( 'Download', 'button label' ), } ); } - // Reason: This effect should only run on mount. - // eslint-disable-next-line react-hooks/exhaustive-deps + // This effect should only run on mount. }, [] ); function onSelectFile( newMedia ) { diff --git a/packages/block-library/src/social-links/edit.js b/packages/block-library/src/social-links/edit.js index d4dfae70aac5ae..068b34a3a70a4e 100644 --- a/packages/block-library/src/social-links/edit.js +++ b/packages/block-library/src/social-links/edit.js @@ -86,7 +86,6 @@ export function SocialLinksEdit( props ) { } else { setAttributes( { ...backgroundBackupRef.current } ); } - // eslint-disable-next-line react-hooks/exhaustive-deps }, [ logosOnly ] ); const SocialPlaceholder = ( diff --git a/packages/data/src/components/use-select/index.js b/packages/data/src/components/use-select/index.js index a0073d7e847fc2..3e28e9489e977e 100644 --- a/packages/data/src/components/use-select/index.js +++ b/packages/data/src/components/use-select/index.js @@ -223,7 +223,6 @@ function useMappingSelect( suspense, mapSelect, deps ) { // These are "pass-through" dependencies from the parent hook, // and the parent should catch any hook rule violations. - // eslint-disable-next-line react-hooks/exhaustive-deps const selector = useCallback( mapSelect, deps ); const { subscribe, getValue } = store( selector, isAsync ); const result = useSyncExternalStore( subscribe, getValue, getValue ); diff --git a/packages/edit-site/src/components/block-editor/use-site-editor-settings.js b/packages/edit-site/src/components/block-editor/use-site-editor-settings.js index e6dd0368249627..37fa0a2eaf30c2 100644 --- a/packages/edit-site/src/components/block-editor/use-site-editor-settings.js +++ b/packages/edit-site/src/components/block-editor/use-site-editor-settings.js @@ -29,10 +29,9 @@ function useNavigateToPreviousEntityRecord() { previousLocation?.params.canvas === 'edit'; const showBackButton = isFocusMode && didComeFromEditorCanvas; return showBackButton ? () => history.back() : undefined; - // Disable reason: previousLocation changes when the component updates for any reason, not + // `previousLocation` changes when the component updates for any reason, not // just when location changes. Until this is fixed we can't add it to deps. See // https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465. - // eslint-disable-next-line react-hooks/exhaustive-deps }, [ location, history ] ); return goBack; } diff --git a/packages/edit-site/src/components/layout/animation.js b/packages/edit-site/src/components/layout/animation.js index 0dc6c61b165aad..00f6eb01a6f1a0 100644 --- a/packages/edit-site/src/components/layout/animation.js +++ b/packages/edit-site/src/components/layout/animation.js @@ -41,7 +41,6 @@ function useMovingAnimation( { triggerAnimationOnChange } ) { previous: ref.current && getAbsolutePosition( ref.current ), prevRect: ref.current && ref.current.getBoundingClientRect(), } ), - // eslint-disable-next-line react-hooks/exhaustive-deps [ triggerAnimationOnChange ] ); diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js index 12799f46fbe348..713b1f179b7adb 100644 --- a/packages/edit-site/src/components/layout/index.js +++ b/packages/edit-site/src/components/layout/index.js @@ -75,7 +75,6 @@ export default function Layout( { route } ) { toggleRef.current?.focus(); } // Should not depend on the previous canvas mode value but the next. - // eslint-disable-next-line react-hooks/exhaustive-deps }, [ canvas ] ); return ( diff --git a/packages/edit-widgets/src/components/sidebar/index.js b/packages/edit-widgets/src/components/sidebar/index.js index 79a47b18c7bf12..a42a6d7c4be7a4 100644 --- a/packages/edit-widgets/src/components/sidebar/index.js +++ b/packages/edit-widgets/src/components/sidebar/index.js @@ -88,7 +88,6 @@ function SidebarContent( { // We're intentionally leaving `currentArea` and `isGeneralSidebarOpen` // out of the dep array because we want this effect to run based on // block selection changes, not sidebar state changes. - // eslint-disable-next-line react-hooks/exhaustive-deps }, [ hasSelectedNonAreaBlock, enableComplementaryArea ] ); const tabsContextValue = useContext( Tabs.Context );