Merge pull request #29499 from schultzp2020/react-imports

chore: update react imports
This commit is contained in:
Patrik Oldsberg
2025-04-08 18:52:18 +02:00
committed by GitHub
1342 changed files with 2644 additions and 3440 deletions
+3 -7
View File
@@ -10,7 +10,7 @@ import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
import { ExtensionInput } from '@backstage/frontend-plugin-api';
import { FrontendPlugin } from '@backstage/frontend-plugin-api';
import { IconComponent } from '@backstage/core-plugin-api';
import { default as React_2 } from 'react';
import { JSX as JSX_2 } from 'react';
import { RouteRef } from '@backstage/frontend-plugin-api';
import { SearchFilterExtensionComponent } from '@backstage/plugin-search-react/alpha';
import { SearchResultItemExtensionComponent } from '@backstage/plugin-search-react/alpha';
@@ -71,11 +71,7 @@ const _default: FrontendPlugin<
path?: string | undefined;
};
output:
| ConfigurableExtensionDataRef<
React_2.JSX.Element,
'core.reactElement',
{}
>
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
| ConfigurableExtensionDataRef<string, 'core.routing.path', {}>
| ConfigurableExtensionDataRef<
RouteRef<AnyRouteRefParams>,
@@ -189,7 +185,7 @@ export const searchPage: ExtensionDefinition<{
path?: string | undefined;
};
output:
| ConfigurableExtensionDataRef<React_2.JSX.Element, 'core.reactElement', {}>
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
| ConfigurableExtensionDataRef<string, 'core.routing.path', {}>
| ConfigurableExtensionDataRef<
RouteRef<AnyRouteRefParams>,
+8 -9
View File
@@ -5,8 +5,7 @@
```ts
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { IconComponent } from '@backstage/core-plugin-api';
import { JSX as JSX_2 } from 'react';
import { default as React_2 } from 'react';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { ReactNode } from 'react';
import { RouteRef } from '@backstage/core-plugin-api';
import { SearchBarBaseProps } from '@backstage/plugin-search-react';
@@ -23,10 +22,10 @@ export type HomePageSearchBarProps = Partial<
>;
// @public (undocumented)
export const Router: () => React_2.JSX.Element;
export const Router: () => JSX_2.Element;
// @public (undocumented)
export const SearchModal: (props: SearchModalProps) => React_2.JSX.Element;
export const SearchModal: (props: SearchModalProps) => JSX_2.Element;
// @public (undocumented)
export interface SearchModalChildrenProps {
@@ -48,7 +47,7 @@ export interface SearchModalProps {
// @public
export const SearchModalProvider: (
props: SearchModalProviderProps,
) => React_2.JSX.Element;
) => JSX_2.Element;
// @public
export type SearchModalProviderProps = {
@@ -81,9 +80,9 @@ export { searchPlugin };
// @public (undocumented)
export const SearchType: {
(props: SearchTypeProps): React_2.JSX.Element;
Accordion(props: SearchTypeAccordionProps): React_2.JSX.Element;
Tabs(props: SearchTypeTabsProps): React_2.JSX.Element;
(props: SearchTypeProps): JSX_2.Element;
Accordion(props: SearchTypeAccordionProps): JSX_2.Element;
Tabs(props: SearchTypeTabsProps): JSX_2.Element;
};
// @public (undocumented)
@@ -116,7 +115,7 @@ export type SearchTypeTabsProps = {
};
// @public (undocumented)
export const SidebarSearch: (props: SidebarSearchProps) => React_2.JSX.Element;
export const SidebarSearch: (props: SidebarSearchProps) => JSX_2.Element;
// @public (undocumented)
export const SidebarSearchModal: (
-2
View File
@@ -14,8 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import Grid from '@material-ui/core/Grid';
import Paper from '@material-ui/core/Paper';
import { makeStyles, Theme } from '@material-ui/core/styles';
@@ -19,7 +19,7 @@ import { searchApiRef } from '@backstage/plugin-search-react';
import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils';
import Grid from '@material-ui/core/Grid';
import { makeStyles } from '@material-ui/core/styles';
import React, { ComponentType, PropsWithChildren } from 'react';
import { ComponentType, PropsWithChildren } from 'react';
export default {
title: 'Plugins/Home/Components/SearchBar',
@@ -14,8 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useCallback, useRef, useState } from 'react';
import { useCallback, useRef, useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import {
SearchBarBase,
@@ -33,7 +33,7 @@ import IconButton from '@material-ui/core/IconButton';
import List from '@material-ui/core/List';
import { makeStyles } from '@material-ui/core/styles';
import CloseIcon from '@material-ui/icons/Close';
import React, { ComponentType, PropsWithChildren } from 'react';
import { ComponentType, PropsWithChildren } from 'react';
import { rootRouteRef } from '../../plugin';
import { SearchType } from '../SearchType';
import { SearchModal } from './SearchModal';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils';
import userEvent from '@testing-library/user-event';
@@ -34,7 +34,7 @@ import IconButton from '@material-ui/core/IconButton';
import { makeStyles } from '@material-ui/core/styles';
import ArrowForwardIcon from '@material-ui/icons/ArrowForward';
import CloseIcon from '@material-ui/icons/Close';
import React, { ReactNode, useCallback, useEffect, useRef } from 'react';
import { ReactNode, useCallback, useEffect, useRef } from 'react';
import { useNavigate } from 'react-router-dom';
import { rootRouteRef } from '../../plugin';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { PropsWithChildren } from 'react';
import { act, renderHook } from '@testing-library/react';
import { useSearchModal } from './useSearchModal';
import { BrowserRouter, Router } from 'react-router-dom';
@@ -85,7 +85,7 @@ describe('useSearchModal', () => {
const history = createMemoryHistory({ initialEntries: ['/'] });
const rendered = renderHook(() => useSearchModal(true), {
wrapper: ({ children }: React.PropsWithChildren<{}>) => (
wrapper: ({ children }: PropsWithChildren<{}>) => (
<Router location={history.location} navigator={history}>
{children}
</Router>
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ReactNode, useCallback, useContext, useState } from 'react';
import { ReactNode, useCallback, useContext, useState } from 'react';
import { useLocation } from 'react-router-dom';
import {
createVersionedContext,
@@ -15,7 +15,6 @@
*/
import { renderInTestApp } from '@backstage/test-utils';
import React from 'react';
import { useLocation } from 'react-router-dom';
import { useSearch } from '@backstage/plugin-search-react';
import { SearchPage } from './SearchPage';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useEffect } from 'react';
import { useEffect } from 'react';
import usePrevious from 'react-use/esm/usePrevious';
import qs from 'qs';
import { useLocation, useOutlet } from 'react-router-dom';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { mockApis, TestApiProvider } from '@backstage/test-utils';
import { act, render, waitFor } from '@testing-library/react';
import user from '@testing-library/user-event';
@@ -67,7 +67,7 @@ describe('SearchType.Accordion', () => {
});
});
const Wrapper = ({ children }: { children: React.ReactNode }) => {
const Wrapper = ({ children }: { children: ReactNode }) => {
return (
<TestApiProvider
apis={[
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { cloneElement, Fragment, useEffect, useState } from 'react';
import { cloneElement, Fragment, useEffect, useState } from 'react';
import { useApi } from '@backstage/core-plugin-api';
import { searchApiRef, useSearch } from '@backstage/plugin-search-react';
import Accordion from '@material-ui/core/Accordion';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { mockApis, TestApiProvider } from '@backstage/test-utils';
import { act, render } from '@testing-library/react';
import user from '@testing-library/user-event';
@@ -55,7 +55,7 @@ describe('SearchType.Tabs', () => {
name: 'Expected Type',
};
const Wrapper = ({ children }: { children: React.ReactNode }) => {
const Wrapper = ({ children }: { children: ReactNode }) => {
return (
<TestApiProvider
apis={[
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useEffect } from 'react';
import { ChangeEvent, useEffect } from 'react';
import { useSearch } from '@backstage/plugin-search-react';
import Tab from '@material-ui/core/Tab';
import Tabs from '@material-ui/core/Tabs';
@@ -50,7 +50,7 @@ export const SearchTypeTabs = (props: SearchTypeTabsProps) => {
const { setPageCursor, setTypes, types } = useSearch();
const { defaultValue, types: givenTypes } = props;
const changeTab = (_: React.ChangeEvent<{}>, newType: string) => {
const changeTab = (_: ChangeEvent<{}>, newType: string) => {
setTypes(newType !== '' ? [newType] : []);
setPageCursor(undefined);
};
@@ -19,7 +19,7 @@ import Paper from '@material-ui/core/Paper';
import CatalogIcon from '@material-ui/icons/MenuBook';
import DocsIcon from '@material-ui/icons/Description';
import UsersGroupsIcon from '@material-ui/icons/Person';
import React, { ComponentType, PropsWithChildren } from 'react';
import { ComponentType, PropsWithChildren } from 'react';
import { SearchType } from './SearchType';
import { TestApiProvider } from '@backstage/test-utils';
import {
@@ -17,7 +17,6 @@
import { configApiRef } from '@backstage/core-plugin-api';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
import {
SearchContextProvider,
searchApiRef,
@@ -21,7 +21,7 @@ import ListItemText from '@material-ui/core/ListItemText';
import MenuItem from '@material-ui/core/MenuItem';
import Select from '@material-ui/core/Select';
import { makeStyles } from '@material-ui/core/styles';
import React, { ChangeEvent } from 'react';
import { ChangeEvent } from 'react';
import useEffectOnce from 'react-use/esm/useEffectOnce';
import {
SearchTypeAccordion,
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import qs from 'qs';
import React, { useCallback } from 'react';
import { useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { rootRouteRef } from '../../plugin';
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import SearchIcon from '@material-ui/icons/Search';
import { SidebarItem } from '@backstage/core-components';
import { IconComponent } from '@backstage/core-plugin-api';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { renderInTestApp } from '@backstage/test-utils';
import { useNavigateToQuery } from './util';
import { rootRouteRef } from '../plugin';