chore: turn on correctness.useHookAtTopLevel (#55110)

This commit is contained in:
thinkasany
2025-09-21 13:26:25 +08:00
committed by GitHub
parent cb0dd956ba
commit b138cadf40
3 changed files with 4 additions and 2 deletions

View File

@@ -52,7 +52,6 @@
"correctness": {
"useUniqueElementIds": "off",
"useExhaustiveDependencies": "off",
"useHookAtTopLevel": "off",
"noUnusedFunctionParameters": "off",
"noUnusedVariables": "off"
},

View File

@@ -92,10 +92,12 @@ const InternalForm: React.ForwardRefRenderFunction<FormRef, FormProps> = (props,
const contextValidateMessages = React.useContext(ValidateMessagesContext);
/* eslint-disable react-hooks/rules-of-hooks */
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line react-hooks/rules-of-hooks
// biome-ignore lint/correctness/useHookAtTopLevel: Development-only warning hook called conditionally
useFormWarning(props);
}
/* eslint-enable */
const mergedRequiredMark = React.useMemo(() => {
if (requiredMark !== undefined) {

View File

@@ -120,6 +120,7 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Input');
// biome-ignore lint/correctness/useHookAtTopLevel: Development-only warning hook called conditionally
useEffect(() => {
if (inputHasPrefixSuffix && !prevHasPrefixSuffix.current) {
warning(