Improve eslint rules (#3147)

* Add semi to ESLint rules

* Add padded-blocks to ESLint rules

* Add comma-dangle to ESLint rules

* add config/webpack and storyboard

* add streaming/

* yarn test:lint -- --fix
This commit is contained in:
Yamagishi Kazutoshi 2017-05-21 00:31:47 +09:00 committed by Eugen Rochko
parent 812fe90eca
commit 2e112e2406
170 changed files with 919 additions and 904 deletions

View file

@ -33,7 +33,7 @@ class ActionBar extends React.PureComponent {
onMute: PropTypes.func.isRequired,
onBlockDomain: PropTypes.func.isRequired,
onUnblockDomain: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
render () {

View file

@ -13,12 +13,12 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
follow: { id: 'account.follow', defaultMessage: 'Follow' },
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' }
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' },
});
const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({
autoPlayGif: state.getIn(['meta', 'auto_play_gif'])
autoPlayGif: state.getIn(['meta', 'auto_play_gif']),
});
return mapStateToProps;
@ -28,11 +28,11 @@ class Avatar extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
autoPlayGif: PropTypes.bool.isRequired
autoPlayGif: PropTypes.bool.isRequired,
};
state = {
isHovered: false
isHovered: false,
};
handleMouseOver = () => {
@ -77,7 +77,7 @@ class Header extends ImmutablePureComponent {
me: PropTypes.number.isRequired,
onFollow: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
autoPlayGif: PropTypes.bool.isRequired
autoPlayGif: PropTypes.bool.isRequired,
};
render () {
@ -97,7 +97,7 @@ class Header extends ImmutablePureComponent {
}
if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) {
info = <span className='account--follows-info'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>
info = <span className='account--follows-info'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>;
}
if (me !== account.get('id')) {

View file

@ -6,7 +6,7 @@ import Permalink from '../../../components/permalink';
class MediaItem extends ImmutablePureComponent {
static propTypes = {
media: ImmutablePropTypes.map.isRequired
media: ImmutablePropTypes.map.isRequired,
};
render () {
@ -34,6 +34,7 @@ class MediaItem extends ImmutablePureComponent {
</div>
);
}
}
export default MediaItem;

View file

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import {
fetchAccount,
fetchAccountMediaTimeline,
expandAccountMediaTimeline
expandAccountMediaTimeline,
} from '../../actions/accounts';
import LoadingIndicator from '../../components/loading_indicator';
import Column from '../ui/components/column';

View file

@ -21,7 +21,7 @@ class Header extends ImmutablePureComponent {
};
static contextTypes = {
router: PropTypes.object
router: PropTypes.object,
};
handleFollow = () => {

View file

@ -8,7 +8,7 @@ import {
blockAccount,
unblockAccount,
muteAccount,
unmuteAccount
unmuteAccount,
} from '../../../actions/accounts';
import { mentionCompose } from '../../../actions/compose';
import { initReport } from '../../../actions/reports';
@ -27,7 +27,7 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, Number(accountId)),
me: state.getIn(['meta', 'me'])
me: state.getIn(['meta', 'me']),
});
return mapStateToProps;
@ -49,7 +49,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
confirm: intl.formatMessage(messages.blockConfirm),
onConfirm: () => dispatch(blockAccount(account.get('id')))
onConfirm: () => dispatch(blockAccount(account.get('id'))),
}));
}
},
@ -69,7 +69,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.mute.message' defaultMessage='Are you sure you want to mute {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
confirm: intl.formatMessage(messages.muteConfirm),
onConfirm: () => dispatch(muteAccount(account.get('id')))
onConfirm: () => dispatch(muteAccount(account.get('id'))),
}));
}
},
@ -78,13 +78,13 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.domain_block.message' defaultMessage='Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.' values={{ domain: <strong>{domain}</strong> }} />,
confirm: intl.formatMessage(messages.blockDomainConfirm),
onConfirm: () => dispatch(blockDomain(domain, accountId))
onConfirm: () => dispatch(blockDomain(domain, accountId)),
}));
},
onUnblockDomain (domain, accountId) {
dispatch(unblockDomain(domain, accountId));
}
},
});
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Header));

View file

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import {
fetchAccount,
fetchAccountTimeline,
expandAccountTimeline
expandAccountTimeline,
} from '../../actions/accounts';
import StatusList from '../../components/status_list';
import LoadingIndicator from '../../components/loading_indicator';
@ -19,7 +19,7 @@ const mapStateToProps = (state, props) => ({
statusIds: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'items'], Immutable.List()),
isLoading: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'isLoading']),
hasMore: !!state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId), 'next']),
me: state.getIn(['meta', 'me'])
me: state.getIn(['meta', 'me']),
});
class AccountTimeline extends ImmutablePureComponent {
@ -30,7 +30,7 @@ class AccountTimeline extends ImmutablePureComponent {
statusIds: ImmutablePropTypes.list,
isLoading: PropTypes.bool,
hasMore: PropTypes.bool,
me: PropTypes.number.isRequired
me: PropTypes.number.isRequired,
};
componentWillMount () {

View file

@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
heading: { id: 'column.blocks', defaultMessage: 'Blocked users' }
heading: { id: 'column.blocks', defaultMessage: 'Blocked users' },
});
const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'blocks', 'items'])
accountIds: state.getIn(['user_lists', 'blocks', 'items']),
});
class Blocks extends ImmutablePureComponent {
@ -25,7 +25,7 @@ class Blocks extends ImmutablePureComponent {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
componentWillMount () {
@ -64,6 +64,7 @@ class Blocks extends ImmutablePureComponent {
</Column>
);
}
}
export default connect(mapStateToProps)(injectIntl(Blocks));

View file

@ -8,20 +8,20 @@ import {
updateTimeline,
deleteFromTimelines,
connectTimeline,
disconnectTimeline
disconnectTimeline,
} from '../../actions/timelines';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import createStream from '../../stream';
const messages = defineMessages({
title: { id: 'column.community', defaultMessage: 'Local timeline' }
title: { id: 'column.community', defaultMessage: 'Local timeline' },
});
const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'community', 'unread']) > 0,
streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']),
accessToken: state.getIn(['meta', 'access_token'])
accessToken: state.getIn(['meta', 'access_token']),
});
let subscription;
@ -33,7 +33,7 @@ class CommunityTimeline extends React.PureComponent {
intl: PropTypes.object.isRequired,
streamingAPIBaseURL: PropTypes.string.isRequired,
accessToken: PropTypes.string.isRequired,
hasUnread: PropTypes.bool
hasUnread: PropTypes.bool,
};
componentDidMount () {
@ -68,7 +68,7 @@ class CommunityTimeline extends React.PureComponent {
dispatch(deleteFromTimelines(data.payload));
break;
}
}
},
});
}

View file

@ -7,7 +7,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class AutosuggestAccount extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired
account: ImmutablePropTypes.map.isRequired,
};
render () {

View file

@ -6,7 +6,7 @@ class CharacterCounter extends React.PureComponent {
static propTypes = {
text: PropTypes.string.isRequired,
max: PropTypes.number.isRequired
max: PropTypes.number.isRequired,
};
checkRemainingText (diff) {

View file

@ -53,7 +53,7 @@ class ComposeForm extends ImmutablePureComponent {
};
static defaultProps = {
showSearch: false
showSearch: false,
};
handleChange = (e) => {

View file

@ -13,13 +13,13 @@ const messages = defineMessages({
travel: { id: 'emoji_button.travel', defaultMessage: 'Travel & Places' },
objects: { id: 'emoji_button.objects', defaultMessage: 'Objects' },
symbols: { id: 'emoji_button.symbols', defaultMessage: 'Symbols' },
flags: { id: 'emoji_button.flags', defaultMessage: 'Flags' }
flags: { id: 'emoji_button.flags', defaultMessage: 'Flags' },
});
const settings = {
imageType: 'png',
sprites: false,
imagePathPNG: '/emoji/'
imagePathPNG: '/emoji/',
};
let EmojiPicker; // load asynchronously
@ -28,12 +28,12 @@ class EmojiPickerDropdown extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
onPickEmoji: PropTypes.func.isRequired
onPickEmoji: PropTypes.func.isRequired,
};
state = {
active: false,
loading: false
loading: false,
};
setRef = (c) => {
@ -98,8 +98,8 @@ class EmojiPickerDropdown extends React.PureComponent {
flags: {
title: intl.formatMessage(messages.flags),
emoji: 'flag_gb',
}
}
},
};
const { active, loading } = this.state;

View file

@ -11,7 +11,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class NavigationBar extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired
account: ImmutablePropTypes.map.isRequired,
};
render () {

View file

@ -12,24 +12,24 @@ const messages = defineMessages({
private_long: { id: 'privacy.private.long', defaultMessage: 'Post to followers only' },
direct_short: { id: 'privacy.direct.short', defaultMessage: 'Direct' },
direct_long: { id: 'privacy.direct.long', defaultMessage: 'Post to mentioned users only' },
change_privacy: { id: 'privacy.change', defaultMessage: 'Adjust status privacy' }
change_privacy: { id: 'privacy.change', defaultMessage: 'Adjust status privacy' },
});
const iconStyle = {
height: null,
lineHeight: '27px'
}
lineHeight: '27px',
};
class PrivacyDropdown extends React.PureComponent {
static propTypes = {
value: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
state = {
open: false
open: false,
};
handleToggle = () => {
@ -71,7 +71,7 @@ class PrivacyDropdown extends React.PureComponent {
{ icon: 'globe', value: 'public', shortText: intl.formatMessage(messages.public_short), longText: intl.formatMessage(messages.public_long) },
{ icon: 'unlock-alt', value: 'unlisted', shortText: intl.formatMessage(messages.unlisted_short), longText: intl.formatMessage(messages.unlisted_long) },
{ icon: 'lock', value: 'private', shortText: intl.formatMessage(messages.private_short), longText: intl.formatMessage(messages.private_long) },
{ icon: 'envelope', value: 'direct', shortText: intl.formatMessage(messages.direct_short), longText: intl.formatMessage(messages.direct_long) }
{ icon: 'envelope', value: 'direct', shortText: intl.formatMessage(messages.direct_short), longText: intl.formatMessage(messages.direct_long) },
];
const valueOption = options.find(item => item.value === value);

View file

@ -9,19 +9,19 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' }
cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' },
});
class ReplyIndicator extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object
router: PropTypes.object,
};
static propTypes = {
status: ImmutablePropTypes.map,
onCancel: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
handleClick = () => {

View file

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
const messages = defineMessages({
placeholder: { id: 'search.placeholder', defaultMessage: 'Search' }
placeholder: { id: 'search.placeholder', defaultMessage: 'Search' },
});
class Search extends React.PureComponent {
@ -15,7 +15,7 @@ class Search extends React.PureComponent {
onSubmit: PropTypes.func.isRequired,
onClear: PropTypes.func.isRequired,
onShow: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
handleChange = (e) => {

View file

@ -9,7 +9,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class SearchResults extends ImmutablePureComponent {
static propTypes = {
results: ImmutablePropTypes.map.isRequired
results: ImmutablePropTypes.map.isRequired,
};
render () {

View file

@ -8,7 +8,7 @@ class TextIconButton extends React.PureComponent {
title: PropTypes.string,
active: PropTypes.bool,
onClick: PropTypes.func.isRequired,
ariaControls: PropTypes.string
ariaControls: PropTypes.string,
};
handleClick = (e) => {

View file

@ -5,7 +5,7 @@ import { defineMessages, injectIntl } from 'react-intl';
import { connect } from 'react-redux';
const messages = defineMessages({
upload: { id: 'upload_button.label', defaultMessage: 'Add media' }
upload: { id: 'upload_button.label', defaultMessage: 'Add media' },
});
const makeMapStateToProps = () => {
@ -14,12 +14,12 @@ const makeMapStateToProps = () => {
});
return mapStateToProps;
}
};
const iconStyle = {
height: null,
lineHeight: '27px'
}
lineHeight: '27px',
};
class UploadButton extends React.PureComponent {
@ -29,7 +29,7 @@ class UploadButton extends React.PureComponent {
style: PropTypes.object,
resetFileKey: PropTypes.number,
acceptContentTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
handleChange = (e) => {

View file

@ -8,7 +8,7 @@ import Motion from 'react-motion/lib/Motion';
import spring from 'react-motion/lib/spring';
const messages = defineMessages({
undo: { id: 'upload_form.undo', defaultMessage: 'Undo' }
undo: { id: 'upload_form.undo', defaultMessage: 'Undo' },
});
class UploadForm extends React.PureComponent {
@ -16,7 +16,7 @@ class UploadForm extends React.PureComponent {
static propTypes = {
media: ImmutablePropTypes.list.isRequired,
onRemoveFile: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
onRemoveFile = (e) => {

View file

@ -8,7 +8,7 @@ class UploadProgress extends React.PureComponent {
static propTypes = {
active: PropTypes.bool,
progress: PropTypes.number
progress: PropTypes.number,
};
render () {

View file

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
class Warning extends React.PureComponent {
static propTypes = {
message: PropTypes.node.isRequired
message: PropTypes.node.isRequired,
};
render () {

View file

@ -6,7 +6,7 @@ const makeMapStateToProps = () => {
const getAccount = makeGetAccount();
const mapStateToProps = (state, { id }) => ({
account: getAccount(state, id)
account: getAccount(state, id),
});
return mapStateToProps;

View file

@ -6,7 +6,7 @@ const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const mapStateToProps = (state, { id }) => ({
status: getStatus(state, id)
status: getStatus(state, id),
});
return mapStateToProps;

View file

@ -8,7 +8,7 @@ import {
fetchComposeSuggestions,
selectComposeSuggestion,
changeComposeSpoilerText,
insertEmojiCompose
insertEmojiCompose,
} from '../../../actions/compose';
const mapStateToProps = state => ({
@ -23,7 +23,7 @@ const mapStateToProps = state => ({
is_submitting: state.getIn(['compose', 'is_submitting']),
is_uploading: state.getIn(['compose', 'is_uploading']),
me: state.getIn(['compose', 'me']),
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden'])
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
});
const mapDispatchToProps = (dispatch) => ({

View file

@ -3,7 +3,7 @@ import NavigationBar from '../components/navigation_bar';
const mapStateToProps = (state, props) => {
return {
account: state.getIn(['accounts', state.getIn(['meta', 'me'])])
account: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
};
};

View file

@ -3,14 +3,14 @@ import PrivacyDropdown from '../components/privacy_dropdown';
import { changeComposeVisibility } from '../../../actions/compose';
const mapStateToProps = state => ({
value: state.getIn(['compose', 'privacy'])
value: state.getIn(['compose', 'privacy']),
});
const mapDispatchToProps = dispatch => ({
onChange (value) {
dispatch(changeComposeVisibility(value));
}
},
});

View file

@ -17,7 +17,7 @@ const mapDispatchToProps = dispatch => ({
onCancel () {
dispatch(cancelReplyCompose());
}
},
});

View file

@ -3,13 +3,13 @@ import {
changeSearch,
clearSearch,
submitSearch,
showSearch
showSearch,
} from '../../../actions/search';
import Search from '../components/search';
const mapStateToProps = state => ({
value: state.getIn(['search', 'value']),
submitted: state.getIn(['search', 'submitted'])
submitted: state.getIn(['search', 'submitted']),
});
const mapDispatchToProps = dispatch => ({
@ -28,7 +28,7 @@ const mapDispatchToProps = dispatch => ({
onShow () {
dispatch(showSearch());
}
},
});

View file

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import SearchResults from '../components/search_results';
const mapStateToProps = state => ({
results: state.getIn(['search', 'results'])
results: state.getIn(['search', 'results']),
});
export default connect(mapStateToProps)(SearchResults);

View file

@ -8,19 +8,19 @@ import spring from 'react-motion/lib/spring';
import { injectIntl, defineMessages } from 'react-intl';
const messages = defineMessages({
title: { id: 'compose_form.sensitive', defaultMessage: 'Mark media as sensitive' }
title: { id: 'compose_form.sensitive', defaultMessage: 'Mark media as sensitive' },
});
const mapStateToProps = state => ({
visible: state.getIn(['compose', 'media_attachments']).size > 0,
active: state.getIn(['compose', 'sensitive'])
active: state.getIn(['compose', 'sensitive']),
});
const mapDispatchToProps = dispatch => ({
onClick () {
dispatch(changeComposeSensitivity());
}
},
});
@ -30,7 +30,7 @@ class SensitiveButton extends React.PureComponent {
visible: PropTypes.bool,
active: PropTypes.bool,
onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
render () {

View file

@ -4,21 +4,21 @@ import { changeComposeSpoilerness } from '../../../actions/compose';
import { injectIntl, defineMessages } from 'react-intl';
const messages = defineMessages({
title: { id: 'compose_form.spoiler', defaultMessage: 'Hide text behind warning' }
title: { id: 'compose_form.spoiler', defaultMessage: 'Hide text behind warning' },
});
const mapStateToProps = (state, { intl }) => ({
label: 'CW',
title: intl.formatMessage(messages.title),
active: state.getIn(['compose', 'spoiler']),
ariaControls: 'cw-spoiler-input'
ariaControls: 'cw-spoiler-input',
});
const mapDispatchToProps = dispatch => ({
onClick () {
dispatch(changeComposeSpoilerness());
}
},
});

View file

@ -4,14 +4,14 @@ import { uploadCompose } from '../../../actions/compose';
const mapStateToProps = state => ({
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
resetFileKey: state.getIn(['compose', 'resetFileKey'])
resetFileKey: state.getIn(['compose', 'resetFileKey']),
});
const mapDispatchToProps = dispatch => ({
onSelectFile (files) {
dispatch(uploadCompose(files));
}
},
});

View file

@ -10,7 +10,7 @@ const mapDispatchToProps = dispatch => ({
onRemoveFile (media_id) {
dispatch(undoUploadCompose(media_id));
}
},
});

View file

@ -3,7 +3,7 @@ import UploadProgress from '../components/upload_progress';
const mapStateToProps = (state, props) => ({
active: state.getIn(['compose', 'is_uploading']),
progress: state.getIn(['compose', 'progress'])
progress: state.getIn(['compose', 'progress']),
});
export default connect(mapStateToProps)(UploadProgress);

View file

@ -20,7 +20,7 @@ const mapStateToProps = state => {
return {
needsLeakWarning: (state.getIn(['compose', 'privacy']) === 'private' || state.getIn(['compose', 'privacy']) === 'direct') && mentionedUsernames !== null,
mentionedDomains: mentionedUsernamesWithDomains,
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', state.getIn(['meta', 'me']), 'locked'])
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', state.getIn(['meta', 'me']), 'locked']),
};
};

View file

@ -17,11 +17,11 @@ const messages = defineMessages({
public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
});
const mapStateToProps = state => ({
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden'])
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
});
class Compose extends React.PureComponent {
@ -30,7 +30,7 @@ class Compose extends React.PureComponent {
dispatch: PropTypes.func.isRequired,
withHeader: PropTypes.bool,
showSearch: PropTypes.bool,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
componentDidMount () {

View file

@ -11,13 +11,13 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
heading: { id: 'column.favourites', defaultMessage: 'Favourites' }
heading: { id: 'column.favourites', defaultMessage: 'Favourites' },
});
const mapStateToProps = state => ({
statusIds: state.getIn(['status_lists', 'favourites', 'items']),
loaded: state.getIn(['status_lists', 'favourites', 'loaded']),
me: state.getIn(['meta', 'me'])
me: state.getIn(['meta', 'me']),
});
class Favourites extends ImmutablePureComponent {
@ -27,7 +27,7 @@ class Favourites extends ImmutablePureComponent {
statusIds: ImmutablePropTypes.list.isRequired,
loaded: PropTypes.bool,
intl: PropTypes.object.isRequired,
me: PropTypes.number.isRequired
me: PropTypes.number.isRequired,
};
componentWillMount () {

View file

@ -11,7 +11,7 @@ import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({
accountIds: state.getIn(['user_lists', 'favourited_by', Number(props.params.statusId)])
accountIds: state.getIn(['user_lists', 'favourited_by', Number(props.params.statusId)]),
});
class Favourites extends ImmutablePureComponent {
@ -19,7 +19,7 @@ class Favourites extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list
accountIds: ImmutablePropTypes.list,
};
componentWillMount () {

View file

@ -11,7 +11,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' },
reject: { id: 'follow_request.reject', defaultMessage: 'Reject' }
reject: { id: 'follow_request.reject', defaultMessage: 'Reject' },
});
class AccountAuthorize extends ImmutablePureComponent {
@ -20,7 +20,7 @@ class AccountAuthorize extends ImmutablePureComponent {
account: ImmutablePropTypes.map.isRequired,
onAuthorize: PropTypes.func.isRequired,
onReject: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
render () {

View file

@ -7,7 +7,7 @@ const makeMapStateToProps = () => {
const getAccount = makeGetAccount();
const mapStateToProps = (state, props) => ({
account: getAccount(state, props.id)
account: getAccount(state, props.id),
});
return mapStateToProps;
@ -20,7 +20,7 @@ const mapDispatchToProps = (dispatch, { id }) => ({
onReject (account) {
dispatch(rejectFollowRequest(id));
}
},
});
export default connect(makeMapStateToProps, mapDispatchToProps)(AccountAuthorize);

View file

@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' }
heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' },
});
const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'follow_requests', 'items'])
accountIds: state.getIn(['user_lists', 'follow_requests', 'items']),
});
class FollowRequests extends ImmutablePureComponent {
@ -25,7 +25,7 @@ class FollowRequests extends ImmutablePureComponent {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
componentWillMount () {

View file

@ -6,7 +6,7 @@ import LoadingIndicator from '../../components/loading_indicator';
import {
fetchAccount,
fetchFollowers,
expandFollowers
expandFollowers,
} from '../../actions/accounts';
import { ScrollContainer } from 'react-router-scroll';
import AccountContainer from '../../containers/account_container';
@ -17,7 +17,7 @@ import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({
accountIds: state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'items'])
accountIds: state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'items']),
});
class Followers extends ImmutablePureComponent {
@ -25,7 +25,7 @@ class Followers extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list
accountIds: ImmutablePropTypes.list,
};
componentWillMount () {

View file

@ -6,7 +6,7 @@ import LoadingIndicator from '../../components/loading_indicator';
import {
fetchAccount,
fetchFollowing,
expandFollowing
expandFollowing,
} from '../../actions/accounts';
import { ScrollContainer } from 'react-router-scroll';
import AccountContainer from '../../containers/account_container';
@ -17,7 +17,7 @@ import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({
accountIds: state.getIn(['user_lists', 'following', Number(props.params.accountId), 'items'])
accountIds: state.getIn(['user_lists', 'following', Number(props.params.accountId), 'items']),
});
class Following extends ImmutablePureComponent {
@ -25,7 +25,7 @@ class Following extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list
accountIds: ImmutablePropTypes.list,
};
componentWillMount () {

View file

@ -21,18 +21,18 @@ const messages = defineMessages({
favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' },
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' },
info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' }
info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' },
});
const mapStateToProps = state => ({
me: state.getIn(['accounts', state.getIn(['meta', 'me'])])
me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
});
class GettingStarted extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
me: ImmutablePropTypes.map.isRequired
me: ImmutablePropTypes.map.isRequired,
};
render () {
@ -69,7 +69,7 @@ class GettingStarted extends ImmutablePureComponent {
values={{
faq: <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/FAQ.md" rel="noopener" target="_blank"><FormattedMessage id='getting_started.faq' defaultMessage='FAQ' /></a>,
userguide: <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/User-guide.md" rel="noopener" target="_blank"><FormattedMessage id='getting_started.userguide' defaultMessage='User Guide' /></a>,
apps: <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md" rel="noopener" target="_blank"><FormattedMessage id='getting_started.appsshort' defaultMessage='Apps' /></a>
apps: <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md" rel="noopener" target="_blank"><FormattedMessage id='getting_started.appsshort' defaultMessage='Apps' /></a>,
}}
/>
</p>
@ -85,6 +85,7 @@ class GettingStarted extends ImmutablePureComponent {
</Column>
);
}
}
export default connect(mapStateToProps)(injectIntl(GettingStarted));

View file

@ -6,7 +6,7 @@ import Column from '../ui/components/column';
import {
refreshTimeline,
updateTimeline,
deleteFromTimelines
deleteFromTimelines,
} from '../../actions/timelines';
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import { FormattedMessage } from 'react-intl';
@ -15,7 +15,7 @@ import createStream from '../../stream';
const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'tag', 'unread']) > 0,
streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']),
accessToken: state.getIn(['meta', 'access_token'])
accessToken: state.getIn(['meta', 'access_token']),
});
class HashtagTimeline extends React.PureComponent {
@ -25,7 +25,7 @@ class HashtagTimeline extends React.PureComponent {
dispatch: PropTypes.func.isRequired,
streamingAPIBaseURL: PropTypes.string.isRequired,
accessToken: PropTypes.string.isRequired,
hasUnread: PropTypes.bool
hasUnread: PropTypes.bool,
};
_subscribe (dispatch, id) {
@ -42,7 +42,7 @@ class HashtagTimeline extends React.PureComponent {
dispatch(deleteFromTimelines(data.payload));
break;
}
}
},
});
}

View file

@ -8,7 +8,7 @@ import SettingText from './setting_text';
const messages = defineMessages({
filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' },
settings: { id: 'home.settings', defaultMessage: 'Column settings' }
settings: { id: 'home.settings', defaultMessage: 'Column settings' },
});
class ColumnSettings extends React.PureComponent {
@ -17,7 +17,7 @@ class ColumnSettings extends React.PureComponent {
settings: ImmutablePropTypes.map.isRequired,
onChange: PropTypes.func.isRequired,
onSave: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
render () {

View file

@ -8,11 +8,11 @@ class SettingText extends React.PureComponent {
settings: ImmutablePropTypes.map.isRequired,
settingKey: PropTypes.array.isRequired,
label: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired
onChange: PropTypes.func.isRequired,
};
handleChange = (e) => {
this.props.onChange(this.props.settingKey, e.target.value)
this.props.onChange(this.props.settingKey, e.target.value);
}
render () {

View file

@ -3,7 +3,7 @@ import ColumnSettings from '../components/column_settings';
import { changeSetting, saveSettings } from '../../../actions/settings';
const mapStateToProps = state => ({
settings: state.getIn(['settings', 'home'])
settings: state.getIn(['settings', 'home']),
});
const mapDispatchToProps = dispatch => ({
@ -14,7 +14,7 @@ const mapDispatchToProps = dispatch => ({
onSave () {
dispatch(saveSettings());
}
},
});

View file

@ -8,12 +8,12 @@ import ColumnSettingsContainer from './containers/column_settings_container';
import Link from 'react-router/lib/Link';
const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' }
title: { id: 'column.home', defaultMessage: 'Home' },
});
const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0,
hasFollows: state.getIn(['accounts_counters', state.getIn(['meta', 'me']), 'following_count']) > 0
hasFollows: state.getIn(['accounts_counters', state.getIn(['meta', 'me']), 'following_count']) > 0,
});
class HomeTimeline extends React.PureComponent {
@ -21,7 +21,7 @@ class HomeTimeline extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
hasUnread: PropTypes.bool,
hasFollows: PropTypes.bool
hasFollows: PropTypes.bool,
};
render () {
@ -30,7 +30,7 @@ class HomeTimeline extends React.PureComponent {
let emptyMessage;
if (hasFollows) {
emptyMessage = <FormattedMessage id='empty_column.home.inactivity' defaultMessage="Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon." />
emptyMessage = <FormattedMessage id='empty_column.home.inactivity' defaultMessage="Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon." />;
} else {
emptyMessage = <FormattedMessage id='empty_column.home' defaultMessage="You aren't following anyone yet. Visit {public} or use search to get started and meet other users." values={{ public: <Link to='/timelines/public'><FormattedMessage id='empty_column.home.public_timeline' defaultMessage='the public timeline' /></Link> }} />;
}

View file

@ -12,11 +12,11 @@ import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
heading: { id: 'column.mutes', defaultMessage: 'Muted users' }
heading: { id: 'column.mutes', defaultMessage: 'Muted users' },
});
const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'mutes', 'items'])
accountIds: state.getIn(['user_lists', 'mutes', 'items']),
});
class Mutes extends ImmutablePureComponent {
@ -64,7 +64,7 @@ Mutes.propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
export default connect(mapStateToProps)(injectIntl(Mutes));

View file

@ -3,14 +3,14 @@ import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
const messages = defineMessages({
clear: { id: 'notifications.clear', defaultMessage: 'Clear notifications' }
clear: { id: 'notifications.clear', defaultMessage: 'Clear notifications' },
});
class ClearColumnButton extends React.Component {
static propTypes = {
onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
render () {
@ -22,6 +22,7 @@ class ClearColumnButton extends React.Component {
</div>
);
}
}
export default injectIntl(ClearColumnButton);

View file

@ -6,7 +6,7 @@ import ColumnCollapsable from '../../../components/column_collapsable';
import SettingToggle from './setting_toggle';
const messages = defineMessages({
settings: { id: 'notifications.settings', defaultMessage: 'Column settings' }
settings: { id: 'notifications.settings', defaultMessage: 'Column settings' },
});
class ColumnSettings extends React.PureComponent {
@ -16,8 +16,8 @@ class ColumnSettings extends React.PureComponent {
onChange: PropTypes.func.isRequired,
onSave: PropTypes.func.isRequired,
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired
}).isRequired
formatMessage: PropTypes.func.isRequired,
}).isRequired,
};
render () {

View file

@ -12,7 +12,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class Notification extends ImmutablePureComponent {
static propTypes = {
notification: ImmutablePropTypes.map.isRequired
notification: ImmutablePropTypes.map.isRequired,
};
renderFollow (account, link) {

View file

@ -10,7 +10,7 @@ class SettingToggle extends React.PureComponent {
settingKey: PropTypes.array.isRequired,
label: PropTypes.node.isRequired,
onChange: PropTypes.func.isRequired,
htmlFor: PropTypes.string
htmlFor: PropTypes.string,
}
onChange = (e) => {

View file

@ -3,7 +3,7 @@ import ColumnSettings from '../components/column_settings';
import { changeSetting, saveSettings } from '../../../actions/settings';
const mapStateToProps = state => ({
settings: state.getIn(['settings', 'notifications'])
settings: state.getIn(['settings', 'notifications']),
});
const mapDispatchToProps = dispatch => ({
@ -14,7 +14,7 @@ const mapDispatchToProps = dispatch => ({
onSave () {
dispatch(saveSettings());
}
},
});

View file

@ -6,7 +6,7 @@ const makeMapStateToProps = () => {
const getNotification = makeGetNotification();
const mapStateToProps = (state, props) => ({
notification: getNotification(state, props.notification, props.accountId)
notification: getNotification(state, props.notification, props.accountId),
});
return mapStateToProps;

View file

@ -17,18 +17,18 @@ import { openModal } from '../../actions/modal';
const messages = defineMessages({
title: { id: 'column.notifications', defaultMessage: 'Notifications' },
clearMessage: { id: 'notifications.clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all your notifications?' },
clearConfirm: { id: 'notifications.clear', defaultMessage: 'Clear notifications' }
clearConfirm: { id: 'notifications.clear', defaultMessage: 'Clear notifications' },
});
const getNotifications = createSelector([
state => Immutable.List(state.getIn(['settings', 'notifications', 'shows']).filter(item => !item).keys()),
state => state.getIn(['notifications', 'items'])
state => state.getIn(['notifications', 'items']),
], (excludedTypes, notifications) => notifications.filterNot(item => excludedTypes.includes(item.get('type'))));
const mapStateToProps = state => ({
notifications: getNotifications(state),
isLoading: state.getIn(['notifications', 'isLoading'], true),
isUnread: state.getIn(['notifications', 'unread']) > 0
isUnread: state.getIn(['notifications', 'unread']) > 0,
});
class Notifications extends React.PureComponent {
@ -39,11 +39,11 @@ class Notifications extends React.PureComponent {
shouldUpdateScroll: PropTypes.func,
intl: PropTypes.object.isRequired,
isLoading: PropTypes.bool,
isUnread: PropTypes.bool
isUnread: PropTypes.bool,
};
static defaultProps = {
trackScroll: true
trackScroll: true,
};
handleScroll = (e) => {
@ -77,7 +77,7 @@ class Notifications extends React.PureComponent {
dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.clearMessage),
confirm: intl.formatMessage(messages.clearConfirm),
onConfirm: () => dispatch(clearNotifications())
onConfirm: () => dispatch(clearNotifications()),
}));
}

View file

@ -8,20 +8,20 @@ import {
updateTimeline,
deleteFromTimelines,
connectTimeline,
disconnectTimeline
disconnectTimeline,
} from '../../actions/timelines';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import createStream from '../../stream';
const messages = defineMessages({
title: { id: 'column.public', defaultMessage: 'Federated timeline' }
title: { id: 'column.public', defaultMessage: 'Federated timeline' },
});
const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'public', 'unread']) > 0,
streamingAPIBaseURL: state.getIn(['meta', 'streaming_api_base_url']),
accessToken: state.getIn(['meta', 'access_token'])
accessToken: state.getIn(['meta', 'access_token']),
});
let subscription;
@ -33,7 +33,7 @@ class PublicTimeline extends React.PureComponent {
intl: PropTypes.object.isRequired,
streamingAPIBaseURL: PropTypes.string.isRequired,
accessToken: PropTypes.string.isRequired,
hasUnread: PropTypes.bool
hasUnread: PropTypes.bool,
};
componentDidMount () {
@ -68,7 +68,7 @@ class PublicTimeline extends React.PureComponent {
dispatch(deleteFromTimelines(data.payload));
break;
}
}
},
});
}

View file

@ -11,7 +11,7 @@ import ColumnBackButton from '../../components/column_back_button';
import ImmutablePureComponent from 'react-immutable-pure-component';
const mapStateToProps = (state, props) => ({
accountIds: state.getIn(['user_lists', 'reblogged_by', Number(props.params.statusId)])
accountIds: state.getIn(['user_lists', 'reblogged_by', Number(props.params.statusId)]),
});
class Reblogs extends ImmutablePureComponent {
@ -19,7 +19,7 @@ class Reblogs extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list
accountIds: ImmutablePropTypes.list,
};
componentWillMount () {

View file

@ -10,7 +10,7 @@ class StatusCheckBox extends React.PureComponent {
status: ImmutablePropTypes.map.isRequired,
checked: PropTypes.bool,
onToggle: PropTypes.func.isRequired,
disabled: PropTypes.bool
disabled: PropTypes.bool,
};
render () {

View file

@ -5,14 +5,14 @@ import Immutable from 'immutable';
const mapStateToProps = (state, { id }) => ({
status: state.getIn(['statuses', id]),
checked: state.getIn(['reports', 'new', 'status_ids'], Immutable.Set()).includes(id)
checked: state.getIn(['reports', 'new', 'status_ids'], Immutable.Set()).includes(id),
});
const mapDispatchToProps = (dispatch, { id }) => ({
onToggle (e) {
dispatch(toggleStatusReport(id, e.target.checked));
}
},
});

View file

@ -15,7 +15,7 @@ import ColumnBackButtonSlim from '../../components/column_back_button_slim';
const messages = defineMessages({
heading: { id: 'report.heading', defaultMessage: 'New report' },
placeholder: { id: 'report.placeholder', defaultMessage: 'Additional comments' },
submit: { id: 'report.submit', defaultMessage: 'Submit' }
submit: { id: 'report.submit', defaultMessage: 'Submit' },
});
const makeMapStateToProps = () => {
@ -28,7 +28,7 @@ const makeMapStateToProps = () => {
isSubmitting: state.getIn(['reports', 'new', 'isSubmitting']),
account: getAccount(state, accountId),
comment: state.getIn(['reports', 'new', 'comment']),
statusIds: Immutable.OrderedSet(state.getIn(['timelines', 'accounts_timelines', accountId, 'items'])).union(state.getIn(['reports', 'new', 'status_ids']))
statusIds: Immutable.OrderedSet(state.getIn(['timelines', 'accounts_timelines', accountId, 'items'])).union(state.getIn(['reports', 'new', 'status_ids'])),
};
};
@ -38,7 +38,7 @@ const makeMapStateToProps = () => {
class Report extends React.PureComponent {
static contextTypes = {
router: PropTypes.object
router: PropTypes.object,
};
static propTypes = {
@ -47,7 +47,7 @@ class Report extends React.PureComponent {
statusIds: ImmutablePropTypes.orderedSet.isRequired,
comment: PropTypes.string.isRequired,
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
componentWillMount () {

View file

@ -18,7 +18,7 @@ const messages = defineMessages({
class ActionBar extends React.PureComponent {
static contextTypes = {
router: PropTypes.object
router: PropTypes.object,
};
static propTypes = {
@ -30,7 +30,7 @@ class ActionBar extends React.PureComponent {
onMention: PropTypes.func.isRequired,
onReport: PropTypes.func,
me: PropTypes.number.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
handleReplyClick = () => {

View file

@ -1,6 +1,6 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import punycode from 'punycode'
import punycode from 'punycode';
const IDNA_PREFIX = 'xn--';
@ -9,7 +9,7 @@ const decodeIDNA = domain => {
.split('.')
.map(part => part.indexOf(IDNA_PREFIX) === 0 ? punycode.decode(part.slice(IDNA_PREFIX.length)) : part)
.join('.');
}
};
const getHostname = url => {
const parser = document.createElement('a');
@ -20,7 +20,7 @@ const getHostname = url => {
class Card extends React.PureComponent {
static propTypes = {
card: ImmutablePropTypes.map
card: ImmutablePropTypes.map,
};
renderLink () {
@ -95,6 +95,7 @@ class Card extends React.PureComponent {
return null;
}
}
}
export default Card;

View file

@ -15,7 +15,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
class DetailedStatus extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object
router: PropTypes.object,
};
static propTypes = {

View file

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import Card from '../components/card';
const mapStateToProps = (state, { statusId }) => ({
card: state.getIn(['cards', statusId], null)
card: state.getIn(['cards', statusId], null),
});
export default connect(mapStateToProps)(Card);

View file

@ -13,30 +13,30 @@ import {
favourite,
unfavourite,
reblog,
unreblog
unreblog,
} from '../../actions/interactions';
import {
replyCompose,
mentionCompose
mentionCompose,
} from '../../actions/compose';
import { deleteStatus } from '../../actions/statuses';
import { initReport } from '../../actions/reports';
import {
makeGetStatus,
getStatusAncestors,
getStatusDescendants
getStatusDescendants,
} from '../../selectors';
import { ScrollContainer } from 'react-router-scroll';
import ColumnBackButton from '../../components/column_back_button';
import StatusContainer from '../../containers/status_container';
import { openModal } from '../../actions/modal';
import { isMobile } from '../../is_mobile'
import { isMobile } from '../../is_mobile';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' }
deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
});
const makeMapStateToProps = () => {
@ -48,7 +48,7 @@ const makeMapStateToProps = () => {
descendantsIds: state.getIn(['timelines', 'descendants', Number(props.params.statusId)]),
me: state.getIn(['meta', 'me']),
boostModal: state.getIn(['meta', 'boost_modal']),
autoPlayGif: state.getIn(['meta', 'auto_play_gif'])
autoPlayGif: state.getIn(['meta', 'auto_play_gif']),
});
return mapStateToProps;
@ -57,7 +57,7 @@ const makeMapStateToProps = () => {
class Status extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object
router: PropTypes.object,
};
static propTypes = {
@ -69,7 +69,7 @@ class Status extends ImmutablePureComponent {
me: PropTypes.number,
boostModal: PropTypes.bool,
autoPlayGif: PropTypes.bool,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
componentWillMount () {
@ -116,7 +116,7 @@ class Status extends ImmutablePureComponent {
dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.deleteMessage),
confirm: intl.formatMessage(messages.deleteConfirm),
onConfirm: () => dispatch(deleteStatus(status.get('id')))
onConfirm: () => dispatch(deleteStatus(status.get('id'))),
}));
}

View file

@ -11,20 +11,20 @@ import DisplayName from '../../../components/display_name';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
reblog: { id: 'status.reblog', defaultMessage: 'Boost' }
reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
});
class BoostModal extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object
router: PropTypes.object,
};
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
onReblog: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
constructor (props, context) {

View file

@ -37,7 +37,7 @@ class Column extends React.PureComponent {
icon: PropTypes.string,
children: PropTypes.node,
active: PropTypes.bool,
hideHeadingOnMobile: PropTypes.bool
hideHeadingOnMobile: PropTypes.bool,
};
handleHeaderClick = () => {
@ -61,11 +61,11 @@ class Column extends React.PureComponent {
render () {
const { heading, icon, children, active, hideHeadingOnMobile } = this.props;
let columnHeaderId = null
let columnHeaderId = null;
let header = '';
if (heading) {
columnHeaderId = heading.replace(/ /g, '-')
columnHeaderId = heading.replace(/ /g, '-');
header = <ColumnHeader icon={icon} active={active} type={heading} onClick={this.handleHeaderClick} hideOnMobile={hideHeadingOnMobile} columnHeaderId={columnHeaderId}/>;
}
return (

View file

@ -1,5 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types'
import PropTypes from 'prop-types';
class ColumnHeader extends React.PureComponent {
@ -9,7 +9,7 @@ class ColumnHeader extends React.PureComponent {
active: PropTypes.bool,
onClick: PropTypes.func,
hideOnMobile: PropTypes.bool,
columnHeaderId: PropTypes.string
columnHeaderId: PropTypes.string,
};
handleClick = () => {

View file

@ -26,7 +26,7 @@ ColumnLink.propTypes = {
to: PropTypes.string,
href: PropTypes.string,
method: PropTypes.string,
hideOnMobile: PropTypes.bool
hideOnMobile: PropTypes.bool,
};
export default ColumnLink;

View file

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
class ColumnsArea extends React.PureComponent {
static propTypes = {
children: PropTypes.node
children: PropTypes.node,
};
render () {

View file

@ -10,7 +10,7 @@ class ConfirmationModal extends React.PureComponent {
confirm: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
onConfirm: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
handleClick = () => {

View file

@ -9,7 +9,7 @@ import IconButton from '../../../components/icon_button';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' }
close: { id: 'lightbox.close', defaultMessage: 'Close' },
});
class MediaModal extends ImmutablePureComponent {
@ -18,11 +18,11 @@ class MediaModal extends ImmutablePureComponent {
media: ImmutablePropTypes.list.isRequired,
index: PropTypes.number.isRequired,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
state = {
index: null
index: null,
};
handleNextClick = () => {

View file

@ -13,7 +13,7 @@ const MODAL_COMPONENTS = {
'ONBOARDING': OnboardingModal,
'VIDEO': VideoModal,
'BOOST': BoostModal,
'CONFIRM': ConfirmationModal
'CONFIRM': ConfirmationModal,
};
class ModalRoot extends React.PureComponent {
@ -21,7 +21,7 @@ class ModalRoot extends React.PureComponent {
static propTypes = {
type: PropTypes.string,
props: PropTypes.object,
onClose: PropTypes.func.isRequired
onClose: PropTypes.func.isRequired,
};
handleKeyUp = (e) => {
@ -56,7 +56,7 @@ class ModalRoot extends React.PureComponent {
items.push({
key: type,
data: { type, props },
style: { opacity: spring(1), scale: spring(1, { stiffness: 120, damping: 14 }) }
style: { opacity: spring(1), scale: spring(1, { stiffness: 120, damping: 14 }) },
});
}

View file

@ -18,7 +18,7 @@ const messages = defineMessages({
home_title: { id: 'column.home', defaultMessage: 'Home' },
notifications_title: { id: 'column.notifications', defaultMessage: 'Notifications' },
local_title: { id: 'column.community', defaultMessage: 'Local timeline' },
federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' }
federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' },
});
const PageOne = ({ acct, domain }) => (
@ -37,7 +37,7 @@ const PageOne = ({ acct, domain }) => (
PageOne.propTypes = {
acct: PropTypes.string.isRequired,
domain: PropTypes.string.isRequired
domain: PropTypes.string.isRequired,
};
const PageTwo = ({ me }) => (
@ -93,7 +93,7 @@ const PageThree = ({ me, domain }) => (
PageThree.propTypes = {
me: ImmutablePropTypes.map.isRequired,
domain: PropTypes.string.isRequired
domain: PropTypes.string.isRequired,
};
const PageFour = ({ domain, intl }) => (
@ -128,7 +128,7 @@ const PageFour = ({ domain, intl }) => (
PageFour.propTypes = {
domain: PropTypes.string.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
const PageSix = ({ admin, domain }) => {
@ -157,13 +157,13 @@ const PageSix = ({ admin, domain }) => {
PageSix.propTypes = {
admin: ImmutablePropTypes.map,
domain: PropTypes.string.isRequired
domain: PropTypes.string.isRequired,
};
const mapStateToProps = state => ({
me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]),
domain: state.getIn(['meta', 'domain'])
domain: state.getIn(['meta', 'domain']),
});
class OnboardingModal extends React.PureComponent {
@ -173,11 +173,11 @@ class OnboardingModal extends React.PureComponent {
intl: PropTypes.object.isRequired,
me: ImmutablePropTypes.map.isRequired,
domain: PropTypes.string.isRequired,
admin: ImmutablePropTypes.map
admin: ImmutablePropTypes.map,
};
state = {
currentIndex: 0
currentIndex: 0,
};
handleSkip = (e) => {
@ -210,7 +210,7 @@ class OnboardingModal extends React.PureComponent {
<PageTwo me={me} />,
<PageThree me={me} domain={domain} />,
<PageFour domain={domain} intl={intl} />,
<PageSix admin={admin} domain={domain} />
<PageSix admin={admin} domain={domain} />,
];
const { currentIndex } = this.state;
@ -226,7 +226,7 @@ class OnboardingModal extends React.PureComponent {
const styles = pages.map((page, i) => ({
key: `page-${i}`,
style: { opacity: spring(i === currentIndex ? 1 : 0) }
style: { opacity: spring(i === currentIndex ? 1 : 0) },
}));
return (

View file

@ -8,14 +8,14 @@ class UploadArea extends React.PureComponent {
static propTypes = {
active: PropTypes.bool,
onClose: PropTypes.func
onClose: PropTypes.func,
};
handleKeyUp = (e) => {
e.preventDefault();
e.stopPropagation();
const keyCode = e.keyCode
const keyCode = e.keyCode;
if (this.props.active) {
switch(keyCode) {
case 27:

View file

@ -8,7 +8,7 @@ import IconButton from '../../../components/icon_button';
import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' }
close: { id: 'lightbox.close', defaultMessage: 'Close' },
});
class VideoModal extends ImmutablePureComponent {
@ -17,7 +17,7 @@ class VideoModal extends ImmutablePureComponent {
media: ImmutablePropTypes.map.isRequired,
time: PropTypes.number,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
intl: PropTypes.object.isRequired,
};
render () {

View file

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import LoadingBar from 'react-redux-loading-bar';
const mapStateToProps = (state) => ({
loading: state.get('loadingBar')
loading: state.get('loadingBar'),
});
export default connect(mapStateToProps)(LoadingBar.WrappedComponent);

View file

@ -4,7 +4,7 @@ import ModalRoot from '../components/modal_root';
const mapStateToProps = state => ({
type: state.get('modal').modalType,
props: state.get('modal').modalProps
props: state.get('modal').modalProps,
});
const mapDispatchToProps = dispatch => ({

View file

@ -2,19 +2,19 @@ import { connect } from 'react-redux';
import { NotificationStack } from 'react-notification';
import {
dismissAlert,
clearAlerts
clearAlerts,
} from '../../../actions/alerts';
import { getAlerts } from '../../../selectors';
const mapStateToProps = (state, props) => ({
notifications: getAlerts(state)
notifications: getAlerts(state),
});
const mapDispatchToProps = (dispatch) => {
return {
onDismiss: alert => {
dispatch(dismissAlert(alert));
}
},
};
};

View file

@ -9,7 +9,7 @@ const makeGetStatusIds = () => createSelector([
(state, { type }) => state.getIn(['settings', type], Immutable.Map()),
(state, { type }) => state.getIn(['timelines', type, 'items'], Immutable.List()),
(state) => state.get('statuses'),
(state) => state.getIn(['meta', 'me'])
(state) => state.getIn(['meta', 'me']),
], (columnSettings, statusIds, statuses, me) => statusIds.filter(id => {
const statusForId = statuses.get(id);
let showStatus = true;
@ -45,7 +45,7 @@ const makeMapStateToProps = () => {
statusIds: getStatusIds(state, props),
isLoading: state.getIn(['timelines', props.type, 'isLoading'], true),
isUnread: state.getIn(['timelines', props.type, 'unread']) > 0,
hasMore: !!state.getIn(['timelines', props.type, 'next'])
hasMore: !!state.getIn(['timelines', props.type, 'next']),
});
return mapStateToProps;
@ -64,7 +64,7 @@ const mapDispatchToProps = (dispatch, { type, id }) => ({
onScroll: debounce(() => {
dispatch(scrollTopTimeline(type, false));
}, 100)
}, 100),
});

View file

@ -22,12 +22,12 @@ class UI extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
children: PropTypes.node
children: PropTypes.node,
};
state = {
width: window.innerWidth,
draggingOver: false
draggingOver: false,
};
handleResize = () => {