diff --git a/.eslintrc.js b/.eslintrc.js index bce34ca61..766aae53a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -65,7 +65,9 @@ module.exports = { ], 'comma-style': ['warn', 'last'], 'space-before-function-paren': ['error', 'never'], + 'space-infix-ops': 'error', 'space-in-parens': ['error', 'never'], + 'keyword-spacing': 'error', 'consistent-return': 'error', 'dot-notation': 'error', eqeqeq: 'error', diff --git a/app/soapbox/actions/filters.js b/app/soapbox/actions/filters.js index e6af25f9c..9c351442a 100644 --- a/app/soapbox/actions/filters.js +++ b/app/soapbox/actions/filters.js @@ -67,7 +67,7 @@ export function createFilter(intl, phrase, expires_at, context, whole_word, irre export function deleteFilter(intl, id) { return (dispatch, getState) => { dispatch({ type: FILTERS_DELETE_REQUEST }); - return api(getState).delete('/api/v1/filters/'+id).then(response => { + return api(getState).delete('/api/v1/filters/' + id).then(response => { dispatch({ type: FILTERS_DELETE_SUCCESS, filter: response.data }); dispatch(snackbar.success(intl.formatMessage(messages.removed))); }).catch(error => { diff --git a/app/soapbox/actions/instance.ts b/app/soapbox/actions/instance.ts index cd99ac470..cabccdd33 100644 --- a/app/soapbox/actions/instance.ts +++ b/app/soapbox/actions/instance.ts @@ -46,7 +46,7 @@ export const fetchInstance = createAsyncThunk( dispatch(fetchNodeinfo()); } return instance; - } catch(e) { + } catch (e) { return rejectWithValue(e); } }, diff --git a/app/soapbox/actions/streaming.js b/app/soapbox/actions/streaming.js index 5f2365f18..ece6dee64 100644 --- a/app/soapbox/actions/streaming.js +++ b/app/soapbox/actions/streaming.js @@ -51,7 +51,7 @@ export function connectTimelineStream(timelineId, path, pollingRefresh = null, a }, onReceive(data) { - switch(data.event) { + switch (data.event) { case 'update': dispatch(processTimelineUpdate(timelineId, JSON.parse(data.payload), accept)); break; diff --git a/app/soapbox/components/autosuggest_input.js b/app/soapbox/components/autosuggest_input.js index af83c7774..ddf926987 100644 --- a/app/soapbox/components/autosuggest_input.js +++ b/app/soapbox/components/autosuggest_input.js @@ -108,7 +108,7 @@ export default class AutosuggestInput extends ImmutablePureComponent { return; } - switch(e.key) { + switch (e.key) { case 'Escape': if (suggestions.size === 0 || suggestionsHidden) { document.querySelector('.ui').parentElement.focus(); diff --git a/app/soapbox/components/autosuggest_textarea.js b/app/soapbox/components/autosuggest_textarea.js index 183f50a5d..03e3465da 100644 --- a/app/soapbox/components/autosuggest_textarea.js +++ b/app/soapbox/components/autosuggest_textarea.js @@ -97,7 +97,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { return; } - switch(e.key) { + switch (e.key) { case 'Escape': if (suggestions.size === 0 || suggestionsHidden) { document.querySelector('.ui').parentElement.focus(); diff --git a/app/soapbox/components/dropdown_menu.tsx b/app/soapbox/components/dropdown_menu.tsx index 18258c0f0..6cbc3e678 100644 --- a/app/soapbox/components/dropdown_menu.tsx +++ b/app/soapbox/components/dropdown_menu.tsx @@ -95,25 +95,25 @@ class DropdownMenu extends React.PureComponent { } handleButtonKeyDown: React.EventHandler = (e) => { - switch(e.key) { + switch (e.key) { case ' ': case 'Enter': this.handleMouseDown(e); @@ -321,7 +321,7 @@ class Dropdown extends React.PureComponent { } handleKeyPress: React.EventHandler> = (e) => { - switch(e.key) { + switch (e.key) { case ' ': case 'Enter': this.handleClick(e); diff --git a/app/soapbox/components/filter_bar.js b/app/soapbox/components/filter_bar.js index 49fdb58ca..003a35908 100644 --- a/app/soapbox/components/filter_bar.js +++ b/app/soapbox/components/filter_bar.js @@ -56,12 +56,12 @@ class FilterBar extends React.PureComponent { const index = items.indexOf(document.activeElement); let element = null; - switch(e.key) { + switch (e.key) { case 'ArrowRight': - element = items[index+1] || items[0]; + element = items[index + 1] || items[0]; break; case 'ArrowLeft': - element = items[index-1] || items[items.length-1]; + element = items[index - 1] || items[items.length - 1]; break; } diff --git a/app/soapbox/components/helmet.tsx b/app/soapbox/components/helmet.tsx index 5668a3eec..81383ad08 100644 --- a/app/soapbox/components/helmet.tsx +++ b/app/soapbox/components/helmet.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Helmet as ReactHelmet } from'react-helmet'; +import { Helmet as ReactHelmet } from 'react-helmet'; import { useAppSelector, useSettings } from 'soapbox/hooks'; import FaviconService from 'soapbox/utils/favicon_service'; diff --git a/app/soapbox/components/media_gallery.js b/app/soapbox/components/media_gallery.js index ffe8bc0e1..30ddbbc34 100644 --- a/app/soapbox/components/media_gallery.js +++ b/app/soapbox/components/media_gallery.js @@ -337,7 +337,7 @@ class MediaGallery extends React.PureComponent { const aspectRatio = media.getIn([0, 'meta', 'original', 'aspect']); const getHeight = () => { - if (!aspectRatio) return width*9/16; + if (!aspectRatio) return width * 9 / 16; if (isPanoramic(aspectRatio)) return Math.floor(width / maximumAspectRatio); if (isPortrait(aspectRatio)) return Math.floor(width / minimumAspectRatio); return Math.floor(width / aspectRatio); diff --git a/app/soapbox/components/sidebar_menu.tsx b/app/soapbox/components/sidebar_menu.tsx index 7924ccd33..2a0946e6e 100644 --- a/app/soapbox/components/sidebar_menu.tsx +++ b/app/soapbox/components/sidebar_menu.tsx @@ -143,7 +143,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { {logo ? ( Logo - ): ( + ) : ( - ): ( + ) : ( { - switch(e.key) { + switch (e.key) { case 'k': e.preventDefault(); e.stopPropagation(); diff --git a/app/soapbox/features/audio/visualizer.js b/app/soapbox/features/audio/visualizer.js index 5aac5755a..2ec2bfafe 100644 --- a/app/soapbox/features/audio/visualizer.js +++ b/app/soapbox/features/audio/visualizer.js @@ -40,7 +40,7 @@ export default class Visualizer { getTickPoints(count) { const coords = []; - for(let i = 0; i < count; i++) { + for (let i = 0; i < count; i++) { const rad = Math.PI * 2 * i / count; coords.push({ x: Math.cos(rad), y: -Math.sin(rad) }); } diff --git a/app/soapbox/features/auth_login/components/captcha.tsx b/app/soapbox/features/auth_login/components/captcha.tsx index dcd51209c..73acc26cc 100644 --- a/app/soapbox/features/auth_login/components/captcha.tsx +++ b/app/soapbox/features/auth_login/components/captcha.tsx @@ -30,7 +30,7 @@ const CaptchaField: React.FC = ({ onFetch = noOp, onFetchFail = noOp, onClick = noOp, - refreshInterval = 5*60*1000, // 5 minutes, Pleroma default + refreshInterval = 5 * 60 * 1000, // 5 minutes, Pleroma default idempotencyKey, }) => { const dispatch = useAppDispatch(); @@ -71,7 +71,7 @@ const CaptchaField: React.FC = ({ }; }, [idempotencyKey]); - switch(captcha.get('type')) { + switch (captcha.get('type')) { case 'native': return (
diff --git a/app/soapbox/features/chats/components/chat_box.js b/app/soapbox/features/chats/components/chat_box.js index fac4ae894..b4aee7a34 100644 --- a/app/soapbox/features/chats/components/chat_box.js +++ b/app/soapbox/features/chats/components/chat_box.js @@ -132,7 +132,7 @@ class ChatBox extends ImmutablePureComponent { onUploadProgress = (e) => { const { loaded, total } = e; - this.setState({ uploadProgress: loaded/total }); + this.setState({ uploadProgress: loaded / total }); } handleFiles = (files) => { @@ -193,7 +193,7 @@ class ChatBox extends ImmutablePureComponent {
{this.renderAttachment()} - +
{this.renderActionButton()} diff --git a/app/soapbox/features/chats/components/chat_message_list.js b/app/soapbox/features/chats/components/chat_message_list.js index 981c34314..929201b3d 100644 --- a/app/soapbox/features/chats/components/chat_message_list.js +++ b/app/soapbox/features/chats/components/chat_message_list.js @@ -314,11 +314,11 @@ class ChatMessageList extends ImmutablePureComponent { return (
{chatMessages.reduce((acc, curr, idx) => { - const lastMessage = chatMessages.get(idx-1); + const lastMessage = chatMessages.get(idx - 1); if (lastMessage) { const key = `${curr.get('id')}_divider`; - switch(timeChange(lastMessage, curr)) { + switch (timeChange(lastMessage, curr)) { case 'today': acc.push(this.renderDivider(key, intl.formatMessage(messages.today))); break; diff --git a/app/soapbox/features/compose/components/privacy_dropdown.js b/app/soapbox/features/compose/components/privacy_dropdown.js index caf6ae6c6..87c83903f 100644 --- a/app/soapbox/features/compose/components/privacy_dropdown.js +++ b/app/soapbox/features/compose/components/privacy_dropdown.js @@ -55,7 +55,7 @@ class PrivacyDropdownMenu extends React.PureComponent { }); let element = null; - switch(e.key) { + switch (e.key) { case 'Escape': this.props.onClose(); break; @@ -211,7 +211,7 @@ class PrivacyDropdown extends React.PureComponent { } handleKeyDown = e => { - switch(e.key) { + switch (e.key) { case 'Escape': this.handleClose(); break; @@ -225,7 +225,7 @@ class PrivacyDropdown extends React.PureComponent { } handleButtonKeyDown = (e) => { - switch(e.key) { + switch (e.key) { case ' ': case 'Enter': this.handleMouseDown(); diff --git a/app/soapbox/features/compose/components/upload.js b/app/soapbox/features/compose/components/upload.js index 184b6b612..a293509f9 100644 --- a/app/soapbox/features/compose/components/upload.js +++ b/app/soapbox/features/compose/components/upload.js @@ -158,7 +158,7 @@ class Upload extends ImmutablePureComponent { className={classNames('compose-form__upload-thumbnail', `${mediaType}`)} style={{ transform: `scale(${scale})`, - backgroundImage: mediaType === 'image' ? `url(${media.get('preview_url')})`: null, + backgroundImage: mediaType === 'image' ? `url(${media.get('preview_url')})` : null, backgroundPosition: `${x}% ${y}%` }} >
diff --git a/app/soapbox/features/compose/util/url_regex.ts b/app/soapbox/features/compose/util/url_regex.ts index 302519662..d42900002 100644 --- a/app/soapbox/features/compose/util/url_regex.ts +++ b/app/soapbox/features/compose/util/url_regex.ts @@ -177,8 +177,8 @@ export const urlRegex = (function() { '(?:' + '#{validGeneralUrlPathChars}*' + '(?:#{validUrlBalancedParens}#{validGeneralUrlPathChars}*)*' + - '#{validUrlPathEndingChars}'+ - ')|(?:@#{validGeneralUrlPathChars}+\/)'+ + '#{validUrlPathEndingChars}' + + ')|(?:@#{validGeneralUrlPathChars}+\/)' + ')', 'i'); regexen.validUrlQueryChars = /[a-z0-9!?\*'@\(\);:&=\+\$\/%#\[\]\-_\.,~|]/i; regexen.validUrlQueryEndingChars = /[a-z0-9_&=#\/]/i; diff --git a/app/soapbox/features/edit_profile/index.tsx b/app/soapbox/features/edit_profile/index.tsx index a8af56390..5853d2796 100644 --- a/app/soapbox/features/edit_profile/index.tsx +++ b/app/soapbox/features/edit_profile/index.tsx @@ -409,7 +409,7 @@ const EditProfile: React.FC = () => { hint={} > diff --git a/app/soapbox/features/ui/components/funding_panel.tsx b/app/soapbox/features/ui/components/funding_panel.tsx index 57c5246ef..883734bbe 100644 --- a/app/soapbox/features/ui/components/funding_panel.tsx +++ b/app/soapbox/features/ui/components/funding_panel.tsx @@ -22,7 +22,7 @@ const moneyFormat = (amount: number): string => ( currency: 'usd', notation: 'compact', }) - .format(amount/100) + .format(amount / 100) ); const FundingPanel: React.FC = () => { @@ -59,7 +59,7 @@ const FundingPanel: React.FC = () => {
{ratioText}
- +
{goalText}
diff --git a/app/soapbox/features/ui/components/media_modal.js b/app/soapbox/features/ui/components/media_modal.js index 31571cde3..c1ca65007 100644 --- a/app/soapbox/features/ui/components/media_modal.js +++ b/app/soapbox/features/ui/components/media_modal.js @@ -57,7 +57,7 @@ class MediaModal extends ImmutablePureComponent { } handleKeyDown = (e) => { - switch(e.key) { + switch (e.key) { case 'ArrowLeft': this.handlePrevClick(); e.preventDefault(); diff --git a/app/soapbox/features/ui/components/upload_area.tsx b/app/soapbox/features/ui/components/upload_area.tsx index ebdad855c..c8e155740 100644 --- a/app/soapbox/features/ui/components/upload_area.tsx +++ b/app/soapbox/features/ui/components/upload_area.tsx @@ -20,7 +20,7 @@ const UploadArea: React.FC = ({ active, onClose }) => { const keyCode = e.keyCode; if (active) { - switch(keyCode) { + switch (keyCode) { case 27: e.preventDefault(); e.stopPropagation(); diff --git a/app/soapbox/features/video/index.js b/app/soapbox/features/video/index.js index 43a7f9f17..46a039472 100644 --- a/app/soapbox/features/video/index.js +++ b/app/soapbox/features/video/index.js @@ -290,7 +290,7 @@ class Video extends React.PureComponent { handleKeyDown = e => { const frameTime = 1 / 25; - switch(e.key) { + switch (e.key) { case 'k': e.preventDefault(); e.stopPropagation(); @@ -505,7 +505,7 @@ class Video extends React.PureComponent { if (inline && containerWidth) { width = containerWidth; - const minSize = containerWidth / (16/9); + const minSize = containerWidth / (16 / 9); if (isPanoramic(aspectRatio)) { height = Math.max(Math.floor(containerWidth / maximumAspectRatio), minSize); diff --git a/app/soapbox/reducers/accounts.ts b/app/soapbox/reducers/accounts.ts index 63f479adb..e0d8a9f11 100644 --- a/app/soapbox/reducers/accounts.ts +++ b/app/soapbox/reducers/accounts.ts @@ -93,7 +93,7 @@ const addTags = ( ); tags.forEach(tag => { - switch(tag) { + switch (tag) { case 'verified': state.setIn([id, 'verified'], true); break; @@ -118,7 +118,7 @@ const removeTags = ( ); tags.forEach(tag => { - switch(tag) { + switch (tag) { case 'verified': state.setIn([id, 'verified'], false); break; @@ -243,7 +243,7 @@ const setSuggested = (state: State, accountIds: Array, isSuggested: bool }; export default function accounts(state: State = initialState, action: AnyAction): State { - switch(action.type) { + switch (action.type) { case ACCOUNT_IMPORT: return fixAccount(state, action.account); case ACCOUNTS_IMPORT: diff --git a/app/soapbox/reducers/accounts_counters.js b/app/soapbox/reducers/accounts_counters.js index 60b9e8cab..f97578851 100644 --- a/app/soapbox/reducers/accounts_counters.js +++ b/app/soapbox/reducers/accounts_counters.js @@ -36,7 +36,7 @@ const updateFollowCounters = (state, counterUpdates) => { const initialState = ImmutableMap(); export default function accountsCounters(state = initialState, action) { - switch(action.type) { + switch (action.type) { case ACCOUNT_IMPORT: return normalizeAccount(state, action.account); case ACCOUNTS_IMPORT: diff --git a/app/soapbox/reducers/accounts_meta.js b/app/soapbox/reducers/accounts_meta.js index d3668d524..b5dff359c 100644 --- a/app/soapbox/reducers/accounts_meta.js +++ b/app/soapbox/reducers/accounts_meta.js @@ -20,7 +20,7 @@ const importAccount = (state, account) => { }; export default function accounts_meta(state = initialState, action) { - switch(action.type) { + switch (action.type) { case ME_FETCH_SUCCESS: case ME_PATCH_SUCCESS: return importAccount(state, fromJS(action.me)); diff --git a/app/soapbox/reducers/admin.ts b/app/soapbox/reducers/admin.ts index 90cb10a4f..48a143595 100644 --- a/app/soapbox/reducers/admin.ts +++ b/app/soapbox/reducers/admin.ts @@ -137,7 +137,7 @@ function handleReportDiffs(state: State, reports: APIReport[]) { // hence the need for a new function. return state.withMutations(state => { reports.forEach(report => { - switch(report.state) { + switch (report.state) { case 'open': state.update('openReports', orderedSet => orderedSet.add(report.id)); break; @@ -159,7 +159,7 @@ const importConfigs = (state: State, configs: any): State => { }; export default function admin(state: State = ReducerRecord(), action: AnyAction): State { - switch(action.type) { + switch (action.type) { case ADMIN_CONFIG_FETCH_SUCCESS: case ADMIN_CONFIG_UPDATE_SUCCESS: return importConfigs(state, action.configs); diff --git a/app/soapbox/reducers/admin_log.js b/app/soapbox/reducers/admin_log.js index c194bbc04..81ee46def 100644 --- a/app/soapbox/reducers/admin_log.js +++ b/app/soapbox/reducers/admin_log.js @@ -36,7 +36,7 @@ const importItems = (state, items, total) => { }; export default function admin_log(state = ReducerRecord(), action) { - switch(action.type) { + switch (action.type) { case ADMIN_LOG_FETCH_SUCCESS: return importItems(state, action.items, action.total); default: diff --git a/app/soapbox/reducers/alerts.ts b/app/soapbox/reducers/alerts.ts index f8219d199..0971f8b77 100644 --- a/app/soapbox/reducers/alerts.ts +++ b/app/soapbox/reducers/alerts.ts @@ -40,7 +40,7 @@ const deleteAlert = (state: State, alert: PlainAlert): State => { }; export default function alerts(state: State = ImmutableList(), action: AnyAction): State { - switch(action.type) { + switch (action.type) { case ALERT_SHOW: return importAlert(state, action); case ALERT_DISMISS: diff --git a/app/soapbox/reducers/aliases.js b/app/soapbox/reducers/aliases.js index 158e91158..c76a5200b 100644 --- a/app/soapbox/reducers/aliases.js +++ b/app/soapbox/reducers/aliases.js @@ -20,7 +20,7 @@ const initialState = ImmutableMap({ }); export default function aliasesReducer(state = initialState, action) { - switch(action.type) { + switch (action.type) { case ALIASES_FETCH_SUCCESS: return state .setIn(['aliases', 'items'], action.value); diff --git a/app/soapbox/reducers/auth.js b/app/soapbox/reducers/auth.js index 24df1780e..04f7fb5a7 100644 --- a/app/soapbox/reducers/auth.js +++ b/app/soapbox/reducers/auth.js @@ -282,7 +282,7 @@ const deleteForbiddenToken = (state, error, token) => { }; const reducer = (state, action) => { - switch(action.type) { + switch (action.type) { case AUTH_APP_CREATED: return state.set('app', fromJS(action.app)); case AUTH_APP_AUTHORIZED: diff --git a/app/soapbox/reducers/backups.js b/app/soapbox/reducers/backups.js index 349b9012a..6019e99a9 100644 --- a/app/soapbox/reducers/backups.js +++ b/app/soapbox/reducers/backups.js @@ -18,7 +18,7 @@ const importBackups = (state, backups) => { }; export default function backups(state = initialState, action) { - switch(action.type) { + switch (action.type) { case BACKUPS_FETCH_SUCCESS: case BACKUPS_CREATE_SUCCESS: return importBackups(state, fromJS(action.backups)); diff --git a/app/soapbox/reducers/chat_message_lists.ts b/app/soapbox/reducers/chat_message_lists.ts index 79a595801..27d97421c 100644 --- a/app/soapbox/reducers/chat_message_lists.ts +++ b/app/soapbox/reducers/chat_message_lists.ts @@ -51,7 +51,7 @@ const replaceMessage = (state: State, chatId: string, oldId: string, newId: stri }; export default function chatMessageLists(state = initialState, action: AnyAction) { - switch(action.type) { + switch (action.type) { case CHAT_MESSAGE_SEND_REQUEST: return updateList(state, action.chatId, [action.uuid]); case CHATS_FETCH_SUCCESS: diff --git a/app/soapbox/reducers/chat_messages.ts b/app/soapbox/reducers/chat_messages.ts index d6b4f4fb9..eb62a99dc 100644 --- a/app/soapbox/reducers/chat_messages.ts +++ b/app/soapbox/reducers/chat_messages.ts @@ -37,7 +37,7 @@ const importLastMessages = (state: State, chats: APIEntities) => const initialState: State = ImmutableMap(); export default function chatMessages(state = initialState, action: AnyAction) { - switch(action.type) { + switch (action.type) { case CHAT_MESSAGE_SEND_REQUEST: return importMessage(state, fromJS({ id: action.uuid, // Make fake message to get overriden later diff --git a/app/soapbox/reducers/chats.ts b/app/soapbox/reducers/chats.ts index 956da3c39..3b5468d61 100644 --- a/app/soapbox/reducers/chats.ts +++ b/app/soapbox/reducers/chats.ts @@ -55,7 +55,7 @@ const importChats = (state: State, chats: APIEntities, next?: string) => }); export default function chats(state: State = ReducerRecord(), action: AnyAction): State { - switch(action.type) { + switch (action.type) { case CHATS_FETCH_REQUEST: case CHATS_EXPAND_REQUEST: return state.set('isLoading', true); diff --git a/app/soapbox/reducers/compose.js b/app/soapbox/reducers/compose.js index 9d8f5bb62..80ec0d719 100644 --- a/app/soapbox/reducers/compose.js +++ b/app/soapbox/reducers/compose.js @@ -283,7 +283,7 @@ const updateSetting = (state, path, value) => { }; export default function compose(state = initialState, action) { - switch(action.type) { + switch (action.type) { case COMPOSE_MOUNT: return state.set('mounted', state.get('mounted') + 1); case COMPOSE_UNMOUNT: diff --git a/app/soapbox/reducers/contexts.js b/app/soapbox/reducers/contexts.js index f8412c624..6cb3d007f 100644 --- a/app/soapbox/reducers/contexts.js +++ b/app/soapbox/reducers/contexts.js @@ -141,7 +141,7 @@ const deletePendingStatus = (state, { in_reply_to_id }, idempotencyKey) => { }; export default function replies(state = initialState, action) { - switch(action.type) { + switch (action.type) { case ACCOUNT_BLOCK_SUCCESS: case ACCOUNT_MUTE_SUCCESS: return filterContexts(state, action.relationship, action.statuses); diff --git a/app/soapbox/reducers/domain_lists.js b/app/soapbox/reducers/domain_lists.js index 8cdd3ba37..d2cfd46f8 100644 --- a/app/soapbox/reducers/domain_lists.js +++ b/app/soapbox/reducers/domain_lists.js @@ -13,7 +13,7 @@ const initialState = ImmutableMap({ }); export default function domainLists(state = initialState, action) { - switch(action.type) { + switch (action.type) { case DOMAIN_BLOCKS_FETCH_SUCCESS: return state.setIn(['blocks', 'items'], ImmutableOrderedSet(action.domains)).setIn(['blocks', 'next'], action.next); case DOMAIN_BLOCKS_EXPAND_SUCCESS: diff --git a/app/soapbox/reducers/filters.tsx b/app/soapbox/reducers/filters.tsx index 484b2b80a..bf68d0fa2 100644 --- a/app/soapbox/reducers/filters.tsx +++ b/app/soapbox/reducers/filters.tsx @@ -16,7 +16,7 @@ const importFilters = (_state: State, filters: unknown): State => { }; export default function filters(state: State = ImmutableList(), action: AnyAction): State { - switch(action.type) { + switch (action.type) { case FILTERS_FETCH_SUCCESS: return importFilters(state, action.filters); default: diff --git a/app/soapbox/reducers/group_editor.js b/app/soapbox/reducers/group_editor.js index 4086f0388..557747a14 100644 --- a/app/soapbox/reducers/group_editor.js +++ b/app/soapbox/reducers/group_editor.js @@ -22,7 +22,7 @@ const initialState = ImmutableMap({ }); export default function groupEditorReducer(state = initialState, action) { - switch(action.type) { + switch (action.type) { case GROUP_EDITOR_RESET: return initialState; case GROUP_EDITOR_SETUP: diff --git a/app/soapbox/reducers/group_lists.js b/app/soapbox/reducers/group_lists.js index c35a65bdd..790dfc99f 100644 --- a/app/soapbox/reducers/group_lists.js +++ b/app/soapbox/reducers/group_lists.js @@ -13,7 +13,7 @@ const normalizeList = (state, type, id, groups) => { }; export default function groupLists(state = initialState, action) { - switch(action.type) { + switch (action.type) { case GROUPS_FETCH_SUCCESS: return normalizeList(state, action.tab, action.id, action.groups); default: diff --git a/app/soapbox/reducers/group_relationships.js b/app/soapbox/reducers/group_relationships.js index 469b17a6b..b0f85625e 100644 --- a/app/soapbox/reducers/group_relationships.js +++ b/app/soapbox/reducers/group_relationships.js @@ -15,7 +15,7 @@ const normalizeRelationships = (state, relationships) => { const initialState = ImmutableMap(); export default function group_relationships(state = initialState, action) { - switch(action.type) { + switch (action.type) { case GROUP_JOIN_SUCCESS: case GROUP_LEAVE_SUCCESS: return normalizeRelationship(state, action.relationship); diff --git a/app/soapbox/reducers/groups.js b/app/soapbox/reducers/groups.js index 56309aace..974fbb026 100644 --- a/app/soapbox/reducers/groups.js +++ b/app/soapbox/reducers/groups.js @@ -20,7 +20,7 @@ const normalizeGroups = (state, groups) => { }; export default function groups(state = initialState, action) { - switch(action.type) { + switch (action.type) { case GROUP_FETCH_SUCCESS: case GROUP_UPDATE_SUCCESS: return normalizeGroup(state, action.group); diff --git a/app/soapbox/reducers/history.ts b/app/soapbox/reducers/history.ts index 08711dea5..be4b20817 100644 --- a/app/soapbox/reducers/history.ts +++ b/app/soapbox/reducers/history.ts @@ -16,7 +16,7 @@ type State = ImmutableMap>; const initialState: State = ImmutableMap(); export default function history(state: State = initialState, action: AnyAction) { - switch(action.type) { + switch (action.type) { case HISTORY_FETCH_REQUEST: return state.update(action.statusId, HistoryRecord(), history => history!.withMutations(map => { map.set('loading', true); diff --git a/app/soapbox/reducers/identity_proofs.js b/app/soapbox/reducers/identity_proofs.js index 64f258abe..d971ef82e 100644 --- a/app/soapbox/reducers/identity_proofs.js +++ b/app/soapbox/reducers/identity_proofs.js @@ -9,7 +9,7 @@ import { const initialState = ImmutableMap(); export default function identityProofsReducer(state = initialState, action) { - switch(action.type) { + switch (action.type) { case IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST: return state.set('isLoading', true); case IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL: diff --git a/app/soapbox/reducers/index.ts b/app/soapbox/reducers/index.ts index bcbb07139..7c7f69391 100644 --- a/app/soapbox/reducers/index.ts +++ b/app/soapbox/reducers/index.ts @@ -152,7 +152,7 @@ const logOut = (state: any = StateRecord()): ReturnType => { }; const rootReducer: typeof appReducer = (state, action) => { - switch(action.type) { + switch (action.type) { case AUTH_LOGGED_OUT: return appReducer(logOut(state), action); default: diff --git a/app/soapbox/reducers/instance.ts b/app/soapbox/reducers/instance.ts index db8ef816e..abd2a217a 100644 --- a/app/soapbox/reducers/instance.ts +++ b/app/soapbox/reducers/instance.ts @@ -111,7 +111,7 @@ const handleInstanceFetchFail = (state: typeof initialState, error: Record; export default function listAdderReducer(state: State = ReducerRecord(), action: AnyAction) { - switch(action.type) { + switch (action.type) { case LIST_ADDER_RESET: return ReducerRecord(); case LIST_ADDER_SETUP: diff --git a/app/soapbox/reducers/list_editor.ts b/app/soapbox/reducers/list_editor.ts index 3c1611a92..94ae6e1e1 100644 --- a/app/soapbox/reducers/list_editor.ts +++ b/app/soapbox/reducers/list_editor.ts @@ -46,7 +46,7 @@ const ReducerRecord = ImmutableRecord({ type State = ReturnType; export default function listEditorReducer(state: State = ReducerRecord(), action: AnyAction) { - switch(action.type) { + switch (action.type) { case LIST_EDITOR_RESET: return ReducerRecord(); case LIST_EDITOR_SETUP: diff --git a/app/soapbox/reducers/lists.ts b/app/soapbox/reducers/lists.ts index e0ab4db97..a6c7033d5 100644 --- a/app/soapbox/reducers/lists.ts +++ b/app/soapbox/reducers/lists.ts @@ -30,7 +30,7 @@ const importLists = (state: State, lists: APIEntities) => { }; export default function lists(state: State = initialState, action: AnyAction) { - switch(action.type) { + switch (action.type) { case LIST_FETCH_SUCCESS: case LIST_CREATE_SUCCESS: case LIST_UPDATE_SUCCESS: diff --git a/app/soapbox/reducers/me.ts b/app/soapbox/reducers/me.ts index e36897785..2118e49b8 100644 --- a/app/soapbox/reducers/me.ts +++ b/app/soapbox/reducers/me.ts @@ -25,7 +25,7 @@ const handleForbidden = (state: Me, error: AxiosError) => { }; export default function me(state: Me = initialState, action: AnyAction): Me { - switch(action.type) { + switch (action.type) { case ME_FETCH_SUCCESS: case ME_PATCH_SUCCESS: return action.me.id; diff --git a/app/soapbox/reducers/meta.ts b/app/soapbox/reducers/meta.ts index aa1df8cc5..75c03abec 100644 --- a/app/soapbox/reducers/meta.ts +++ b/app/soapbox/reducers/meta.ts @@ -11,7 +11,7 @@ const ReducerRecord = ImmutableRecord({ }); export default function meta(state = ReducerRecord(), action: AnyAction) { - switch(action.type) { + switch (action.type) { case fetchInstance.rejected.type: if (action.payload.response?.status === 404) { return state.set('instance_fetch_failed', true); diff --git a/app/soapbox/reducers/modals.js b/app/soapbox/reducers/modals.js index 65a0b85f6..1d5434a63 100644 --- a/app/soapbox/reducers/modals.js +++ b/app/soapbox/reducers/modals.js @@ -5,7 +5,7 @@ import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modals'; const initialState = ImmutableList(); export default function modal(state = initialState, action) { - switch(action.type) { + switch (action.type) { case MODAL_OPEN: return state.push({ modalType: action.modalType, modalProps: action.modalProps }); case MODAL_CLOSE: diff --git a/app/soapbox/reducers/notifications.js b/app/soapbox/reducers/notifications.js index faade6a82..f9c2d1708 100644 --- a/app/soapbox/reducers/notifications.js +++ b/app/soapbox/reducers/notifications.js @@ -183,7 +183,7 @@ const importMarker = (state, marker) => { }; export default function notifications(state = ReducerRecord(), action) { - switch(action.type) { + switch (action.type) { case NOTIFICATIONS_EXPAND_REQUEST: return state.set('isLoading', true); case NOTIFICATIONS_EXPAND_FAIL: diff --git a/app/soapbox/reducers/onboarding.ts b/app/soapbox/reducers/onboarding.ts index 844d6b353..c0e38ddb6 100644 --- a/app/soapbox/reducers/onboarding.ts +++ b/app/soapbox/reducers/onboarding.ts @@ -11,7 +11,7 @@ const initialState: OnboardingState = { }; export default function onboarding(state: OnboardingState = initialState, action: OnboardingActions): OnboardingState { - switch(action.type) { + switch (action.type) { case ONBOARDING_START: return { ...state, needsOnboarding: true }; case ONBOARDING_END: diff --git a/app/soapbox/reducers/patron.ts b/app/soapbox/reducers/patron.ts index edf4c1c43..6a2770cee 100644 --- a/app/soapbox/reducers/patron.ts +++ b/app/soapbox/reducers/patron.ts @@ -39,7 +39,7 @@ const normalizePatronAccount = (state: State, account: Record) => { }; export default function patron(state = ReducerRecord(), action: AnyAction) { - switch(action.type) { + switch (action.type) { case PATRON_INSTANCE_FETCH_SUCCESS: return state.set('instance', PatronInstanceRecord(ImmutableMap(fromJS(action.instance)))); case PATRON_ACCOUNT_FETCH_SUCCESS: diff --git a/app/soapbox/reducers/pending_statuses.js b/app/soapbox/reducers/pending_statuses.js index 1c18d7599..e14f7b902 100644 --- a/app/soapbox/reducers/pending_statuses.js +++ b/app/soapbox/reducers/pending_statuses.js @@ -14,7 +14,7 @@ const deleteStatus = (state, idempotencyKey) => state.delete(idempotencyKey); const initialState = ImmutableMap(); export default function pending_statuses(state = initialState, action) { - switch(action.type) { + switch (action.type) { case STATUS_CREATE_REQUEST: return importStatus(state, fromJS(action.params), action.idempotencyKey); case STATUS_CREATE_SUCCESS: diff --git a/app/soapbox/reducers/polls.ts b/app/soapbox/reducers/polls.ts index ff6e25567..d1fbf3a20 100644 --- a/app/soapbox/reducers/polls.ts +++ b/app/soapbox/reducers/polls.ts @@ -30,7 +30,7 @@ const importPolls = (state: State, polls: Array) => { const initialState: State = ImmutableMap(); export default function polls(state: State = initialState, action: AnyAction): State { - switch(action.type) { + switch (action.type) { case POLLS_IMPORT: return importPolls(state, action.polls); default: diff --git a/app/soapbox/reducers/profile_hover_card.js b/app/soapbox/reducers/profile_hover_card.js index fcb2cbbe9..2b6024e28 100644 --- a/app/soapbox/reducers/profile_hover_card.js +++ b/app/soapbox/reducers/profile_hover_card.js @@ -9,7 +9,7 @@ import { const initialState = ImmutableMap(); export default function profileHoverCard(state = initialState, action) { - switch(action.type) { + switch (action.type) { case PROFILE_HOVER_CARD_OPEN: return ImmutableMap({ ref: action.ref, diff --git a/app/soapbox/reducers/push_notifications.js b/app/soapbox/reducers/push_notifications.js index c622d215b..de447b48a 100644 --- a/app/soapbox/reducers/push_notifications.js +++ b/app/soapbox/reducers/push_notifications.js @@ -17,7 +17,7 @@ const initialState = ImmutableMap({ }); export default function push_subscriptions(state = initialState, action) { - switch(action.type) { + switch (action.type) { case SET_SUBSCRIPTION: return state .set('subscription', new ImmutableMap({ diff --git a/app/soapbox/reducers/relationships.js b/app/soapbox/reducers/relationships.js index 09dd4d318..b604d1011 100644 --- a/app/soapbox/reducers/relationships.js +++ b/app/soapbox/reducers/relationships.js @@ -64,7 +64,7 @@ const importPleromaAccounts = (state, accounts) => { }; const followStateToRelationship = followState => { - switch(followState) { + switch (followState) { case 'follow_pending': return { following: false, requested: true }; case 'follow_accept': @@ -84,7 +84,7 @@ const updateFollowRelationship = (state, id, followState) => { const initialState = ImmutableMap(); export default function relationships(state = initialState, action) { - switch(action.type) { + switch (action.type) { case ACCOUNT_IMPORT: return importPleromaAccount(state, action.account); case ACCOUNTS_IMPORT: diff --git a/app/soapbox/reducers/reports.js b/app/soapbox/reducers/reports.js index 3f56e67b8..d86e5e6cf 100644 --- a/app/soapbox/reducers/reports.js +++ b/app/soapbox/reducers/reports.js @@ -26,7 +26,7 @@ const initialState = ImmutableMap({ }); export default function reports(state = initialState, action) { - switch(action.type) { + switch (action.type) { case REPORT_INIT: return state.withMutations(map => { map.setIn(['new', 'isSubmitting'], false); diff --git a/app/soapbox/reducers/scheduled_statuses.js b/app/soapbox/reducers/scheduled_statuses.js index 48adabbae..1cc7b5b7e 100644 --- a/app/soapbox/reducers/scheduled_statuses.js +++ b/app/soapbox/reducers/scheduled_statuses.js @@ -22,7 +22,7 @@ const deleteStatus = (state, id) => state.delete(id); const initialState = ImmutableMap(); export default function scheduled_statuses(state = initialState, action) { - switch(action.type) { + switch (action.type) { case STATUS_IMPORT: case STATUS_CREATE_SUCCESS: return importStatus(state, action.status); diff --git a/app/soapbox/reducers/search.js b/app/soapbox/reducers/search.js index bdc5cb58e..e0905c419 100644 --- a/app/soapbox/reducers/search.js +++ b/app/soapbox/reducers/search.js @@ -77,7 +77,7 @@ const handleSubmitted = (state, value) => { }; export default function search(state = initialState, action) { - switch(action.type) { + switch (action.type) { case SEARCH_CHANGE: return state.set('value', action.value); case SEARCH_CLEAR: diff --git a/app/soapbox/reducers/security.js b/app/soapbox/reducers/security.js index 443e80b49..60535dea3 100644 --- a/app/soapbox/reducers/security.js +++ b/app/soapbox/reducers/security.js @@ -38,7 +38,7 @@ const disableMfa = (state, method) => { }; export default function security(state = initialState, action) { - switch(action.type) { + switch (action.type) { case FETCH_TOKENS_SUCCESS: return state.set('tokens', fromJS(action.tokens)); case REVOKE_TOKEN_SUCCESS: diff --git a/app/soapbox/reducers/settings.js b/app/soapbox/reducers/settings.js index dfe5c7223..e93a42418 100644 --- a/app/soapbox/reducers/settings.js +++ b/app/soapbox/reducers/settings.js @@ -29,7 +29,7 @@ const importSettings = (state, account) => { }; export default function settings(state = initialState, action) { - switch(action.type) { + switch (action.type) { case ME_FETCH_SUCCESS: return importSettings(state, action.me); case NOTIFICATIONS_FILTER_SET: diff --git a/app/soapbox/reducers/sidebar.ts b/app/soapbox/reducers/sidebar.ts index 7b05e9c76..bb070eed1 100644 --- a/app/soapbox/reducers/sidebar.ts +++ b/app/soapbox/reducers/sidebar.ts @@ -11,7 +11,7 @@ const initialState: State = { }; export default function sidebar(state: State = initialState, action: AnyAction): State { - switch(action.type) { + switch (action.type) { case SIDEBAR_OPEN: return { sidebarOpen: true }; case SIDEBAR_CLOSE: diff --git a/app/soapbox/reducers/soapbox.js b/app/soapbox/reducers/soapbox.js index c8eeb7031..bc98968a5 100644 --- a/app/soapbox/reducers/soapbox.js +++ b/app/soapbox/reducers/soapbox.js @@ -52,7 +52,7 @@ const importSoapboxConfig = (state, soapboxConfig, host) => { }; export default function soapbox(state = initialState, action) { - switch(action.type) { + switch (action.type) { case PLEROMA_PRELOAD_IMPORT: return preloadImport(state, action); case SOAPBOX_CONFIG_REMEMBER_SUCCESS: diff --git a/app/soapbox/reducers/status_lists.js b/app/soapbox/reducers/status_lists.js index e49bb02ef..a41b545eb 100644 --- a/app/soapbox/reducers/status_lists.js +++ b/app/soapbox/reducers/status_lists.js @@ -97,7 +97,7 @@ const removeOneFromList = (state, listType, status) => { }; export default function statusLists(state = initialState, action) { - switch(action.type) { + switch (action.type) { case FAVOURITED_STATUSES_FETCH_REQUEST: case FAVOURITED_STATUSES_EXPAND_REQUEST: return setLoading(state, 'favourites', true); diff --git a/app/soapbox/reducers/statuses.ts b/app/soapbox/reducers/statuses.ts index 7e5b764b5..32c40179f 100644 --- a/app/soapbox/reducers/statuses.ts +++ b/app/soapbox/reducers/statuses.ts @@ -194,7 +194,7 @@ const simulateFavourite = ( const initialState: State = ImmutableMap(); export default function statuses(state = initialState, action: AnyAction): State { - switch(action.type) { + switch (action.type) { case STATUS_IMPORT: return importStatus(state, action.status, action.expandSpoilers); case STATUSES_IMPORT: diff --git a/app/soapbox/reducers/suggestions.js b/app/soapbox/reducers/suggestions.js index 5362773e7..26c926ae6 100644 --- a/app/soapbox/reducers/suggestions.js +++ b/app/soapbox/reducers/suggestions.js @@ -49,7 +49,7 @@ const dismissAccounts = (state, accountIds) => { }; export default function suggestionsReducer(state = initialState, action) { - switch(action.type) { + switch (action.type) { case SUGGESTIONS_FETCH_REQUEST: case SUGGESTIONS_V2_FETCH_REQUEST: return state.set('isLoading', true); diff --git a/app/soapbox/reducers/timelines.js b/app/soapbox/reducers/timelines.js index 2f840683d..8438f73d0 100644 --- a/app/soapbox/reducers/timelines.js +++ b/app/soapbox/reducers/timelines.js @@ -233,7 +233,7 @@ const timelineDisconnect = (state, timelineId) => { }; const getTimelinesByVisibility = visibility => { - switch(visibility) { + switch (visibility) { case 'direct': return ['direct']; case 'public': @@ -299,7 +299,7 @@ const handleExpandFail = (state, timelineId) => { }; export default function timelines(state = initialState, action) { - switch(action.type) { + switch (action.type) { case STATUS_CREATE_REQUEST: if (action.params.scheduled_at) return state; return importPendingStatus(state, action.params, action.idempotencyKey); diff --git a/app/soapbox/reducers/trending_statuses.js b/app/soapbox/reducers/trending_statuses.js index 86038fbf7..c5582fc21 100644 --- a/app/soapbox/reducers/trending_statuses.js +++ b/app/soapbox/reducers/trending_statuses.js @@ -20,7 +20,7 @@ const importStatuses = (state, statuses) => { }; export default function trending_statuses(state = initialState, action) { - switch(action.type) { + switch (action.type) { case TRENDING_STATUSES_FETCH_REQUEST: return state.set('isLoading', true); case TRENDING_STATUSES_FETCH_SUCCESS: diff --git a/app/soapbox/reducers/trends.js b/app/soapbox/reducers/trends.js index c5822a660..f116ed00c 100644 --- a/app/soapbox/reducers/trends.js +++ b/app/soapbox/reducers/trends.js @@ -12,7 +12,7 @@ const initialState = ImmutableMap({ }); export default function trendsReducer(state = initialState, action) { - switch(action.type) { + switch (action.type) { case TRENDS_FETCH_REQUEST: return state.set('isLoading', true); case TRENDS_FETCH_SUCCESS: diff --git a/app/soapbox/reducers/user_lists.js b/app/soapbox/reducers/user_lists.js index ff9a63865..15a85c26f 100644 --- a/app/soapbox/reducers/user_lists.js +++ b/app/soapbox/reducers/user_lists.js @@ -82,7 +82,7 @@ const normalizeFollowRequest = (state, notification) => { }; export default function userLists(state = initialState, action) { - switch(action.type) { + switch (action.type) { case FOLLOWERS_FETCH_SUCCESS: return normalizeList(state, 'followers', action.id, action.accounts, action.next); case FOLLOWERS_EXPAND_SUCCESS: diff --git a/app/soapbox/service_worker/web_push_notifications.js b/app/soapbox/service_worker/web_push_notifications.js index c0eb4982e..5dbd749f4 100644 --- a/app/soapbox/service_worker/web_push_notifications.js +++ b/app/soapbox/service_worker/web_push_notifications.js @@ -62,7 +62,7 @@ const cloneNotification = notification => { let k; // Object.assign() does not work with notifications - for(k in notification) { + for (k in notification) { clone[k] = notification[k]; } diff --git a/app/soapbox/utils/emoji_reacts.ts b/app/soapbox/utils/emoji_reacts.ts index 9662c8458..a6ebaf672 100644 --- a/app/soapbox/utils/emoji_reacts.ts +++ b/app/soapbox/utils/emoji_reacts.ts @@ -70,17 +70,17 @@ export const oneEmojiPerAccount = (emojiReacts: ImmutableList, me: M .reverse(); }; -export const filterEmoji = (emojiReacts: ImmutableList, allowedEmoji=ALLOWED_EMOJI): ImmutableList => ( +export const filterEmoji = (emojiReacts: ImmutableList, allowedEmoji = ALLOWED_EMOJI): ImmutableList => ( emojiReacts.filter(emojiReact => ( allowedEmoji.includes(emojiReact.get('name')) ))); -export const reduceEmoji = (emojiReacts: ImmutableList, favouritesCount: number, favourited: boolean, allowedEmoji=ALLOWED_EMOJI): ImmutableList => ( +export const reduceEmoji = (emojiReacts: ImmutableList, favouritesCount: number, favourited: boolean, allowedEmoji = ALLOWED_EMOJI): ImmutableList => ( filterEmoji(sortEmoji(mergeEmoji(mergeEmojiFavourites( emojiReacts, favouritesCount, favourited, ))), allowedEmoji)); -export const getReactForStatus = (status: any, allowedEmoji=ALLOWED_EMOJI): string | undefined => { +export const getReactForStatus = (status: any, allowedEmoji = ALLOWED_EMOJI): string | undefined => { const result = reduceEmoji( status.getIn(['pleroma', 'emoji_reactions'], ImmutableList()), status.get('favourites_count', 0), diff --git a/app/soapbox/utils/media.ts b/app/soapbox/utils/media.ts index 74fc4d3f8..1c08611bf 100644 --- a/app/soapbox/utils/media.ts +++ b/app/soapbox/utils/media.ts @@ -8,8 +8,8 @@ const truncateFilename = (url: string, maxLength: number) => { if (filename.length <= maxLength) return filename; return [ - filename.substr(0, maxLength/2), - filename.substr(filename.length - maxLength/2), + filename.substr(0, maxLength / 2), + filename.substr(filename.length - maxLength / 2), ].join('…'); }; diff --git a/app/soapbox/utils/state.ts b/app/soapbox/utils/state.ts index 6ea55dc21..b51ba702c 100644 --- a/app/soapbox/utils/state.ts +++ b/app/soapbox/utils/state.ts @@ -3,7 +3,7 @@ * @module soapbox/utils/state */ -import { getSoapboxConfig } from'soapbox/actions/soapbox'; +import { getSoapboxConfig } from 'soapbox/actions/soapbox'; import * as BuildConfig from 'soapbox/build_config'; import { isPrerendered } from 'soapbox/precheck'; import { isURL } from 'soapbox/utils/auth'; diff --git a/webpack.config.js b/webpack.config.js index 1194dfddd..e6ff4bdf1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,7 +2,7 @@ require('dotenv').config(); const { NODE_ENV } = process.env; -switch(NODE_ENV) { +switch (NODE_ENV) { case 'development': case 'production': case 'test':