From 2786fa257b07c7b2d3dddb5c4ecd6b4e430ac96a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 9 Jun 2022 21:08:51 +0200 Subject: [PATCH] Use `import type` in some places MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/__mocks__/api.ts | 3 ++- app/soapbox/actions/__tests__/alerts.test.ts | 4 ++-- app/soapbox/actions/about.ts | 4 ++-- app/soapbox/actions/alerts.ts | 6 +++--- app/soapbox/actions/blocks.ts | 6 +++--- app/soapbox/actions/group_editor.js | 3 --- app/soapbox/components/modal_root.js | 1 - app/soapbox/components/more_follows.tsx | 1 - app/soapbox/components/still_image.tsx | 1 - app/soapbox/features/compose/components/poll-form.tsx | 1 - app/soapbox/features/developers/developers_challenge.tsx | 1 - app/soapbox/features/emoji/emoji_compressed.js | 1 - app/soapbox/features/filters/index.js | 1 - .../features/import_data/components/csv_importer.tsx | 1 - app/soapbox/features/onboarding/steps/bio-step.tsx | 3 ++- .../onboarding/steps/cover-photo-selection-step.tsx | 3 ++- app/soapbox/features/onboarding/steps/display-name-step.tsx | 3 ++- app/soapbox/features/security/mfa/disable_otp_form.tsx | 2 -- app/soapbox/features/security/mfa_form.tsx | 1 - app/soapbox/features/status/components/action-bar.tsx | 1 - app/soapbox/features/ui/components/modal_root.js | 1 - .../ui/components/modals/report-modal/report-modal.tsx | 3 ++- app/soapbox/features/ui/components/navbar.tsx | 3 ++- app/soapbox/features/ui/containers/bundle_container.js | 1 - app/soapbox/features/verification/email_passthru.tsx | 3 ++- app/soapbox/features/verification/registration.tsx | 3 ++- app/soapbox/features/verification/steps/sms-verification.js | 1 - app/soapbox/reducers/__tests__/accounts_counters-test.js | 1 - app/soapbox/reducers/account_notes.ts | 3 ++- app/soapbox/reducers/accounts.ts | 3 ++- app/soapbox/reducers/aliases.ts | 1 - app/soapbox/reducers/auth.js | 1 - app/soapbox/reducers/chat_message_lists.ts | 3 ++- app/soapbox/reducers/chat_messages.ts | 3 ++- app/soapbox/reducers/history.ts | 3 ++- app/soapbox/reducers/instance.ts | 3 ++- app/soapbox/reducers/list_adder.ts | 3 ++- app/soapbox/reducers/list_editor.ts | 3 ++- app/soapbox/reducers/lists.ts | 3 ++- app/soapbox/reducers/modals.ts | 1 - app/soapbox/reducers/suggestions.ts | 1 - app/soapbox/store.ts | 3 ++- webpack/translationRunner.js | 1 - 43 files changed, 46 insertions(+), 52 deletions(-) diff --git a/app/soapbox/__mocks__/api.ts b/app/soapbox/__mocks__/api.ts index f81d4a3c4..c164ba63c 100644 --- a/app/soapbox/__mocks__/api.ts +++ b/app/soapbox/__mocks__/api.ts @@ -1,8 +1,9 @@ import { jest } from '@jest/globals'; -import { AxiosInstance, AxiosResponse } from 'axios'; import MockAdapter from 'axios-mock-adapter'; import LinkHeader from 'http-link-header'; +import type { AxiosInstance, AxiosResponse } from 'axios'; + const api = jest.requireActual('../api') as Record; let mocks: Array = []; diff --git a/app/soapbox/actions/__tests__/alerts.test.ts b/app/soapbox/actions/__tests__/alerts.test.ts index f2419893a..52e0c8b5b 100644 --- a/app/soapbox/actions/__tests__/alerts.test.ts +++ b/app/soapbox/actions/__tests__/alerts.test.ts @@ -1,10 +1,10 @@ -import { AxiosError } from 'axios'; - import { mockStore } from 'soapbox/jest/test-helpers'; import rootReducer from 'soapbox/reducers'; import { dismissAlert, showAlert, showAlertForError } from '../alerts'; +import type { AxiosError } from 'axios'; + const buildError = (message: string, status: number) => new AxiosError(message, String(status), null, null, { data: { error: message, diff --git a/app/soapbox/actions/about.ts b/app/soapbox/actions/about.ts index 37713c401..dc6610eb7 100644 --- a/app/soapbox/actions/about.ts +++ b/app/soapbox/actions/about.ts @@ -1,7 +1,7 @@ -import { AnyAction } from 'redux'; - import { staticClient } from '../api'; +import type { AnyAction } from 'redux'; + const FETCH_ABOUT_PAGE_REQUEST = 'FETCH_ABOUT_PAGE_REQUEST'; const FETCH_ABOUT_PAGE_SUCCESS = 'FETCH_ABOUT_PAGE_SUCCESS'; const FETCH_ABOUT_PAGE_FAIL = 'FETCH_ABOUT_PAGE_FAIL'; diff --git a/app/soapbox/actions/alerts.ts b/app/soapbox/actions/alerts.ts index b0af2af35..2fc253158 100644 --- a/app/soapbox/actions/alerts.ts +++ b/app/soapbox/actions/alerts.ts @@ -1,10 +1,10 @@ -import { AnyAction } from '@reduxjs/toolkit'; -import { AxiosError } from 'axios'; import { defineMessages, MessageDescriptor } from 'react-intl'; import { httpErrorMessages } from 'soapbox/utils/errors'; -import { SnackbarActionSeverity } from './snackbar'; +import type { SnackbarActionSeverity } from './snackbar'; +import type { AnyAction } from '@reduxjs/toolkit'; +import type { AxiosError } from 'axios'; const messages = defineMessages({ unexpectedTitle: { id: 'alert.unexpected.title', defaultMessage: 'Oops!' }, diff --git a/app/soapbox/actions/blocks.ts b/app/soapbox/actions/blocks.ts index af68b7b83..25488d0f6 100644 --- a/app/soapbox/actions/blocks.ts +++ b/app/soapbox/actions/blocks.ts @@ -1,6 +1,3 @@ -import { AnyAction } from '@reduxjs/toolkit'; -import { AxiosError } from 'axios'; - import { isLoggedIn } from 'soapbox/utils/auth'; import { getNextLinkName } from 'soapbox/utils/quirks'; @@ -9,6 +6,9 @@ import api, { getLinks } from '../api'; import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; +import type { AnyAction } from '@reduxjs/toolkit'; +import type { AxiosError } from 'axios'; + const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST'; const BLOCKS_FETCH_SUCCESS = 'BLOCKS_FETCH_SUCCESS'; const BLOCKS_FETCH_FAIL = 'BLOCKS_FETCH_FAIL'; diff --git a/app/soapbox/actions/group_editor.js b/app/soapbox/actions/group_editor.js index f504a743a..c5e85df3b 100644 --- a/app/soapbox/actions/group_editor.js +++ b/app/soapbox/actions/group_editor.js @@ -27,7 +27,6 @@ export const submit = (routerHistory) => (dispatch, getState) => { } }; - export const create = (title, description, coverImage, routerHistory) => (dispatch, getState) => { if (!isLoggedIn(getState)) return; @@ -47,7 +46,6 @@ export const create = (title, description, coverImage, routerHistory) => (dispat }).catch(err => dispatch(createFail(err))); }; - export const createRequest = id => ({ type: GROUP_CREATE_REQUEST, id, @@ -82,7 +80,6 @@ export const update = (groupId, title, description, coverImage, routerHistory) = }).catch(err => dispatch(updateFail(err))); }; - export const updateRequest = id => ({ type: GROUP_UPDATE_REQUEST, id, diff --git a/app/soapbox/components/modal_root.js b/app/soapbox/components/modal_root.js index ddf5fd26f..1c4c53224 100644 --- a/app/soapbox/components/modal_root.js +++ b/app/soapbox/components/modal_root.js @@ -90,7 +90,6 @@ class ModalRoot extends React.PureComponent { } }; - handleKeyDown = (e) => { if (e.key === 'Tab') { const focusable = Array.from(this.node.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter((x) => window.getComputedStyle(x).display !== 'none'); diff --git a/app/soapbox/components/more_follows.tsx b/app/soapbox/components/more_follows.tsx index a99b4b5be..f200cd543 100644 --- a/app/soapbox/components/more_follows.tsx +++ b/app/soapbox/components/more_follows.tsx @@ -29,7 +29,6 @@ const MoreFollows: React.FC = ({ visible = true, count, type }) => return intl.formatMessage(messages[type], { count }); }; - // If the instance isn't federating, there are no remote followers if (!features.federating) { return null; diff --git a/app/soapbox/components/still_image.tsx b/app/soapbox/components/still_image.tsx index d2ee256a3..4369c84b9 100644 --- a/app/soapbox/components/still_image.tsx +++ b/app/soapbox/components/still_image.tsx @@ -34,7 +34,6 @@ const StillImage: React.FC = ({ alt, className, src, style }) => { } }; - return (
{alt} diff --git a/app/soapbox/features/compose/components/poll-form.tsx b/app/soapbox/features/compose/components/poll-form.tsx index 0f8e87387..b0116ffef 100644 --- a/app/soapbox/features/compose/components/poll-form.tsx +++ b/app/soapbox/features/compose/components/poll-form.tsx @@ -169,7 +169,6 @@ const PollForm = (props: IPollForm) => { const handleToggleMultiple = () => onChangeSettings(expiresIn, !isMultiple); - if (!options) { return null; } diff --git a/app/soapbox/features/developers/developers_challenge.tsx b/app/soapbox/features/developers/developers_challenge.tsx index 50d107384..468f9a6fe 100644 --- a/app/soapbox/features/developers/developers_challenge.tsx +++ b/app/soapbox/features/developers/developers_challenge.tsx @@ -6,7 +6,6 @@ import { changeSettingImmediate } from 'soapbox/actions/settings'; import snackbar from 'soapbox/actions/snackbar'; import { Button, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui'; - import Column from '../ui/components/column'; const messages = defineMessages({ diff --git a/app/soapbox/features/emoji/emoji_compressed.js b/app/soapbox/features/emoji/emoji_compressed.js index 542bb7feb..74cb1cf06 100644 --- a/app/soapbox/features/emoji/emoji_compressed.js +++ b/app/soapbox/features/emoji/emoji_compressed.js @@ -13,7 +13,6 @@ const emojiMap = require('./emoji_map.json'); const { unicodeToFilename } = require('./unicode_to_filename'); const { unicodeToUnifiedName } = require('./unicode_to_unified_name'); - if (data.compressed) { data = emojiMartUncompress(data); } diff --git a/app/soapbox/features/filters/index.js b/app/soapbox/features/filters/index.js index f3ba42899..62e12cdf6 100644 --- a/app/soapbox/features/filters/index.js +++ b/app/soapbox/features/filters/index.js @@ -48,7 +48,6 @@ const mapStateToProps = state => ({ filters: state.get('filters'), }); - export default @connect(mapStateToProps) @injectIntl class Filters extends ImmutablePureComponent { diff --git a/app/soapbox/features/import_data/components/csv_importer.tsx b/app/soapbox/features/import_data/components/csv_importer.tsx index fafbe813d..65d9e1ee4 100644 --- a/app/soapbox/features/import_data/components/csv_importer.tsx +++ b/app/soapbox/features/import_data/components/csv_importer.tsx @@ -21,7 +21,6 @@ const CSVImporter: React.FC = ({ messages, action }) => { const [isLoading, setIsLoading] = useState(false); const [file, setFile] = useState(null); - const handleSubmit: React.FormEventHandler = (event) => { const params = new FormData(); params.append('list', file!); diff --git a/app/soapbox/features/onboarding/steps/bio-step.tsx b/app/soapbox/features/onboarding/steps/bio-step.tsx index 6b80d75bb..785accc37 100644 --- a/app/soapbox/features/onboarding/steps/bio-step.tsx +++ b/app/soapbox/features/onboarding/steps/bio-step.tsx @@ -1,4 +1,3 @@ -import { AxiosError } from 'axios'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { useDispatch } from 'react-redux'; @@ -8,6 +7,8 @@ import snackbar from 'soapbox/actions/snackbar'; import { Button, Card, CardBody, FormGroup, Stack, Text, Textarea } from 'soapbox/components/ui'; import { useOwnAccount } from 'soapbox/hooks'; +import type { AxiosError } from 'axios'; + const BioStep = ({ onNext }: { onNext: () => void }) => { const dispatch = useDispatch(); diff --git a/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx b/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx index 29b333a52..9efd311e8 100644 --- a/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx +++ b/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx @@ -1,4 +1,3 @@ -import { AxiosError } from 'axios'; import classNames from 'classnames'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; @@ -11,6 +10,8 @@ import { Avatar, Button, Card, CardBody, Icon, Spinner, Stack, Text } from 'soap import { useOwnAccount } from 'soapbox/hooks'; import resizeImage from 'soapbox/utils/resize_image'; +import type { AxiosError } from 'axios'; + /** Default header filenames from various backends */ const DEFAULT_HEADERS = [ '/headers/original/missing.png', // Mastodon diff --git a/app/soapbox/features/onboarding/steps/display-name-step.tsx b/app/soapbox/features/onboarding/steps/display-name-step.tsx index f54fa21c9..56d9eac1e 100644 --- a/app/soapbox/features/onboarding/steps/display-name-step.tsx +++ b/app/soapbox/features/onboarding/steps/display-name-step.tsx @@ -1,4 +1,3 @@ -import { AxiosError } from 'axios'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { useDispatch } from 'react-redux'; @@ -8,6 +7,8 @@ import snackbar from 'soapbox/actions/snackbar'; import { Button, Card, CardBody, FormGroup, Input, Stack, Text } from 'soapbox/components/ui'; import { useOwnAccount } from 'soapbox/hooks'; +import type { AxiosError } from 'axios'; + const DisplayNameStep = ({ onNext }: { onNext: () => void }) => { const dispatch = useDispatch(); diff --git a/app/soapbox/features/security/mfa/disable_otp_form.tsx b/app/soapbox/features/security/mfa/disable_otp_form.tsx index a62133b87..ba0e5fbbf 100644 --- a/app/soapbox/features/security/mfa/disable_otp_form.tsx +++ b/app/soapbox/features/security/mfa/disable_otp_form.tsx @@ -14,7 +14,6 @@ const messages = defineMessages({ passwordPlaceholder: { id: 'mfa.mfa_setup.password_placeholder', defaultMessage: 'Password' }, }); - const DisableOtpForm: React.FC = () => { const [isLoading, setIsLoading] = useState(false); const [password, setPassword] = useState(''); @@ -39,7 +38,6 @@ const DisableOtpForm: React.FC = () => { setPassword(event.target.value); }; - return (
diff --git a/app/soapbox/features/security/mfa_form.tsx b/app/soapbox/features/security/mfa_form.tsx index 92a922148..759c648c1 100644 --- a/app/soapbox/features/security/mfa_form.tsx +++ b/app/soapbox/features/security/mfa_form.tsx @@ -29,7 +29,6 @@ const MfaForm: React.FC = () => { dispatch(fetchMfa()); }, []); - const handleSetupProceedClick = (event: React.MouseEvent) => { event.preventDefault(); setDisplayOtpForm(true); diff --git a/app/soapbox/features/status/components/action-bar.tsx b/app/soapbox/features/status/components/action-bar.tsx index 9db8e3925..50055df23 100644 --- a/app/soapbox/features/status/components/action-bar.tsx +++ b/app/soapbox/features/status/components/action-bar.tsx @@ -525,7 +525,6 @@ class ActionBar extends React.PureComponent { const canShare = ('share' in navigator) && status.visibility === 'public'; - let reblogIcon = require('@tabler/icons/icons/repeat.svg'); if (status.visibility === 'direct') { diff --git a/app/soapbox/features/ui/components/modal_root.js b/app/soapbox/features/ui/components/modal_root.js index eb7ba90a2..62f9fa50f 100644 --- a/app/soapbox/features/ui/components/modal_root.js +++ b/app/soapbox/features/ui/components/modal_root.js @@ -39,7 +39,6 @@ import BundleContainer from '../containers/bundle_container'; import BundleModalError from './bundle_modal_error'; import ModalLoading from './modal_loading'; - const MODAL_COMPONENTS = { 'MEDIA': MediaModal, 'VIDEO': VideoModal, diff --git a/app/soapbox/features/ui/components/modals/report-modal/report-modal.tsx b/app/soapbox/features/ui/components/modals/report-modal/report-modal.tsx index cb4181eaa..39575beb4 100644 --- a/app/soapbox/features/ui/components/modals/report-modal/report-modal.tsx +++ b/app/soapbox/features/ui/components/modals/report-modal/report-modal.tsx @@ -1,4 +1,3 @@ -import { AxiosError } from 'axios'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; @@ -15,6 +14,8 @@ import ConfirmationStep from './steps/confirmation-step'; import OtherActionsStep from './steps/other-actions-step'; import ReasonStep from './steps/reason-step'; +import type { AxiosError } from 'axios'; + const messages = defineMessages({ blankslate: { id: 'report.reason.blankslate', defaultMessage: 'You have removed all statuses from being selected.' }, done: { id: 'report.done', defaultMessage: 'Done' }, diff --git a/app/soapbox/features/ui/components/navbar.tsx b/app/soapbox/features/ui/components/navbar.tsx index 9b09edc1c..eb403c8fc 100644 --- a/app/soapbox/features/ui/components/navbar.tsx +++ b/app/soapbox/features/ui/components/navbar.tsx @@ -1,4 +1,3 @@ -import { AxiosError } from 'axios'; import classNames from 'classnames'; import React, { useRef, useState } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; @@ -15,6 +14,8 @@ import { useOwnAccount, useSoapboxConfig } from 'soapbox/hooks'; import ProfileDropdown from './profile-dropdown'; +import type { AxiosError } from 'axios'; + const messages = defineMessages({ login: { id: 'navbar.login.action', defaultMessage: 'Log in' }, username: { id: 'navbar.login.username.placeholder', defaultMessage: 'Email or username' }, diff --git a/app/soapbox/features/ui/containers/bundle_container.js b/app/soapbox/features/ui/containers/bundle_container.js index dc2802822..b12e29a43 100644 --- a/app/soapbox/features/ui/containers/bundle_container.js +++ b/app/soapbox/features/ui/containers/bundle_container.js @@ -3,7 +3,6 @@ import { connect } from 'react-redux'; import { fetchBundleRequest, fetchBundleSuccess, fetchBundleFail } from '../../../actions/bundles'; import Bundle from '../components/bundle'; - const mapDispatchToProps = dispatch => ({ onFetch() { dispatch(fetchBundleRequest()); diff --git a/app/soapbox/features/verification/email_passthru.tsx b/app/soapbox/features/verification/email_passthru.tsx index d014143aa..97020f3a4 100644 --- a/app/soapbox/features/verification/email_passthru.tsx +++ b/app/soapbox/features/verification/email_passthru.tsx @@ -1,4 +1,3 @@ -import { AxiosError } from 'axios'; import * as React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { useDispatch } from 'react-redux'; @@ -8,6 +7,8 @@ import snackbar from 'soapbox/actions/snackbar'; import { confirmEmailVerification } from 'soapbox/actions/verification'; import { Icon, Spinner, Stack, Text } from 'soapbox/components/ui'; +import type { AxiosError } from 'axios'; + const Statuses = { IDLE: 'IDLE', SUCCESS: 'SUCCESS', diff --git a/app/soapbox/features/verification/registration.tsx b/app/soapbox/features/verification/registration.tsx index 8b76dce34..3c527b828 100644 --- a/app/soapbox/features/verification/registration.tsx +++ b/app/soapbox/features/verification/registration.tsx @@ -1,4 +1,3 @@ -import { AxiosError } from 'axios'; import * as React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { useDispatch } from 'react-redux'; @@ -13,6 +12,8 @@ import { Button, Form, FormGroup, Input } from 'soapbox/components/ui'; import { useAppSelector } from 'soapbox/hooks'; import { getRedirectUrl } from 'soapbox/utils/redirect'; +import type { AxiosError } from 'axios'; + const messages = defineMessages({ success: { id: 'registrations.success', diff --git a/app/soapbox/features/verification/steps/sms-verification.js b/app/soapbox/features/verification/steps/sms-verification.js index 01050c832..aa5e3f3ea 100644 --- a/app/soapbox/features/verification/steps/sms-verification.js +++ b/app/soapbox/features/verification/steps/sms-verification.js @@ -165,5 +165,4 @@ const SmsVerification = () => { ); }; - export { SmsVerification as default, validPhoneNumberRegex }; diff --git a/app/soapbox/reducers/__tests__/accounts_counters-test.js b/app/soapbox/reducers/__tests__/accounts_counters-test.js index 8985179c5..ca1a279e0 100644 --- a/app/soapbox/reducers/__tests__/accounts_counters-test.js +++ b/app/soapbox/reducers/__tests__/accounts_counters-test.js @@ -7,7 +7,6 @@ import reducer from '../accounts_counters'; // import accounts_counter_unfollow from 'soapbox/__fixtures__/accounts_counter_unfollow.json'; // import accounts_counter_follow from 'soapbox/__fixtures__/accounts_counter_follow.json'; - describe('accounts_counters reducer', () => { it('should return the initial state', () => { expect(reducer(undefined, {})).toEqual(ImmutableMap()); diff --git a/app/soapbox/reducers/account_notes.ts b/app/soapbox/reducers/account_notes.ts index 88515a59f..f5d753ee3 100644 --- a/app/soapbox/reducers/account_notes.ts +++ b/app/soapbox/reducers/account_notes.ts @@ -1,5 +1,4 @@ import { Record as ImmutableRecord } from 'immutable'; -import { AnyAction } from 'redux'; import { ACCOUNT_NOTE_INIT_MODAL, @@ -9,6 +8,8 @@ import { ACCOUNT_NOTE_SUBMIT_SUCCESS, } from '../actions/account-notes'; +import type { AnyAction } from 'redux'; + const EditRecord = ImmutableRecord({ isSubmitting: false, account: null, diff --git a/app/soapbox/reducers/accounts.ts b/app/soapbox/reducers/accounts.ts index f87602d95..d0d2db235 100644 --- a/app/soapbox/reducers/accounts.ts +++ b/app/soapbox/reducers/accounts.ts @@ -4,7 +4,6 @@ import { OrderedSet as ImmutableOrderedSet, fromJS, } from 'immutable'; -import { AnyAction } from 'redux'; import { ADMIN_USERS_FETCH_SUCCESS, @@ -39,6 +38,8 @@ import { STREAMING_CHAT_UPDATE } from 'soapbox/actions/streaming'; import { normalizeAccount } from 'soapbox/normalizers/account'; import { normalizeId } from 'soapbox/utils/normalizers'; +import type { AnyAction } from 'redux'; + type AccountRecord = ReturnType; type AccountMap = ImmutableMap; type APIEntity = Record; diff --git a/app/soapbox/reducers/aliases.ts b/app/soapbox/reducers/aliases.ts index 8a7691e5a..0d6eb3bad 100644 --- a/app/soapbox/reducers/aliases.ts +++ b/app/soapbox/reducers/aliases.ts @@ -10,7 +10,6 @@ import { import type { AnyAction } from 'redux'; import type { APIEntity } from 'soapbox/types/entities'; - const ReducerRecord = ImmutableRecord({ aliases: ImmutableRecord({ items: ImmutableList(), diff --git a/app/soapbox/reducers/auth.js b/app/soapbox/reducers/auth.js index 150a06288..fb6338120 100644 --- a/app/soapbox/reducers/auth.js +++ b/app/soapbox/reducers/auth.js @@ -257,7 +257,6 @@ const importMastodonPreload = (state, data) => { }); }; - const persistAuthAccount = account => { if (account && account.url) { const key = `authAccount:${account.url}`; diff --git a/app/soapbox/reducers/chat_message_lists.ts b/app/soapbox/reducers/chat_message_lists.ts index e801414a8..d9450a277 100644 --- a/app/soapbox/reducers/chat_message_lists.ts +++ b/app/soapbox/reducers/chat_message_lists.ts @@ -1,5 +1,4 @@ import { Map as ImmutableMap, OrderedSet as ImmutableOrderedSet } from 'immutable'; -import { AnyAction } from 'redux'; import { CHATS_FETCH_SUCCESS, @@ -11,6 +10,8 @@ import { } from 'soapbox/actions/chats'; import { STREAMING_CHAT_UPDATE } from 'soapbox/actions/streaming'; +import type { AnyAction } from 'redux'; + type APIEntity = Record; type APIEntities = Array; diff --git a/app/soapbox/reducers/chat_messages.ts b/app/soapbox/reducers/chat_messages.ts index 64900afab..00df417cf 100644 --- a/app/soapbox/reducers/chat_messages.ts +++ b/app/soapbox/reducers/chat_messages.ts @@ -1,5 +1,4 @@ import { Map as ImmutableMap, fromJS } from 'immutable'; -import { AnyAction } from 'redux'; import { CHATS_FETCH_SUCCESS, @@ -13,6 +12,8 @@ import { import { STREAMING_CHAT_UPDATE } from 'soapbox/actions/streaming'; import { normalizeChatMessage } from 'soapbox/normalizers'; +import type { AnyAction } from 'redux'; + type ChatMessageRecord = ReturnType; type APIEntity = Record; type APIEntities = Array; diff --git a/app/soapbox/reducers/history.ts b/app/soapbox/reducers/history.ts index f0ca3b771..855d5fd92 100644 --- a/app/soapbox/reducers/history.ts +++ b/app/soapbox/reducers/history.ts @@ -1,9 +1,10 @@ import { List as ImmutableList, Map as ImmutableMap, Record as ImmutableRecord } from 'immutable'; -import { AnyAction } from 'redux'; import { HISTORY_FETCH_REQUEST, HISTORY_FETCH_SUCCESS, HISTORY_FETCH_FAIL } from 'soapbox/actions/history'; import { normalizeStatusEdit } from 'soapbox/normalizers'; +import type { AnyAction } from 'redux'; + type StatusEditRecord = ReturnType; const HistoryRecord = ImmutableRecord({ diff --git a/app/soapbox/reducers/instance.ts b/app/soapbox/reducers/instance.ts index ab58fb7db..4c1456dc4 100644 --- a/app/soapbox/reducers/instance.ts +++ b/app/soapbox/reducers/instance.ts @@ -1,5 +1,4 @@ import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable'; -import { AnyAction } from 'redux'; import { ADMIN_CONFIG_UPDATE_REQUEST, ADMIN_CONFIG_UPDATE_SUCCESS } from 'soapbox/actions/admin'; import { PLEROMA_PRELOAD_IMPORT } from 'soapbox/actions/preload'; @@ -13,6 +12,8 @@ import { fetchNodeinfo, } from '../actions/instance'; +import type { AnyAction } from 'redux'; + const initialState = normalizeInstance(ImmutableMap()); const nodeinfoToInstance = (nodeinfo: ImmutableMap) => { diff --git a/app/soapbox/reducers/list_adder.ts b/app/soapbox/reducers/list_adder.ts index d95f74df0..f2ff96324 100644 --- a/app/soapbox/reducers/list_adder.ts +++ b/app/soapbox/reducers/list_adder.ts @@ -1,5 +1,4 @@ import { List as ImmutableList, Record as ImmutableRecord } from 'immutable'; -import { AnyAction } from 'redux'; import { LIST_ADDER_RESET, @@ -11,6 +10,8 @@ import { LIST_EDITOR_REMOVE_SUCCESS, } from '../actions/lists'; +import type { AnyAction } from 'redux'; + const ListsRecord = ImmutableRecord({ items: ImmutableList(), loaded: false, diff --git a/app/soapbox/reducers/list_editor.ts b/app/soapbox/reducers/list_editor.ts index 2352c9a88..8c0ef8e11 100644 --- a/app/soapbox/reducers/list_editor.ts +++ b/app/soapbox/reducers/list_editor.ts @@ -1,5 +1,4 @@ import { List as ImmutableList, Record as ImmutableRecord } from 'immutable'; -import { AnyAction } from 'redux'; import { LIST_CREATE_REQUEST, @@ -21,6 +20,8 @@ import { LIST_EDITOR_REMOVE_SUCCESS, } from '../actions/lists'; +import type { AnyAction } from 'redux'; + const AccountsRecord = ImmutableRecord({ items: ImmutableList(), loaded: false, diff --git a/app/soapbox/reducers/lists.ts b/app/soapbox/reducers/lists.ts index fc2753598..0acfc6a31 100644 --- a/app/soapbox/reducers/lists.ts +++ b/app/soapbox/reducers/lists.ts @@ -1,5 +1,4 @@ import { Map as ImmutableMap } from 'immutable'; -import { AnyAction } from 'redux'; import { LIST_FETCH_SUCCESS, @@ -11,6 +10,8 @@ import { } from 'soapbox/actions/lists'; import { normalizeList } from 'soapbox/normalizers'; +import type { AnyAction } from 'redux'; + type ListRecord = ReturnType; type APIEntity = Record; type APIEntities = Array; diff --git a/app/soapbox/reducers/modals.ts b/app/soapbox/reducers/modals.ts index d16451bd1..829cbabe9 100644 --- a/app/soapbox/reducers/modals.ts +++ b/app/soapbox/reducers/modals.ts @@ -4,7 +4,6 @@ import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modals'; import type { AnyAction } from 'redux'; - const ModalRecord = ImmutableRecord({ modalType: '', modalProps: null as Record | null, diff --git a/app/soapbox/reducers/suggestions.ts b/app/soapbox/reducers/suggestions.ts index 329d4ea29..fc095113f 100644 --- a/app/soapbox/reducers/suggestions.ts +++ b/app/soapbox/reducers/suggestions.ts @@ -1,6 +1,5 @@ import { OrderedSet as ImmutableOrderedSet, Record as ImmutableRecord } from 'immutable'; - import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'soapbox/actions/accounts'; import { DOMAIN_BLOCK_SUCCESS } from 'soapbox/actions/domain_blocks'; import { diff --git a/app/soapbox/store.ts b/app/soapbox/store.ts index aba830a93..cb55a033d 100644 --- a/app/soapbox/store.ts +++ b/app/soapbox/store.ts @@ -1,11 +1,12 @@ import { configureStore } from '@reduxjs/toolkit'; -import { AnyAction } from 'redux'; import thunk, { ThunkDispatch } from 'redux-thunk'; import errorsMiddleware from './middleware/errors'; import soundsMiddleware from './middleware/sounds'; import appReducer from './reducers'; +import type { AnyAction } from 'redux'; + export const store = configureStore({ reducer: appReducer, middleware: [ diff --git a/webpack/translationRunner.js b/webpack/translationRunner.js index 4afedff26..a5d463835 100644 --- a/webpack/translationRunner.js +++ b/webpack/translationRunner.js @@ -100,7 +100,6 @@ manageTranslations({ }, }); - // Check variable interpolations and print error messages if variables are // used in translations which are not used in the default message. /* eslint-disable no-console */