Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA][TS migration] Remove all remaining prop-types from the project #42249

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0f89237
Uninstall prop-types
blazejkustra May 16, 2024
97cb585
Remove avatar prop types
blazejkustra May 16, 2024
fe6801d
Remove category prop types
blazejkustra May 16, 2024
8811c70
Remove option prop types
blazejkustra May 16, 2024
1dd358c
Remove participant prop types
blazejkustra May 16, 2024
3648983
Remove tag prop types
blazejkustra May 16, 2024
ab8b380
Remove source prop types
blazejkustra May 16, 2024
765da70
Remove source prop types v2
blazejkustra May 16, 2024
e681719
Remove reportActionFragment prop types
blazejkustra May 16, 2024
575bcc8
Remove reportAction prop types
blazejkustra May 16, 2024
e0367cb
Remove style prop types
blazejkustra May 16, 2024
09a3b7e
Remove violations prop types
blazejkustra May 16, 2024
e193cb5
Remove translatableText prop types
blazejkustra May 16, 2024
4b30f9b
Remove tax prop types
blazejkustra May 16, 2024
ab59bcf
Remove withCurrentReportID prop types
blazejkustra May 16, 2024
17caec9
Remove withCurrentReportID prop types
blazejkustra May 16, 2024
d234f7b
Remove withLocalize prop types
blazejkustra May 16, 2024
3570da0
Remove withStyleUtils prop types
blazejkustra May 16, 2024
903ce9d
Remove withTheme prop types
blazejkustra May 16, 2024
e73528a
Clean JSDoc comment
blazejkustra May 16, 2024
ec29401
Remove windowDimensions prop types
blazejkustra May 16, 2024
a935604
Merge branch 'main' into ts/remove-prop-types
blazejkustra May 16, 2024
5770d0e
Merge branch 'main' into ts/remove-prop-types
blazejkustra May 17, 2024
e316325
Merge branch 'main' into ts/remove-prop-types
blazejkustra May 27, 2024
9b82d97
Run npm i
blazejkustra May 27, 2024
4689f0b
Merge branch 'main' into ts/remove-prop-types
blazejkustra May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
"mapbox-gl": "^2.15.0",
"onfido-sdk-ui": "14.15.0",
"process": "^0.11.10",
"prop-types": "^15.7.2",
"pusher-js": "8.3.0",
"react": "18.2.0",
"react-beautiful-dnd": "^13.1.1",
Expand Down
13 changes: 0 additions & 13 deletions src/components/Image/sourcePropTypes/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/Image/sourcePropTypes/index.native.js

This file was deleted.

10 changes: 4 additions & 6 deletions src/components/Tooltip/BaseTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ const hasHoverSupport = DeviceCapabilities.hasHoverSupport();
/**
* A component used to wrap an element intended for displaying a tooltip. The term "tooltip's target" refers to the
* wrapped element, which, upon hover, triggers the tooltip to be shown.
* @param {propTypes} props
* @returns {ReactNodeLike}
*/

/**
Expand All @@ -30,10 +28,10 @@ const hasHoverSupport = DeviceCapabilities.hasHoverSupport();
* so we need to find the correct part (the one that the user is hovering
* over) and show the tooltip there.
*
* @param {Element} target The DOM element being hovered over.
* @param {number} clientX The X position from the MouseEvent.
* @param {number} clientY The Y position from the MouseEvent.
* @return {DOMRect} The chosen bounding box.
* @param target The DOM element being hovered over.
* @param clientX The X position from the MouseEvent.
* @param clientY The Y position from the MouseEvent.
* @return The chosen bounding box.
*/

function chooseBoundingBox(target: HTMLElement, clientX: number, clientY: number): DOMRect {
Expand Down
11 changes: 0 additions & 11 deletions src/components/avatarPropTypes.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/components/categoryPropTypes.js

This file was deleted.

65 changes: 0 additions & 65 deletions src/components/optionPropTypes.js

This file was deleted.

28 changes: 0 additions & 28 deletions src/components/participantPropTypes.js

This file was deleted.

21 changes: 0 additions & 21 deletions src/components/tagPropTypes.js

This file was deleted.

12 changes: 1 addition & 11 deletions src/components/withCurrentReportID.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {NavigationState} from '@react-navigation/native';
import PropTypes from 'prop-types';
import type {ComponentType, ForwardedRef, RefAttributes} from 'react';
import React, {createContext, forwardRef, useCallback, useMemo, useState} from 'react';
import getComponentDisplayName from '@libs/getComponentDisplayName';
Expand All @@ -17,15 +16,6 @@ type CurrentReportIDContextProviderProps = {

const CurrentReportIDContext = createContext<CurrentReportIDContextValue | null>(null);

// TODO: Remove when depended components are migrated to TypeScript.
const withCurrentReportIDPropTypes = {
/** Function to update the state */
updateCurrentReportID: PropTypes.func.isRequired,

/** The top most report id */
currentReportID: PropTypes.string,
};

const withCurrentReportIDDefaultProps = {
currentReportID: '',
};
Expand Down Expand Up @@ -95,5 +85,5 @@ export default function withCurrentReportID<TProps extends CurrentReportIDContex
return forwardRef(WithCurrentReportID);
}

export {withCurrentReportIDPropTypes, withCurrentReportIDDefaultProps, CurrentReportIDContextProvider, CurrentReportIDContext};
export {withCurrentReportIDDefaultProps, CurrentReportIDContextProvider, CurrentReportIDContext};
export type {CurrentReportIDContextValue};
13 changes: 2 additions & 11 deletions src/components/withKeyboardState.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import PropTypes from 'prop-types';
import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react';
import React, {createContext, forwardRef, useEffect, useMemo, useState} from 'react';
import {Keyboard} from 'react-native';
Expand All @@ -13,15 +12,6 @@ type KeyboardStateContextValue = {
keyboardHeight: number;
};

// TODO: Remove - left for backwards compatibility with existing components (https://github.com/Expensify/App/issues/25151)
const keyboardStatePropTypes = {
/** Whether the keyboard is open */
isKeyboardShown: PropTypes.bool.isRequired,

/** Height of the keyboard in pixels */
keyboardHeight: PropTypes.number.isRequired,
};

const KeyboardStateContext = createContext<KeyboardStateContextValue>({
isKeyboardShown: false,
keyboardHeight: 0,
Expand Down Expand Up @@ -76,4 +66,5 @@ export default function withKeyboardState<TProps extends KeyboardStateContextVal
return forwardRef(WithKeyboardState);
}

export {KeyboardStateProvider, keyboardStatePropTypes, type KeyboardStateContextValue, KeyboardStateContext};
export type {KeyboardStateContextValue};
export {KeyboardStateProvider, KeyboardStateContext};
29 changes: 0 additions & 29 deletions src/components/withLocalize.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
import PropTypes from 'prop-types';
import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react';
import React, {forwardRef} from 'react';
import getComponentDisplayName from '@libs/getComponentDisplayName';
import type {LocaleContextProps} from './LocaleContextProvider';
import {LocaleContext} from './LocaleContextProvider';

const withLocalizePropTypes = {
/** Returns translated string for given locale and phrase */
translate: PropTypes.func.isRequired,

/** Formats number formatted according to locale and options */
numberFormat: PropTypes.func.isRequired,

/** Converts a datetime into a localized string representation that's relative to current moment in time */
datetimeToRelative: PropTypes.func.isRequired,

/** Formats a datetime to local date and time string */
datetimeToCalendarTime: PropTypes.func.isRequired,

/** Updates date-fns internal locale */
updateLocale: PropTypes.func.isRequired,

/** Returns a locally converted phone number for numbers from the same region
* and an internationally converted phone number with the country code for numbers from other regions */
formatPhoneNumber: PropTypes.func.isRequired,

/** Gets the standard digit corresponding to a locale digit */
fromLocaleDigit: PropTypes.func.isRequired,

/** Gets the locale digit corresponding to a standard digit */
toLocaleDigit: PropTypes.func.isRequired,
};

type WithLocalizeProps = LocaleContextProps;

export default function withLocalize<TProps extends WithLocalizeProps, TRef>(
Expand All @@ -57,5 +29,4 @@ export default function withLocalize<TProps extends WithLocalizeProps, TRef>(
return forwardRef(WithLocalize);
}

export {withLocalizePropTypes};
export type {WithLocalizeProps};
6 changes: 1 addition & 5 deletions src/components/withStyleUtils.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import PropTypes from 'prop-types';
import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react';
import React, {forwardRef} from 'react';
import useStyleUtils from '@hooks/useStyleUtils';
import getComponentDisplayName from '@libs/getComponentDisplayName';
import type {StyleUtilsType} from '@styles/utils';

const withStyleUtilsPropTypes = {
StyleUtils: PropTypes.object.isRequired,
};
type WithStyleUtilsProps = {StyleUtils: StyleUtilsType};

export default function withStyleUtils<TProps extends WithStyleUtilsProps, TRef>(
Expand All @@ -30,4 +26,4 @@ export default function withStyleUtils<TProps extends WithStyleUtilsProps, TRef>
return forwardRef(WithStyleUtils);
}

export {withStyleUtilsPropTypes, type WithStyleUtilsProps};
export type {WithStyleUtilsProps};
5 changes: 0 additions & 5 deletions src/components/withTheme.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import PropTypes from 'prop-types';
import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react';
import React, {forwardRef} from 'react';
import useTheme from '@hooks/useTheme';
import getComponentDisplayName from '@libs/getComponentDisplayName';
import type {ThemeColors} from '@styles/theme/types';

const withThemePropTypes = {
theme: PropTypes.object.isRequired,
};
type WithThemeProps = {theme: ThemeColors};

export default function withTheme<TProps extends WithThemeProps, TRef>(
Expand All @@ -30,5 +26,4 @@ export default function withTheme<TProps extends WithThemeProps, TRef>(
return forwardRef(WithTheme);
}

export {withThemePropTypes};
export type {WithThemeProps};
5 changes: 0 additions & 5 deletions src/components/withThemeStyles.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import PropTypes from 'prop-types';
import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react';
import React, {forwardRef} from 'react';
import useThemeStyles from '@hooks/useThemeStyles';
import getComponentDisplayName from '@libs/getComponentDisplayName';
import type {ThemeStyles} from '@styles/index';

const withThemeStylesPropTypes = {
themeStyles: PropTypes.object.isRequired,
};
type WithThemeStylesProps = {themeStyles: ThemeStyles};

export default function withThemeStyles<TProps extends WithThemeStylesProps, TRef>(
Expand All @@ -30,5 +26,4 @@ export default function withThemeStyles<TProps extends WithThemeStylesProps, TRe
return forwardRef(WithThemeStyles);
}

export {withThemeStylesPropTypes};
export type {WithThemeStylesProps};
Loading
Loading