chore: remove React 16.4's obsolete React imports (#28571)

Signed-off-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
Đỗ Trọng Hải
2024-06-05 18:13:24 +07:00
committed by GitHub
parent 8a8ce16a1f
commit 0ca42a8e4d
1173 changed files with 1360 additions and 1880 deletions

View File

@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { render, screen, fireEvent } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/react';
@@ -29,7 +28,7 @@ const createProps = (): Partial<PopoverProps> => ({
content: <span data-test="control-popover-content">Information</span>,
});
const TestComponent: React.FC<PopoverProps> = props => (
const TestComponent: globalThis.React.FC<PopoverProps> = props => (
<div id="controlSections">
<div data-test="outer-container">
<ControlPopover {...props}>
@@ -42,7 +41,7 @@ const TestComponent: React.FC<PopoverProps> = props => (
const setupTest = (props: Partial<PopoverProps> = createProps()) => {
const setStateMock = jest.fn();
jest
.spyOn(React, 'useState')
.spyOn(global.React, 'useState')
.mockImplementation(((state: any) => [
state,
state === 'right' ? setStateMock : jest.fn(),

View File

@@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { useCallback, useRef, useEffect, useState } from 'react';
// eslint-disable-next-line no-restricted-syntax -- whole React import is required for `ControlPopover.test.tsx` Jest test passing.
import React, { FC, useCallback, useRef, useEffect, useState } from 'react';
import Popover, {
PopoverProps as BasePopoverProps,
@@ -41,7 +42,7 @@ export type PopoverProps = BasePopoverProps & {
getVisibilityRatio?: typeof getElementYVisibilityRatioOnContainer;
};
const ControlPopover: React.FC<PopoverProps> = ({
const ControlPopover: FC<PopoverProps> = ({
getPopupContainer,
getVisibilityRatio = getElementYVisibilityRatioOnContainer,
visible: visibleProp,