1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Use the new JSX transform (#25064)

This commit is contained in:
Renaud Chaput 2023-05-23 10:52:27 +02:00 committed by GitHub
parent e387175fc9
commit 8f66126b10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
241 changed files with 366 additions and 473 deletions

View file

@ -101,7 +101,12 @@ module.exports = {
'react/jsx-equals-spacing': 'error', 'react/jsx-equals-spacing': 'error',
'react/jsx-no-bind': 'error', 'react/jsx-no-bind': 'error',
'react/jsx-no-target-blank': 'off', '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/no-unknown-property': 'off',
'react/react-in-jsx-scope': 'off', // not needed with new JSX transform
'react/self-closing-comp': 'error', 'react/self-closing-comp': 'error',
// recommended values found in https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/index.js // 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', 'import/no-default-export': 'warn',
'react/prefer-stateless-function': 'warn', 'react/prefer-stateless-function': 'warn',
'react/function-component-definition': ['error', { namedComponents: 'arrow-function' }], '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 renderer from 'react-test-renderer';
import AutosuggestEmoji from '../autosuggest_emoji'; import AutosuggestEmoji from '../autosuggest_emoji';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import api from 'mastodon/api'; import api from 'mastodon/api';
import { FormattedMessage, FormattedNumber, FormattedDate } from 'react-intl'; 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 = { static propTypes = {
start_at: PropTypes.string, start_at: PropTypes.string,

View file

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

View file

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ImmutablePureComponent from 'react-immutable-pure-component'; 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 PropTypes from 'prop-types';
import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light'; import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light';
import { assetHost } from 'mastodon/utils/config'; import { assetHost } from 'mastodon/utils/config';
export default class AutosuggestEmoji extends React.PureComponent { export default class AutosuggestEmoji extends PureComponent {
static propTypes = { static propTypes = {
emoji: PropTypes.object.isRequired, emoji: PropTypes.object.isRequired,

View file

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

View file

@ -1,4 +1,3 @@
import React from 'react';
import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container'; import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container';
import AutosuggestEmoji from './autosuggest_emoji'; import AutosuggestEmoji from './autosuggest_emoji';
import AutosuggestHashtag from './autosuggest_hashtag'; 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 AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container';
import AutosuggestEmoji from './autosuggest_emoji'; import AutosuggestEmoji from './autosuggest_emoji';
import AutosuggestHashtag from './autosuggest_hashtag'; import AutosuggestHashtag from './autosuggest_hashtag';

View file

@ -1,5 +1,3 @@
import * as React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { useHovering } from '../../hooks/useHovering'; 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 PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { autoPlayGif } from '../initial_state'; import { autoPlayGif } from '../initial_state';
import { Avatar } from './avatar'; import { Avatar } from './avatar';
export default class AvatarComposite extends React.PureComponent { export default class AvatarComposite extends PureComponent {
static propTypes = { static propTypes = {
accounts: ImmutablePropTypes.list.isRequired, accounts: ImmutablePropTypes.list.isRequired,

View file

@ -1,5 +1,3 @@
import React from 'react';
import { useHovering } from '../../hooks/useHovering'; import { useHovering } from '../../hooks/useHovering';
import type { Account } from '../../types/resources'; import type { Account } from '../../types/resources';
import { autoPlayGif } from '../initial_state'; 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'; 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 }; export { MemoizedBlurhash as Blurhash };

View file

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

View file

@ -1,5 +1,3 @@
import React from 'react';
export const Check: React.FC = () => ( export const Check: React.FC = () => (
<svg <svg
xmlns='http://www.w3.org/2000/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 PropTypes from 'prop-types';
import { supportsPassiveEvents } from 'detect-passive-events'; import { supportsPassiveEvents } from 'detect-passive-events';
import { scrollTop } from '../scroll'; import { scrollTop } from '../scroll';
const listenerOptions = supportsPassiveEvents ? { passive: true } : false; const listenerOptions = supportsPassiveEvents ? { passive: true } : false;
export default class Column extends React.PureComponent { export default class Column extends PureComponent {
static propTypes = { static propTypes = {
children: PropTypes.node, children: PropTypes.node,

View file

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

View file

@ -1,4 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import ColumnBackButton from './column_back_button'; import ColumnBackButton from './column_back_button';
import { Icon } from 'mastodon/components/icon'; 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 PropTypes from 'prop-types';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import classNames from 'classnames'; import classNames from 'classnames';
@ -12,7 +12,7 @@ const messages = defineMessages({
moveRight: { id: 'column_header.moveRight_settings', defaultMessage: 'Move column to the right' }, moveRight: { id: 'column_header.moveRight_settings', defaultMessage: 'Move column to the right' },
}); });
class ColumnHeader extends React.PureComponent { class ColumnHeader extends PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object, router: PropTypes.object,

View file

@ -1,5 +1,4 @@
// @ts-check // @ts-check
import React from 'react';
import { FormattedMessage } from 'react-intl'; 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 { IconButton } from './icon_button';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { injectIntl, defineMessages } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl';
@ -8,7 +8,7 @@ const messages = defineMessages({
dismiss: { id: 'dismissable_banner.dismiss', defaultMessage: 'Dismiss' }, dismiss: { id: 'dismissable_banner.dismiss', defaultMessage: 'Dismiss' },
}); });
class DismissableBanner extends React.PureComponent { class DismissableBanner extends PureComponent {
static propTypes = { static propTypes = {
id: PropTypes.string.isRequired, 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 type { InjectedIntl } from 'react-intl';
import { defineMessages, injectIntl } 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 PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { IconButton } from './icon_button'; import { IconButton } from './icon_button';
@ -10,7 +10,7 @@ import { CircularProgress } from 'mastodon/components/loading_indicator';
const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true; const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true;
let id = 0; let id = 0;
class DropdownMenu extends React.PureComponent { class DropdownMenu extends PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object, 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 = { static contextTypes = {
router: PropTypes.object, router: PropTypes.object,
@ -286,7 +286,7 @@ export default class Dropdown extends React.PureComponent {
const open = this.state.id === openDropdownId; 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, onClick: this.handleClick,
onMouseDown: this.handleMouseDown, onMouseDown: this.handleMouseDown,
onKeyDown: this.handleButtonKeyDown, onKeyDown: this.handleButtonKeyDown,
@ -306,7 +306,7 @@ export default class Dropdown extends React.PureComponent {
); );
return ( return (
<React.Fragment> <Fragment>
<span ref={this.setTargetRef}> <span ref={this.setTargetRef}>
{button} {button}
</span> </span>
@ -329,7 +329,7 @@ export default class Dropdown extends React.PureComponent {
</div> </div>
)} )}
</Overlay> </Overlay>
</React.Fragment> </Fragment>
); );
} }

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl } from 'react-intl'; import { FormattedMessage, injectIntl } from 'react-intl';
import { Icon } from 'mastodon/components/icon'; 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 = { static propTypes = {
statusId: PropTypes.string.isRequired, statusId: PropTypes.string.isRequired,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,3 @@
import React from 'react';
import { Icon } from './icon'; import { Icon } from './icon';
const formatNumber = (num: number): number | string => (num > 40 ? '40+' : num); 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 ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { makeGetAccount } from 'mastodon/selectors'; import { makeGetAccount } from 'mastodon/selectors';
@ -14,7 +14,7 @@ const makeMapStateToProps = () => {
return mapStateToProps; return mapStateToProps;
}; };
class InlineAccount extends React.PureComponent { class InlineAccount extends PureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map.isRequired, 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 PropTypes from 'prop-types';
import scheduleIdleTask from '../features/ui/util/schedule_idle_task'; import scheduleIdleTask from '../features/ui/util/schedule_idle_task';
import getRectFromEntry from '../features/ui/util/get_rect_from_entry'; 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 // Diff these props in the "unrendered" state
const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight']; const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight'];
export default class IntersectionObserverArticle extends React.Component { export default class IntersectionObserverArticle extends Component {
static propTypes = { static propTypes = {
intersectionObserverWrapper: PropTypes.object.isRequired, intersectionObserverWrapper: PropTypes.object.isRequired,
@ -115,14 +115,14 @@ export default class IntersectionObserverArticle extends React.Component {
data-id={id} data-id={id}
tabIndex={0} tabIndex={0}
> >
{children && React.cloneElement(children, { hidden: true })} {children && cloneElement(children, { hidden: true })}
</article> </article>
); );
} }
return ( return (
<article ref={this.handleRef} aria-posinset={index + 1} aria-setsize={listLength} data-id={id} tabIndex={0}> <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> </article>
); );
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component'; 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 ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { is } from 'immutable'; 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}}' }, 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 = { static propTypes = {
attachment: ImmutablePropTypes.map.isRequired, attachment: ImmutablePropTypes.map.isRequired,
@ -196,7 +196,7 @@ class Item extends React.PureComponent {
} }
class MediaGallery extends React.PureComponent { class MediaGallery extends PureComponent {
static propTypes = { static propTypes = {
sensitive: PropTypes.bool, sensitive: PropTypes.bool,

View file

@ -1,10 +1,10 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import 'wicg-inert'; import 'wicg-inert';
import { createBrowserHistory } from 'history'; import { createBrowserHistory } from 'history';
import { multiply } from 'color-blend'; import { multiply } from 'color-blend';
export default class ModalRoot extends React.PureComponent { export default class ModalRoot extends PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object, 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 { Switch, Route, withRouter } from 'react-router-dom';
import { showTrends } from 'mastodon/initial_state'; import { showTrends } from 'mastodon/initial_state';
import Trends from 'mastodon/features/getting_started/containers/trends_container'; 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 () { render () {
return ( return (

View file

@ -1,5 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
export const NotSignedInIndicator: React.FC = () => ( 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 PropTypes from 'prop-types';
import { Icon } from 'mastodon/components/icon'; import { Icon } from 'mastodon/components/icon';
import { removePictureInPicture } from 'mastodon/actions/picture_in_picture'; import { removePictureInPicture } from 'mastodon/actions/picture_in_picture';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
class PictureInPicturePlaceholder extends React.PureComponent { class PictureInPicturePlaceholder extends PureComponent {
static propTypes = { static propTypes = {
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
import React from 'react'; import { memo } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers'; import { toShortNumber, pluralReady, DECIMAL_UNITS } from '../utils/numbers';
import { FormattedMessage, FormattedNumber } from 'react-intl'; import { FormattedMessage, FormattedNumber } from 'react-intl';
@ -109,4 +109,4 @@ ShortNumberCounter.propTypes = {
value: PropTypes.arrayOf(PropTypes.number), 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 { interface Props {
width?: number | string; width?: number | string;
height?: number | string; height?: number | string;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import { PureComponent } from 'react';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import { IntlProvider, addLocaleData } from 'react-intl'; import { IntlProvider, addLocaleData } from 'react-intl';
import { Provider as ReduxProvider } from 'react-redux'; import { Provider as ReduxProvider } from 'react-redux';
@ -34,7 +34,7 @@ const createIdentityContext = state => ({
permissions: state.role ? state.role.permissions : 0, permissions: state.role ? state.role.permissions : 0,
}); });
export default class Mastodon extends React.PureComponent { export default class Mastodon extends PureComponent {
static propTypes = { static propTypes = {
locale: PropTypes.string.isRequired, locale: PropTypes.string.isRequired,

View file

@ -1,4 +1,4 @@
import React, { PureComponent, Fragment } from 'react'; import { PureComponent, Fragment } from 'react';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { IntlProvider, addLocaleData } from 'react-intl'; import { IntlProvider, addLocaleData } from 'react-intl';

View file

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Status from '../components/status'; import Status from '../components/status';
import { makeGetStatus, makeGetPictureInPicture } from '../selectors'; import { makeGetStatus, makeGetPictureInPicture } from '../selectors';

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
@ -41,7 +41,7 @@ const mapStateToProps = state => ({
domainBlocks: state.getIn(['server', 'domainBlocks']), domainBlocks: state.getIn(['server', 'domainBlocks']),
}); });
class Section extends React.PureComponent { class Section extends PureComponent {
static propTypes = { static propTypes = {
title: PropTypes.string, title: PropTypes.string,
@ -80,7 +80,7 @@ class Section extends React.PureComponent {
} }
class About extends React.PureComponent { class About extends PureComponent {
static propTypes = { static propTypes = {
server: ImmutablePropTypes.map, server: ImmutablePropTypes.map,

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
@ -10,7 +10,7 @@ const messages = defineMessages({
placeholder: { id: 'account_note.placeholder', defaultMessage: 'Click to add a note' }, placeholder: { id: 'account_note.placeholder', defaultMessage: 'Click to add a note' },
}); });
class InlineAlert extends React.PureComponent { class InlineAlert extends PureComponent {
static propTypes = { static propTypes = {
show: PropTypes.bool, show: PropTypes.bool,

View file

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

View file

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';

View file

@ -1,4 +1,4 @@
import React from 'react'; import { Fragment } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
@ -399,10 +399,10 @@ class Header extends ImmutablePureComponent {
{!suspended && ( {!suspended && (
<div className='account__header__tabs__buttons'> <div className='account__header__tabs__buttons'>
{!hidden && ( {!hidden && (
<React.Fragment> <Fragment>
{actionBtn} {actionBtn}
{bellBtn} {bellBtn}
</React.Fragment> </Fragment>
)} )}
<DropdownMenuContainer disabled={menu.length === 0} items={menu} icon='ellipsis-v' size={24} direction='right' /> <DropdownMenuContainer disabled={menu.length === 0} items={menu} icon='ellipsis-v' size={24} direction='right' />

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import FeaturedTags from 'mastodon/features/account/containers/featured_tags_container'; import FeaturedTags from 'mastodon/features/account/containers/featured_tags_container';
@ -19,7 +19,7 @@ const mapStateToProps = (state, { match: { params: { acct } } }) => {
}; };
}; };
class AccountNavigation extends React.PureComponent { class AccountNavigation extends PureComponent {
static propTypes = { static propTypes = {
match: PropTypes.shape({ match: PropTypes.shape({

View file

@ -3,7 +3,6 @@ import classNames from 'classnames';
import { Icon } from 'mastodon/components/icon'; import { Icon } from 'mastodon/components/icon';
import { autoPlayGif, displayMedia, useBlurhash } from 'mastodon/initial_state'; import { autoPlayGif, displayMedia, useBlurhash } from 'mastodon/initial_state';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';

View file

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

View file

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import InnerHeader from '../../account/components/header'; import InnerHeader from '../../account/components/header';

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { revealAccount } from 'mastodon/actions/accounts'; import { revealAccount } from 'mastodon/actions/accounts';
@ -14,7 +14,7 @@ const mapDispatchToProps = (dispatch, { accountId }) => ({
}); });
class LimitedAccountHint extends React.PureComponent { class LimitedAccountHint extends PureComponent {
static propTypes = { static propTypes = {
accountId: PropTypes.string.isRequired, accountId: PropTypes.string.isRequired,

View file

@ -1,4 +1,3 @@
import React from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
const MemorialNote = () => ( const MemorialNote = () => (

View file

@ -1,4 +1,3 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';

View file

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { makeGetAccount, getAccountHidden } from '../../../selectors'; import { makeGetAccount, getAccountHidden } from '../../../selectors';
import Header from '../components/header'; import Header from '../components/header';

View file

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

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
import { formatTime, getPointerPosition, fileNameFromURL } from 'mastodon/features/video'; import { formatTime, getPointerPosition, fileNameFromURL } from 'mastodon/features/video';
@ -22,7 +22,7 @@ const messages = defineMessages({
const TICK_SIZE = 10; const TICK_SIZE = 10;
const PADDING = 180; const PADDING = 180;
class Audio extends React.PureComponent { class Audio extends PureComponent {
static propTypes = { static propTypes = {
src: PropTypes.string.isRequired, src: PropTypes.string.isRequired,

View file

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';

View file

@ -1,6 +1,5 @@
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';

View file

@ -1,4 +1,3 @@
import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';

View file

@ -1,10 +1,10 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { injectIntl, FormattedMessage } from 'react-intl'; import { injectIntl, FormattedMessage } from 'react-intl';
import SettingToggle from '../../notifications/components/setting_toggle'; import SettingToggle from '../../notifications/components/setting_toggle';
class ColumnSettings extends React.PureComponent { class ColumnSettings extends PureComponent {
static propTypes = { static propTypes = {
settings: ImmutablePropTypes.map.isRequired, settings: ImmutablePropTypes.map.isRequired,

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -30,7 +30,7 @@ const mapStateToProps = (state, { columnId }) => {
}; };
}; };
class CommunityTimeline extends React.PureComponent { class CommunityTimeline extends PureComponent {
static contextTypes = { static contextTypes = {
router: PropTypes.object, router: PropTypes.object,

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
@ -20,7 +20,7 @@ const messages = defineMessages({
bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' }, bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' },
}); });
class ActionBar extends React.PureComponent { class ActionBar extends PureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map.isRequired, account: ImmutablePropTypes.map.isRequired,

View file

@ -1,4 +1,3 @@
import React from 'react';
import { Avatar } from '../../../components/avatar'; import { Avatar } from '../../../components/avatar';
import { DisplayName } from '../../../components/display_name'; import { DisplayName } from '../../../components/display_name';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';

View file

@ -1,8 +1,8 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { length } from 'stringz'; import { length } from 'stringz';
export default class CharacterCounter extends React.PureComponent { export default class CharacterCounter extends PureComponent {
static propTypes = { static propTypes = {
text: PropTypes.string.isRequired, text: PropTypes.string.isRequired,

View file

@ -1,4 +1,3 @@
import React from 'react';
import CharacterCounter from './character_counter'; import CharacterCounter from './character_counter';
import Button from '../../../components/button'; import Button from '../../../components/button';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { EmojiPicker as EmojiPickerAsync } from '../../ui/util/async-components'; import { EmojiPicker as EmojiPickerAsync } from '../../ui/util/async-components';
@ -47,7 +47,7 @@ const notFoundFn = () => (
</div> </div>
); );
class ModifierPickerMenu extends React.PureComponent { class ModifierPickerMenu extends PureComponent {
static propTypes = { static propTypes = {
active: PropTypes.bool, active: PropTypes.bool,
@ -108,7 +108,7 @@ class ModifierPickerMenu extends React.PureComponent {
} }
class ModifierPicker extends React.PureComponent { class ModifierPicker extends PureComponent {
static propTypes = { static propTypes = {
active: PropTypes.bool, active: PropTypes.bool,
@ -144,7 +144,7 @@ class ModifierPicker extends React.PureComponent {
} }
class EmojiPickerMenuImpl extends React.PureComponent { class EmojiPickerMenuImpl extends PureComponent {
static propTypes = { static propTypes = {
custom_emojis: ImmutablePropTypes.list, custom_emojis: ImmutablePropTypes.list,
@ -306,7 +306,7 @@ class EmojiPickerMenuImpl extends React.PureComponent {
const EmojiPickerMenu = injectIntl(EmojiPickerMenuImpl); const EmojiPickerMenu = injectIntl(EmojiPickerMenuImpl);
class EmojiPickerDropdown extends React.PureComponent { class EmojiPickerDropdown extends PureComponent {
static propTypes = { static propTypes = {
custom_emojis: ImmutablePropTypes.list, custom_emojis: ImmutablePropTypes.list,

View file

@ -1,4 +1,4 @@
import React from 'react'; import { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { injectIntl, defineMessages } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl';
import TextIconButton from './text_icon_button'; import TextIconButton from './text_icon_button';
@ -17,7 +17,7 @@ const messages = defineMessages({
const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true; const listenerOptions = supportsPassiveEvents ? { passive: true, capture: true } : true;
class LanguageDropdownMenu extends React.PureComponent { class LanguageDropdownMenu extends PureComponent {
static propTypes = { static propTypes = {
value: PropTypes.string.isRequired, value: PropTypes.string.isRequired,
@ -238,7 +238,7 @@ class LanguageDropdownMenu extends React.PureComponent {
} }
class LanguageDropdown extends React.PureComponent { class LanguageDropdown extends PureComponent {
static propTypes = { static propTypes = {
value: PropTypes.string, value: PropTypes.string,

Some files were not shown because too many files have changed in this diff Show more