Merge commit '8f66126b1010e0aaaa8b5f2a2f4ea8a28824e2b7' into glitch-soc/merge-upstream

pull/62/head
Claire 2023-05-28 13:55:30 +02:00
commit 9381f78166
241 changed files with 366 additions and 473 deletions

View File

@ -101,7 +101,12 @@ module.exports = {
'react/jsx-equals-spacing': 'error',
'react/jsx-no-bind': 'error',
'react/jsx-no-target-blank': 'off',
'react/jsx-tag-spacing': 'error',
'react/jsx-uses-react': 'off', // not needed with new JSX transform
'react/jsx-wrap-multilines': 'error',
'react/no-deprecated': 'off',
'react/no-unknown-property': 'off',
'react/react-in-jsx-scope': 'off', // not needed with new JSX transform
'react/self-closing-comp': 'error',
// recommended values found in https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/index.js
@ -339,6 +344,9 @@ module.exports = {
'import/no-default-export': 'warn',
'react/prefer-stateless-function': 'warn',
'react/function-component-definition': ['error', { namedComponents: 'arrow-function' }],
'react/jsx-uses-react': 'off', // not needed with new JSX transform
'react/react-in-jsx-scope': 'off', // not needed with new JSX transform
'react/prop-types': 'off',
},
},
{

View File

@ -1,4 +1,3 @@
import React from 'react';
import renderer from 'react-test-renderer';
import AutosuggestEmoji from '../autosuggest_emoji';

View File

@ -1,4 +1,3 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { fromJS } from 'immutable';
import { Avatar } from '../avatar';

View File

@ -1,4 +1,3 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { fromJS } from 'immutable';
import { AvatarOverlay } from '../avatar_overlay';

View File

@ -1,5 +1,4 @@
import { render, fireEvent, screen } from '@testing-library/react';
import React from 'react';
import renderer from 'react-test-renderer';
import Button from '../button';

View File

@ -1,4 +1,3 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { fromJS } from 'immutable';
import { DisplayName } from '../display_name';

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { Avatar } from './avatar';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import api from 'mastodon/api';
import { FormattedNumber } from 'react-intl';
@ -24,7 +24,7 @@ const percIncrease = (a, b) => {
return percent;
};
export default class Counter extends React.PureComponent {
export default class Counter extends PureComponent {
static propTypes = {
measure: PropTypes.string.isRequired,
@ -62,25 +62,25 @@ export default class Counter extends React.PureComponent {
if (loading) {
content = (
<React.Fragment>
<Fragment>
<span className='sparkline__value__total'><Skeleton width={43} /></span>
<span className='sparkline__value__change'><Skeleton width={43} /></span>
</React.Fragment>
</Fragment>
);
} else {
const measure = data[0];
const percentChange = measure.previous_total && percIncrease(measure.previous_total * 1, measure.total * 1);
content = (
<React.Fragment>
<Fragment>
<span className='sparkline__value__total'>{measure.human_value || <FormattedNumber value={measure.total} />}</span>
{measure.previous_total && (<span className={classNames('sparkline__value__change', { positive: percentChange > 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'}<FormattedNumber value={percentChange} style='percent' /></span>)}
</React.Fragment>
</Fragment>
);
}
const inner = (
<React.Fragment>
<Fragment>
<div className='sparkline__value'>
{content}
</div>
@ -96,7 +96,7 @@ export default class Counter extends React.PureComponent {
</Sparklines>
)}
</div>
</React.Fragment>
</Fragment>
);
if (href) {

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'mastodon/api';
import { FormattedNumber } from 'react-intl';
import { roundTo10 } from 'mastodon/utils/numbers';
import { Skeleton } from 'mastodon/components/skeleton';
export default class Dimension extends React.PureComponent {
export default class Dimension extends PureComponent {
static propTypes = {
dimension: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'mastodon/api';
import { injectIntl, defineMessages } from 'react-intl';
@ -10,7 +10,7 @@ const messages = defineMessages({
violation: { id: 'report.categories.violation', defaultMessage: 'Content violates one or more server rules' },
});
class Category extends React.PureComponent {
class Category extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,
@ -52,7 +52,7 @@ class Category extends React.PureComponent {
}
class Rule extends React.PureComponent {
class Rule extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,
@ -84,7 +84,7 @@ class Rule extends React.PureComponent {
}
class ReportReasonSelector extends React.PureComponent {
class ReportReasonSelector extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'mastodon/api';
import { FormattedMessage, FormattedNumber, FormattedDate } from 'react-intl';
@ -14,7 +14,7 @@ const dateForCohort = cohort => {
}
};
export default class Retention extends React.PureComponent {
export default class Retention extends PureComponent {
static propTypes = {
start_at: PropTypes.string,

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import api from 'mastodon/api';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import Hashtag from 'mastodon/components/hashtag';
export default class Trends extends React.PureComponent {
export default class Trends extends PureComponent {
static propTypes = {
limit: PropTypes.number.isRequired,

View File

@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import { TransitionMotion, spring } from 'react-motion';

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,9 +1,9 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light';
import { assetHost } from 'mastodon/utils/config';
export default class AutosuggestEmoji extends React.PureComponent {
export default class AutosuggestEmoji extends PureComponent {
static propTypes = {
emoji: PropTypes.object.isRequired,

View File

@ -1,9 +1,9 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ShortNumber from 'mastodon/components/short_number';
import { FormattedMessage } from 'react-intl';
export default class AutosuggestHashtag extends React.PureComponent {
export default class AutosuggestHashtag extends PureComponent {
static propTypes = {
tag: PropTypes.shape({

View File

@ -1,4 +1,3 @@
import React from 'react';
import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container';
import AutosuggestEmoji from './autosuggest_emoji';
import AutosuggestHashtag from './autosuggest_hashtag';

View File

@ -1,4 +1,3 @@
import React from 'react';
import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container';
import AutosuggestEmoji from './autosuggest_emoji';
import AutosuggestHashtag from './autosuggest_hashtag';

View File

@ -1,5 +1,3 @@
import * as React from 'react';
import classNames from 'classnames';
import { useHovering } from '../../hooks/useHovering';

View File

@ -1,10 +1,10 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { autoPlayGif } from '../initial_state';
import { Avatar } from './avatar';
export default class AvatarComposite extends React.PureComponent {
export default class AvatarComposite extends PureComponent {
static propTypes = {
accounts: ImmutablePropTypes.list.isRequired,

View File

@ -1,5 +1,3 @@
import React from 'react';
import { useHovering } from '../../hooks/useHovering';
import type { Account } from '../../types/resources';
import { autoPlayGif } from '../initial_state';

View File

@ -1,4 +1,4 @@
import React, { useRef, useEffect } from 'react';
import { memo, useRef, useEffect } from 'react';
import { decode } from 'blurhash';
@ -43,6 +43,6 @@ const Blurhash: React.FC<Props> = ({
);
};
const MemoizedBlurhash = React.memo(Blurhash);
const MemoizedBlurhash = memo(Blurhash);
export { MemoizedBlurhash as Blurhash };

View File

@ -1,8 +1,8 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
export default class Button extends React.PureComponent {
export default class Button extends PureComponent {
static propTypes = {
text: PropTypes.node,

View File

@ -1,5 +1,3 @@
import React from 'react';
export const Check: React.FC = () => (
<svg
xmlns='http://www.w3.org/2000/svg'

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { supportsPassiveEvents } from 'detect-passive-events';
import { scrollTop } from '../scroll';
const listenerOptions = supportsPassiveEvents ? { passive: true } : false;
export default class Column extends React.PureComponent {
export default class Column extends PureComponent {
static propTypes = {
children: PropTypes.node,

View File

@ -1,10 +1,10 @@
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import { Icon } from 'mastodon/components/icon';
import { createPortal } from 'react-dom';
export default class ColumnBackButton extends React.PureComponent {
export default class ColumnBackButton extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,4 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import ColumnBackButton from './column_back_button';
import { Icon } from 'mastodon/components/icon';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { createPortal } from 'react-dom';
import classNames from 'classnames';
@ -12,7 +12,7 @@ const messages = defineMessages({
moveRight: { id: 'column_header.moveRight_settings', defaultMessage: 'Move column to the right' },
});
class ColumnHeader extends React.PureComponent {
class ColumnHeader extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,5 +1,4 @@
// @ts-check
import React from 'react';
import { FormattedMessage } from 'react-intl';
/**

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import { IconButton } from './icon_button';
import PropTypes from 'prop-types';
import { injectIntl, defineMessages } from 'react-intl';
@ -8,7 +8,7 @@ const messages = defineMessages({
dismiss: { id: 'dismissable_banner.dismiss', defaultMessage: 'Dismiss' },
});
class DismissableBanner extends React.PureComponent {
class DismissableBanner extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React, { useCallback } from 'react';
import { useCallback } from 'react';
import type { InjectedIntl } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent, cloneElement, Children, Fragment } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { IconButton } from './icon_button';
@ -10,7 +10,7 @@ import { CircularProgress } from 'mastodon/components/loading_indicator';
const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true;
let id = 0;
class DropdownMenu extends React.PureComponent {
class DropdownMenu extends PureComponent {
static contextTypes = {
router: PropTypes.object,
@ -155,7 +155,7 @@ class DropdownMenu extends React.PureComponent {
}
export default class Dropdown extends React.PureComponent {
export default class Dropdown extends PureComponent {
static contextTypes = {
router: PropTypes.object,
@ -286,7 +286,7 @@ export default class Dropdown extends React.PureComponent {
const open = this.state.id === openDropdownId;
const button = children ? React.cloneElement(React.Children.only(children), {
const button = children ? cloneElement(Children.only(children), {
onClick: this.handleClick,
onMouseDown: this.handleMouseDown,
onKeyDown: this.handleButtonKeyDown,
@ -306,7 +306,7 @@ export default class Dropdown extends React.PureComponent {
);
return (
<React.Fragment>
<Fragment>
<span ref={this.setTargetRef}>
{button}
</span>
@ -329,7 +329,7 @@ export default class Dropdown extends React.PureComponent {
</div>
)}
</Overlay>
</React.Fragment>
</Fragment>
);
}

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl } from 'react-intl';
import { Icon } from 'mastodon/components/icon';
@ -16,7 +16,7 @@ const mapDispatchToProps = (dispatch, { statusId }) => ({
});
class EditedTimestamp extends React.PureComponent {
class EditedTimestamp extends PureComponent {
static propTypes = {
statusId: PropTypes.string.isRequired,

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { version, source_url } from 'mastodon/initial_state';
import StackTrace from 'stacktrace-js';
import { Helmet } from 'react-helmet';
export default class ErrorBoundary extends React.PureComponent {
export default class ErrorBoundary extends PureComponent {
static propTypes = {
children: PropTypes.node,

View File

@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
interface Props {
src: string;

View File

@ -1,5 +1,5 @@
// @ts-check
import React from 'react';
import { Component, Fragment } from 'react';
import { Sparklines, SparklinesCurve } from 'react-sparklines';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
@ -9,7 +9,7 @@ import ShortNumber from 'mastodon/components/short_number';
import { Skeleton } from 'mastodon/components/skeleton';
import classNames from 'classnames';
class SilentErrorBoundary extends React.Component {
class SilentErrorBoundary extends Component {
static propTypes = {
children: PropTypes.node,
@ -69,7 +69,7 @@ const Hashtag = ({ name, to, people, uses, history, className, description, with
<div className={classNames('trends__item', className)}>
<div className='trends__item__name'>
<Link to={to}>
{name ? <React.Fragment>#<span>{name}</span></React.Fragment> : <Skeleton width={50} />}
{name ? <Fragment>#<span>{name}</span></Fragment> : <Skeleton width={50} />}
</Link>
{description ? (

View File

@ -1,5 +1,3 @@
import React from 'react';
import classNames from 'classnames';
interface Props extends React.HTMLAttributes<HTMLImageElement> {

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import classNames from 'classnames';
@ -32,7 +32,7 @@ interface States {
activate: boolean;
deactivate: boolean;
}
export class IconButton extends React.PureComponent<Props, States> {
export class IconButton extends PureComponent<Props, States> {
static defaultProps = {
size: 18,
active: false,
@ -127,14 +127,14 @@ export class IconButton extends React.PureComponent<Props, States> {
}
let contents = (
<React.Fragment>
<>
<Icon id={icon} fixedWidth aria-hidden='true' />{' '}
{typeof counter !== 'undefined' && (
<span className='icon-button__counter'>
<AnimatedNumber value={counter} obfuscate={obfuscateCount} />
</span>
)}
</React.Fragment>
</>
);
if (href != null) {

View File

@ -1,5 +1,3 @@
import React from 'react';
import { Icon } from './icon';
const formatNumber = (num: number): number | string => (num > 40 ? '40+' : num);

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { makeGetAccount } from 'mastodon/selectors';
@ -14,7 +14,7 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
class InlineAccount extends React.PureComponent {
class InlineAccount extends PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { cloneElement, Component } from 'react';
import PropTypes from 'prop-types';
import scheduleIdleTask from '../features/ui/util/schedule_idle_task';
import getRectFromEntry from '../features/ui/util/get_rect_from_entry';
@ -6,7 +6,7 @@ import getRectFromEntry from '../features/ui/util/get_rect_from_entry';
// Diff these props in the "unrendered" state
const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight'];
export default class IntersectionObserverArticle extends React.Component {
export default class IntersectionObserverArticle extends Component {
static propTypes = {
intersectionObserverWrapper: PropTypes.object.isRequired,
@ -115,14 +115,14 @@ export default class IntersectionObserverArticle extends React.Component {
data-id={id}
tabIndex={0}
>
{children && React.cloneElement(children, { hidden: true })}
{children && cloneElement(children, { hidden: true })}
</article>
);
}
return (
<article ref={this.handleRef} aria-posinset={index + 1} aria-setsize={listLength} data-id={id} tabIndex={0}>
{children && React.cloneElement(children, { hidden: false })}
{children && cloneElement(children, { hidden: false })}
</article>
);
}

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { injectIntl, defineMessages } from 'react-intl';
import { Icon } from 'mastodon/components/icon';
@ -7,7 +7,7 @@ const messages = defineMessages({
load_more: { id: 'status.load_more', defaultMessage: 'Load more' },
});
class LoadGap extends React.PureComponent {
class LoadGap extends PureComponent {
static propTypes = {
disabled: PropTypes.bool,

View File

@ -1,8 +1,8 @@
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
export default class LoadMore extends React.PureComponent {
export default class LoadMore extends PureComponent {
static propTypes = {
onClick: PropTypes.func,

View File

@ -1,8 +1,8 @@
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
export default class LoadPending extends React.PureComponent {
export default class LoadPending extends PureComponent {
static propTypes = {
onClick: PropTypes.func,

View File

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
export const CircularProgress = ({ size, strokeWidth }) => {

View File

@ -1,5 +1,3 @@
import React from 'react';
import logo from 'mastodon/../images/logo.svg';
export const WordmarkLogo: React.FC = () => (

View File

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { is } from 'immutable';
@ -13,7 +13,7 @@ const messages = defineMessages({
toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: '{number, plural, one {Hide image} other {Hide images}}' },
});
class Item extends React.PureComponent {
class Item extends PureComponent {
static propTypes = {
attachment: ImmutablePropTypes.map.isRequired,
@ -196,7 +196,7 @@ class Item extends React.PureComponent {
}
class MediaGallery extends React.PureComponent {
class MediaGallery extends PureComponent {
static propTypes = {
sensitive: PropTypes.bool,

View File

@ -1,10 +1,10 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import 'wicg-inert';
import { createBrowserHistory } from 'history';
import { multiply } from 'color-blend';
export default class ModalRoot extends React.PureComponent {
export default class ModalRoot extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import { Switch, Route, withRouter } from 'react-router-dom';
import { showTrends } from 'mastodon/initial_state';
import Trends from 'mastodon/features/getting_started/containers/trends_container';
@ -15,7 +15,7 @@ const DefaultNavigation = () => (
</>
);
class NavigationPortal extends React.PureComponent {
class NavigationPortal extends PureComponent {
render () {
return (

View File

@ -1,5 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
export const NotSignedInIndicator: React.FC = () => (

View File

@ -1,11 +1,11 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Icon } from 'mastodon/components/icon';
import { removePictureInPicture } from 'mastodon/actions/picture_in_picture';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
class PictureInPicturePlaceholder extends React.PureComponent {
class PictureInPicturePlaceholder extends PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';

View File

@ -1,5 +1,3 @@
import React from 'react';
import classNames from 'classnames';
interface Props {

View File

@ -1,4 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import illustration from 'mastodon/../images/elephant_ui_working.svg';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { Component } from 'react';
import type { InjectedIntl } from 'react-intl';
import { injectIntl, defineMessages } from 'react-intl';
@ -199,7 +199,7 @@ interface Props {
interface States {
now: number;
}
class RelativeTimestamp extends React.Component<Props, States> {
class RelativeTimestamp extends Component<Props, States> {
state = {
now: this.props.intl.now(),
};

View File

@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { Children, cloneElement, PureComponent } from 'react';
import ScrollContainer from 'mastodon/containers/scroll_container';
import PropTypes from 'prop-types';
import IntersectionObserverArticleContainer from '../containers/intersection_observer_article_container';
@ -184,8 +184,8 @@ class ScrollableList extends PureComponent {
};
getSnapshotBeforeUpdate (prevProps) {
const someItemInserted = React.Children.count(prevProps.children) > 0 &&
React.Children.count(prevProps.children) < React.Children.count(this.props.children) &&
const someItemInserted = Children.count(prevProps.children) > 0 &&
Children.count(prevProps.children) < Children.count(this.props.children) &&
this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props);
const pendingChanged = (prevProps.numPending > 0) !== (this.props.numPending > 0);
@ -293,7 +293,7 @@ class ScrollableList extends PureComponent {
render () {
const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, emptyMessage, onLoadMore } = this.props;
const { fullscreen } = this.state;
const childrenCount = React.Children.count(children);
const childrenCount = Children.count(children);
const loadMore = (hasMore && onLoadMore) ? <LoadMore visible={!isLoading} onClick={this.handleLoadMore} /> : null;
const loadPending = (numPending > 0) ? <LoadPending count={numPending} onClick={this.handleLoadPending} /> : null;
@ -319,7 +319,7 @@ class ScrollableList extends PureComponent {
{loadPending}
{React.Children.map(this.props.children, (child, index) => (
{Children.map(this.props.children, (child, index) => (
<IntersectionObserverArticleContainer
key={child.key}
id={child.key}
@ -328,7 +328,7 @@ class ScrollableList extends PureComponent {
intersectionObserverWrapper={this.intersectionObserverWrapper}
saveHeightKey={trackScroll ? `${this.context.router.route.location.key}:${scrollKey}` : null}
>
{React.cloneElement(child, {
{cloneElement(child, {
getScrollPosition: this.getScrollPosition,
updateScrollBottom: this.updateScrollBottom,
cachedMediaWidth: this.state.cachedMediaWidth,

View File

@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PureComponent } from 'react';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
import { connect } from 'react-redux';
import { fetchServer } from 'mastodon/actions/server';
@ -18,7 +18,7 @@ const mapStateToProps = state => ({
server: state.getIn(['server', 'server']),
});
class ServerBanner extends React.PureComponent {
class ServerBanner extends PureComponent {
static propTypes = {
server: PropTypes.object,

View File

@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import classNames from 'classnames';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { memo } from 'react';
import PropTypes from 'prop-types';
import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers';
import { FormattedMessage, FormattedNumber } from 'react-intl';
@ -109,4 +109,4 @@ ShortNumberCounter.propTypes = {
value: PropTypes.arrayOf(PropTypes.number),
};
export default React.memo(ShortNumber);
export default memo(ShortNumber);

View File

@ -1,5 +1,3 @@
import React from 'react';
interface Props {
width?: number | string;
height?: number | string;

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { Avatar } from './avatar';

View File

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl } from 'react-intl';
@ -11,7 +11,7 @@ import { autoPlayGif, languages as preloadedLanguages } from 'mastodon/initial_s
const MAX_HEIGHT = 706; // 22px * 32 (+ 2px padding at the top)
class TranslateButton extends React.PureComponent {
class TranslateButton extends PureComponent {
static propTypes = {
translation: ImmutablePropTypes.map,
@ -52,7 +52,7 @@ const mapStateToProps = state => ({
languages: state.getIn(['server', 'translationLanguages', 'items']),
});
class StatusContent extends React.PureComponent {
class StatusContent extends PureComponent {
static contextTypes = {
router: PropTypes.object,

View File

@ -1,5 +1,4 @@
import { debounce } from 'lodash';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import StatusContainer from '../containers/status_container';

View File

@ -1,5 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
interface Props {

View File

@ -1,5 +1,3 @@
import React from 'react';
import { Icon } from './icon';
interface Props {

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { makeGetAccount } from '../selectors';

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { IntlProvider, addLocaleData } from 'react-intl';
import { getLocale } from '../locales';
@ -6,7 +6,7 @@ import { getLocale } from '../locales';
const { localeData, messages } = getLocale();
addLocaleData(localeData);
export default class AdminComponent extends React.PureComponent {
export default class AdminComponent extends PureComponent {
static propTypes = {
locale: PropTypes.string.isRequired,

View File

@ -1,4 +1,4 @@
import React from 'react';
import { PureComponent } from 'react';
import { Provider } from 'react-redux';
import PropTypes from 'prop-types';
import { store } from '../store';
@ -18,7 +18,7 @@ if (initialState) {
store.dispatch(fetchCustomEmojis());
export default class TimelineContainer extends React.PureComponent {
export default class TimelineContainer extends PureComponent {
static propTypes = {
locale: PropTypes.string.isRequired,

View File

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux';
import { blockDomain, unblockDomain } from '../actions/domain_blocks';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';

View File

@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PureComponent } from 'react';
import { Helmet } from 'react-helmet';
import { IntlProvider, addLocaleData } from 'react-intl';
import { Provider as ReduxProvider } from 'react-redux';