Skip to content

Commit

Permalink
Remove unused variables (mastodon#3906)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts authored and Gargron committed Jun 23, 2017
1 parent 6fbb384 commit eff9416
Show file tree
Hide file tree
Showing 63 changed files with 60 additions and 182 deletions.
13 changes: 12 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
root: true

env:
browser: true
node: false
node: true
es6: true

parser: babel-eslint
Expand Down Expand Up @@ -52,8 +54,14 @@ rules:
no-mixed-spaces-and-tabs: warn
no-nested-ternary: warn
no-trailing-spaces: warn
no-undef: error
no-unreachable: error
no-unused-expressions: error
no-unused-vars:
- error
- vars: all
args: after-used
ignoreRestSiblings: true
object-curly-spacing:
- error
- always
Expand Down Expand Up @@ -81,7 +89,10 @@ rules:
- 2
react/jsx-no-bind: error
react/jsx-no-duplicate-props: error
react/jsx-no-undef: error
react/jsx-tag-spacing: error
react/jsx-uses-react: error
react/jsx-uses-vars: error
react/jsx-wrap-multilines: error
react/no-multi-comp: off
react/no-string-refs: error
Expand Down
5 changes: 2 additions & 3 deletions app/javascript/mastodon/actions/accounts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import api, { getLinks } from '../api';
import Immutable from 'immutable';

export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST';
export const ACCOUNT_FETCH_SUCCESS = 'ACCOUNT_FETCH_SUCCESS';
Expand Down Expand Up @@ -597,7 +596,7 @@ export function authorizeFollowRequest(id) {

api(getState)
.post(`/api/v1/follow_requests/${id}/authorize`)
.then(response => dispatch(authorizeFollowRequestSuccess(id)))
.then(() => dispatch(authorizeFollowRequestSuccess(id)))
.catch(error => dispatch(authorizeFollowRequestFail(id, error)));
};
};
Expand Down Expand Up @@ -631,7 +630,7 @@ export function rejectFollowRequest(id) {

api(getState)
.post(`/api/v1/follow_requests/${id}/reject`)
.then(response => dispatch(rejectFollowRequestSuccess(id)))
.then(() => dispatch(rejectFollowRequestSuccess(id)))
.catch(error => dispatch(rejectFollowRequestFail(id, error)));
};
};
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/mastodon/actions/domain_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function blockDomain(domain, accountId) {
return (dispatch, getState) => {
dispatch(blockDomainRequest(domain));

api(getState).post('/api/v1/domain_blocks', { domain }).then(response => {
api(getState).post('/api/v1/domain_blocks', { domain }).then(() => {
dispatch(blockDomainSuccess(domain, accountId));
}).catch(err => {
dispatch(blockDomainFail(domain, err));
Expand Down Expand Up @@ -51,7 +51,7 @@ export function unblockDomain(domain, accountId) {
return (dispatch, getState) => {
dispatch(unblockDomainRequest(domain));

api(getState).delete('/api/v1/domain_blocks', { params: { domain } }).then(response => {
api(getState).delete('/api/v1/domain_blocks', { params: { domain } }).then(() => {
dispatch(unblockDomainSuccess(domain, accountId));
}).catch(err => {
dispatch(unblockDomainFail(domain, err));
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/actions/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const NOTIFICATIONS_EXPAND_FAIL = 'NOTIFICATIONS_EXPAND_FAIL';
export const NOTIFICATIONS_CLEAR = 'NOTIFICATIONS_CLEAR';
export const NOTIFICATIONS_SCROLL_TOP = 'NOTIFICATIONS_SCROLL_TOP';

const messages = defineMessages({
defineMessages({
mention: { id: 'notification.mention', defaultMessage: '{name} mentioned you' },
});

Expand Down
6 changes: 3 additions & 3 deletions app/javascript/mastodon/actions/statuses.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function deleteStatus(id) {
return (dispatch, getState) => {
dispatch(deleteStatusRequest(id));

api(getState).delete(`/api/v1/statuses/${id}`).then(response => {
api(getState).delete(`/api/v1/statuses/${id}`).then(() => {
dispatch(deleteStatusSuccess(id));
dispatch(deleteFromTimelines(id));
}).catch(error => {
Expand Down Expand Up @@ -152,7 +152,7 @@ export function muteStatus(id) {
return (dispatch, getState) => {
dispatch(muteStatusRequest(id));

api(getState).post(`/api/v1/statuses/${id}/mute`).then(response => {
api(getState).post(`/api/v1/statuses/${id}/mute`).then(() => {
dispatch(muteStatusSuccess(id));
}).catch(error => {
dispatch(muteStatusFail(id, error));
Expand Down Expand Up @@ -186,7 +186,7 @@ export function unmuteStatus(id) {
return (dispatch, getState) => {
dispatch(unmuteStatusRequest(id));

api(getState).post(`/api/v1/statuses/${id}/unmute`).then(response => {
api(getState).post(`/api/v1/statuses/${id}/unmute`).then(() => {
dispatch(unmuteStatusSuccess(id));
}).catch(error => {
dispatch(unmuteStatusFail(id, error));
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/dropdown_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DropdownMenu extends React.PureComponent {
return <li key={`sep-${i}`} className='dropdown__sep' />;
}

const { text, action, href = '#' } = item;
const { text, href = '#' } = item;

return (
<li className='dropdown__content-list-item' key={`${text}-${i}`}>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/media_gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class MediaGallery extends React.PureComponent {
visible: !this.props.sensitive,
};

handleOpen = (e) => {
handleOpen = () => {
this.setState({ visible: !this.state.visible });
}

Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/components/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import RelativeTimestamp from './relative_timestamp';
import DisplayName from './display_name';
import MediaGallery from './media_gallery';
import VideoPlayer from './video_player';
import AttachmentList from './attachment_list';
import StatusContent from './status_content';
import StatusActionBar from './status_action_bar';
import { FormattedMessage } from 'react-intl';
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/components/status_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class StatusContent extends React.PureComponent {
for (var i = 0; i < links.length; ++i) {
let link = links[i];
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url'));
let media = this.props.status.get('media_attachments').find(item => link.href === item.get('text_url') || (item.get('remote_url').length > 0 && link.href === item.get('remote_url')));

if (mention) {
link.addEventListener('click', this.onMentionClick.bind(this, mention), false);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/status_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class StatusList extends ImmutablePureComponent {
}

render () {
const { statusIds, onScrollToBottom, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, emptyMessage } = this.props;
const { statusIds, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, emptyMessage } = this.props;

let loadMore = null;
let scrollableArea = null;
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/containers/mastodon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Provider } from 'react-redux';
import PropTypes from 'prop-types';
import configureStore from '../store/configureStore';
import {
refreshTimelineSuccess,
updateTimeline,
deleteFromTimelines,
refreshHomeTimeline,
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/containers/status_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {
import { muteStatus, unmuteStatus, deleteStatus } from '../actions/statuses';
import { initReport } from '../actions/reports';
import { openModal } from '../actions/modal';
import { createSelector } from 'reselect';
import { isMobile } from '../is_mobile';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';

const messages = defineMessages({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const messages = defineMessages({
});

const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({
const mapStateToProps = state => ({
autoPlayGif: state.getIn(['meta', 'auto_play_gif']),
});

Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/features/account_gallery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { refreshAccountMediaTimeline, expandAccountMediaTimeline } from '../../a
import LoadingIndicator from '../../components/loading_indicator';
import Column from '../ui/components/column';
import ColumnBackButton from '../../components/column_back_button';
import Immutable from 'immutable';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { getAccountGallery } from '../../selectors';
import MediaItem from './components/media_item';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ColumnCollapsable from '../../../components/column_collapsable';
import SettingToggle from '../../notifications/components/setting_toggle';
import SettingText from '../../../components/setting_text';

const messages = defineMessages({
Expand All @@ -16,12 +14,11 @@ class ColumnSettings extends React.PureComponent {
static propTypes = {
settings: ImmutablePropTypes.map.isRequired,
onChange: PropTypes.func.isRequired,
onSave: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};

render () {
const { settings, onChange, onSave, intl } = this.props;
const { settings, onChange, intl } = this.props;

return (
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import ColumnSettings from '../components/column_settings';
import { changeSetting, saveSettings } from '../../../actions/settings';
import { changeSetting } from '../../../actions/settings';

const mapStateToProps = state => ({
settings: state.getIn(['settings', 'community']),
Expand All @@ -12,10 +12,6 @@ const mapDispatchToProps = dispatch => ({
dispatch(changeSetting(['community', ...key], checked));
},

onSave () {
dispatch(saveSettings());
},

});

export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from '../../actions/timelines';
import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import ColumnSettingsContainer from './containers/column_settings_container';
import createStream from '../../stream';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import ReplyIndicatorContainer from '../containers/reply_indicator_container';
import AutosuggestTextarea from '../../../components/autosuggest_textarea';
import { debounce } from 'lodash';
import UploadButtonContainer from '../containers/upload_button_container';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import Toggle from 'react-toggle';
import { defineMessages, injectIntl } from 'react-intl';
import Collapsable from '../../../components/collapsable';
import SpoilerButtonContainer from '../containers/spoiler_button_container';
import PrivacyDropdownContainer from '../containers/privacy_dropdown_container';
import SensitiveButtonContainer from '../containers/sensitive_button_container';
import EmojiPickerDropdown from './emoji_picker_dropdown';
import UploadFormContainer from '../containers/upload_form_container';
import TextIconButton from './text_icon_button';
import WarningContainer from '../containers/warning_container';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { length } from 'stringz';
Expand Down Expand Up @@ -141,7 +139,6 @@ class ComposeForm extends ImmutablePureComponent {
const text = [this.props.spoiler_text, this.props.text].join('');

let publishText = '';
let reply_to_other = false;

if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
publishText = <span className='compose-form__publish-private'><i className='fa fa-lock' /> {intl.formatMessage(messages.publish)}</span>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class EmojiPickerDropdown extends React.PureComponent {
import(/* webpackChunkName: "emojione_picker" */ 'emojione-picker').then(TheEmojiPicker => {
EmojiPicker = TheEmojiPicker.default;
this.setState({ loading: false });
}).catch(err => {
}).catch(() => {
// TODO: show the user an error?
this.setState({ loading: false });
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Avatar from '../../../components/avatar';
import IconButton from '../../../components/icon_button';
import DisplayName from '../../../components/display_name';
import Permalink from '../../../components/permalink';
import { FormattedMessage } from 'react-intl';
import Link from 'react-router-dom/Link';
import ImmutablePureComponent from 'react-immutable-pure-component';

class NavigationBar extends ImmutablePureComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class PrivacyDropdown extends React.PureComponent {
}

render () {
const { value, onChange, intl } = this.props;
const { value, intl } = this.props;
const { open } = this.state;

const options = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';

const messages = defineMessages({
placeholder: { id: 'search.placeholder', defaultMessage: 'Search' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { FormattedMessage } from 'react-intl';
import AccountContainer from '../../../containers/account_container';
import StatusContainer from '../../../containers/status_container';
import Link from 'react-router-dom/Link';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const messages = defineMessages({
});

const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({
const mapStateToProps = state => ({
acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']),
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { connect } from 'react-redux';
import NavigationBar from '../components/navigation_bar';

const mapStateToProps = (state, props) => {
const mapStateToProps = state => {
return {
account: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ReplyIndicator from '../components/reply_indicator';
const makeMapStateToProps = () => {
const getStatus = makeGetStatus();

const mapStateToProps = (state, props) => ({
const mapStateToProps = state => ({
status: getStatus(state, state.getIn(['compose', 'in_reply_to'])),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import UploadForm from '../components/upload_form';
import { undoUploadCompose } from '../../../actions/compose';

const mapStateToProps = (state, props) => ({
const mapStateToProps = state => ({
media: state.getIn(['compose', 'media_attachments']),
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { connect } from 'react-redux';
import UploadProgress from '../components/upload_progress';

const mapStateToProps = (state, props) => ({
const mapStateToProps = state => ({
active: state.getIn(['compose', 'is_uploading']),
progress: state.getIn(['compose', 'progress']),
});
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/features/compose/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import ComposeFormContainer from './containers/compose_form_container';
import UploadFormContainer from './containers/upload_form_container';
import NavigationContainer from './containers/navigation_container';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
Expand Down
Loading

0 comments on commit eff9416

Please sign in to comment.