gearheads
/
mastodon
Archived
2
0
Fork 0

Enable ESLint react/no-deprecated (#24471)

gh/dev
Nick Schonning 2023-05-10 03:05:32 -04:00 committed by GitHub
parent 2d5e257938
commit b878e3d8df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 32 additions and 33 deletions

View File

@ -104,7 +104,6 @@ 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/no-deprecated': 'off',
'react/no-unknown-property': 'off', 'react/no-unknown-property': 'off',
'react/self-closing-comp': 'error', 'react/self-closing-comp': 'error',

View File

@ -154,7 +154,7 @@ export default class AutosuggestInput extends ImmutablePureComponent {
this.input.focus(); this.input.focus();
}; };
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.suggestions !== this.props.suggestions && nextProps.suggestions.size > 0 && this.state.suggestionsHidden && this.state.focused) { if (nextProps.suggestions !== this.props.suggestions && nextProps.suggestions.size > 0 && this.state.suggestionsHidden && this.state.focused) {
this.setState({ suggestionsHidden: false }); this.setState({ suggestionsHidden: false });
} }

View File

@ -153,7 +153,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
this.textarea.focus(); this.textarea.focus();
}; };
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.suggestions !== this.props.suggestions && nextProps.suggestions.size > 0 && this.state.suggestionsHidden && this.state.focused) { if (nextProps.suggestions !== this.props.suggestions && nextProps.suggestions.size > 0 && this.state.suggestionsHidden && this.state.focused) {
this.setState({ suggestionsHidden: false }); this.setState({ suggestionsHidden: false });
} }

View File

@ -231,7 +231,7 @@ class MediaGallery extends React.PureComponent {
window.removeEventListener('resize', this.handleResize); window.removeEventListener('resize', this.handleResize);
} }
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (!is(nextProps.media, this.props.media) && nextProps.visible === undefined) { if (!is(nextProps.media, this.props.media) && nextProps.visible === undefined) {
this.setState({ visible: displayMedia !== 'hide_all' && !nextProps.sensitive || displayMedia === 'show_all' }); this.setState({ visible: displayMedia !== 'hide_all' && !nextProps.sensitive || displayMedia === 'show_all' });
} else if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) { } else if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {

View File

@ -57,7 +57,7 @@ export default class ModalRoot extends React.PureComponent {
this.history = this.context.router ? this.context.router.history : createBrowserHistory(); this.history = this.context.router ? this.context.router.history : createBrowserHistory();
} }
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (!!nextProps.children && !this.props.children) { if (!!nextProps.children && !this.props.children) {
this.activeElement = document.activeElement; this.activeElement = document.activeElement;

View File

@ -22,7 +22,7 @@ class InlineAlert extends React.PureComponent {
static TRANSITION_DELAY = 200; static TRANSITION_DELAY = 200;
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (!this.props.show && nextProps.show) { if (!this.props.show && nextProps.show) {
this.setState({ mountMessage: true }); this.setState({ mountMessage: true });
} else if (this.props.show && !nextProps.show) { } else if (this.props.show && !nextProps.show) {
@ -58,11 +58,11 @@ class AccountNote extends ImmutablePureComponent {
saved: false, saved: false,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this._reset(); this._reset();
} }
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
const accountWillChange = !is(this.props.account, nextProps.account); const accountWillChange = !is(this.props.account, nextProps.account);
const newState = {}; const newState = {};

View File

@ -136,7 +136,7 @@ class Audio extends React.PureComponent {
} }
} }
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) { if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {
this.setState({ revealed: nextProps.visible }); this.setState({ revealed: nextProps.visible });
} }

View File

@ -34,7 +34,7 @@ class Blocks extends ImmutablePureComponent {
multiColumn: PropTypes.bool, multiColumn: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchBlocks()); this.props.dispatch(fetchBlocks());
} }

View File

@ -34,7 +34,7 @@ class Bookmarks extends ImmutablePureComponent {
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchBookmarkedStatuses()); this.props.dispatch(fetchBookmarkedStatuses());
} }

View File

@ -59,7 +59,7 @@ class ModifierPickerMenu extends React.PureComponent {
this.props.onSelect(e.currentTarget.getAttribute('data-index') * 1); this.props.onSelect(e.currentTarget.getAttribute('data-index') * 1);
}; };
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.active) { if (nextProps.active) {
this.attachListeners(); this.attachListeners();
} else { } else {

View File

@ -212,7 +212,7 @@ class PrivacyDropdown extends React.PureComponent {
this.props.onChange(value); this.props.onChange(value);
}; };
componentWillMount () { UNSAFE_componentWillMount () {
const { intl: { formatMessage } } = this.props; const { intl: { formatMessage } } = this.props;
this.options = [ this.options = [

View File

@ -34,7 +34,7 @@ class Blocks extends ImmutablePureComponent {
multiColumn: PropTypes.bool, multiColumn: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchDomainBlocks()); this.props.dispatch(fetchDomainBlocks());
} }

View File

@ -34,7 +34,7 @@ class Favourites extends ImmutablePureComponent {
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchFavouritedStatuses()); this.props.dispatch(fetchFavouritedStatuses());
} }

View File

@ -31,13 +31,13 @@ class Favourites extends ImmutablePureComponent {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
if (!this.props.accountIds) { if (!this.props.accountIds) {
this.props.dispatch(fetchFavourites(this.props.params.statusId)); this.props.dispatch(fetchFavourites(this.props.params.statusId));
} }
} }
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this.props.dispatch(fetchFavourites(nextProps.params.statusId)); this.props.dispatch(fetchFavourites(nextProps.params.statusId));
} }

View File

@ -39,7 +39,7 @@ class FollowRequests extends ImmutablePureComponent {
multiColumn: PropTypes.bool, multiColumn: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchFollowRequests()); this.props.dispatch(fetchFollowRequests());
} }

View File

@ -76,7 +76,7 @@ class ListTimeline extends React.PureComponent {
this.disconnect = dispatch(connectListStream(id)); this.disconnect = dispatch(connectListStream(id));
} }
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
const { dispatch } = this.props; const { dispatch } = this.props;
const { id } = nextProps.params; const { id } = nextProps.params;

View File

@ -42,7 +42,7 @@ class Lists extends ImmutablePureComponent {
multiColumn: PropTypes.bool, multiColumn: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchLists()); this.props.dispatch(fetchLists());
} }

View File

@ -35,7 +35,7 @@ class Mutes extends ImmutablePureComponent {
multiColumn: PropTypes.bool, multiColumn: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchMutes()); this.props.dispatch(fetchMutes());
} }

View File

@ -93,7 +93,7 @@ class Notifications extends React.PureComponent {
trackScroll: true, trackScroll: true,
}; };
componentWillMount() { UNSAFE_componentWillMount() {
this.props.dispatch(mountNotifications()); this.props.dispatch(mountNotifications());
} }

View File

@ -29,7 +29,7 @@ class PinnedStatuses extends ImmutablePureComponent {
multiColumn: PropTypes.bool, multiColumn: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchPinnedStatuses()); this.props.dispatch(fetchPinnedStatuses());
} }

View File

@ -31,13 +31,13 @@ class Reblogs extends ImmutablePureComponent {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
if (!this.props.accountIds) { if (!this.props.accountIds) {
this.props.dispatch(fetchReblogs(this.props.params.statusId)); this.props.dispatch(fetchReblogs(this.props.params.statusId));
} }
} }
componentWillReceiveProps(nextProps) { UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this.props.dispatch(fetchReblogs(nextProps.params.statusId)); this.props.dispatch(fetchReblogs(nextProps.params.statusId));
} }

View File

@ -66,7 +66,7 @@ export default class Card extends React.PureComponent {
revealed: !this.props.sensitive, revealed: !this.props.sensitive,
}; };
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (!Immutable.is(this.props.card, nextProps.card)) { if (!Immutable.is(this.props.card, nextProps.card)) {
this.setState({ embedded: false, previewLoaded: false }); this.setState({ embedded: false, previewLoaded: false });
} }

View File

@ -207,7 +207,7 @@ class Status extends ImmutablePureComponent {
loadedStatusId: undefined, loadedStatusId: undefined,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
this.props.dispatch(fetchStatus(this.props.params.statusId)); this.props.dispatch(fetchStatus(this.props.params.statusId));
} }
@ -215,7 +215,7 @@ class Status extends ImmutablePureComponent {
attachFullscreenListener(this.onFullScreenChange); attachFullscreenListener(this.onFullScreenChange);
} }
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this._scrolledIntoView = false; this._scrolledIntoView = false;
this.props.dispatch(fetchStatus(nextProps.params.statusId)); this.props.dispatch(fetchStatus(nextProps.params.statusId));

View File

@ -33,11 +33,11 @@ class Bundle extends React.PureComponent {
forceRender: false, forceRender: false,
}; };
componentWillMount() { UNSAFE_componentWillMount() {
this.load(this.props); this.load(this.props);
} }
componentWillReceiveProps(nextProps) { UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.fetchComponent !== this.props.fetchComponent) { if (nextProps.fetchComponent !== this.props.fetchComponent) {
this.load(nextProps); this.load(nextProps);
} }

View File

@ -76,7 +76,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
this.isRtlLayout = document.getElementsByTagName('body')[0].classList.contains('rtl'); this.isRtlLayout = document.getElementsByTagName('body')[0].classList.contains('rtl');
} }
componentWillUpdate(nextProps) { UNSAFE_componentWillUpdate(nextProps) {
if (this.props.singleColumn !== nextProps.singleColumn && nextProps.singleColumn) { if (this.props.singleColumn !== nextProps.singleColumn && nextProps.singleColumn) {
this.node.removeEventListener('wheel', this.handleWheel); this.node.removeEventListener('wheel', this.handleWheel);
} }

View File

@ -123,7 +123,7 @@ class SwitchingColumnsArea extends React.PureComponent {
mobile: PropTypes.bool, mobile: PropTypes.bool,
}; };
componentWillMount () { UNSAFE_componentWillMount () {
if (this.props.mobile) { if (this.props.mobile) {
document.body.classList.toggle('layout-single-column', true); document.body.classList.toggle('layout-single-column', true);
document.body.classList.toggle('layout-multiple-columns', false); document.body.classList.toggle('layout-multiple-columns', false);

View File

@ -370,7 +370,7 @@ class Video extends React.PureComponent {
} }
} }
componentWillReceiveProps (nextProps) { UNSAFE_componentWillReceiveProps (nextProps) {
if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) { if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {
this.setState({ revealed: nextProps.visible }); this.setState({ revealed: nextProps.visible });
} }