From 60c2ec168df5fbef558c5819dbf2ed270a03d57e Mon Sep 17 00:00:00 2001 From: Mark Dunphy Date: Tue, 8 Apr 2025 13:20:53 -0400 Subject: [PATCH] remove React imports and run api reports Signed-off-by: Mark Dunphy --- plugins/catalog-react/report-alpha.api.md | 14 +++++--------- .../EntityContextMenuItemBlueprint.test.tsx | 2 -- .../blueprints/EntityContextMenuItemBlueprint.tsx | 8 ++++---- .../src/hooks/useEntityContextMenu.test.tsx | 4 ++-- plugins/catalog/report.api.md | 4 ++-- plugins/catalog/src/alpha/contextMenuItems.tsx | 4 ++-- .../src/context/EntityContextMenuContext.tsx | 4 ++-- 7 files changed, 17 insertions(+), 23 deletions(-) diff --git a/plugins/catalog-react/report-alpha.api.md b/plugins/catalog-react/report-alpha.api.md index e70fc34ed8..b9a064043c 100644 --- a/plugins/catalog-react/report-alpha.api.md +++ b/plugins/catalog-react/report-alpha.api.md @@ -11,7 +11,7 @@ import { ExtensionBlueprint } from '@backstage/frontend-plugin-api'; import { ExtensionDefinition } from '@backstage/frontend-plugin-api'; import { JsonValue } from '@backstage/types'; import { JSX as JSX_2 } from 'react'; -import { default as React_2 } from 'react'; +import { ReactNode } from 'react'; import { ResourcePermission } from '@backstage/plugin-permission-common'; import { RouteRef } from '@backstage/frontend-plugin-api'; import { TranslationRef } from '@backstage/core-plugin-api/alpha'; @@ -331,11 +331,7 @@ export const EntityContextMenuItemBlueprint: ExtensionBlueprint<{ kind: 'entity-context-menu-item'; name: undefined; params: EntityContextMenuItemParams; - output: ConfigurableExtensionDataRef< - React_2.JSX.Element, - 'core.reactElement', - {} - >; + output: ConfigurableExtensionDataRef; inputs: {}; config: {}; configInput: {}; @@ -345,7 +341,7 @@ export const EntityContextMenuItemBlueprint: ExtensionBlueprint<{ // @alpha (undocumented) export type EntityContextMenuItemParams = { useProps: UseProps; - icon: React_2.JSX.Element; + icon: JSX_2.Element; }; // @alpha (undocumented) @@ -431,12 +427,12 @@ export function useEntityPermission( // @alpha (undocumented) export type UseProps = () => | { - title: React_2.ReactNode; + title: ReactNode; href: string; disabled?: boolean; } | { - title: React_2.ReactNode; + title: ReactNode; onClick: () => void | Promise; disabled?: boolean; }; diff --git a/plugins/catalog-react/src/alpha/blueprints/EntityContextMenuItemBlueprint.test.tsx b/plugins/catalog-react/src/alpha/blueprints/EntityContextMenuItemBlueprint.test.tsx index 29d6cc11d8..3bdfc00db7 100644 --- a/plugins/catalog-react/src/alpha/blueprints/EntityContextMenuItemBlueprint.test.tsx +++ b/plugins/catalog-react/src/alpha/blueprints/EntityContextMenuItemBlueprint.test.tsx @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React from 'react'; import { EntityContextMenuItemBlueprint } from './EntityContextMenuItemBlueprint'; describe('EntityContextMenuItemBlueprint', () => { diff --git a/plugins/catalog-react/src/alpha/blueprints/EntityContextMenuItemBlueprint.tsx b/plugins/catalog-react/src/alpha/blueprints/EntityContextMenuItemBlueprint.tsx index 43bf4213f9..f43dd6a6d9 100644 --- a/plugins/catalog-react/src/alpha/blueprints/EntityContextMenuItemBlueprint.tsx +++ b/plugins/catalog-react/src/alpha/blueprints/EntityContextMenuItemBlueprint.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import React from 'react'; +import { ReactNode, JSX } from 'react'; import { coreExtensionData, createExtensionBlueprint, @@ -28,12 +28,12 @@ import { useEntityContextMenu } from '../../hooks/useEntityContextMenu'; /** @alpha */ export type UseProps = () => | { - title: React.ReactNode; + title: ReactNode; href: string; disabled?: boolean; } | { - title: React.ReactNode; + title: ReactNode; onClick: () => void | Promise; disabled?: boolean; }; @@ -41,7 +41,7 @@ export type UseProps = () => /** @alpha */ export type EntityContextMenuItemParams = { useProps: UseProps; - icon: React.JSX.Element; + icon: JSX.Element; }; /** @alpha */ diff --git a/plugins/catalog-react/src/hooks/useEntityContextMenu.test.tsx b/plugins/catalog-react/src/hooks/useEntityContextMenu.test.tsx index e2b45a0fc9..60757a6050 100644 --- a/plugins/catalog-react/src/hooks/useEntityContextMenu.test.tsx +++ b/plugins/catalog-react/src/hooks/useEntityContextMenu.test.tsx @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React from 'react'; +import { ReactNode } from 'react'; import { useEntityContextMenu } from './useEntityContextMenu'; import { renderHook } from '@testing-library/react'; import { @@ -29,7 +29,7 @@ const Provider = ({ children, onMenuClose, }: { - children: React.ReactNode; + children: ReactNode; onMenuClose: () => void; }) => ( diff --git a/plugins/catalog/report.api.md b/plugins/catalog/report.api.md index 3ddf164802..0059f0504f 100644 --- a/plugins/catalog/report.api.md +++ b/plugins/catalog/report.api.md @@ -403,9 +403,9 @@ export interface EntityLayoutProps { // (undocumented) children?: ReactNode; // (undocumented) - NotFoundComponent?: ReactNode; - // (undocumented) extraMenuItems?: JSX.Element[]; + // (undocumented) + NotFoundComponent?: ReactNode; parentEntityRelations?: string[]; // Warning: (ae-forgotten-export) The symbol "EntityContextMenuOptions" needs to be exported by the entry point index.d.ts // diff --git a/plugins/catalog/src/alpha/contextMenuItems.tsx b/plugins/catalog/src/alpha/contextMenuItems.tsx index 5c503313cf..d503bc33a1 100644 --- a/plugins/catalog/src/alpha/contextMenuItems.tsx +++ b/plugins/catalog/src/alpha/contextMenuItems.tsx @@ -14,7 +14,6 @@ * limitations under the License. */ -import React from 'react'; import { EntityContextMenuItemBlueprint, useEntityPermission, @@ -37,6 +36,7 @@ import { } from '@backstage/plugin-catalog-react'; import { rootRouteRef, unregisterRedirectRouteRef } from '../routes'; import { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common/alpha'; +import { useEffect } from 'react'; export const copyEntityUrlContextMenuItem = EntityContextMenuItemBlueprint.make( { @@ -48,7 +48,7 @@ export const copyEntityUrlContextMenuItem = EntityContextMenuItemBlueprint.make( const alertApi = useApi(alertApiRef); const { t } = useTranslationRef(catalogTranslationRef); - React.useEffect(() => { + useEffect(() => { if (!copyState.error && copyState.value) { alertApi.post({ message: t('entityContextMenu.copiedMessage'), diff --git a/plugins/catalog/src/context/EntityContextMenuContext.tsx b/plugins/catalog/src/context/EntityContextMenuContext.tsx index b3769757b2..ec2f823b07 100644 --- a/plugins/catalog/src/context/EntityContextMenuContext.tsx +++ b/plugins/catalog/src/context/EntityContextMenuContext.tsx @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React from 'react'; import { createVersionedContext, createVersionedValueMap, } from '@backstage/version-bridge'; +import { ReactNode } from 'react'; /** @internal */ export type EntityContextMenuContextValue = { @@ -30,7 +30,7 @@ const EntityContextMenuContext = createVersionedContext<{ /** @internal */ export interface EntityContextMenuProviderProps { - children: React.ReactNode; + children: ReactNode; onMenuClose: () => void; }