From 5fe442b68455734d2bc6ea2448ecc5a78bc4e500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 7 Jun 2022 22:21:18 +0200 Subject: [PATCH] ESLint: add no-duplicate-imports rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .eslintrc.js | 1 + app/soapbox/actions/__tests__/statuses-test.js | 3 +-- app/soapbox/api.ts | 3 +-- app/soapbox/components/media_gallery.js | 3 +-- app/soapbox/components/sidebar_menu.tsx | 3 +-- app/soapbox/components/status_action_bar.tsx | 3 +-- app/soapbox/features/account_gallery/index.js | 3 +-- .../features/admin/components/latest_accounts_panel.tsx | 3 +-- app/soapbox/features/audio/index.js | 6 ++---- app/soapbox/features/chats/components/chat_panes.js | 3 +-- app/soapbox/features/compose/components/search_results.js | 3 +-- .../features/compose/containers/poll_form_container.js | 6 +++++- app/soapbox/features/compose/containers/upload_container.js | 3 +-- app/soapbox/features/filters/index.js | 3 +-- app/soapbox/features/groups/removed_accounts/index.js | 3 +-- app/soapbox/features/list_adder/index.tsx | 3 +-- app/soapbox/features/list_editor/index.tsx | 3 +-- app/soapbox/features/lists/index.tsx | 3 +-- .../features/notifications/components/notification.tsx | 3 +-- .../notifications/containers/column_settings_container.js | 3 +-- app/soapbox/features/status/components/detailed-status.tsx | 3 +-- app/soapbox/features/status/index.tsx | 3 ++- app/soapbox/features/ui/components/profile-dropdown.tsx | 3 +-- app/soapbox/features/ui/components/timeline.tsx | 3 +-- app/soapbox/features/ui/index.tsx | 6 +++--- app/soapbox/features/verification/registration.tsx | 3 +-- .../features/verification/steps/email-verification.js | 3 +-- app/soapbox/reducers/contexts.ts | 2 +- 28 files changed, 36 insertions(+), 54 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bfe92311d..c140fa524 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -258,6 +258,7 @@ module.exports = { alphabetize: { order: 'asc' }, }, ], + '@typescript-eslint/no-duplicate-imports': 'error', 'promise/catch-or-return': 'error', diff --git a/app/soapbox/actions/__tests__/statuses-test.js b/app/soapbox/actions/__tests__/statuses-test.js index 463b87437..b00175401 100644 --- a/app/soapbox/actions/__tests__/statuses-test.js +++ b/app/soapbox/actions/__tests__/statuses-test.js @@ -6,8 +6,7 @@ import { mockStore, rootState } from 'soapbox/jest/test-helpers'; import { normalizeStatus } from 'soapbox/normalizers/status'; import rootReducer from 'soapbox/reducers'; -import { fetchContext } from '../statuses'; -import { deleteStatus } from '../statuses'; +import { deleteStatus, fetchContext } from '../statuses'; describe('fetchContext()', () => { it('handles Mitra context', done => { diff --git a/app/soapbox/api.ts b/app/soapbox/api.ts index 34ed699f8..05d08b768 100644 --- a/app/soapbox/api.ts +++ b/app/soapbox/api.ts @@ -11,8 +11,7 @@ import { createSelector } from 'reselect'; import * as BuildConfig from 'soapbox/build_config'; import { RootState } from 'soapbox/store'; -import { getAccessToken, getAppToken, parseBaseURL } from 'soapbox/utils/auth'; -import { isURL } from 'soapbox/utils/auth'; +import { getAccessToken, getAppToken, isURL, parseBaseURL } from 'soapbox/utils/auth'; /** Parse Link headers, mostly for pagination. diff --git a/app/soapbox/components/media_gallery.js b/app/soapbox/components/media_gallery.js index 44b08a3df..5e528d4be 100644 --- a/app/soapbox/components/media_gallery.js +++ b/app/soapbox/components/media_gallery.js @@ -1,6 +1,5 @@ import classNames from 'classnames'; -import { is } from 'immutable'; -import { Map as ImmutableMap } from 'immutable'; +import { Map as ImmutableMap, is } from 'immutable'; import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; diff --git a/app/soapbox/components/sidebar_menu.tsx b/app/soapbox/components/sidebar_menu.tsx index 7d47baa47..c53ec0b40 100644 --- a/app/soapbox/components/sidebar_menu.tsx +++ b/app/soapbox/components/sidebar_menu.tsx @@ -4,8 +4,7 @@ import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; import { useDispatch } from 'react-redux'; import { Link, NavLink } from 'react-router-dom'; -import { logOut, switchAccount } from 'soapbox/actions/auth'; -import { fetchOwnAccounts } from 'soapbox/actions/auth'; +import { fetchOwnAccounts, logOut, switchAccount } from 'soapbox/actions/auth'; import { getSettings } from 'soapbox/actions/settings'; import { closeSidebar } from 'soapbox/actions/sidebar'; import Account from 'soapbox/components/account'; diff --git a/app/soapbox/components/status_action_bar.tsx b/app/soapbox/components/status_action_bar.tsx index f50852698..dbb78b8d7 100644 --- a/app/soapbox/components/status_action_bar.tsx +++ b/app/soapbox/components/status_action_bar.tsx @@ -6,6 +6,7 @@ import { connect } from 'react-redux'; import { withRouter, RouteComponentProps } from 'react-router-dom'; import { simpleEmojiReact } from 'soapbox/actions/emoji_reacts'; +import { openModal } from 'soapbox/actions/modals'; import EmojiButtonWrapper from 'soapbox/components/emoji-button-wrapper'; import StatusActionButton from 'soapbox/components/status-action-button'; import DropdownMenuContainer from 'soapbox/containers/dropdown_menu_container'; @@ -13,8 +14,6 @@ import { isUserTouching } from 'soapbox/is_mobile'; import { getReactForStatus, reduceEmoji } from 'soapbox/utils/emoji_reacts'; import { getFeatures } from 'soapbox/utils/features'; -import { openModal } from '../actions/modals'; - import type { History } from 'history'; import type { AnyAction, Dispatch } from 'redux'; import type { Menu } from 'soapbox/components/dropdown_menu'; diff --git a/app/soapbox/features/account_gallery/index.js b/app/soapbox/features/account_gallery/index.js index a17fa85e1..18d06c036 100644 --- a/app/soapbox/features/account_gallery/index.js +++ b/app/soapbox/features/account_gallery/index.js @@ -13,8 +13,7 @@ import { openModal } from 'soapbox/actions/modals'; import { expandAccountMediaTimeline } from 'soapbox/actions/timelines'; import LoadMore from 'soapbox/components/load_more'; import MissingIndicator from 'soapbox/components/missing_indicator'; -import { Column } from 'soapbox/components/ui'; -import { Spinner } from 'soapbox/components/ui'; +import { Column, Spinner } from 'soapbox/components/ui'; import { getAccountGallery, findAccountByUsername } from 'soapbox/selectors'; import { getFeatures } from 'soapbox/utils/features'; diff --git a/app/soapbox/features/admin/components/latest_accounts_panel.tsx b/app/soapbox/features/admin/components/latest_accounts_panel.tsx index 804744d5e..b9eabcde6 100644 --- a/app/soapbox/features/admin/components/latest_accounts_panel.tsx +++ b/app/soapbox/features/admin/components/latest_accounts_panel.tsx @@ -7,8 +7,7 @@ import { fetchUsers } from 'soapbox/actions/admin'; import compareId from 'soapbox/compare_id'; import { Widget } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account_container'; -import { useAppSelector } from 'soapbox/hooks'; -import { useAppDispatch } from 'soapbox/hooks'; +import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; const messages = defineMessages({ title: { id: 'admin.latest_accounts_panel.title', defaultMessage: 'Latest Accounts' }, diff --git a/app/soapbox/features/audio/index.js b/app/soapbox/features/audio/index.js index d73b7208c..6fa5418bc 100644 --- a/app/soapbox/features/audio/index.js +++ b/app/soapbox/features/audio/index.js @@ -1,13 +1,11 @@ import classNames from 'classnames'; -import { throttle } from 'lodash'; -import { debounce } from 'lodash'; +import { debounce, throttle } from 'lodash'; import PropTypes from 'prop-types'; import React from 'react'; import { defineMessages, injectIntl } from 'react-intl'; import Icon from 'soapbox/components/icon'; -import { formatTime } from 'soapbox/features/video'; -import { getPointerPosition, fileNameFromURL } from 'soapbox/features/video'; +import { formatTime, getPointerPosition, fileNameFromURL } from 'soapbox/features/video'; import Visualizer from './visualizer'; diff --git a/app/soapbox/features/chats/components/chat_panes.js b/app/soapbox/features/chats/components/chat_panes.js index 7232af6e5..74647c98c 100644 --- a/app/soapbox/features/chats/components/chat_panes.js +++ b/app/soapbox/features/chats/components/chat_panes.js @@ -3,8 +3,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { FormattedMessage } from 'react-intl'; -import { injectIntl, defineMessages } from 'react-intl'; +import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import { createSelector } from 'reselect'; diff --git a/app/soapbox/features/compose/components/search_results.js b/app/soapbox/features/compose/components/search_results.js index e4dfa936b..bb816094e 100644 --- a/app/soapbox/features/compose/components/search_results.js +++ b/app/soapbox/features/compose/components/search_results.js @@ -3,8 +3,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { FormattedMessage } from 'react-intl'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Hashtag from 'soapbox/components/hashtag'; import ScrollableList from 'soapbox/components/scrollable_list'; diff --git a/app/soapbox/features/compose/containers/poll_form_container.js b/app/soapbox/features/compose/containers/poll_form_container.js index a0b00709d..04c3b61ee 100644 --- a/app/soapbox/features/compose/containers/poll_form_container.js +++ b/app/soapbox/features/compose/containers/poll_form_container.js @@ -1,7 +1,11 @@ import { connect } from 'react-redux'; -import { addPollOption, removePollOption, changePollOption, changePollSettings, removePoll } from '../../../actions/compose'; import { + addPollOption, + removePollOption, + changePollOption, + changePollSettings, + removePoll, clearComposeSuggestions, fetchComposeSuggestions, selectComposeSuggestion, diff --git a/app/soapbox/features/compose/containers/upload_container.js b/app/soapbox/features/compose/containers/upload_container.js index 332f206ee..21b257fc8 100644 --- a/app/soapbox/features/compose/containers/upload_container.js +++ b/app/soapbox/features/compose/containers/upload_container.js @@ -1,8 +1,7 @@ import { List as ImmutableList } from 'immutable'; import { connect } from 'react-redux'; -import { undoUploadCompose, changeUploadCompose } from '../../../actions/compose'; -import { submitCompose } from '../../../actions/compose'; +import { undoUploadCompose, changeUploadCompose, submitCompose } from '../../../actions/compose'; import { openModal } from '../../../actions/modals'; import Upload from '../components/upload'; diff --git a/app/soapbox/features/filters/index.js b/app/soapbox/features/filters/index.js index 00e32d5f0..f3ba42899 100644 --- a/app/soapbox/features/filters/index.js +++ b/app/soapbox/features/filters/index.js @@ -8,8 +8,7 @@ import { fetchFilters, createFilter, deleteFilter } from 'soapbox/actions/filter import snackbar from 'soapbox/actions/snackbar'; import Icon from 'soapbox/components/icon'; import ScrollableList from 'soapbox/components/scrollable_list'; -import { Button } from 'soapbox/components/ui'; -import { CardHeader, CardTitle, Column, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui'; +import { Button, CardHeader, CardTitle, Column, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui'; import { FieldsGroup, Checkbox, diff --git a/app/soapbox/features/groups/removed_accounts/index.js b/app/soapbox/features/groups/removed_accounts/index.js index a6f0d990b..5227e0af0 100644 --- a/app/soapbox/features/groups/removed_accounts/index.js +++ b/app/soapbox/features/groups/removed_accounts/index.js @@ -3,8 +3,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { FormattedMessage } from 'react-intl'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { Spinner } from 'soapbox/components/ui'; diff --git a/app/soapbox/features/list_adder/index.tsx b/app/soapbox/features/list_adder/index.tsx index 10d706519..191c71b75 100644 --- a/app/soapbox/features/list_adder/index.tsx +++ b/app/soapbox/features/list_adder/index.tsx @@ -1,5 +1,4 @@ -import React from 'react'; -import { useEffect } from 'react'; +import React, { useEffect } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { createSelector } from 'reselect'; diff --git a/app/soapbox/features/list_editor/index.tsx b/app/soapbox/features/list_editor/index.tsx index d495f4b2f..c2a784adc 100644 --- a/app/soapbox/features/list_editor/index.tsx +++ b/app/soapbox/features/list_editor/index.tsx @@ -1,5 +1,4 @@ -import React from 'react'; -import { useEffect } from 'react'; +import React, { useEffect } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { setupListEditor, resetListEditor } from 'soapbox/actions/lists'; diff --git a/app/soapbox/features/lists/index.tsx b/app/soapbox/features/lists/index.tsx index 1f3930c6c..187c05218 100644 --- a/app/soapbox/features/lists/index.tsx +++ b/app/soapbox/features/lists/index.tsx @@ -8,8 +8,7 @@ import { deleteList, fetchLists } from 'soapbox/actions/lists'; import { openModal } from 'soapbox/actions/modals'; import Icon from 'soapbox/components/icon'; import ScrollableList from 'soapbox/components/scrollable_list'; -import { IconButton, Spinner } from 'soapbox/components/ui'; -import { CardHeader, CardTitle } from 'soapbox/components/ui'; +import { CardHeader, CardTitle, IconButton, Spinner } from 'soapbox/components/ui'; import { useAppSelector } from 'soapbox/hooks'; import Column from '../ui/components/column'; diff --git a/app/soapbox/features/notifications/components/notification.tsx b/app/soapbox/features/notifications/components/notification.tsx index 49b1da3af..26feb4b47 100644 --- a/app/soapbox/features/notifications/components/notification.tsx +++ b/app/soapbox/features/notifications/components/notification.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { HotKeys } from 'react-hotkeys'; -import { defineMessages, FormattedMessage, IntlShape, MessageDescriptor } from 'react-intl'; -import { useIntl } from 'react-intl'; +import { defineMessages, useIntl, FormattedMessage, IntlShape, MessageDescriptor } from 'react-intl'; import { useHistory } from 'react-router-dom'; import Icon from 'soapbox/components/icon'; diff --git a/app/soapbox/features/notifications/containers/column_settings_container.js b/app/soapbox/features/notifications/containers/column_settings_container.js index d21733b18..7e01f2fca 100644 --- a/app/soapbox/features/notifications/containers/column_settings_container.js +++ b/app/soapbox/features/notifications/containers/column_settings_container.js @@ -2,8 +2,7 @@ import { defineMessages, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; import { openModal } from 'soapbox/actions/modals'; -import { setFilter } from 'soapbox/actions/notifications'; -import { clearNotifications } from 'soapbox/actions/notifications'; +import { clearNotifications, setFilter } from 'soapbox/actions/notifications'; import { changeAlerts as changePushNotifications } from 'soapbox/actions/push_notifications'; import { getSettings, changeSetting } from 'soapbox/actions/settings'; import { getFeatures } from 'soapbox/utils/features'; diff --git a/app/soapbox/features/status/components/detailed-status.tsx b/app/soapbox/features/status/components/detailed-status.tsx index 1387fd2cf..203a9836e 100644 --- a/app/soapbox/features/status/components/detailed-status.tsx +++ b/app/soapbox/features/status/components/detailed-status.tsx @@ -1,8 +1,7 @@ import classNames from 'classnames'; import React from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { FormattedMessage, injectIntl, WrappedComponentProps as IntlProps } from 'react-intl'; -import { FormattedDate } from 'react-intl'; +import { FormattedDate, FormattedMessage, injectIntl, WrappedComponentProps as IntlProps } from 'react-intl'; import Icon from 'soapbox/components/icon'; import StatusMedia from 'soapbox/components/status-media'; diff --git a/app/soapbox/features/status/index.tsx b/app/soapbox/features/status/index.tsx index 39d768e9f..b3c4452e9 100644 --- a/app/soapbox/features/status/index.tsx +++ b/app/soapbox/features/status/index.tsx @@ -45,8 +45,9 @@ import { hideStatus, revealStatus, editStatus, + fetchStatusWithContext, + fetchNext, } from 'soapbox/actions/statuses'; -import { fetchStatusWithContext, fetchNext } from 'soapbox/actions/statuses'; import MissingIndicator from 'soapbox/components/missing_indicator'; import ScrollableList from 'soapbox/components/scrollable_list'; import { textForScreenReader, defaultMediaVisibility } from 'soapbox/components/status'; diff --git a/app/soapbox/features/ui/components/profile-dropdown.tsx b/app/soapbox/features/ui/components/profile-dropdown.tsx index f364cee68..dd2d8a6fc 100644 --- a/app/soapbox/features/ui/components/profile-dropdown.tsx +++ b/app/soapbox/features/ui/components/profile-dropdown.tsx @@ -4,8 +4,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { useDispatch } from 'react-redux'; import { Link } from 'react-router-dom'; -import { logOut, switchAccount } from 'soapbox/actions/auth'; -import { fetchOwnAccounts } from 'soapbox/actions/auth'; +import { fetchOwnAccounts, logOut, switchAccount } from 'soapbox/actions/auth'; import Account from 'soapbox/components/account'; import { Menu, MenuButton, MenuDivider, MenuItem, MenuLink, MenuList } from 'soapbox/components/ui'; import { useAppSelector, useFeatures } from 'soapbox/hooks'; diff --git a/app/soapbox/features/ui/components/timeline.tsx b/app/soapbox/features/ui/components/timeline.tsx index af3ff8e8c..109fa7dcb 100644 --- a/app/soapbox/features/ui/components/timeline.tsx +++ b/app/soapbox/features/ui/components/timeline.tsx @@ -3,8 +3,7 @@ import { debounce } from 'lodash'; import React, { useCallback } from 'react'; import { defineMessages } from 'react-intl'; -import { dequeueTimeline } from 'soapbox/actions/timelines'; -import { scrollTopTimeline } from 'soapbox/actions/timelines'; +import { dequeueTimeline, scrollTopTimeline } from 'soapbox/actions/timelines'; import ScrollTopButton from 'soapbox/components/scroll-top-button'; import StatusList, { IStatusList } from 'soapbox/components/status_list'; import { useAppSelector, useAppDispatch } from 'soapbox/hooks'; diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index c64e26095..9520320e2 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -29,13 +29,11 @@ import AdminPage from 'soapbox/pages/admin_page'; import DefaultPage from 'soapbox/pages/default_page'; // import GroupsPage from 'soapbox/pages/groups_page'; // import GroupPage from 'soapbox/pages/group_page'; -import EmptyPage from 'soapbox/pages/default_page'; import HomePage from 'soapbox/pages/home_page'; import ProfilePage from 'soapbox/pages/profile_page'; import RemoteInstancePage from 'soapbox/pages/remote_instance_page'; import StatusPage from 'soapbox/pages/status_page'; -import { getAccessToken } from 'soapbox/utils/auth'; -import { getVapidKey } from 'soapbox/utils/auth'; +import { getAccessToken, getVapidKey } from 'soapbox/utils/auth'; import { cacheCurrentUrl } from 'soapbox/utils/redirect'; import { isStandalone } from 'soapbox/utils/state'; // import GroupSidebarPanel from '../groups/sidebar_panel'; @@ -120,6 +118,8 @@ import { WrappedRoute } from './util/react_router_helpers'; // Without this it ends up in ~8 very commonly used bundles. import 'soapbox/components/status'; +const EmptyPage = HomePage; + const isMobile = (width: number): boolean => width <= 1190; const messages = defineMessages({ diff --git a/app/soapbox/features/verification/registration.tsx b/app/soapbox/features/verification/registration.tsx index 400f6b6c4..8b76dce34 100644 --- a/app/soapbox/features/verification/registration.tsx +++ b/app/soapbox/features/verification/registration.tsx @@ -8,8 +8,7 @@ import { logIn, verifyCredentials } from 'soapbox/actions/auth'; import { fetchInstance } from 'soapbox/actions/instance'; import { startOnboarding } from 'soapbox/actions/onboarding'; import snackbar from 'soapbox/actions/snackbar'; -import { createAccount } from 'soapbox/actions/verification'; -import { removeStoredVerification } from 'soapbox/actions/verification'; +import { createAccount, removeStoredVerification } from 'soapbox/actions/verification'; import { Button, Form, FormGroup, Input } from 'soapbox/components/ui'; import { useAppSelector } from 'soapbox/hooks'; import { getRedirectUrl } from 'soapbox/utils/redirect'; diff --git a/app/soapbox/features/verification/steps/email-verification.js b/app/soapbox/features/verification/steps/email-verification.js index fba2862c1..05e463db3 100644 --- a/app/soapbox/features/verification/steps/email-verification.js +++ b/app/soapbox/features/verification/steps/email-verification.js @@ -4,8 +4,7 @@ import { useIntl } from 'react-intl'; import { useDispatch, useSelector } from 'react-redux'; import snackbar from 'soapbox/actions/snackbar'; -import { checkEmailVerification, requestEmailVerification } from 'soapbox/actions/verification'; -import { postEmailVerification } from 'soapbox/actions/verification'; +import { checkEmailVerification, postEmailVerification, requestEmailVerification } from 'soapbox/actions/verification'; import Icon from 'soapbox/components/icon'; import { Button, Form, FormGroup, Input, Text } from 'soapbox/components/ui'; diff --git a/app/soapbox/reducers/contexts.ts b/app/soapbox/reducers/contexts.ts index bfc830c93..73cbd825e 100644 --- a/app/soapbox/reducers/contexts.ts +++ b/app/soapbox/reducers/contexts.ts @@ -11,10 +11,10 @@ import { ACCOUNT_MUTE_SUCCESS, } from '../actions/accounts'; import { + CONTEXT_FETCH_SUCCESS, STATUS_CREATE_REQUEST, STATUS_CREATE_SUCCESS, } from '../actions/statuses'; -import { CONTEXT_FETCH_SUCCESS } from '../actions/statuses'; import { TIMELINE_DELETE } from '../actions/timelines'; import type { ReducerStatus } from './statuses';