From d27216dc4616d80659c0cc5d2a55394e0e1ae874 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 23 May 2023 17:15:17 +0200 Subject: [PATCH] Enforce import order with ESLint (#25096) --- .eslintrc.js | 98 +++++++++---------- app/javascript/mastodon/actions/accounts.js | 1 + .../mastodon/actions/announcements.js | 1 + app/javascript/mastodon/actions/blocks.js | 1 + app/javascript/mastodon/actions/bookmarks.js | 1 + app/javascript/mastodon/actions/compose.js | 5 +- .../mastodon/actions/conversations.js | 1 + app/javascript/mastodon/actions/directory.js | 3 +- app/javascript/mastodon/actions/favourites.js | 1 + app/javascript/mastodon/actions/filters.js | 1 + app/javascript/mastodon/actions/history.js | 1 + .../mastodon/actions/importer/normalizer.js | 3 +- .../mastodon/actions/interactions.js | 1 + app/javascript/mastodon/actions/lists.js | 3 +- app/javascript/mastodon/actions/markers.js | 8 +- app/javascript/mastodon/actions/mutes.js | 1 + .../mastodon/actions/notifications.js | 18 ++-- .../mastodon/actions/pin_statuses.js | 4 +- app/javascript/mastodon/actions/polls.js | 1 + .../actions/push_notifications/index.js | 2 +- .../actions/push_notifications/registerer.js | 7 +- app/javascript/mastodon/actions/reports.js | 1 + app/javascript/mastodon/actions/search.js | 1 + app/javascript/mastodon/actions/server.js | 1 + app/javascript/mastodon/actions/settings.js | 4 +- app/javascript/mastodon/actions/statuses.js | 4 +- app/javascript/mastodon/actions/store.js | 1 + app/javascript/mastodon/actions/streaming.js | 21 ++-- .../mastodon/actions/suggestions.js | 3 +- app/javascript/mastodon/actions/timelines.js | 8 +- app/javascript/mastodon/actions/trends.js | 1 + app/javascript/mastodon/api.js | 1 + .../__tests__/autosuggest_emoji-test.jsx | 1 + .../components/__tests__/avatar-test.jsx | 4 +- .../__tests__/avatar_overlay-test.jsx | 4 +- .../components/__tests__/button-test.jsx | 1 + .../__tests__/display_name-test.jsx | 4 +- .../mastodon/components/account.jsx | 26 +++-- .../mastodon/components/admin/Counter.jsx | 10 +- .../mastodon/components/admin/Dimension.jsx | 8 +- .../components/admin/ReportReasonSelector.jsx | 7 +- .../mastodon/components/admin/Retention.jsx | 7 +- .../mastodon/components/admin/Trends.jsx | 7 +- .../mastodon/components/attachment_list.jsx | 8 +- .../mastodon/components/autosuggest_emoji.jsx | 6 +- .../components/autosuggest_hashtag.jsx | 6 +- .../mastodon/components/autosuggest_input.jsx | 12 ++- .../components/autosuggest_textarea.jsx | 15 ++- .../mastodon/components/avatar_composite.jsx | 5 +- app/javascript/mastodon/components/button.jsx | 3 +- app/javascript/mastodon/components/column.jsx | 4 +- .../components/column_back_button.jsx | 8 +- .../components/column_back_button_slim.jsx | 4 +- .../mastodon/components/column_header.jsx | 7 +- .../components/dismissable_banner.jsx | 7 +- .../mastodon/components/dropdown_menu.jsx | 15 ++- .../containers/dropdown_menu_container.js | 1 + .../components/edited_timestamp/index.jsx | 12 ++- .../mastodon/components/error_boundary.jsx | 10 +- .../mastodon/components/hashtag.jsx | 15 ++- .../mastodon/components/inline_account.jsx | 4 +- .../intersection_observer_article.jsx | 5 +- .../mastodon/components/load_gap.jsx | 4 +- .../mastodon/components/load_more.jsx | 5 +- .../mastodon/components/load_pending.jsx | 5 +- .../mastodon/components/media_attachments.jsx | 7 +- .../mastodon/components/media_gallery.jsx | 17 +++- .../mastodon/components/modal_root.jsx | 5 +- .../mastodon/components/navigation_portal.jsx | 6 +- .../picture_in_picture_placeholder.jsx | 11 ++- app/javascript/mastodon/components/poll.jsx | 18 ++-- .../components/regeneration_indicator.jsx | 1 + .../mastodon/components/scrollable_list.jsx | 24 +++-- .../mastodon/components/server_banner.jsx | 8 +- .../mastodon/components/short_number.jsx | 7 +- app/javascript/mastodon/components/status.jsx | 32 +++--- .../mastodon/components/status_action_bar.jsx | 18 ++-- .../mastodon/components/status_content.jsx | 14 ++- .../mastodon/components/status_list.jsx | 13 ++- .../mastodon/containers/account_container.jsx | 8 +- .../mastodon/containers/admin_component.jsx | 4 +- .../mastodon/containers/compose_container.jsx | 15 +-- .../mastodon/containers/domain_container.jsx | 8 +- .../containers/dropdown_menu_container.js | 8 +- ...intersection_observer_article_container.js | 3 +- .../mastodon/containers/mastodon.jsx | 13 ++- .../mastodon/containers/media_container.jsx | 17 ++-- .../mastodon/containers/poll_container.js | 3 +- .../mastodon/containers/status_container.jsx | 44 +++++---- .../mastodon/features/about/index.jsx | 26 ++--- .../account/components/account_note.jsx | 11 ++- .../account/components/featured_tags.jsx | 5 +- .../components/follow_request_note.jsx | 4 +- .../features/account/components/header.jsx | 23 +++-- .../containers/account_note_container.js | 2 + .../containers/featured_tags_container.js | 8 +- .../follow_request_note_container.js | 4 +- .../mastodon/features/account/navigation.jsx | 4 +- .../account_gallery/components/media_item.jsx | 11 ++- .../features/account_gallery/index.jsx | 35 ++++--- .../account_timeline/components/header.jsx | 13 ++- .../components/limited_account_hint.jsx | 9 +- .../components/moved_note.jsx | 7 +- .../containers/header_container.jsx | 19 ++-- .../features/account_timeline/index.jsx | 37 ++++--- .../mastodon/features/audio/index.jsx | 21 ++-- .../mastodon/features/blocks/index.jsx | 22 +++-- .../features/bookmarked_statuses/index.jsx | 9 +- .../closed_registrations_modal/index.jsx | 6 +- .../components/column_settings.jsx | 7 +- .../containers/column_settings_container.js | 5 +- .../features/community_timeline/index.jsx | 26 +++-- .../compose/components/action_bar.jsx | 9 +- .../components/autosuggest_account.jsx | 5 +- .../compose/components/character_counter.jsx | 3 +- .../compose/components/compose_form.jsx | 37 ++++--- .../components/emoji_picker_dropdown.jsx | 14 ++- .../compose/components/language_dropdown.jsx | 15 ++- .../compose/components/navigation_bar.jsx | 15 ++- .../compose/components/poll_button.jsx | 6 +- .../features/compose/components/poll_form.jsx | 14 ++- .../compose/components/privacy_dropdown.jsx | 13 ++- .../compose/components/reply_indicator.jsx | 12 ++- .../features/compose/components/search.jsx | 12 ++- .../compose/components/search_results.jsx | 14 ++- .../compose/components/text_icon_button.jsx | 2 +- .../features/compose/components/upload.jsx | 13 ++- .../compose/components/upload_button.jsx | 9 +- .../compose/components/upload_form.jsx | 5 +- .../compose/components/upload_progress.jsx | 12 ++- .../features/compose/components/warning.jsx | 6 +- .../autosuggest_account_container.js | 3 +- .../containers/compose_form_container.js | 3 +- .../emoji_picker_dropdown_container.js | 9 +- .../containers/language_dropdown_container.js | 8 +- .../containers/navigation_container.js | 9 +- .../containers/poll_button_container.js | 3 +- .../compose/containers/poll_form_container.js | 3 +- .../containers/privacy_dropdown_container.js | 3 +- .../containers/reply_indicator_container.js | 1 + .../compose/containers/search_container.js | 2 + .../containers/search_results_container.js | 6 +- .../containers/sensitive_button_container.jsx | 12 ++- .../containers/spoiler_button_container.js | 8 +- .../containers/upload_button_container.js | 3 +- .../compose/containers/upload_container.js | 3 +- .../containers/upload_form_container.js | 1 + .../containers/upload_progress_container.js | 1 + .../compose/containers/warning_container.jsx | 8 +- .../mastodon/features/compose/index.jsx | 33 ++++--- .../features/compose/util/url_regex.js | 2 +- .../components/conversation.jsx | 17 ++-- .../components/conversations_list.jsx | 7 +- .../containers/conversation_container.js | 11 ++- .../conversations_list_container.js | 3 +- .../features/direct_timeline/index.jsx | 7 +- .../directory/components/account_card.jsx | 26 ++--- .../mastodon/features/directory/index.jsx | 25 +++-- .../mastodon/features/domain_blocks/index.jsx | 27 ++--- .../emoji/__tests__/emoji_index-test.js | 3 +- .../mastodon/features/emoji/emoji.js | 9 +- .../features/emoji/emoji_compressed.js | 9 +- .../features/emoji/emoji_mart_data_light.js | 2 +- .../mastodon/features/emoji/emoji_picker.js | 2 +- .../emoji/emoji_unicode_mapping_light.js | 1 - .../features/explore/components/story.jsx | 6 +- .../mastodon/features/explore/index.jsx | 23 +++-- .../mastodon/features/explore/links.jsx | 16 +-- .../mastodon/features/explore/results.jsx | 20 ++-- .../mastodon/features/explore/statuses.jsx | 12 ++- .../mastodon/features/explore/suggestions.jsx | 15 +-- .../mastodon/features/explore/tags.jsx | 13 ++- .../features/favourited_statuses/index.jsx | 9 +- .../mastodon/features/favourites/index.jsx | 12 ++- .../features/filters/added_to_filter.jsx | 11 ++- .../features/filters/select_filter.jsx | 12 ++- .../components/account_authorize.jsx | 10 +- .../containers/account_authorize_container.js | 3 +- .../features/follow_requests/index.jsx | 20 ++-- .../mastodon/features/followed_tags/index.jsx | 17 ++-- .../mastodon/features/followers/index.jsx | 27 ++--- .../mastodon/features/following/index.jsx | 27 ++--- .../components/announcements.jsx | 27 ++--- .../getting_started/components/trends.jsx | 10 +- .../containers/announcements_container.js | 10 +- .../containers/trends_container.js | 2 + .../features/getting_started/index.jsx | 26 +++-- .../components/column_settings.jsx | 12 ++- .../containers/column_settings_container.js | 3 +- .../features/hashtag_timeline/index.jsx | 33 ++++--- .../components/column_settings.jsx | 7 +- .../containers/column_settings_container.js | 3 +- .../mastodon/features/home_timeline/index.jsx | 30 +++--- .../features/interaction_modal/index.jsx | 12 ++- .../features/keyboard_shortcuts/index.jsx | 12 ++- .../list_adder/components/account.jsx | 10 +- .../features/list_adder/components/list.jsx | 14 ++- .../mastodon/features/list_adder/index.jsx | 16 +-- .../list_editor/components/account.jsx | 13 ++- .../list_editor/components/edit_list_form.jsx | 9 +- .../list_editor/components/search.jsx | 11 ++- .../mastodon/features/list_editor/index.jsx | 21 ++-- .../mastodon/features/list_timeline/index.jsx | 10 +- .../lists/components/new_list_form.jsx | 9 +- .../mastodon/features/lists/index.jsx | 11 ++- .../mastodon/features/mutes/index.jsx | 27 ++--- .../components/clear_column_button.jsx | 4 +- .../components/column_settings.jsx | 10 +- .../notifications/components/filter_bar.jsx | 4 +- .../components/follow_request.jsx | 12 ++- .../components/grant_permission_button.jsx | 3 +- .../notifications/components/notification.jsx | 29 +++--- .../notifications_permission_banner.jsx | 15 +-- .../notifications/components/report.jsx | 5 +- .../components/setting_toggle.jsx | 4 +- .../containers/column_settings_container.js | 12 ++- .../containers/filter_bar_container.js | 3 +- .../containers/follow_request_container.js | 6 +- .../containers/notification_container.js | 5 +- .../mastodon/features/notifications/index.jsx | 43 ++++---- .../components/progress_indicator.jsx | 6 +- .../features/onboarding/components/step.jsx | 3 +- .../mastodon/features/onboarding/follows.jsx | 18 ++-- .../mastodon/features/onboarding/index.jsx | 30 +++--- .../mastodon/features/onboarding/share.jsx | 22 +++-- .../picture_in_picture/components/footer.jsx | 20 ++-- .../picture_in_picture/components/header.jsx | 14 ++- .../features/picture_in_picture/index.jsx | 13 ++- .../features/pinned_statuses/index.jsx | 14 ++- .../features/privacy_policy/index.jsx | 9 +- .../components/column_settings.jsx | 7 +- .../containers/column_settings_container.js | 5 +- .../features/public_timeline/index.jsx | 24 +++-- .../mastodon/features/reblogs/index.jsx | 23 +++-- .../mastodon/features/report/category.jsx | 10 +- .../mastodon/features/report/comment.jsx | 7 +- .../features/report/components/option.jsx | 4 +- .../report/components/status_check_box.jsx | 16 +-- .../containers/status_check_box_container.js | 4 +- .../mastodon/features/report/rules.jsx | 8 +- .../mastodon/features/report/statuses.jsx | 11 ++- .../mastodon/features/report/thanks.jsx | 9 +- .../features/standalone/compose/index.jsx | 3 +- .../features/status/components/action_bar.jsx | 17 ++-- .../features/status/components/card.jsx | 15 ++- .../status/components/detailed_status.jsx | 34 ++++--- .../containers/detailed_status_container.js | 20 ++-- .../mastodon/features/status/index.jsx | 97 +++++++++--------- .../subscribed_languages_modal/index.jsx | 17 ++-- .../ui/components/__tests__/column-test.jsx | 1 + .../features/ui/components/actions_modal.jsx | 5 +- .../features/ui/components/audio_modal.jsx | 8 +- .../features/ui/components/block_modal.jsx | 18 ++-- .../features/ui/components/boost_modal.jsx | 27 ++--- .../features/ui/components/bundle.jsx | 2 +- .../ui/components/bundle_column_error.jsx | 11 ++- .../ui/components/bundle_modal_error.jsx | 3 +- .../features/ui/components/column.jsx | 9 +- .../features/ui/components/column_header.jsx | 4 +- .../features/ui/components/column_link.jsx | 6 +- .../features/ui/components/column_loading.jsx | 3 +- .../features/ui/components/columns_area.jsx | 16 +-- .../ui/components/compare_history_modal.jsx | 16 +-- .../features/ui/components/compose_panel.jsx | 13 ++- .../ui/components/confirmation_modal.jsx | 4 +- .../ui/components/disabled_account_banner.jsx | 12 ++- .../features/ui/components/embed_modal.jsx | 5 +- .../features/ui/components/filter_modal.jsx | 11 ++- .../ui/components/focal_point_modal.jsx | 38 ++++--- .../follow_requests_column_link.jsx | 15 +-- .../features/ui/components/header.jsx | 16 +-- .../features/ui/components/image_loader.jsx | 5 +- .../features/ui/components/image_modal.jsx | 8 +- .../features/ui/components/link_footer.jsx | 12 ++- .../features/ui/components/list_panel.jsx | 8 +- .../features/ui/components/media_modal.jsx | 26 +++-- .../features/ui/components/modal_root.jsx | 32 +++--- .../features/ui/components/mute_modal.jsx | 12 ++- .../ui/components/navigation_panel.jsx | 8 +- .../components/notifications_counter_icon.js | 1 + .../features/ui/components/report_modal.jsx | 19 ++-- .../features/ui/components/sign_in_banner.jsx | 7 +- .../features/ui/components/upload_area.jsx | 9 +- .../features/ui/components/video_modal.jsx | 10 +- .../features/ui/components/zoomable_image.jsx | 6 +- .../ui/containers/bundle_container.js | 3 +- .../ui/containers/columns_area_container.js | 1 + .../ui/containers/loading_bar_container.js | 1 + .../features/ui/containers/modal_container.js | 1 + .../ui/containers/notifications_container.js | 3 + .../ui/containers/status_list_container.js | 8 +- app/javascript/mastodon/features/ui/index.jsx | 47 +++++---- .../features/ui/util/optional_motion.js | 6 +- .../features/ui/util/react_router_helpers.jsx | 7 +- .../features/ui/util/reduced_motion.jsx | 5 +- .../mastodon/features/video/index.jsx | 18 ++-- app/javascript/mastodon/main.jsx | 5 +- app/javascript/mastodon/reducers/accounts.js | 5 +- .../mastodon/reducers/accounts_counters.js | 6 +- .../mastodon/reducers/accounts_map.js | 5 +- app/javascript/mastodon/reducers/alerts.js | 3 +- .../mastodon/reducers/announcements.js | 3 +- app/javascript/mastodon/reducers/compose.js | 9 +- app/javascript/mastodon/reducers/contexts.js | 3 +- .../mastodon/reducers/conversations.js | 6 +- .../mastodon/reducers/custom_emojis.js | 3 +- .../mastodon/reducers/domain_lists.js | 3 +- .../mastodon/reducers/dropdown_menu.js | 1 + app/javascript/mastodon/reducers/filters.js | 5 +- .../mastodon/reducers/followed_tags.js | 3 +- .../mastodon/reducers/height_cache.js | 1 + app/javascript/mastodon/reducers/history.js | 3 +- .../mastodon/reducers/list_adder.js | 1 + .../mastodon/reducers/list_editor.js | 1 + app/javascript/mastodon/reducers/lists.js | 3 +- app/javascript/mastodon/reducers/markers.js | 3 +- .../mastodon/reducers/media_attachments.js | 3 +- app/javascript/mastodon/reducers/meta.js | 5 +- app/javascript/mastodon/reducers/modal.js | 5 +- .../mastodon/reducers/notifications.js | 32 +++--- .../mastodon/reducers/picture_in_picture.js | 1 + app/javascript/mastodon/reducers/polls.js | 3 +- .../mastodon/reducers/push_notifications.js | 5 +- .../mastodon/reducers/relationships.js | 12 ++- app/javascript/mastodon/reducers/search.js | 13 +-- app/javascript/mastodon/reducers/server.js | 3 +- app/javascript/mastodon/reducers/settings.js | 9 +- .../mastodon/reducers/status_lists.js | 43 ++++---- app/javascript/mastodon/reducers/statuses.js | 5 +- .../mastodon/reducers/suggestions.js | 9 +- app/javascript/mastodon/reducers/tags.js | 3 +- app/javascript/mastodon/reducers/timelines.js | 13 +-- app/javascript/mastodon/reducers/trends.js | 3 +- .../mastodon/reducers/user_lists.js | 42 ++++---- app/javascript/mastodon/selectors/index.js | 4 +- .../mastodon/service_worker/entry.js | 1 + .../service_worker/web_push_notifications.js | 2 + app/javascript/packs/admin.jsx | 6 +- app/javascript/packs/application.js | 2 +- app/javascript/packs/public.jsx | 29 +++--- app/javascript/packs/share.jsx | 9 +- app/javascript/packs/sign_up.js | 3 +- .../packs/two_factor_authentication.js | 3 +- config/webpack/configuration.js | 3 +- config/webpack/development.js | 3 +- config/webpack/generateLocalePacks.js | 3 +- config/webpack/production.js | 8 +- config/webpack/rules/babel.js | 1 + config/webpack/rules/file.js | 1 + config/webpack/rules/index.js | 2 +- config/webpack/rules/node_modules.js | 1 + config/webpack/shared.js | 8 +- config/webpack/tests.js | 1 + config/webpack/translationRunner.js | 2 + streaming/index.js | 13 +-- 355 files changed, 2304 insertions(+), 1366 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 774109367..2b0907b1d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -198,6 +198,55 @@ module.exports = { 'import/no-useless-path-segments': 'error', 'import/no-webpack-loader-syntax': 'error', + 'import/order': [ + 'error', + { + alphabetize: { order: 'asc' }, + 'newlines-between': 'always', + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + ['index', 'sibling'], + 'object', + ], + pathGroups: [ + // React core packages + { + pattern: '{react,react-dom,react-dom/client,prop-types}', + group: 'builtin', + position: 'after', + }, + // I18n + { + pattern: '{react-intl,intl-messageformat}', + group: 'builtin', + position: 'after', + }, + // Common React utilities + { + pattern: '{classnames,react-helmet,react-router-dom}', + group: 'external', + position: 'before', + }, + // Immutable / Redux / data store + { + pattern: '{immutable,react-redux,react-immutable-proptypes,react-immutable-pure-component,reselect}', + group: 'external', + position: 'before', + }, + // Internal packages + { + pattern: '{mastodon/**}', + group: 'internal', + position: 'after', + }, + ], + pathGroupsExcludedImportTypes: [], + }, + ], + 'promise/always-return': 'off', 'promise/catch-or-return': [ 'error', @@ -286,55 +335,6 @@ module.exports = { rules: { 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], - 'import/order': [ - 'error', - { - alphabetize: { order: 'asc' }, - 'newlines-between': 'always', - groups: [ - 'builtin', - 'external', - 'internal', - 'parent', - ['index', 'sibling'], - 'object', - ], - pathGroups: [ - // React core packages - { - pattern: '{react,react-dom,prop-types}', - group: 'builtin', - position: 'after', - }, - // I18n - { - pattern: 'react-intl', - group: 'builtin', - position: 'after', - }, - // Common React utilities - { - pattern: '{classnames,react-helmet}', - group: 'external', - position: 'before', - }, - // Immutable / Redux / data store - { - pattern: '{immutable,react-redux,react-immutable-proptypes,react-immutable-pure-component,reselect}', - group: 'external', - position: 'before', - }, - // Internal packages - { - pattern: '{mastodon/**}', - group: 'internal', - position: 'after', - }, - ], - pathGroupsExcludedImportTypes: [], - }, - ], - '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'], '@typescript-eslint/consistent-type-exports': 'error', '@typescript-eslint/consistent-type-imports': 'error', diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/mastodon/actions/accounts.js index 88407ae6c..3a85393d6 100644 --- a/app/javascript/mastodon/actions/accounts.js +++ b/app/javascript/mastodon/actions/accounts.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedAccount, importFetchedAccounts } from './importer'; export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/announcements.js b/app/javascript/mastodon/actions/announcements.js index 586dcfd33..339c5f3ad 100644 --- a/app/javascript/mastodon/actions/announcements.js +++ b/app/javascript/mastodon/actions/announcements.js @@ -1,4 +1,5 @@ import api from '../api'; + import { normalizeAnnouncement } from './importer/normalizer'; export const ANNOUNCEMENTS_FETCH_REQUEST = 'ANNOUNCEMENTS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/blocks.js b/app/javascript/mastodon/actions/blocks.js index 192aa3ce4..66421ed45 100644 --- a/app/javascript/mastodon/actions/blocks.js +++ b/app/javascript/mastodon/actions/blocks.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; import { openModal } from './modal'; diff --git a/app/javascript/mastodon/actions/bookmarks.js b/app/javascript/mastodon/actions/bookmarks.js index 3c8eec546..0b16f61e6 100644 --- a/app/javascript/mastodon/actions/bookmarks.js +++ b/app/javascript/mastodon/actions/bookmarks.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const BOOKMARKED_STATUSES_FETCH_REQUEST = 'BOOKMARKED_STATUSES_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index bf504b88a..22454cf3d 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -1,9 +1,12 @@ +import { defineMessages } from 'react-intl'; + import axios from 'axios'; import { throttle } from 'lodash'; -import { defineMessages } from 'react-intl'; + import api from 'mastodon/api'; import { search as emojiSearch } from 'mastodon/features/emoji/emoji_mart_search_light'; import { tagHistory } from 'mastodon/settings'; + import { showAlert, showAlertForError } from './alerts'; import { useEmoji } from './emojis'; import { importFetchedAccounts, importFetchedStatus } from './importer'; diff --git a/app/javascript/mastodon/actions/conversations.js b/app/javascript/mastodon/actions/conversations.js index 4ef654b1f..8c4c4529f 100644 --- a/app/javascript/mastodon/actions/conversations.js +++ b/app/javascript/mastodon/actions/conversations.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedAccounts, importFetchedStatuses, diff --git a/app/javascript/mastodon/actions/directory.js b/app/javascript/mastodon/actions/directory.js index 4b2b6dd56..cda63f2b5 100644 --- a/app/javascript/mastodon/actions/directory.js +++ b/app/javascript/mastodon/actions/directory.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { fetchRelationships } from './accounts'; +import { importFetchedAccounts } from './importer'; export const DIRECTORY_FETCH_REQUEST = 'DIRECTORY_FETCH_REQUEST'; export const DIRECTORY_FETCH_SUCCESS = 'DIRECTORY_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/favourites.js b/app/javascript/mastodon/actions/favourites.js index 7388e0c58..2d4d4e620 100644 --- a/app/javascript/mastodon/actions/favourites.js +++ b/app/javascript/mastodon/actions/favourites.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/filters.js b/app/javascript/mastodon/actions/filters.js index e9c609fc8..3774ee042 100644 --- a/app/javascript/mastodon/actions/filters.js +++ b/app/javascript/mastodon/actions/filters.js @@ -1,4 +1,5 @@ import api from '../api'; + import { openModal } from './modal'; export const FILTERS_FETCH_REQUEST = 'FILTERS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/history.js b/app/javascript/mastodon/actions/history.js index c142aaf61..52401b7dc 100644 --- a/app/javascript/mastodon/actions/history.js +++ b/app/javascript/mastodon/actions/history.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccounts } from './importer'; export const HISTORY_FETCH_REQUEST = 'HISTORY_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/importer/normalizer.js b/app/javascript/mastodon/actions/importer/normalizer.js index 8a22f83fa..61062fd2c 100644 --- a/app/javascript/mastodon/actions/importer/normalizer.js +++ b/app/javascript/mastodon/actions/importer/normalizer.js @@ -1,7 +1,8 @@ import escapeTextContentForBrowser from 'escape-html'; + import emojify from '../../features/emoji/emoji'; -import { unescapeHTML } from '../../utils/html'; import { expandSpoilers } from '../../initial_state'; +import { unescapeHTML } from '../../utils/html'; const domParser = new DOMParser(); diff --git a/app/javascript/mastodon/actions/interactions.js b/app/javascript/mastodon/actions/interactions.js index bc35736ff..092a67ea7 100644 --- a/app/javascript/mastodon/actions/interactions.js +++ b/app/javascript/mastodon/actions/interactions.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccounts, importFetchedStatus } from './importer'; export const REBLOG_REQUEST = 'REBLOG_REQUEST'; diff --git a/app/javascript/mastodon/actions/lists.js b/app/javascript/mastodon/actions/lists.js index 5ab922436..2faa54b95 100644 --- a/app/javascript/mastodon/actions/lists.js +++ b/app/javascript/mastodon/actions/lists.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { showAlertForError } from './alerts'; +import { importFetchedAccounts } from './importer'; export const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST'; export const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/markers.js b/app/javascript/mastodon/actions/markers.js index b23ecccc3..cfc329a8b 100644 --- a/app/javascript/mastodon/actions/markers.js +++ b/app/javascript/mastodon/actions/markers.js @@ -1,8 +1,10 @@ -import api from '../api'; -import { debounce } from 'lodash'; -import { compareId } from '../compare_id'; import { List as ImmutableList } from 'immutable'; +import { debounce } from 'lodash'; + +import api from '../api'; +import { compareId } from '../compare_id'; + export const MARKERS_FETCH_REQUEST = 'MARKERS_FETCH_REQUEST'; export const MARKERS_FETCH_SUCCESS = 'MARKERS_FETCH_SUCCESS'; export const MARKERS_FETCH_FAIL = 'MARKERS_FETCH_FAIL'; diff --git a/app/javascript/mastodon/actions/mutes.js b/app/javascript/mastodon/actions/mutes.js index cbc42a67e..e61a14af2 100644 --- a/app/javascript/mastodon/actions/mutes.js +++ b/app/javascript/mastodon/actions/mutes.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; import { openModal } from './modal'; diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index 0c58f8d15..c040edb58 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -1,5 +1,15 @@ -import api, { getLinks } from '../api'; import IntlMessageFormat from 'intl-messageformat'; +import { defineMessages } from 'react-intl'; + +import { List as ImmutableList } from 'immutable'; + +import { compareId } from 'mastodon/compare_id'; +import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; + +import api, { getLinks } from '../api'; +import { unescapeHTML } from '../utils/html'; +import { requestNotificationPermission } from '../utils/notifications'; + import { fetchFollowRequests, fetchRelationships } from './accounts'; import { importFetchedAccount, @@ -9,12 +19,6 @@ import { } from './importer'; import { submitMarkers } from './markers'; import { saveSettings } from './settings'; -import { defineMessages } from 'react-intl'; -import { List as ImmutableList } from 'immutable'; -import { unescapeHTML } from '../utils/html'; -import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; -import { compareId } from 'mastodon/compare_id'; -import { requestNotificationPermission } from '../utils/notifications'; export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; export const NOTIFICATIONS_UPDATE_NOOP = 'NOTIFICATIONS_UPDATE_NOOP'; diff --git a/app/javascript/mastodon/actions/pin_statuses.js b/app/javascript/mastodon/actions/pin_statuses.js index 1e4bd37bf..baa10d156 100644 --- a/app/javascript/mastodon/actions/pin_statuses.js +++ b/app/javascript/mastodon/actions/pin_statuses.js @@ -1,8 +1,8 @@ import api from '../api'; -import { importFetchedStatuses } from './importer'; - import { me } from '../initial_state'; +import { importFetchedStatuses } from './importer'; + export const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST'; export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS'; export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL'; diff --git a/app/javascript/mastodon/actions/polls.js b/app/javascript/mastodon/actions/polls.js index 8e8b82df5..a37410dc9 100644 --- a/app/javascript/mastodon/actions/polls.js +++ b/app/javascript/mastodon/actions/polls.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedPoll } from './importer'; export const POLL_VOTE_REQUEST = 'POLL_VOTE_REQUEST'; diff --git a/app/javascript/mastodon/actions/push_notifications/index.js b/app/javascript/mastodon/actions/push_notifications/index.js index 9dcc4bd4b..46b63867f 100644 --- a/app/javascript/mastodon/actions/push_notifications/index.js +++ b/app/javascript/mastodon/actions/push_notifications/index.js @@ -1,5 +1,5 @@ -import { setAlerts } from './setter'; import { saveSettings } from './registerer'; +import { setAlerts } from './setter'; export function changeAlerts(path, value) { return dispatch => { diff --git a/app/javascript/mastodon/actions/push_notifications/registerer.js b/app/javascript/mastodon/actions/push_notifications/registerer.js index b491f85c2..b3d3850e3 100644 --- a/app/javascript/mastodon/actions/push_notifications/registerer.js +++ b/app/javascript/mastodon/actions/push_notifications/registerer.js @@ -1,8 +1,9 @@ import api from '../../api'; -import { decode as decodeBase64 } from '../../utils/base64'; -import { pushNotificationsSetting } from '../../settings'; -import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; import { me } from '../../initial_state'; +import { pushNotificationsSetting } from '../../settings'; +import { decode as decodeBase64 } from '../../utils/base64'; + +import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; // Taken from https://www.npmjs.com/package/web-push const urlBase64ToUint8Array = (base64String) => { diff --git a/app/javascript/mastodon/actions/reports.js b/app/javascript/mastodon/actions/reports.js index fbe5b3791..b3f9bf1ac 100644 --- a/app/javascript/mastodon/actions/reports.js +++ b/app/javascript/mastodon/actions/reports.js @@ -1,4 +1,5 @@ import api from '../api'; + import { openModal } from './modal'; export const REPORT_SUBMIT_REQUEST = 'REPORT_SUBMIT_REQUEST'; diff --git a/app/javascript/mastodon/actions/search.js b/app/javascript/mastodon/actions/search.js index 605a457a2..94e7f2ed7 100644 --- a/app/javascript/mastodon/actions/search.js +++ b/app/javascript/mastodon/actions/search.js @@ -1,4 +1,5 @@ import api from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts, importFetchedStatuses } from './importer'; diff --git a/app/javascript/mastodon/actions/server.js b/app/javascript/mastodon/actions/server.js index 091af0f0f..bd784906d 100644 --- a/app/javascript/mastodon/actions/server.js +++ b/app/javascript/mastodon/actions/server.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccount } from './importer'; export const SERVER_FETCH_REQUEST = 'Server_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/settings.js b/app/javascript/mastodon/actions/settings.js index 6ae001b6f..3685b0684 100644 --- a/app/javascript/mastodon/actions/settings.js +++ b/app/javascript/mastodon/actions/settings.js @@ -1,5 +1,7 @@ -import api from '../api'; import { debounce } from 'lodash'; + +import api from '../api'; + import { showAlertForError } from './alerts'; export const SETTING_CHANGE = 'SETTING_CHANGE'; diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js index 275280a53..84a1271b8 100644 --- a/app/javascript/mastodon/actions/statuses.js +++ b/app/javascript/mastodon/actions/statuses.js @@ -1,8 +1,8 @@ import api from '../api'; -import { deleteFromTimelines } from './timelines'; -import { importFetchedStatus, importFetchedStatuses, importFetchedAccount } from './importer'; import { ensureComposeIsVisible, setComposeToStatus } from './compose'; +import { importFetchedStatus, importFetchedStatuses, importFetchedAccount } from './importer'; +import { deleteFromTimelines } from './timelines'; export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST'; export const STATUS_FETCH_SUCCESS = 'STATUS_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/store.js b/app/javascript/mastodon/actions/store.js index b3030467b..6b0743439 100644 --- a/app/javascript/mastodon/actions/store.js +++ b/app/javascript/mastodon/actions/store.js @@ -1,4 +1,5 @@ import { Iterable, fromJS } from 'immutable'; + import { hydrateCompose } from './compose'; import { importFetchedAccounts } from './importer'; diff --git a/app/javascript/mastodon/actions/streaming.js b/app/javascript/mastodon/actions/streaming.js index 7831f261e..562e72655 100644 --- a/app/javascript/mastodon/actions/streaming.js +++ b/app/javascript/mastodon/actions/streaming.js @@ -1,6 +1,17 @@ // @ts-check +import { getLocale } from '../locales'; import { connectStream } from '../stream'; + +import { + fetchAnnouncements, + updateAnnouncements, + updateReaction as updateAnnouncementsReaction, + deleteAnnouncement, +} from './announcements'; +import { updateConversations } from './conversations'; +import { updateNotifications, expandNotifications } from './notifications'; +import { updateStatus } from './statuses'; import { updateTimeline, deleteFromTimelines, @@ -12,16 +23,6 @@ import { fillCommunityTimelineGaps, fillListTimelineGaps, } from './timelines'; -import { updateNotifications, expandNotifications } from './notifications'; -import { updateConversations } from './conversations'; -import { updateStatus } from './statuses'; -import { - fetchAnnouncements, - updateAnnouncements, - updateReaction as updateAnnouncementsReaction, - deleteAnnouncement, -} from './announcements'; -import { getLocale } from '../locales'; const { messages } = getLocale(); diff --git a/app/javascript/mastodon/actions/suggestions.js b/app/javascript/mastodon/actions/suggestions.js index 9e8cd1ea4..870a31102 100644 --- a/app/javascript/mastodon/actions/suggestions.js +++ b/app/javascript/mastodon/actions/suggestions.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { fetchRelationships } from './accounts'; +import { importFetchedAccounts } from './importer'; export const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST'; export const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index e9e3a8e24..96dc4a2a1 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -1,10 +1,12 @@ -import { importFetchedStatus, importFetchedStatuses } from './importer'; -import { submitMarkers } from './markers'; -import api, { getLinks } from 'mastodon/api'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; + +import api, { getLinks } from 'mastodon/api'; import { compareId } from 'mastodon/compare_id'; import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; +import { importFetchedStatus, importFetchedStatuses } from './importer'; +import { submitMarkers } from './markers'; + export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; export const TIMELINE_DELETE = 'TIMELINE_DELETE'; export const TIMELINE_CLEAR = 'TIMELINE_CLEAR'; diff --git a/app/javascript/mastodon/actions/trends.js b/app/javascript/mastodon/actions/trends.js index edda0b5b5..d31442388 100644 --- a/app/javascript/mastodon/actions/trends.js +++ b/app/javascript/mastodon/actions/trends.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const TRENDS_TAGS_FETCH_REQUEST = 'TRENDS_TAGS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/api.js b/app/javascript/mastodon/api.js index 42b64d6cc..1c171a1c4 100644 --- a/app/javascript/mastodon/api.js +++ b/app/javascript/mastodon/api.js @@ -2,6 +2,7 @@ import axios from 'axios'; import LinkHeader from 'http-link-header'; + import ready from './ready'; /** diff --git a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx index 80aa33a18..2603420ae 100644 --- a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx +++ b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx @@ -1,4 +1,5 @@ import renderer from 'react-test-renderer'; + import AutosuggestEmoji from '../autosuggest_emoji'; describe('', () => { diff --git a/app/javascript/mastodon/components/__tests__/avatar-test.jsx b/app/javascript/mastodon/components/__tests__/avatar-test.jsx index b20c6f4e3..21c3ae580 100644 --- a/app/javascript/mastodon/components/__tests__/avatar-test.jsx +++ b/app/javascript/mastodon/components/__tests__/avatar-test.jsx @@ -1,5 +1,7 @@ -import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; + +import renderer from 'react-test-renderer'; + import { Avatar } from '../avatar'; describe('', () => { diff --git a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx index c03a9aa9d..99a440af7 100644 --- a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx +++ b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx @@ -1,5 +1,7 @@ -import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; + +import renderer from 'react-test-renderer'; + import { AvatarOverlay } from '../avatar_overlay'; describe(' { diff --git a/app/javascript/mastodon/components/__tests__/button-test.jsx b/app/javascript/mastodon/components/__tests__/button-test.jsx index 82d307e84..6de961f78 100644 --- a/app/javascript/mastodon/components/__tests__/button-test.jsx +++ b/app/javascript/mastodon/components/__tests__/button-test.jsx @@ -1,5 +1,6 @@ import { render, fireEvent, screen } from '@testing-library/react'; import renderer from 'react-test-renderer'; + import Button from '../button'; describe('