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 | 6 +- 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 | 5 +- 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 | 24 +++-- .../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 | 6 +- .../components/column_back_button_slim.jsx | 4 +- .../mastodon/components/column_header.jsx | 7 +- .../components/dismissable_banner.jsx | 7 +- .../mastodon/components/dropdown_menu.jsx | 13 ++- .../containers/dropdown_menu_container.js | 1 + .../components/edited_timestamp/index.jsx | 12 ++- .../mastodon/components/error_boundary.jsx | 10 +- .../mastodon/components/hashtag.jsx | 13 ++- .../mastodon/components/inline_account.jsx | 4 +- .../intersection_observer_article.jsx | 5 +- .../mastodon/components/load_gap.jsx | 4 +- .../mastodon/components/load_more.jsx | 3 +- .../mastodon/components/load_pending.jsx | 3 +- .../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 | 16 ++- .../components/regeneration_indicator.jsx | 1 + .../mastodon/components/scrollable_list.jsx | 22 +++-- .../mastodon/components/server_banner.jsx | 8 +- .../mastodon/components/short_number.jsx | 7 +- app/javascript/mastodon/components/status.jsx | 30 +++--- .../mastodon/components/status_action_bar.jsx | 18 ++-- .../mastodon/components/status_content.jsx | 12 ++- .../mastodon/components/status_list.jsx | 13 ++- .../mastodon/containers/account_container.jsx | 8 +- .../mastodon/containers/admin_component.jsx | 4 +- .../mastodon/containers/compose_container.jsx | 13 ++- .../mastodon/containers/domain_container.jsx | 6 +- .../containers/dropdown_menu_container.js | 6 +- ...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 | 22 +++-- .../account/components/account_note.jsx | 9 +- .../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 | 6 +- .../follow_request_note_container.js | 4 +- .../mastodon/features/account/navigation.jsx | 4 +- .../account_gallery/components/media_item.jsx | 11 ++- .../features/account_gallery/index.jsx | 31 +++--- .../account_timeline/components/header.jsx | 13 ++- .../components/limited_account_hint.jsx | 7 +- .../components/moved_note.jsx | 7 +- .../containers/header_container.jsx | 17 ++-- .../features/account_timeline/index.jsx | 31 +++--- .../mastodon/features/audio/index.jsx | 19 ++-- .../mastodon/features/blocks/index.jsx | 18 ++-- .../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 | 24 +++-- .../compose/components/action_bar.jsx | 7 +- .../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 | 13 ++- .../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 | 10 +- .../features/compose/components/warning.jsx | 6 +- .../autosuggest_account_container.js | 3 +- .../containers/compose_form_container.js | 3 +- .../emoji_picker_dropdown_container.js | 7 +- .../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 | 10 +- .../containers/spoiler_button_container.js | 6 +- .../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 | 23 +++-- .../mastodon/features/domain_blocks/index.jsx | 21 ++-- .../emoji/__tests__/emoji_index-test.js | 3 +- .../mastodon/features/emoji/emoji.js | 7 +- .../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 | 19 ++-- .../mastodon/features/explore/links.jsx | 12 ++- .../mastodon/features/explore/results.jsx | 16 +-- .../mastodon/features/explore/statuses.jsx | 12 ++- .../mastodon/features/explore/suggestions.jsx | 11 ++- .../mastodon/features/explore/tags.jsx | 11 ++- .../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 | 6 +- .../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 | 29 +++--- .../components/column_settings.jsx | 7 +- .../containers/column_settings_container.js | 3 +- .../mastodon/features/home_timeline/index.jsx | 28 +++--- .../features/interaction_modal/index.jsx | 12 ++- .../features/keyboard_shortcuts/index.jsx | 10 +- .../list_adder/components/account.jsx | 10 +- .../features/list_adder/components/list.jsx | 14 ++- .../mastodon/features/list_adder/index.jsx | 14 ++- .../list_editor/components/account.jsx | 13 ++- .../list_editor/components/edit_list_form.jsx | 7 +- .../list_editor/components/search.jsx | 11 ++- .../mastodon/features/list_editor/index.jsx | 15 ++- .../mastodon/features/list_timeline/index.jsx | 8 +- .../lists/components/new_list_form.jsx | 7 +- .../mastodon/features/lists/index.jsx | 11 ++- .../mastodon/features/mutes/index.jsx | 21 ++-- .../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 | 25 +++-- .../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 | 4 +- .../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 | 26 +++-- .../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 | 11 ++- .../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 | 22 +++-- .../mastodon/features/reblogs/index.jsx | 21 ++-- .../mastodon/features/report/category.jsx | 10 +- .../mastodon/features/report/comment.jsx | 7 +- .../features/report/components/option.jsx | 4 +- .../report/components/status_check_box.jsx | 14 ++- .../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 | 15 ++- .../features/status/components/card.jsx | 15 ++- .../status/components/detailed_status.jsx | 34 ++++--- .../containers/detailed_status_container.js | 20 ++-- .../mastodon/features/status/index.jsx | 89 +++++++++-------- .../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 | 14 +-- .../features/ui/components/boost_modal.jsx | 25 +++-- .../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 | 4 +- .../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 | 11 ++- .../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 | 34 ++++--- .../follow_requests_column_link.jsx | 13 ++- .../features/ui/components/header.jsx | 14 ++- .../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 | 24 +++-- .../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 | 41 ++++---- .../features/ui/util/optional_motion.js | 4 +- .../features/ui/util/react_router_helpers.jsx | 7 +- .../features/ui/util/reduced_motion.jsx | 3 +- .../mastodon/features/video/index.jsx | 16 ++- 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 | 27 ++--- 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, 2207 insertions(+), 1269 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7741093674e9f58560b7f5f30aaf557f94e3953f..2b0907b1d599b1d3571ab3dbad44aafe200330e6 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 88407ae6cf34996a0761c5431f45f299f5e89766..3a85393d6cf273c76e4341cc8924122d4c27578b 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 586dcfd33715676d79a83cd241d8a6e4e2d4e367..339c5f3adc5a8e73f86636a21927298568d6ef2c 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 192aa3ce4003d96134e7882b8fbb5295f2eeca09..66421ed45583b510da0da82c75ebc86fc63888be 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 3c8eec546879e40d56e7cf9d384d26805a209b72..0b16f61e63635a648e0724eaa4c95a0dcfae8026 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 bf504b88a8dd8eb1c176a30ef2ea3966dff21349..22454cf3df8a876ad54bebcfb2d9b619dc0d980e 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 4ef654b1f902413a81a2ba0274e9252754e7836c..8c4c4529fb7e8b73fae59ee7cd85dbb83cdaedef 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 4b2b6dd56dce58aa588f71b75a449bd804415afe..cda63f2b5a43ebee3a2515d91fc00e71209cf8e9 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 7388e0c5809ffe39377f6ca713c2a60116f85084..2d4d4e6206e845ec126575585c77264d80535b57 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 e9c609fc87c9bedcd3907c3984d3dceff8911a36..3774ee042a1b08bd0c22ec8e3357f2262856e70d 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 c142aaf617e2cbbbd7d5530f270e247c6ff2eb61..52401b7dce3f9556fbfe3403665da3f763cc3734 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 8a22f83fa4314c619a951db84999b3e2ba5771c4..61062fd2c88202ba5f07d666930340d2eb74991c 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 bc35736ffa6fed100965f477e782f89ae8741c01..092a67ea7583d2973f20dd0625c7db70695aacf4 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 5ab9224363fe6f61a6291e3d3567712b0d7b26bc..2faa54b955f4fe2c59689bbf11d91c59bf43f1f0 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 b23ecccc3960b0b8e872814930eee949d756efd8..cfc329a8b75b91bd4a67f7c1ad07d79e9cd42fe9 100644 --- a/app/javascript/mastodon/actions/markers.js +++ b/app/javascript/mastodon/actions/markers.js @@ -1,7 +1,9 @@ -import api from '../api'; +import { List as ImmutableList } from 'immutable'; + import { debounce } from 'lodash'; + +import api from '../api'; import { compareId } from '../compare_id'; -import { List as ImmutableList } from 'immutable'; export const MARKERS_FETCH_REQUEST = 'MARKERS_FETCH_REQUEST'; export const MARKERS_FETCH_SUCCESS = 'MARKERS_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/mutes.js b/app/javascript/mastodon/actions/mutes.js index cbc42a67eb891f689ab3ea381f6941bd1062ec99..e61a14af24bf1442feb66fb5a8effbaea14689fd 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 0c58f8d159fb97b1422005d4a728a430e1912ae1..c040edb58b84f4072f9676430320f96e87733f12 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 1e4bd37bf070ea9d30e89f49aeb0eafe7e3b1eb7..baa10d15627d6625ca67391dba0a5ec3836749ce 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 8e8b82df5d0eed2a52cb9487f919f2aae4db4454..a37410dc90fa4df5dd31312b2a220968cd819a04 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 9dcc4bd4bb447214b438484d7e5495de8ab24de3..46b63867f1c2247483b1195d1905d33ba5775abe 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 b491f85c2414d8e66adea9832c99b51081a33551..b3d3850e31d1150aefbed48c0ef46c7710b72700 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 { me } from '../../initial_state'; import { pushNotificationsSetting } from '../../settings'; +import { decode as decodeBase64 } from '../../utils/base64'; + import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; -import { me } from '../../initial_state'; // 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 fbe5b3791bcf66195b28c235c4c4c080a37f500e..b3f9bf1ac3126430d27674f8a8c653da7fc4569b 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 605a457a2e29e037c8c720e13d2f0b86a9835695..94e7f2ed75c1ed663083749fac9ebf6ae8e02176 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 091af0f0fe01cd89ae17dd4bca45263a42ca4ce5..bd784906d4edc8fd1abce9a672038a7d88ad2c30 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 6ae001b6ff90f5d919829930c3aa3958aa0b40f7..3685b0684e0b83fffaa76f2304c4ab98b03b0d88 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 275280a537e8d1188aae57d203eac7a7fcbc7fb0..84a1271b8b86ebb8bf5d88e97d848ac17c09f335 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 b3030467b38bc501391e328321e9576ed9f8ae11..6b0743439b3fce2027f14b24c438891ba1024886 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 7831f261e69aec1a555cbc56d570dd1cea54f8de..562e72655c801b577ee4d765cac77289aefec0f2 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 9e8cd1ea40b574ef5382ed8371d34bfbe1220cb3..870a311024d12fd501f6818b2a51b494cece0896 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 e9e3a8e240a676dcad706ba3c6e6a59b2af40104..96dc4a2a1e317496464fae3301eb00840b2abe81 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 edda0b5b5d0eb5afa1b59601d28b1dfda4aaa6a2..d314423884efe153c4e20ef418c57e08fbe0c845 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 42b64d6cc5b6ba64f472fd795280ff6326be840c..1c171a1c4aa5d43f135cd55e0e04b9b18910623e 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 80aa33a187ad819f036512e1ae7b95fe4a13a743..2603420aec4d2e13c51e89146f822710ec99f1bf 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 b20c6f4e394c7de90e80527a1fe45ababd9263e7..21c3ae58005562ba443287539a095768a0f03c62 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 c03a9aa9d0dac8c02c13f5a2e4ce6df51a4202d9..99a440af7c8c6290205d32758466428040f7e4c4 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 82d307e84302ccde4ef0d0cde32eb6a7a25d5bb8..6de961f784ebf5686cc1e18fd78f4e0dbbb7c6b4 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('