Skip to content

Commit

Permalink
ESLint: suppress react-hooks/rules-of-hooks for experimental components
Browse files Browse the repository at this point in the history
  • Loading branch information
shvlv committed Oct 14, 2024
1 parent 8cbd764 commit f9195af
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function VariationsToggleGroupControl( {
);
}

/* eslint-disable react-hooks/rules-of-hooks */
function __experimentalBlockVariationTransforms( { blockClientId } ) {
const { updateBlockAttributes } = useDispatch( blockEditorStore );
const { activeBlockVariation, variations, isContentOnly } = useSelect(
Expand Down Expand Up @@ -215,5 +216,6 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
/>
);
}
/* eslint-enable react-hooks/rules-of-hooks */

export default __experimentalBlockVariationTransforms;
2 changes: 2 additions & 0 deletions packages/block-editor/src/components/copy-handler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import deprecated from '@wordpress/deprecated';
*/
import useClipboardHandler from '../writing-flow/use-clipboard-handler';

/* eslint-disable react-hooks/rules-of-hooks */
/**
* @deprecated
*/
Expand All @@ -19,6 +20,7 @@ export const __unstableUseClipboardHandler = () => {
} );
return useClipboardHandler();
};
/* eslint-enable react-hooks/rules-of-hooks */

/**
* @deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function getGradientSlugByValue( gradients, value ) {
return gradient && gradient.slug;
}

/* eslint-disable react-hooks/rules-of-hooks */
export function __experimentalUseGradient( {
gradientAttribute = 'gradient',
customGradientAttribute = 'customGradient',
Expand Down Expand Up @@ -120,3 +121,4 @@ export function __experimentalUseGradient( {
}
return { gradientClass, gradientValue, setGradient };
}
/* eslint-enable react-hooks/rules-of-hooks */
2 changes: 2 additions & 0 deletions packages/block-editor/src/components/rich-text/input-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useEffect, useContext, useRef } from '@wordpress/element';
*/
import { inputEventContext } from './';

/* eslint-disable react-hooks/rules-of-hooks */
export function __unstableRichTextInputEvent( { inputType, onInput } ) {
const callbacks = useContext( inputEventContext );
const onInputRef = useRef();
Expand All @@ -29,3 +30,4 @@ export function __unstableRichTextInputEvent( { inputType, onInput } ) {

return null;
}
/* eslint-enable react-hooks/rules-of-hooks */
2 changes: 2 additions & 0 deletions packages/block-editor/src/hooks/block-style-variation.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function OverrideStyles( { override } ) {
usePrivateStyleOverride( override );
}

/* eslint-disable react-hooks/rules-of-hooks */
/**
* This component is used to generate new block style variation overrides
* based on an incoming theme config. If a matching style is found in the config,
Expand Down Expand Up @@ -180,6 +181,7 @@ export function __unstableBlockStyleVariationOverridesWithConfig( { config } ) {
</>
);
}
/* eslint-enable react-hooks/rules-of-hooks */

/**
* Retrieves any variation styles data and resolves any referenced values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const CustomSelectButton = ( {
);
};

/* eslint-disable react-hooks/rules-of-hooks */
function _CustomSelect(
props: _CustomSelectInternalProps &
_CustomSelectProps &
Expand Down Expand Up @@ -157,5 +158,6 @@ function _CustomSelect(
</div>
);
}
/* eslint-enable react-hooks/rules-of-hooks */

export default _CustomSelect;
2 changes: 2 additions & 0 deletions packages/core-data/src/hooks/use-entity-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export default function useEntityRecord< RecordType >(
};
}

/* eslint-disable react-hooks/rules-of-hooks */
export function __experimentalUseEntityRecord(
kind: string,
name: string,
Expand All @@ -233,3 +234,4 @@ export function __experimentalUseEntityRecord(
} );
return useEntityRecord( kind, name, recordId, options );
}
/* eslint-enable react-hooks/rules-of-hooks */
2 changes: 2 additions & 0 deletions packages/core-data/src/hooks/use-entity-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export default function useEntityRecords< RecordType >(
};
}

/* eslint-disable react-hooks/rules-of-hooks */
export function __experimentalUseEntityRecords(
kind: string,
name: string,
Expand All @@ -154,6 +155,7 @@ export function __experimentalUseEntityRecords(
} );
return useEntityRecords( kind, name, queryArgs, options );
}
/* eslint-enable react-hooks/rules-of-hooks */

export function useEntityRecordsWithPermissions< RecordType >(
kind: string,
Expand Down
2 changes: 2 additions & 0 deletions packages/core-data/src/hooks/use-resource-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ function useResourcePermissions< IdType = void >(

export default useResourcePermissions;

/* eslint-disable react-hooks/rules-of-hooks */
export function __experimentalUseResourcePermissions(
resource: string,
id?: unknown
Expand All @@ -219,3 +220,4 @@ export function __experimentalUseResourcePermissions(
} );
return useResourcePermissions( resource, id );
}
/* eslint-enable react-hooks/rules-of-hooks */

0 comments on commit f9195af

Please sign in to comment.