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

@@ -17,7 +17,6 @@
* under the License.
*/
import React from 'react';
import { render, screen } from 'spec/helpers/testing-library';
import { ErrorLevel, supersetTheme } from '@superset-ui/core';
import BasicErrorAlert from './BasicErrorAlert';

View File

@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { ErrorLevel, styled, useTheme } from '@superset-ui/core';
import Icons from 'src/components/Icons';

View File

@@ -17,7 +17,6 @@
* under the License.
*/
import React from 'react';
import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core';
import { render, screen } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';

View File

@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { t, tn } from '@superset-ui/core';
import { ErrorMessageComponentProps } from './types';
@@ -47,7 +47,7 @@ function DatabaseErrorMessage({
{t('This may be triggered by:')}
<br />
{extra.issue_codes
?.map<React.ReactNode>(issueCode => (
?.map<ReactNode>(issueCode => (
<IssueCode {...issueCode} key={issueCode.code} />
))
.reduce((prev, curr) => [prev, <br />, curr])}

View File

@@ -17,7 +17,6 @@
* under the License.
*/
import React from 'react';
import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core';
import { render, screen } from 'spec/helpers/testing-library';
import DatasetNotFoundErrorMessage from './DatasetNotFoundErrorMessage';

View File

@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { t } from '@superset-ui/core';
import { ErrorMessageComponentProps } from './types';

View File

@@ -17,7 +17,6 @@
* under the License.
*/
import React from 'react';
import userEvent from '@testing-library/user-event';
import { render, screen } from 'spec/helpers/testing-library';
import { ErrorLevel, ErrorSource, supersetTheme } from '@superset-ui/core';

View File

@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { useState, ReactNode } from 'react';
import { useState, ReactNode } from 'react';
import {
ErrorLevel,
ErrorSource,

View File

@@ -17,7 +17,6 @@
* under the License.
*/
import React from 'react';
import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core';
import { render, screen } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';

View File

@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { ErrorSource, t, SupersetError } from '@superset-ui/core';
import getErrorMessageComponentRegistry from './getErrorMessageComponentRegistry';
import ErrorAlert from './ErrorAlert';
@@ -27,13 +27,13 @@ type Props = {
title?: string;
error?: SupersetError;
link?: string;
subtitle?: React.ReactNode;
subtitle?: ReactNode;
copyText?: string;
stackTrace?: string;
source?: ErrorSource;
description?: string;
errorMitigationFunction?: () => void;
fallback?: React.ReactNode;
fallback?: ReactNode;
};
export default function ErrorMessageWithStackTrace({

View File

@@ -17,7 +17,6 @@
* under the License.
*/
import React from 'react';
import { render, screen } from 'spec/helpers/testing-library';
import IssueCode from './IssueCode';

View File

@@ -16,8 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
interface IssueCodeProps {
code: number;
message: string;

View File

@@ -17,7 +17,6 @@
* under the License.
*/
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import {

View File

@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { JSONTree } from 'react-json-tree';
import { css, styled, SupersetTheme, t } from '@superset-ui/core';

View File

@@ -17,7 +17,6 @@
* under the License.
*/
import React from 'react';
import * as reduxHooks from 'react-redux';
import { Provider } from 'react-redux';
import { createStore } from 'redux';

View File

@@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { useEffect, useRef } from 'react';
import { useEffect, useRef, MouseEvent } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { QueryEditor, SqlLabRootState } from 'src/SqlLab/types';
import { ExplorePageState } from 'src/explore/types';
@@ -67,7 +68,7 @@ function OAuth2RedirectMessage({
// store a reference to the OAuth2 browser tab, so we can check that the success
// message is coming from it
const handleOAuthClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
const handleOAuthClick = (event: MouseEvent<HTMLAnchorElement>) => {
event.preventDefault();
oAuthTab.current = window.open(extra.url, '_blank');
};

View File

@@ -19,7 +19,6 @@
import userEvent from '@testing-library/user-event';
import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core';
import React from 'react';
import { render, screen } from 'spec/helpers/testing-library';
import ParameterErrorMessage from './ParameterErrorMessage';

View File

@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { t, tn } from '@superset-ui/core';
import levenshtein from 'js-levenshtein';
@@ -101,7 +101,7 @@ function ParameterErrorMessage({
<br />
{extra.issue_codes.length > 0 &&
extra.issue_codes
.map<React.ReactNode>(issueCode => <IssueCode {...issueCode} />)
.map<ReactNode>(issueCode => <IssueCode {...issueCode} />)
.reduce((prev, curr) => [prev, <br />, curr])}
</p>
</>

View File

@@ -18,7 +18,6 @@
*/
import userEvent from '@testing-library/user-event';
import React from 'react';
import { ErrorSource, ErrorTypeEnum, ErrorLevel } from '@superset-ui/core';
import { render, screen } from 'spec/helpers/testing-library';
import TimeoutErrorMessage from './TimeoutErrorMessage';

View File

@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { t, tn } from '@superset-ui/core';
import { ErrorMessageComponentProps } from './types';
@@ -62,7 +62,7 @@ function TimeoutErrorMessage({
{t('This may be triggered by:')}
<br />
{extra.issue_codes
.map<React.ReactNode>(issueCode => <IssueCode {...issueCode} />)
.map<ReactNode>(issueCode => <IssueCode {...issueCode} />)
.reduce((prev, curr) => [prev, <br />, curr])}
</p>
{isVisualization && extra.owners && (

View File

@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import getErrorMessageComponentRegistry from 'src/components/ErrorMessage/getErrorMessageComponentRegistry';
import { ErrorMessageComponentProps } from 'src/components/ErrorMessage/types';