Skip to content

Commit f6a166b

Browse files
committed
ESLint: suppress react-hooks/rules-of-hooks for experimental components
See facebook/react#25162
1 parent f2cd6bb commit f6a166b

File tree

10 files changed

+20
-0
lines changed

10 files changed

+20
-0
lines changed

packages/block-editor/src/components/block-variation-transforms/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ function VariationsToggleGroupControl( {
138138
);
139139
}
140140

141+
/* eslint-disable react-hooks/rules-of-hooks */
141142
function __experimentalBlockVariationTransforms( { blockClientId } ) {
142143
const { updateBlockAttributes } = useDispatch( blockEditorStore );
143144
const { activeBlockVariation, variations } = useSelect(
@@ -206,5 +207,6 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
206207
/>
207208
);
208209
}
210+
/* eslint-enable react-hooks/rules-of-hooks */
209211

210212
export default __experimentalBlockVariationTransforms;

packages/block-editor/src/components/copy-handler/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import deprecated from '@wordpress/deprecated';
88
*/
99
import useClipboardHandler from '../writing-flow/use-clipboard-handler';
1010

11+
/* eslint-disable react-hooks/rules-of-hooks */
1112
/**
1213
* @deprecated
1314
*/
@@ -19,6 +20,7 @@ export const __unstableUseClipboardHandler = () => {
1920
} );
2021
return useClipboardHandler();
2122
};
23+
/* eslint-enable react-hooks/rules-of-hooks */
2224

2325
/**
2426
* @deprecated

packages/block-editor/src/components/gradients/use-gradient.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export function getGradientSlugByValue( gradients, value ) {
5454
return gradient && gradient.slug;
5555
}
5656

57+
/* eslint-disable react-hooks/rules-of-hooks */
5758
export function __experimentalUseGradient( {
5859
gradientAttribute = 'gradient',
5960
customGradientAttribute = 'customGradient',
@@ -120,3 +121,4 @@ export function __experimentalUseGradient( {
120121
}
121122
return { gradientClass, gradientValue, setGradient };
122123
}
124+
/* eslint-enable react-hooks/rules-of-hooks */

packages/block-editor/src/components/rich-text/input-event.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useEffect, useContext, useRef } from '@wordpress/element';
88
*/
99
import { inputEventContext } from './';
1010

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

3031
return null;
3132
}
33+
/* eslint-enable react-hooks/rules-of-hooks */

packages/block-editor/src/hooks/block-style-variation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function OverrideStyles( { override } ) {
6666
usePrivateStyleOverride( override );
6767
}
6868

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

184186
/**
185187
* Retrieves any variation styles data and resolves any referenced values.

packages/components/src/custom-select-control-v2/custom-select.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const CustomSelectButton = ( {
8282
);
8383
};
8484

85+
/* eslint-disable react-hooks/rules-of-hooks */
8586
function _CustomSelect(
8687
props: _CustomSelectInternalProps &
8788
_CustomSelectProps &
@@ -157,5 +158,6 @@ function _CustomSelect(
157158
</div>
158159
);
159160
}
161+
/* eslint-enable react-hooks/rules-of-hooks */
160162

161163
export default _CustomSelect;

packages/compose/src/hooks/use-resize-observer/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import _useLegacyResizeObserver from './_legacy';
1313
*/
1414
import type { ReactElement } from 'react';
1515

16+
/* eslint-disable react-hooks/rules-of-hooks */
1617
// This is the current implementation of `useResizeObserver`.
1718
//
1819
// The legacy implementation is still supported for backwards compatibility.
@@ -47,6 +48,7 @@ function _useResizeObserver< T extends HTMLElement >(
4748
}
4849
} );
4950
}
51+
/* eslint-enable react-hooks/rules-of-hooks */
5052

5153
/**
5254
* Sets up a [`ResizeObserver`](https://developer.mozilla.org/en-US/docs/Web/API/Resize_Observer_API)

packages/core-data/src/hooks/use-entity-record.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export default function useEntityRecord< RecordType >(
221221
};
222222
}
223223

224+
/* eslint-disable react-hooks/rules-of-hooks */
224225
export function __experimentalUseEntityRecord(
225226
kind: string,
226227
name: string,
@@ -233,3 +234,4 @@ export function __experimentalUseEntityRecord(
233234
} );
234235
return useEntityRecord( kind, name, recordId, options );
235236
}
237+
/* eslint-enable react-hooks/rules-of-hooks */

packages/core-data/src/hooks/use-entity-records.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export default function useEntityRecords< RecordType >(
142142
};
143143
}
144144

145+
/* eslint-disable react-hooks/rules-of-hooks */
145146
export function __experimentalUseEntityRecords(
146147
kind: string,
147148
name: string,
@@ -154,6 +155,7 @@ export function __experimentalUseEntityRecords(
154155
} );
155156
return useEntityRecords( kind, name, queryArgs, options );
156157
}
158+
/* eslint-enable react-hooks/rules-of-hooks */
157159

158160
export function useEntityRecordsWithPermissions< RecordType >(
159161
kind: string,

packages/core-data/src/hooks/use-resource-permissions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ function useResourcePermissions< IdType = void >(
209209

210210
export default useResourcePermissions;
211211

212+
/* eslint-disable react-hooks/rules-of-hooks */
212213
export function __experimentalUseResourcePermissions(
213214
resource: string,
214215
id?: unknown
@@ -219,3 +220,4 @@ export function __experimentalUseResourcePermissions(
219220
} );
220221
return useResourcePermissions( resource, id );
221222
}
223+
/* eslint-enable react-hooks/rules-of-hooks */

0 commit comments

Comments
 (0)