From 51ee276e9731c9fda3236641bc1cee740b69ab3c Mon Sep 17 00:00:00 2001 From: Jono M Date: Thu, 14 Dec 2023 16:01:28 +0000 Subject: [PATCH] Updated files with mixed named/default exports to use only named exports (#19385) no issue Fixes a warning in yarn dev --- apps/admin-x-demo/playwright.config.mjs | 2 +- apps/admin-x-framework/src/index.ts | 2 +- apps/admin-x-framework/src/playwright.ts | 2 +- apps/admin-x-framework/src/providers/FrameworkProvider.tsx | 4 +--- apps/admin-x-framework/src/providers/RoutingProvider.tsx | 4 +--- apps/admin-x-framework/src/routing.ts | 2 +- apps/admin-x-framework/test/unit/utils/api/fetchApi.test.tsx | 3 +-- apps/admin-x-framework/test/unit/utils/api/hooks.test.tsx | 2 +- apps/admin-x-settings/playwright.config.mjs | 2 +- 9 files changed, 9 insertions(+), 14 deletions(-) diff --git a/apps/admin-x-demo/playwright.config.mjs b/apps/admin-x-demo/playwright.config.mjs index 04367c1d9e..8fa59553e5 100644 --- a/apps/admin-x-demo/playwright.config.mjs +++ b/apps/admin-x-demo/playwright.config.mjs @@ -1,3 +1,3 @@ -import adminXPlaywrightConfig from '@tryghost/admin-x-framework/playwright'; +import {adminXPlaywrightConfig} from '@tryghost/admin-x-framework/playwright'; export default adminXPlaywrightConfig(); diff --git a/apps/admin-x-framework/src/index.ts b/apps/admin-x-framework/src/index.ts index ba48c23dee..f876659421 100644 --- a/apps/admin-x-framework/src/index.ts +++ b/apps/admin-x-framework/src/index.ts @@ -1,4 +1,4 @@ -export {default as FrameworkProvider, useFramework} from './providers/FrameworkProvider'; +export {FrameworkProvider, useFramework} from './providers/FrameworkProvider'; export type {FrameworkContextType, FrameworkProviderProps, TopLevelFrameworkProps} from './providers/FrameworkProvider'; export {useQueryClient} from '@tanstack/react-query'; diff --git a/apps/admin-x-framework/src/playwright.ts b/apps/admin-x-framework/src/playwright.ts index a6cfbc70a0..e72c05e580 100644 --- a/apps/admin-x-framework/src/playwright.ts +++ b/apps/admin-x-framework/src/playwright.ts @@ -2,7 +2,7 @@ import {defineConfig, devices, PlaywrightTestConfig} from '@playwright/test'; export const E2E_PORT = 5173; -export default function adminXPlaywrightConfig(overrides: Partial = {}) { +export function adminXPlaywrightConfig(overrides: Partial = {}) { /** * See https://playwright.dev/docs/test-configuration. */ diff --git a/apps/admin-x-framework/src/providers/FrameworkProvider.tsx b/apps/admin-x-framework/src/providers/FrameworkProvider.tsx index d56615813a..4a26aef932 100644 --- a/apps/admin-x-framework/src/providers/FrameworkProvider.tsx +++ b/apps/admin-x-framework/src/providers/FrameworkProvider.tsx @@ -42,7 +42,7 @@ const FrameworkContext = createContext({ onDelete: () => {} }); -function FrameworkProvider({children, ...props}: FrameworkProviderProps) { +export function FrameworkProvider({children, ...props}: FrameworkProviderProps) { return ( @@ -54,6 +54,4 @@ function FrameworkProvider({children, ...props}: FrameworkProviderProps) { ); } -export default FrameworkProvider; - export const useFramework = () => useContext(FrameworkContext); diff --git a/apps/admin-x-framework/src/providers/RoutingProvider.tsx b/apps/admin-x-framework/src/providers/RoutingProvider.tsx index 763ce62490..46f93f2c11 100644 --- a/apps/admin-x-framework/src/providers/RoutingProvider.tsx +++ b/apps/admin-x-framework/src/providers/RoutingProvider.tsx @@ -97,7 +97,7 @@ export interface RoutingProviderProps { children: React.ReactNode; } -const RoutingProvider: React.FC = ({basePath, modals, children}) => { +export const RoutingProvider: React.FC = ({basePath, modals, children}) => { const {externalNavigate} = useFramework(); const [route, setRoute] = useState(undefined); const [loadingModal, setLoadingModal] = useState(false); @@ -172,8 +172,6 @@ const RoutingProvider: React.FC = ({basePath, modals, chil ); }; -export default RoutingProvider; - export function useRouting() { return useContext(RouteContext); } diff --git a/apps/admin-x-framework/src/routing.ts b/apps/admin-x-framework/src/routing.ts index 44e35c28ec..426eb4b8a7 100644 --- a/apps/admin-x-framework/src/routing.ts +++ b/apps/admin-x-framework/src/routing.ts @@ -1,3 +1,3 @@ -export {default as RoutingProvider, useRouteChangeCallback, useRouting} from './providers/RoutingProvider'; +export {RoutingProvider, useRouteChangeCallback, useRouting} from './providers/RoutingProvider'; export type {ExternalLink, InternalLink, ModalComponent, RoutingModalProps} from './providers/RoutingProvider'; diff --git a/apps/admin-x-framework/test/unit/utils/api/fetchApi.test.tsx b/apps/admin-x-framework/test/unit/utils/api/fetchApi.test.tsx index 2fda8f9557..ae25f61053 100644 --- a/apps/admin-x-framework/test/unit/utils/api/fetchApi.test.tsx +++ b/apps/admin-x-framework/test/unit/utils/api/fetchApi.test.tsx @@ -1,12 +1,11 @@ import {renderHook} from '@testing-library/react'; import React, {ReactNode} from 'react'; -import FrameworkProvider from '../../../../src/providers/FrameworkProvider'; +import {FrameworkProvider} from '../../../../src/providers/FrameworkProvider'; import {useFetchApi} from '../../../../src/utils/api/fetchApi'; import {withMockFetch} from '../../../utils/mockFetch'; const wrapper: React.FC<{ children: ReactNode }> = ({children}) => ( {}} ghostVersion='5.x' sentryDSN='' diff --git a/apps/admin-x-framework/test/unit/utils/api/hooks.test.tsx b/apps/admin-x-framework/test/unit/utils/api/hooks.test.tsx index a94da1bbc4..1245c3c63f 100644 --- a/apps/admin-x-framework/test/unit/utils/api/hooks.test.tsx +++ b/apps/admin-x-framework/test/unit/utils/api/hooks.test.tsx @@ -1,7 +1,7 @@ import {InfiniteData, QueryClient, QueryClientProvider} from '@tanstack/react-query'; import {act, renderHook, waitFor} from '@testing-library/react'; import React, {ReactNode} from 'react'; -import FrameworkProvider from '../../../../src/providers/FrameworkProvider'; +import {FrameworkProvider} from '../../../../src/providers/FrameworkProvider'; import {createInfiniteQuery, createMutation, createPaginatedQuery, createQuery, createQueryWithId} from '../../../../src/utils/api/hooks'; import {withMockFetch} from '../../../utils/mockFetch'; diff --git a/apps/admin-x-settings/playwright.config.mjs b/apps/admin-x-settings/playwright.config.mjs index 04367c1d9e..8fa59553e5 100644 --- a/apps/admin-x-settings/playwright.config.mjs +++ b/apps/admin-x-settings/playwright.config.mjs @@ -1,3 +1,3 @@ -import adminXPlaywrightConfig from '@tryghost/admin-x-framework/playwright'; +import {adminXPlaywrightConfig} from '@tryghost/admin-x-framework/playwright'; export default adminXPlaywrightConfig();