From 141b0e6bfa0d382c580e43c4c5dd63848b47ed70 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 14 Apr 2020 15:45:38 -0500 Subject: [PATCH] Fix most linter errors --- .eslintrc.js | 3 +- app/gabsocial/actions/auth.js | 2 +- app/gabsocial/actions/me.js | 5 +- app/gabsocial/actions/notifications.js | 5 +- app/gabsocial/actions/patron.js | 2 - app/gabsocial/actions/statuses.js | 3 +- app/gabsocial/actions/store.js | 1 - app/gabsocial/actions/timelines.js | 4 +- app/gabsocial/components/account.js | 1 - app/gabsocial/components/column_header.js | 2 +- app/gabsocial/components/display_name.js | 4 +- .../components/home_column_header.js | 2 +- app/gabsocial/components/icon.js | 2 +- app/gabsocial/components/icon_with_badge.js | 1 - app/gabsocial/components/media_gallery.js | 15 +- app/gabsocial/components/modal_root.js | 6 +- app/gabsocial/components/scrollable_list.js | 1 - app/gabsocial/components/status_action_bar.js | 2 +- app/gabsocial/components/status_content.js | 4 +- .../timeline_queue_button_header.js | 2 +- .../components/verification_badge.js | 1 - app/gabsocial/containers/gabsocial.js | 4 +- .../features/account/components/header.js | 20 +- .../features/account_gallery/index.js | 12 +- .../account_timeline/components/header.js | 2 - .../features/account_timeline/index.js | 8 +- .../features/community_timeline/index.js | 10 +- .../features/compose/components/action_bar.js | 3 +- .../compose/components/compose_form.js | 2 +- .../compose/components/search_results.js | 4 +- .../features/favourited_statuses/index.js | 3 +- app/gabsocial/features/followers/index.js | 11 +- app/gabsocial/features/following/index.js | 11 +- app/gabsocial/features/groups/create/index.js | 137 +++++++------ app/gabsocial/features/groups/edit/index.js | 186 +++++++++--------- app/gabsocial/features/groups/index/card.js | 4 +- app/gabsocial/features/groups/index/index.js | 104 +++++----- .../features/groups/members/index.js | 80 ++++---- .../features/groups/removed_accounts/index.js | 92 ++++----- .../groups/timeline/components/header.js | 98 ++++----- .../groups/timeline/components/panel.js | 1 + .../features/groups/timeline/index.js | 138 ++++++------- app/gabsocial/features/landing_page/index.js | 2 +- app/gabsocial/features/list_adder/index.js | 4 +- .../list_editor/components/edit_list_form.js | 2 - app/gabsocial/features/list_editor/index.js | 3 +- .../lists/components/new_list_form.js | 1 - .../features/pinned_statuses/index.js | 2 +- .../features/public_timeline/index.js | 10 +- .../features/search/components/header.js | 1 - .../status/components/detailed_status.js | 2 +- app/gabsocial/features/status/index.js | 1 - .../ui/components/__tests__/column-test.js | 4 +- .../features/ui/components/columns_area.js | 13 +- .../features/ui/components/explanation_box.js | 3 - .../features/ui/components/funding_panel.js | 4 +- .../ui/components/profile_info_panel.js | 2 - .../features/ui/components/promo_panel.js | 3 - .../features/ui/components/sign_up_panel.js | 1 - .../features/ui/components/tabs_bar.js | 2 +- .../features/ui/components/trends_panel.js | 1 - .../ui/components/unauthorized_modal.js | 4 +- .../ui/components/who_to_follow_panel.js | 1 - app/gabsocial/features/ui/index.js | 36 ++-- .../features/ui/util/react_router_helpers.js | 2 +- app/gabsocial/pages/home_page.js | 3 +- app/gabsocial/pages/profile_page.js | 9 +- app/gabsocial/reducers/auth.js | 2 +- app/gabsocial/reducers/me.js | 2 +- app/gabsocial/utils/numbers.js | 2 +- app/packs/admin.js | 8 +- app/packs/public.js | 4 +- package.json | 2 +- webpack/development.js | 3 +- webpack/production.js | 2 +- yarn.lock | 159 +++++++++++---- 76 files changed, 651 insertions(+), 647 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4f740f1cc..86f4e296a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -87,7 +87,7 @@ module.exports = { 'error', { vars: 'all', - args: 'after-used', + args: 'none', ignoreRestSiblings: true, }, ], @@ -183,6 +183,7 @@ module.exports = { 'always', { js: 'never', + mjs: 'ignorePackages', }, ], 'import/newline-after-import': 'error', diff --git a/app/gabsocial/actions/auth.js b/app/gabsocial/actions/auth.js index 3e3745f55..3d1695aaa 100644 --- a/app/gabsocial/actions/auth.js +++ b/app/gabsocial/actions/auth.js @@ -9,7 +9,7 @@ export const AUTH_LOGGED_OUT = 'AUTH_LOGGED_OUT'; export function createAuthApp() { return (dispatch, getState) => { const appToken = getState().getIn(['auth', 'app', 'access_token']); - if (appToken) return; // Skip for now, FIXME: call verify_credentials + if (appToken) return new Promise(_ => _()); // Skip for now, FIXME: call verify_credentials return api(getState).post('/api/v1/apps', { // TODO: Add commit hash to client_name client_name: `SoapboxFE_${(new Date()).toISOString()}`, diff --git a/app/gabsocial/actions/me.js b/app/gabsocial/actions/me.js index d4a4b1cab..407b46817 100644 --- a/app/gabsocial/actions/me.js +++ b/app/gabsocial/actions/me.js @@ -9,7 +9,10 @@ export const ME_FETCH_SKIP = 'ME_FETCH_SKIP'; export function fetchMe() { return (dispatch, getState) => { const accessToken = getState().getIn(['auth', 'user', 'access_token']); - if (!accessToken) return dispatch({ type: ME_FETCH_SKIP }); + if (!accessToken) { + dispatch({ type: ME_FETCH_SKIP }); + return; + }; dispatch(fetchMeRequest()); api(getState).get('/api/v1/accounts/verify_credentials').then(response => { dispatch(fetchMeSuccess(response.data)); diff --git a/app/gabsocial/actions/notifications.js b/app/gabsocial/actions/notifications.js index bc30b7cab..fa0964ac7 100644 --- a/app/gabsocial/actions/notifications.js +++ b/app/gabsocial/actions/notifications.js @@ -126,7 +126,7 @@ export function dequeueNotifications() { const queuedNotifications = getState().getIn(['notifications', 'queuedNotifications'], ImmutableList()); const totalQueuedNotificationsCount = getState().getIn(['notifications', 'totalQueuedNotificationsCount'], 0); - if (totalQueuedNotificationsCount == 0) { + if (totalQueuedNotificationsCount === 0) { return; } else if (totalQueuedNotificationsCount > 0 && totalQueuedNotificationsCount <= MAX_QUEUED_NOTIFICATIONS) { queuedNotifications.forEach(block => { @@ -264,6 +264,9 @@ export function markReadNotifications() { type: NOTIFICATIONS_MARK_READ, notification: top_notification, }); + }).catch(e => { + console.error(e); + console.error('Could not mark notifications read.'); }); } }; diff --git a/app/gabsocial/actions/patron.js b/app/gabsocial/actions/patron.js index 7e946913b..6b4885c9a 100644 --- a/app/gabsocial/actions/patron.js +++ b/app/gabsocial/actions/patron.js @@ -7,8 +7,6 @@ export function fetchFunding() { return (dispatch, getState) => { api(getState).get('/patron/v1/funding').then(response => { dispatch(importFetchedFunding(response.data)); - }).then(() => { - dispatch(fetchFundingSuccess()); }).catch(error => { dispatch(fetchFundingFail(error)); }); diff --git a/app/gabsocial/actions/statuses.js b/app/gabsocial/actions/statuses.js index d73e1724b..acbbea1f4 100644 --- a/app/gabsocial/actions/statuses.js +++ b/app/gabsocial/actions/statuses.js @@ -3,8 +3,7 @@ import openDB from '../storage/db'; import { evictStatus } from '../storage/modifier'; import { deleteFromTimelines } from './timelines'; import { importFetchedStatus, importFetchedStatuses, importAccount, importStatus } from './importer'; -import { ensureComposeIsVisible } from './compose'; -import { openModal, closeModal } from './modal'; +import { openModal } from './modal'; export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST'; export const STATUS_FETCH_SUCCESS = 'STATUS_FETCH_SUCCESS'; diff --git a/app/gabsocial/actions/store.js b/app/gabsocial/actions/store.js index 42c2c5817..87e495b99 100644 --- a/app/gabsocial/actions/store.js +++ b/app/gabsocial/actions/store.js @@ -1,6 +1,5 @@ import { Iterable, fromJS } from 'immutable'; import { hydrateCompose } from './compose'; -import { importFetchedAccounts } from './importer'; export const STORE_HYDRATE = 'STORE_HYDRATE'; export const STORE_HYDRATE_LAZY = 'STORE_HYDRATE_LAZY'; diff --git a/app/gabsocial/actions/timelines.js b/app/gabsocial/actions/timelines.js index c7ce451fc..f1213c301 100644 --- a/app/gabsocial/actions/timelines.js +++ b/app/gabsocial/actions/timelines.js @@ -1,6 +1,6 @@ import { importFetchedStatus, importFetchedStatuses } from './importer'; import api, { getLinks } from '../api'; -import { Map as ImmutableMap, List as ImmutableList, toJS } from 'immutable'; +import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; export const TIMELINE_DELETE = 'TIMELINE_DELETE'; @@ -55,7 +55,7 @@ export function dequeueTimeline(timeline, expandFunc, optionalExpandArgs) { let shouldDispatchDequeue = true; - if (totalQueuedItemsCount == 0) { + if (totalQueuedItemsCount === 0) { return; } else if (totalQueuedItemsCount > 0 && totalQueuedItemsCount <= MAX_QUEUED_ITEMS) { queuedItems.forEach(status => { diff --git a/app/gabsocial/components/account.js b/app/gabsocial/components/account.js index d0c5f0fc6..99713ad32 100644 --- a/app/gabsocial/components/account.js +++ b/app/gabsocial/components/account.js @@ -84,7 +84,6 @@ class Account extends ImmutablePureComponent { } let buttons; - let reciprocal_follow_message; let followed_by; if (onActionClick && actionIcon) { diff --git a/app/gabsocial/components/column_header.js b/app/gabsocial/components/column_header.js index e7871e164..6445e0a79 100644 --- a/app/gabsocial/components/column_header.js +++ b/app/gabsocial/components/column_header.js @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; +import { injectIntl, defineMessages } from 'react-intl'; import Icon from 'gabsocial/components/icon'; const messages = defineMessages({ diff --git a/app/gabsocial/components/display_name.js b/app/gabsocial/components/display_name.js index 62a9e844f..9894b6d4c 100644 --- a/app/gabsocial/components/display_name.js +++ b/app/gabsocial/components/display_name.js @@ -1,6 +1,5 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; import VerificationBadge from './verification_badge'; import { acctFull } from '../utils/accounts'; @@ -9,11 +8,10 @@ export default class DisplayName extends React.PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, others: ImmutablePropTypes.list, - localDomain: PropTypes.string, }; render () { - const { others, localDomain } = this.props; + const { others } = this.props; let displayName, suffix, account; diff --git a/app/gabsocial/components/home_column_header.js b/app/gabsocial/components/home_column_header.js index 5927d314e..c7ab71a1a 100644 --- a/app/gabsocial/components/home_column_header.js +++ b/app/gabsocial/components/home_column_header.js @@ -5,7 +5,7 @@ import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import classNames from 'classnames'; -import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; +import { injectIntl, defineMessages } from 'react-intl'; import { Link } from 'react-router-dom'; import Icon from 'gabsocial/components/icon'; import { fetchLists } from 'gabsocial/actions/lists'; diff --git a/app/gabsocial/components/icon.js b/app/gabsocial/components/icon.js index 08b773be8..649b727eb 100644 --- a/app/gabsocial/components/icon.js +++ b/app/gabsocial/components/icon.js @@ -16,7 +16,7 @@ export default class Icon extends React.PureComponent { // tag. There is a common adblocker rule which hides elements with // alt='retweet' unless the domain is twitter.com. This should // change what screenreaders call it as well. - var alt_id = (id == 'retweet') ? 'repost' : id; + var alt_id = (id === 'retweet') ? 'repost' : id; return ( ); diff --git a/app/gabsocial/components/icon_with_badge.js b/app/gabsocial/components/icon_with_badge.js index f9688c22e..7b2657f13 100644 --- a/app/gabsocial/components/icon_with_badge.js +++ b/app/gabsocial/components/icon_with_badge.js @@ -1,6 +1,5 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Icon from 'gabsocial/components/icon'; import { shortNumberFormat } from 'gabsocial/utils/numbers'; const IconWithBadge = ({ id, count, className }) => { diff --git a/app/gabsocial/components/media_gallery.js b/app/gabsocial/components/media_gallery.js index 48a4f0ee8..8244c2eff 100644 --- a/app/gabsocial/components/media_gallery.js +++ b/app/gabsocial/components/media_gallery.js @@ -108,9 +108,7 @@ class Item extends React.PureComponent { } render () { - const { attachment, index, size, standalone, displayWidth, visible, dimensions } = this.props; - - const ar = attachment.getIn(['meta', 'small', 'aspect']); + const { attachment, standalone, displayWidth, visible, dimensions } = this.props; let width = 100; let height = '100%'; @@ -285,14 +283,11 @@ class MediaGallery extends React.PureComponent { const style = {}; const size = media.take(4).size; - const standard169 = width / (16 / 9); - const standard169_percent = 100 / (16 / 9); - const standard169_px = `${standard169}px`; const panoSize = Math.floor(width / maximumAspectRatio); const panoSize_px = `${Math.floor(width / maximumAspectRatio)}px`; let itemsDimensions = []; - if (size == 1 && width) { + if (size === 1 && width) { const aspectRatio = media.getIn([0, 'meta', 'small', 'aspect']); if (isPanoramic(aspectRatio)) { @@ -308,7 +303,7 @@ class MediaGallery extends React.PureComponent { const ar3 = media.getIn([2, 'meta', 'small', 'aspect']); const ar4 = media.getIn([3, 'meta', 'small', 'aspect']); - if (size == 2) { + if (size === 2) { if (isPortrait(ar1) && isPortrait(ar2)) { style.height = width - (width / maximumAspectRatio); } else if (isPanoramic(ar1) && isPanoramic(ar2)) { @@ -358,7 +353,7 @@ class MediaGallery extends React.PureComponent { { w: 50, h: '100%', l: '2px' }, ]; } - } else if (size == 3) { + } else if (size === 3) { if (isPanoramic(ar1) && isPanoramic(ar2) && isPanoramic(ar3)) { style.height = panoSize * 3; } else if (isPortrait(ar1) && isPortrait(ar2) && isPortrait(ar3)) { @@ -427,7 +422,7 @@ class MediaGallery extends React.PureComponent { { w: 100, h: '50%', t: '2px' }, ]; } - } else if (size == 4) { + } else if (size === 4) { if ( (isPortrait(ar1) && isPortrait(ar2) && isPortrait(ar3) && isPortrait(ar4)) || (isPortrait(ar1) && isPortrait(ar2) && isPortrait(ar3) && isNonConformingRatio(ar4)) || diff --git a/app/gabsocial/components/modal_root.js b/app/gabsocial/components/modal_root.js index 59333bc08..392e99785 100644 --- a/app/gabsocial/components/modal_root.js +++ b/app/gabsocial/components/modal_root.js @@ -48,9 +48,9 @@ class ModalRoot extends React.PureComponent { } handleOnClose = () => { - const { onOpenModal, composeText, onClose, intl, type, onCancelReplyCompose } = this.props; + const { onOpenModal, composeText, intl, type, onCancelReplyCompose } = this.props; - if (composeText && type == 'COMPOSE') { + if (composeText && type === 'COMPOSE') { onOpenModal('CONFIRM', { message: , confirm: intl.formatMessage(messages.confirm), @@ -117,7 +117,7 @@ class ModalRoot extends React.PureComponent { return (
-
this.handleOnClose()} /> +
{children}
diff --git a/app/gabsocial/components/scrollable_list.js b/app/gabsocial/components/scrollable_list.js index c526f5f7a..24398f198 100644 --- a/app/gabsocial/components/scrollable_list.js +++ b/app/gabsocial/components/scrollable_list.js @@ -5,7 +5,6 @@ import LoadMore from './load_more'; import IntersectionObserverWrapper from '../features/ui/util/intersection_observer_wrapper'; import { throttle } from 'lodash'; import { List as ImmutableList } from 'immutable'; -import classNames from 'classnames'; import LoadingIndicator from './loading_indicator'; const MOUSE_IDLE_DELAY = 300; diff --git a/app/gabsocial/components/status_action_bar.js b/app/gabsocial/components/status_action_bar.js index e77946b25..2310b37dd 100644 --- a/app/gabsocial/components/status_action_bar.js +++ b/app/gabsocial/components/status_action_bar.js @@ -245,7 +245,7 @@ class StatusActionBar extends ImmutablePureComponent { } render () { - const { status, intl, withDismiss } = this.props; + const { status, intl } = this.props; const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); diff --git a/app/gabsocial/components/status_content.js b/app/gabsocial/components/status_content.js index 92a9ce6d5..734424c39 100644 --- a/app/gabsocial/components/status_content.js +++ b/app/gabsocial/components/status_content.js @@ -136,7 +136,7 @@ export default class StatusContent extends React.PureComponent { } getHtmlContent = () => { - const { status, reblogContent } = this.props; + const { status } = this.props; const properContent = status.get('contentHtml'); @@ -144,7 +144,7 @@ export default class StatusContent extends React.PureComponent { } render () { - const { status, reblogContent } = this.props; + const { status } = this.props; if (status.get('content').length === 0) { return null; diff --git a/app/gabsocial/components/timeline_queue_button_header.js b/app/gabsocial/components/timeline_queue_button_header.js index 8b0f17f5e..41baf76e2 100644 --- a/app/gabsocial/components/timeline_queue_button_header.js +++ b/app/gabsocial/components/timeline_queue_button_header.js @@ -32,7 +32,7 @@ export default class TimelineQueueButtonHeader extends React.PureComponent { defaultMessage='Click to see {count} new {type}' values={{ count: shortNumberFormat(count), - type: count == 1 ? itemType : `${itemType}s`, + type: count === 1 ? itemType : `${itemType}s`, }} />} diff --git a/app/gabsocial/components/verification_badge.js b/app/gabsocial/components/verification_badge.js index 01a5fda28..5fee48a34 100644 --- a/app/gabsocial/components/verification_badge.js +++ b/app/gabsocial/components/verification_badge.js @@ -1,5 +1,4 @@ import React from 'react'; -import Icon from './icon'; const VerificationBadge = () => ( diff --git a/app/gabsocial/containers/gabsocial.js b/app/gabsocial/containers/gabsocial.js index 98a86ba09..5dba84eb0 100644 --- a/app/gabsocial/containers/gabsocial.js +++ b/app/gabsocial/containers/gabsocial.js @@ -8,7 +8,7 @@ import { INTRODUCTION_VERSION } from '../actions/onboarding'; import { Switch, BrowserRouter, Route } from 'react-router-dom'; import { ScrollContext } from 'react-router-scroll-4'; import UI from '../features/ui'; -import Introduction from '../features/introduction'; +// import Introduction from '../features/introduction'; import { fetchCustomEmojis } from '../actions/custom_emojis'; import { hydrateStore } from '../actions/store'; import { IntlProvider, addLocaleData } from 'react-intl'; @@ -52,7 +52,7 @@ class GabSocialMount extends React.PureComponent { render () { const { me } = this.props; - if (me == null) return null; + if (me === null) return null; // Disabling introduction for launch // const { showIntroduction } = this.props; diff --git a/app/gabsocial/features/account/components/header.js b/app/gabsocial/features/account/components/header.js index 979e651e3..47f52285f 100644 --- a/app/gabsocial/features/account/components/header.js +++ b/app/gabsocial/features/account/components/header.js @@ -9,7 +9,6 @@ import Button from 'gabsocial/components/button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { autoPlayGif, isStaff } from 'gabsocial/initial_state'; import classNames from 'classnames'; -import Icon from 'gabsocial/components/icon'; import Avatar from 'gabsocial/components/avatar'; import { shortNumberFormat } from 'gabsocial/utils/numbers'; import { NavLink } from 'react-router-dom'; @@ -48,15 +47,6 @@ const messages = defineMessages({ add_or_remove_from_list: { id: 'account.add_or_remove_from_list', defaultMessage: 'Add or Remove from lists' }, }); -const dateFormatOptions = { - month: 'short', - day: 'numeric', - year: 'numeric', - hour12: false, - hour: '2-digit', - minute: '2-digit', -}; - const mapStateToProps = state => { return { me: state.get('me'), @@ -108,7 +98,7 @@ class Header extends ImmutablePureComponent { }); makeMenu() { - const { account, intl, domain, me } = this.props; + const { account, intl, me } = this.props; let menu = []; @@ -180,7 +170,7 @@ class Header extends ImmutablePureComponent { } makeInfo() { - const { account, intl, me } = this.props; + const { account, me } = this.props; let info = []; @@ -224,7 +214,7 @@ class Header extends ImmutablePureComponent { }; render () { - const { account, intl, domain, username, me } = this.props; + const { account, intl, username, me } = this.props; const { isSmallScreen } = this.state; if (!account) { @@ -250,10 +240,6 @@ class Header extends ImmutablePureComponent { const actionBtn = this.getActionBtn(); const menu = this.makeMenu(); - const content = { __html: account.get('note_emojified') }; - const fields = account.get('fields'); - const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct'); - const headerImgSrc = autoPlayGif ? account.get('header') : account.get('header_static'); const headerMissing = (headerImgSrc.indexOf('/headers/original/missing.png') > -1); diff --git a/app/gabsocial/features/account_gallery/index.js b/app/gabsocial/features/account_gallery/index.js index 916332692..cdceb7773 100644 --- a/app/gabsocial/features/account_gallery/index.js +++ b/app/gabsocial/features/account_gallery/index.js @@ -21,14 +21,14 @@ import { FormattedMessage } from 'react-intl'; const mapStateToProps = (state, { params: { username }, withReplies = false }) => { const me = state.get('me'); const accounts = state.getIn(['accounts']); - const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase()); + const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase()); let accountId = -1; let accountUsername = username; if (accountFetchError) { accountId = null; } else { - let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); + let account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase()); accountId = account ? account.getIn(['id'], null) : -1; accountUsername = account ? account.getIn(['acct'], '') : ''; } @@ -36,7 +36,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) = const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false); const isLocked = state.getIn(['accounts', accountId, 'locked'], false); const isFollowing = state.getIn(['relationships', accountId, 'following'], false); - const unavailable = (me == accountId) ? false : (isBlocked || (isLocked && !isFollowing)); + const unavailable = (me === accountId) ? false : (isBlocked || (isLocked && !isFollowing)); return { accountId, @@ -89,7 +89,7 @@ class AccountGallery extends ImmutablePureComponent { }; componentDidMount () { - const { params: { username }, accountId, withReplies } = this.props; + const { params: { username }, accountId } = this.props; if (accountId && accountId !== -1) { this.props.dispatch(fetchAccount(accountId)); @@ -161,7 +161,7 @@ class AccountGallery extends ImmutablePureComponent { ); } - if (accountId == -1 || (!attachments && isLoading)) { + if (accountId === -1 || (!attachments && isLoading)) { return ( @@ -210,7 +210,7 @@ class AccountGallery extends ImmutablePureComponent { ))} { - attachments.size == 0 && + attachments.size === 0 &&
diff --git a/app/gabsocial/features/account_timeline/components/header.js b/app/gabsocial/features/account_timeline/components/header.js index ed1e0900e..a5a497fa2 100644 --- a/app/gabsocial/features/account_timeline/components/header.js +++ b/app/gabsocial/features/account_timeline/components/header.js @@ -4,8 +4,6 @@ import PropTypes from 'prop-types'; import InnerHeader from '../../account/components/header'; import ImmutablePureComponent from 'react-immutable-pure-component'; import MovedNote from './moved_note'; -import { FormattedMessage } from 'react-intl'; -import { NavLink } from 'react-router-dom'; export default class Header extends ImmutablePureComponent { diff --git a/app/gabsocial/features/account_timeline/index.js b/app/gabsocial/features/account_timeline/index.js index 06a9d9e2d..5a38431ed 100644 --- a/app/gabsocial/features/account_timeline/index.js +++ b/app/gabsocial/features/account_timeline/index.js @@ -19,14 +19,14 @@ const emptyList = ImmutableList(); const mapStateToProps = (state, { params: { username }, withReplies = false }) => { const me = state.get('me'); const accounts = state.getIn(['accounts']); - const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase()); + const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase()); let accountId = -1; let accountUsername = username; if (accountFetchError) { accountId = null; } else { - let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); + let account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase()); accountId = account ? account.getIn(['id'], null) : -1; accountUsername = account ? account.getIn(['acct'], '') : ''; } @@ -36,7 +36,7 @@ const mapStateToProps = (state, { params: { username }, withReplies = false }) = const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false); const isLocked = state.getIn(['accounts', accountId, 'locked'], false); const isFollowing = state.getIn(['relationships', accountId, 'following'], false); - const unavailable = (me == accountId) ? false : (isBlocked || (isLocked && !isFollowing)); + const unavailable = (me === accountId) ? false : (isBlocked || (isLocked && !isFollowing)); return { accountId, @@ -114,7 +114,7 @@ class AccountTimeline extends ImmutablePureComponent { ); } - if (accountId == -1 || (!statusIds && isLoading)) { + if (accountId === -1 || (!statusIds && isLoading)) { return ( diff --git a/app/gabsocial/features/community_timeline/index.js b/app/gabsocial/features/community_timeline/index.js index ae24116e2..aff0d903d 100644 --- a/app/gabsocial/features/community_timeline/index.js +++ b/app/gabsocial/features/community_timeline/index.js @@ -6,14 +6,8 @@ import StatusListContainer from '../ui/containers/status_list_container'; import Column from '../../components/column'; import ColumnSettingsContainer from './containers/column_settings_container'; import HomeColumnHeader from '../../components/home_column_header'; -import { - expandCommunityTimeline, - expandPublicTimeline, -} from '../../actions/timelines'; -import { - connectCommunityStream, - connectPublicStream, -} from '../../actions/streaming'; +import { expandCommunityTimeline } from '../../actions/timelines'; +import { connectCommunityStream } from '../../actions/streaming'; const messages = defineMessages({ title: { id: 'column.community', defaultMessage: 'Local timeline' }, diff --git a/app/gabsocial/features/compose/components/action_bar.js b/app/gabsocial/features/compose/components/action_bar.js index 61c52e362..46880631f 100644 --- a/app/gabsocial/features/compose/components/action_bar.js +++ b/app/gabsocial/features/compose/components/action_bar.js @@ -1,7 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; import { openModal } from '../../../actions/modal'; -import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; @@ -43,7 +42,7 @@ class ActionBar extends React.PureComponent { } render () { - const { intl, onOpenHotkeys, onClickLogOut } = this.props; + const { intl, onClickLogOut } = this.props; const size = this.props.size || 16; let menu = []; diff --git a/app/gabsocial/features/compose/components/compose_form.js b/app/gabsocial/features/compose/components/compose_form.js index 9be69ceb3..ecd4d1f39 100644 --- a/app/gabsocial/features/compose/components/compose_form.js +++ b/app/gabsocial/features/compose/components/compose_form.js @@ -100,7 +100,7 @@ class ComposeForm extends ImmutablePureComponent { } handleClick = (e) => { - if (!this.form) return false; + if (!this.form) return; if (!this.form.contains(e.target)) { this.handleClickOutside(); } diff --git a/app/gabsocial/features/compose/components/search_results.js b/app/gabsocial/features/compose/components/search_results.js index 55400ad4d..b4606ea55 100644 --- a/app/gabsocial/features/compose/components/search_results.js +++ b/app/gabsocial/features/compose/components/search_results.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; +import { FormattedMessage, injectIntl } from 'react-intl'; import AccountContainer from '../../../containers/account_container'; import StatusContainer from '../../../containers/status_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -23,7 +23,7 @@ class SearchResults extends ImmutablePureComponent { } render () { - const { intl, results, dismissSuggestion } = this.props; + const { results } = this.props; const { isSmallScreen } = this.state; if (results.isEmpty() && isSmallScreen) { diff --git a/app/gabsocial/features/favourited_statuses/index.js b/app/gabsocial/features/favourited_statuses/index.js index 451f9d1a5..f8e946e42 100644 --- a/app/gabsocial/features/favourited_statuses/index.js +++ b/app/gabsocial/features/favourited_statuses/index.js @@ -4,7 +4,6 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { fetchFavouritedStatuses, expandFavouritedStatuses } from '../../actions/favourites'; import Column from '../ui/components/column'; -import ColumnHeader from '../../components/column_header'; import StatusList from '../../components/status_list'; import { injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; @@ -43,7 +42,7 @@ class Favourites extends ImmutablePureComponent { }, 300, { leading: true }) render () { - const { intl, statusIds, hasMore, isLoading, isMyAccount } = this.props; + const { statusIds, hasMore, isLoading, isMyAccount } = this.props; if (!isMyAccount) { return ( diff --git a/app/gabsocial/features/followers/index.js b/app/gabsocial/features/followers/index.js index d0d018dcf..d3db69999 100644 --- a/app/gabsocial/features/followers/index.js +++ b/app/gabsocial/features/followers/index.js @@ -20,21 +20,20 @@ import MissingIndicator from 'gabsocial/components/missing_indicator'; const mapStateToProps = (state, { params: { username }, withReplies = false }) => { const me = state.get('me'); const accounts = state.getIn(['accounts']); - const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase()); + const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase()); let accountId = -1; - let accountUsername = username; if (accountFetchError) { accountId = null; } else { - let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); + let account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase()); accountId = account ? account.getIn(['id'], null) : -1; } const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false); const isLocked = state.getIn(['accounts', accountId, 'locked'], false); const isFollowing = state.getIn(['relationships', accountId, 'following'], false); - const unavailable = (me == accountId) ? false : (isBlocked || (isLocked && !isFollowing)); + const unavailable = (me === accountId) ? false : (isBlocked || (isLocked && !isFollowing)); return { accountId, @@ -58,7 +57,7 @@ class Followers extends ImmutablePureComponent { }; componentWillMount () { - const { params: { username }, accountId, withReplies } = this.props; + const { params: { username }, accountId } = this.props; if (accountId && accountId !== -1) { this.props.dispatch(fetchAccount(accountId)); @@ -92,7 +91,7 @@ class Followers extends ImmutablePureComponent { ); } - if (accountId == -1 || (!accountIds)) { + if (accountId === -1 || (!accountIds)) { return ( diff --git a/app/gabsocial/features/following/index.js b/app/gabsocial/features/following/index.js index af15b03f6..3a767012d 100644 --- a/app/gabsocial/features/following/index.js +++ b/app/gabsocial/features/following/index.js @@ -14,27 +14,26 @@ import { import { FormattedMessage } from 'react-intl'; import AccountContainer from '../../containers/account_container'; import Column from '../ui/components/column'; -import HeaderContainer from '../account_timeline/containers/header_container'; import ScrollableList from '../../components/scrollable_list'; import MissingIndicator from 'gabsocial/components/missing_indicator'; const mapStateToProps = (state, { params: { username }, withReplies = false }) => { const me = state.get('me'); const accounts = state.getIn(['accounts']); - const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase()); + const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase()); let accountId = -1; if (accountFetchError) { accountId = null; } else { - let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); + let account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase()); accountId = account ? account.getIn(['id'], null) : -1; } const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false); const isLocked = state.getIn(['accounts', accountId, 'locked'], false); const isFollowing = state.getIn(['relationships', accountId, 'following'], false); - const unavailable = (me == accountId) ? false : (isBlocked || (isLocked && !isFollowing)); + const unavailable = (me === accountId) ? false : (isBlocked || (isLocked && !isFollowing)); return { accountId, @@ -58,7 +57,7 @@ class Following extends ImmutablePureComponent { }; componentWillMount () { - const { params: { username }, accountId, withReplies } = this.props; + const { params: { username }, accountId } = this.props; if (accountId && accountId !== -1) { this.props.dispatch(fetchAccount(accountId)); @@ -92,7 +91,7 @@ class Following extends ImmutablePureComponent { ); } - if (accountId == -1 || (!accountIds)) { + if (accountId === -1 || (!accountIds)) { return ( diff --git a/app/gabsocial/features/groups/create/index.js b/app/gabsocial/features/groups/create/index.js index 3353d43e5..26b886d44 100644 --- a/app/gabsocial/features/groups/create/index.js +++ b/app/gabsocial/features/groups/create/index.js @@ -2,7 +2,6 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { changeValue, submit, reset } from '../../../actions/group_editor'; -import Icon from '../../../components/icon'; import { defineMessages, injectIntl } from 'react-intl'; import classNames from 'classnames'; @@ -33,81 +32,81 @@ export default @connect(mapStateToProps, mapDispatchToProps) @injectIntl class Create extends React.PureComponent { - static contextTypes = { - router: PropTypes.object, - } + static contextTypes = { + router: PropTypes.object, + } - static propTypes = { - title: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, - coverImage: PropTypes.object, - disabled: PropTypes.bool, - intl: PropTypes.object.isRequired, - onTitleChange: PropTypes.func.isRequired, - onSubmit: PropTypes.func.isRequired, - }; + static propTypes = { + title: PropTypes.string.isRequired, + description: PropTypes.string.isRequired, + coverImage: PropTypes.object, + disabled: PropTypes.bool, + intl: PropTypes.object.isRequired, + onTitleChange: PropTypes.func.isRequired, + onSubmit: PropTypes.func.isRequired, + }; - componentWillMount() { - this.props.reset(); - } + componentWillMount() { + this.props.reset(); + } - handleTitleChange = e => { - this.props.onTitleChange(e.target.value); - } + handleTitleChange = e => { + this.props.onTitleChange(e.target.value); + } - handleDescriptionChange = e => { - this.props.onDescriptionChange(e.target.value); - } + handleDescriptionChange = e => { + this.props.onDescriptionChange(e.target.value); + } - handleCoverImageChange = e => { - this.props.onCoverImageChange(e.target.files[0]); - } + handleCoverImageChange = e => { + this.props.onCoverImageChange(e.target.files[0]); + } - handleSubmit = e => { - e.preventDefault(); - this.props.onSubmit(this.context.router.history); - } + handleSubmit = e => { + e.preventDefault(); + this.props.onSubmit(this.context.router.history); + } - render () { - const { title, description, coverImage, disabled, intl } = this.props; + render () { + const { title, description, coverImage, disabled, intl } = this.props; - return ( -
-
- -
-
-