diff --git a/packages/use-dataloader/package.json b/packages/use-dataloader/package.json index 661ae7b62..6874c99db 100644 --- a/packages/use-dataloader/package.json +++ b/packages/use-dataloader/package.json @@ -25,9 +25,6 @@ "directory": "packages/use-dataloader" }, "license": "MIT", - "dependencies": { - "prop-types": "15.8.1" - }, "peerDependencies": { "react": "18.x" } diff --git a/packages/use-dataloader/src/DataLoaderProvider.tsx b/packages/use-dataloader/src/DataLoaderProvider.tsx index 78c2e61e6..4f97f818c 100644 --- a/packages/use-dataloader/src/DataLoaderProvider.tsx +++ b/packages/use-dataloader/src/DataLoaderProvider.tsx @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types' import type { ReactElement, ReactNode } from 'react' import { createContext, useCallback, useContext, useMemo, useRef } from 'react' import { @@ -56,17 +55,19 @@ export type IDataLoaderContext = { // @ts-expect-error we force the context to undefined, should be corrected with default values export const DataLoaderContext = createContext(undefined) +type DataLoaderProviderProps = { + children: ReactNode + cacheKeyPrefix?: string + onError?: OnErrorFn + maxConcurrentRequests?: number +} + const DataLoaderProvider = ({ children, - cacheKeyPrefix, + cacheKeyPrefix = '', onError, - maxConcurrentRequests, -}: { - children: ReactNode - cacheKeyPrefix: string - onError: OnErrorFn - maxConcurrentRequests?: number -}): ReactElement => { + maxConcurrentRequests = DEFAULT_MAX_CONCURRENT_REQUESTS, +}: DataLoaderProviderProps): ReactElement => { const requestsRef = useRef({}) const computeKey = useCallback( @@ -82,7 +83,7 @@ const DataLoaderProvider = ({ const addRequest = useCallback( (key: string, args: UseDataLoaderInitializerArgs) => { if (DataLoader.maxConcurrent !== maxConcurrentRequests) { - DataLoader.maxConcurrent = maxConcurrentRequests as number + DataLoader.maxConcurrent = maxConcurrentRequests } if (key && typeof key === 'string') { const newRequest = new DataLoader({ @@ -212,19 +213,6 @@ const DataLoaderProvider = ({ ) } -DataLoaderProvider.propTypes = { - cacheKeyPrefix: PropTypes.string, - children: PropTypes.node.isRequired, - maxConcurrentRequests: PropTypes.number, - onError: PropTypes.func, -} - -DataLoaderProvider.defaultProps = { - cacheKeyPrefix: undefined, - maxConcurrentRequests: DEFAULT_MAX_CONCURRENT_REQUESTS, - onError: undefined, -} - export const useDataLoaderContext = (): IDataLoaderContext => useContext(DataLoaderContext) diff --git a/packages/use-dataloader/src/__tests__/usePaginatedDataLoader.test.tsx b/packages/use-dataloader/src/__tests__/usePaginatedDataLoader.test.tsx index 5d6b5e855..a2ff3c7be 100644 --- a/packages/use-dataloader/src/__tests__/usePaginatedDataLoader.test.tsx +++ b/packages/use-dataloader/src/__tests__/usePaginatedDataLoader.test.tsx @@ -19,7 +19,6 @@ const initialProps = { }), ), } -// eslint-disable-next-line react/prop-types const wrapper = ({ children }: { children?: ReactNode }) => ( {children} ) diff --git a/packages/use-i18n/package.json b/packages/use-i18n/package.json index 4282d3493..2e9fdc12f 100644 --- a/packages/use-i18n/package.json +++ b/packages/use-i18n/package.json @@ -33,8 +33,7 @@ "date-fns": "2.29.3", "filesize": "10.0.6", "international-types": "0.3.6", - "intl-messageformat": "10.2.5", - "prop-types": "15.8.1" + "intl-messageformat": "10.2.5" }, "peerDependencies": { "date-fns": "2.x", diff --git a/packages/use-i18n/src/usei18n.tsx b/packages/use-i18n/src/usei18n.tsx index 9011c1a25..421176ae6 100644 --- a/packages/use-i18n/src/usei18n.tsx +++ b/packages/use-i18n/src/usei18n.tsx @@ -2,7 +2,6 @@ import type { NumberFormatOptions } from '@formatjs/ecma402-abstract' import type { Locale as DateFnsLocale } from 'date-fns' import { formatDistanceToNow, formatDistanceToNowStrict } from 'date-fns' import type { BaseLocale } from 'international-types' -import PropTypes from 'prop-types' import type { ReactElement, ReactNode } from 'react' import { createContext, @@ -397,17 +396,4 @@ const I18nContextProvider = ({ return {children} } -I18nContextProvider.propTypes = { - children: PropTypes.node.isRequired, - defaultDateLocale: PropTypes.shape({}), - defaultLoad: PropTypes.func.isRequired, - defaultLocale: PropTypes.string.isRequired, - defaultTranslations: PropTypes.shape({}), - enableDebugKey: PropTypes.bool, - enableDefaultLocale: PropTypes.bool, - loadDateLocale: PropTypes.func, - localeItemStorage: PropTypes.string, - supportedLocales: PropTypes.arrayOf(PropTypes.string).isRequired, -} - export default I18nContextProvider diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index baebfbf37..b7b352e18 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -157,10 +157,7 @@ importers: specifiers: {} packages/use-dataloader: - specifiers: - prop-types: 15.8.1 - dependencies: - prop-types: 15.8.1 + specifiers: {} packages/use-gtm: specifiers: {} @@ -173,7 +170,6 @@ importers: filesize: 10.0.6 international-types: 0.3.6 intl-messageformat: 10.2.5 - prop-types: 15.8.1 dependencies: '@formatjs/ecma402-abstract': 1.14.3 '@formatjs/fast-memoize': 1.2.7 @@ -181,7 +177,6 @@ importers: filesize: 10.0.6 international-types: 0.3.6 intl-messageformat: 10.2.5 - prop-types: 15.8.1 packages/use-media: specifiers: {}