diff --git a/configs/.eslintrc.yml b/configs/.eslintrc.yml index 7a6e09f8..63db4261 100644 --- a/configs/.eslintrc.yml +++ b/configs/.eslintrc.yml @@ -10,18 +10,69 @@ plugins: [ '@typescript-eslint' ] -"rules": - "import/extensions": [ - "error", - "ignorePackages", - { +rules: + "import/extensions": [ + "error", + "ignorePackages", + { "js": "never", "jsx": "never", "ts": "never", "tsx": "never" - } - ] - + } + ] + "no-unused-vars": "off" + "@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }] + # Temp turn off following rules because we're doing ts-migrate + # Will turn them on after migration completed. + "max-len": "warn" + "no-use-before-define": "warn" + # It's fix after upgrading eslint-plugin-react to v7.20.6 + # to keep consistency with rule config in eslint-config-ichef. + # just add `static-variables` in the first line. + # Should remove after we upgrade eslint-plugin-react in eslint-config-ichef. + 'react/sort-comp': ['error', { + order: [ + 'static-variables', + 'static-methods', + 'instance-variables', + 'lifecycle', + 'getters', + 'setters', + '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', + 'instance-methods', + 'everything-else', + '/^(on|handle).+$/', + 'rendering', + ], + groups: { + lifecycle: [ + 'displayName', + 'propTypes', + 'contextTypes', + 'childContextTypes', + 'mixins', + 'statics', + 'defaultProps', + 'constructor', + 'getDefaultProps', + 'getInitialState', + 'state', + 'getChildContext', + 'componentWillMount', + 'componentDidMount', + 'componentWillReceiveProps', + 'shouldComponentUpdate', + 'componentWillUpdate', + 'componentDidUpdate', + 'componentWillUnmount', + ], + rendering: [ + '/^render.+$/', + 'render', + ], + }, + }] env: browser: true diff --git a/package.json b/package.json index 7f5e8b6f..b775465b 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "eslint-import-resolver-babel-module": "^5.0.0-beta.1", "eslint-plugin-import": "^2.22.0", "eslint-plugin-jsx-a11y": "^6.1.2", - "eslint-plugin-react": "^7.11.1", + "eslint-plugin-react": "^7.20.6", "extract-text-webpack-plugin": "^3.0.2", "file-loader": "^1.1.6", "fork-ts-checker-webpack-plugin": "^5.0.14", diff --git a/packages/core/configs/webpack.dist.js b/packages/core/configs/webpack.dist.js index 5e709f20..9fcf5454 100644 --- a/packages/core/configs/webpack.dist.js +++ b/packages/core/configs/webpack.dist.js @@ -7,6 +7,8 @@ const defaultConfigs = require('../../../configs/webpack.dist'); const packageDirname = process.cwd(); module.exports = webpackMerge(defaultConfigs, { + entry: './src/index.ts', + module: { rules: [ { diff --git a/packages/core/src/Avatar.tsx b/packages/core/src/Avatar.tsx index 9be255a1..d237e51f 100644 --- a/packages/core/src/Avatar.tsx +++ b/packages/core/src/Avatar.tsx @@ -14,12 +14,14 @@ const SQUARE = 'square'; const ROUNDED = 'rounded'; const CIRCLE = 'circle'; -type AvatarPropTypes = { - className?: string, - src: string, - alt: string, - type: typeof SQUARE | typeof ROUNDED | typeof CIRCLE, -} +type OwnAvatarPropTypes = { + className?: string; + src: string; + alt: string; + type: typeof SQUARE | typeof ROUNDED | typeof CIRCLE; +}; + +type AvatarPropTypes = OwnAvatarPropTypes & typeof Avatar.defaultProps; function Avatar({ className, diff --git a/packages/core/src/BasicRow.js b/packages/core/src/BasicRow.tsx similarity index 56% rename from packages/core/src/BasicRow.js rename to packages/core/src/BasicRow.tsx index d04c34db..7b306508 100644 --- a/packages/core/src/BasicRow.js +++ b/packages/core/src/BasicRow.tsx @@ -6,19 +6,23 @@ import Tag from './Tag'; import wrapIfNotElement from './utils/wrapIfNotElement'; -function BasicRow({ - basic, - tag, - statusIcon, - children, - ...otherProps -}) { +type OwnProps = { + basic?: React.ReactNode; + tag?: React.ReactNode; + statusIcon?: React.ReactNode; +}; + +type Props = OwnProps & typeof BasicRow.defaultProps; + +// @ts-expect-error ts-migrate(2339) FIXME: Property 'children' does not exist on type 'Props'... Remove this comment to see the full error message +function BasicRow({ basic, tag, statusIcon, children, ...otherProps }: Props) { if (!basic) { return null; } return (
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Property 'children' does not exist on type 'Intrin... Remove this comment to see the full error message */} {basic} {tag && wrapIfNotElement(tag, { with: Tag })} diff --git a/packages/core/src/Button.js b/packages/core/src/Button.tsx similarity index 63% rename from packages/core/src/Button.js rename to packages/core/src/Button.tsx index bf43436f..33a4afb9 100644 --- a/packages/core/src/Button.js +++ b/packages/core/src/Button.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import icBEM from './utils/icBEM'; @@ -15,15 +14,22 @@ const RED = 'red'; const WHITE = 'white'; const BLACK = 'black'; +const colors = [BLUE, RED, WHITE, BLACK] as const; + +type OwnProps = { + color?: typeof colors[number], + solid?: boolean; + tagName?: 'button' | 'a' | 'div'; +}; + +type Props = OwnProps & typeof Button.defaultProps; + function Button({ - color, - solid, - tagName: ButtonTag, + color, solid, tagName: ButtonTag, // React props - className, - children, - ...otherProps -}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Props... Remove this comment to see the full error message + className, children, ...otherProps +}: Props) { const bemClass = ROOT_BEM .modifier(color) .modifier('solid', solid); @@ -38,12 +44,6 @@ function Button({ ); } -Button.propTypes = { - color: PropTypes.oneOf([BLUE, RED, WHITE, BLACK]), - solid: PropTypes.bool, - tagName: PropTypes.oneOf(['button', 'a', 'div']), -}; - Button.defaultProps = { color: BLACK, solid: false, @@ -53,6 +53,7 @@ Button.defaultProps = { // export for tests export { Button as PureButton }; +// @ts-expect-error ts-migrate(4023) FIXME: Exported variable 'RowCompButton' has or is using ... Remove this comment to see the full error message const RowCompButton = rowComp({ defaultMinified: true })(Button); RowCompButton.defaultProps.bold = true; diff --git a/packages/core/src/Checkbox.js b/packages/core/src/Checkbox.tsx similarity index 71% rename from packages/core/src/Checkbox.js rename to packages/core/src/Checkbox.tsx index 1f90b54d..60fd3b30 100644 --- a/packages/core/src/Checkbox.js +++ b/packages/core/src/Checkbox.tsx @@ -1,5 +1,4 @@ import React, { PureComponent } from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import prefixClass from './utils/prefixClass'; import icBEM from './utils/icBEM'; @@ -17,24 +16,22 @@ export const BEM = { iconWrapper: ROOT_BEM.element('icon-wrapper'), }; +// @ts-expect-error ts-migrate(2322) FIXME: Property 'className' does not exist on type 'Intri... Remove this comment to see the full error message export const CHECKBOX_BUTTON = ; -class Checkbox extends PureComponent { - static propTypes = { - /** - * Use this to inject props to the underlying `` - */ - input: PropTypes.object, // eslint-disable-line react/forbid-prop-types - indeterminate: PropTypes.bool, - overrideButton: PropTypes.element, - - // props - checked: PropTypes.bool, - defaultChecked: PropTypes.bool, - disabled: PropTypes.bool, - onChange: PropTypes.func, - }; +type OwnProps = { + input?: any; + indeterminate?: boolean; + overrideButton?: React.ReactElement; + checked?: boolean; + defaultChecked?: boolean; + disabled?: boolean; + onChange?: (...args: any[]) => any; +}; +type Props = OwnProps & typeof Checkbox.defaultProps; + +class Checkbox extends PureComponent { static defaultProps = { input: {}, indeterminate: false, @@ -46,11 +43,13 @@ class Checkbox extends PureComponent { onChange: undefined }; + inputRef: any; + componentDidMount() { this.updateInputIndeterminate(); } - componentDidUpdate(prevProps) { + componentDidUpdate(prevProps: Props) { if (prevProps.indeterminate !== this.props.indeterminate) { this.updateInputIndeterminate(); } @@ -67,6 +66,7 @@ class Checkbox extends PureComponent { renderCheckboxInput(inputProps, overrideButton) { return ( + // @ts-expect-error ts-migrate(2322) FIXME: Type 'BEMFactory' is not assignable to type 'strin... Remove this comment to see the full error message { this.inputRef = ref; }} @@ -90,6 +90,7 @@ class Checkbox extends PureComponent { disabled, onChange, // React props + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message className, children, ...otherProps @@ -114,5 +115,6 @@ class Checkbox extends PureComponent { } } +// @ts-expect-error ts-migrate(4082) FIXME: Default export of the module has or is using priva... Remove this comment to see the full error message export default rowComp()(Checkbox); export { Checkbox as PureCheckbox }; diff --git a/packages/core/src/ColumnView.js b/packages/core/src/ColumnView.tsx similarity index 73% rename from packages/core/src/ColumnView.js rename to packages/core/src/ColumnView.tsx index 6bb07b6c..6d68f98e 100644 --- a/packages/core/src/ColumnView.js +++ b/packages/core/src/ColumnView.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import './styles/ColumnView.scss'; @@ -15,16 +14,26 @@ export const BEM = { footer: ROOT_BEM.element('footer'), }; +type OwnProps = { + header?: React.ReactNode; + footer?: React.ReactNode; + flexBody?: boolean; + bodyPadding?: { + top?: number; + bottom?: number; + left?: number; + right?: number; + }; +}; + +type Props = OwnProps & typeof ColumnView.defaultProps; + function ColumnView({ - header, - footer, - flexBody, - bodyPadding, + header, footer, flexBody, bodyPadding, // React props - className, - children, - ...wrapperProps -}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Props... Remove this comment to see the full error message + className, children, ...wrapperProps +}: Props) { const rootClassName = classNames(`${BEM.root}`, className); const bodyClassName = BEM.body.modifier('flex', flexBody); @@ -56,18 +65,6 @@ function ColumnView({ ); } -ColumnView.propTypes = { - header: PropTypes.node, - footer: PropTypes.node, - flexBody: PropTypes.bool, - bodyPadding: PropTypes.shape({ - top: PropTypes.number, - bottom: PropTypes.number, - left: PropTypes.number, - right: PropTypes.number, - }), -}; - ColumnView.defaultProps = { header: undefined, footer: undefined, diff --git a/packages/core/src/EditableBasicRow.js b/packages/core/src/EditableBasicRow.tsx similarity index 77% rename from packages/core/src/EditableBasicRow.js rename to packages/core/src/EditableBasicRow.tsx index 5a136bac..b486519b 100644 --- a/packages/core/src/EditableBasicRow.js +++ b/packages/core/src/EditableBasicRow.tsx @@ -1,5 +1,4 @@ import React, { PureComponent } from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import './styles/EditableBasicRow.scss'; @@ -24,6 +23,24 @@ export const ROW_INPUT_TAGS = { TEXTAREA: TAG_TEXTAREA }; +type OwnProps = { + inputTag?: any; // TODO: PropTypes.oneOf(Object.values(ROW_INPUT_TAGS)) + value?: string; + defaultValue?: string; + placeholder?: string; + readOnly?: boolean; + disabled?: boolean; + onChange?: (...args: any[]) => any; + onFocus?: (...args: any[]) => any; + onBlur?: (...args: any[]) => any; + status?: string; + statusIcon?: React.ReactElement; +}; + +type State = any; + +type Props = OwnProps & typeof EditableBasicRow.defaultProps; + /** * * ================== @@ -57,23 +74,7 @@ export const ROW_INPUT_TAGS = { * ``` */ -class EditableBasicRow extends PureComponent { - static propTypes = { - inputTag: PropTypes.oneOf(Object.values(ROW_INPUT_TAGS)), - // props - value: PropTypes.string, - defaultValue: PropTypes.string, - placeholder: PropTypes.string, - readOnly: PropTypes.bool, - disabled: PropTypes.bool, - onChange: PropTypes.func, - onFocus: PropTypes.func, - onBlur: PropTypes.func, - // status props - status: PropTypes.string, - statusIcon: PropTypes.element, - }; - +class EditableBasicRow extends PureComponent { static defaultProps = { inputTag: TAG_INPUT, value: undefined, @@ -88,12 +89,14 @@ class EditableBasicRow extends PureComponent { statusIcon: undefined, }; + inputNode: any; + state = { currentValue: this.props.value || this.props.defaultValue || '', focused: false, }; - componentWillReceiveProps(nextProps) { + componentWillReceiveProps(nextProps: Props) { if (nextProps.value !== this.props.value) { this.setState({ currentValue: nextProps.value }); } @@ -133,9 +136,12 @@ class EditableBasicRow extends PureComponent { status, // digested by this component and should not go into statusIcon, // React props + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message className, // props from , should ignore + // @ts-expect-error ts-migrate(2339) FIXME: Property 'basic' does not exist on type 'Readonly<... Remove this comment to see the full error message basic, // eslint-disable-line react/prop-types + // @ts-expect-error ts-migrate(2339) FIXME: Property 'tag' does not exist on type 'Readonly will be invisible on browser */ const basicLabel = ( + // @ts-expect-error ts-migrate(2322) FIXME: Type 'BEMFactory' is not assignable to type 'strin... Remove this comment to see the full error message {currentValue || placeholder} {InputTag === TAG_TEXTAREA && '\n'} @@ -162,6 +169,7 @@ class EditableBasicRow extends PureComponent { ); return ( + // @ts-expect-error ts-migrate(2322) FIXME: Property 'children' does not exist on type 'Intrin... Remove this comment to see the full error message any; + onBlur?: (...args: any[]) => any; + align?: any; // TODO: PureText.propTypes.align + noGrow?: any; // TODO: PureText.propTypes.noGrow + status?: any; // withStatusPropTypes.status + statusIcon?: any; // TODO: withStatusPropTypes.statusIcon + errorMsg?: any; // TODO: withStatusPropTypes.errorMsg +}; + +type State = any; + +type Props = OwnProps & typeof EditableText.defaultProps; + /** * * ============== @@ -34,19 +48,7 @@ import { PureText } from './Text'; * status="loading" /> * ``` */ -class EditableText extends PureComponent { - static propTypes = { - onFocus: PropTypes.func, - onBlur: PropTypes.func, - // props, - align: PureText.propTypes.align, - noGrow: PureText.propTypes.noGrow, - // withStatus() props - status: withStatusPropTypes.status, - statusIcon: withStatusPropTypes.statusIcon, - errorMsg: withStatusPropTypes.errorMsg, - }; - +class EditableText extends PureComponent { static defaultProps = { onFocus: () => {}, onBlur: () => {}, @@ -87,6 +89,7 @@ class EditableText extends PureComponent { statusIcon, errorMsg, // React props, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message className, ...editableRowProps } = this.props; @@ -97,6 +100,7 @@ class EditableText extends PureComponent { const statusProps = isFocused ? {} : { statusIcon, errorMsg }; const basicRow = ( + // @ts-expect-error ts-migrate(2769) FIXME: Type '(event: any) => void' is not assignable to t... Remove this comment to see the full error message any; + onDblClick?: (...args: any[]) => any; + icon?: any; // TODO: TextLabel.propTypes.icon + basic?: any; // TODO: TextLabel.propTypes.basic + align?: any; // TODO: TextLabel.propTypes.align + status?: any; // TODO: TextLabel.propTypes.status +}; + +type State = any; + +type Props = OwnProps & typeof EditableTextLabel.defaultProps; + /** * * =================== @@ -32,18 +45,7 @@ const TOUCH_TIMEOUT_MS = 250; * It does not offer direct control to the `` inside. */ -class EditableTextLabel extends PureComponent { - static propTypes = { - inEdit: PropTypes.bool, - onEditEnd: PropTypes.func, - onDblClick: PropTypes.func, - // props - icon: TextLabel.propTypes.icon, - basic: TextLabel.propTypes.basic, - align: TextLabel.propTypes.align, - status: TextLabel.propTypes.status, - }; - +class EditableTextLabel extends PureComponent { static defaultProps = { inEdit: undefined, onEditEnd: () => {}, @@ -63,7 +65,7 @@ class EditableTextLabel extends PureComponent { dblTouchTimeout: null, }; - componentWillReceiveProps(nextProps) { + componentWillReceiveProps(nextProps: Props) { /** * If the edit-state of is *controlled* by `inEdit` prop. * If the prop is `undefined`, this component became *uncontrolled* @@ -178,6 +180,7 @@ class EditableTextLabel extends PureComponent { return ( @@ -192,6 +195,7 @@ class EditableTextLabel extends PureComponent { {labelIcon} {children}
); } -FlexCell.propTypes = { - shrink: PropTypes.oneOfType([ - PropTypes.bool, - PropTypes.number - ]), - grow: PropTypes.oneOfType([ - PropTypes.bool, - PropTypes.number - ]), - basis: PropTypes.string, -}; - FlexCell.defaultProps = { shrink: false, grow: false, diff --git a/packages/core/src/HeaderRow.js b/packages/core/src/HeaderRow.tsx similarity index 51% rename from packages/core/src/HeaderRow.js rename to packages/core/src/HeaderRow.tsx index a108e58a..c1374108 100644 --- a/packages/core/src/HeaderRow.js +++ b/packages/core/src/HeaderRow.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import './styles/HeaderRow.scss'; @@ -15,41 +14,45 @@ export const BEM = { right: ROOT_BEM.element('right'), }; +type OwnHeaderAreaProps = { + content?: React.ReactNode | any; // TODO: PropTypes.oneOf([false]) +}; + +type HeaderAreaProps = OwnHeaderAreaProps & typeof HeaderArea.defaultProps; + // -------------------- // Helper Component // -------------------- -export function HeaderArea({ content, ...props }) { +export function HeaderArea({ content, ...props }: HeaderAreaProps) { if (content === false) { return null; } return
{content}
; } -HeaderArea.propTypes = { - content: PropTypes.oneOfType([ - PropTypes.node, - PropTypes.oneOf([false]), - ]), -}; - HeaderArea.defaultProps = { content: undefined, }; +type OwnHeaderRowProps = { + left?: any; // TODO: HeaderArea.propTypes.content + center?: any; // TODO: HeaderArea.propTypes.content + right?: any; // TODO: HeaderArea.propTypes.content +}; + +type HeaderRowProps = OwnHeaderRowProps & typeof HeaderRow.defaultProps; + // -------------------- // Main Component // -------------------- function HeaderRow({ - left, - center, - right, + left, center, right, // React props - className, - children, - ...otherProps -}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Heade... Remove this comment to see the full error message + className, children, ...otherProps +}: HeaderRowProps) { const rootClassName = classNames( BEM.root.toString(), className, @@ -57,20 +60,17 @@ function HeaderRow({ return (
+ {/* @ts-expect-error ts-migrate(2322) FIXME: Property 'className' does not exist on type 'Intri... Remove this comment to see the full error message */} + {/* @ts-expect-error ts-migrate(2322) FIXME: Property 'className' does not exist on type 'Intri... Remove this comment to see the full error message */} + {/* @ts-expect-error ts-migrate(2322) FIXME: Property 'className' does not exist on type 'Intri... Remove this comment to see the full error message */} {children}
); } -HeaderRow.propTypes = { - left: HeaderArea.propTypes.content, - center: HeaderArea.propTypes.content, - right: HeaderArea.propTypes.content, -}; - HeaderRow.defaultProps = { left: undefined, center: undefined, diff --git a/packages/core/src/Icon.js b/packages/core/src/Icon.tsx similarity index 80% rename from packages/core/src/Icon.js rename to packages/core/src/Icon.tsx index dfcad2be..390860a2 100644 --- a/packages/core/src/Icon.js +++ b/packages/core/src/Icon.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import icBEM from './utils/icBEM'; @@ -16,6 +15,7 @@ const ROOT_BEM = icBEM(COMPONENT_NAME); const GRAY = 'gray'; const BLUE = 'blue'; const RED = 'red'; +const colors = [GRAY, BLUE, RED] as const; const COLORS = { blue: '#45b0e6', @@ -41,15 +41,22 @@ function getSvgFill({ colorType, wrapperProps }) { return null; } +type OwnProps = { + type: string; + color?: typeof colors; + large?: boolean; + spinning?: boolean; + svgProps?: { + [key: string]: any; + }; +}; + +type Props = OwnProps & typeof Icon.defaultProps; + function Icon({ - type, - color, - large, - spinning, - className, - svgProps, - ...otherProps -}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Props... Remove this comment to see the full error message + type, color, large, spinning, className, svgProps, ...otherProps +}: Props) { let bemClass = ROOT_BEM .modifier('large', large) .modifier('spin', spinning); @@ -80,21 +87,12 @@ function Icon({ + {...otherProps}> {SvgComponent && } ); } -Icon.propTypes = { - type: PropTypes.string.isRequired, - color: PropTypes.oneOf([GRAY, BLUE, RED]), - large: PropTypes.bool, - spinning: PropTypes.bool, - svgProps: PropTypes.objectOf(PropTypes.any), -}; - Icon.defaultProps = { color: undefined, large: false, diff --git a/packages/core/src/IconButton.js b/packages/core/src/IconButton.tsx similarity index 51% rename from packages/core/src/IconButton.js rename to packages/core/src/IconButton.tsx index a6a6144e..ac898ec2 100644 --- a/packages/core/src/IconButton.js +++ b/packages/core/src/IconButton.tsx @@ -1,13 +1,22 @@ import React from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import EnhancedPropTypes from './utils/enhancedPropTypes'; import icBEM from './utils/icBEM'; import Button, { COMPONENT_NAME } from './Button'; import IconLayout from './IconLayout'; +type OwnProps = { + icon: string | React.ReactElement; + tinted?: boolean; + color?: any; // TODO: EnhancedPropTypes.isEmpty + solid?: any; // TODO: EnhancedPropTypes.isEmpty +}; + +type Props = OwnProps & typeof IconButton.defaultProps; + /** * * === @@ -17,14 +26,11 @@ import IconLayout from './IconLayout'; * However, `color` & `solid` props are invalid in `` */ function IconButton({ - icon, - tinted, - color, - solid, + icon, tinted, color, solid, // React props - className, - ...buttonProps -}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Props... Remove this comment to see the full error message + className, ...buttonProps +}: Props) { const bemClass = icBEM(COMPONENT_NAME) .modifier('icon-only') .modifier('tinted', tinted) @@ -33,22 +39,14 @@ function IconButton({ const rootClass = classNames(bemClass, className); return ( + // @ts-expect-error ts-migrate(2769) FIXME: Property 'className' does not exist on type 'Intri... Remove this comment to see the full error message ); } -IconButton.propTypes = { - icon: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.element - ]).isRequired, - tinted: PropTypes.bool, - color: EnhancedPropTypes.isEmpty, - solid: EnhancedPropTypes.isEmpty, -}; - IconButton.defaultProps = { tinted: false, color: undefined, diff --git a/packages/core/src/IconCheckbox.js b/packages/core/src/IconCheckbox.tsx similarity index 79% rename from packages/core/src/IconCheckbox.js rename to packages/core/src/IconCheckbox.tsx index 368f0f43..da052a7e 100644 --- a/packages/core/src/IconCheckbox.js +++ b/packages/core/src/IconCheckbox.tsx @@ -10,6 +10,7 @@ import Checkbox, { CHECKBOX_BUTTON } from './Checkbox'; * `` is a variant of ``. */ function IconCheckbox(props) { + // @ts-expect-error ts-migrate(2769) FIXME: Property 'icon' does not exist on type 'IntrinsicA... Remove this comment to see the full error message const buttonWithStatus = ; return ( diff --git a/packages/core/src/IconLayout.js b/packages/core/src/IconLayout.tsx similarity index 61% rename from packages/core/src/IconLayout.js rename to packages/core/src/IconLayout.tsx index 0160e710..060ff700 100644 --- a/packages/core/src/IconLayout.js +++ b/packages/core/src/IconLayout.tsx @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; -import PropTypes from 'prop-types'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import withStatus, { withStatusPropTypes } from './mixins/withStatus'; import wrapIfNotElement from './utils/wrapIfNotElement'; import prefixClass from './utils/prefixClass'; @@ -11,29 +11,32 @@ import Icon from './Icon'; import { STATUS_POSITION } from './StatusIcon'; -export const COMPONENT_NAME = prefixClass('iconlayout'); // Prevent from affected by 'gyp-icon-*' styles +export const COMPONENT_NAME = prefixClass('iconlayout'); + +/* +(ts-migrate) TODO: Migrate the remaining prop types +...withStatusPropTypes +*/ +type OwnProps = { + icon: string | React.ReactElement; + tooltip?: boolean; +}; + +type State = any; + +type Props = OwnProps & typeof IconLayout.defaultProps; // Prevent from affected by 'gyp-icon-*' styles /** * needs to be a valid React Component to maintain a ref * to its container node, so an anchored can find its position. */ -class IconLayout extends PureComponent { - static propTypes = { - icon: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.element - ]).isRequired, - tooltip: PropTypes.bool, - - ...withStatusPropTypes, - // statusIcon, - // errorMsg, - }; - +class IconLayout extends PureComponent { static defaultProps = { tooltip: true, }; + nodeRef: any; + state = { showTooltip: false, }; @@ -47,6 +50,7 @@ class IconLayout extends PureComponent { } renderTooltip() { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'errorMsg' does not exist on type 'Readon... Remove this comment to see the full error message const { tooltip, errorMsg } = this.props; if (!errorMsg || !tooltip) { @@ -59,14 +63,17 @@ class IconLayout extends PureComponent { */ return ( + {/* @ts-expect-error ts-migrate(2339) FIXME: Property 'errorMsg' does not exist on type 'Readon... Remove this comment to see the full error message */} {this.props.errorMsg} ); } render() { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusIcon' does not exist on type 'Read... Remove this comment to see the full error message const { icon, statusIcon } = this.props; const { showTooltip } = this.state; const iconElement = wrapIfNotElement(icon, { with: Icon, via: 'type' }); @@ -85,5 +92,6 @@ class IconLayout extends PureComponent { } } +// @ts-expect-error ts-migrate(2345) FIXME: Object literal may only specify known properties, ... Remove this comment to see the full error message export default withStatus({ position: STATUS_POSITION.CORNER })(IconLayout); export { IconLayout as PureIconLayout }; diff --git a/packages/core/src/InfiniteScroll.js b/packages/core/src/InfiniteScroll.tsx similarity index 83% rename from packages/core/src/InfiniteScroll.js rename to packages/core/src/InfiniteScroll.tsx index 314141c2..51e370fb 100644 --- a/packages/core/src/InfiniteScroll.js +++ b/packages/core/src/InfiniteScroll.tsx @@ -1,5 +1,4 @@ import React, { PureComponent, isValidElement } from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import documentOffset from 'document-offset'; @@ -23,6 +22,20 @@ const FILL_SPACE_TYPE = { MANUAL: 'manual' }; +type OwnProps = { + onLoadMore: (...args: any[]) => any; + threshold?: number; + isLoading?: boolean; + hasMore?: boolean; + usePageAsContainer?: boolean; + fillSpace?: any; // TODO: PropTypes.oneOf(Object.values(FILL_SPACE_TYPE)) + loadingLabel?: React.ReactNode; + showMoreButton?: React.ReactNode; + noNewestButton?: React.ReactNode; +}; + +type Props = OwnProps & typeof InfiniteScroll.defaultProps; + /** * @@ -32,21 +45,7 @@ const FILL_SPACE_TYPE = { * * @ref https://github.com/CassetteRocks/react-infinite-scroller */ -class InfiniteScroll extends PureComponent { - static propTypes = { - onLoadMore: PropTypes.func.isRequired, - threshold: PropTypes.number, // Distance in px before the end of items - isLoading: PropTypes.bool, - hasMore: PropTypes.bool, - usePageAsContainer: PropTypes.bool, - fillSpace: PropTypes.oneOf(Object.values(FILL_SPACE_TYPE)), - - // Footer children - loadingLabel: PropTypes.node, - showMoreButton: PropTypes.node, - noNewestButton: PropTypes.node - }; - +class InfiniteScroll extends PureComponent { static defaultProps = { threshold: 100, isLoading: false, @@ -59,13 +58,19 @@ class InfiniteScroll extends PureComponent { noNewestButton: null } + scrollContainer: any; + + scrollNode: any; + componentDidMount() { this.attachScrollListener(); + // @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0. this.loadMoreToFillSpace(); } componentDidUpdate() { // Auto trigger onLoadMore + // @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0. this.loadMoreToFillSpace(); } @@ -123,6 +128,7 @@ class InfiniteScroll extends PureComponent { const windowBodyElement = document.documentElement || document.body.parentNode || document.body; + // @ts-expect-error ts-migrate(2339) FIXME: Property 'scrollTop' does not exist on type 'Node ... Remove this comment to see the full error message return window.pageYOffset || windowBodyElement.scrollTop; } @@ -244,6 +250,7 @@ class InfiniteScroll extends PureComponent { return ( )} @@ -185,5 +207,6 @@ class SearchInput extends Component { } } +// @ts-expect-error ts-migrate(4082) FIXME: Default export of the module has or is using priva... Remove this comment to see the full error message export default rowComp()(SearchInput); export { SearchInput as PureSearchInput }; diff --git a/packages/core/src/Section.js b/packages/core/src/Section.tsx similarity index 75% rename from packages/core/src/Section.js rename to packages/core/src/Section.tsx index 9c0dc275..f3976f9a 100644 --- a/packages/core/src/Section.js +++ b/packages/core/src/Section.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import icBEM from './utils/icBEM'; @@ -15,17 +14,23 @@ export const BEM = { desc: ROOT_BEM.element('desc'), }; +type OwnProps = { + title?: React.ReactNode; + desc?: React.ReactNode; + verticalSpacing?: boolean; + bodySpacing?: boolean; + titleSize?: 'base' | 'small'; +}; + +type Props = OwnProps & typeof Section.defaultProps; + function Section({ - title, - titleSize, - desc, - verticalSpacing, // add margin to above and below
+ title, titleSize, desc, verticalSpacing, // add margin to above and below
bodySpacing, // add padding to body for components that are not row-based // React props - className, - children, - ...wrapperProps -}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Props... Remove this comment to see the full error message + className, children, ...wrapperProps +}: Props) { // Class names const rootClassName = classNames( BEM.root @@ -64,14 +69,6 @@ function Section({ ); } -Section.propTypes = { - title: PropTypes.node, - desc: PropTypes.node, - verticalSpacing: PropTypes.bool, - bodySpacing: PropTypes.bool, - titleSize: PropTypes.oneOf(['base', 'small']), -}; - Section.defaultProps = { title: undefined, desc: undefined, diff --git a/packages/core/src/SplitView.js b/packages/core/src/SplitView.tsx similarity index 100% rename from packages/core/src/SplitView.js rename to packages/core/src/SplitView.tsx diff --git a/packages/core/src/SplitViewColumn.js b/packages/core/src/SplitViewColumn.tsx similarity index 63% rename from packages/core/src/SplitViewColumn.js rename to packages/core/src/SplitViewColumn.tsx index b64736ba..f398ce7a 100644 --- a/packages/core/src/SplitViewColumn.js +++ b/packages/core/src/SplitViewColumn.tsx @@ -1,17 +1,21 @@ import React from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import { BEM } from './SplitView'; import './styles/SplitView.scss'; +type OwnProps = { + wide?: boolean; +}; + +type Props = OwnProps & typeof SplitViewColumn.defaultProps; + function SplitViewColumn({ wide, // React props - className, - children, - ...otherProps -}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Props... Remove this comment to see the full error message + className, children, ...otherProps +}: Props) { const columnBEM = BEM.column.modifier('wide', wide); const columnClassName = classNames(columnBEM.toString(), className); @@ -22,10 +26,6 @@ function SplitViewColumn({ ); } -SplitViewColumn.propTypes = { - wide: PropTypes.bool, -}; - SplitViewColumn.defaultProps = { wide: false, }; diff --git a/packages/core/src/StatusIcon.js b/packages/core/src/StatusIcon.tsx similarity index 86% rename from packages/core/src/StatusIcon.js rename to packages/core/src/StatusIcon.tsx index 13097176..85969b3f 100644 --- a/packages/core/src/StatusIcon.js +++ b/packages/core/src/StatusIcon.tsx @@ -22,7 +22,17 @@ const ROOT_BEM = icBEM(COMPONENT_NAME); const ICON_HIDE_TIMEOUT = 2 * 1000; -class StatusIcon extends PureComponent { +type OwnProps = { + status?: any; // TODO: PropTypes.oneOf([LOADING, SUCCESS, ERROR]) + position?: any; // TODO: PropTypes.oneOf([INLINE, CORNER]) + autohide?: boolean; +}; + +type State = any; + +type Props = OwnProps & typeof StatusIcon.defaultProps; + +class StatusIcon extends PureComponent { static propTypes = { status: PropTypes.oneOf([LOADING, SUCCESS, ERROR]), position: PropTypes.oneOf([INLINE, CORNER]), @@ -39,7 +49,9 @@ class StatusIcon extends PureComponent { autohide: true, }; - constructor(props) { + hideIconTimeout: any; + + constructor(props: Props) { super(props); this.hideIconTimeout = null; } @@ -52,7 +64,7 @@ class StatusIcon extends PureComponent { this.autoToggleStatusIcon(); } - componentWillReceiveProps(nextProps) { + componentWillReceiveProps(nextProps: Props) { if (nextProps.status !== this.props.status) { this.autoToggleStatusIcon(nextProps.status); } @@ -121,6 +133,7 @@ class StatusIcon extends PureComponent { break; } + // @ts-expect-error ts-migrate(2339) FIXME: Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message const wrapperProps = getRemainingProps(this.props, StatusIcon.propTypes); return (icon && ( diff --git a/packages/core/src/Switch.js b/packages/core/src/Switch.tsx similarity index 70% rename from packages/core/src/Switch.js rename to packages/core/src/Switch.tsx index c8df2dd2..c37a9372 100644 --- a/packages/core/src/Switch.js +++ b/packages/core/src/Switch.tsx @@ -1,5 +1,4 @@ import React, { PureComponent } from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import prefixClass from './utils/prefixClass'; @@ -19,6 +18,16 @@ export const BEM = { iconWrapper: ROOT_BEM.element('icon-wrapper'), }; +type OwnProps = { + input?: any; + checked?: boolean; + defaultChecked?: boolean; + disabled?: boolean; + onChange?: (...args: any[]) => any; +}; + +type Props = OwnProps & typeof Switch.defaultProps; + /** * * === @@ -27,25 +36,7 @@ export const BEM = { * with its underlying ``.` */ -class Switch extends PureComponent { - static propTypes = { - /** - * Use `input` to inject props to the underlying `` - */ - input: PropTypes.object, // eslint-disable-line react/forbid-prop-types - checked: PropTypes.bool, - defaultChecked: PropTypes.bool, - - /** - * `` props - */ - disabled: PropTypes.bool, - /** - * `` props - */ - onChange: PropTypes.func, - }; - +class Switch extends PureComponent { static defaultProps = { input: {}, checked: undefined, @@ -55,10 +46,13 @@ class Switch extends PureComponent { onChange: undefined, }; + inputRef: any; + renderSwitchButton(inputProps) { const button = ; return ( + // @ts-expect-error ts-migrate(2322) FIXME: Type 'BEMFactory' is not assignable to type 'strin... Remove this comment to see the full error message { this.inputRef = ref; }} @@ -66,6 +60,7 @@ class Switch extends PureComponent { className={BEM.input} {...inputProps} /> + {/* @ts-expect-error ts-migrate(2769) FIXME: Property 'icon' does not exist on type 'IntrinsicA... Remove this comment to see the full error message */} ); @@ -82,6 +77,7 @@ class Switch extends PureComponent { onChange, // React props + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message className, children, ...otherProps @@ -105,5 +101,6 @@ class Switch extends PureComponent { } } +// @ts-expect-error ts-migrate(4082) FIXME: Default export of the module has or is using priva... Remove this comment to see the full error message export default rowComp({ defaultAlign: 'reverse' })(Switch); export { Switch as PureSwitch }; diff --git a/packages/core/src/SwitchIcon.js b/packages/core/src/SwitchIcon.tsx similarity index 63% rename from packages/core/src/SwitchIcon.js rename to packages/core/src/SwitchIcon.tsx index 4b7645e8..f5569f28 100644 --- a/packages/core/src/SwitchIcon.js +++ b/packages/core/src/SwitchIcon.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import classNames from 'classnames'; import prefixClass from './utils/prefixClass'; @@ -17,27 +16,31 @@ const ON = 'on'; const OFF = 'off'; export const SWITCH_STATE = { ON, OFF }; +type OwnProps = { + state?: any; // TODO: PropTypes.oneOf([ON, OFF]) +}; + +type Props = OwnProps & typeof SwitchIcon.defaultProps; + /** * * === * * A `` is a visual element that is supposed to be like a 64x32 icon. */ -function SwitchIcon({ state, className, ...otherProps }) { +// @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Props... Remove this comment to see the full error message +function SwitchIcon({ state, className, ...otherProps }: Props) { const bemClass = BEM.root.modifier(state); const rootClassName = classNames(className, `${bemClass}`); return ( + {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'BEMFactory' is not assignable to type 'strin... Remove this comment to see the full error message */} ); } -SwitchIcon.propTypes = { - state: PropTypes.oneOf([ON, OFF]), -}; - SwitchIcon.defaultProps = { state: OFF, }; diff --git a/packages/core/src/Tag.js b/packages/core/src/Tag.tsx similarity index 100% rename from packages/core/src/Tag.js rename to packages/core/src/Tag.tsx diff --git a/packages/core/src/Text.js b/packages/core/src/Text.tsx similarity index 79% rename from packages/core/src/Text.js rename to packages/core/src/Text.tsx index ab5c41b8..2a52027b 100644 --- a/packages/core/src/Text.js +++ b/packages/core/src/Text.tsx @@ -22,6 +22,7 @@ import classNames from 'classnames'; import icBEM from './utils/icBEM'; import prefixClass from './utils/prefixClass'; import getRemainingProps from './utils/getRemainingProps'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import withStatus, { withStatusPropTypes } from './mixins/withStatus'; import './styles/Text.scss'; @@ -47,7 +48,23 @@ export const VERTICAL_ORDER = { REVERSE: 'reverse', }; -class Text extends PureComponent { +/* +(ts-migrate) TODO: Migrate the remaining prop types +...withStatusPropTypes +...BasicRow.propTypes +*/ +type OwnProps = { + align?: any; // TODO: PropTypes.oneOf([LEFT, CENTER, RIGHT]) + verticalOrder?: any; // TODO: PropTypes.oneOf([ VERTICAL_ORDER.NORMAL, VERTICAL_ORDER.REVERSE, ]) + aside?: React.ReactNode; + basicRow?: React.ReactElement; + noGrow?: boolean; + bold?: boolean; +}; + +type Props = OwnProps & typeof Text.defaultProps; + +class Text extends PureComponent { static propTypes = { align: PropTypes.oneOf([LEFT, CENTER, RIGHT]), verticalOrder: PropTypes.oneOf([ @@ -125,8 +142,10 @@ class Text extends PureComponent { verticalOrder, noGrow, bold, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message className, } = this.props; + // @ts-expect-error ts-migrate(2339) FIXME: Property 'propTypes' does not exist on type 'typeo... Remove this comment to see the full error message const wrapperProps = getRemainingProps(this.props, Text.propTypes); const bemClass = BEM.root @@ -146,5 +165,6 @@ class Text extends PureComponent { } } +// @ts-expect-error ts-migrate(4082) FIXME: Default export of the module has or is using priva... Remove this comment to see the full error message export default withStatus()(Text); export { Text as PureText }; diff --git a/packages/core/src/TextEllipsis.js b/packages/core/src/TextEllipsis.tsx similarity index 74% rename from packages/core/src/TextEllipsis.js rename to packages/core/src/TextEllipsis.tsx index 01d7db5a..d3a171c5 100644 --- a/packages/core/src/TextEllipsis.js +++ b/packages/core/src/TextEllipsis.tsx @@ -8,6 +8,7 @@ const ROOT_BEM = icBEM(COMPONENT_NAME); function TextEllipsis({ children, ...wrapperProps }) { return ( + // @ts-expect-error ts-migrate(2322) FIXME: Type 'BEMFactory' is not assignable to type 'strin... Remove this comment to see the full error message
{children}
diff --git a/packages/core/src/TextInput.js b/packages/core/src/TextInput.tsx similarity index 65% rename from packages/core/src/TextInput.js rename to packages/core/src/TextInput.tsx index 71ca260b..f00b855d 100644 --- a/packages/core/src/TextInput.js +++ b/packages/core/src/TextInput.tsx @@ -18,12 +18,19 @@ export const BEM = { input: ROOT_BEM.element('input'), }; +type OwnTextInputBasicRowProps = { + basic?: React.ReactNode; +}; + +type TextInputBasicRowProps = OwnTextInputBasicRowProps & typeof TextInputBasicRow.defaultProps; + // -------------------- // Helper components // -------------------- -export function TextInputBasicRow({ basic, className }) { +// @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'TextI... Remove this comment to see the full error message +export function TextInputBasicRow({ basic, className }: TextInputBasicRowProps) { return (
{basic} @@ -31,21 +38,23 @@ export function TextInputBasicRow({ basic, className }) { ); } -TextInputBasicRow.propTypes = { - basic: PropTypes.node, -}; - TextInputBasicRow.defaultProps = { basic: undefined, }; -export function InnerInput({ - multiLine, - minRows, - maxRows, - renderInput, - inputProps, -}) { +type OwnInnerInputProps = { + multiLine?: boolean; + minRows?: number; + maxRows?: number; + renderInput?: (...args: any[]) => any; + inputProps?: { + [key: string]: any; + }; +}; + +type InnerInputProps = OwnInnerInputProps & typeof InnerInput.defaultProps; + +export function InnerInput({ multiLine, minRows, maxRows, renderInput, inputProps, }: InnerInputProps) { if (renderInput) { return renderInput(inputProps); } @@ -55,27 +64,17 @@ export function InnerInput({ + {...inputProps} /> ); } return ( + {...inputProps} /> ); } -InnerInput.propTypes = { - multiLine: PropTypes.bool, - minRows: PropTypes.number, - maxRows: PropTypes.number, - renderInput: PropTypes.func, - inputProps: PropTypes.objectOf(PropTypes.any), -}; - InnerInput.defaultProps = { multiLine: false, minRows: 2, @@ -84,6 +83,16 @@ InnerInput.defaultProps = { inputProps: {}, }; +type TextInputProps = { + label?: React.ReactNode; + readOnly?: boolean; + disabled?: boolean; + renderInput?: (...args: any[]) => any; + multiLine?: boolean; + minRows?: number; + maxRows?: number; +}; + /** * A `` is a specialized ``, which holds an editable `` * as its main part. @@ -97,19 +106,13 @@ InnerInput.defaultProps = { */ function TextInput({ - label, - readOnly, - disabled, + label, readOnly, disabled, // props - renderInput, - multiLine, - minRows, - maxRows, + renderInput, multiLine, minRows, maxRows, // React props - className, - children, - ...inputProps -}, context) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'TextI... Remove this comment to see the full error message + className, children, ...inputProps +}: TextInputProps, context) { const rootClassName = classNames(className, COMPONENT_NAME); const { textProps } = context; @@ -125,8 +128,7 @@ function TextInput({ readOnly, disabled, ...inputProps, - }} - /> + }} /> ); const isEditable = !(readOnly || disabled); @@ -138,23 +140,11 @@ function TextInput({ basicRow={} bold={isEditable} basic={input} - aside={label} - /> + aside={label} />
); } -TextInput.propTypes = { - label: PropTypes.node, - readOnly: PropTypes.bool, - disabled: PropTypes.bool, - // props - renderInput: PropTypes.func, - multiLine: PropTypes.bool, - minRows: PropTypes.number, - maxRows: PropTypes.number, -}; - TextInput.defaultProps = { label: undefined, readOnly: false, @@ -173,4 +163,5 @@ TextInput.contextTypes = { }; export { TextInput as PureTextInput }; +// @ts-expect-error ts-migrate(4082) FIXME: Default export of the module has or is using priva... Remove this comment to see the full error message export default rowComp({ defaultVerticalOrder: VERTICAL_ORDER.REVERSE })(TextInput); diff --git a/packages/core/src/TextLabel.js b/packages/core/src/TextLabel.tsx similarity index 79% rename from packages/core/src/TextLabel.js rename to packages/core/src/TextLabel.tsx index 086aafb1..e2e7c08b 100644 --- a/packages/core/src/TextLabel.js +++ b/packages/core/src/TextLabel.tsx @@ -19,4 +19,5 @@ function TextLabel({ className, children, ...otherProps }) { // export for tests export { TextLabel as PureTextLabel }; +// @ts-expect-error ts-migrate(4082) FIXME: Default export of the module has or is using priva... Remove this comment to see the full error message export default rowComp()(TextLabel); diff --git a/packages/core/src/Tooltip.js b/packages/core/src/Tooltip.tsx similarity index 58% rename from packages/core/src/Tooltip.js rename to packages/core/src/Tooltip.tsx index 340bedfb..d96ba858 100644 --- a/packages/core/src/Tooltip.js +++ b/packages/core/src/Tooltip.tsx @@ -5,6 +5,7 @@ import icBEM from './utils/icBEM'; import prefixClass from './utils/prefixClass'; import anchored, { + // eslint-disable-next-line @typescript-eslint/no-unused-vars anchoredPropTypes, ANCHORED_PLACEMENT, } from './mixins/anchored'; @@ -22,33 +23,33 @@ const TOP = 'top'; const BOTTOM = 'bottom'; export const TOOLTIP_PLACEMENT = { TOP, BOTTOM }; +type OwnProps = { + placement?: any; // TODO: anchoredPropTypes.placement + arrowStyle?: any; // TODO: anchoredPropTypes.arrowStyle + nodeRef?: React.ReactNode; +}; + +type Props = OwnProps & typeof Tooltip.defaultProps; + function Tooltip({ - // from anchored() - placement, - arrowStyle, - nodeRef, +// from anchored() + placement, arrowStyle, nodeRef, // React props - className, - children, - ...otherProps -}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Props... Remove this comment to see the full error message + className, children, ...otherProps +}: Props) { const bemClass = BEM.root.modifier(placement); const rootClassName = classNames(className, `${bemClass}`); return ( {children} + {/* @ts-expect-error ts-migrate(2322) FIXME: Type 'BEMFactory' is not assignable to type 'strin... Remove this comment to see the full error message */} ); } -Tooltip.propTypes = { - placement: anchoredPropTypes.placement, - arrowStyle: anchoredPropTypes.arrowStyle, - nodeRef: anchoredPropTypes.nodeRef, -}; - Tooltip.defaultProps = { placement: TOP, arrowStyle: {}, @@ -57,6 +58,7 @@ Tooltip.defaultProps = { export { Tooltip as PureTooltip }; +// @ts-expect-error ts-migrate(4082) FIXME: Default export of the module has or is using priva... Remove this comment to see the full error message export default renderToLayer( anchored({ defaultPlacement: ANCHORED_PLACEMENT.TOP, diff --git a/packages/core/src/__tests__/index.test.js b/packages/core/src/__tests__/index.test.js index c581068c..d337b9b7 100644 --- a/packages/core/src/__tests__/index.test.js +++ b/packages/core/src/__tests__/index.test.js @@ -10,7 +10,7 @@ describe('Gypcrete Bundle', () => { const allFileNames = readdirSync(srcPath); const expectedFileNames = allFileNames.filter((fileName) => { const isJsFile = fileName.match(/\.[j|t]sx?$/); - const isIndexFile = fileName === 'index.js'; + const isIndexFile = fileName === 'index.ts'; return isJsFile && !isIndexFile; }); diff --git a/packages/core/src/contexts/listSpacing.js b/packages/core/src/contexts/listSpacing.ts similarity index 100% rename from packages/core/src/contexts/listSpacing.js rename to packages/core/src/contexts/listSpacing.ts diff --git a/packages/core/src/index.js b/packages/core/src/index.ts similarity index 100% rename from packages/core/src/index.js rename to packages/core/src/index.ts diff --git a/packages/core/src/mixins/__tests__/rowComp.test.js b/packages/core/src/mixins/__tests__/rowComp.test.js index 0a83841d..c88f6b94 100644 --- a/packages/core/src/mixins/__tests__/rowComp.test.js +++ b/packages/core/src/mixins/__tests__/rowComp.test.js @@ -2,8 +2,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { shallow } from 'enzyme'; -import Icon from 'src/Icon'; -import Text from 'src/Text'; +import Icon from '../../Icon'; +import Text from '../../Text'; import rowComp from '../rowComp'; diff --git a/packages/core/src/mixins/__tests__/withStatus.test.js b/packages/core/src/mixins/__tests__/withStatus.test.js index ce41f5ee..52b13b35 100644 --- a/packages/core/src/mixins/__tests__/withStatus.test.js +++ b/packages/core/src/mixins/__tests__/withStatus.test.js @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; import ReactDOM from 'react-dom'; import { shallow, mount } from 'enzyme'; -import StatusIcon from 'src/StatusIcon'; +import StatusIcon from '../../StatusIcon'; import withStatus, { withStatusPropTypes } from '../withStatus'; diff --git a/packages/core/src/mixins/anchored/getPositionState.js b/packages/core/src/mixins/anchored/getPositionState.ts similarity index 100% rename from packages/core/src/mixins/anchored/getPositionState.js rename to packages/core/src/mixins/anchored/getPositionState.ts diff --git a/packages/core/src/mixins/anchored/index.js b/packages/core/src/mixins/anchored/index.tsx similarity index 84% rename from packages/core/src/mixins/anchored/index.js rename to packages/core/src/mixins/anchored/index.tsx index 8abe560d..515388af 100644 --- a/packages/core/src/mixins/anchored/index.js +++ b/packages/core/src/mixins/anchored/index.tsx @@ -5,7 +5,8 @@ import memoize from 'memoize-one'; import getComponentName from '../../utils/getComponentName'; import getPositionState, { PLACEMENT, - // eslint-disable-next-line import/named, no-unused-vars + // @ts-expect-error ts-migrate(2724) FIXME: Module '"./getPositionState"' has no exported memb... Remove this comment to see the full error message + // eslint-disable-next-line import/named, no-unused-vars, @typescript-eslint/no-unused-vars Placement, // type alias } from './getPositionState'; @@ -83,6 +84,7 @@ class Example extends React.Component { * @param {number} options.edgePadding - the number to be deducted when calculating “safe area” */ +// @ts-expect-error ts-migrate(4025) FIXME: Exported variable 'anchored' has or is using priva... Remove this comment to see the full error message const anchored = ({ defaultPlacement = PLACEMENT.BOTTOM, edgePadding = 16, @@ -112,7 +114,9 @@ const anchored = ({ render() { const { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'anchor' does not exist on type 'Readonly... Remove this comment to see the full error message anchor, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'style' does not exist on type 'Readonly<... Remove this comment to see the full error message style, ...otherProps } = this.props; diff --git a/packages/core/src/mixins/closable.js b/packages/core/src/mixins/closable.tsx similarity index 74% rename from packages/core/src/mixins/closable.js rename to packages/core/src/mixins/closable.tsx index f8203859..81b1e792 100644 --- a/packages/core/src/mixins/closable.js +++ b/packages/core/src/mixins/closable.tsx @@ -21,6 +21,7 @@ const ESCAPE = 'Escape'; * * Formerlly `escapable()`. */ +// @ts-expect-error ts-migrate(4025) FIXME: Exported variable 'closable' has or is using priva... Remove this comment to see the full error message const closable = ({ onEscape = true, onClickOutside = false, @@ -63,6 +64,7 @@ const closable = ({ } getOptions() { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'closable' does not exist on type 'Readon... Remove this comment to see the full error message const { closable: runtimeOptions } = this.props; /** @type {typeof mixinDefaults} */ @@ -81,6 +83,7 @@ const closable = ({ const options = this.getOptions(); if (options.onEscape && event.keyCode === keycode(ESCAPE)) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'onClose' does not exist on type 'Readonl... Remove this comment to see the full error message this.props.onClose(event); } } @@ -96,6 +99,7 @@ const closable = ({ } if (options.onClickOutside) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'onClose' does not exist on type 'Readonl... Remove this comment to see the full error message this.props.onClose(event); } } @@ -107,13 +111,16 @@ const closable = ({ const options = this.getOptions(); if (options.onClickInside) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'onClose' does not exist on type 'Readonl... Remove this comment to see the full error message this.props.onClose(event); } } render() { const { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'onClose' does not exist on type 'Readonl... Remove this comment to see the full error message onClose, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'closable' does not exist on type 'Readon... Remove this comment to see the full error message closable: runtimeOptions, ...otherProps } = this.props; @@ -123,12 +130,10 @@ const closable = ({
+ onClick={this.handleOuterLayerClick} /> + {...otherProps} /> ); } diff --git a/packages/core/src/mixins/escapable.js b/packages/core/src/mixins/escapable.tsx similarity index 80% rename from packages/core/src/mixins/escapable.js rename to packages/core/src/mixins/escapable.tsx index 27a59392..2b2771ed 100644 --- a/packages/core/src/mixins/escapable.js +++ b/packages/core/src/mixins/escapable.tsx @@ -25,7 +25,11 @@ function escapable(WrappedComponent) { }; + keyUpListener: any; + + componentDidMount() { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'onEscape' does not exist on type 'Readon... Remove this comment to see the full error message this.keyUpListener = createEscapeListener(this.props.onEscape); document.addEventListener('keyup', this.keyUpListener); // #DEPRECATED: remove in next major release @@ -38,6 +42,7 @@ function escapable(WrappedComponent) { render() { // Stripe callback prop from + // @ts-expect-error ts-migrate(2339) FIXME: Property 'onEscape' does not exist on type 'Readon... Remove this comment to see the full error message // eslint-disable-next-line no-unused-vars const { onEscape, ...otherProps } = this.props; return ; diff --git a/packages/core/src/mixins/renderToLayer.js b/packages/core/src/mixins/renderToLayer.tsx similarity index 92% rename from packages/core/src/mixins/renderToLayer.js rename to packages/core/src/mixins/renderToLayer.tsx index c045a8da..1b1ba18e 100644 --- a/packages/core/src/mixins/renderToLayer.js +++ b/packages/core/src/mixins/renderToLayer.tsx @@ -29,12 +29,15 @@ export function createLayer() { * @example * const ExternalComponent = renderToLayer(Component); */ +// @ts-expect-error ts-migrate(4060) FIXME: Return type of exported function has or is using p... Remove this comment to see the full error message function renderToLayer(WrappedComponent) { const componentName = getComponentName(WrappedComponent); class RenderToLayer extends Component { static displayName = `renderToLayer(${componentName})`; + baseLayer: any; + state = { inDOM: false, }; diff --git a/packages/core/src/mixins/rowComp.js b/packages/core/src/mixins/rowComp.tsx similarity index 63% rename from packages/core/src/mixins/rowComp.js rename to packages/core/src/mixins/rowComp.tsx index 1e4f0171..0fad0c92 100644 --- a/packages/core/src/mixins/rowComp.js +++ b/packages/core/src/mixins/rowComp.tsx @@ -104,6 +104,7 @@ export function getTextLayoutProps(compAlign, hasIcon) { }; } +// @ts-expect-error ts-migrate(4025) FIXME: Exported variable 'rowComp' has or is using privat... Remove this comment to see the full error message const rowComp = ({ defaultMinified = false, defaultAlign = LEFT, @@ -181,6 +182,7 @@ const rowComp = ({ }; getChildContext() { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'status' does not exist on type 'Readonly... Remove this comment to see the full error message const { status, statusOptions, errorMsg } = this.props; const textProps = this.getTextProps(); @@ -195,12 +197,19 @@ const rowComp = ({ getTextProps() { const { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'align' does not exist on type 'Readonly<... Remove this comment to see the full error message align, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'verticalOrder' does not exist on type 'R... Remove this comment to see the full error message verticalOrder, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'icon' does not exist on type 'Readonly<{... Remove this comment to see the full error message icon, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'basic' does not exist on type 'Readonly<... Remove this comment to see the full error message basic, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'aside' does not exist on type 'Readonly<... Remove this comment to see the full error message aside, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'tag' does not exist on type 'Readonly<{}... Remove this comment to see the full error message tag, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'bold' does not exist on type 'Readonly<{... Remove this comment to see the full error message bold, } = this.props; @@ -217,6 +226,7 @@ const rowComp = ({ } renderIconElement() { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'icon' does not exist on type 'Readonly<{... Remove this comment to see the full error message const { icon } = this.props; if (!icon) { @@ -240,26 +250,43 @@ const rowComp = ({ render() { const { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'minified' does not exist on type 'Readon... Remove this comment to see the full error message minified, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'avatar' does not exist on type 'Readonly... Remove this comment to see the full error message avatar, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'align' does not exist on type 'Readonly<... Remove this comment to see the full error message align, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'verticalOrder' does not exist on type 'R... Remove this comment to see the full error message verticalOrder, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'icon' does not exist on type 'Readonly<{... Remove this comment to see the full error message icon, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'basic' does not exist on type 'Readonly<... Remove this comment to see the full error message basic, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'aside' does not exist on type 'Readonly<... Remove this comment to see the full error message aside, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'tag' does not exist on type 'Readonly<{}... Remove this comment to see the full error message tag, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'bold' does not exist on type 'Readonly<{... Remove this comment to see the full error message bold, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'active' does not exist on type 'Readonly... Remove this comment to see the full error message active, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'highlight' does not exist on type 'Reado... Remove this comment to see the full error message highlight, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'disabled' does not exist on type 'Readon... Remove this comment to see the full error message disabled, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'muted' does not exist on type 'Readonly<... Remove this comment to see the full error message muted, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'status' does not exist on type 'Readonly... Remove this comment to see the full error message status, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusOptions' does not exist on type 'R... Remove this comment to see the full error message statusOptions, + // @ts-expect-error ts-migrate(2339) FIXME: Property 'errorMsg' does not exist on type 'Readon... Remove this comment to see the full error message errorMsg, // React props + // @ts-expect-error ts-migrate(2339) FIXME: Property 'className' does not exist on type 'Reado... Remove this comment to see the full error message className, children, diff --git a/packages/core/src/mixins/withStatus.js b/packages/core/src/mixins/withStatus.tsx similarity index 79% rename from packages/core/src/mixins/withStatus.js rename to packages/core/src/mixins/withStatus.tsx index 1ce14301..31ab0af3 100644 --- a/packages/core/src/mixins/withStatus.js +++ b/packages/core/src/mixins/withStatus.tsx @@ -21,6 +21,7 @@ export const withStatusPropTypes = { errorMsg: statusPropTypes.errorMsg, }; +// @ts-expect-error ts-migrate(4025) FIXME: Exported variable 'withStatus' has or is using pri... Remove this comment to see the full error message const withStatus = ({ withRef = false, withRawStatus = false, @@ -39,6 +40,7 @@ const withStatus = ({ }; getRenderedComponent() { + // @ts-expect-error ts-migrate(2551) FIXME: Property 'renderedComponentRef' does not exist on ... Remove this comment to see the full error message return this.renderedComponentRef; } @@ -46,6 +48,7 @@ const withStatus = ({ const props = {}; if (withRawStatus) { + // @ts-expect-error ts-migrate(2339) FIXME: Property 'status' does not exist on type '{}'. props.status = this.context.status; } @@ -63,6 +66,7 @@ const withStatus = ({ ); const refProps = !withRef ? {} : { + // @ts-expect-error ts-migrate(2551) FIXME: Property 'renderedComponentRef' does not exist on ... Remove this comment to see the full error message ref: (ref) => { this.renderedComponentRef = ref; }, }; const optionalProps = this.getOptionalProps(); diff --git a/packages/core/src/utils/enhancedPropTypes.js b/packages/core/src/utils/enhancedPropTypes.ts similarity index 100% rename from packages/core/src/utils/enhancedPropTypes.js rename to packages/core/src/utils/enhancedPropTypes.ts diff --git a/packages/core/src/utils/getComponentName.js b/packages/core/src/utils/getComponentName.ts similarity index 100% rename from packages/core/src/utils/getComponentName.js rename to packages/core/src/utils/getComponentName.ts diff --git a/packages/core/src/utils/getRemainingProps.js b/packages/core/src/utils/getRemainingProps.ts similarity index 100% rename from packages/core/src/utils/getRemainingProps.js rename to packages/core/src/utils/getRemainingProps.ts diff --git a/packages/core/src/utils/getStateClassnames.js b/packages/core/src/utils/getStateClassnames.ts similarity index 100% rename from packages/core/src/utils/getStateClassnames.js rename to packages/core/src/utils/getStateClassnames.ts diff --git a/packages/core/src/utils/icBEM.js b/packages/core/src/utils/icBEM.ts similarity index 74% rename from packages/core/src/utils/icBEM.js rename to packages/core/src/utils/icBEM.ts index 06f9329a..75ad910a 100644 --- a/packages/core/src/utils/icBEM.js +++ b/packages/core/src/utils/icBEM.ts @@ -19,13 +19,19 @@ const ELEMENT_SEPARATOR = '__'; const MODIFIER_SEPARATOR = '--'; export class BEMFactory { + _block: any; + + _nonBemClasses: any; + constructor({ block, element, modifiers = [], nonBemClasses = [] }) { if (!block) { throw new Error('block is required.'); } this._block = block; + // @ts-expect-error ts-migrate(2551) FIXME: Property '_element' does not exist on type 'BEMFac... Remove this comment to see the full error message this._element = element; + // @ts-expect-error ts-migrate(2551) FIXME: Property '_modifiers' does not exist on type 'BEMF... Remove this comment to see the full error message this._modifiers = modifiers; this._nonBemClasses = nonBemClasses; @@ -58,6 +64,7 @@ export class BEMFactory { if (isOn && isNonEmptyString(modifierIdentifier)) { return new BEMFactory({ ...this.toHash(), + // @ts-expect-error ts-migrate(2551) FIXME: Property '_modifiers' does not exist on type 'BEMF... Remove this comment to see the full error message modifiers: [...this._modifiers, modifierIdentifier] }); } @@ -87,6 +94,7 @@ export class BEMFactory { * @return {String} */ toString({ stripBlock = false } = {}) { + // @ts-expect-error ts-migrate(2339) FIXME: Property '_element' does not exist on type 'BEMFac... Remove this comment to see the full error message const { _block, _element, _modifiers, _nonBemClasses } = this; const baseClass = (typeof _element !== 'undefined') @@ -112,7 +120,9 @@ export class BEMFactory { toHash() { return { block: this._block, + // @ts-expect-error ts-migrate(2551) FIXME: Property '_element' does not exist on type 'BEMFac... Remove this comment to see the full error message element: this._element, + // @ts-expect-error ts-migrate(2551) FIXME: Property '_modifiers' does not exist on type 'BEMF... Remove this comment to see the full error message modifiers: this._modifiers.slice(0), nonBemClasses: this._nonBemClasses.slice(0) }; @@ -126,6 +136,7 @@ export class BEMFactory { // Creates BEM chain based on context type function icBEM(blockName) { if (typeof blockName === 'string') { + // @ts-expect-error ts-migrate(2345) FIXME: Property 'element' is missing in type '{ block: st... Remove this comment to see the full error message return new BEMFactory({ block: blockName }); } throw new Error('blockName should be a non-empty String.'); diff --git a/packages/core/src/utils/isNonEmptyString.js b/packages/core/src/utils/isNonEmptyString.ts similarity index 100% rename from packages/core/src/utils/isNonEmptyString.js rename to packages/core/src/utils/isNonEmptyString.ts diff --git a/packages/core/src/utils/prefixClass.js b/packages/core/src/utils/prefixClass.ts similarity index 100% rename from packages/core/src/utils/prefixClass.js rename to packages/core/src/utils/prefixClass.ts diff --git a/packages/core/src/utils/randId.js b/packages/core/src/utils/randId.ts similarity index 100% rename from packages/core/src/utils/randId.js rename to packages/core/src/utils/randId.ts diff --git a/packages/core/src/utils/wrapIfNotElement.js b/packages/core/src/utils/wrapIfNotElement.tsx similarity index 100% rename from packages/core/src/utils/wrapIfNotElement.js rename to packages/core/src/utils/wrapIfNotElement.tsx diff --git a/packages/form/src/TextInputRow.js b/packages/form/src/TextInputRow.js index cd768dae..ca67ce9a 100644 --- a/packages/form/src/TextInputRow.js +++ b/packages/form/src/TextInputRow.js @@ -12,6 +12,7 @@ import formRow, { rowPropTypes } from './mixins/formRow'; */ function TextInputRow({ // from formRow() + // eslint-disable-next-line react/prop-types ineditable, // unwanted prop readOnly, disabled, diff --git a/yarn.lock b/yarn.lock index f7f2314e..14589771 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3523,6 +3523,15 @@ array.prototype.flatmap@^1.2.1: es-abstract "^1.10.0" function-bind "^1.1.1" +array.prototype.flatmap@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.3.tgz#1c13f84a178566042dd63de4414440db9222e443" + integrity sha512-OOEk+lkePcg+ODXIpvuU9PAryCikCJyo7GlDG1upleEpQRx6mzL9puEBkozQ5iAx20KV0l3DbyQwqciJtqe5Pg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + function-bind "^1.1.1" + array.prototype.map@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array.prototype.map/-/array.prototype.map-1.0.2.tgz#9a4159f416458a23e9483078de1106b2ef68f8ec" @@ -6438,6 +6447,23 @@ es-abstract@^1.10.0, es-abstract@^1.12.0, es-abstract@^1.17.0, es-abstract@^1.17 string.prototype.trimleft "^2.1.1" string.prototype.trimright "^2.1.1" +es-abstract@^1.17.5: + version "1.17.6" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a" + integrity sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw== + dependencies: + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + is-callable "^1.2.0" + is-regex "^1.1.0" + object-inspect "^1.7.0" + object-keys "^1.1.1" + object.assign "^4.1.0" + string.prototype.trimend "^1.0.1" + string.prototype.trimstart "^1.0.1" + es-array-method-boxes-properly@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" @@ -6657,16 +6683,22 @@ eslint-plugin-jsx-a11y@^6.1.2: has "^1.0.3" jsx-ast-utils "^2.0.1" -eslint-plugin-react@^7.11.1: - version "7.11.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz#c01a7af6f17519457d6116aa94fc6d2ccad5443c" - integrity sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw== +eslint-plugin-react@^7.20.6: + version "7.20.6" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.20.6.tgz#4d7845311a93c463493ccfa0a19c9c5d0fd69f60" + integrity sha512-kidMTE5HAEBSLu23CUDvj8dc3LdBU0ri1scwHBZjI41oDv4tjsWZKU7MQccFzH1QYPYhsnTF2ovh7JlcIcmxgg== dependencies: - array-includes "^3.0.3" + array-includes "^3.1.1" + array.prototype.flatmap "^1.2.3" doctrine "^2.1.0" has "^1.0.3" - jsx-ast-utils "^2.0.1" - prop-types "^15.6.2" + jsx-ast-utils "^2.4.1" + object.entries "^1.1.2" + object.fromentries "^2.0.2" + object.values "^1.1.1" + prop-types "^15.7.2" + resolve "^1.17.0" + string.prototype.matchall "^4.0.2" eslint-restricted-globals@^0.1.1: version "0.1.1" @@ -8681,6 +8713,11 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.1.5: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.5.tgz#f7e46b596890456db74e7f6e976cb3273d06faab" integrity sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q== +is-callable@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb" + integrity sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw== + is-ci@^1.0.10: version "1.1.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" @@ -8948,6 +8985,13 @@ is-regex@^1.0.3, is-regex@^1.0.4, is-regex@^1.0.5: dependencies: has "^1.0.3" +is-regex@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.1.tgz#c6f98aacc546f6cec5468a07b7b153ab564a57b9" + integrity sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg== + dependencies: + has-symbols "^1.0.1" + is-regexp@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-2.1.0.tgz#cd734a56864e23b956bf4e7c66c396a4c0b22c2d" @@ -9828,6 +9872,14 @@ jsx-ast-utils@^2.0.1: dependencies: array-includes "^3.0.3" +jsx-ast-utils@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz#1114a4c1209481db06c690c2b4f488cc665f657e" + integrity sha512-z1xSldJ6imESSzOjd3NNkieVJKRlKYSOtMG8SFyCj2FIrvSaSuli/WjpBkEzCBoR9bYYYFgqJw61Xhu7Lcgk+w== + dependencies: + array-includes "^3.1.1" + object.assign "^4.1.0" + keycode@^2.1.9: version "2.2.0" resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.2.0.tgz#3d0af56dc7b8b8e5cba8d0a97f107204eec22b04" @@ -11342,7 +11394,16 @@ object.entries@^1.0.4, object.entries@^1.1.0: function-bind "^1.1.1" has "^1.0.3" -"object.fromentries@^2.0.0 || ^1.0.0": +object.entries@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.2.tgz#bc73f00acb6b6bb16c203434b10f9a7e797d3add" + integrity sha512-BQdB9qKmb/HyNdMNWVr7O3+z5MUIx3aiegEIJqjMBbBf0YT9RRxTJSim4mzFqtyr7PDAHigq0N9dO0m0tRakQA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + has "^1.0.3" + +"object.fromentries@^2.0.0 || ^1.0.0", object.fromentries@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.2.tgz#4a09c9b9bb3843dd0f89acdb517a794d4f355ac9" integrity sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ== @@ -14626,7 +14687,7 @@ string-width@^4.0.0, string-width@^4.1.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -"string.prototype.matchall@^4.0.0 || ^3.0.1": +"string.prototype.matchall@^4.0.0 || ^3.0.1", string.prototype.matchall@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz#48bb510326fb9fdeb6a33ceaa81a6ea04ef7648e" integrity sha512-N/jp6O5fMf9os0JU3E72Qhf590RSRZU/ungsL/qJUYVTNv7hTG0P/dbPjxINVN9jpscu3nzYwKESU3P3RY5tOg== @@ -14665,6 +14726,14 @@ string.prototype.trim@^1.1.2: es-abstract "^1.5.0" function-bind "^1.0.2" +string.prototype.trimend@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" + integrity sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + string.prototype.trimleft@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz#9bdb8ac6abd6d602b17a4ed321870d2f8dcefc74" @@ -14681,6 +14750,14 @@ string.prototype.trimright@^2.1.1: define-properties "^1.1.3" function-bind "^1.1.1" +string.prototype.trimstart@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" + integrity sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + string_decoder@^1.0.0, string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"