Add missing propTypes for eslint
This commit is contained in:
parent
141b0e6bfa
commit
2beb4d725f
18 changed files with 63 additions and 7 deletions
|
@ -1,7 +1,13 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
const Badge = (props) => (
|
const Badge = (props) => (
|
||||||
<span className={'badge badge--' + props.slug}>{props.title}</span>
|
<span className={'badge badge--' + props.slug}>{props.title}</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Badge.propTypes = {
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
slug: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default Badge;
|
export default Badge;
|
||||||
|
|
|
@ -48,6 +48,7 @@ class ColumnHeader extends React.PureComponent {
|
||||||
activeItem: PropTypes.string,
|
activeItem: PropTypes.string,
|
||||||
activeSubItem: PropTypes.string,
|
activeSubItem: PropTypes.string,
|
||||||
lists: ImmutablePropTypes.list,
|
lists: ImmutablePropTypes.list,
|
||||||
|
siteTitle: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
|
|
@ -48,6 +48,7 @@ class GabSocialMount extends React.PureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
showIntroduction: PropTypes.bool,
|
showIntroduction: PropTypes.bool,
|
||||||
|
me: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
|
|
@ -35,6 +35,8 @@ class ActionBar extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
size: PropTypes.number,
|
size: PropTypes.number,
|
||||||
|
onOpenHotkeys: PropTypes.func.isRequired,
|
||||||
|
onClickLogOut: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
handleHotkeyClick = () => {
|
handleHotkeyClick = () => {
|
||||||
|
|
|
@ -44,6 +44,9 @@ class Create extends React.PureComponent {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
onTitleChange: PropTypes.func.isRequired,
|
onTitleChange: PropTypes.func.isRequired,
|
||||||
onSubmit: PropTypes.func.isRequired,
|
onSubmit: PropTypes.func.isRequired,
|
||||||
|
reset: PropTypes.func.isRequired,
|
||||||
|
onDescriptionChange: PropTypes.func.isRequired,
|
||||||
|
onCoverImageChange: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
|
|
@ -50,6 +50,9 @@ class Edit extends React.PureComponent {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
onTitleChange: PropTypes.func.isRequired,
|
onTitleChange: PropTypes.func.isRequired,
|
||||||
onSubmit: PropTypes.func.isRequired,
|
onSubmit: PropTypes.func.isRequired,
|
||||||
|
onDescriptionChange: PropTypes.func.isRequired,
|
||||||
|
onCoverImageChange: PropTypes.func.isRequired,
|
||||||
|
setUp: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillMount(nextProps) {
|
componentWillMount(nextProps) {
|
||||||
|
|
|
@ -53,6 +53,12 @@ class GroupRemovedAccounts extends ImmutablePureComponent {
|
||||||
this.props.dispatch(expandRemovedAccounts(this.props.params.id));
|
this.props.dispatch(expandRemovedAccounts(this.props.params.id));
|
||||||
}, 300, { leading: true });
|
}, 300, { leading: true });
|
||||||
|
|
||||||
|
handleOnActionClick = (group, id) => {
|
||||||
|
return () => {
|
||||||
|
this.props.dispatch(removeRemovedAccount(group.get('id'), id));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { accountIds, hasMore, group, intl } = this.props;
|
const { accountIds, hasMore, group, intl } = this.props;
|
||||||
|
|
||||||
|
@ -76,7 +82,7 @@ class GroupRemovedAccounts extends ImmutablePureComponent {
|
||||||
key={id}
|
key={id}
|
||||||
id={id}
|
id={id}
|
||||||
actionIcon='remove'
|
actionIcon='remove'
|
||||||
onActionClick={() => this.props.dispatch(removeRemovedAccount(group.get('id'), id))}
|
onActionClick={this.handleOnActionClick(group, id)}
|
||||||
actionTitle={intl.formatMessage(messages.remove)}
|
actionTitle={intl.formatMessage(messages.remove)}
|
||||||
/>))}
|
/>))}
|
||||||
</ScrollableList>
|
</ScrollableList>
|
||||||
|
|
|
@ -27,16 +27,20 @@ class Header extends ImmutablePureComponent {
|
||||||
router: PropTypes.object,
|
router: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
toggle = () => {
|
||||||
|
const { group, relationships, toggleMembership } = this.props;
|
||||||
|
toggleMembership(group, relationships);
|
||||||
|
}
|
||||||
|
|
||||||
getActionButton() {
|
getActionButton() {
|
||||||
const { group, relationships, toggleMembership, intl } = this.props;
|
const { group, relationships, intl } = this.props;
|
||||||
const toggle = () => toggleMembership(group, relationships);
|
|
||||||
|
|
||||||
if (!relationships) {
|
if (!relationships) {
|
||||||
return '';
|
return '';
|
||||||
} else if (!relationships.get('member')) {
|
} else if (!relationships.get('member')) {
|
||||||
return <Button className='logo-button' text={intl.formatMessage(messages.join)} onClick={toggle} />;
|
return <Button className='logo-button' text={intl.formatMessage(messages.join)} onClick={this.toggle} />;
|
||||||
} else if (relationships.get('member')) {
|
} else if (relationships.get('member')) {
|
||||||
return <Button className='logo-button' text={intl.formatMessage(messages.leave, { name: group.get('title') })} onClick={toggle} />;
|
return <Button className='logo-button' text={intl.formatMessage(messages.leave, { name: group.get('title') })} onClick={this.toggle} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -28,6 +28,7 @@ class HomeTimeline extends React.PureComponent {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
hasUnread: PropTypes.bool,
|
hasUnread: PropTypes.bool,
|
||||||
isPartial: PropTypes.bool,
|
isPartial: PropTypes.bool,
|
||||||
|
siteTitle: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
handleLoadMore = maxId => {
|
handleLoadMore = maxId => {
|
||||||
|
|
|
@ -42,6 +42,7 @@ class CommunityTimeline extends React.PureComponent {
|
||||||
hasUnread: PropTypes.bool,
|
hasUnread: PropTypes.bool,
|
||||||
onlyMedia: PropTypes.bool,
|
onlyMedia: PropTypes.bool,
|
||||||
timelineId: PropTypes.string,
|
timelineId: PropTypes.string,
|
||||||
|
siteTitle: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
|
|
|
@ -67,6 +67,7 @@ class ActionBar extends React.PureComponent {
|
||||||
onEmbed: PropTypes.func,
|
onEmbed: PropTypes.func,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
onOpenUnauthorizedModal: PropTypes.func.isRequired,
|
onOpenUnauthorizedModal: PropTypes.func.isRequired,
|
||||||
|
me: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
handleReplyClick = () => {
|
handleReplyClick = () => {
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
export default
|
export default
|
||||||
class ExplanationBox extends React.PureComponent {
|
class ExplanationBox extends React.PureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
||||||
|
explanation: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
||||||
|
dismissable: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { title, explanation, dismissable } = this.props;
|
const { title, explanation, dismissable } = this.props;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { invitesEnabled } from 'gabsocial/initial_state';
|
import { invitesEnabled } from 'gabsocial/initial_state';
|
||||||
|
@ -61,7 +62,9 @@ const LinkFooter = ({ onOpenHotkeys, account, onClickLogOut }) => (
|
||||||
);
|
);
|
||||||
|
|
||||||
LinkFooter.propTypes = {
|
LinkFooter.propTypes = {
|
||||||
withHotkeys: PropTypes.bool,
|
account: ImmutablePropTypes.map,
|
||||||
|
onOpenHotkeys: PropTypes.func.isRequired,
|
||||||
|
onClickLogOut: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LinkFooter));
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LinkFooter));
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import Icon from 'gabsocial/components/icon';
|
import Icon from 'gabsocial/components/icon';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
@ -9,6 +10,10 @@ const mapStateToProps = state => ({
|
||||||
export default @connect(mapStateToProps)
|
export default @connect(mapStateToProps)
|
||||||
class PromoPanel extends React.PureComponent {
|
class PromoPanel extends React.PureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
promoItems: ImmutablePropTypes.list,
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { promoItems } = this.props;
|
const { promoItems } = this.props;
|
||||||
if (!promoItems) return null;
|
if (!promoItems) return null;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||||
|
|
||||||
|
@ -33,4 +34,9 @@ const SignUpPanel = ({ siteTitle, me }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SignUpPanel.propTypes = {
|
||||||
|
siteTitle: PropTypes.string,
|
||||||
|
me: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
export default injectIntl(connect(mapStateToProps)(SignUpPanel));
|
export default injectIntl(connect(mapStateToProps)(SignUpPanel));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { Link, NavLink, withRouter } from 'react-router-dom';
|
import { Link, NavLink, withRouter } from 'react-router-dom';
|
||||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||||
import { throttle } from 'lodash';
|
import { throttle } from 'lodash';
|
||||||
|
@ -20,6 +21,8 @@ class TabsBar extends React.PureComponent {
|
||||||
history: PropTypes.object.isRequired,
|
history: PropTypes.object.isRequired,
|
||||||
onOpenCompose: PropTypes.func,
|
onOpenCompose: PropTypes.func,
|
||||||
onOpenSidebar: PropTypes.func.isRequired,
|
onOpenSidebar: PropTypes.func.isRequired,
|
||||||
|
logo: PropTypes.string,
|
||||||
|
account: ImmutablePropTypes.map,
|
||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
|
|
@ -256,6 +256,8 @@ class UI extends React.PureComponent {
|
||||||
location: PropTypes.object,
|
location: PropTypes.object,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
dropdownMenuIsOpen: PropTypes.bool,
|
dropdownMenuIsOpen: PropTypes.bool,
|
||||||
|
me: PropTypes.string,
|
||||||
|
streamingUrl: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
|
|
@ -22,6 +22,7 @@ class WrappedRoute extends React.Component {
|
||||||
componentParams: PropTypes.object,
|
componentParams: PropTypes.object,
|
||||||
layout: PropTypes.object,
|
layout: PropTypes.object,
|
||||||
publicRoute: PropTypes.bool,
|
publicRoute: PropTypes.bool,
|
||||||
|
me: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -74,7 +75,7 @@ class WrappedRoute extends React.Component {
|
||||||
const { component: Component, content, publicRoute, me, ...rest } = this.props;
|
const { component: Component, content, publicRoute, me, ...rest } = this.props;
|
||||||
|
|
||||||
if (!publicRoute && me === false) {
|
if (!publicRoute && me === false) {
|
||||||
const actualUrl = encodeURIComponent(this.props.computedMatch.url);
|
const actualUrl = encodeURIComponent(this.props.computedMatch.url); // eslint-disable-line react/prop-types
|
||||||
return <Redirect to={`/auth/sign_in?redirect_uri=${actualUrl}`} />;
|
return <Redirect to={`/auth/sign_in?redirect_uri=${actualUrl}`} />;
|
||||||
// return <Route path={this.props.path} component={() => {
|
// return <Route path={this.props.path} component={() => {
|
||||||
// window.location.href = `/auth/sign_in?redirect_uri=${actualUrl}`;
|
// window.location.href = `/auth/sign_in?redirect_uri=${actualUrl}`;
|
||||||
|
|
Loading…
Reference in a new issue