diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-23 21:10:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-23 21:10:24 +0000 |
commit | 5838993b5f3e2d861d9dd7c82dfeea71506b9fc2 (patch) | |
tree | caab6621fb79f06a355f802dc885982f746b544d | |
parent | b8d021cb606ac86f41a0ef9dacd133a9677f8414 (diff) | |
download | gitlab-ce-5838993b5f3e2d861d9dd7c82dfeea71506b9fc2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
1140 files changed, 4303 insertions, 5430 deletions
diff --git a/.gitlab/issue_templates/Security developer workflow.md b/.gitlab/issue_templates/Security developer workflow.md index 840ef4c6337..3de004b0319 100644 --- a/.gitlab/issue_templates/Security developer workflow.md +++ b/.gitlab/issue_templates/Security developer workflow.md @@ -9,6 +9,7 @@ Set the title to: `Description of the original issue` ## Prior to starting the security release work - [ ] Read the [security process for developers] if you are not familiar with it. + - Verify if the issue you're working on `gitlab-org/gitlab` is confidential, if it's public fix should be placed on GitLab canonical and no backports are required. - [ ] Mark this [issue as related] to the Security Release Tracking Issue. You can find it on the topic of the `#releases` Slack channel. - Fill out the [Links section](#links): - [ ] Next to **Issue on GitLab**, add a link to the `gitlab-org/gitlab` issue that describes the security vulnerability. diff --git a/.prettierignore b/.prettierignore index 36d7c91a639..d582d727558 100644 --- a/.prettierignore +++ b/.prettierignore @@ -10,329 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql *.scss *.md -## boring-bohr -jest.config.base.js -jest.config.js -scripts/frontend/block_dependencies.js -scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js -scripts/frontend/extract_gettext_all.js -scripts/frontend/file_test_coverage.js -scripts/frontend/frontend_script_utils.js -scripts/frontend/merge_coverage_frontend.js -scripts/frontend/prettier.js -scripts/frontend/stylelint/stylelint-utility-map.js -scripts/frontend/stylelint/stylelint-utils.js -app/assets/javascripts/access_tokens/index.js -app/assets/javascripts/activities.js -app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue -app/assets/javascripts/add_context_commits_modal/store/actions.js - -## interesting-kepler -app/assets/javascripts/add_context_commits_modal/utils.js -app/assets/javascripts/admin/application_settings/setup_metrics_and_profiling.js -app/assets/javascripts/admin/statistics_panel/store/actions.js -app/assets/javascripts/admin/statistics_panel/store/getters.js -app/assets/javascripts/admin/users/components/users_table.vue -app/assets/javascripts/admin/users/index.js -app/assets/javascripts/alert_handler.js -app/assets/javascripts/alert_management/components/alert_details.vue -app/assets/javascripts/alert_management/components/alert_management_table.vue -app/assets/javascripts/alert_management/components/alert_metrics.vue -app/assets/javascripts/alert_management/components/alert_status.vue -app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue -app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue -app/assets/javascripts/alert_management/details.js -app/assets/javascripts/alert_management/list.js -app/assets/javascripts/alerts_service_settings/components/alerts_service_form.vue -app/assets/javascripts/alerts_service_settings/index.js -app/assets/javascripts/alerts_settings/components/alert_mapping_builder.vue -app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue -app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue -app/assets/javascripts/alerts_settings/graphql.js -app/assets/javascripts/alerts_settings/index.js -app/assets/javascripts/alerts_settings/utils/cache_updates.js -app/assets/javascripts/analytics/instance_statistics/components/instance_statistics_count_chart.vue -app/assets/javascripts/analytics/instance_statistics/components/projects_and_groups_chart.vue -app/assets/javascripts/analytics/instance_statistics/components/users_chart.vue -app/assets/javascripts/analytics/instance_statistics/utils.js -app/assets/javascripts/analytics/product_analytics/activity_charts_bundle.js -app/assets/javascripts/api.js -app/assets/javascripts/authentication/u2f/authenticate.js -app/assets/javascripts/authentication/u2f/register.js - -## reverent-lovelace -app/assets/javascripts/authentication/webauthn/authenticate.js -app/assets/javascripts/authentication/webauthn/register.js -app/assets/javascripts/awards_handler.js -app/assets/javascripts/badges/components/badge_form.vue -app/assets/javascripts/badges/components/badge_settings.vue -app/assets/javascripts/badges/store/actions.js -app/assets/javascripts/badges/store/mutations.js -app/assets/javascripts/batch_comments/components/preview_item.vue -app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js -app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js -app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js -app/assets/javascripts/batch_comments/utils.js -app/assets/javascripts/behaviors/autosize.js -app/assets/javascripts/behaviors/bind_in_out.js -app/assets/javascripts/behaviors/copy_to_clipboard.js -app/assets/javascripts/behaviors/gl_emoji.js -app/assets/javascripts/behaviors/load_startup_css.js -app/assets/javascripts/behaviors/markdown/copy_as_gfm.js -app/assets/javascripts/behaviors/markdown/highlight_current_user.js -app/assets/javascripts/behaviors/markdown/marks/inline_diff.js -app/assets/javascripts/behaviors/markdown/marks/inline_html.js -app/assets/javascripts/behaviors/markdown/nodes/code_block.js -app/assets/javascripts/behaviors/markdown/nodes/emoji.js -app/assets/javascripts/behaviors/markdown/nodes/image.js -app/assets/javascripts/behaviors/markdown/nodes/playable.js -app/assets/javascripts/behaviors/markdown/nodes/reference.js -app/assets/javascripts/behaviors/markdown/nodes/table_cell.js -app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js -app/assets/javascripts/behaviors/markdown/render_math.js -app/assets/javascripts/behaviors/markdown/render_mermaid.js -app/assets/javascripts/behaviors/markdown/render_metrics.js -app/assets/javascripts/behaviors/markdown/schema.js -app/assets/javascripts/behaviors/markdown/serializer.js - -## nice-swanson -app/assets/javascripts/behaviors/preview_markdown.js -app/assets/javascripts/behaviors/quick_submit.js -app/assets/javascripts/behaviors/requires_input.js -app/assets/javascripts/behaviors/secret_values.js -app/assets/javascripts/behaviors/shortcuts/keybindings.js -app/assets/javascripts/behaviors/shortcuts/shortcuts.js -app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js -app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js -app/assets/javascripts/blob/3d_viewer/index.js -app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js -app/assets/javascripts/blob/blob_file_dropzone.js -app/assets/javascripts/blob/blob_line_permalink_updater.js -app/assets/javascripts/blob/components/blob_content_error.vue -app/assets/javascripts/blob/file_template_mediator.js -app/assets/javascripts/blob/notebook/notebook_viewer.vue -app/assets/javascripts/blob/openapi/index.js -app/assets/javascripts/blob/sketch/index.js -app/assets/javascripts/blob/stl_viewer.js -app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js -app/assets/javascripts/blob/template_selector.js -app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js -app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js -app/assets/javascripts/blob/template_selectors/dockerfile_selector.js -app/assets/javascripts/blob/template_selectors/gitignore_selector.js -app/assets/javascripts/blob/template_selectors/license_selector.js -app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js -app/assets/javascripts/blob/template_selectors/type_selector.js -app/assets/javascripts/blob/viewer/index.js -app/assets/javascripts/blob_edit/blob_bundle.js -app/assets/javascripts/blob_edit/edit_blob.js -app/assets/javascripts/boards/boards_util.js - -## keen-chatelet -app/assets/javascripts/boards/components/board_assignee_dropdown.vue -app/assets/javascripts/boards/components/board_card_layout.vue -app/assets/javascripts/boards/components/board_form.vue -app/assets/javascripts/boards/components/board_list.vue -app/assets/javascripts/boards/components/board_list_new.vue -app/assets/javascripts/boards/components/board_new_issue_new.vue -app/assets/javascripts/boards/components/board_sidebar.js -app/assets/javascripts/boards/components/boards_selector.vue -app/assets/javascripts/boards/components/modal/footer.vue -app/assets/javascripts/boards/components/modal/index.vue -app/assets/javascripts/boards/components/project_select.vue -app/assets/javascripts/boards/components/sidebar/board_sidebar_labels_select.vue -app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue -app/assets/javascripts/boards/filtered_search_boards.js -app/assets/javascripts/boards/filters/due_date_filters.js -app/assets/javascripts/boards/index.js -app/assets/javascripts/boards/mixins/sortable_default_options.js -app/assets/javascripts/boards/models/issue.js -app/assets/javascripts/boards/models/list.js -app/assets/javascripts/boards/stores/actions.js -app/assets/javascripts/boards/stores/boards_store.js -app/assets/javascripts/boards/stores/getters.js -app/assets/javascripts/boards/stores/modal_store.js -app/assets/javascripts/boards/stores/mutations.js -app/assets/javascripts/branches/divergence_graph.js -app/assets/javascripts/breadcrumb.js -app/assets/javascripts/broadcast_notification.js -app/assets/javascripts/build_artifacts.js -app/assets/javascripts/ci_settings_pipeline_triggers/index.js -app/assets/javascripts/ci_variable_list/ci_variable_list.js -app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue -app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue - -## relaxed-kilby -app/assets/javascripts/ci_variable_list/store/actions.js -app/assets/javascripts/ci_variable_list/store/getters.js -app/assets/javascripts/ci_variable_list/store/utils.js -app/assets/javascripts/clone_panel.js -app/assets/javascripts/clusters/clusters_bundle.js -app/assets/javascripts/clusters/components/fluentd_output_settings.vue -app/assets/javascripts/clusters/forms/stores/index.js -app/assets/javascripts/clusters/stores/clusters_store.js -app/assets/javascripts/clusters/stores/new_cluster/index.js -app/assets/javascripts/clusters_list/components/clusters.vue -app/assets/javascripts/clusters_list/load_clusters.js -app/assets/javascripts/clusters_list/store/actions.js -app/assets/javascripts/clusters_list/store/index.js -app/assets/javascripts/code_navigation/index.js -app/assets/javascripts/code_navigation/store/actions.js -app/assets/javascripts/code_navigation/utils/index.js -app/assets/javascripts/commit/image_file.js -app/assets/javascripts/commit/pipelines/pipelines_bundle.js -app/assets/javascripts/commit_merge_requests.js -app/assets/javascripts/commons/nav/user_merge_requests.js -app/assets/javascripts/compare_autocomplete.js -app/assets/javascripts/confidential_merge_request/components/project_form_group.vue -app/assets/javascripts/confirm_danger_modal.js -app/assets/javascripts/confirm_modal.js -app/assets/javascripts/contributors/components/contributors.vue -app/assets/javascripts/contributors/stores/actions.js -app/assets/javascripts/contributors/stores/getters.js -app/assets/javascripts/contributors/utils.js -app/assets/javascripts/create_cluster/components/cluster_form_dropdown.vue -app/assets/javascripts/create_cluster/eks_cluster/index.js -app/assets/javascripts/create_cluster/eks_cluster/services/aws_services_facade.js - -## lucid-lederberg -app/assets/javascripts/create_cluster/eks_cluster/store/actions.js -app/assets/javascripts/create_cluster/eks_cluster/store/state.js -app/assets/javascripts/create_cluster/gke_cluster/components/gke_dropdown_mixin.js -app/assets/javascripts/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue -app/assets/javascripts/create_cluster/gke_cluster/index.js -app/assets/javascripts/create_cluster/gke_cluster/store/actions.js -app/assets/javascripts/create_cluster/gke_cluster/store/getters.js -app/assets/javascripts/create_cluster/gke_cluster_namespace/index.js -app/assets/javascripts/create_cluster/init_create_cluster.js -app/assets/javascripts/create_cluster/store/cluster_dropdown/actions.js -app/assets/javascripts/create_item_dropdown.js -app/assets/javascripts/create_label.js -app/assets/javascripts/create_merge_request_dropdown.js -app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue -app/assets/javascripts/custom_metrics/constants.js -app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js -app/assets/javascripts/cycle_analytics/cycle_analytics_service.js -app/assets/javascripts/cycle_analytics/cycle_analytics_store.js -app/assets/javascripts/deploy_freeze/store/actions.js -app/assets/javascripts/deploy_freeze/store/index.js -app/assets/javascripts/deploy_freeze/store/mutations.js -app/assets/javascripts/deploy_keys/components/app.vue -app/assets/javascripts/deploy_keys/components/key.vue -app/assets/javascripts/deploy_keys/service/index.js -app/assets/javascripts/deploy_keys/store/index.js -app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js -app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js -app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js -app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js -app/assets/javascripts/design_management/components/design_notes/design_discussion.vue -app/assets/javascripts/design_management/components/design_presentation.vue -app/assets/javascripts/design_management/components/design_sidebar.vue -app/assets/javascripts/design_management/components/design_todo_button.vue - -## loving-feistel -app/assets/javascripts/design_management/components/toolbar/design_navigation.vue -app/assets/javascripts/design_management/components/toolbar/index.vue -app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue -app/assets/javascripts/design_management/graphql.js -app/assets/javascripts/design_management/mixins/all_designs.js -app/assets/javascripts/design_management/mixins/all_versions.js -app/assets/javascripts/design_management/pages/design/index.vue -app/assets/javascripts/design_management/pages/index.vue -app/assets/javascripts/design_management/utils/cache_update.js -app/assets/javascripts/design_management/utils/design_management_utils.js -app/assets/javascripts/design_management/utils/error_messages.js -app/assets/javascripts/diff.js -app/assets/javascripts/diffs/components/app.vue -app/assets/javascripts/diffs/components/compare_dropdown_layout.vue -app/assets/javascripts/diffs/components/diff_content.vue -app/assets/javascripts/diffs/components/diff_expansion_cell.vue -app/assets/javascripts/diffs/components/diff_file.vue -app/assets/javascripts/diffs/components/diff_gutter_avatars.vue -app/assets/javascripts/diffs/components/diff_line_note_form.vue -app/assets/javascripts/diffs/components/diff_row_utils.js -app/assets/javascripts/diffs/components/parallel_diff_table_row.vue -app/assets/javascripts/diffs/components/tree_list.vue -app/assets/javascripts/diffs/index.js -app/assets/javascripts/diffs/store/actions.js -app/assets/javascripts/diffs/store/getters_versions_dropdowns.js -app/assets/javascripts/diffs/store/mutations.js -app/assets/javascripts/diffs/store/utils.js -app/assets/javascripts/diffs/utils/diff_file.js -app/assets/javascripts/diffs/workers/tree_worker.js -app/assets/javascripts/dirty_submit/dirty_submit_collection.js -app/assets/javascripts/dirty_submit/dirty_submit_form.js - -## distracted-nash -app/assets/javascripts/droplab/drop_down.js -app/assets/javascripts/droplab/drop_lab.js -app/assets/javascripts/droplab/hook_button.js -app/assets/javascripts/droplab/hook_input.js -app/assets/javascripts/droplab/plugins/ajax.js -app/assets/javascripts/droplab/plugins/ajax_filter.js -app/assets/javascripts/droplab/plugins/input_setter.js -app/assets/javascripts/due_date_select.js -app/assets/javascripts/editor/editor_lite.js -app/assets/javascripts/editor/editor_markdown_ext.js -app/assets/javascripts/editor/utils.js -app/assets/javascripts/emoji/index.js -app/assets/javascripts/emoji/no_emoji_validator.js -app/assets/javascripts/emoji/support/is_emoji_unicode_supported.js -app/assets/javascripts/emoji/support/unicode_support_map.js -app/assets/javascripts/environments/components/environment_item.vue -app/assets/javascripts/environments/components/environment_rollback.vue -app/assets/javascripts/environments/components/environments_app.vue -app/assets/javascripts/environments/components/environments_table.vue -app/assets/javascripts/environments/mixins/environments_mixin.js -app/assets/javascripts/environments/stores/environments_store.js -app/assets/javascripts/error_tracking/components/error_details.vue -app/assets/javascripts/error_tracking/store/actions.js -app/assets/javascripts/error_tracking/store/details/actions.js -app/assets/javascripts/error_tracking/store/details/getters.js -app/assets/javascripts/error_tracking/store/list/mutations.js -app/assets/javascripts/error_tracking/utils.js -app/assets/javascripts/error_tracking_settings/store/actions.js -app/assets/javascripts/error_tracking_settings/store/getters.js -app/assets/javascripts/error_tracking_settings/store/mutations.js -app/assets/javascripts/error_tracking_settings/utils.js - -## modest-mayer -app/assets/javascripts/experimental_flags.js -app/assets/javascripts/feature_flags/components/edit_feature_flag.vue -app/assets/javascripts/feature_flags/components/feature_flags.vue -app/assets/javascripts/feature_flags/components/feature_flags_table.vue -app/assets/javascripts/feature_flags/components/form.vue -app/assets/javascripts/feature_flags/components/new_feature_flag.vue -app/assets/javascripts/feature_flags/store/edit/actions.js -app/assets/javascripts/feature_flags/store/edit/index.js -app/assets/javascripts/feature_flags/store/gitlab_user_list/actions.js -app/assets/javascripts/feature_flags/store/gitlab_user_list/index.js -app/assets/javascripts/feature_flags/store/helpers.js -app/assets/javascripts/feature_flags/store/index/actions.js -app/assets/javascripts/feature_flags/store/index/index.js -app/assets/javascripts/feature_flags/store/index/mutations.js -app/assets/javascripts/feature_flags/store/new/actions.js -app/assets/javascripts/feature_flags/store/new/index.js -app/assets/javascripts/feature_flags/utils.js -app/assets/javascripts/feature_highlight/feature_highlight.js -app/assets/javascripts/feature_highlight/feature_highlight_helper.js -app/assets/javascripts/file_pickers.js -app/assets/javascripts/files_comment_button.js -app/assets/javascripts/filterable_list.js -app/assets/javascripts/filtered_search/available_dropdown_mappings.js -app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.vue -app/assets/javascripts/filtered_search/dropdown_ajax_filter.js -app/assets/javascripts/filtered_search/dropdown_emoji.js -app/assets/javascripts/filtered_search/dropdown_hint.js -app/assets/javascripts/filtered_search/dropdown_non_user.js -app/assets/javascripts/filtered_search/dropdown_utils.js -app/assets/javascripts/filtered_search/filtered_search_dropdown.js -app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js -app/assets/javascripts/filtered_search/filtered_search_manager.js -app/assets/javascripts/filtered_search/filtered_search_token_keys.js -app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js -app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js - ## stoic-merkle app/assets/javascripts/filtered_search/stores/recent_searches_store.js app/assets/javascripts/filtered_search/visual_token_value.js @@ -517,171 +194,6 @@ app/assets/javascripts/lib/utils/text_markdown.js app/assets/javascripts/lib/utils/text_utility.js app/assets/javascripts/lib/utils/type_utility.js -## zen-robinson -app/assets/javascripts/lib/utils/unit_format/formatter_factory.js -app/assets/javascripts/lib/utils/url_utility.js -app/assets/javascripts/line_highlighter.js -app/assets/javascripts/locale/ensure_single_line.js -app/assets/javascripts/locale/index.js -app/assets/javascripts/locale/sprintf.js -app/assets/javascripts/logs/components/log_advanced_filters.vue -app/assets/javascripts/logs/logs_tracking_helper.js -app/assets/javascripts/logs/stores/actions.js -app/assets/javascripts/logs/stores/getters.js -app/assets/javascripts/logs/utils.js -app/assets/javascripts/main.js -app/assets/javascripts/manual_ordering.js -app/assets/javascripts/member_expiration_date.js -app/assets/javascripts/members.js -app/assets/javascripts/members/components/avatars/user_avatar.vue -app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue -app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue -app/assets/javascripts/members/store/index.js -app/assets/javascripts/members/utils.js -app/assets/javascripts/merge_conflicts/components/diff_file_editor.js -app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js -app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js -app/assets/javascripts/merge_conflicts/merge_conflict_store.js -app/assets/javascripts/merge_request.js -app/assets/javascripts/merge_request_tabs.js -app/assets/javascripts/milestone.js -app/assets/javascripts/milestone_select.js -app/assets/javascripts/milestones/components/milestone_combobox.vue -app/assets/javascripts/milestones/stores/actions.js -app/assets/javascripts/milestones/stores/mutations.js - -## inspiring-lovelace -app/assets/javascripts/mini_pipeline_graph_dropdown.js -app/assets/javascripts/mirrors/mirror_repos.js -app/assets/javascripts/mirrors/ssh_mirror.js -app/assets/javascripts/monitoring/components/alert_widget.vue -app/assets/javascripts/monitoring/components/alert_widget_form.vue -app/assets/javascripts/monitoring/components/charts/annotations.js -app/assets/javascripts/monitoring/components/charts/anomaly.vue -app/assets/javascripts/monitoring/components/charts/bar.vue -app/assets/javascripts/monitoring/components/charts/column.vue -app/assets/javascripts/monitoring/components/charts/heatmap.vue -app/assets/javascripts/monitoring/components/charts/options.js -app/assets/javascripts/monitoring/components/charts/stacked_column.vue -app/assets/javascripts/monitoring/components/charts/time_series.vue -app/assets/javascripts/monitoring/components/dashboard_panel.vue -app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue -app/assets/javascripts/monitoring/components/duplicate_dashboard_modal.vue -app/assets/javascripts/monitoring/components/embeds/embed_group.vue -app/assets/javascripts/monitoring/components/embeds/metric_embed.vue -app/assets/javascripts/monitoring/components/empty_state.vue -app/assets/javascripts/monitoring/components/variables/dropdown_field.vue -app/assets/javascripts/monitoring/csv_export.js -app/assets/javascripts/monitoring/requests/index.js -app/assets/javascripts/monitoring/services/alerts_service.js -app/assets/javascripts/monitoring/stores/embed_group/getters.js -app/assets/javascripts/monitoring/stores/mutations.js -app/assets/javascripts/monitoring/stores/utils.js -app/assets/javascripts/monitoring/stores/variable_mapping.js -app/assets/javascripts/monitoring/utils.js -app/assets/javascripts/monitoring/validators.js -app/assets/javascripts/mr_notes/init_notes.js -app/assets/javascripts/mr_notes/stores/getters.js - -## cool-dirac -app/assets/javascripts/mr_popover/components/mr_popover.vue -app/assets/javascripts/mr_popover/index.js -app/assets/javascripts/namespace_select.js -app/assets/javascripts/network/branch_graph.js -app/assets/javascripts/new_branch_form.js -app/assets/javascripts/notebook/cells/markdown.vue -app/assets/javascripts/notes.js -app/assets/javascripts/notes/components/diff_with_note.vue -app/assets/javascripts/notes/components/discussion_actions.vue -app/assets/javascripts/notes/components/discussion_counter.vue -app/assets/javascripts/notes/components/discussion_filter.vue -app/assets/javascripts/notes/components/multiline_comment_utils.js -app/assets/javascripts/notes/components/note_actions.vue -app/assets/javascripts/notes/components/note_body.vue -app/assets/javascripts/notes/components/note_form.vue -app/assets/javascripts/notes/components/noteable_discussion.vue -app/assets/javascripts/notes/components/noteable_note.vue -app/assets/javascripts/notes/components/notes_app.vue -app/assets/javascripts/notes/components/toggle_replies_widget.vue -app/assets/javascripts/notes/discussion_filters.js -app/assets/javascripts/notes/mixins/diff_line_note_form.js -app/assets/javascripts/notes/mixins/discussion_navigation.js -app/assets/javascripts/notes/mixins/resolvable.js -app/assets/javascripts/notes/sort_discussions.js -app/assets/javascripts/notes/stores/actions.js -app/assets/javascripts/notes/stores/collapse_utils.js -app/assets/javascripts/notes/stores/getters.js -app/assets/javascripts/notes/stores/mutations.js -app/assets/javascripts/notes/stores/utils.js -app/assets/javascripts/notes/utils.js -app/assets/javascripts/notifications_dropdown.js - -## practical-cohen -app/assets/javascripts/onboarding_issues/index.js -app/assets/javascripts/operation_settings/store/actions.js -app/assets/javascripts/operation_settings/store/index.js -app/assets/javascripts/packages/details/components/package_files.vue -app/assets/javascripts/packages/list/components/packages_list.vue -app/assets/javascripts/packages/list/components/packages_list_app.vue -app/assets/javascripts/packages/list/components/packages_sort.vue -app/assets/javascripts/packages/list/stores/getters.js -app/assets/javascripts/packages/shared/components/package_tags.vue -app/assets/javascripts/packages/shared/utils.js -app/assets/javascripts/pages/admin/admin.js -app/assets/javascripts/pages/admin/application_settings/payload_previewer.js -app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js -app/assets/javascripts/pages/admin/jobs/index/components/stop_jobs_modal.vue -app/assets/javascripts/pages/admin/projects/index.js -app/assets/javascripts/pages/admin/projects/index/index.js -app/assets/javascripts/pages/admin/users/index.js -app/assets/javascripts/pages/admin/users/new/index.js -app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue -app/assets/javascripts/pages/dashboard/projects/index/init_customize_homepage_banner.js -app/assets/javascripts/pages/groups/new/group_path_validator.js -app/assets/javascripts/pages/groups/shared/group_tabs.js -app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue -app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue -app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js -app/assets/javascripts/pages/milestones/shared/promote_milestone_modal_init.js -app/assets/javascripts/pages/profiles/show/index.js -app/assets/javascripts/pages/projects/blob/show/index.js -app/assets/javascripts/pages/projects/graphs/charts/index.js -app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue -app/assets/javascripts/pages/projects/issues/service_desk/filtered_search.js - -## vigorous-wiles -app/assets/javascripts/pages/projects/issues/show.js -app/assets/javascripts/pages/projects/jobs/index/index.js -app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue -app/assets/javascripts/pages/projects/labels/index/index.js -app/assets/javascripts/pages/projects/merge_requests/creations/new/compare.js -app/assets/javascripts/pages/projects/new/index.js -app/assets/javascripts/pages/projects/pages_domains/form.js -app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js -app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/timezone_dropdown.js -app/assets/javascripts/pages/projects/pipelines/init_pipelines.js -app/assets/javascripts/pages/projects/project.js -app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js -app/assets/javascripts/pages/projects/shared/permissions/external.js -app/assets/javascripts/pages/projects/shared/permissions/index.js -app/assets/javascripts/pages/projects/tags/index/index.js -app/assets/javascripts/pages/search/show/refresh_counts.js -app/assets/javascripts/pages/sessions/new/length_validator.js -app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js -app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js -app/assets/javascripts/pages/sessions/new/username_validator.js -app/assets/javascripts/pages/shared/mount_badge_settings.js -app/assets/javascripts/pages/shared/wikis/wikis.js -app/assets/javascripts/pages/users/activity_calendar.js -app/assets/javascripts/pages/users/index.js -app/assets/javascripts/pdf/index.vue -app/assets/javascripts/pdf/page/index.vue -app/assets/javascripts/performance/utils.js -app/assets/javascripts/performance_bar/components/detailed_metric.vue -app/assets/javascripts/performance_bar/components/request_selector.vue -app/assets/javascripts/performance_bar/index.js -app/assets/javascripts/performance_bar/performance_bar_log.js - ## musing-khayyam app/assets/javascripts/performance_bar/services/performance_bar_service.js app/assets/javascripts/performance_bar/stores/performance_bar_store.js @@ -848,345 +360,6 @@ app/assets/javascripts/snippets/components/snippet_blob_view.vue app/assets/javascripts/snippets/components/snippet_header.vue app/assets/javascripts/snippets/mixins/snippets.js -## lucid-lalande -app/assets/javascripts/snippets/utils/blob.js -app/assets/javascripts/static_site_editor/graphql/index.js -app/assets/javascripts/static_site_editor/graphql/resolvers/file.js -app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js -app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js -app/assets/javascripts/static_site_editor/image_repository.js -app/assets/javascripts/static_site_editor/index.js -app/assets/javascripts/static_site_editor/pages/home.vue -app/assets/javascripts/static_site_editor/services/formatter.js -app/assets/javascripts/static_site_editor/services/front_matterify.js -app/assets/javascripts/static_site_editor/services/image_service.js -app/assets/javascripts/static_site_editor/services/load_source_content.js -app/assets/javascripts/static_site_editor/services/parse_source_file.js -app/assets/javascripts/static_site_editor/services/renderers/render_image.js -app/assets/javascripts/static_site_editor/services/submit_content_changes.js -app/assets/javascripts/static_site_editor/services/templater.js -app/assets/javascripts/task_list.js -app/assets/javascripts/terminal/terminal.js -app/assets/javascripts/terraform/components/terraform_list.vue -app/assets/javascripts/test_utils/simulate_input.js -app/assets/javascripts/toggle_buttons.js -app/assets/javascripts/tooltips/components/tooltips.vue -app/assets/javascripts/tooltips/index.js -app/assets/javascripts/tracking.js -app/assets/javascripts/tree.js -app/assets/javascripts/ui_development_kit.js -app/assets/javascripts/usage_ping_consent.js -app/assets/javascripts/user_callout.js -app/assets/javascripts/user_lists/store/edit/actions.js -app/assets/javascripts/user_lists/store/edit/index.js -app/assets/javascripts/user_lists/store/new/actions.js -app/assets/javascripts/user_lists/store/new/index.js - -## nostalgic-morse -app/assets/javascripts/user_lists/store/show/actions.js -app/assets/javascripts/user_lists/store/show/index.js -app/assets/javascripts/user_lists/store/show/mutations.js -app/assets/javascripts/user_popovers.js -app/assets/javascripts/users_select/index.js -app/assets/javascripts/vue_alerts.js -app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue -app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue -app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_view_button.vue -app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue -app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue -app/assets/javascripts/vue_merge_request_widget/components/extensions/container.js -app/assets/javascripts/vue_merge_request_widget/components/extensions/index.js -app/assets/javascripts/vue_merge_request_widget/components/mr_widget_alert_message.vue -app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue -app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue -app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue -app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue -app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue -app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue -app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue -app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue -app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue -app/assets/javascripts/vue_merge_request_widget/extensions/issues.js -app/assets/javascripts/vue_merge_request_widget/mixins/approvals.js -app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue -app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js -app/assets/javascripts/vue_merge_request_widget/stores/artifacts_list/getters.js -app/assets/javascripts/vue_shared/components/actions_button.vue -app/assets/javascripts/vue_shared/components/awards_list.vue -app/assets/javascripts/vue_shared/components/commit.vue -app/assets/javascripts/vue_shared/components/confirm_modal.vue - -## thirsty-mccarthy -app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue -app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_input.vue -app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_lib.js -app/assets/javascripts/vue_shared/components/deprecated_modal_2.vue -app/assets/javascripts/vue_shared/components/dismissible_container.vue -app/assets/javascripts/vue_shared/components/file_finder/index.vue -app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue -app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js -app/assets/javascripts/vue_shared/components/filtered_search_bar/store/modules/filters/actions.js -app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue -app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/branch_token.vue -app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/label_token.vue -app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue -app/assets/javascripts/vue_shared/components/gfm_autocomplete/gfm_autocomplete.vue -app/assets/javascripts/vue_shared/components/gfm_autocomplete/utils.js -app/assets/javascripts/vue_shared/components/lib/utils/diff_utils.js -app/assets/javascripts/vue_shared/components/markdown/field.vue -app/assets/javascripts/vue_shared/components/markdown/header.vue -app/assets/javascripts/vue_shared/components/markdown/suggestions.vue -app/assets/javascripts/vue_shared/components/modal_copy_button.vue -app/assets/javascripts/vue_shared/components/ordered_layout.vue -app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs.vue -app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/utils.js -app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue -app/assets/javascripts/vue_shared/components/registry/list_item.vue -app/assets/javascripts/vue_shared/components/registry/title_area.vue -app/assets/javascripts/vue_shared/components/rich_content_editor/rich_content_editor.vue -app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_custom_renderer.js -app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer.js -app/assets/javascripts/vue_shared/components/rich_content_editor/services/editor_service.js -app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token.js -app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_html_block.js -app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text.js -app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph.js -app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_softbreak.js -app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_utils.js - -## practical-wozniak -app/assets/javascripts/vue_shared/components/rich_content_editor/services/sanitize_html.js -app/assets/javascripts/vue_shared/components/select2_select.vue -app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label.vue -app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed.vue -app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue -app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue -app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/getters.js -app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js -app/assets/javascripts/vue_shared/components/split_button.vue -app/assets/javascripts/vue_shared/components/tabs/tabs.js -app/assets/javascripts/vue_shared/components/timezone_dropdown.vue -app/assets/javascripts/vue_shared/components/web_ide_link.vue -app/assets/javascripts/vue_shared/directives/autofocusonshow.js -app/assets/javascripts/vue_shared/directives/validation.js -app/assets/javascripts/vue_shared/gl_feature_flags_plugin.js -app/assets/javascripts/vue_shared/mixins/ci_pagination_api_mixin.js -app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue -app/assets/javascripts/vue_shared/security_reports/store/getters.js -app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js -app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js -app/assets/javascripts/vue_shared/security_reports/store/utils.js -app/assets/javascripts/vue_shared/translate.js -app/assets/javascripts/vuex_shared/bindings.js -app/assets/javascripts/whats_new/components/app.vue -app/assets/javascripts/whats_new/index.js -app/assets/javascripts/whats_new/utils/get_drawer_body_height.js -app/assets/javascripts/whats_new/utils/notification.js -app/assets/javascripts/zen_mode.js -config/helpers/is_eslint.js -config/helpers/vendor_dll_hash.js -config/karma.config.js - -## frosty-kare -config/plugins/monaco_webpack.js -config/webpack.config.js -ee/app/assets/javascripts/add_gitlab_slack_application/components/add_gitlab_slack_application.vue -ee/app/assets/javascripts/admin/dev_ops_report/components/devops_adoption_app.vue -ee/app/assets/javascripts/admin/dev_ops_report/components/devops_adoption_segment_modal.vue -ee/app/assets/javascripts/admin/dev_ops_report/components/devops_adoption_table.vue -ee/app/assets/javascripts/admin/dev_ops_report/graphql.js -ee/app/assets/javascripts/admin/dev_ops_report/utils/cache_updates.js -ee/app/assets/javascripts/analytics/code_review_analytics/components/app.vue -ee/app/assets/javascripts/analytics/code_review_analytics/components/filter_bar.vue -ee/app/assets/javascripts/analytics/code_review_analytics/filtered_search_code_review_analytics.js -ee/app/assets/javascripts/analytics/code_review_analytics/store/modules/merge_requests/actions.js -ee/app/assets/javascripts/analytics/code_review_analytics/utils.js -ee/app/assets/javascripts/analytics/contribution_analytics/components/column_chart.vue -ee/app/assets/javascripts/analytics/contribution_analytics/contribution_analytics_bundle.js -ee/app/assets/javascripts/analytics/cycle_analytics/components/create_value_stream_form/utils.js -ee/app/assets/javascripts/analytics/cycle_analytics/components/custom_stage_form.vue -ee/app/assets/javascripts/analytics/cycle_analytics/components/filter_bar.vue -ee/app/assets/javascripts/analytics/cycle_analytics/components/stage_dropdown_filter.vue -ee/app/assets/javascripts/analytics/cycle_analytics/components/stage_table_nav.vue -ee/app/assets/javascripts/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters.vue -ee/app/assets/javascripts/analytics/cycle_analytics/components/time_metrics_card.vue -ee/app/assets/javascripts/analytics/cycle_analytics/index.js -ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js -ee/app/assets/javascripts/analytics/cycle_analytics/store/getters.js -ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/actions.js -ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/mutations.js -ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart/actions.js -ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart/getters.js -ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/type_of_work/actions.js -ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js - -## frosty-sammet -ee/app/assets/javascripts/analytics/group_ci_cd_analytics/index.js -ee/app/assets/javascripts/analytics/merge_request_analytics/components/filter_bar.vue -ee/app/assets/javascripts/analytics/merge_request_analytics/components/throughput_chart.vue -ee/app/assets/javascripts/analytics/merge_request_analytics/components/throughput_table.vue -ee/app/assets/javascripts/analytics/merge_request_analytics/graphql/throughput_chart_query_builder.js -ee/app/assets/javascripts/analytics/merge_request_analytics/index.js -ee/app/assets/javascripts/analytics/merge_request_analytics/utils.js -ee/app/assets/javascripts/analytics/productivity_analytics/components/app.vue -ee/app/assets/javascripts/analytics/productivity_analytics/components/metric_chart.vue -ee/app/assets/javascripts/analytics/productivity_analytics/components/mr_table.vue -ee/app/assets/javascripts/analytics/productivity_analytics/filtered_search_productivity_analytics.js -ee/app/assets/javascripts/analytics/productivity_analytics/store/getters.js -ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/charts/actions.js -ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/charts/getters.js -ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/filters/getters.js -ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/table/actions.js -ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/table/getters.js -ee/app/assets/javascripts/analytics/productivity_analytics/utils.js -ee/app/assets/javascripts/analytics/repository_analytics/components/download_test_coverage.vue -ee/app/assets/javascripts/analytics/repository_analytics/components/test_coverage_table.vue -ee/app/assets/javascripts/analytics/shared/components/groups_dropdown_filter.vue -ee/app/assets/javascripts/analytics/shared/components/projects_dropdown_filter.vue -ee/app/assets/javascripts/analytics/shared/components/scatterplot.vue -ee/app/assets/javascripts/analytics/shared/utils.js -ee/app/assets/javascripts/approvals/components/app.vue -ee/app/assets/javascripts/approvals/components/approvers_select.vue -ee/app/assets/javascripts/approvals/components/branches_select.vue -ee/app/assets/javascripts/approvals/components/license_compliance/index.vue -ee/app/assets/javascripts/approvals/components/mr_edit/app.vue -ee/app/assets/javascripts/approvals/components/mr_edit/mr_rules.vue -ee/app/assets/javascripts/approvals/components/mr_edit/mr_rules_hidden_inputs.vue -ee/app/assets/javascripts/approvals/components/mr_edit/rule_input.vue - -## strange-shirley -ee/app/assets/javascripts/approvals/components/project_settings/project_rules.vue -ee/app/assets/javascripts/approvals/components/rule_form.vue -ee/app/assets/javascripts/approvals/components/security_configuration/unconfigured_security_rules.vue -ee/app/assets/javascripts/approvals/mappers.js -ee/app/assets/javascripts/approvals/stores/modules/base/getters.js -ee/app/assets/javascripts/approvals/stores/modules/license_compliance/actions.js -ee/app/assets/javascripts/approvals/stores/modules/mr_edit/actions.js -ee/app/assets/javascripts/approvals/stores/modules/mr_edit/mutations.js -ee/app/assets/javascripts/approvals/stores/modules/project_settings/actions.js -ee/app/assets/javascripts/audit_events/components/audit_events_filter.vue -ee/app/assets/javascripts/audit_events/components/sorting_field.vue -ee/app/assets/javascripts/audit_events/components/tokens/member_token.vue -ee/app/assets/javascripts/audit_events/components/tokens/project_token.vue -ee/app/assets/javascripts/audit_events/components/tokens/shared/audit_filter_token.vue -ee/app/assets/javascripts/audit_events/components/tokens/user_token.vue -ee/app/assets/javascripts/audit_events/constants.js -ee/app/assets/javascripts/audit_events/init_audit_events.js -ee/app/assets/javascripts/audit_events/store/getters.js -ee/app/assets/javascripts/audit_events/utils.js -ee/app/assets/javascripts/audit_events/validators.js -ee/app/assets/javascripts/billings/seat_usage/store/actions.js -ee/app/assets/javascripts/billings/seat_usage/store/getters.js -ee/app/assets/javascripts/billings/subscriptions/store/actions.js -ee/app/assets/javascripts/billings/subscriptions/store/getters.js -ee/app/assets/javascripts/billings/subscriptions/store/mutations.js -ee/app/assets/javascripts/boards/boards_util.js -ee/app/assets/javascripts/boards/components/board_scope.vue -ee/app/assets/javascripts/boards/components/boards_list_selector/index.js -ee/app/assets/javascripts/boards/components/boards_list_selector/list_container.vue -ee/app/assets/javascripts/boards/components/epics_swimlanes.vue -ee/app/assets/javascripts/boards/components/new_list_dropdown.js - -## great-keldysh -ee/app/assets/javascripts/boards/components/sidebar/remove_issue.js -ee/app/assets/javascripts/boards/config_toggle.js -ee/app/assets/javascripts/boards/ee_functions.js -ee/app/assets/javascripts/boards/mixins/modal_footer.js -ee/app/assets/javascripts/boards/models/list.js -ee/app/assets/javascripts/boards/stores/actions.js -ee/app/assets/javascripts/boards/stores/boards_store_ee.js -ee/app/assets/javascripts/boards/stores/mutations.js -ee/app/assets/javascripts/boards/toggle_labels.js -ee/app/assets/javascripts/burndown_chart/burn_chart_data.js -ee/app/assets/javascripts/burndown_chart/components/burn_charts.vue -ee/app/assets/javascripts/burndown_chart/components/burnup_chart.vue -ee/app/assets/javascripts/burndown_chart/components/open_timebox_summary.vue -ee/app/assets/javascripts/clusters/components/environments.vue -ee/app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js -ee/app/assets/javascripts/clusters_list/components/agents.vue -ee/app/assets/javascripts/codequality_report/store/actions.js -ee/app/assets/javascripts/codequality_report/store/getters.js -ee/app/assets/javascripts/compliance_dashboard/compliance_dashboard_bundle.js -ee/app/assets/javascripts/dependencies/components/dependencies_actions.vue -ee/app/assets/javascripts/dependencies/components/paginated_dependencies_table.vue -ee/app/assets/javascripts/dependencies/store/getters.js -ee/app/assets/javascripts/dependencies/store/modules/list/actions.js -ee/app/assets/javascripts/diffs/mixins/image_diff.js -ee/app/assets/javascripts/droplab/plugins/custom_number.js -ee/app/assets/javascripts/ee_trial_banner/ee_trial_banner.js -ee/app/assets/javascripts/environments/stores/environments_store.js -ee/app/assets/javascripts/epic/components/epic_form.vue -ee/app/assets/javascripts/epic/components/sidebar_items/sidebar_labels.vue -ee/app/assets/javascripts/epic/epic_bundle.js -ee/app/assets/javascripts/epic/epic_tabs.js - -## stoic-einstein -ee/app/assets/javascripts/epic/store/actions.js -ee/app/assets/javascripts/epic/store/mutations.js -ee/app/assets/javascripts/epic/utils/epic_utils.js -ee/app/assets/javascripts/event_tracking/navbar.js -ee/app/assets/javascripts/filtered_search/dropdown_weight.js -ee/app/assets/javascripts/filtered_search/filtered_search_manager.js -ee/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js -ee/app/assets/javascripts/geo_node_form/components/geo_node_form_capacities.vue -ee/app/assets/javascripts/geo_node_form/components/geo_node_form_namespaces.vue -ee/app/assets/javascripts/geo_node_form/components/geo_node_form_shards.vue -ee/app/assets/javascripts/geo_node_form/store/actions.js -ee/app/assets/javascripts/geo_node_form/store/getters.js -ee/app/assets/javascripts/geo_node_form/validations.js -ee/app/assets/javascripts/geo_nodes/components/app.vue -ee/app/assets/javascripts/geo_nodes/components/node_detail_sections/node_details_section_main.vue -ee/app/assets/javascripts/geo_nodes/store/geo_nodes_store.js -ee/app/assets/javascripts/geo_replicable/graphql/replicable_type_query_builder.js -ee/app/assets/javascripts/geo_replicable/store/actions.js -ee/app/assets/javascripts/geo_replicable/store/getters.js -ee/app/assets/javascripts/geo_replicable/store/index.js -ee/app/assets/javascripts/geo_settings/store/getters.js -ee/app/assets/javascripts/geo_settings/store/state.js -ee/app/assets/javascripts/geo_settings/validations.js -ee/app/assets/javascripts/gfm_auto_complete.js -ee/app/assets/javascripts/group_member_contributions/store/group_member_store.js -ee/app/assets/javascripts/groups/members/utils.js -ee/app/assets/javascripts/groups/settings/access_restriction_field/validate_ip_address.js -ee/app/assets/javascripts/groups/settings/compliance_frameworks/components/list.vue -ee/app/assets/javascripts/groups/settings/compliance_frameworks/init_list.js -ee/app/assets/javascripts/groups/settings/components/comma_separated_list_token_selector.vue -ee/app/assets/javascripts/insights/components/insights.vue -ee/app/assets/javascripts/insights/components/insights_chart.vue - -## pedantic-noether -ee/app/assets/javascripts/insights/stores/modules/insights/actions.js -ee/app/assets/javascripts/insights/stores/modules/insights/helpers.js -ee/app/assets/javascripts/insights/stores/modules/insights/mutations.js -ee/app/assets/javascripts/integrations/jira/issues_list/components/jira_issues_list_root.vue -ee/app/assets/javascripts/integrations/jira/issues_list/jira_issues_list_bundle.js -ee/app/assets/javascripts/issues_analytics/components/issues_analytics.vue -ee/app/assets/javascripts/issues_analytics/filtered_search_issues_analytics.js -ee/app/assets/javascripts/issues_analytics/stores/modules/issue_analytics/actions.js -ee/app/assets/javascripts/issues_analytics/stores/modules/issue_analytics/getters.js -ee/app/assets/javascripts/iterations/components/iteration_report.vue -ee/app/assets/javascripts/iterations/components/iteration_report_tabs.vue -ee/app/assets/javascripts/iterations/components/iterations.vue -ee/app/assets/javascripts/iterations/components/iterations_list.vue -ee/app/assets/javascripts/ldap_groups_select.js -ee/app/assets/javascripts/license_compliance/store/modules/list/actions.js -ee/app/assets/javascripts/license_compliance/store/modules/list/getters.js -ee/app/assets/javascripts/license_compliance/store/plugins/mediator.js -ee/app/assets/javascripts/license_compliance/utils/mappers.js -ee/app/assets/javascripts/maintenance_mode_settings/store/index.js -ee/app/assets/javascripts/members.js -ee/app/assets/javascripts/members/components/table/members_table_cell.vue -ee/app/assets/javascripts/members/store/state.js -ee/app/assets/javascripts/members/utils.js -ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue -ee/app/assets/javascripts/on_demand_scans/components/profile_selector/scanner_profile_selector.vue -ee/app/assets/javascripts/on_demand_scans/components/profile_selector/site_profile_selector.vue -ee/app/assets/javascripts/oncall_schedules/components/add_edit_schedule_form.vue -ee/app/assets/javascripts/oncall_schedules/components/add_edit_schedule_modal.vue -ee/app/assets/javascripts/oncall_schedules/components/delete_schedule_modal.vue -ee/app/assets/javascripts/oncall_schedules/components/oncall_schedule.vue -ee/app/assets/javascripts/oncall_schedules/components/rotations/components/add_rotation_modal.vue - ## gifted-dewdney ee/app/assets/javascripts/oncall_schedules/utils/cache_updates.js ee/app/assets/javascripts/oncall_schedules/utils/common_utils.js @@ -1368,711 +541,6 @@ ee/app/assets/javascripts/vulnerabilities/components/resolution_alert.vue ## wonderful-proskuriakova ee/app/assets/javascripts/vulnerabilities/helpers.js ee/app/assets/javascripts/vulnerabilities/vulnerabilities_init.js -ee/spec/frontend/admin/dev_ops_report/components/devops_adoption_segment_modal_spec.js -ee/spec/frontend/admin/dev_ops_report/components/devops_adoption_table_cell_flag_spec.js -ee/spec/frontend/admin/dev_ops_report/components/devops_adoption_table_spec.js -ee/spec/frontend/analytics/code_review_analytics/components/app_spec.js -ee/spec/frontend/analytics/code_review_analytics/components/filter_bar_spec.js -ee/spec/frontend/analytics/code_review_analytics/components/merge_request_table_spec.js -ee/spec/frontend/analytics/code_review_analytics/store/modules/merge_requests/actions_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/base_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/create_value_stream_form/custom_stage_fields_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/custom_stage_form_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/duration_chart_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/filter_bar_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/labels_selector_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/metrics_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/path_navigation_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/stage_dropdown_filter_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/stage_event_list_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/stage_nav_item_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/stage_table_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/type_of_work_charts_spec.js -ee/spec/frontend/analytics/cycle_analytics/components/value_stream_select_spec.js -ee/spec/frontend/analytics/cycle_analytics/helpers.js -ee/spec/frontend/analytics/cycle_analytics/mock_data.js -ee/spec/frontend/analytics/cycle_analytics/store/getters_spec.js -ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js -ee/spec/frontend/analytics/cycle_analytics/utils_spec.js -ee/spec/frontend/analytics/merge_request_analytics/components/filter_bar_spec.js -ee/spec/frontend/analytics/merge_request_analytics/components/throughput_table_spec.js - -## inspiring-banach -ee/spec/frontend/analytics/productivity_analytics/components/app_spec.js -ee/spec/frontend/analytics/productivity_analytics/helpers.js -ee/spec/frontend/analytics/productivity_analytics/store/actions_spec.js -ee/spec/frontend/analytics/productivity_analytics/store/modules/charts/actions_spec.js -ee/spec/frontend/analytics/productivity_analytics/store/modules/charts/getters_spec.js -ee/spec/frontend/analytics/productivity_analytics/store/modules/filters/actions_spec.js -ee/spec/frontend/analytics/productivity_analytics/store/modules/table/actions_spec.js -ee/spec/frontend/analytics/repository_analytics/components/select_projects_dropdown_spec.js -ee/spec/frontend/analytics/repository_analytics/components/test_coverage_table_spec.js -ee/spec/frontend/analytics/shared/utils_spec.js -ee/spec/frontend/api_spec.js -ee/spec/frontend/approvals/components/approval_check_popover_spec.js -ee/spec/frontend/approvals/components/approval_check_rule_popover_spec.js -ee/spec/frontend/approvals/components/approvers_select_spec.js -ee/spec/frontend/approvals/components/branches_select_spec.js -ee/spec/frontend/approvals/components/license_compliance/index_spec.js -ee/spec/frontend/approvals/components/license_compliance/modal_spec.js -ee/spec/frontend/approvals/components/mr_edit/mr_rules_hidden_inputs_spec.js -ee/spec/frontend/approvals/components/mr_edit/mr_rules_spec.js -ee/spec/frontend/approvals/components/project_settings/project_rules_spec.js -ee/spec/frontend/approvals/components/rule_form_spec.js -ee/spec/frontend/approvals/stores/modules/mr_edit/actions_spec.js -ee/spec/frontend/approvals/stores/modules/project_settings/actions_spec.js -ee/spec/frontend/audit_events/components/audit_events_app_spec.js -ee/spec/frontend/audit_events/components/sorting_field_spec.js -ee/spec/frontend/audit_events/components/tokens/audit_filter_token_spec.js -ee/spec/frontend/billings/helpers.js -ee/spec/frontend/billings/seat_usage/components/subscription_seats_spec.js -ee/spec/frontend/billings/seat_usage/store/actions_spec.js -ee/spec/frontend/billings/subscriptions/components/subscription_table_row_spec.js -ee/spec/frontend/billings/subscriptions/store/mutations_spec.js - -## keen-napier -ee/spec/frontend/boards/components/assignee_select_spec.js -ee/spec/frontend/boards/components/board_list_header_new_spec.js -ee/spec/frontend/boards/components/board_list_header_spec.js -ee/spec/frontend/boards/components/board_list_selector/board_list_selector_spec.js -ee/spec/frontend/boards/components/board_list_spec.js -ee/spec/frontend/boards/components/board_setting_list_types_spec.js -ee/spec/frontend/boards/components/board_settings_wip_limit_spec.js -ee/spec/frontend/boards/components/epic_lane_spec.js -ee/spec/frontend/boards/components/sidebar/board_sidebar_epic_select_spec.js -ee/spec/frontend/boards/components/sidebar/board_sidebar_time_tracker_spec.js -ee/spec/frontend/boards/components/weight_select_spec.js -ee/spec/frontend/boards/milestone_select_spec.js -ee/spec/frontend/boards/mock_data.js -ee/spec/frontend/boards/stores/actions_spec.js -ee/spec/frontend/boards/stores/boards_store_ee_spec.js -ee/spec/frontend/boards/stores/mutations_spec.js -ee/spec/frontend/burndown_chart/components/burn_charts_spec.js -ee/spec/frontend/codequality_report/store/actions_spec.js -ee/spec/frontend/compliance_dashboard/components/empty_state_spec.js -ee/spec/frontend/compliance_dashboard/components/merge_requests/branch_details_spec.js -ee/spec/frontend/compliance_dashboard/components/merge_requests/grid_spec.js -ee/spec/frontend/compliance_dashboard/components/merge_requests/merge_request_spec.js -ee/spec/frontend/compliance_dashboard/components/merge_requests/status_spec.js -ee/spec/frontend/compliance_dashboard/components/merge_requests/statuses/approval_spec.js -ee/spec/frontend/compliance_dashboard/components/merge_requests/statuses/pipeline_spec.js -ee/spec/frontend/compliance_dashboard/components/shared/grid_column_heading_spec.js -ee/spec/frontend/compliance_dashboard/components/shared/pagination_spec.js -ee/spec/frontend/compliance_dashboard/mock_data.js -ee/spec/frontend/dependencies/components/app_spec.js -ee/spec/frontend/dependencies/components/dependencies_actions_spec.js -ee/spec/frontend/dependencies/components/dependency_license_links_spec.js -ee/spec/frontend/dependencies/components/dependency_list_job_failed_alert_spec.js - -## gallant-ride -ee/spec/frontend/diffs/components/diff_line_note_form_spec.js -ee/spec/frontend/environments/canary_ingress_spec.js -ee/spec/frontend/environments/deploy_board_component_spec.js -ee/spec/frontend/environments/environments_app_spec.js -ee/spec/frontend/environments/environments_table_spec.js -ee/spec/frontend/environments/mock_data.js -ee/spec/frontend/environments_dashboard/components/project_header_spec.js -ee/spec/frontend/epic/components/sidebar_items/sidebar_date_picker_spec.js -ee/spec/frontend/epic/components/sidebar_items/sidebar_header_spec.js -ee/spec/frontend/epic/components/sidebar_items/sidebar_todo_spec.js -ee/spec/frontend/epic/store/actions_spec.js -ee/spec/frontend/filtered_search/issues_filtered_search_token_keys_spec.js -ee/spec/frontend/geo_node_form/components/geo_node_form_namespaces_spec.js -ee/spec/frontend/geo_nodes/components/app_spec.js -ee/spec/frontend/geo_nodes/components/geo_node_header_spec.js -ee/spec/frontend/geo_nodes/components/geo_node_sync_progress_spec.js -ee/spec/frontend/geo_nodes/components/node_detail_sections/node_details_section_main_spec.js -ee/spec/frontend/geo_nodes/components/node_detail_sections/node_details_section_other_spec.js -ee/spec/frontend/geo_nodes/store/geo_nodes_store_spec.js -ee/spec/frontend/geo_replicable/components/app_spec.js -ee/spec/frontend/geo_replicable/components/geo_replicable_filter_bar_spec.js -ee/spec/frontend/geo_replicable/components/geo_replicable_spec.js -ee/spec/frontend/geo_replicable/store/actions_spec.js -ee/spec/frontend/group_member_contributions/components/table_header_spec.js -ee/spec/frontend/group_member_contributions/store/group_member_store_spec.js -ee/spec/frontend/groups/components/invite_members_spec.js -ee/spec/frontend/groups/components/registration_trial_toggle_spec.js -ee/spec/frontend/groups/settings/compliance_frameworks/components/list_spec.js -ee/spec/frontend/groups/settings/components/comma_separated_list_token_selector_spec.js -ee/spec/frontend/insights/components/insights_chart_spec.js -ee/spec/frontend/issue_show/components/incidents/incident_sla_spec.js - -## boring-brattain -ee/spec/frontend/issues_analytics/components/issues_analytics_spec.js -ee/spec/frontend/issues_analytics/components/issues_analytics_table_spec.js -ee/spec/frontend/issues_analytics/mock_data.js -ee/spec/frontend/iterations/components/iteration_report_tabs_spec.js -ee/spec/frontend/iterations/components/iterations_spec.js -ee/spec/frontend/license_compliance/components/app_spec.js -ee/spec/frontend/license_compliance/components/license_component_links_spec.js -ee/spec/frontend/license_compliance/components/licenses_table_spec.js -ee/spec/frontend/maintenance_mode_settings/components/app_spec.js -ee/spec/frontend/members/components/ldap/ldap_override_confirmation_modal_spec.js -ee/spec/frontend/members/components/table/members_table_spec.js -ee/spec/frontend/members/utils_spec.js -ee/spec/frontend/notes/components/note_header_spec.js -ee/spec/frontend/on_demand_scans/components/on_demand_scans_app_spec.js -ee/spec/frontend/on_demand_scans/components/on_demand_scans_form_spec.js -ee/spec/frontend/on_demand_scans/components/profile_selector/profile_selector_spec.js -ee/spec/frontend/on_demand_scans/components/profile_selector/scanner_profile_selector_spec.js -ee/spec/frontend/on_demand_scans/components/profile_selector/site_profile_selector_spec.js -ee/spec/frontend/on_demand_scans/mocks/apollo_mocks.js -ee/spec/frontend/oncall_schedule/schedule/components/preset_weeks/weeks_header_sub_item_spec.js -ee/spec/frontend/pages/groups/saml_providers/saml_members/store/actions_spec.js -ee/spec/frontend/projects/merge_requests/blocking_mr_input_root_spec.js -ee/spec/frontend/related_items_tree/components/create_issue_form_spec.js -ee/spec/frontend/related_items_tree/store/actions_spec.js -ee/spec/frontend/related_items_tree/store/mutations_spec.js -ee/spec/frontend/requirements/components/requirement_status_badge_spec.js -ee/spec/frontend/roadmap/components/epic_item_details_spec.js -ee/spec/frontend/roadmap/components/epic_item_spec.js -ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js -ee/spec/frontend/roadmap/components/epics_list_empty_spec.js -ee/spec/frontend/roadmap/components/milestones_list_section_spec.js - -## compassionate-aryabhata -ee/spec/frontend/roadmap/components/preset_months/months_header_sub_item_spec.js -ee/spec/frontend/roadmap/components/preset_quarters/quarters_header_item_spec.js -ee/spec/frontend/roadmap/components/preset_quarters/quarters_header_sub_item_spec.js -ee/spec/frontend/roadmap/components/preset_weeks/weeks_header_sub_item_spec.js -ee/spec/frontend/roadmap/store/actions_spec.js -ee/spec/frontend/roadmap/store/mutations_spec.js -ee/spec/frontend/saml_providers/dirty_form_checker_spec.js -ee/spec/frontend/saml_providers/saml_settings_form_spec.js -ee/spec/frontend/scim_token/scim_token_toggle_area_spec.js -ee/spec/frontend/security_configuration/components/app_spec.js -ee/spec/frontend/security_configuration/components/feature_status_spec.js -ee/spec/frontend/security_configuration/components/helpers.js -ee/spec/frontend/security_configuration/components/manage_feature_spec.js -ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_list_spec.js -ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_spec.js -ee/spec/frontend/security_configuration/dast_profiles/components/dast_site_profiles_list_spec.js -ee/spec/frontend/security_configuration/dast_scanner_profiles_form/components/dast_scanner_profiles_form_spec.js -ee/spec/frontend/security_configuration/dast_site_profiles_form/components/dast_site_auth_section_spec.js -ee/spec/frontend/security_configuration/sast/components/configuration_form_spec.js -ee/spec/frontend/security_configuration/sast/components/dynamic_fields_spec.js -ee/spec/frontend/security_configuration/sast/components/helpers.js -ee/spec/frontend/security_configuration/sast/components/utils_spec.js -ee/spec/frontend/security_dashboard/components/auto_fix_help_text_spec.js -ee/spec/frontend/security_dashboard/components/filters/filter_body_spec.js -ee/spec/frontend/security_dashboard/components/filters/filter_item_spec.js -ee/spec/frontend/security_dashboard/components/filters/standard_filter_spec.js -ee/spec/frontend/security_dashboard/components/first_class_project_manager/project_list_spec.js -ee/spec/frontend/security_dashboard/components/first_class_project_security_dashboard_spec.js -ee/spec/frontend/security_dashboard/components/first_class_vulnerability_severities_spec.js -ee/spec/frontend/security_dashboard/components/loading_error_spec.js -ee/spec/frontend/security_dashboard/components/pipeline_security_dashboard_spec.js -ee/spec/frontend/security_dashboard/components/pipeline_status_badge_spec.js -ee/spec/frontend/security_dashboard/components/security_charts_layout_spec.js -ee/spec/frontend/security_dashboard/components/security_dashboard_layout_spec.js -ee/spec/frontend/security_dashboard/components/security_dashboard_table_row_spec.js -ee/spec/frontend/security_dashboard/components/security_dashboard_vuex_spec.js -ee/spec/frontend/security_dashboard/components/security_reports_summary_spec.js -ee/spec/frontend/security_dashboard/components/security_scanner_alert_spec.js -ee/spec/frontend/security_dashboard/components/selection_summary_spec.js -ee/spec/frontend/security_dashboard/components/selection_summary_vuex_spec.js -ee/spec/frontend/security_dashboard/components/vulnerability_count_list_layout_spec.js - -## jovial-haslett -ee/spec/frontend/security_dashboard/helpers.js -ee/spec/frontend/security_dashboard/helpers_spec.js -ee/spec/frontend/security_dashboard/store/modules/filters/mutations_spec.js -ee/spec/frontend/security_dashboard/store/modules/pipeline_jobs/actions_spec.js -ee/spec/frontend/security_dashboard/store/modules/project_selector/actions_spec.js -ee/spec/frontend/security_dashboard/store/modules/project_selector/utils/add_page_info_spec.js -ee/spec/frontend/security_dashboard/store/modules/projects/actions_spec.js -ee/spec/frontend/security_dashboard/store/modules/unscanned_projects/getters_spec.js -ee/spec/frontend/security_dashboard/store/modules/unscanned_projects/utils_spec.js -ee/spec/frontend/security_dashboard/store/modules/vulnerabilities/actions_spec.js -ee/spec/frontend/security_dashboard/store/modules/vulnerabilities/utils_spec.js -ee/spec/frontend/security_dashboard/store/modules/vulnerable_projects/mock_data.js -ee/spec/frontend/security_dashboard/store/modules/vulnerable_projects/utils_spec.js -ee/spec/frontend/sidebar/components/iteration_select_spec.js -ee/spec/frontend/sidebar/components/status/sidebar_status_spec.js -ee/spec/frontend/status_page_settings/store/actions_spec.js -ee/spec/frontend/storage_counter/components/usage_graph_spec.js -ee/spec/frontend/storage_counter/components/usage_statistics_spec.js -ee/spec/frontend/storage_counter/mock_data.js -ee/spec/frontend/storage_counter/utils_spec.js -ee/spec/frontend/subscriptions/new/components/checkout/progress_bar_spec.js -ee/spec/frontend/subscriptions/new/components/checkout/step_spec.js -ee/spec/frontend/subscriptions/new/components/checkout/subscription_details_spec.js -ee/spec/frontend/subscriptions/new/store/actions_spec.js -ee/spec/frontend/test_case_create/components/test_case_create_root_spec.js -ee/spec/frontend/threat_monitoring/components/app_spec.js -ee/spec/frontend/threat_monitoring/components/environment_picker_spec.js -ee/spec/frontend/threat_monitoring/components/network_policy_list_spec.js -ee/spec/frontend/threat_monitoring/components/policy_editor/lib/rules_spec.js -ee/spec/frontend/threat_monitoring/components/policy_editor/policy_rule_builder_spec.js -ee/spec/frontend/threat_monitoring/components/policy_editor/policy_rule_entity_spec.js - -## modest-kilby -ee/spec/frontend/threat_monitoring/components/statistics_summary_spec.js -ee/spec/frontend/threat_monitoring/components/threat_monitoring_filters_spec.js -ee/spec/frontend/threat_monitoring/store/modules/threat_monitoring/actions_spec.js -ee/spec/frontend/threat_monitoring/store/modules/threat_monitoring_statistics/getters_spec.js -ee/spec/frontend/threat_monitoring/store/modules/threat_monitoring_statistics/mutations_spec.js -ee/spec/frontend/trial_registrations/username_suggester_spec.js -ee/spec/frontend/vue_mr_widget/components/approvals/approvals_auth_spec.js -ee/spec/frontend/vue_mr_widget/components/approvals/approvals_footer_spec.js -ee/spec/frontend/vue_mr_widget/components/approvals/approvals_list_spec.js -ee/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js -ee/spec/frontend/vue_mr_widget/components/blocking_merge_requests/blocking_merge_requests_report_spec.js -ee/spec/frontend/vue_mr_widget/components/merge_train_helper_text_spec.js -ee/spec/frontend/vue_mr_widget/components/merge_train_position_indicator_spec.js -ee/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js -ee/spec/frontend/vue_mr_widget/ee_mr_widget_options_spec.js -ee/spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js -ee/spec/frontend/vue_shared/components/accordion/accordion_item_spec.js -ee/spec/frontend/vue_shared/components/deployment_instance/deployment_instance_spec.js -ee/spec/frontend/vue_shared/components/notes/system_note_spec.js -ee/spec/frontend/vue_shared/components/security_reports/severity_badge_spec.js -ee/spec/frontend/vue_shared/components/sidebar/epics_select/base_spec.js -ee/spec/frontend/vue_shared/components/sidebar/epics_select/dropdown_contents_spec.js -ee/spec/frontend/vue_shared/components/sidebar/epics_select/store/actions_spec.js -ee/spec/frontend/vue_shared/components/sidebar/epics_select/store/getters_spec.js -ee/spec/frontend/vue_shared/dashboards/store/actions_spec.js -ee/spec/frontend/vue_shared/dashboards/store/mutations_spec.js -ee/spec/frontend/vue_shared/discover/card_security_discover_app_spec.js -ee/spec/frontend/vue_shared/license_compliance/components/add_license_form_dropdown_spec.js -ee/spec/frontend/vue_shared/license_compliance/components/admin_license_management_row_spec.js -ee/spec/frontend/vue_shared/license_compliance/components/delete_confirmation_modal_spec.js -ee/spec/frontend/vue_shared/license_compliance/components/license_packages_spec.js - -## interesting-galileo -ee/spec/frontend/vue_shared/license_compliance/license_management_spec.js -ee/spec/frontend/vue_shared/license_compliance/mock_data.js -ee/spec/frontend/vue_shared/license_compliance/mr_widget_license_report_spec.js -ee/spec/frontend/vue_shared/license_compliance/store/actions_spec.js -ee/spec/frontend/vue_shared/license_compliance/store/getters_spec.js -ee/spec/frontend/vue_shared/security_reports/components/dast_modal_spec.js -ee/spec/frontend/vue_shared/security_reports/components/dismiss_button_spec.js -ee/spec/frontend/vue_shared/security_reports/components/modal_footer_spec.js -ee/spec/frontend/vue_shared/security_reports/components/modal_spec.js -ee/spec/frontend/vue_shared/security_reports/components/security_issue_body_spec.js -ee/spec/frontend/vue_shared/security_reports/components/split_button_spec.js -ee/spec/frontend/vue_shared/security_reports/components/vulnerability_details_spec.js -ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js -ee/spec/frontend/vue_shared/security_reports/store/actions_spec.js -ee/spec/frontend/vue_shared/security_reports/store/getters_spec.js -ee/spec/frontend/vue_shared/security_reports/store/mediator_spec.js -ee/spec/frontend/vue_shared/security_reports/store/modules/api_fuzzing/actions_spec.js -ee/spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js -ee/spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js -ee/spec/frontend/vulnerabilities/details_spec.js -ee/spec/frontend/vulnerabilities/header_spec.js -ee/spec/frontend/vulnerabilities/helpers_spec.js -ee/spec/frontend/vulnerabilities/history_comment_editor_spec.js -ee/spec/frontend/vulnerabilities/history_comment_spec.js -ee/spec/frontend/vulnerabilities/history_entry_spec.js -ee/spec/frontend/vulnerabilities/issue_link_spec.js -ee/spec/frontend/vulnerabilities/related_issues_spec.js -ee/spec/frontend/vulnerabilities/status_description_spec.js -ee/spec/frontend/vulnerabilities/vulnerability_state_dropdown_spec.js - -## relaxed-goldwasser -spec/frontend/__mocks__/@gitlab/ui.js -spec/frontend/__mocks__/lodash/debounce.js -spec/frontend/__mocks__/lodash/throttle.js -spec/frontend/activities_spec.js -spec/frontend/add_context_commits_modal/store/actions_spec.js -spec/frontend/admin/statistics_panel/components/app_spec.js -spec/frontend/admin/statistics_panel/store/actions_spec.js -spec/frontend/alert_handler_spec.js -spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js -spec/frontend/alerts_settings/alert_mapping_builder_spec.js -spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js -spec/frontend/analytics/instance_statistics/components/app_spec.js -spec/frontend/api_spec.js -spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js -spec/frontend/authentication/u2f/authenticate_spec.js -spec/frontend/authentication/u2f/register_spec.js -spec/frontend/awards_handler_spec.js -spec/frontend/badges/components/badge_form_spec.js -spec/frontend/badges/components/badge_list_row_spec.js -spec/frontend/badges/components/badge_list_spec.js -spec/frontend/badges/components/badge_spec.js -spec/frontend/badges/store/actions_spec.js -spec/frontend/batch_comments/components/draft_note_spec.js -spec/frontend/batch_comments/components/drafts_count_spec.js -spec/frontend/batch_comments/components/preview_item_spec.js -spec/frontend/batch_comments/components/publish_button_spec.js -spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js -spec/frontend/behaviors/autosize_spec.js -spec/frontend/behaviors/copy_as_gfm_spec.js -spec/frontend/behaviors/load_startup_css_spec.js -spec/frontend/behaviors/markdown/paste_markdown_table_spec.js -spec/frontend/behaviors/quick_submit_spec.js -spec/frontend/behaviors/secret_values_spec.js - -## eager-lamport -spec/frontend/behaviors/shortcuts/keybindings_spec.js -spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js -spec/frontend/blob/components/blob_content_error_spec.js -spec/frontend/blob/components/blob_edit_content_spec.js -spec/frontend/blob/components/blob_edit_header_spec.js -spec/frontend/blob/components/blob_header_spec.js -spec/frontend/blob/sketch/index_spec.js -spec/frontend/blob/utils_spec.js -spec/frontend/blob/viewer/index_spec.js -spec/frontend/blob_edit/edit_blob_spec.js -spec/frontend/boards/board_list_new_spec.js -spec/frontend/boards/board_list_spec.js -spec/frontend/boards/boards_store_spec.js -spec/frontend/boards/components/board_assignee_dropdown_spec.js -spec/frontend/boards/components/board_card_layout_spec.js -spec/frontend/boards/components/board_card_spec.js -spec/frontend/boards/components/board_configuration_options_spec.js -spec/frontend/boards/components/board_list_header_new_spec.js -spec/frontend/boards/components/board_list_header_spec.js -spec/frontend/boards/components/boards_selector_spec.js -spec/frontend/boards/components/issue_count_spec.js -spec/frontend/boards/components/issue_due_date_spec.js -spec/frontend/boards/components/issue_time_estimate_deprecated_spec.js -spec/frontend/boards/components/issue_time_estimate_spec.js -spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js -spec/frontend/boards/components/sidebar/remove_issue_spec.js -spec/frontend/boards/issue_card_deprecated_spec.js -spec/frontend/boards/issue_card_inner_spec.js -spec/frontend/boards/list_spec.js -spec/frontend/boards/mock_data.js -spec/frontend/boards/stores/actions_spec.js -spec/frontend/boards/stores/getters_spec.js -spec/frontend/boards/stores/mutations_spec.js - -## busy-mayer -spec/frontend/branches/branches_delete_modal_spec.js -spec/frontend/ci_settings_pipeline_triggers/components/triggers_list_spec.js -spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js -spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js -spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js -spec/frontend/ci_variable_list/store/actions_spec.js -spec/frontend/clusters/clusters_bundle_spec.js -spec/frontend/clusters/components/application_row_spec.js -spec/frontend/clusters/components/applications_spec.js -spec/frontend/clusters/components/fluentd_output_settings_spec.js -spec/frontend/clusters/services/application_state_machine_spec.js -spec/frontend/clusters_list/components/node_error_help_text_spec.js -spec/frontend/clusters_list/store/actions_spec.js -spec/frontend/code_navigation/store/actions_spec.js -spec/frontend/collapsed_sidebar_todo_spec.js -spec/frontend/commit/commit_pipeline_status_component_spec.js -spec/frontend/commit/pipelines/pipelines_spec.js -spec/frontend/commits_spec.js -spec/frontend/confirm_modal_spec.js -spec/frontend/contributors/store/actions_spec.js -spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js -spec/frontend/create_cluster/eks_cluster/store/actions_spec.js -spec/frontend/create_cluster/eks_cluster/store/getters_spec.js -spec/frontend/create_cluster/eks_cluster/store/mutations_spec.js -spec/frontend/create_cluster/gke_cluster/helpers.js -spec/frontend/create_cluster/gke_cluster/stores/actions_spec.js -spec/frontend/create_cluster/gke_cluster_namespace/gke_cluster_namespace_spec.js -spec/frontend/create_cluster/store/cluster_dropdown/mutations_spec.js -spec/frontend/create_item_dropdown_spec.js -spec/frontend/create_merge_request_dropdown_spec.js -spec/frontend/custom_metrics/components/custom_metrics_form_fields_spec.js - -## eloquent-black -spec/frontend/cycle_analytics/limit_warning_component_spec.js -spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js -spec/frontend/deploy_keys/components/key_spec.js -spec/frontend/deploy_keys/components/keys_panel_spec.js -spec/frontend/deprecated_jquery_dropdown_spec.js -spec/frontend/design_management/components/design_notes/design_discussion_spec.js -spec/frontend/design_management/components/design_overlay_spec.js -spec/frontend/design_management/components/design_scaler_spec.js -spec/frontend/design_management/components/upload/design_version_dropdown_spec.js -spec/frontend/design_management/pages/index_spec.js -spec/frontend/design_management/router_spec.js -spec/frontend/design_management/utils/error_messages_spec.js -spec/frontend/diffs/components/app_spec.js -spec/frontend/diffs/components/compare_dropdown_layout_spec.js -spec/frontend/diffs/components/compare_versions_spec.js -spec/frontend/diffs/components/diff_content_spec.js -spec/frontend/diffs/components/diff_discussions_spec.js -spec/frontend/diffs/components/diff_expansion_cell_spec.js -spec/frontend/diffs/components/diff_file_spec.js -spec/frontend/diffs/components/diff_line_note_form_spec.js -spec/frontend/diffs/components/diff_stats_spec.js -spec/frontend/diffs/components/diff_view_spec.js -spec/frontend/diffs/components/image_diff_overlay_spec.js -spec/frontend/diffs/components/no_changes_spec.js -spec/frontend/diffs/components/parallel_diff_table_row_spec.js -spec/frontend/diffs/components/settings_dropdown_spec.js -spec/frontend/diffs/store/actions_spec.js -spec/frontend/diffs/store/getters_versions_dropdowns_spec.js -spec/frontend/diffs/store/utils_spec.js -spec/frontend/diffs/utils/uuids_spec.js -spec/frontend/dirty_submit/dirty_submit_collection_spec.js -spec/frontend/dirty_submit/dirty_submit_form_spec.js - -## exciting-driscoll -spec/frontend/droplab/drop_down_spec.js -spec/frontend/droplab/plugins/ajax_filter_spec.js -spec/frontend/editor/editor_lite_extension_base_spec.js -spec/frontend/editor/editor_lite_spec.js -spec/frontend/editor/editor_markdown_ext_spec.js -spec/frontend/emoji/emoji_spec.js -spec/frontend/environment.js -spec/frontend/environments/environment_actions_spec.js -spec/frontend/environments/environment_table_spec.js -spec/frontend/environments/environment_terminal_button_spec.js -spec/frontend/environments/folder/environments_folder_view_spec.js -spec/frontend/error_tracking/components/error_details_spec.js -spec/frontend/error_tracking/components/error_tracking_list_spec.js -spec/frontend/error_tracking/store/actions_spec.js -spec/frontend/error_tracking/store/details/actions_spec.js -spec/frontend/error_tracking/store/list/actions_spec.js -spec/frontend/error_tracking_settings/store/actions_spec.js -spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js -spec/frontend/feature_flags/components/edit_feature_flag_spec.js -spec/frontend/feature_flags/components/environments_dropdown_spec.js -spec/frontend/feature_flags/components/feature_flags_spec.js -spec/frontend/feature_flags/components/form_spec.js -spec/frontend/feature_flags/components/new_environments_dropdown_spec.js -spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js -spec/frontend/feature_flags/components/user_lists_table_spec.js -spec/frontend/feature_flags/store/edit/actions_spec.js -spec/frontend/feature_flags/store/index/actions_spec.js -spec/frontend/feature_flags/store/index/mutations_spec.js -spec/frontend/feature_flags/store/new/actions_spec.js -spec/frontend/feature_highlight/feature_highlight_helper_spec.js -spec/frontend/filtered_search/components/recent_searches_dropdown_content_spec.js - -## determined-blackburn -spec/frontend/filtered_search/filtered_search_manager_spec.js -spec/frontend/filtered_search/filtered_search_token_keys_spec.js -spec/frontend/filtered_search/filtered_search_visual_tokens_spec.js -spec/frontend/filtered_search/issues_filtered_search_token_keys_spec.js -spec/frontend/filtered_search/recent_searches_root_spec.js -spec/frontend/filtered_search/services/recent_searches_service_spec.js -spec/frontend/filtered_search/visual_token_value_spec.js -spec/frontend/flash_spec.js -spec/frontend/frequent_items/components/app_spec.js -spec/frontend/frequent_items/components/frequent_items_list_item_spec.js -spec/frontend/frequent_items/components/frequent_items_search_input_spec.js -spec/frontend/frequent_items/store/actions_spec.js -spec/frontend/gfm_auto_complete_spec.js -spec/frontend/gl_field_errors_spec.js -spec/frontend/gl_form_spec.js -spec/frontend/gpg_badges_spec.js -spec/frontend/group_settings/components/shared_runners_form_spec.js -spec/frontend/groups/components/group_item_spec.js -spec/frontend/groups/components/visibility_level_dropdown_spec.js -spec/frontend/helpers/backoff_helper.js -spec/frontend/helpers/dom_events_helper.js -spec/frontend/helpers/dom_shims/size_properties.js -spec/frontend/helpers/emoji.js -spec/frontend/helpers/event_hub_factory_spec.js -spec/frontend/helpers/fake_date.js -spec/frontend/helpers/fake_request_animation_frame.js -spec/frontend/helpers/fixtures.js -spec/frontend/helpers/jest_helpers.js -spec/frontend/helpers/local_storage_helper.js -spec/frontend/helpers/locale_helper.js -spec/frontend/helpers/mock_window_location_helper.js -spec/frontend/helpers/set_timeout_promise_helper.js -spec/frontend/helpers/set_window_location_helper_spec.js -spec/frontend/helpers/startup_css_helper_spec.js -spec/frontend/helpers/stub_children.js -spec/frontend/helpers/text_helper.js -spec/frontend/helpers/timeout.js -spec/frontend/helpers/tracking_helper.js -spec/frontend/helpers/vue_mock_directive.js -spec/frontend/helpers/vue_test_utils_helper.js -spec/frontend/helpers/vuex_action_helper.js -spec/frontend/helpers/vuex_action_helper_spec.js -spec/frontend/helpers/wait_for_promises.js -spec/frontend/helpers/wait_using_real_timer.js - -## condescending-haslett -spec/frontend/ide/components/activity_bar_spec.js -spec/frontend/ide/components/branches/search_list_spec.js -spec/frontend/ide/components/commit_sidebar/actions_spec.js -spec/frontend/ide/components/commit_sidebar/list_item_spec.js -spec/frontend/ide/components/commit_sidebar/list_spec.js -spec/frontend/ide/components/commit_sidebar/message_field_spec.js -spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js -spec/frontend/ide/components/commit_sidebar/radio_group_spec.js -spec/frontend/ide/components/commit_sidebar/success_message_spec.js -spec/frontend/ide/components/error_message_spec.js -spec/frontend/ide/components/file_row_extra_spec.js -spec/frontend/ide/components/file_templates/bar_spec.js -spec/frontend/ide/components/file_templates/dropdown_spec.js -spec/frontend/ide/components/ide_sidebar_nav_spec.js -spec/frontend/ide/components/ide_spec.js -spec/frontend/ide/components/ide_status_bar_spec.js -spec/frontend/ide/components/ide_status_mr_spec.js -spec/frontend/ide/components/ide_tree_list_spec.js -spec/frontend/ide/components/jobs/detail/scroll_button_spec.js -spec/frontend/ide/components/jobs/detail_spec.js -spec/frontend/ide/components/jobs/item_spec.js -spec/frontend/ide/components/jobs/list_spec.js -spec/frontend/ide/components/jobs/stage_spec.js -spec/frontend/ide/components/merge_requests/list_spec.js -spec/frontend/ide/components/nav_dropdown_button_spec.js -spec/frontend/ide/components/nav_dropdown_spec.js -spec/frontend/ide/components/new_dropdown/button_spec.js -spec/frontend/ide/components/new_dropdown/index_spec.js -spec/frontend/ide/components/new_dropdown/modal_spec.js -spec/frontend/ide/components/new_dropdown/upload_spec.js -spec/frontend/ide/components/panes/collapsible_sidebar_spec.js -spec/frontend/ide/components/panes/right_spec.js - -## jovial-mirzakhani -spec/frontend/ide/components/repo_commit_section_spec.js -spec/frontend/ide/components/repo_editor_spec.js -spec/frontend/ide/components/repo_tabs_spec.js -spec/frontend/ide/components/resizable_panel_spec.js -spec/frontend/ide/components/shared/tokened_input_spec.js -spec/frontend/ide/components/terminal/session_spec.js -spec/frontend/ide/components/terminal/terminal_controls_spec.js -spec/frontend/ide/components/terminal/terminal_spec.js -spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js -spec/frontend/ide/file_helpers.js -spec/frontend/ide/helpers.js -spec/frontend/ide/ide_router_extension_spec.js -spec/frontend/ide/ide_router_spec.js -spec/frontend/ide/lib/common/model_spec.js -spec/frontend/ide/lib/create_diff_spec.js -spec/frontend/ide/lib/create_file_diff_spec.js -spec/frontend/ide/lib/diff/controller_spec.js -spec/frontend/ide/lib/editor_spec.js -spec/frontend/ide/lib/editorconfig/parser_spec.js -spec/frontend/ide/lib/errors_spec.js -spec/frontend/ide/lib/files_spec.js -spec/frontend/ide/lib/mirror_spec.js -spec/frontend/ide/services/index_spec.js -spec/frontend/ide/stores/actions/file_spec.js -spec/frontend/ide/stores/actions/merge_request_spec.js -spec/frontend/ide/stores/actions/project_spec.js -spec/frontend/ide/stores/actions/tree_spec.js -spec/frontend/ide/stores/actions_spec.js -spec/frontend/ide/stores/extend_spec.js -spec/frontend/ide/stores/getters_spec.js -spec/frontend/ide/stores/integration_spec.js - -## angry-bhabha -spec/frontend/ide/stores/modules/branches/actions_spec.js -spec/frontend/ide/stores/modules/branches/mutations_spec.js -spec/frontend/ide/stores/modules/clientside/actions_spec.js -spec/frontend/ide/stores/modules/commit/actions_spec.js -spec/frontend/ide/stores/modules/commit/getters_spec.js -spec/frontend/ide/stores/modules/file_templates/actions_spec.js -spec/frontend/ide/stores/modules/merge_requests/actions_spec.js -spec/frontend/ide/stores/modules/pane/actions_spec.js -spec/frontend/ide/stores/modules/pipelines/actions_spec.js -spec/frontend/ide/stores/modules/pipelines/mutations_spec.js -spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js -spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js -spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js -spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js -spec/frontend/ide/stores/mutations/file_spec.js -spec/frontend/ide/sync_router_and_store_spec.js -spec/frontend/ide/utils_spec.js -spec/frontend/image_diff/init_discussion_tab_spec.js -spec/frontend/image_diff/replaced_image_diff_spec.js -spec/frontend/import_entities/import_groups/components/import_table_row_spec.js -spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js -spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js -spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js -spec/frontend/import_entities/import_projects/store/actions_spec.js -spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js -spec/frontend/integrations/edit/components/jira_issues_fields_spec.js -spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js -spec/frontend/integrations/edit/components/trigger_fields_spec.js -spec/frontend/issuable/related_issues/components/related_issues_block_spec.js -spec/frontend/issuable_show/components/issuable_body_spec.js -spec/frontend/issuable_show/components/issuable_edit_form_spec.js -spec/frontend/issuable_show/components/issuable_header_spec.js -spec/frontend/issuable_show/components/issuable_show_root_spec.js - -## practical-murdock -spec/frontend/issuable_spec.js -spec/frontend/issue_show/components/app_spec.js -spec/frontend/issue_show/components/description_spec.js -spec/frontend/issue_show/components/edit_actions_spec.js -spec/frontend/issue_show/components/fields/description_spec.js -spec/frontend/issue_show/components/form_spec.js -spec/frontend/issue_show/components/header_actions_spec.js -spec/frontend/issue_show/components/incidents/highlight_bar_spec.js -spec/frontend/issue_show/components/pinned_links_spec.js -spec/frontend/issue_show/issue_spec.js -spec/frontend/issue_spec.js -spec/frontend/issues_list/components/issuable_spec.js -spec/frontend/issues_list/components/issuables_list_app_spec.js -spec/frontend/jira_import/components/jira_import_form_spec.js -spec/frontend/jira_import/components/jira_import_progress_spec.js -spec/frontend/jira_import/components/jira_import_setup_spec.js -spec/frontend/jobs/components/artifacts_block_spec.js -spec/frontend/jobs/components/empty_state_spec.js -spec/frontend/jobs/components/erased_block_spec.js -spec/frontend/jobs/components/job_app_spec.js -spec/frontend/jobs/components/job_container_item_spec.js -spec/frontend/jobs/components/job_log_controllers_spec.js -spec/frontend/jobs/components/log/line_spec.js -spec/frontend/jobs/components/manual_variables_form_spec.js -spec/frontend/jobs/components/stuck_block_spec.js -spec/frontend/jobs/components/trigger_block_spec.js -spec/frontend/jobs/store/actions_spec.js -spec/frontend/jobs/store/helpers.js -spec/frontend/lazy_loader_spec.js -spec/frontend/lib/dompurify_spec.js -spec/frontend/lib/utils/ajax_cache_spec.js -spec/frontend/lib/utils/apollo_startup_js_link_spec.js -spec/frontend/lib/utils/common_utils_spec.js -spec/frontend/lib/utils/datetime_range_spec.js -spec/frontend/lib/utils/datetime_utility_spec.js -spec/frontend/lib/utils/dom_utils_spec.js -spec/frontend/lib/utils/forms_spec.js -spec/frontend/lib/utils/highlight_spec.js -spec/frontend/lib/utils/icon_utils_spec.js -spec/frontend/lib/utils/poll_spec.js -spec/frontend/lib/utils/poll_until_complete_spec.js -spec/frontend/lib/utils/text_utility_spec.js -spec/frontend/lib/utils/url_utility_spec.js -spec/frontend/lib/utils/users_cache_spec.js - -## determined-shamir -spec/frontend/logs/components/environment_logs_spec.js -spec/frontend/logs/components/log_advanced_filters_spec.js -spec/frontend/logs/components/log_control_buttons_spec.js -spec/frontend/logs/components/log_simple_filters_spec.js -spec/frontend/logs/stores/actions_spec.js -spec/frontend/logs/stores/mutations_spec.js -spec/frontend/matchers.js -spec/frontend/matchers_spec.js -spec/frontend/members/components/avatars/user_avatar_spec.js -spec/frontend/members/components/filter_sort/filter_sort_container_spec.js -spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js -spec/frontend/members/components/filter_sort/sort_dropdown_spec.js -spec/frontend/members/components/modals/remove_group_link_modal_spec.js -spec/frontend/members/components/table/created_at_spec.js -spec/frontend/members/components/table/expiration_datepicker_spec.js -spec/frontend/members/components/table/expires_at_spec.js -spec/frontend/members/components/table/member_avatar_spec.js -spec/frontend/members/components/table/member_source_spec.js -spec/frontend/members/components/table/members_table_spec.js -spec/frontend/members/components/table/role_dropdown_spec.js -spec/frontend/members/utils_spec.js -spec/frontend/merge_request_spec.js -spec/frontend/merge_request_tabs_spec.js -spec/frontend/milestones/milestone_combobox_spec.js -spec/frontend/mini_pipeline_graph_dropdown_spec.js -spec/frontend/mocks/ce/lib/utils/axios_utils.js -spec/frontend/mocks/mocks_helper.js -spec/frontend/mocks/mocks_helper_spec.js -spec/frontend/monitoring/alert_widget_spec.js -spec/frontend/monitoring/components/charts/annotations_spec.js -spec/frontend/monitoring/components/charts/anomaly_spec.js -spec/frontend/monitoring/components/charts/bar_spec.js -spec/frontend/monitoring/components/charts/column_spec.js -spec/frontend/monitoring/components/charts/gauge_spec.js -spec/frontend/monitoring/components/charts/options_spec.js -spec/frontend/monitoring/components/charts/stacked_column_spec.js -spec/frontend/monitoring/components/charts/time_series_spec.js ## beautiful-benz spec/frontend/monitoring/components/dashboard_actions_menu_spec.js @@ -2255,159 +723,3 @@ spec/frontend/set_status_modal/set_status_modal_wrapper_spec.js spec/frontend/shared/popover_spec.js spec/frontend/shortcuts_spec.js spec/frontend/sidebar/assignee_title_spec.js - -## exciting-buck -spec/frontend/sidebar/components/assignees/collapsed_assignee_list_spec.js -spec/frontend/sidebar/components/severity/severity_spec.js -spec/frontend/sidebar/components/severity/sidebar_severity_spec.js -spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js -spec/frontend/sidebar/confidential/edit_form_spec.js -spec/frontend/sidebar/lock/edit_form_buttons_spec.js -spec/frontend/sidebar/lock/edit_form_spec.js -spec/frontend/sidebar/lock/issuable_lock_form_spec.js -spec/frontend/sidebar/participants_spec.js -spec/frontend/sidebar/reviewer_title_spec.js -spec/frontend/sidebar/sidebar_mediator_spec.js -spec/frontend/sidebar/sidebar_move_issue_spec.js -spec/frontend/sidebar/subscriptions_spec.js -spec/frontend/snippet/collapsible_input_spec.js -spec/frontend/snippets/components/embed_dropdown_spec.js -spec/frontend/snippets/components/snippet_blob_actions_edit_spec.js -spec/frontend/snippets/components/snippet_visibility_edit_spec.js -spec/frontend/snippets/utils/blob_spec.js -spec/frontend/static_site_editor/components/edit_area_spec.js -spec/frontend/static_site_editor/components/edit_meta_controls_spec.js -spec/frontend/static_site_editor/graphql/resolvers/file_spec.js -spec/frontend/static_site_editor/services/load_source_content_spec.js -spec/frontend/static_site_editor/services/submit_content_changes_spec.js -spec/frontend/syntax_highlight_spec.js -spec/frontend/task_list_spec.js -spec/frontend/tooltips/components/tooltips_spec.js -spec/frontend/tooltips/index_spec.js -spec/frontend/user_lists/components/add_user_modal_spec.js -spec/frontend/user_lists/components/edit_user_list_spec.js -spec/frontend/user_lists/components/new_user_list_spec.js -spec/frontend/user_lists/components/user_list_spec.js - -## priceless-margulis -spec/frontend/user_popovers_spec.js -spec/frontend/vue_alerts_spec.js -spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js -spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js -spec/frontend/vue_mr_widget/components/artifacts_list_spec.js -spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js -spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js -spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js -spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js -spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js -spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js -spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js -spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js -spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js -spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js -spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js -spec/frontend/vue_mr_widget/deployment/deployment_spec.js -spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js -spec/frontend/vue_mr_widget/mr_widget_options_spec.js -spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js -spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js -spec/frontend/vue_shared/components/actions_button_spec.js -spec/frontend/vue_shared/components/alert_details_table_spec.js -spec/frontend/vue_shared/components/awards_list_spec.js -spec/frontend/vue_shared/components/ci_badge_link_spec.js -spec/frontend/vue_shared/components/commit_spec.js -spec/frontend/vue_shared/components/confirm_modal_spec.js - -## trusting-antonelli -spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js -spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js -spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js -spec/frontend/vue_shared/components/deprecated_modal_2_spec.js -spec/frontend/vue_shared/components/diff_viewer/diff_viewer_spec.js -spec/frontend/vue_shared/components/diff_viewer/viewers/image_diff_viewer_spec.js -spec/frontend/vue_shared/components/dismissible_container_spec.js -spec/frontend/vue_shared/components/editor_lite_spec.js -spec/frontend/vue_shared/components/expand_button_spec.js -spec/frontend/vue_shared/components/file_finder/index_spec.js -spec/frontend/vue_shared/components/file_finder/item_spec.js -spec/frontend/vue_shared/components/file_tree_spec.js -spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js -spec/frontend/vue_shared/components/filtered_search_bar/store/modules/filters/test_helper.js -spec/frontend/vue_shared/components/gl_countdown_spec.js -spec/frontend/vue_shared/components/gl_modal_vuex_spec.js -spec/frontend/vue_shared/components/issuable/issuable_header_warnings_spec.js -spec/frontend/vue_shared/components/issue/issue_assignees_spec.js -spec/frontend/vue_shared/components/issue/issue_milestone_spec.js -spec/frontend/vue_shared/components/local_storage_sync_spec.js -spec/frontend/vue_shared/components/markdown/apply_suggestion_spec.js -spec/frontend/vue_shared/components/markdown/header_spec.js -spec/frontend/vue_shared/components/markdown/suggestions_spec.js -spec/frontend/vue_shared/components/markdown/toolbar_button_spec.js -spec/frontend/vue_shared/components/notes/noteable_warning_spec.js -spec/frontend/vue_shared/components/ordered_layout_spec.js -spec/frontend/vue_shared/components/pagination_links_spec.js -spec/frontend/vue_shared/components/project_avatar/default_spec.js -spec/frontend/vue_shared/components/registry/details_row_spec.js -spec/frontend/vue_shared/components/registry/list_item_spec.js -spec/frontend/vue_shared/components/registry/metadata_item_spec.js -spec/frontend/vue_shared/components/registry/title_area_spec.js - -## wizardly-agnesi -spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js -spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js -spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js -spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js -spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js -spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js -spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js -spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js -spec/frontend/vue_shared/components/security_reports/help_icon_spec.js -spec/frontend/vue_shared/components/security_reports/security_summary_spec.js -spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js -spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js -spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js -spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js -spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js -spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js -spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js -spec/frontend/vue_shared/components/slot_switch_spec.js -spec/frontend/vue_shared/components/split_button_spec.js -spec/frontend/vue_shared/components/table_pagination_spec.js -spec/frontend/vue_shared/components/tabs/tab_spec.js -spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js -spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js -spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js -spec/frontend/vue_shared/components/user_popover/user_popover_spec.js -spec/frontend/vue_shared/directives/validation_spec.js -spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js -spec/frontend/vue_shared/security_reports/security_reports_app_spec.js -spec/frontend/vue_shared/security_reports/store/getters_spec.js -spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js -spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js - -## upbeat-elion -spec/frontend/vuex_shared/modules/modal/actions_spec.js -spec/frontend/whats_new/components/app_spec.js -spec/frontend/wikis_spec.js -spec/frontend_integration/ide/ide_integration_spec.js -spec/frontend_integration/test_helpers/fixtures.js -spec/frontend_integration/test_helpers/mock_server/index.js -spec/frontend_integration/test_helpers/mock_server/routes/404.js -spec/frontend_integration/test_helpers/mock_server/routes/ci.js -spec/frontend_integration/test_helpers/mock_server/routes/graphql.js -spec/frontend_integration/test_helpers/mock_server/routes/index.js -spec/frontend_integration/test_helpers/mock_server/routes/projects.js -spec/frontend_integration/test_helpers/mock_server/routes/repository.js -spec/frontend_integration/test_helpers/snapshot_serializer.js -spec/javascripts/fly_out_nav_browser_spec.js -spec/javascripts/lib/utils/browser_spec.js -spec/javascripts/matchers.js -spec/javascripts/test_bundle.js diff --git a/app/assets/javascripts/access_tokens/index.js b/app/assets/javascripts/access_tokens/index.js index 319144193f1..b4353af30d5 100644 --- a/app/assets/javascripts/access_tokens/index.js +++ b/app/assets/javascripts/access_tokens/index.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import ExpiresAtField from './components/expires_at_field.vue'; -const getInputAttrs = el => { +const getInputAttrs = (el) => { const input = el.querySelector('input'); return { diff --git a/app/assets/javascripts/activities.js b/app/assets/javascripts/activities.js index 05de970e387..6b9f46dcfb6 100644 --- a/app/assets/javascripts/activities.js +++ b/app/assets/javascripts/activities.js @@ -9,9 +9,9 @@ export default class Activities { constructor(container = '') { this.container = container; - Pager.init(20, true, false, data => data, this.updateTooltips, this.container); + Pager.init(20, true, false, (data) => data, this.updateTooltips, this.container); - $('.event-filter-link').on('click', e => { + $('.event-filter-link').on('click', (e) => { e.preventDefault(); this.toggleFilter(e.currentTarget); this.reloadActivities(); @@ -24,7 +24,7 @@ export default class Activities { reloadActivities() { $('.content_list').html(''); - Pager.init(20, true, false, data => data, this.updateTooltips, this.container); + Pager.init(20, true, false, (data) => data, this.updateTooltips, this.container); } toggleFilter(sender) { diff --git a/app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue b/app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue index cb9aa50fa68..c58ded3f1f5 100644 --- a/app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue +++ b/app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue @@ -61,14 +61,14 @@ export default { }, }, selectedCommitsCount() { - return this.selectedCommits.filter(selectedCommit => selectedCommit.isSelected).length; + return this.selectedCommits.filter((selectedCommit) => selectedCommit.isSelected).length; }, shouldPurge() { return this.selectedCommitsCount !== this.selectedCommits.length; }, uniqueCommits() { return this.selectedCommits.filter( - selectedCommit => + (selectedCommit) => selectedCommit.isSelected && findCommitIndex(this.contextCommits, selectedCommit.short_id) === -1, ); @@ -126,7 +126,7 @@ export default { this.focusSearch(); if (this.shouldPurge) { this.setSelectedCommits( - [...this.commits, ...this.selectedCommits].filter(commit => commit.isSelected), + [...this.commits, ...this.selectedCommits].filter((commit) => commit.isSelected), ); } } @@ -178,7 +178,7 @@ export default { this.setCommits({ commits: tempCommits }); this.setSelectedCommits([ ...tempSelectedCommits, - ...tempCommits.filter(commit => commit.isSelected), + ...tempCommits.filter((commit) => commit.isSelected), ]); }, handleCreateContextCommits() { @@ -186,7 +186,7 @@ export default { return Promise.all([ this.createContextCommits({ commits: this.uniqueCommits }), this.removeContextCommits(), - ]).then(values => { + ]).then((values) => { if (values[0] || values[1]) { window.location.reload(); } diff --git a/app/assets/javascripts/add_context_commits_modal/store/actions.js b/app/assets/javascripts/add_context_commits_modal/store/actions.js index d23955182b2..1bf54b159ee 100644 --- a/app/assets/javascripts/add_context_commits_modal/store/actions.js +++ b/app/assets/javascripts/add_context_commits_modal/store/actions.js @@ -27,10 +27,10 @@ export const searchCommits = ({ dispatch, commit, state }, searchText) => { return axios .get(state.contextCommitsPath, params) .then(({ data }) => { - let commits = data.map(o => ({ ...o, isSelected: false })); - commits = commits.map(c => { + let commits = data.map((o) => ({ ...o, isSelected: false })); + commits = commits.map((c) => { const isPresent = state.selectedCommits.find( - selectedCommit => selectedCommit.short_id === c.short_id && selectedCommit.isSelected, + (selectedCommit) => selectedCommit.short_id === c.short_id && selectedCommit.isSelected, ); if (isPresent) { return { ...c, isSelected: true }; @@ -50,7 +50,7 @@ export const searchCommits = ({ dispatch, commit, state }, searchText) => { export const setCommits = ({ commit }, { commits: data, silentAddition = false }) => { let commits = _.uniqBy(data, 'short_id'); - commits = _.orderBy(data, c => new Date(c.committed_date), ['desc']); + commits = _.orderBy(data, (c) => new Date(c.committed_date), ['desc']); if (silentAddition) { commit(types.SET_COMMITS_SILENT, commits); } else { @@ -60,7 +60,7 @@ export const setCommits = ({ commit }, { commits: data, silentAddition = false } export const createContextCommits = ({ state }, { commits, forceReload = false }) => Api.createContextCommits(state.projectId, state.mergeRequestIid, { - commits: commits.map(commit => commit.short_id), + commits: commits.map((commit) => commit.short_id), }) .then(() => { if (forceReload) { @@ -81,7 +81,7 @@ export const fetchContextCommits = ({ dispatch, commit, state }) => { commit(types.FETCH_CONTEXT_COMMITS); return Api.allContextCommits(state.projectId, state.mergeRequestIid) .then(({ data }) => { - const contextCommits = data.map(o => ({ ...o, isSelected: true })); + const contextCommits = data.map((o) => ({ ...o, isSelected: true })); dispatch('setContextCommits', contextCommits); dispatch('setCommits', { commits: [...state.commits, ...contextCommits], @@ -121,7 +121,7 @@ export const setSelectedCommits = ({ commit }, selected) => { let selectedCommits = _.uniqBy(selected, 'short_id'); selectedCommits = _.orderBy( selectedCommits, - selectedCommit => new Date(selectedCommit.committed_date), + (selectedCommit) => new Date(selectedCommit.committed_date), ['desc'], ); commit(types.SET_SELECTED_COMMITS, selectedCommits); diff --git a/app/assets/javascripts/add_context_commits_modal/utils.js b/app/assets/javascripts/add_context_commits_modal/utils.js index 3495ee17cd3..114913b1893 100644 --- a/app/assets/javascripts/add_context_commits_modal/utils.js +++ b/app/assets/javascripts/add_context_commits_modal/utils.js @@ -1,5 +1,5 @@ export const findCommitIndex = (commits, commitShortId) => { - return commits.findIndex(commit => commit.short_id === commitShortId); + return commits.findIndex((commit) => commit.short_id === commitShortId); }; export const setCommitStatus = (commits, commitIndex, selected) => { diff --git a/app/assets/javascripts/admin/application_settings/setup_metrics_and_profiling.js b/app/assets/javascripts/admin/application_settings/setup_metrics_and_profiling.js index f89533aeb1d..a357d5d2f1f 100644 --- a/app/assets/javascripts/admin/application_settings/setup_metrics_and_profiling.js +++ b/app/assets/javascripts/admin/application_settings/setup_metrics_and_profiling.js @@ -1,7 +1,7 @@ import PayloadPreviewer from '~/pages/admin/application_settings/payload_previewer'; export default () => { - Array.from(document.querySelectorAll('.js-payload-preview-trigger')).forEach(trigger => { + Array.from(document.querySelectorAll('.js-payload-preview-trigger')).forEach((trigger) => { new PayloadPreviewer(trigger).init(); }); }; diff --git a/app/assets/javascripts/admin/statistics_panel/store/actions.js b/app/assets/javascripts/admin/statistics_panel/store/actions.js index dd04e492388..149540c4222 100644 --- a/app/assets/javascripts/admin/statistics_panel/store/actions.js +++ b/app/assets/javascripts/admin/statistics_panel/store/actions.js @@ -13,7 +13,7 @@ export const fetchStatistics = ({ dispatch }) => { .then(({ data }) => { dispatch('receiveStatisticsSuccess', convertObjectPropsToCamelCase(data, { deep: true })); }) - .catch(error => dispatch('receiveStatisticsError', error)); + .catch((error) => dispatch('receiveStatisticsError', error)); }; export const receiveStatisticsSuccess = ({ commit }, statistics) => diff --git a/app/assets/javascripts/admin/statistics_panel/store/getters.js b/app/assets/javascripts/admin/statistics_panel/store/getters.js index 1c1868b5bca..7ad1b0445ac 100644 --- a/app/assets/javascripts/admin/statistics_panel/store/getters.js +++ b/app/assets/javascripts/admin/statistics_panel/store/getters.js @@ -3,8 +3,8 @@ * and returns an array of the following form: * [{ key: "forks", label: "Forks", value: 50 }] */ -export const getStatistics = state => labels => - Object.keys(labels).map(key => { +export const getStatistics = (state) => (labels) => + Object.keys(labels).map((key) => { const result = { key, label: labels[key], diff --git a/app/assets/javascripts/admin/users/components/users_table.vue b/app/assets/javascripts/admin/users/components/users_table.vue index a2d68972519..61c4f1ed8a8 100644 --- a/app/assets/javascripts/admin/users/components/users_table.vue +++ b/app/assets/javascripts/admin/users/components/users_table.vue @@ -4,7 +4,7 @@ import { __ } from '~/locale'; const DEFAULT_TH_CLASSES = 'gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!'; -const thWidthClass = width => `gl-w-${width}p ${DEFAULT_TH_CLASSES}`; +const thWidthClass = (width) => `gl-w-${width}p ${DEFAULT_TH_CLASSES}`; export default { components: { diff --git a/app/assets/javascripts/admin/users/index.js b/app/assets/javascripts/admin/users/index.js index 6f8446221a3..f35b57c4e1a 100644 --- a/app/assets/javascripts/admin/users/index.js +++ b/app/assets/javascripts/admin/users/index.js @@ -11,7 +11,7 @@ export default function (el = document.querySelector('#js-admin-users-app')) { return new Vue({ el, - render: createElement => + render: (createElement) => createElement(AdminUsersApp, { props: { users: convertObjectPropsToCamelCase(JSON.parse(users), { deep: true }), diff --git a/app/assets/javascripts/alert_handler.js b/app/assets/javascripts/alert_handler.js index 26b0142f6a2..3c867f196d6 100644 --- a/app/assets/javascripts/alert_handler.js +++ b/app/assets/javascripts/alert_handler.js @@ -8,9 +8,9 @@ export default function initAlertHandler() { const DISMISS_LABEL = '[aria-label="Dismiss"]'; const DISMISS_CLASS = '.gl-alert-dismiss'; - DISMISSIBLE_SELECTORS.forEach(selector => { + DISMISSIBLE_SELECTORS.forEach((selector) => { const elements = document.querySelectorAll(selector); - elements.forEach(element => { + elements.forEach((element) => { const button = element.querySelector(DISMISS_LABEL) || element.querySelector(DISMISS_CLASS); if (!button) { return; diff --git a/app/assets/javascripts/alert_management/components/alert_details.vue b/app/assets/javascripts/alert_management/components/alert_details.vue index ad29f5833e4..895c6e76019 100644 --- a/app/assets/javascripts/alert_management/components/alert_details.vue +++ b/app/assets/javascripts/alert_management/components/alert_details.vue @@ -140,7 +140,7 @@ export default { }, currentTabIndex: { get() { - return this.$options.tabsConfig.findIndex(tab => tab.id === this.activeTab); + return this.$options.tabsConfig.findIndex((tab) => tab.id === this.activeTab); }, set(tabIdx) { const tabId = this.$options.tabsConfig[tabIdx].id; @@ -208,7 +208,7 @@ export default { } }, ) - .catch(error => { + .catch((error) => { this.createIncidentError = error; this.incidentCreationInProgress = false; }); diff --git a/app/assets/javascripts/alert_management/components/alert_management_table.vue b/app/assets/javascripts/alert_management/components/alert_management_table.vue index f49f0c52ce6..d6e31b57cba 100644 --- a/app/assets/javascripts/alert_management/components/alert_management_table.vue +++ b/app/assets/javascripts/alert_management/components/alert_management_table.vue @@ -138,7 +138,7 @@ export default { data.project || {}; const now = new Date(); - const listWithData = list.map(alert => { + const listWithData = list.map((alert) => { const then = new Date(alert.startedAt); const diff = now - then; diff --git a/app/assets/javascripts/alert_management/components/alert_metrics.vue b/app/assets/javascripts/alert_management/components/alert_metrics.vue index 8a6490ecd5c..dd4faa03c00 100644 --- a/app/assets/javascripts/alert_management/components/alert_metrics.vue +++ b/app/assets/javascripts/alert_management/components/alert_metrics.vue @@ -33,7 +33,7 @@ export default { }); this.metricEmbedComponent = MetricEmbed; }) - .catch(e => Sentry.captureException(e)); + .catch((e) => Sentry.captureException(e)); } }, }; diff --git a/app/assets/javascripts/alert_management/components/alert_status.vue b/app/assets/javascripts/alert_management/components/alert_status.vue index d7c5aa26370..2afdeb8b6fd 100644 --- a/app/assets/javascripts/alert_management/components/alert_status.vue +++ b/app/assets/javascripts/alert_management/components/alert_status.vue @@ -57,7 +57,7 @@ export default { projectPath: this.projectPath, }, }) - .then(resp => { + .then((resp) => { this.trackStatusUpdate(status); const errors = resp.data?.updateAlertStatus?.errors || []; diff --git a/app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue b/app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue index 3b9a730e5e1..2a999b908f9 100644 --- a/app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue +++ b/app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue @@ -92,7 +92,7 @@ export default { }, sortedUsers() { return this.users - .map(user => ({ ...user, active: this.isActive(user.username) })) + .map((user) => ({ ...user, active: this.isActive(user.username) })) .sort((a, b) => (a.active === b.active ? 0 : a.active ? -1 : 1)); // eslint-disable-line no-nested-ternary }, dropdownClass() { diff --git a/app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue b/app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue index 84d54466a10..485395bcac2 100644 --- a/app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue +++ b/app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue @@ -115,7 +115,7 @@ export default { variables: this.getAlertQueryVariables, }); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { // eslint-disable-next-line no-param-reassign draftData.project.alertManagementAlerts.nodes[0].todos.nodes = []; }); diff --git a/app/assets/javascripts/alert_management/details.js b/app/assets/javascripts/alert_management/details.js index cbbdecae390..733ce649977 100644 --- a/app/assets/javascripts/alert_management/details.js +++ b/app/assets/javascripts/alert_management/details.js @@ -9,7 +9,7 @@ import createRouter from './router'; Vue.use(VueApollo); -export default selector => { +export default (selector) => { const domEl = document.querySelector(selector); const { alertId, projectPath, projectIssuesPath, projectId } = domEl.dataset; const router = createRouter(); @@ -18,7 +18,7 @@ export default selector => { Mutation: { toggleSidebarStatus: (_, __, { cache }) => { const sourceData = cache.readQuery({ query: sidebarStatusQuery }); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { // eslint-disable-next-line no-param-reassign draftData.sidebarStatus = !draftData.sidebarStatus; }); @@ -30,7 +30,7 @@ export default selector => { const apolloProvider = new VueApollo({ defaultClient: createDefaultClient(resolvers, { cacheConfig: { - dataIdFromObject: object => { + dataIdFromObject: (object) => { // eslint-disable-next-line no-underscore-dangle if (object.__typename === 'AlertManagementAlert') { return object.iid; diff --git a/app/assets/javascripts/alert_management/list.js b/app/assets/javascripts/alert_management/list.js index e34450204fb..e4d418e15c0 100644 --- a/app/assets/javascripts/alert_management/list.js +++ b/app/assets/javascripts/alert_management/list.js @@ -30,7 +30,7 @@ export default () => { {}, { cacheConfig: { - dataIdFromObject: object => { + dataIdFromObject: (object) => { // eslint-disable-next-line no-underscore-dangle if (object.__typename === 'AlertManagementAlert') { return object.iid; diff --git a/app/assets/javascripts/alerts_service_settings/components/alerts_service_form.vue b/app/assets/javascripts/alerts_service_settings/components/alerts_service_form.vue index f2394ce385f..576ea2c543a 100644 --- a/app/assets/javascripts/alerts_service_settings/components/alerts_service_form.vue +++ b/app/assets/javascripts/alerts_service_settings/components/alerts_service_form.vue @@ -98,7 +98,7 @@ export default { }, methods: { updateIcon() { - return document.querySelectorAll('.js-service-active-status').forEach(icon => { + return document.querySelectorAll('.js-service-active-status').forEach((icon) => { if (icon.dataset.value === this.activated.toString()) { icon.classList.remove('d-none'); } else { @@ -109,7 +109,7 @@ export default { resetKey() { return axios .put(this.formPath, { service: { token: '' } }) - .then(res => { + .then((res) => { this.authorizationKey = res.data.token; }) .catch(() => { diff --git a/app/assets/javascripts/alerts_service_settings/index.js b/app/assets/javascripts/alerts_service_settings/index.js index fe83ced2ee7..ddba966ffb3 100644 --- a/app/assets/javascripts/alerts_service_settings/index.js +++ b/app/assets/javascripts/alerts_service_settings/index.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import { parseBoolean } from '~/lib/utils/common_utils'; import AlertsServiceForm from './components/alerts_service_form.vue'; -export default el => { +export default (el) => { if (!el) { return null; } diff --git a/app/assets/javascripts/alerts_settings/components/alert_mapping_builder.vue b/app/assets/javascripts/alerts_settings/components/alert_mapping_builder.vue index f6474efcc1f..5400f6657a5 100644 --- a/app/assets/javascripts/alerts_settings/components/alert_mapping_builder.vue +++ b/app/assets/javascripts/alerts_settings/components/alert_mapping_builder.vue @@ -64,9 +64,9 @@ export default { }, computed: { mappingData() { - return this.gitlabFields.map(gitlabField => { + return this.gitlabFields.map((gitlabField) => { const mappingFields = this.payloadFields.filter(({ type }) => - type.some(t => gitlabField.compatibleTypes.includes(t)), + type.some((t) => gitlabField.compatibleTypes.includes(t)), ); const foundMapping = this.mapping.find( @@ -88,26 +88,26 @@ export default { }, methods: { setMapping(gitlabKey, mappingKey, valueKey) { - const fieldIndex = this.gitlabFields.findIndex(field => field.name === gitlabKey); + const fieldIndex = this.gitlabFields.findIndex((field) => field.name === gitlabKey); const updatedField = { ...this.gitlabFields[fieldIndex], ...{ [valueKey]: mappingKey } }; Vue.set(this.gitlabFields, fieldIndex, updatedField); }, setSearchTerm(search = '', searchFieldKey, gitlabKey) { - const fieldIndex = this.gitlabFields.findIndex(field => field.name === gitlabKey); + const fieldIndex = this.gitlabFields.findIndex((field) => field.name === gitlabKey); const updatedField = { ...this.gitlabFields[fieldIndex], ...{ [searchFieldKey]: search } }; Vue.set(this.gitlabFields, fieldIndex, updatedField); }, filterFields(searchTerm = '', fields) { const search = searchTerm.toLowerCase(); - return fields.filter(field => field.label.toLowerCase().includes(search)); + return fields.filter((field) => field.label.toLowerCase().includes(search)); }, isSelected(fieldValue, mapping) { return fieldValue === mapping; }, selectedValue(name) { return ( - this.payloadFields.find(item => item.name === name)?.label || + this.payloadFields.find((item) => item.name === name)?.label || this.$options.i18n.makeSelection ); }, diff --git a/app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue b/app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue index cf16750dbf8..6cfb4601192 100644 --- a/app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue +++ b/app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue @@ -97,8 +97,8 @@ export default { }; }, mounted() { - const callback = entries => { - const isVisible = entries.some(entry => entry.isIntersecting); + const callback = (entries) => { + const isVisible = entries.some((entry) => entry.isIntersecting); if (isVisible) { this.trackPageViews(); diff --git a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue index b2be563522a..c8742be9985 100644 --- a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue +++ b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue @@ -197,7 +197,7 @@ export default { return options; }, options() { - return integrationTypesNew.map(el => ({ + return integrationTypesNew.map((el) => ({ ...el, disabled: this.disabledIntegrations.includes(el.value), })); @@ -390,10 +390,10 @@ export default { // TODO: replace with real BE mutation when ready; this.parsingPayload = true; - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => resolve(mockedCustomMapping), 1000); }) - .then(res => { + .then((res) => { const mapping = { ...res }; delete mapping.storedMapping; this.customMapping = res; @@ -408,7 +408,7 @@ export default { }, getIntegrationMapping() { // TODO: replace with real BE mutation when ready; - return Promise.resolve(mockedCustomMapping).then(res => { + return Promise.resolve(mockedCustomMapping).then((res) => { this.customMapping = res; this.integrationTestPayload.json = res?.samplePayload.body; }); diff --git a/app/assets/javascripts/alerts_settings/graphql.js b/app/assets/javascripts/alerts_settings/graphql.js index 02c2def87fa..3dbfa69a8e9 100644 --- a/app/assets/javascripts/alerts_settings/graphql.js +++ b/app/assets/javascripts/alerts_settings/graphql.js @@ -14,7 +14,7 @@ const resolvers = { { cache }, ) => { const sourceData = cache.readQuery({ query: getCurrentIntegrationQuery }); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { if (id === null) { // eslint-disable-next-line no-param-reassign draftData.currentIntegration = null; diff --git a/app/assets/javascripts/alerts_settings/index.js b/app/assets/javascripts/alerts_settings/index.js index 41b19a675c5..73d132ce335 100644 --- a/app/assets/javascripts/alerts_settings/index.js +++ b/app/assets/javascripts/alerts_settings/index.js @@ -11,7 +11,7 @@ apolloProvider.clients.defaultClient.cache.writeData({ }); Vue.use(GlToast); -export default el => { +export default (el) => { if (!el) { return null; } diff --git a/app/assets/javascripts/alerts_settings/utils/cache_updates.js b/app/assets/javascripts/alerts_settings/utils/cache_updates.js index 18054b29fe9..758f3eb6dd4 100644 --- a/app/assets/javascripts/alerts_settings/utils/cache_updates.js +++ b/app/assets/javascripts/alerts_settings/utils/cache_updates.js @@ -14,7 +14,7 @@ const deleteIntegrationFromStore = (store, query, { httpIntegrationDestroy }, va variables, }); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { // eslint-disable-next-line no-param-reassign draftData.project.alertManagementIntegrations.nodes = draftData.project.alertManagementIntegrations.nodes.filter( ({ id }) => id !== integration.id, @@ -45,7 +45,7 @@ const addIntegrationToStore = ( variables, }); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { // eslint-disable-next-line no-param-reassign draftData.project.alertManagementIntegrations.nodes = [ integration, diff --git a/app/assets/javascripts/analytics/instance_statistics/components/instance_statistics_count_chart.vue b/app/assets/javascripts/analytics/instance_statistics/components/instance_statistics_count_chart.vue index a9bd1bb2f41..620f38bd50f 100644 --- a/app/assets/javascripts/analytics/instance_statistics/components/instance_statistics_count_chart.vue +++ b/app/assets/javascripts/analytics/instance_statistics/components/instance_statistics_count_chart.vue @@ -60,13 +60,13 @@ export default { return Object.values(this.errors); }, isLoading() { - return some(this.$apollo.queries, query => query?.loading); + return some(this.$apollo.queries, (query) => query?.loading); }, allQueriesFailed() { - return every(this.errorMessages, message => message.length); + return every(this.errorMessages, (message) => message.length); }, hasLoadingErrors() { - return some(this.errorMessages, message => message.length); + return some(this.errorMessages, (message) => message.length); }, errorMessage() { // show the generic loading message if all requests fail @@ -179,7 +179,7 @@ export default { }; }, }) - .catch(error => this.handleError({ identifier, error, message: errorMessage })); + .catch((error) => this.handleError({ identifier, error, message: errorMessage })); }, }, }; diff --git a/app/assets/javascripts/analytics/instance_statistics/components/projects_and_groups_chart.vue b/app/assets/javascripts/analytics/instance_statistics/components/projects_and_groups_chart.vue index e8e35c22fe1..46cc05fc124 100644 --- a/app/assets/javascripts/analytics/instance_statistics/components/projects_and_groups_chart.vue +++ b/app/assets/javascripts/analytics/instance_statistics/components/projects_and_groups_chart.vue @@ -11,7 +11,7 @@ import latestGroupsQuery from '../graphql/queries/groups.query.graphql'; import latestProjectsQuery from '../graphql/queries/projects.query.graphql'; import { getAverageByMonth } from '../utils'; -const sortByDate = data => sortBy(data, item => new Date(item[0]).getTime()); +const sortByDate = (data) => sortBy(data, (item) => new Date(item[0]).getTime()); const averageAndSortData = (data = [], maxDataPoints) => { const averaged = getAverageByMonth( @@ -148,7 +148,7 @@ export default { name: this.$options.i18n.xAxisTitle, type: 'category', axisLabel: { - formatter: value => { + formatter: (value) => { return formatDateAsMonth(value); }, }, @@ -189,7 +189,7 @@ export default { .fetchMore({ variables: { first: this.totalDataPoints, after: pageInfo.endCursor }, updateQuery: (previousResult, { fetchMoreResult }) => { - const results = produce(fetchMoreResult, newData => { + const results = produce(fetchMoreResult, (newData) => { // eslint-disable-next-line no-param-reassign newData[dataKey].nodes = [ ...previousResult[dataKey].nodes, @@ -199,7 +199,7 @@ export default { return results; }, }) - .catch(error => { + .catch((error) => { this.handleError({ error, message: errorMessage, dataKey }); }); } diff --git a/app/assets/javascripts/analytics/instance_statistics/components/users_chart.vue b/app/assets/javascripts/analytics/instance_statistics/components/users_chart.vue index a4a1d40b70b..03462113630 100644 --- a/app/assets/javascripts/analytics/instance_statistics/components/users_chart.vue +++ b/app/assets/javascripts/analytics/instance_statistics/components/users_chart.vue @@ -10,7 +10,7 @@ import { formatDateAsMonth } from '~/lib/utils/datetime_utility'; import usersQuery from '../graphql/queries/users.query.graphql'; import { getAverageByMonth } from '../utils'; -const sortByDate = data => sortBy(data, item => new Date(item[0]).getTime()); +const sortByDate = (data) => sortBy(data, (item) => new Date(item[0]).getTime()); export default { name: 'UsersChart', @@ -106,7 +106,7 @@ export default { .fetchMore({ variables: { first: this.totalDataPoints, after: this.pageInfo.endCursor }, updateQuery: (previousResult, { fetchMoreResult }) => { - return produce(fetchMoreResult, newUsers => { + return produce(fetchMoreResult, (newUsers) => { // eslint-disable-next-line no-param-reassign newUsers.users.nodes = [...previousResult.users.nodes, ...newUsers.users.nodes]; }); diff --git a/app/assets/javascripts/analytics/instance_statistics/utils.js b/app/assets/javascripts/analytics/instance_statistics/utils.js index e1fa5d155a2..396962ffad6 100644 --- a/app/assets/javascripts/analytics/instance_statistics/utils.js +++ b/app/assets/javascripts/analytics/instance_statistics/utils.js @@ -29,7 +29,7 @@ export function getAverageByMonth(items = [], options = {}) { return { ...memo, [month]: { sum: count, recordCount: 1 } }; }, {}); - return Object.keys(itemsMap).map(month => { + return Object.keys(itemsMap).map((month) => { const { sum, recordCount } = itemsMap[month]; const avg = sum / recordCount; if (shouldRound) { diff --git a/app/assets/javascripts/analytics/product_analytics/activity_charts_bundle.js b/app/assets/javascripts/analytics/product_analytics/activity_charts_bundle.js index d1f4b537b11..cf9575cbc82 100644 --- a/app/assets/javascripts/analytics/product_analytics/activity_charts_bundle.js +++ b/app/assets/javascripts/analytics/product_analytics/activity_charts_bundle.js @@ -8,7 +8,7 @@ export default () => { return false; } - return containers.forEach(container => { + return containers.forEach((container) => { const { chartData } = container.dataset; const formattedData = JSON.parse(chartData); diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 29703cac664..f96e02b1359 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -374,8 +374,8 @@ const Api = { .post(url, { label: data, }) - .then(res => callback(res.data)) - .catch(e => callback(e.response.data)); + .then((res) => callback(res.data)) + .catch((e) => callback(e.response.data)); }, // Return group projects list. Filtered by query @@ -431,7 +431,7 @@ const Api = { commitPipelines(projectId, sha) { const encodedProjectId = projectId .split('/') - .map(fragment => encodeURIComponent(fragment)) + .map((fragment) => encodeURIComponent(fragment)) .join('/'); const url = Api.buildUrl(Api.commitPipelinesPath) @@ -455,7 +455,7 @@ const Api = { .replace(':type', type) .replace(':key', encodeURIComponent(key)); - return axios.get(url, { params: options }).then(res => { + return axios.get(url, { params: options }).then((res) => { if (callback) callback(res.data); return res; @@ -467,7 +467,7 @@ const Api = { .replace(':id', encodeURIComponent(id)) .replace(':type', type); - return axios.get(url, { params }).then(res => { + return axios.get(url, { params }).then((res) => { if (callback) callback(res.data); return res; diff --git a/app/assets/javascripts/authentication/u2f/authenticate.js b/app/assets/javascripts/authentication/u2f/authenticate.js index f9b5ca3e5b4..f5217e9c9be 100644 --- a/app/assets/javascripts/authentication/u2f/authenticate.js +++ b/app/assets/javascripts/authentication/u2f/authenticate.js @@ -37,7 +37,7 @@ export default class U2FAuthenticate { // Note: The server library fixes this behaviour in (unreleased) version 1.0.0. // This can be removed once we upgrade. // https://github.com/castle/ruby-u2f/commit/103f428071a81cd3d5f80c2e77d522d5029946a4 - this.signRequests = u2fParams.sign_requests.map(request => omit(request, 'challenge')); + this.signRequests = u2fParams.sign_requests.map((request) => omit(request, 'challenge')); this.templates = { inProgress: '#js-authenticate-token-2fa-in-progress', @@ -48,7 +48,7 @@ export default class U2FAuthenticate { start() { return importU2FLibrary() - .then(utils => { + .then((utils) => { this.u2fUtils = utils; this.renderInProgress(); }) @@ -60,7 +60,7 @@ export default class U2FAuthenticate { this.appId, this.challenge, this.signRequests, - response => { + (response) => { if (response.errorCode) { const error = new U2FError(response.errorCode, 'authenticate'); return this.renderError(error); diff --git a/app/assets/javascripts/authentication/u2f/register.js b/app/assets/javascripts/authentication/u2f/register.js index 9773a9185f8..52940e1c305 100644 --- a/app/assets/javascripts/authentication/u2f/register.js +++ b/app/assets/javascripts/authentication/u2f/register.js @@ -34,7 +34,7 @@ export default class U2FRegister { start() { return importU2FLibrary() - .then(utils => { + .then((utils) => { this.u2fUtils = utils; this.renderSetup(); }) @@ -46,7 +46,7 @@ export default class U2FRegister { this.appId, this.registerRequests, this.signRequests, - response => { + (response) => { if (response.errorCode) { const error = new U2FError(response.errorCode, 'register'); return this.renderError(error); diff --git a/app/assets/javascripts/authentication/webauthn/authenticate.js b/app/assets/javascripts/authentication/webauthn/authenticate.js index 42c4c2b63bd..47cb7a40f76 100644 --- a/app/assets/javascripts/authentication/webauthn/authenticate.js +++ b/app/assets/javascripts/authentication/webauthn/authenticate.js @@ -39,11 +39,11 @@ export default class WebAuthnAuthenticate { authenticate() { navigator.credentials .get({ publicKey: this.webauthnParams }) - .then(resp => { + .then((resp) => { const convertedResponse = convertGetResponse(resp); this.renderAuthenticated(JSON.stringify(convertedResponse)); }) - .catch(err => { + .catch((err) => { this.flow.renderError(new WebAuthnError(err, 'authenticate')); }); } diff --git a/app/assets/javascripts/authentication/webauthn/register.js b/app/assets/javascripts/authentication/webauthn/register.js index 06e4ffd6f3e..62ebf85abe4 100644 --- a/app/assets/javascripts/authentication/webauthn/register.js +++ b/app/assets/javascripts/authentication/webauthn/register.js @@ -39,8 +39,8 @@ export default class WebAuthnRegister { .create({ publicKey: this.webauthnOptions, }) - .then(cred => this.renderRegistered(JSON.stringify(convertCreateResponse(cred)))) - .catch(err => this.flow.renderError(new WebAuthnError(err, 'register'))); + .then((cred) => this.renderRegistered(JSON.stringify(convertCreateResponse(cred)))) + .catch((err) => this.flow.renderError(new WebAuthnError(err, 'register'))); } renderSetup() { diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 6e13261accc..22717a3f84c 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -56,13 +56,13 @@ export class AwardsHandler { } }, ); - this.registerEventListener('on', $parentEl, 'click', this.toggleButtonSelector, e => { + this.registerEventListener('on', $parentEl, 'click', this.toggleButtonSelector, (e) => { e.stopPropagation(); e.preventDefault(); this.showEmojiMenu($(e.currentTarget)); }); - this.registerEventListener('on', $('html'), 'click', e => { + this.registerEventListener('on', $('html'), 'click', (e) => { const $target = $(e.target); if (!$target.closest(`.${this.menuClass}`).length) { $('.js-awards-block.current').removeClass('current'); @@ -74,7 +74,7 @@ export class AwardsHandler { }); const emojiButtonSelector = `.js-awards-block .js-emoji-btn, .${this.menuClass} .js-emoji-btn`; - this.registerEventListener('on', $parentEl, 'click', emojiButtonSelector, e => { + this.registerEventListener('on', $parentEl, 'click', emojiButtonSelector, (e) => { e.preventDefault(); const $target = $(e.currentTarget); const $glEmojiElement = $target.find('gl-emoji'); @@ -190,7 +190,7 @@ export class AwardsHandler { (promiseChain, categoryNameKey) => promiseChain.then( () => - new Promise(resolve => { + new Promise((resolve) => { const emojisInCategory = categoryMap[categoryNameKey]; const categoryMarkup = this.renderCategory( categoryLabelMap[categoryNameKey], @@ -213,7 +213,7 @@ export class AwardsHandler { menu.dispatchEvent(new CustomEvent('build-emoji-menu-finish')); } }) - .catch(err => { + .catch((err) => { emojiContentElement.insertAdjacentHTML( 'beforeend', '<p>We encountered an error while adding the remaining categories</p>', @@ -230,7 +230,7 @@ export class AwardsHandler { <ul class="clearfix emoji-menu-list ${opts.menuListClass || ''}"> ${emojiList .map( - emojiName => ` + (emojiName) => ` <li class="emoji-menu-list-item"> <button class="emoji-menu-btn text-center js-emoji-btn" type="button"> ${this.emoji.glEmojiTag(emojiName, { @@ -463,7 +463,7 @@ export class AwardsHandler { const className = 'pulse animated once short'; $emoji.addClass(className); - this.registerEventListener('on', $emoji, animationEndEventString, e => { + this.registerEventListener('on', $emoji, animationEndEventString, (e) => { $(e.currentTarget).removeClass(className); }); } @@ -515,7 +515,7 @@ export class AwardsHandler { this.frequentlyUsedEmojis || (() => { const frequentlyUsedEmojis = uniq((Cookies.get('frequently_used_emojis') || '').split(',')); - this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter(inputName => + this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter((inputName) => this.emoji.isEmojiNameValid(inputName), ); @@ -527,13 +527,13 @@ export class AwardsHandler { setupSearch() { const $search = $('.js-emoji-menu-search'); - this.registerEventListener('on', $search, 'input', e => { + this.registerEventListener('on', $search, 'input', (e) => { const term = $(e.target).val().trim(); this.searchEmojis(term); }); const $menu = $(`.${this.menuClass}`); - this.registerEventListener('on', $menu, transitionEndEventString, e => { + this.registerEventListener('on', $menu, transitionEndEventString, (e) => { if (e.target === e.currentTarget) { // Clear the search this.searchEmojis(''); @@ -583,7 +583,7 @@ export class AwardsHandler { } hideMenuElement($emojiMenu) { - $emojiMenu.on(transitionEndEventString, e => { + $emojiMenu.on(transitionEndEventString, (e) => { if (e.currentTarget === e.target) { // eslint-disable-next-line @gitlab/no-global-event-off $emojiMenu.removeClass(IS_RENDERED).off(transitionEndEventString); @@ -594,7 +594,7 @@ export class AwardsHandler { } destroy() { - this.eventListeners.forEach(entry => { + this.eventListeners.forEach((entry) => { entry.element.off.call(entry.element, ...entry.args); }); $(`.${this.menuClass}`).remove(); diff --git a/app/assets/javascripts/badges/components/badge_form.vue b/app/assets/javascripts/badges/components/badge_form.vue index e2d9b325815..9e09f527a39 100644 --- a/app/assets/javascripts/badges/components/badge_form.vue +++ b/app/assets/javascripts/badges/components/badge_form.vue @@ -48,7 +48,7 @@ export default { }, helpText() { const placeholders = ['project_path', 'project_id', 'default_branch', 'commit_sha'] - .map(placeholder => `<code>%{${placeholder}}</code>`) + .map((placeholder) => `<code>%{${placeholder}}</code>`) .join(', '); return sprintf( s__('Badges|Supported %{docsLinkStart}variables%{docsLinkEnd}: %{placeholders}'), @@ -137,7 +137,7 @@ export default { createFlash(s__('Badges|Badge saved.'), 'notice'); this.wasValidated = false; }) - .catch(error => { + .catch((error) => { createFlash( s__('Badges|Saving the badge failed, please check the entered URLs and try again.'), ); @@ -150,7 +150,7 @@ export default { createFlash(s__('Badges|New badge added.'), 'notice'); this.wasValidated = false; }) - .catch(error => { + .catch((error) => { createFlash( s__('Badges|Adding the badge failed, please check the entered URLs and try again.'), ); diff --git a/app/assets/javascripts/badges/components/badge_settings.vue b/app/assets/javascripts/badges/components/badge_settings.vue index 19781783100..73c63a72b1c 100644 --- a/app/assets/javascripts/badges/components/badge_settings.vue +++ b/app/assets/javascripts/badges/components/badge_settings.vue @@ -42,7 +42,7 @@ export default { .then(() => { createFlash(s__('Badges|The badge was deleted.'), 'notice'); }) - .catch(error => { + .catch((error) => { createFlash(s__('Badges|Deleting the badge failed, please try again.')); throw error; }); diff --git a/app/assets/javascripts/badges/store/actions.js b/app/assets/javascripts/badges/store/actions.js index 806c2423e7e..3377f6c0996 100644 --- a/app/assets/javascripts/badges/store/actions.js +++ b/app/assets/javascripts/badges/store/actions.js @@ -2,7 +2,7 @@ import axios from '~/lib/utils/axios_utils'; import types from './mutation_types'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -export const transformBackendBadge = badge => ({ +export const transformBackendBadge = (badge) => ({ ...convertObjectPropsToCamelCase(badge, true), isDeleting: false, }); @@ -27,11 +27,11 @@ export default { image_url: newBadge.imageUrl, link_url: newBadge.linkUrl, }) - .catch(error => { + .catch((error) => { dispatch('receiveNewBadgeError'); throw error; }) - .then(res => { + .then((res) => { dispatch('receiveNewBadge', transformBackendBadge(res.data)); }); }, @@ -50,7 +50,7 @@ export default { const endpoint = `${state.apiEndpointUrl}/${badgeId}`; return axios .delete(endpoint) - .catch(error => { + .catch((error) => { dispatch('receiveDeleteBadgeError', badgeId); throw error; }) @@ -78,11 +78,11 @@ export default { const endpoint = state.apiEndpointUrl; return axios .get(endpoint) - .catch(error => { + .catch((error) => { dispatch('receiveLoadBadgesError'); throw error; }) - .then(res => { + .then((res) => { dispatch('receiveLoadBadges', res.data.map(transformBackendBadge)); }); }, @@ -113,11 +113,11 @@ export default { const renderEndpoint = `${state.apiEndpointUrl}/render?${parameters}`; return axios .get(renderEndpoint) - .catch(error => { + .catch((error) => { dispatch('receiveRenderedBadgeError'); throw error; }) - .then(res => { + .then((res) => { dispatch('receiveRenderedBadge', transformBackendBadge(res.data)); }); }, @@ -142,11 +142,11 @@ export default { image_url: badge.imageUrl, link_url: badge.linkUrl, }) - .catch(error => { + .catch((error) => { dispatch('receiveUpdatedBadgeError'); throw error; }) - .then(res => { + .then((res) => { dispatch('receiveUpdatedBadge', transformBackendBadge(res.data)); }); }, diff --git a/app/assets/javascripts/badges/store/mutations.js b/app/assets/javascripts/badges/store/mutations.js index bd84e68c00f..3f4689aeb17 100644 --- a/app/assets/javascripts/badges/store/mutations.js +++ b/app/assets/javascripts/badges/store/mutations.js @@ -1,7 +1,7 @@ import types from './mutation_types'; import { PROJECT_BADGE } from '../constants'; -const reorderBadges = badges => +const reorderBadges = (badges) => badges.sort((a, b) => { if (a.kind !== b.kind) { return a.kind === PROJECT_BADGE ? 1 : -1; @@ -31,7 +31,7 @@ export default { }, [types.RECEIVE_UPDATED_BADGE](state, updatedBadge) { - const badges = state.badges.map(badge => { + const badges = state.badges.map((badge) => { if (badge.id === updatedBadge.id) { return updatedBadge; } @@ -77,13 +77,13 @@ export default { }, [types.RECEIVE_DELETE_BADGE](state, badgeId) { - const badges = state.badges.filter(badge => badge.id !== badgeId); + const badges = state.badges.filter((badge) => badge.id !== badgeId); Object.assign(state, { badges, }); }, [types.RECEIVE_DELETE_BADGE_ERROR](state, badgeId) { - const badges = state.badges.map(badge => { + const badges = state.badges.map((badge) => { if (badge.id === badgeId) { return { ...badge, @@ -98,7 +98,7 @@ export default { }); }, [types.REQUEST_DELETE_BADGE](state, badgeId) { - const badges = state.badges.map(badge => { + const badges = state.badges.map((badge) => { if (badge.id === badgeId) { return { ...badge, diff --git a/app/assets/javascripts/batch_comments/components/preview_item.vue b/app/assets/javascripts/batch_comments/components/preview_item.vue index cae1157e57c..3e93168f0e2 100644 --- a/app/assets/javascripts/batch_comments/components/preview_item.vue +++ b/app/assets/javascripts/batch_comments/components/preview_item.vue @@ -47,7 +47,7 @@ export default { } return sprintf(__("%{authorsName}'s thread"), { - authorsName: this.discussion.notes.find(note => !note.system).author.name, + authorsName: this.discussion.notes.find((note) => !note.system).author.name, }); }, linePosition() { diff --git a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js index ebd821125fb..a29409c52ae 100644 --- a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js +++ b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js @@ -11,8 +11,8 @@ export const saveDraft = ({ dispatch }, draft) => export const addDraftToDiscussion = ({ commit }, { endpoint, data }) => service .addDraftToDiscussion(endpoint, data) - .then(res => res.data) - .then(res => { + .then((res) => res.data) + .then((res) => { commit(types.ADD_NEW_DRAFT, res); return res; }) @@ -23,8 +23,8 @@ export const addDraftToDiscussion = ({ commit }, { endpoint, data }) => export const createNewDraft = ({ commit }, { endpoint, data }) => service .createNewDraft(endpoint, data) - .then(res => res.data) - .then(res => { + .then((res) => res.data) + .then((res) => { commit(types.ADD_NEW_DRAFT, res); return res; }) @@ -43,8 +43,8 @@ export const deleteDraft = ({ commit, getters }, draft) => export const fetchDrafts = ({ commit, getters }) => service .fetchDrafts(getters.getNotesData.draftsPath) - .then(res => res.data) - .then(data => commit(types.SET_BATCH_COMMENTS_DRAFTS, data)) + .then((res) => res.data) + .then((data) => commit(types.SET_BATCH_COMMENTS_DRAFTS, data)) .catch(() => flash(__('An error occurred while fetching pending comments'))); export const publishSingleDraft = ({ commit, dispatch, getters }, draftId) => { @@ -86,8 +86,8 @@ export const updateDraft = ( resolveDiscussion, position: JSON.stringify(position), }) - .then(res => res.data) - .then(data => commit(types.RECEIVE_DRAFT_UPDATE_SUCCESS, data)) + .then((res) => res.data) + .then((data) => commit(types.RECEIVE_DRAFT_UPDATE_SUCCESS, data)) .then(callback) .catch(() => flash(__('An error occurred while updating the comment'))); @@ -116,8 +116,8 @@ export const scrollToDraft = ({ dispatch, rootGetters }, draft) => { export const expandAllDiscussions = ({ dispatch, state }) => state.drafts - .filter(draft => draft.discussion_id) - .forEach(draft => { + .filter((draft) => draft.discussion_id) + .forEach((draft) => { dispatch('expandDiscussion', { discussionId: draft.discussion_id }, { root: true }); }); diff --git a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js index 22ae6c2e970..df5214ea7ab 100644 --- a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js +++ b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/getters.js @@ -1,12 +1,12 @@ import { parallelLineKey, showDraftOnSide } from '../../../utils'; -export const draftsCount = state => state.drafts.length; +export const draftsCount = (state) => state.drafts.length; export const getNotesData = (state, getters, rootState, rootGetters) => rootGetters.getNotesData; -export const hasDrafts = state => state.drafts.length > 0; +export const hasDrafts = (state) => state.drafts.length > 0; -export const draftsPerDiscussionId = state => +export const draftsPerDiscussionId = (state) => state.drafts.reduce((acc, draft) => { if (draft.discussion_id) { acc[draft.discussion_id] = draft; @@ -15,7 +15,7 @@ export const draftsPerDiscussionId = state => return acc; }, {}); -export const draftsPerFileHashAndLine = state => +export const draftsPerFileHashAndLine = (state) => state.drafts.reduce((acc, draft) => { if (draft.file_hash) { if (!acc[draft.file_hash]) { @@ -55,10 +55,10 @@ export const hasParallelDraftRight = (state, getters) => (diffFileSha, line) => return draftsForFile ? Boolean(draftsForFile[rkey]) : false; }; -export const shouldRenderDraftRowInDiscussion = (state, getters) => discussionId => +export const shouldRenderDraftRowInDiscussion = (state, getters) => (discussionId) => typeof getters.draftsPerDiscussionId[discussionId] !== 'undefined'; -export const draftForDiscussion = (state, getters) => discussionId => +export const draftForDiscussion = (state, getters) => (discussionId) => getters.draftsPerDiscussionId[discussionId] || {}; export const draftForLine = (state, getters) => (diffFileSha, line, side = null) => { @@ -75,10 +75,10 @@ export const draftForLine = (state, getters) => (diffFileSha, line, side = null) return {}; }; -export const draftsForFile = state => diffFileSha => - state.drafts.filter(draft => draft.file_hash === diffFileSha); +export const draftsForFile = (state) => (diffFileSha) => + state.drafts.filter((draft) => draft.file_hash === diffFileSha); -export const isPublishingDraft = state => draftId => +export const isPublishingDraft = (state) => (draftId) => state.currentlyPublishingDrafts.indexOf(draftId) !== -1; -export const sortedDrafts = state => [...state.drafts].sort((a, b) => a.id > b.id); +export const sortedDrafts = (state) => [...state.drafts].sort((a, b) => a.id > b.id); diff --git a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js index 731f4b6d12a..dabfe864575 100644 --- a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js +++ b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/mutations.js @@ -1,6 +1,6 @@ import * as types from './mutation_types'; -const processDraft = draft => ({ +const processDraft = (draft) => ({ ...draft, isDraft: true, }); @@ -11,7 +11,7 @@ export default { }, [types.DELETE_DRAFT](state, draftId) { - state.drafts = state.drafts.filter(draft => draft.id !== draftId); + state.drafts = state.drafts.filter((draft) => draft.id !== draftId); }, [types.SET_BATCH_COMMENTS_DRAFTS](state, drafts) { @@ -23,13 +23,13 @@ export default { }, [types.RECEIVE_PUBLISH_DRAFT_SUCCESS](state, draftId) { state.currentlyPublishingDrafts = state.currentlyPublishingDrafts.filter( - publishingDraftId => publishingDraftId !== draftId, + (publishingDraftId) => publishingDraftId !== draftId, ); - state.drafts = state.drafts.filter(d => d.id !== draftId); + state.drafts = state.drafts.filter((d) => d.id !== draftId); }, [types.RECEIVE_PUBLISH_DRAFT_ERROR](state, draftId) { state.currentlyPublishingDrafts = state.currentlyPublishingDrafts.filter( - publishingDraftId => publishingDraftId !== draftId, + (publishingDraftId) => publishingDraftId !== draftId, ); }, @@ -44,14 +44,14 @@ export default { state.isPublishing = false; }, [types.RECEIVE_DRAFT_UPDATE_SUCCESS](state, data) { - const index = state.drafts.findIndex(draft => draft.id === data.id); + const index = state.drafts.findIndex((draft) => draft.id === data.id); if (index >= 0) { state.drafts.splice(index, 1, processDraft(data)); } }, [types.TOGGLE_RESOLVE_DISCUSSION](state, draftId) { - state.drafts = state.drafts.map(draft => { + state.drafts = state.drafts.map((draft) => { if (draft.id === draftId) { return { ...draft, diff --git a/app/assets/javascripts/batch_comments/utils.js b/app/assets/javascripts/batch_comments/utils.js index cf4f7af0ebb..387e7e4a610 100644 --- a/app/assets/javascripts/batch_comments/utils.js +++ b/app/assets/javascripts/batch_comments/utils.js @@ -1,11 +1,11 @@ import { getFormData } from '~/diffs/store/utils'; -export const getDraftReplyFormData = data => ({ +export const getDraftReplyFormData = (data) => ({ endpoint: data.notesData.draftsPath, data, }); -export const getDraftFormData = params => ({ +export const getDraftFormData = (params) => ({ endpoint: params.notesData.draftsPath, data: getFormData(params), }); diff --git a/app/assets/javascripts/behaviors/autosize.js b/app/assets/javascripts/behaviors/autosize.js index 3e9d77cdf6b..a5404539c17 100644 --- a/app/assets/javascripts/behaviors/autosize.js +++ b/app/assets/javascripts/behaviors/autosize.js @@ -8,6 +8,6 @@ document.addEventListener('DOMContentLoaded', () => { Autosize(autosizeEls); Autosize.update(autosizeEls); - autosizeEls.forEach(el => el.classList.add('js-autosize-initialized')); + autosizeEls.forEach((el) => el.classList.add('js-autosize-initialized')); }); }); diff --git a/app/assets/javascripts/behaviors/bind_in_out.js b/app/assets/javascripts/behaviors/bind_in_out.js index 886f127b06b..2c5a3994ade 100644 --- a/app/assets/javascripts/behaviors/bind_in_out.js +++ b/app/assets/javascripts/behaviors/bind_in_out.js @@ -30,7 +30,7 @@ class BindInOut { static initAll() { const ins = document.querySelectorAll('*[data-bind-in]'); - return [].map.call(ins, anIn => BindInOut.init(anIn)); + return [].map.call(ins, (anIn) => BindInOut.init(anIn)); } static init(anIn, anOut) { diff --git a/app/assets/javascripts/behaviors/copy_to_clipboard.js b/app/assets/javascripts/behaviors/copy_to_clipboard.js index e822072d669..1176fa6628d 100644 --- a/app/assets/javascripts/behaviors/copy_to_clipboard.js +++ b/app/assets/javascripts/behaviors/copy_to_clipboard.js @@ -58,7 +58,7 @@ export default function initCopyToClipboard() { * the last minute to deconstruct this JSON hash and set the `text/plain` and `text/x-gfm` copy * data types to the intended values. */ - $(document).on('copy', 'body > textarea[readonly]', e => { + $(document).on('copy', 'body > textarea[readonly]', (e) => { const { clipboardData } = e.originalEvent; if (!clipboardData) return; diff --git a/app/assets/javascripts/behaviors/gl_emoji.js b/app/assets/javascripts/behaviors/gl_emoji.js index 16373b523b2..1fa37999d62 100644 --- a/app/assets/javascripts/behaviors/gl_emoji.js +++ b/app/assets/javascripts/behaviors/gl_emoji.js @@ -32,7 +32,7 @@ class GlEmoji extends HTMLElement { const isEmojiUnicode = this.childNodes && - Array.prototype.every.call(this.childNodes, childNode => childNode.nodeType === 3); + Array.prototype.every.call(this.childNodes, (childNode) => childNode.nodeType === 3); if ( emojiUnicode && diff --git a/app/assets/javascripts/behaviors/load_startup_css.js b/app/assets/javascripts/behaviors/load_startup_css.js index 1d7bf716475..dbe9ff8b6e7 100644 --- a/app/assets/javascripts/behaviors/load_startup_css.js +++ b/app/assets/javascripts/behaviors/load_startup_css.js @@ -8,7 +8,7 @@ export const loadStartupCSS = () => { () => { document .querySelectorAll('link[media=print]') - .forEach(x => x.dispatchEvent(new Event('load'))); + .forEach((x) => x.dispatchEvent(new Event('load'))); }, { once: true }, ); diff --git a/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js b/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js index ce5b63df19c..9a8af79210e 100644 --- a/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js +++ b/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js @@ -10,10 +10,10 @@ export class CopyAsGFM { const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); if (isIOS) return; - $(document).on('copy', '.md', e => { + $(document).on('copy', '.md', (e) => { CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection); }); - $(document).on('copy', 'pre.code.highlight, table.code td.line_content', e => { + $(document).on('copy', 'pre.code.highlight, table.code td.line_content', (e) => { CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection); }); $(document).on('paste', '.js-gfm-input', CopyAsGFM.pasteGFM); @@ -42,7 +42,7 @@ export class CopyAsGFM { clipboardData.setData('text/x-gfm-html', html); CopyAsGFM.nodeToGFM(el) - .then(res => { + .then((res) => { clipboardData.setData('text/x-gfm', res); }) .catch(() => { @@ -71,7 +71,7 @@ export class CopyAsGFM { const div = document.createElement('div'); div.innerHTML = gfmHtml; CopyAsGFM.nodeToGFM(div) - .then(transformedGfm => { + .then((transformedGfm) => { CopyAsGFM.insertPastedText(e.target, text, transformedGfm); }) .catch(() => {}); @@ -79,7 +79,7 @@ export class CopyAsGFM { } static insertPastedText(target, text, gfm) { - insertText(target, textBefore => { + insertText(target, (textBefore) => { // If the text before the cursor contains an odd number of backticks, // we are either inside an inline code span that starts with 1 backtick // or a code block that starts with 3 backticks. @@ -125,7 +125,7 @@ export class CopyAsGFM { let lineSelector = '.line'; if (target) { - const lineClass = ['left-side', 'right-side'].filter(name => + const lineClass = ['left-side', 'right-side'].filter((name) => target.classList.contains(name), )[0]; if (lineClass) { diff --git a/app/assets/javascripts/behaviors/markdown/highlight_current_user.js b/app/assets/javascripts/behaviors/markdown/highlight_current_user.js index 6208b3f0032..0fac278573e 100644 --- a/app/assets/javascripts/behaviors/markdown/highlight_current_user.js +++ b/app/assets/javascripts/behaviors/markdown/highlight_current_user.js @@ -9,7 +9,7 @@ export default function highlightCurrentUser(elements) { return; } - elements.forEach(element => { + elements.forEach((element) => { if (parseInt(element.dataset.user, 10) === currentUserId) { element.classList.add('current-user'); } diff --git a/app/assets/javascripts/behaviors/markdown/marks/inline_diff.js b/app/assets/javascripts/behaviors/markdown/marks/inline_diff.js index ce425e80cd3..7f1506cd5d9 100644 --- a/app/assets/javascripts/behaviors/markdown/marks/inline_diff.js +++ b/app/assets/javascripts/behaviors/markdown/marks/inline_diff.js @@ -19,7 +19,7 @@ export default class InlineDiff extends Mark { { tag: 'span.idiff.addition', attrs: { addition: true } }, { tag: 'span.idiff.deletion', attrs: { addition: false } }, ], - toDOM: node => [ + toDOM: (node) => [ 'span', { class: `idiff left right ${node.attrs.addition ? 'addition' : 'deletion'}` }, 0, diff --git a/app/assets/javascripts/behaviors/markdown/marks/inline_html.js b/app/assets/javascripts/behaviors/markdown/marks/inline_html.js index f8465111959..556e6f7df1c 100644 --- a/app/assets/javascripts/behaviors/markdown/marks/inline_html.js +++ b/app/assets/javascripts/behaviors/markdown/marks/inline_html.js @@ -19,14 +19,14 @@ export default class InlineHTML extends Mark { parseDOM: [ { tag: 'sup, sub, kbd, q, samp, var', - getAttrs: el => ({ tag: el.nodeName.toLowerCase() }), + getAttrs: (el) => ({ tag: el.nodeName.toLowerCase() }), }, { tag: 'abbr', - getAttrs: el => ({ tag: 'abbr', title: el.getAttribute('title') }), + getAttrs: (el) => ({ tag: 'abbr', title: el.getAttribute('title') }), }, ], - toDOM: node => [node.attrs.tag, { title: node.attrs.title }, 0], + toDOM: (node) => [node.attrs.tag, { title: node.attrs.title }, 0], }; } diff --git a/app/assets/javascripts/behaviors/markdown/nodes/code_block.js b/app/assets/javascripts/behaviors/markdown/nodes/code_block.js index 1e0c05eff08..cd90d67c60d 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/code_block.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/code_block.js @@ -25,7 +25,7 @@ export default class CodeBlock extends BaseCodeBlock { { tag: 'pre.code.highlight', preserveWhitespace: 'full', - getAttrs: el => { + getAttrs: (el) => { const lang = el.getAttribute('lang'); if (!lang || lang === '') return {}; @@ -62,13 +62,13 @@ export default class CodeBlock extends BaseCodeBlock { tag: '.md-suggestion-diff', preserveWhitespace: 'full', getContent: (el, schema) => - [...el.querySelectorAll('.line_content.new span')].map(span => + [...el.querySelectorAll('.line_content.new span')].map((span) => schema.text(span.innerText), ), attrs: { lang: 'suggestion' }, }, ], - toDOM: node => ['pre', { class: 'code highlight', lang: node.attrs.lang }, ['code', 0]], + toDOM: (node) => ['pre', { class: 'code highlight', lang: node.attrs.lang }, ['code', 0]], }; } diff --git a/app/assets/javascripts/behaviors/markdown/nodes/emoji.js b/app/assets/javascripts/behaviors/markdown/nodes/emoji.js index a7cc3e828f5..367a06ad3c1 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/emoji.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/emoji.js @@ -20,14 +20,14 @@ export default class Emoji extends Node { parseDOM: [ { tag: 'gl-emoji', - getAttrs: el => ({ + getAttrs: (el) => ({ name: el.dataset.name, title: el.getAttribute('title'), moji: el.textContent, }), }, ], - toDOM: node => [ + toDOM: (node) => [ 'gl-emoji', { 'data-name': node.attrs.name, title: node.attrs.title }, node.attrs.moji, diff --git a/app/assets/javascripts/behaviors/markdown/nodes/image.js b/app/assets/javascripts/behaviors/markdown/nodes/image.js index b1983eebe15..76746528e72 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/image.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/image.js @@ -30,7 +30,7 @@ export default class Image extends BaseImage { // Matches HTML generated by Banzai::Filter::ImageLazyLoadFilter { tag: 'img[src]', - getAttrs: el => { + getAttrs: (el) => { const imageSrc = el.src; const imageUrl = imageSrc && imageSrc !== placeholderImage ? imageSrc : el.dataset.src || ''; @@ -43,7 +43,7 @@ export default class Image extends BaseImage { }, }, ], - toDOM: node => ['img', node.attrs], + toDOM: (node) => ['img', node.attrs], }; } diff --git a/app/assets/javascripts/behaviors/markdown/nodes/playable.js b/app/assets/javascripts/behaviors/markdown/nodes/playable.js index 9a2c9c3c9b0..9cbd95a7bd8 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/playable.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/playable.js @@ -42,11 +42,11 @@ export default class Playable extends Node { }, { tag: `${this.mediaType}[src]`, - getAttrs: el => ({ src: el.src, alt: el.dataset.title }), + getAttrs: (el) => ({ src: el.src, alt: el.dataset.title }), }, ]; - const toDOM = node => [ + const toDOM = (node) => [ this.mediaType, { src: node.attrs.src, diff --git a/app/assets/javascripts/behaviors/markdown/nodes/reference.js b/app/assets/javascripts/behaviors/markdown/nodes/reference.js index aa724798da6..dd82ea58ea5 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/reference.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/reference.js @@ -25,7 +25,7 @@ export default class Reference extends Node { { tag: 'a.gfm:not([data-link=true])', priority: HIGHER_PARSE_RULE_PRIORITY, - getAttrs: el => ({ + getAttrs: (el) => ({ className: el.className, referenceType: el.dataset.referenceType, originalText: el.dataset.original, @@ -34,7 +34,7 @@ export default class Reference extends Node { }), }, ], - toDOM: node => [ + toDOM: (node) => [ 'a', { class: node.attrs.className, diff --git a/app/assets/javascripts/behaviors/markdown/nodes/table_cell.js b/app/assets/javascripts/behaviors/markdown/nodes/table_cell.js index c63bfe10e39..ebb66cd4da5 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/table_cell.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/table_cell.js @@ -19,13 +19,13 @@ export default class TableCell extends Node { parseDOM: [ { tag: 'td, th', - getAttrs: el => ({ + getAttrs: (el) => ({ header: el.tagName === 'TH', align: el.getAttribute('align') || el.style.textAlign, }), }, ], - toDOM: node => [node.attrs.header ? 'th' : 'td', { align: node.attrs.align }, 0], + toDOM: (node) => [node.attrs.header ? 'th' : 'td', { align: node.attrs.align }, 0], }; } diff --git a/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js b/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js index 7bb56b4c406..56c2b17286d 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js @@ -23,7 +23,7 @@ export default class TaskListItem extends Node { { priority: HIGHER_PARSE_RULE_PRIORITY, tag: 'li.task-list-item', - getAttrs: el => { + getAttrs: (el) => { const checkbox = el.querySelector('input[type=checkbox].task-list-item-checkbox'); return { done: checkbox && checkbox.checked }; }, diff --git a/app/assets/javascripts/behaviors/markdown/render_math.js b/app/assets/javascripts/behaviors/markdown/render_math.js index 30783562da9..f34fec4d449 100644 --- a/app/assets/javascripts/behaviors/markdown/render_math.js +++ b/app/assets/javascripts/behaviors/markdown/render_math.js @@ -35,7 +35,7 @@ const RENDER_FLASH_MSG = sprintf( // Wait for the browser to reflow the layout. Reflowing SVG takes time. // This has to wrap the inner function, otherwise IE/Edge throw "invalid calling object". -const waitForReflow = fn => { +const waitForReflow = (fn) => { window.requestAnimationFrame(fn); }; @@ -122,7 +122,7 @@ class SafeMathRenderer { render() { // Replace math blocks with a placeholder so they aren't rendered twice - this.elements.forEach(el => { + this.elements.forEach((el) => { const placeholder = document.createElement('span'); placeholder.style.display = 'none'; placeholder.setAttribute('data-math-style', el.getAttribute('data-math-style')); diff --git a/app/assets/javascripts/behaviors/markdown/render_mermaid.js b/app/assets/javascripts/behaviors/markdown/render_mermaid.js index 602f156dbf0..479782a1f1f 100644 --- a/app/assets/javascripts/behaviors/markdown/render_mermaid.js +++ b/app/assets/javascripts/behaviors/markdown/render_mermaid.js @@ -29,7 +29,7 @@ let mermaidModule = {}; function importMermaidModule() { return import(/* webpackChunkName: 'mermaid' */ 'mermaid') - .then(mermaid => { + .then((mermaid) => { let theme = 'neutral'; const ideDarkThemes = ['dark', 'solarized-dark', 'monokai']; @@ -59,7 +59,7 @@ function importMermaidModule() { return mermaid; }) - .catch(err => { + .catch((err) => { flash(sprintf(__("Can't load mermaid module: %{err}"), { err })); // eslint-disable-next-line no-console console.error(err); @@ -77,7 +77,7 @@ function fixElementSource(el) { } function renderMermaidEl(el) { - mermaidModule.init(undefined, el, id => { + mermaidModule.init(undefined, el, (id) => { const source = el.textContent; const svg = document.getElementById(id); @@ -170,7 +170,7 @@ function renderMermaids($els) { elsProcessingMap.set(el, requestId); }); }) - .catch(err => { + .catch((err) => { flash(sprintf(__('Encountered an error while rendering: %{err}'), { err })); // eslint-disable-next-line no-console console.error(err); diff --git a/app/assets/javascripts/behaviors/markdown/render_metrics.js b/app/assets/javascripts/behaviors/markdown/render_metrics.js index 37cbce46b6f..e7a2a6ce47c 100644 --- a/app/assets/javascripts/behaviors/markdown/render_metrics.js +++ b/app/assets/javascripts/behaviors/markdown/render_metrics.js @@ -9,7 +9,7 @@ export default function renderMetrics(elements) { const wrapperList = []; - elements.forEach(element => { + elements.forEach((element) => { let wrapper; const { previousElementSibling } = element; const isFirstElementInGroup = !previousElementSibling?.urls; @@ -33,7 +33,7 @@ export default function renderMetrics(elements) { ).then(({ default: EmbedGroup }) => { const EmbedGroupComponent = Vue.extend(EmbedGroup); - wrapperList.forEach(wrapper => { + wrapperList.forEach((wrapper) => { // eslint-disable-next-line no-new new EmbedGroupComponent({ el: wrapper, diff --git a/app/assets/javascripts/behaviors/markdown/schema.js b/app/assets/javascripts/behaviors/markdown/schema.js index 163182ab778..8bea24584cc 100644 --- a/app/assets/javascripts/behaviors/markdown/schema.js +++ b/app/assets/javascripts/behaviors/markdown/schema.js @@ -2,7 +2,7 @@ import { Schema } from 'prosemirror-model'; import editorExtensions from './editor_extensions'; const nodes = editorExtensions - .filter(extension => extension.type === 'node') + .filter((extension) => extension.type === 'node') .reduce( (ns, { name, schema }) => ({ ...ns, @@ -12,7 +12,7 @@ const nodes = editorExtensions ); const marks = editorExtensions - .filter(extension => extension.type === 'mark') + .filter((extension) => extension.type === 'mark') .reduce( (ms, { name, schema }) => ({ ...ms, diff --git a/app/assets/javascripts/behaviors/markdown/serializer.js b/app/assets/javascripts/behaviors/markdown/serializer.js index 70dbd8bd206..b4adf1a413f 100644 --- a/app/assets/javascripts/behaviors/markdown/serializer.js +++ b/app/assets/javascripts/behaviors/markdown/serializer.js @@ -2,7 +2,7 @@ import { MarkdownSerializer } from 'prosemirror-markdown'; import editorExtensions from './editor_extensions'; const nodes = editorExtensions - .filter(extension => extension.type === 'node') + .filter((extension) => extension.type === 'node') .reduce( (ns, { name, toMarkdown }) => ({ ...ns, @@ -12,7 +12,7 @@ const nodes = editorExtensions ); const marks = editorExtensions - .filter(extension => extension.type === 'mark') + .filter((extension) => extension.type === 'mark') .reduce( (ms, { name, toMarkdown }) => ({ ...ms, diff --git a/app/assets/javascripts/behaviors/preview_markdown.js b/app/assets/javascripts/behaviors/preview_markdown.js index 3a8ba7be667..def1c567cd5 100644 --- a/app/assets/javascripts/behaviors/preview_markdown.js +++ b/app/assets/javascripts/behaviors/preview_markdown.js @@ -41,7 +41,7 @@ MarkdownPreview.prototype.showPreview = function ($form) { this.hideReferencedUsers($form); } else { preview.addClass('md-preview-loading').text(__('Loading...')); - this.fetchMarkdownPreview(mdText, url, response => { + this.fetchMarkdownPreview(mdText, url, (response) => { let body; if (response.body.length > 0) { ({ body } = response); diff --git a/app/assets/javascripts/behaviors/quick_submit.js b/app/assets/javascripts/behaviors/quick_submit.js index 907cfc06e28..68e831252d6 100644 --- a/app/assets/javascripts/behaviors/quick_submit.js +++ b/app/assets/javascripts/behaviors/quick_submit.js @@ -30,7 +30,7 @@ function keyCodeIs(e, keyCode) { return e.keyCode === keyCode; } -$(document).on('keydown.quick_submit', '.js-quick-submit', e => { +$(document).on('keydown.quick_submit', '.js-quick-submit', (e) => { // Enter if (!keyCodeIs(e, 13)) { return; diff --git a/app/assets/javascripts/behaviors/requires_input.js b/app/assets/javascripts/behaviors/requires_input.js index 2fa3f4fc789..b1227fb3533 100644 --- a/app/assets/javascripts/behaviors/requires_input.js +++ b/app/assets/javascripts/behaviors/requires_input.js @@ -23,7 +23,7 @@ $.fn.requiresInput = function requiresInput() { function requireInput() { // Collect the input values of *all* required fields - const values = Array.from($(fieldSelector, $form)).map(field => field.value); + const values = Array.from($(fieldSelector, $form)).map((field) => field.value); // Disable the button if any required fields are empty if (values.length && values.some(isEmpty)) { diff --git a/app/assets/javascripts/behaviors/secret_values.js b/app/assets/javascripts/behaviors/secret_values.js index 5b92608d536..2f1951c97f9 100644 --- a/app/assets/javascripts/behaviors/secret_values.js +++ b/app/assets/javascripts/behaviors/secret_values.js @@ -30,12 +30,12 @@ export default class SecretValues { updateDom(isRevealed) { const values = this.container.querySelectorAll(this.valueSelector); - values.forEach(value => { + values.forEach((value) => { value.classList.toggle('hide', !isRevealed); }); const placeholders = this.container.querySelectorAll(this.placeholderSelector); - placeholders.forEach(placeholder => { + placeholders.forEach((placeholder) => { placeholder.classList.toggle('hide', isRevealed); }); diff --git a/app/assets/javascripts/behaviors/shortcuts/keybindings.js b/app/assets/javascripts/behaviors/shortcuts/keybindings.js index bbcc40ab9fe..10832583783 100644 --- a/app/assets/javascripts/behaviors/shortcuts/keybindings.js +++ b/app/assets/javascripts/behaviors/shortcuts/keybindings.js @@ -49,10 +49,10 @@ export const keybindingGroups = [ // For each keybinding object, add a `customKeys` property populated with the // user's custom keybindings (if the command has been customized). // `customKeys` will be `undefined` if the command hasn't been customized. - .map(group => { + .map((group) => { return { ...group, - keybindings: group.keybindings.map(binding => ({ + keybindings: group.keybindings.map((binding) => ({ ...binding, customKeys: customizations[binding.command], })), @@ -66,7 +66,7 @@ export const keybindingGroups = [ * @example * { "globalShortcuts.togglePerformanceBar": ["p e r f"] } */ -const commandToKeys = flatten(keybindingGroups.map(group => group.keybindings)).reduce( +const commandToKeys = flatten(keybindingGroups.map((group) => group.keybindings)).reduce( (acc, binding) => { acc[binding.command] = binding.customKeys || binding.defaultKeys; return acc; @@ -87,7 +87,7 @@ const commandToKeys = flatten(keybindingGroups.map(group => group.keybindings)). * * Mousetrap.bind(keysFor(TOGGLE_PERFORMANCE_BAR), handler); */ -export const keysFor = command => { +export const keysFor = (command) => { if (shouldDisableShortcuts()) { return []; } diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js index 766e99fd5a6..50d2399b312 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js @@ -197,7 +197,7 @@ export default class Shortcuts { $textarea.data(LOCAL_MOUSETRAP_DATA_KEY, localMousetrap); toolbarBtnToShortcutsMap.forEach((keyboardShortcuts, $toolbarBtn) => { - localMousetrap.bind(keyboardShortcuts, e => { + localMousetrap.bind(keyboardShortcuts, (e) => { e.preventDefault(); handler($toolbarBtn); @@ -231,7 +231,7 @@ export default class Shortcuts { const localMousetrap = $textarea.data(LOCAL_MOUSETRAP_DATA_KEY); if (localMousetrap) { - getToolbarBtnToShortcutsMap($textarea).forEach(keyboardShortcuts => { + getToolbarBtnToShortcutsMap($textarea).forEach((keyboardShortcuts) => { localMousetrap.unbind(keyboardShortcuts); }); } diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js index c35a073b291..11b4fcd4e1c 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js @@ -53,7 +53,7 @@ export default class ShortcutsBlob extends Shortcuts { shortcircuitPermalinkButton() { const button = this.options.fileBlobPermalinkUrlElement; - const handleButton = e => { + const handleButton = (e) => { if (!eventHasModifierKeys(e)) { e.preventDefault(); this.moveToFilePermalink(); diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js index 5a5a67334d3..5e8ddeb6af7 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js @@ -39,7 +39,7 @@ export default class ShortcutsIssuable extends Shortcuts { // ... Or come from a message if (!foundMessage) { if (documentFragment.originalNodes) { - documentFragment.originalNodes.forEach(e => { + documentFragment.originalNodes.forEach((e) => { let node = e; do { // Text nodes don't define the `matches` method @@ -62,7 +62,7 @@ export default class ShortcutsIssuable extends Shortcuts { const blockquoteEl = document.createElement('blockquote'); blockquoteEl.appendChild(el); CopyAsGFM.nodeToGFM(blockquoteEl) - .then(text => { + .then((text) => { if (text.trim() === '') { return false; } diff --git a/app/assets/javascripts/blob/3d_viewer/index.js b/app/assets/javascripts/blob/3d_viewer/index.js index 2d4f45cc365..94397d70384 100644 --- a/app/assets/javascripts/blob/3d_viewer/index.js +++ b/app/assets/javascripts/blob/3d_viewer/index.js @@ -68,7 +68,7 @@ export default class Renderer { } loadFile() { - this.loader.load(this.container.dataset.endpoint, geo => { + this.loader.load(this.container.dataset.endpoint, (geo) => { const obj = new MeshObject(geo); this.objects.push(obj); @@ -99,7 +99,7 @@ export default class Renderer { } changeObjectMaterials(type) { - this.objects.forEach(obj => { + this.objects.forEach((obj) => { obj.changeMaterial(type); }); } diff --git a/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js b/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js index 5b781947d55..ebe2c2b3bb8 100644 --- a/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js +++ b/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js @@ -28,7 +28,7 @@ class BalsamiqViewer { .then(({ data }) => { this.renderFile(data); }) - .catch(e => { + .catch((e) => { throw new Error(e); }); } @@ -39,7 +39,7 @@ class BalsamiqViewer { this.initDatabase(fileBuffer); const previews = this.getPreviews(); - previews.forEach(preview => { + previews.forEach((preview) => { const renderedPreview = this.renderPreview(preview); container.appendChild(renderedPreview); diff --git a/app/assets/javascripts/blob/blob_file_dropzone.js b/app/assets/javascripts/blob/blob_file_dropzone.js index 77565902ea3..19bad64155d 100644 --- a/app/assets/javascripts/blob/blob_file_dropzone.js +++ b/app/assets/javascripts/blob/blob_file_dropzone.js @@ -80,7 +80,7 @@ export default class BlobFileDropzone { }, }); - submitButton.on('click', e => { + submitButton.on('click', (e) => { e.preventDefault(); e.stopPropagation(); if (dropzone[0].dropzone.getQueuedFiles().length === 0) { diff --git a/app/assets/javascripts/blob/blob_line_permalink_updater.js b/app/assets/javascripts/blob/blob_line_permalink_updater.js index 62f0a56ed75..11089b299c5 100644 --- a/app/assets/javascripts/blob/blob_line_permalink_updater.js +++ b/app/assets/javascripts/blob/blob_line_permalink_updater.js @@ -2,12 +2,12 @@ import { getLocationHash } from '../lib/utils/url_utility'; const lineNumberRe = /^L[0-9]+/; -const updateLineNumbersOnBlobPermalinks = linksToUpdate => { +const updateLineNumbersOnBlobPermalinks = (linksToUpdate) => { const hash = getLocationHash(); if (hash && lineNumberRe.test(hash)) { const hashUrlString = `#${hash}`; - [].concat(Array.prototype.slice.call(linksToUpdate)).forEach(permalinkButton => { + [].concat(Array.prototype.slice.call(linksToUpdate)).forEach((permalinkButton) => { const baseHref = permalinkButton.getAttribute('data-original-href') || (() => { @@ -28,7 +28,7 @@ function BlobLinePermalinkUpdater(blobContentHolder, lineNumberSelector, element }, 0); }; - blobContentHolder.addEventListener('click', e => { + blobContentHolder.addEventListener('click', (e) => { if (e.target.matches(lineNumberSelector)) { updateBlameAndBlobPermalinkCb(); } diff --git a/app/assets/javascripts/blob/components/blob_content_error.vue b/app/assets/javascripts/blob/components/blob_content_error.vue index 7344b9cdff5..4c5d9831237 100644 --- a/app/assets/javascripts/blob/components/blob_content_error.vue +++ b/app/assets/javascripts/blob/components/blob_content_error.vue @@ -25,7 +25,7 @@ export default { }, renderErrorReason() { const defaultReasonPath = Object.keys(BLOB_RENDER_ERRORS.REASONS).find( - reason => BLOB_RENDER_ERRORS.REASONS[reason].id === this.viewerError, + (reason) => BLOB_RENDER_ERRORS.REASONS[reason].id === this.viewerError, ); const defaultReason = BLOB_RENDER_ERRORS.REASONS[defaultReasonPath].text; return this.notStoredExternally diff --git a/app/assets/javascripts/blob/file_template_mediator.js b/app/assets/javascripts/blob/file_template_mediator.js index 10e508484aa..c35f9934004 100644 --- a/app/assets/javascripts/blob/file_template_mediator.js +++ b/app/assets/javascripts/blob/file_template_mediator.js @@ -38,14 +38,14 @@ export default class FileTemplateMediator { MetricsDashboardSelector, DockerfileSelector, LicenseSelector, - ].map(TemplateSelectorClass => new TemplateSelectorClass({ mediator: this })); + ].map((TemplateSelectorClass) => new TemplateSelectorClass({ mediator: this })); } initTemplateTypeSelector() { this.typeSelector = new FileTemplateTypeSelector({ mediator: this, dropdownData: this.templateSelectors - .map(templateSelector => { + .map((templateSelector) => { const cfg = templateSelector.config; return { @@ -55,7 +55,7 @@ export default class FileTemplateMediator { }; }) .reduce( - (acc, current) => (acc.find(item => item.id === current.id) ? acc : [...acc, current]), + (acc, current) => (acc.find((item) => item.id === current.id) ? acc : [...acc, current]), [], ), }); @@ -99,7 +99,7 @@ export default class FileTemplateMediator { } listenForPreviewMode() { - this.$navLinks.on('click', 'a', e => { + this.$navLinks.on('click', 'a', (e) => { const urlPieces = e.target.href.split('#'); const hash = urlPieces[1]; if (hash === 'preview') { @@ -115,7 +115,7 @@ export default class FileTemplateMediator { e.preventDefault(); } - this.templateSelectors.forEach(selector => { + this.templateSelectors.forEach((selector) => { if (selector.config.key === item.key) { selector.show(); } else { @@ -138,7 +138,7 @@ export default class FileTemplateMediator { selector.renderLoading(); this.fetchFileTemplate(selector.config.type, query, data) - .then(file => { + .then((file) => { this.setEditorContent(file); this.setFilename(name); selector.renderLoaded(); @@ -157,12 +157,12 @@ export default class FileTemplateMediator { initPopover(suggestCommitChanges); } }) - .catch(err => new Flash(`An error occurred while fetching the template: ${err}`)); + .catch((err) => new Flash(`An error occurred while fetching the template: ${err}`)); } displayMatchedTemplateSelector() { const currentInput = this.getFilename(); - this.templateSelectors.forEach(selector => { + this.templateSelectors.forEach((selector) => { const match = selector.config.pattern.test(currentInput); if (match) { @@ -174,8 +174,8 @@ export default class FileTemplateMediator { } fetchFileTemplate(type, query, data = {}) { - return new Promise(resolve => { - const resolveFile = file => resolve(file); + return new Promise((resolve) => { + const resolveFile = (file) => resolve(file); Api.projectTemplate(this.projectId, type, query, data, resolveFile); }); @@ -194,7 +194,7 @@ export default class FileTemplateMediator { } findTemplateSelectorByKey(key) { - return this.templateSelectors.find(selector => selector.config.key === key); + return this.templateSelectors.find((selector) => selector.config.key === key); } hideTemplateSelectorMenu() { @@ -250,6 +250,6 @@ export default class FileTemplateMediator { } getSelected() { - return this.templateSelectors.find(selector => selector.selected); + return this.templateSelectors.find((selector) => selector.selected); } } diff --git a/app/assets/javascripts/blob/notebook/notebook_viewer.vue b/app/assets/javascripts/blob/notebook/notebook_viewer.vue index ea33d621d47..02f93e14219 100644 --- a/app/assets/javascripts/blob/notebook/notebook_viewer.vue +++ b/app/assets/javascripts/blob/notebook/notebook_viewer.vue @@ -45,12 +45,12 @@ export default { loadFile() { axios .get(this.endpoint) - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { this.json = data; this.loading = false; }) - .catch(e => { + .catch((e) => { if (e.status !== 200) { this.loadError = true; } diff --git a/app/assets/javascripts/blob/openapi/index.js b/app/assets/javascripts/blob/openapi/index.js index 12cc2be8246..e6dc463f764 100644 --- a/app/assets/javascripts/blob/openapi/index.js +++ b/app/assets/javascripts/blob/openapi/index.js @@ -12,7 +12,7 @@ export default () => { dom_id: '#js-openapi-viewer', }); }) - .catch(error => { + .catch((error) => { flash(__('Something went wrong while initializing the OpenAPI viewer')); throw error; }); diff --git a/app/assets/javascripts/blob/sketch/index.js b/app/assets/javascripts/blob/sketch/index.js index 767e205fcaa..d257810da65 100644 --- a/app/assets/javascripts/blob/sketch/index.js +++ b/app/assets/javascripts/blob/sketch/index.js @@ -12,9 +12,9 @@ export default class SketchLoader { load() { return this.getZipFile() - .then(data => JSZip.loadAsync(data)) - .then(asyncResult => asyncResult.files['previews/preview.png'].async('uint8array')) - .then(content => { + .then((data) => JSZip.loadAsync(data)) + .then((asyncResult) => asyncResult.files['previews/preview.png'].async('uint8array')) + .then((content) => { const url = window.URL || window.webkitURL; const blob = new Blob([new Uint8Array(content)], { type: 'image/png', diff --git a/app/assets/javascripts/blob/stl_viewer.js b/app/assets/javascripts/blob/stl_viewer.js index f129b6e631e..339906adc34 100644 --- a/app/assets/javascripts/blob/stl_viewer.js +++ b/app/assets/javascripts/blob/stl_viewer.js @@ -3,8 +3,8 @@ import Renderer from './3d_viewer'; export default () => { const viewer = new Renderer(document.getElementById('js-stl-viewer')); - [].slice.call(document.querySelectorAll('.js-material-changer')).forEach(el => { - el.addEventListener('click', e => { + [].slice.call(document.querySelectorAll('.js-material-changer')).forEach((el) => { + el.addEventListener('click', (e) => { const { target } = e; e.preventDefault(); diff --git a/app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js b/app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js index 55edb852ee6..d0dd80932cc 100644 --- a/app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js +++ b/app/assets/javascripts/blob/suggest_gitlab_ci_yml/index.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import Popover from './components/popover.vue'; -export default el => +export default (el) => new Vue({ el, render(createElement) { diff --git a/app/assets/javascripts/blob/template_selector.js b/app/assets/javascripts/blob/template_selector.js index ae9bb3455f0..9fa70ce3c62 100644 --- a/app/assets/javascripts/blob/template_selector.js +++ b/app/assets/javascripts/blob/template_selector.js @@ -26,12 +26,12 @@ export default class TemplateSelector { data, filterable: true, selectable: true, - toggleLabel: item => item.name, + toggleLabel: (item) => item.name, search: { fields: ['name'], }, - clicked: options => this.onDropdownClicked(options), - text: item => item.name, + clicked: (options) => this.onDropdownClicked(options), + text: (item) => item.name, }); } @@ -46,7 +46,7 @@ export default class TemplateSelector { } listenForFilenameInput() { - return this.$filenameInput.on('keyup blur', e => this.renderMatchedDropdown(e)); + return this.$filenameInput.on('keyup blur', (e) => this.renderMatchedDropdown(e)); } renderMatchedDropdown() { diff --git a/app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js b/app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js index cb0e1a2d9fc..9370e170571 100644 --- a/app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js +++ b/app/assets/javascripts/blob/template_selectors/ci_syntax_yaml_selector.js @@ -22,8 +22,8 @@ export default class BlobCiSyntaxYamlSelector extends FileTemplateSelector { search: { fields: ['name'], }, - clicked: options => this.reportSelectionName(options), - text: item => item.name, + clicked: (options) => this.reportSelectionName(options), + text: (item) => item.name, }); } } diff --git a/app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js b/app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js index 3a4e86fe572..3879a6c5742 100644 --- a/app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js +++ b/app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js @@ -23,8 +23,8 @@ export default class BlobCiYamlSelector extends FileTemplateSelector { search: { fields: ['name'], }, - clicked: options => this.reportSelectionName(options), - text: item => item.name, + clicked: (options) => this.reportSelectionName(options), + text: (item) => item.name, }); } } diff --git a/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js b/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js index 3cb4bb83930..5d976c5acdb 100644 --- a/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js +++ b/app/assets/javascripts/blob/template_selectors/dockerfile_selector.js @@ -24,8 +24,8 @@ export default class DockerfileSelector extends FileTemplateSelector { search: { fields: ['name'], }, - clicked: options => this.reportSelectionName(options), - text: item => item.name, + clicked: (options) => this.reportSelectionName(options), + text: (item) => item.name, }); } } diff --git a/app/assets/javascripts/blob/template_selectors/gitignore_selector.js b/app/assets/javascripts/blob/template_selectors/gitignore_selector.js index 1721230dcb7..1bb1cbb74de 100644 --- a/app/assets/javascripts/blob/template_selectors/gitignore_selector.js +++ b/app/assets/javascripts/blob/template_selectors/gitignore_selector.js @@ -22,8 +22,8 @@ export default class BlobGitignoreSelector extends FileTemplateSelector { search: { fields: ['name'], }, - clicked: options => this.reportSelectionName(options), - text: item => item.name, + clicked: (options) => this.reportSelectionName(options), + text: (item) => item.name, }); } } diff --git a/app/assets/javascripts/blob/template_selectors/license_selector.js b/app/assets/javascripts/blob/template_selectors/license_selector.js index dafde82b1e0..affa20997e9 100644 --- a/app/assets/javascripts/blob/template_selectors/license_selector.js +++ b/app/assets/javascripts/blob/template_selectors/license_selector.js @@ -22,7 +22,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector { search: { fields: ['name'], }, - clicked: options => { + clicked: (options) => { const { e } = options; const el = options.$el; const query = options.selectedObj; @@ -39,7 +39,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector { data, }); }, - text: item => item.name, + text: (item) => item.name, }); } } diff --git a/app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js b/app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js index 9e698bfea5d..42adab05ce3 100644 --- a/app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js +++ b/app/assets/javascripts/blob/template_selectors/metrics_dashboard_selector.js @@ -22,8 +22,8 @@ export default class MetricsDashboardSelector extends FileTemplateSelector { search: { fields: ['name'], }, - clicked: options => this.reportSelectionName(options), - text: item => item.name, + clicked: (options) => this.reportSelectionName(options), + text: (item) => item.name, }); } } diff --git a/app/assets/javascripts/blob/template_selectors/type_selector.js b/app/assets/javascripts/blob/template_selectors/type_selector.js index 01625911815..f74f7535d99 100644 --- a/app/assets/javascripts/blob/template_selectors/type_selector.js +++ b/app/assets/javascripts/blob/template_selectors/type_selector.js @@ -17,8 +17,8 @@ export default class FileTemplateTypeSelector extends FileTemplateSelector { data: this.config.dropdownData, filterable: false, selectable: true, - clicked: options => this.mediator.selectTemplateTypeOptions(options), - text: item => item.name, + clicked: (options) => this.mediator.selectTemplateTypeOptions(options), + text: (item) => item.name, }); } } diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index 01350acad0c..4e6ec20ec64 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -7,7 +7,7 @@ import eventHub from '../../notes/event_hub'; import { __ } from '~/locale'; import { fixTitle } from '~/tooltips'; -const loadRichBlobViewer = type => { +const loadRichBlobViewer = (type) => { switch (type) { case 'balsamiq': return import(/* webpackChunkName: 'balsamiq_viewer' */ '../balsamiq_viewer'); @@ -30,8 +30,8 @@ export const handleBlobRichViewer = (viewer, type) => { if (!viewer || !type) return; loadRichBlobViewer(type) - .then(module => module?.default(viewer)) - .catch(error => { + .then((module) => module?.default(viewer)) + .catch((error) => { Flash(__('Error loading file viewer.')); throw error; }); @@ -84,7 +84,7 @@ export default class BlobViewer { initBindings() { if (this.switcherBtns.length) { - Array.from(this.switcherBtns).forEach(el => { + Array.from(this.switcherBtns).forEach((el) => { el.addEventListener('click', this.switchViewHandler.bind(this)); }); } @@ -155,7 +155,7 @@ export default class BlobViewer { this.toggleCopyButtonState(); BlobViewer.loadViewer(newViewer) - .then(viewer => { + .then((viewer) => { $(viewer).renderGFM(); this.$fileHolder.trigger('highlight:line'); diff --git a/app/assets/javascripts/blob_edit/blob_bundle.js b/app/assets/javascripts/blob_edit/blob_bundle.js index 678044687a9..7c2217a59e9 100644 --- a/app/assets/javascripts/blob_edit/blob_bundle.js +++ b/app/assets/javascripts/blob_edit/blob_bundle.js @@ -75,7 +75,7 @@ export default () => { }); initPopovers(); }) - .catch(e => createFlash(e)); + .catch((e) => createFlash(e)); cancelLink.on('click', () => { window.onbeforeunload = null; diff --git a/app/assets/javascripts/blob_edit/edit_blob.js b/app/assets/javascripts/blob_edit/edit_blob.js index 1bc51aa1d6f..e73e368fe01 100644 --- a/app/assets/javascripts/blob_edit/edit_blob.js +++ b/app/assets/javascripts/blob_edit/edit_blob.js @@ -21,7 +21,7 @@ export default class EditBlob { this.editor.use(new MarkdownExtension()); addEditorMarkdownListeners(this.editor); }) - .catch(e => createFlash(`${BLOB_EDITOR_ERROR}: ${e}`)); + .catch((e) => createFlash(`${BLOB_EDITOR_ERROR}: ${e}`)); } this.initModePanesAndLinks(); @@ -66,7 +66,7 @@ export default class EditBlob { initModePanesAndLinks() { this.$editModePanes = $('.js-edit-mode-pane'); this.$editModeLinks = $('.js-edit-mode a'); - this.$editModeLinks.on('click', e => this.editModeLinkClickHandler(e)); + this.$editModeLinks.on('click', (e) => this.editModeLinkClickHandler(e)); } editModeLinkClickHandler(e) { diff --git a/app/assets/javascripts/boards/boards_util.js b/app/assets/javascripts/boards/boards_util.js index 55dc155df0c..16c833c8aa2 100644 --- a/app/assets/javascripts/boards/boards_util.js +++ b/app/assets/javascripts/boards/boards_util.js @@ -41,14 +41,14 @@ export function formatListIssues(listIssues) { const listData = listIssues.nodes.reduce((map, list) => { listIssuesCount = list.issues.count; - let sortedIssues = list.issues.edges.map(issueNode => ({ + let sortedIssues = list.issues.edges.map((issueNode) => ({ ...issueNode.node, })); sortedIssues = sortBy(sortedIssues, 'relativePosition'); return { ...map, - [list.id]: sortedIssues.map(i => { + [list.id]: sortedIssues.map((i) => { const id = getIdFromGraphQLId(i.id); const listIssue = { @@ -97,23 +97,23 @@ export function moveIssueListHelper(issue, fromList, toList) { const updatedIssue = issue; if ( toList.listType === ListType.label && - !updatedIssue.labels.find(label => label.id === toList.label.id) + !updatedIssue.labels.find((label) => label.id === toList.label.id) ) { updatedIssue.labels.push(toList.label); } if (fromList?.label && fromList.listType === ListType.label) { - updatedIssue.labels = updatedIssue.labels.filter(label => fromList.label.id !== label.id); + updatedIssue.labels = updatedIssue.labels.filter((label) => fromList.label.id !== label.id); } if ( toList.listType === ListType.assignee && - !updatedIssue.assignees.find(assignee => assignee.id === toList.assignee.id) + !updatedIssue.assignees.find((assignee) => assignee.id === toList.assignee.id) ) { updatedIssue.assignees.push(toList.assignee); } if (fromList?.assignee && fromList.listType === ListType.assignee) { updatedIssue.assignees = updatedIssue.assignees.filter( - assignee => assignee.id !== fromList.assignee.id, + (assignee) => assignee.id !== fromList.assignee.id, ); } diff --git a/app/assets/javascripts/boards/components/board_assignee_dropdown.vue b/app/assets/javascripts/boards/components/board_assignee_dropdown.vue index 1469efae5a6..5d381f9a570 100644 --- a/app/assets/javascripts/boards/components/board_assignee_dropdown.vue +++ b/app/assets/javascripts/boards/components/board_assignee_dropdown.vue @@ -119,7 +119,7 @@ export default { this.selected = this.selected.concat(name); }, unselect(name) { - this.selected = this.selected.filter(user => user.username !== name); + this.selected = this.selected.filter((user) => user.username !== name); }, saveAssignees() { this.setAssignees(this.selectedUserNames); diff --git a/app/assets/javascripts/boards/components/board_card_layout.vue b/app/assets/javascripts/boards/components/board_card_layout.vue index 551390e9acf..350d709abfd 100644 --- a/app/assets/javascripts/boards/components/board_card_layout.vue +++ b/app/assets/javascripts/boards/components/board_card_layout.vue @@ -43,7 +43,7 @@ export default { }, computed: { multiSelectVisible() { - return this.multiSelect.list.findIndex(issue => issue.id === this.issue.id) > -1; + return this.multiSelect.list.findIndex((issue) => issue.id === this.issue.id) > -1; }, }, methods: { diff --git a/app/assets/javascripts/boards/components/board_list.vue b/app/assets/javascripts/boards/components/board_list.vue index 1f87b563e73..cb0061782a0 100644 --- a/app/assets/javascripts/boards/components/board_list.vue +++ b/app/assets/javascripts/boards/components/board_list.vue @@ -143,7 +143,7 @@ export default { // For each list we check if the destination list is // a the list were we should clone the issue const shouldClone = Object.entries(cloneActions).some( - entry => fromBoardType === entry[0] && entry[1].includes(toBoardType), + (entry) => fromBoardType === entry[0] && entry[1].includes(toBoardType), ); if (shouldClone) { @@ -156,7 +156,7 @@ export default { }, revertClone: true, }, - onStart: e => { + onStart: (e) => { const card = this.$refs.issue[e.oldIndex]; card.showDetail = false; @@ -171,15 +171,15 @@ export default { sortableStart(); }, - onAdd: e => { + onAdd: (e) => { const { items = [], newIndicies = [] } = e; if (items.length) { // Not using e.newIndex here instead taking a min of all // the newIndicies. Basically we have to find that during // a drop what is the index we're going to start putting // all the dropped elements from. - const newIndex = Math.min(...newIndicies.map(obj => obj.index).filter(i => i !== -1)); - const issues = items.map(item => + const newIndex = Math.min(...newIndicies.map((obj) => obj.index).filter((i) => i !== -1)); + const issues = items.map((item) => boardsStore.moving.list.findIssue(Number(item.dataset.issueId)), ); @@ -201,23 +201,23 @@ export default { }); } }, - onUpdate: e => { - const sortedArray = this.sortable.toArray().filter(id => id !== '-1'); + onUpdate: (e) => { + const sortedArray = this.sortable.toArray().filter((id) => id !== '-1'); const { items = [], newIndicies = [], oldIndicies = [] } = e; if (items.length) { - const newIndex = Math.min(...newIndicies.map(obj => obj.index)); - const issues = items.map(item => + const newIndex = Math.min(...newIndicies.map((obj) => obj.index)); + const issues = items.map((item) => boardsStore.moving.list.findIssue(Number(item.dataset.issueId)), ); boardsStore.moveMultipleIssuesInList({ list: this.list, issues, - oldIndicies: oldIndicies.map(obj => obj.index), + oldIndicies: oldIndicies.map((obj) => obj.index), newIndex, idArray: sortedArray, }); - e.items.forEach(el => { + e.items.forEach((el) => { Sortable.utils.deselect(el); }); boardsStore.clearMultiSelect(); @@ -232,7 +232,7 @@ export default { sortedArray, ); }, - onEnd: e => { + onEnd: (e) => { const { items = [], clones = [], to } = e; // This is not a multi select operation @@ -253,14 +253,14 @@ export default { */ const isSameList = toList && toList.id === this.list.id; if (toList && !isSameList && boardsStore.shouldRemoveIssue(this.list, toList)) { - const issues = items.map(item => this.list.findIssue(Number(item.dataset.issueId))); + const issues = items.map((item) => this.list.findIssue(Number(item.dataset.issueId))); if ( issues.filter(Boolean).length && !boardsStore.issuesAreContiguous(this.list, issues) ) { const indexes = []; - const ids = this.list.issues.map(i => i.id); - issues.forEach(issue => { + const ids = this.list.issues.map((i) => i.id); + issues.forEach((issue) => { const index = ids.indexOf(issue.id); if (index > -1) { indexes.push(index); @@ -270,7 +270,7 @@ export default { // Descending sort because splice would cause index discrepancy otherwise const sortedIndexes = indexes.sort((a, b) => (a < b ? 1 : -1)); - sortedIndexes.forEach(i => { + sortedIndexes.forEach((i) => { /** * **setTimeout and splice each element one-by-one in a loop * is intended.** @@ -301,14 +301,14 @@ export default { // Since Vue's list does not re-render the same keyed item, we'll // remove `multi-select` class to express it's unselected if (clones && clones.length) { - clones.forEach(el => el.classList.remove('multi-select')); + clones.forEach((el) => el.classList.remove('multi-select')); } // Due to some bug which I am unable to figure out // Sortable does not deselect some pending items from the // source list. // We'll just do it forcefully here. - Array.from(document.querySelectorAll('.js-multi-select') || []).forEach(item => { + Array.from(document.querySelectorAll('.js-multi-select') || []).forEach((item) => { Sortable.utils.deselect(item); }); @@ -322,7 +322,7 @@ export default { */ this.$nextTick(() => { if (items && items.length) { - items.forEach(item => { + items.forEach((item) => { item.remove(); }); } @@ -346,7 +346,7 @@ export default { Sortable.utils.deselect(e.item); } }, - onDeselect: e => { + onDeselect: (e) => { const { item: { dataset, classList }, } = e; diff --git a/app/assets/javascripts/boards/components/board_list_new.vue b/app/assets/javascripts/boards/components/board_list_new.vue index 92a381a8f57..726fa4a9b2b 100644 --- a/app/assets/javascripts/boards/components/board_list_new.vue +++ b/app/assets/javascripts/boards/components/board_list_new.vue @@ -153,7 +153,7 @@ export default { let moveBeforeId; let moveAfterId; - const getIssueId = el => Number(el.dataset.issueId); + const getIssueId = (el) => Number(el.dataset.issueId); // If issue is being moved within the same list if (from === to) { diff --git a/app/assets/javascripts/boards/components/board_new_issue_new.vue b/app/assets/javascripts/boards/components/board_new_issue_new.vue index 969c84ddb59..5766484a3ff 100644 --- a/app/assets/javascripts/boards/components/board_new_issue_new.vue +++ b/app/assets/javascripts/boards/components/board_new_issue_new.vue @@ -65,8 +65,8 @@ export default { return this.addListNewIssue({ issueInput: { title, - labelIds: labels?.map(l => l.id), - assigneeIds: assignees?.map(a => a?.id), + labelIds: labels?.map((l) => l.id), + assigneeIds: assignees?.map((a) => a?.id), milestoneId: milestone?.id, projectPath: this.selectedProject.path, weight: weight >= 0 ? weight : null, diff --git a/app/assets/javascripts/boards/components/board_sidebar.js b/app/assets/javascripts/boards/components/board_sidebar.js index a0dd7f4d898..bf3dc5c608f 100644 --- a/app/assets/javascripts/boards/components/board_sidebar.js +++ b/app/assets/javascripts/boards/components/board_sidebar.js @@ -68,7 +68,7 @@ export default Vue.extend({ : __('Label'); }, selectedLabels() { - return this.hasLabels ? this.issue.labels.map(l => l.title).join(',') : ''; + return this.hasLabels ? this.issue.labels.map((l) => l.title).join(',') : ''; }, }, watch: { diff --git a/app/assets/javascripts/boards/components/boards_selector.vue b/app/assets/javascripts/boards/components/boards_selector.vue index 4f23c38d0f7..fcd1c3fdceb 100644 --- a/app/assets/javascripts/boards/components/boards_selector.vue +++ b/app/assets/javascripts/boards/components/boards_selector.vue @@ -118,7 +118,7 @@ export default { return this.state.currentPage; }, filteredBoards() { - return this.boards.filter(board => + return this.boards.filter((board) => board.name.toLowerCase().includes(this.filterTerm.toLowerCase()), ); }, @@ -181,10 +181,10 @@ export default { this.loadingRecentBoards = true; boardsStore .recentBoards() - .then(res => { + .then((res) => { this.recentBoards = res.data; }) - .catch(err => { + .catch((err) => { /** * If user is unauthorized we'd still want to resolve the * request to display all boards. diff --git a/app/assets/javascripts/boards/components/modal/footer.vue b/app/assets/javascripts/boards/components/modal/footer.vue index d28a03da97f..10c29977cae 100644 --- a/app/assets/javascripts/boards/components/modal/footer.vue +++ b/app/assets/javascripts/boards/components/modal/footer.vue @@ -40,21 +40,21 @@ export default { const firstListIndex = 1; const list = this.modal.selectedList || this.state.lists[firstListIndex]; const selectedIssues = ModalStore.getSelectedIssues(); - const issueIds = selectedIssues.map(issue => issue.id); + const issueIds = selectedIssues.map((issue) => issue.id); const req = this.buildUpdateRequest(list); // Post the data to the backend boardsStore.bulkUpdate(issueIds, req).catch(() => { Flash(__('Failed to update issues, please try again.')); - selectedIssues.forEach(issue => { + selectedIssues.forEach((issue) => { list.removeIssue(issue); list.issuesSize -= 1; }); }); // Add the issues on the frontend - selectedIssues.forEach(issue => { + selectedIssues.forEach((issue) => { list.addIssue(issue); list.issuesSize += 1; }); diff --git a/app/assets/javascripts/boards/components/modal/index.vue b/app/assets/javascripts/boards/components/modal/index.vue index 67885993d86..84d687a46b9 100644 --- a/app/assets/javascripts/boards/components/modal/index.vue +++ b/app/assets/javascripts/boards/components/modal/index.vue @@ -100,13 +100,13 @@ export default { page: this.page, per: this.perPage, }) - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { if (clearIssues) { this.issues = []; } - data.issues.forEach(issueObj => { + data.issues.forEach((issueObj) => { const issue = new ListIssue(issueObj); const foundSelectedIssue = ModalStore.findSelectedIssue(issue); issue.selected = Boolean(foundSelectedIssue); diff --git a/app/assets/javascripts/boards/components/project_select.vue b/app/assets/javascripts/boards/components/project_select.vue index f152d708f2b..446023e1072 100644 --- a/app/assets/javascripts/boards/components/project_select.vue +++ b/app/assets/javascripts/boards/components/project_select.vue @@ -84,7 +84,7 @@ export default { try { const projects = await Api.groupProjects(this.groupId, this.searchTerm, this.fetchOptions); - this.projects = projects.map(project => { + this.projects = projects.map((project) => { return { id: project.id, name: project.name, @@ -99,7 +99,7 @@ export default { } }, selectProject(projectId) { - this.selectedProject = this.projects.find(project => project.id === projectId); + this.selectedProject = this.projects.find((project) => project.id === projectId); /* TODO Remove eventhub, use Vuex for BoardNewIssue and GraphQL for BoardNewIssueNew diff --git a/app/assets/javascripts/boards/components/sidebar/board_sidebar_labels_select.vue b/app/assets/javascripts/boards/components/sidebar/board_sidebar_labels_select.vue index 6a407bd6ba6..d540ee5f3c7 100644 --- a/app/assets/javascripts/boards/components/sidebar/board_sidebar_labels_select.vue +++ b/app/assets/javascripts/boards/components/sidebar/board_sidebar_labels_select.vue @@ -25,7 +25,7 @@ export default { selectedLabels() { const { labels = [] } = this.activeIssue; - return labels.map(label => ({ + return labels.map((label) => ({ ...label, id: getIdFromGraphQLId(label.id), })); @@ -33,7 +33,7 @@ export default { issueLabels() { const { labels = [] } = this.activeIssue; - return labels.map(label => ({ + return labels.map((label) => ({ ...label, scoped: isScopedLabel(label), })); @@ -46,10 +46,10 @@ export default { this.$refs.sidebarItem.collapse(); try { - const addLabelIds = payload.filter(label => label.set).map(label => label.id); + const addLabelIds = payload.filter((label) => label.set).map((label) => label.id); const removeLabelIds = this.selectedLabels - .filter(label => !payload.find(selected => selected.id === label.id)) - .map(label => label.id); + .filter((label) => !payload.find((selected) => selected.id === label.id)) + .map((label) => label.id); const input = { addLabelIds, removeLabelIds, projectPath: this.projectPathForActiveIssue }; await this.setActiveIssueLabels(input); diff --git a/app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue b/app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue index 78c3f8acc62..242414cf32b 100644 --- a/app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue +++ b/app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue @@ -50,7 +50,7 @@ export default { }, update(data) { const edges = data?.group?.milestones?.edges ?? []; - return edges.map(item => item.node); + return edges.map((item) => item.node); }, error() { createFlash({ message: this.$options.i18n.fetchMilestonesError }); diff --git a/app/assets/javascripts/boards/filtered_search_boards.js b/app/assets/javascripts/boards/filtered_search_boards.js index 1667dcc9f2e..94b35aadaf1 100644 --- a/app/assets/javascripts/boards/filtered_search_boards.js +++ b/app/assets/javascripts/boards/filtered_search_boards.js @@ -23,8 +23,8 @@ export default class FilteredSearchBoards extends FilteredSearchManager { // Issue boards is slightly different, we handle all the requests async // instead or reloading the page, we just re-fire the list ajax requests this.isHandledAsync = true; - this.cantEdit = cantEdit.filter(i => typeof i === 'string'); - this.cantEditWithValue = cantEdit.filter(i => typeof i === 'object'); + this.cantEdit = cantEdit.filter((i) => typeof i === 'string'); + this.cantEditWithValue = cantEdit.filter((i) => typeof i === 'object'); if (vuexstore.getters.shouldUseGraphQL && vuexstore.state.boardConfig) { const boardConfigPath = transformBoardConfig(vuexstore.state.boardConfig); @@ -55,7 +55,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager { const tokens = FilteredSearchContainer.container.querySelectorAll('.js-visual-token'); // Remove all the tokens as they will be replaced by the search manager - [].forEach.call(tokens, el => { + [].forEach.call(tokens, (el) => { el.parentNode.removeChild(el); }); @@ -75,7 +75,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager { if (this.cantEdit.includes(tokenName)) return false; return ( this.cantEditWithValue.findIndex( - token => token.name === tokenName && token.value === tokenValue, + (token) => token.name === tokenName && token.value === tokenValue, ) === -1 ); } diff --git a/app/assets/javascripts/boards/filters/due_date_filters.js b/app/assets/javascripts/boards/filters/due_date_filters.js index 9eaa0cd227d..c35dedde71b 100644 --- a/app/assets/javascripts/boards/filters/due_date_filters.js +++ b/app/assets/javascripts/boards/filters/due_date_filters.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import dateFormat from 'dateformat'; -Vue.filter('due-date', value => { +Vue.filter('due-date', (value) => { const date = new Date(value); return dateFormat(date, 'mmm d, yyyy', true); }); diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index fac26c54519..18d2c75b7e1 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -55,7 +55,7 @@ export default () => { const $boardApp = document.getElementById('board-app'); // check for browser back and trigger a hard reload to circumvent browser caching. - window.addEventListener('pageshow', event => { + window.addEventListener('pageshow', (event) => { const isNavTypeBackForward = window.performance && window.performance.navigation.type === NavigationType.TYPE_BACK_FORWARD; @@ -174,9 +174,9 @@ export default () => { initialBoardLoad() { boardsStore .all() - .then(res => res.data) - .then(lists => { - lists.forEach(list => boardsStore.addList(list)); + .then((res) => res.data) + .then((lists) => { + lists.forEach((list) => boardsStore.addList(list)); this.loading = false; }) .catch(() => { @@ -194,8 +194,8 @@ export default () => { setEpicFetchingState(newIssue, true); boardsStore .getIssueInfo(sidebarInfoEndpoint) - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { const { subscribed, totalTimeSpent, @@ -305,7 +305,7 @@ export default () => { if (!this.store) { return true; } - return !this.store.lists.filter(list => !list.preset).length; + return !this.store.lists.filter((list) => !list.preset).length; }, }, methods: { diff --git a/app/assets/javascripts/boards/mixins/sortable_default_options.js b/app/assets/javascripts/boards/mixins/sortable_default_options.js index f02c92e4230..a95d749d71c 100644 --- a/app/assets/javascripts/boards/mixins/sortable_default_options.js +++ b/app/assets/javascripts/boards/mixins/sortable_default_options.js @@ -24,7 +24,7 @@ export function getBoardSortableDefaultOptions(obj) { onEnd: sortableEnd, }; - Object.keys(obj).forEach(key => { + Object.keys(obj).forEach((key) => { defaultSortOptions[key] = obj[key]; }); return defaultSortOptions; diff --git a/app/assets/javascripts/boards/models/issue.js b/app/assets/javascripts/boards/models/issue.js index 822e6d62ab3..1e77326ba9c 100644 --- a/app/assets/javascripts/boards/models/issue.js +++ b/app/assets/javascripts/boards/models/issue.js @@ -70,7 +70,7 @@ class ListIssue { } getLists() { - return boardsStore.state.lists.filter(list => list.findIssue(this.id)); + return boardsStore.state.lists.filter((list) => list.findIssue(this.id)); } updateData(newData) { diff --git a/app/assets/javascripts/boards/models/list.js b/app/assets/javascripts/boards/models/list.js index 09f5d5b4dd8..7d6fde8fb37 100644 --- a/app/assets/javascripts/boards/models/list.js +++ b/app/assets/javascripts/boards/models/list.js @@ -134,7 +134,7 @@ class List { updateMultipleIssues(issues, listFrom, moveBeforeId, moveAfterId) { boardsStore .moveMultipleIssues({ - ids: issues.map(issue => issue.id), + ids: issues.map((issue) => issue.id), fromListId: listFrom.id, toListId: this.id, moveBeforeId, diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js index 1774f4d640f..5783e87ba0a 100644 --- a/app/assets/javascripts/boards/stores/actions.js +++ b/app/assets/javascripts/boards/stores/actions.js @@ -97,7 +97,7 @@ export default { const { lists, hideBacklogList } = data[boardType]?.board; commit(types.RECEIVE_BOARD_LISTS_SUCCESS, formatBoardLists(lists)); // Backlog list needs to be created if it doesn't exist and it's not hidden - if (!lists.nodes.find(l => l.listType === ListType.backlog) && !hideBacklogList) { + if (!lists.nodes.find((l) => l.listType === ListType.backlog) && !hideBacklogList) { dispatch('createList', { backlog: true }); } }) @@ -390,7 +390,7 @@ export default { commit(types.ADD_ISSUE_TO_LIST, { list, issue, position: 0 }); dispatch('createNewIssue', issueInput) - .then(res => { + .then((res) => { commit(types.ADD_ISSUE_TO_LIST, { list, issue: formatIssue({ ...res, id: getIdFromGraphQLId(res.id) }), diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index 36702b6ca5f..3bc077be552 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -124,7 +124,7 @@ const boardsStore = { }, findIssueLabel(issue, findLabel) { - return issue.labels.find(label => label.id === findLabel.id); + return issue.labels.find((label) => label.id === findLabel.id); }, goToNextPage(list) { @@ -182,7 +182,7 @@ const boardsStore = { } }, findListIssue(list, id) { - return list.issues.find(issue => issue.id === id); + return list.issues.find((issue) => issue.id === id); }, removeList(id, type = 'blank') { @@ -190,7 +190,7 @@ const boardsStore = { if (!list) return; - this.state.lists = this.state.lists.filter(list => list.id !== id); + this.state.lists = this.state.lists.filter((list) => list.id !== id); }, moveList(listFrom, orderLists) { orderLists.forEach((id, i) => { @@ -205,7 +205,7 @@ const boardsStore = { let moveBeforeId = null; let moveAfterId = null; - const listHasIssues = issues.every(issue => list.findIssue(issue.id)); + const listHasIssues = issues.every((issue) => list.findIssue(issue.id)); if (!listHasIssues) { if (newIndex !== undefined) { @@ -223,21 +223,21 @@ const boardsStore = { } if (list.label) { - issues.forEach(issue => issue.addLabel(list.label)); + issues.forEach((issue) => issue.addLabel(list.label)); } if (list.assignee) { if (listFrom && listFrom.type === 'assignee') { - issues.forEach(issue => issue.removeAssignee(listFrom.assignee)); + issues.forEach((issue) => issue.removeAssignee(listFrom.assignee)); } - issues.forEach(issue => issue.addAssignee(list.assignee)); + issues.forEach((issue) => issue.addAssignee(list.assignee)); } if (IS_EE && list.milestone) { if (listFrom && listFrom.type === 'milestone') { - issues.forEach(issue => issue.removeMilestone(listFrom.milestone)); + issues.forEach((issue) => issue.removeMilestone(listFrom.milestone)); } - issues.forEach(issue => issue.addMilestone(list.milestone)); + issues.forEach((issue) => issue.addMilestone(list.milestone)); } if (listFrom) { @@ -249,7 +249,7 @@ const boardsStore = { }, removeListIssues(list, removeIssue) { - list.issues = list.issues.filter(issue => { + list.issues = list.issues.filter((issue) => { const matchesRemove = removeIssue.id === issue.id; if (matchesRemove) { @@ -261,9 +261,9 @@ const boardsStore = { }); }, removeListMultipleIssues(list, removeIssues) { - const ids = removeIssues.map(issue => issue.id); + const ids = removeIssues.map((issue) => issue.id); - list.issues = list.issues.filter(issue => { + list.issues = list.issues.filter((issue) => { const matchesRemove = ids.includes(issue.id); if (matchesRemove) { @@ -289,9 +289,9 @@ const boardsStore = { }, moveMultipleIssuesToList({ listFrom, listTo, issues, newIndex }) { - const issueTo = issues.map(issue => listTo.findIssue(issue.id)); - const issueLists = issues.map(issue => issue.getLists()).flat(); - const listLabels = issueLists.map(list => list.label); + const issueTo = issues.map((issue) => listTo.findIssue(issue.id)); + const issueLists = issues.map((issue) => issue.getLists()).flat(); + const listLabels = issueLists.map((list) => list.label); const hasMoveableIssues = issueTo.filter(Boolean).length > 0; if (!hasMoveableIssues) { @@ -299,30 +299,30 @@ const boardsStore = { if ( listTo.type === ListType.assignee && listFrom.type === ListType.assignee && - issues.some(issue => issue.findAssignee(listTo.assignee)) + issues.some((issue) => issue.findAssignee(listTo.assignee)) ) { - const targetIssues = issues.map(issue => listTo.findIssue(issue.id)); - targetIssues.forEach(targetIssue => targetIssue.removeAssignee(listFrom.assignee)); + const targetIssues = issues.map((issue) => listTo.findIssue(issue.id)); + targetIssues.forEach((targetIssue) => targetIssue.removeAssignee(listFrom.assignee)); } else if (listTo.type === 'milestone') { - const currentMilestones = issues.map(issue => issue.milestone); + const currentMilestones = issues.map((issue) => issue.milestone); const currentLists = this.state.lists - .filter(list => list.type === 'milestone' && list.id !== listTo.id) - .filter(list => - list.issues.some(listIssue => issues.some(issue => listIssue.id === issue.id)), + .filter((list) => list.type === 'milestone' && list.id !== listTo.id) + .filter((list) => + list.issues.some((listIssue) => issues.some((issue) => listIssue.id === issue.id)), ); - issues.forEach(issue => { - currentMilestones.forEach(milestone => { + issues.forEach((issue) => { + currentMilestones.forEach((milestone) => { issue.removeMilestone(milestone); }); }); - issues.forEach(issue => { + issues.forEach((issue) => { issue.addMilestone(listTo.milestone); }); - currentLists.forEach(currentList => { - issues.forEach(issue => { + currentLists.forEach((currentList) => { + issues.forEach((issue) => { currentList.removeIssue(issue); }); }); @@ -334,36 +334,36 @@ const boardsStore = { } } else { listTo.updateMultipleIssues(issues, listFrom); - issues.forEach(issue => { + issues.forEach((issue) => { issue.removeLabel(listFrom.label); }); } if (listTo.type === ListType.closed && listFrom.type !== ListType.backlog) { - issueLists.forEach(list => { - issues.forEach(issue => { + issueLists.forEach((list) => { + issues.forEach((issue) => { list.removeIssue(issue); }); }); - issues.forEach(issue => { + issues.forEach((issue) => { issue.removeLabels(listLabels); }); } else if (listTo.type === ListType.backlog && listFrom.type === ListType.assignee) { - issues.forEach(issue => { + issues.forEach((issue) => { issue.removeAssignee(listFrom.assignee); }); - issueLists.forEach(list => { - issues.forEach(issue => { + issueLists.forEach((list) => { + issues.forEach((issue) => { list.removeIssue(issue); }); }); } else if (listTo.type === ListType.backlog && listFrom.type === ListType.milestone) { - issues.forEach(issue => { + issues.forEach((issue) => { issue.removeMilestone(listFrom.milestone); }); - issueLists.forEach(list => { - issues.forEach(issue => { + issueLists.forEach((list) => { + issues.forEach((issue) => { list.removeIssue(issue); }); }); @@ -380,8 +380,8 @@ const boardsStore = { if (issues.length === 1) return true; // Create list of ids for issues involved. - const listIssueIds = list.issues.map(issue => issue.id); - const movedIssueIds = issues.map(issue => issue.id); + const listIssueIds = list.issues.map((issue) => issue.id); + const movedIssueIds = issues.map((issue) => issue.id); // Check if moved issue IDs is sub-array // of source list issue IDs (i.e. contiguous selection). @@ -391,7 +391,7 @@ const boardsStore = { moveIssueToList(listFrom, listTo, issue, newIndex) { const issueTo = listTo.findIssue(issue.id); const issueLists = issue.getLists(); - const listLabels = issueLists.map(listIssue => listIssue.label); + const listLabels = issueLists.map((listIssue) => listIssue.label); if (!issueTo) { // Check if target list assignee is already present in this issue @@ -405,12 +405,12 @@ const boardsStore = { } else if (listTo.type === 'milestone') { const currentMilestone = issue.milestone; const currentLists = this.state.lists - .filter(list => list.type === 'milestone' && list.id !== listTo.id) - .filter(list => list.issues.some(listIssue => issue.id === listIssue.id)); + .filter((list) => list.type === 'milestone' && list.id !== listTo.id) + .filter((list) => list.issues.some((listIssue) => issue.id === listIssue.id)); issue.removeMilestone(currentMilestone); issue.addMilestone(listTo.milestone); - currentLists.forEach(currentList => currentList.removeIssue(issue)); + currentLists.forEach((currentList) => currentList.removeIssue(issue)); listTo.addIssue(issue, listFrom, newIndex); } else { // Add to new lists issues if it doesn't already exist @@ -422,7 +422,7 @@ const boardsStore = { } if (listTo.type === 'closed' && listFrom.type !== 'backlog') { - issueLists.forEach(list => { + issueLists.forEach((list) => { list.removeIssue(issue); }); issue.removeLabels(listLabels); @@ -462,7 +462,7 @@ const boardsStore = { }); }, findList(key, val, type = 'label') { - const filteredList = this.state.lists.filter(list => { + const filteredList = this.state.lists.filter((list) => { const byType = type ? list.type === type || list.type === 'assignee' || list.type === 'milestone' : true; @@ -472,7 +472,7 @@ const boardsStore = { return filteredList[0]; }, findListByLabelId(id) { - return this.state.lists.find(list => list.type === 'label' && list.label.id === id); + return this.state.lists.find((list) => list.type === 'label' && list.label.id === id); }, toggleFilter(filter) { @@ -589,8 +589,8 @@ const boardsStore = { } return this.createList(entity.id, entityType) - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { list.id = data.id; list.type = data.list_type; list.position = data.position; @@ -607,7 +607,7 @@ const boardsStore = { }; if (list.label && data.label_name) { - data.label_name = data.label_name.filter(label => label !== list.label.title); + data.label_name = data.label_name.filter((label) => label !== list.label.title); } if (emptyIssues) { @@ -615,8 +615,8 @@ const boardsStore = { } return this.getIssuesForList(list.id, data) - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { list.loading = false; list.issuesSize = data.size; @@ -624,7 +624,7 @@ const boardsStore = { list.issues = []; } - data.issues.forEach(issueObj => { + data.issues.forEach((issueObj) => { list.addIssue(new ListIssue(issueObj)); }); @@ -634,7 +634,7 @@ const boardsStore = { getIssuesForList(id, filter = {}) { const data = { id }; - Object.keys(filter).forEach(key => { + Object.keys(filter).forEach((key) => { data[key] = filter[key]; }); @@ -670,13 +670,13 @@ const boardsStore = { }, moveListMultipleIssues({ list, issues, oldIndicies, newIndex, moveBeforeId, moveAfterId }) { - oldIndicies.reverse().forEach(index => { + oldIndicies.reverse().forEach((index) => { list.issues.splice(index, 1); }); list.issues.splice(newIndex, 0, ...issues); return this.moveMultipleIssues({ - ids: issues.map(issue => issue.id), + ids: issues.map((issue) => issue.id), fromListId: null, toListId: null, moveBeforeId, @@ -703,8 +703,8 @@ const boardsStore = { } return this.newIssue(list.id, issue) - .then(res => res.data) - .then(data => list.onNewIssueResponse(issue, data)); + .then((res) => res.data) + .then((data) => list.onNewIssueResponse(issue, data)); }, getBacklog(data) { @@ -717,7 +717,7 @@ const boardsStore = { }, removeIssueLabel(issue, removeLabel) { if (removeLabel) { - issue.labels = issue.labels.filter(label => removeLabel.id !== label.id); + issue.labels = issue.labels.filter((label) => removeLabel.id !== label.id); } }, @@ -762,7 +762,7 @@ const boardsStore = { }, toggleMultiSelect(issue) { - const selectedIssueIds = this.multiSelect.list.map(issue => issue.id); + const selectedIssueIds = this.multiSelect.list.map((issue) => issue.id); const index = selectedIssueIds.indexOf(issue.id); if (index === -1) { @@ -777,12 +777,12 @@ const boardsStore = { }, removeIssueAssignee(issue, removeAssignee) { if (removeAssignee) { - issue.assignees = issue.assignees.filter(assignee => assignee.id !== removeAssignee.id); + issue.assignees = issue.assignees.filter((assignee) => assignee.id !== removeAssignee.id); } }, findIssueAssignee(issue, findAssignee) { - return issue.assignees.find(assignee => assignee.id === findAssignee.id); + return issue.assignees.find((assignee) => assignee.id === findAssignee.id); }, clearMultiSelect() { @@ -837,11 +837,11 @@ const boardsStore = { } if (obj.labels) { - issue.labels = obj.labels.map(label => new ListLabel(label)); + issue.labels = obj.labels.map((label) => new ListLabel(label)); } if (obj.assignees) { - issue.assignees = obj.assignees.map(a => new ListAssignee(a)); + issue.assignees = obj.assignees.map((a) => new ListAssignee(a)); } }, addIssueLabel(issue, label) { diff --git a/app/assets/javascripts/boards/stores/getters.js b/app/assets/javascripts/boards/stores/getters.js index ca6887b6f45..d72b5c6fb8e 100644 --- a/app/assets/javascripts/boards/stores/getters.js +++ b/app/assets/javascripts/boards/stores/getters.js @@ -2,18 +2,18 @@ import { find } from 'lodash'; import { inactiveId } from '../constants'; export default { - isSidebarOpen: state => state.activeId !== inactiveId, + isSidebarOpen: (state) => state.activeId !== inactiveId, isSwimlanesOn: () => false, - getIssueById: state => id => { + getIssueById: (state) => (id) => { return state.issues[id] || {}; }, - getIssuesByList: (state, getters) => listId => { + getIssuesByList: (state, getters) => (listId) => { const listIssueIds = state.issuesByListId[listId] || []; - return listIssueIds.map(id => getters.getIssueById(id)); + return listIssueIds.map((id) => getters.getIssueById(id)); }, - activeIssue: state => { + activeIssue: (state) => { return state.issues[state.activeId] || {}; }, @@ -22,12 +22,12 @@ export default { return referencePath.slice(0, referencePath.indexOf('#')); }, - getListByLabelId: state => labelId => { - return find(state.boardLists, l => l.label?.id === labelId); + getListByLabelId: (state) => (labelId) => { + return find(state.boardLists, (l) => l.label?.id === labelId); }, - getListByTitle: state => title => { - return find(state.boardLists, l => l.title === title); + getListByTitle: (state) => (title) => { + return find(state.boardLists, (l) => l.title === title); }, shouldUseGraphQL: () => { diff --git a/app/assets/javascripts/boards/stores/modal_store.js b/app/assets/javascripts/boards/stores/modal_store.js index b7228bf7bf5..8a8fa61361c 100644 --- a/app/assets/javascripts/boards/stores/modal_store.js +++ b/app/assets/javascripts/boards/stores/modal_store.js @@ -40,7 +40,7 @@ class ModalStore { toggleAll() { const select = this.selectedCount() !== this.store.issues.length; - this.store.issues.forEach(issue => { + this.store.issues.forEach((issue) => { const issueUpdate = issue; if (issueUpdate.selected !== select) { @@ -56,7 +56,7 @@ class ModalStore { } getSelectedIssues() { - return this.store.selectedIssues.filter(issue => issue.selected); + return this.store.selectedIssues.filter((issue) => issue.selected); } addSelectedIssue(issue) { @@ -70,13 +70,13 @@ class ModalStore { removeSelectedIssue(issue, forcePurge = false) { if (this.store.activeTab === 'all' || forcePurge) { this.store.selectedIssues = this.store.selectedIssues.filter( - fIssue => fIssue.id !== issue.id, + (fIssue) => fIssue.id !== issue.id, ); } } purgeUnselectedIssues() { - this.store.selectedIssues.forEach(issue => { + this.store.selectedIssues.forEach((issue) => { if (!issue.selected) { this.removeSelectedIssue(issue, true); } @@ -88,7 +88,7 @@ class ModalStore { } findSelectedIssue(issue) { - return this.store.selectedIssues.filter(filteredIssue => filteredIssue.id === issue.id)[0]; + return this.store.selectedIssues.filter((filteredIssue) => filteredIssue.id === issue.id)[0]; } } diff --git a/app/assets/javascripts/boards/stores/mutations.js b/app/assets/javascripts/boards/stores/mutations.js index 66a2190ebd8..62ac2ca1417 100644 --- a/app/assets/javascripts/boards/stores/mutations.js +++ b/app/assets/javascripts/boards/stores/mutations.js @@ -44,7 +44,7 @@ export default { state.boardLists = lists; }, - [mutationTypes.RECEIVE_BOARD_LISTS_FAILURE]: state => { + [mutationTypes.RECEIVE_BOARD_LISTS_FAILURE]: (state) => { state.error = s__( 'Boards|An error occurred while fetching the board lists. Please reload the page.', ); @@ -59,15 +59,15 @@ export default { state.filterParams = filterParams; }, - [mutationTypes.CREATE_LIST_FAILURE]: state => { + [mutationTypes.CREATE_LIST_FAILURE]: (state) => { state.error = s__('Boards|An error occurred while creating the list. Please try again.'); }, - [mutationTypes.RECEIVE_LABELS_FAILURE]: state => { + [mutationTypes.RECEIVE_LABELS_FAILURE]: (state) => { state.error = s__('Boards|An error occurred while fetching labels. Please reload the page.'); }, - [mutationTypes.GENERATE_DEFAULT_LISTS_FAILURE]: state => { + [mutationTypes.GENERATE_DEFAULT_LISTS_FAILURE]: (state) => { state.error = s__('Boards|An error occurred while generating lists. Please reload the page.'); }, @@ -129,8 +129,8 @@ export default { Vue.set(state.listsFlags, listId, { isLoading: false, isLoadingMore: false }); }, - [mutationTypes.RESET_ISSUES]: state => { - Object.keys(state.issuesByListId).forEach(listId => { + [mutationTypes.RESET_ISSUES]: (state) => { + Object.keys(state.issuesByListId).forEach((listId) => { Vue.set(state.issuesByListId, listId, []); }); }, @@ -206,7 +206,7 @@ export default { notImplemented(); }, - [mutationTypes.CREATE_ISSUE_FAILURE]: state => { + [mutationTypes.CREATE_ISSUE_FAILURE]: (state) => { state.error = s__('Boards|An error occurred while creating the issue. Please try again.'); }, diff --git a/app/assets/javascripts/branches/divergence_graph.js b/app/assets/javascripts/branches/divergence_graph.js index 89e9d3fcb62..a577bdca082 100644 --- a/app/assets/javascripts/branches/divergence_graph.js +++ b/app/assets/javascripts/branches/divergence_graph.js @@ -21,7 +21,7 @@ export function createGraphVueApp(el, data, maxCommits) { }); } -export default endpoint => { +export default (endpoint) => { const names = [...document.querySelectorAll('.js-branch-item')].map( ({ dataset }) => dataset.name, ); diff --git a/app/assets/javascripts/breadcrumb.js b/app/assets/javascripts/breadcrumb.js index ff7f734f998..b8b8a0b2867 100644 --- a/app/assets/javascripts/breadcrumb.js +++ b/app/assets/javascripts/breadcrumb.js @@ -1,7 +1,7 @@ import $ from 'jquery'; import { hide } from '~/tooltips'; -export const addTooltipToEl = el => { +export const addTooltipToEl = (el) => { const textEl = el.querySelector('.js-breadcrumb-item-text'); if (textEl && textEl.scrollWidth > textEl.offsetWidth) { @@ -16,14 +16,14 @@ export default () => { if (breadcrumbs) { const topLevelLinks = [...breadcrumbs.children] - .filter(el => !el.classList.contains('dropdown')) - .map(el => el.querySelector('a')) - .filter(el => el); + .filter((el) => !el.classList.contains('dropdown')) + .map((el) => el.querySelector('a')) + .filter((el) => el); const $expander = $('.js-breadcrumbs-collapsed-expander'); - topLevelLinks.forEach(el => addTooltipToEl(el)); + topLevelLinks.forEach((el) => addTooltipToEl(el)); - $expander.closest('.dropdown').on('show.bs.dropdown hide.bs.dropdown', e => { + $expander.closest('.dropdown').on('show.bs.dropdown hide.bs.dropdown', (e) => { const $el = $('.js-breadcrumbs-collapsed-expander', e.currentTarget); $el.toggleClass('open'); diff --git a/app/assets/javascripts/broadcast_notification.js b/app/assets/javascripts/broadcast_notification.js index 97da6fa34da..2cf2e922f68 100644 --- a/app/assets/javascripts/broadcast_notification.js +++ b/app/assets/javascripts/broadcast_notification.js @@ -15,5 +15,5 @@ const handleOnDismiss = ({ currentTarget }) => { export default () => { document .querySelectorAll('.js-dismiss-current-broadcast-notification') - .forEach(dismissButton => dismissButton.addEventListener('click', handleOnDismiss)); + .forEach((dismissButton) => dismissButton.addEventListener('click', handleOnDismiss)); }; diff --git a/app/assets/javascripts/build_artifacts.js b/app/assets/javascripts/build_artifacts.js index 34731e749d2..42e0f8b37bd 100644 --- a/app/assets/javascripts/build_artifacts.js +++ b/app/assets/javascripts/build_artifacts.js @@ -14,10 +14,10 @@ export default class BuildArtifacts { // eslint-disable-next-line class-methods-use-this disablePropagation() { - $('.top-block').on('click', '.download', e => { + $('.top-block').on('click', '.download', (e) => { e.stopPropagation(); }); - return $('.tree-holder').on('click', 'tr[data-link] a', e => { + return $('.tree-holder').on('click', 'tr[data-link] a', (e) => { e.stopImmediatePropagation(); }); } @@ -41,12 +41,12 @@ export default class BuildArtifacts { // We want the tooltip to show if you hover anywhere on the row // But be placed below and in the middle of the file name $('.js-artifact-tree-row') - .on('mouseenter', e => { + .on('mouseenter', (e) => { const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip'); show($el); }) - .on('mouseleave', e => { + .on('mouseleave', (e) => { const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip'); hide($el); diff --git a/app/assets/javascripts/ci_settings_pipeline_triggers/index.js b/app/assets/javascripts/ci_settings_pipeline_triggers/index.js index 182d5ca5ffb..dc79bbb4d97 100644 --- a/app/assets/javascripts/ci_settings_pipeline_triggers/index.js +++ b/app/assets/javascripts/ci_settings_pipeline_triggers/index.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import TriggersList from './components/triggers_list.vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -const parseJsonArray = triggers => { +const parseJsonArray = (triggers) => { try { return convertObjectPropsToCamelCase(JSON.parse(triggers), { deep: true }); } catch { diff --git a/app/assets/javascripts/ci_variable_list/ci_variable_list.js b/app/assets/javascripts/ci_variable_list/ci_variable_list.js index 53ef0f7098a..aa4d311527e 100644 --- a/app/assets/javascripts/ci_variable_list/ci_variable_list.js +++ b/app/assets/javascripts/ci_variable_list/ci_variable_list.js @@ -81,17 +81,17 @@ export default class VariableList { this.initRow(rowEl); }); - this.$container.on('click', '.js-row-remove-button', e => { + this.$container.on('click', '.js-row-remove-button', (e) => { e.preventDefault(); this.removeRow($(e.currentTarget).closest('.js-row')); }); const inputSelector = Object.keys(this.inputMap) - .map(name => this.inputMap[name].selector) + .map((name) => this.inputMap[name].selector) .join(','); // Remove any empty rows except the last row - this.$container.on('blur', inputSelector, e => { + this.$container.on('blur', inputSelector, (e) => { const $row = $(e.currentTarget).closest('.js-row'); if ($row.is(':not(:last-child)') && !this.checkIfRowTouched($row)) { @@ -99,7 +99,7 @@ export default class VariableList { } }); - this.$container.on('input trigger-change', inputSelector, e => { + this.$container.on('input trigger-change', inputSelector, (e) => { // Always make sure there is an empty last row const $lastRow = this.$container.find('.js-row').last(); @@ -149,7 +149,7 @@ export default class VariableList { $rowClone.removeAttr('data-is-persisted'); // Reset the inputs to their defaults - Object.keys(this.inputMap).forEach(name => { + Object.keys(this.inputMap).forEach((name) => { const entry = this.inputMap[name]; $rowClone.find(entry.selector).val(entry.default); }); @@ -184,7 +184,7 @@ export default class VariableList { } checkIfRowTouched($row) { - return Object.keys(this.inputMap).some(name => { + return Object.keys(this.inputMap).some((name) => { // Row should not qualify as touched if only switches have been touched if (['protected', 'masked'].includes(name)) return false; @@ -225,9 +225,9 @@ export default class VariableList { // a blank variable and run into validation problems. const validRows = this.$container.find('.js-row').toArray().slice(0, -1); - return validRows.map(rowEl => { + return validRows.map((rowEl) => { const resultant = {}; - Object.keys(this.inputMap).forEach(name => { + Object.keys(this.inputMap).forEach((name) => { const entry = this.inputMap[name]; const $input = $(rowEl).find(entry.selector); if ($input.length) { diff --git a/app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue b/app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue index 83e9717041f..104d6672015 100644 --- a/app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue +++ b/app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue @@ -33,7 +33,7 @@ export default { }, filteredResults() { const lowerCasedSearchTerm = this.searchTerm.toLowerCase(); - return this.joinedEnvironments.filter(resultString => + return this.joinedEnvironments.filter((resultString) => resultString.toLowerCase().includes(lowerCasedSearchTerm), ); }, diff --git a/app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue b/app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue index 07278bb442c..47b2745af08 100644 --- a/app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue +++ b/app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue @@ -69,7 +69,7 @@ export default { }, fields() { if (this.isGroup) { - return this.$options.fields.filter(field => field.key !== 'environment_scope'); + return this.$options.fields.filter((field) => field.key !== 'environment_scope'); } return this.$options.fields; }, diff --git a/app/assets/javascripts/ci_variable_list/store/actions.js b/app/assets/javascripts/ci_variable_list/store/actions.js index e3e9dac0a79..ac595fa0045 100644 --- a/app/assets/javascripts/ci_variable_list/store/actions.js +++ b/app/assets/javascripts/ci_variable_list/store/actions.js @@ -47,7 +47,7 @@ export const addVariable = ({ state, dispatch }) => { dispatch('receiveAddVariableSuccess'); dispatch('fetchVariables'); }) - .catch(error => { + .catch((error) => { createFlash(error.response.data[0]); dispatch('receiveAddVariableError', error); }); @@ -77,7 +77,7 @@ export const updateVariable = ({ state, dispatch }) => { dispatch('receiveUpdateVariableSuccess'); dispatch('fetchVariables'); }) - .catch(error => { + .catch((error) => { createFlash(error.response.data[0]); dispatch('receiveUpdateVariableError', error); }); @@ -132,7 +132,7 @@ export const deleteVariable = ({ dispatch, state }) => { dispatch('receiveDeleteVariableSuccess'); dispatch('fetchVariables'); }) - .catch(error => { + .catch((error) => { createFlash(error.response.data[0]); dispatch('receiveDeleteVariableError', error); }); @@ -150,7 +150,7 @@ export const fetchEnvironments = ({ dispatch, state }) => { dispatch('requestEnvironments'); return Api.environments(state.projectId) - .then(res => { + .then((res) => { dispatch('receiveEnvironmentsSuccess', prepareEnvironments(res.data)); }) .catch(() => { diff --git a/app/assets/javascripts/ci_variable_list/store/getters.js b/app/assets/javascripts/ci_variable_list/store/getters.js index 619ad54cad6..6570f455541 100644 --- a/app/assets/javascripts/ci_variable_list/store/getters.js +++ b/app/assets/javascripts/ci_variable_list/store/getters.js @@ -1,6 +1,6 @@ import { uniq } from 'lodash'; -export const joinedEnvironments = state => { - const scopesFromVariables = (state.variables || []).map(variable => variable.environment_scope); +export const joinedEnvironments = (state) => { + const scopesFromVariables = (state.variables || []).map((variable) => variable.environment_scope); return uniq(state.environments.concat(scopesFromVariables)).sort(); }; diff --git a/app/assets/javascripts/ci_variable_list/store/utils.js b/app/assets/javascripts/ci_variable_list/store/utils.js index f04530359e7..d9ca460a8e1 100644 --- a/app/assets/javascripts/ci_variable_list/store/utils.js +++ b/app/assets/javascripts/ci_variable_list/store/utils.js @@ -1,12 +1,12 @@ import { cloneDeep } from 'lodash'; import { displayText, types } from '../constants'; -const variableTypeHandler = type => +const variableTypeHandler = (type) => type === displayText.variableText ? types.variableType : types.fileType; -export const prepareDataForDisplay = variables => { +export const prepareDataForDisplay = (variables) => { const variablesToDisplay = []; - variables.forEach(variable => { + variables.forEach((variable) => { const variableCopy = variable; if (variableCopy.variable_type === types.variableType) { variableCopy.variable_type = displayText.variableText; @@ -42,4 +42,4 @@ export const prepareDataForApi = (variable, destroy = false) => { return variableCopy; }; -export const prepareEnvironments = environments => environments.map(e => e.name); +export const prepareEnvironments = (environments) => environments.map((e) => e.name); diff --git a/app/assets/javascripts/clone_panel.js b/app/assets/javascripts/clone_panel.js index 362e6c5c5ce..00bf54e1478 100644 --- a/app/assets/javascripts/clone_panel.js +++ b/app/assets/javascripts/clone_panel.js @@ -14,7 +14,7 @@ export default function initClonePanel() { $(`a:contains('${selectedCloneOption}')`, $cloneOptions).addClass('is-active'); } - $('a', $cloneOptions).on('click', e => { + $('a', $cloneOptions).on('click', (e) => { e.preventDefault(); const $this = $(e.currentTarget); const url = $this.attr('href'); diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index a533a1a78e8..eb2128b2856 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -128,7 +128,7 @@ export default class Clusters { this.initPolling( 'fetchClusterEnvironments', - data => this.handleClusterEnvironmentsSuccess(data), + (data) => this.handleClusterEnvironmentsSuccess(data), () => this.handleEnvironmentsPollError(), ); } @@ -139,7 +139,7 @@ export default class Clusters { if (statusPath && !this.environments) { this.initPolling( 'fetchClusterStatus', - data => this.handleClusterStatusSuccess(data), + (data) => this.handleClusterStatusSuccess(data), () => this.handlePollError(), ); } @@ -248,15 +248,15 @@ export default class Clusters { addListeners() { eventHub.$on('installApplication', this.installApplication); - eventHub.$on('updateApplication', data => this.updateApplication(data)); - eventHub.$on('saveKnativeDomain', data => this.saveKnativeDomain(data)); - eventHub.$on('setKnativeDomain', data => this.setKnativeDomain(data)); - eventHub.$on('uninstallApplication', data => this.uninstallApplication(data)); - eventHub.$on('setCrossplaneProviderStack', data => this.setCrossplaneProviderStack(data)); - eventHub.$on('setIngressModSecurityEnabled', data => this.setIngressModSecurityEnabled(data)); - eventHub.$on('setIngressModSecurityMode', data => this.setIngressModSecurityMode(data)); - eventHub.$on('resetIngressModSecurityChanges', id => this.resetIngressModSecurityChanges(id)); - eventHub.$on('setFluentdSettings', data => this.setFluentdSettings(data)); + eventHub.$on('updateApplication', (data) => this.updateApplication(data)); + eventHub.$on('saveKnativeDomain', (data) => this.saveKnativeDomain(data)); + eventHub.$on('setKnativeDomain', (data) => this.setKnativeDomain(data)); + eventHub.$on('uninstallApplication', (data) => this.uninstallApplication(data)); + eventHub.$on('setCrossplaneProviderStack', (data) => this.setCrossplaneProviderStack(data)); + eventHub.$on('setIngressModSecurityEnabled', (data) => this.setIngressModSecurityEnabled(data)); + eventHub.$on('setIngressModSecurityMode', (data) => this.setIngressModSecurityMode(data)); + eventHub.$on('resetIngressModSecurityChanges', (id) => this.resetIngressModSecurityChanges(id)); + eventHub.$on('setFluentdSettings', (data) => this.setFluentdSettings(data)); // Add event listener to all the banner close buttons this.addBannerCloseHandler(this.unreachableContainer, 'unreachable'); this.addBannerCloseHandler(this.authenticationFailureContainer, 'authentication_failure'); @@ -343,12 +343,12 @@ export default class Clusters { checkForNewInstalls(prevApplicationMap, newApplicationMap) { const appTitles = Object.keys(newApplicationMap) .filter( - appId => + (appId) => newApplicationMap[appId].status === APPLICATION_STATUS.INSTALLED && prevApplicationMap[appId].status !== APPLICATION_STATUS.INSTALLED && prevApplicationMap[appId].status !== null, ) - .map(appId => newApplicationMap[appId].title); + .map((appId) => newApplicationMap[appId].title); if (appTitles.length > 0) { const text = sprintf( @@ -450,7 +450,7 @@ export default class Clusters { ); }); }) - .catch(error => this.store.updateAppProperty(appId, 'validationError', error)); + .catch((error) => this.store.updateAppProperty(appId, 'validationError', error)); } static validateInstallation(appId, params) { diff --git a/app/assets/javascripts/clusters/components/fluentd_output_settings.vue b/app/assets/javascripts/clusters/components/fluentd_output_settings.vue index b37fc3894f8..84a39874000 100644 --- a/app/assets/javascripts/clusters/components/fluentd_output_settings.vue +++ b/app/assets/javascripts/clusters/components/fluentd_output_settings.vue @@ -127,7 +127,7 @@ export default { }); }, updateCurrentServerSideSettings(settings) { - Object.keys(settings).forEach(key => { + Object.keys(settings).forEach((key) => { if (this.currentServerSideSettings[key] === null) { this.currentServerSideSettings[key] = this[key]; } diff --git a/app/assets/javascripts/clusters/forms/stores/index.js b/app/assets/javascripts/clusters/forms/stores/index.js index ae082c07f26..87f1c05fdf9 100644 --- a/app/assets/javascripts/clusters/forms/stores/index.js +++ b/app/assets/javascripts/clusters/forms/stores/index.js @@ -4,7 +4,7 @@ import state from './state'; Vue.use(Vuex); -export const createStore = initialState => +export const createStore = (initialState) => new Vuex.Store({ state: state(initialState), }); diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index 88505eac3a9..5de487308c5 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -17,7 +17,7 @@ import { } from '../constants'; import transitionApplicationState from '../services/application_state_machine'; -const isApplicationInstalled = appStatus => APPLICATION_INSTALLED_STATUSES.includes(appStatus); +const isApplicationInstalled = (appStatus) => APPLICATION_INSTALLED_STATUSES.includes(appStatus); const applicationInitialState = { status: null, @@ -195,7 +195,7 @@ export default class ClusterStore { this.state.status = serverState.status; this.state.statusReason = serverState.status_reason; - serverState.applications.forEach(serverAppEntry => { + serverState.applications.forEach((serverAppEntry) => { const { name: appId, status, @@ -284,7 +284,7 @@ export default class ClusterStore { } updateEnvironments(environments = []) { - this.state.environments = environments.map(environment => ({ + this.state.environments = environments.map((environment) => ({ name: environment.name, project: environment.project, environmentPath: environment.environment_path, diff --git a/app/assets/javascripts/clusters/stores/new_cluster/index.js b/app/assets/javascripts/clusters/stores/new_cluster/index.js index ae082c07f26..87f1c05fdf9 100644 --- a/app/assets/javascripts/clusters/stores/new_cluster/index.js +++ b/app/assets/javascripts/clusters/stores/new_cluster/index.js @@ -4,7 +4,7 @@ import state from './state'; Vue.use(Vuex); -export const createStore = initialState => +export const createStore = (initialState) => new Vuex.Store({ state: state(initialState), }); diff --git a/app/assets/javascripts/clusters_list/components/clusters.vue b/app/assets/javascripts/clusters_list/components/clusters.vue index 71564086a43..53eec5c8a0d 100644 --- a/app/assets/javascripts/clusters_list/components/clusters.vue +++ b/app/assets/javascripts/clusters_list/components/clusters.vue @@ -79,7 +79,7 @@ export default { { key: 'cluster_type', label: __('Cluster level'), - formatter: value => CLUSTER_TYPES[value], + formatter: (value) => CLUSTER_TYPES[value], }, ]; }, diff --git a/app/assets/javascripts/clusters_list/load_clusters.js b/app/assets/javascripts/clusters_list/load_clusters.js index 98bc5880898..01430230879 100644 --- a/app/assets/javascripts/clusters_list/load_clusters.js +++ b/app/assets/javascripts/clusters_list/load_clusters.js @@ -1,7 +1,7 @@ import Clusters from './components/clusters.vue'; import { createStore } from './store'; -export default Vue => { +export default (Vue) => { const el = document.querySelector('#js-clusters-list-app'); if (!el) { diff --git a/app/assets/javascripts/clusters_list/store/actions.js b/app/assets/javascripts/clusters_list/store/actions.js index 1be82988db0..97ed0a7ab37 100644 --- a/app/assets/javascripts/clusters_list/store/actions.js +++ b/app/assets/javascripts/clusters_list/store/actions.js @@ -13,11 +13,11 @@ const allNodesPresent = (clusters, retryCount) => { They may fail for reasons GitLab cannot control. MAX_REQUESTS will ensure this poll stops at some point. */ - return retryCount > MAX_REQUESTS || clusters.every(cluster => cluster.nodes != null); + return retryCount > MAX_REQUESTS || clusters.every((cluster) => cluster.nodes != null); }; export const reportSentryError = (_store, { error, tag }) => { - Sentry.withScope(scope => { + Sentry.withScope((scope) => { scope.setTag('javascript_clusters_list', tag); Sentry.captureException(error); }); @@ -30,7 +30,7 @@ export const fetchClusters = ({ state, commit, dispatch }) => { const poll = new Poll({ resource: { - fetchClusters: paginatedEndPoint => axios.get(paginatedEndPoint), + fetchClusters: (paginatedEndPoint) => axios.get(paginatedEndPoint), }, data: `${state.endpoint}?page=${state.page}`, method: 'fetchClusters', @@ -59,7 +59,7 @@ export const fetchClusters = ({ state, commit, dispatch }) => { dispatch('reportSentryError', { error, tag: 'fetchClustersSuccessCallback' }); } }, - errorCallback: response => { + errorCallback: (response) => { poll.stop(); commit(types.SET_LOADING_CLUSTERS, false); diff --git a/app/assets/javascripts/clusters_list/store/index.js b/app/assets/javascripts/clusters_list/store/index.js index c472d2f354c..47e17b3624b 100644 --- a/app/assets/javascripts/clusters_list/store/index.js +++ b/app/assets/javascripts/clusters_list/store/index.js @@ -6,7 +6,7 @@ import * as actions from './actions'; Vue.use(Vuex); -export const createStore = initialState => +export const createStore = (initialState) => new Vuex.Store({ actions, mutations, diff --git a/app/assets/javascripts/code_navigation/index.js b/app/assets/javascripts/code_navigation/index.js index fa5835245bc..38b3467dc33 100644 --- a/app/assets/javascripts/code_navigation/index.js +++ b/app/assets/javascripts/code_navigation/index.js @@ -3,7 +3,7 @@ import Vuex from 'vuex'; import createStore from './store'; import App from './components/app.vue'; -export default initialData => { +export default (initialData) => { const el = document.getElementById('js-code-navigation'); if (!el) return null; diff --git a/app/assets/javascripts/code_navigation/store/actions.js b/app/assets/javascripts/code_navigation/store/actions.js index 9a472ca014f..fb77a70de0b 100644 --- a/app/assets/javascripts/code_navigation/store/actions.js +++ b/app/assets/javascripts/code_navigation/store/actions.js @@ -34,7 +34,7 @@ export default { }, showBlobInteractionZones({ state }, path) { if (state.data && state.data[path]) { - Object.values(state.data[path]).forEach(d => addInteractionClass(path, d)); + Object.values(state.data[path]).forEach((d) => addInteractionClass(path, d)); } }, showDefinition({ commit, state }, { target: el }) { diff --git a/app/assets/javascripts/code_navigation/utils/index.js b/app/assets/javascripts/code_navigation/utils/index.js index bb33bc556af..6c078891ed4 100644 --- a/app/assets/javascripts/code_navigation/utils/index.js +++ b/app/assets/javascripts/code_navigation/utils/index.js @@ -1,7 +1,7 @@ export const cachedData = new Map(); export const getCurrentHoverElement = () => cachedData.get('current'); -export const setCurrentHoverElement = el => cachedData.set('current', el); +export const setCurrentHoverElement = (el) => cachedData.set('current', el); export const addInteractionClass = (path, d) => { const lineNumber = d.start_line + 1; @@ -10,7 +10,7 @@ export const addInteractionClass = (path, d) => { .querySelectorAll(`.blob-content #LC${lineNumber}, .line_content:not(.old) #LC${lineNumber}`); if (!lines?.length) return; - lines.forEach(line => { + lines.forEach((line) => { let charCount = 0; const el = [...line.childNodes].find(({ textContent }) => { if (charCount === d.start_char) return true; diff --git a/app/assets/javascripts/commit/image_file.js b/app/assets/javascripts/commit/image_file.js index 9ddf11533c2..5f24a3c370a 100644 --- a/app/assets/javascripts/commit/image_file.js +++ b/app/assets/javascripts/commit/image_file.js @@ -28,7 +28,7 @@ export default class ImageFile { initViewModes() { const viewMode = viewModes[0]; $('.view-modes', this.file).removeClass('gl-display-none'); - $('.view-modes-menu', this.file).on('click', 'li', event => { + $('.view-modes-menu', this.file).on('click', 'li', (event) => { if (!$(event.currentTarget).hasClass('active')) { return this.activateViewMode(event.currentTarget.className); } diff --git a/app/assets/javascripts/commit/pipelines/pipelines_bundle.js b/app/assets/javascripts/commit/pipelines/pipelines_bundle.js index c8168afbcb0..24033634aad 100644 --- a/app/assets/javascripts/commit/pipelines/pipelines_bundle.js +++ b/app/assets/javascripts/commit/pipelines/pipelines_bundle.js @@ -21,7 +21,7 @@ export default () => { if (pipelineTableViewEl) { // Update MR and Commits tabs - pipelineTableViewEl.addEventListener('update-pipelines-count', event => { + pipelineTableViewEl.addEventListener('update-pipelines-count', (event) => { if ( event.detail.pipelines && event.detail.pipelines.count && diff --git a/app/assets/javascripts/commit_merge_requests.js b/app/assets/javascripts/commit_merge_requests.js index 3cdb1587a3b..e382356841c 100644 --- a/app/assets/javascripts/commit_merge_requests.js +++ b/app/assets/javascripts/commit_merge_requests.js @@ -50,7 +50,7 @@ export function createContent(mergeRequests) { if (mergeRequests.length === 0) { $content.text(s__('Commits|No related merge requests found')); } else { - mergeRequests.forEach(mergeRequest => { + mergeRequests.forEach((mergeRequest) => { const $header = createHeader($content.children().length, mergeRequests.length); const $item = createItem(mergeRequest); $content.append($header); @@ -66,7 +66,7 @@ export function fetchCommitMergeRequests() { axios .get($container.data('projectCommitPath')) - .then(response => { + .then((response) => { const $content = createContent(response.data); $container.html($content); diff --git a/app/assets/javascripts/commons/nav/user_merge_requests.js b/app/assets/javascripts/commons/nav/user_merge_requests.js index 8e694cca6a1..1e2cf756059 100644 --- a/app/assets/javascripts/commons/nav/user_merge_requests.js +++ b/app/assets/javascripts/commons/nav/user_merge_requests.js @@ -27,7 +27,7 @@ export function refreshUserMergeRequestCounts() { updateUserMergeRequestCounts(count); broadcastCount(count); }) - .catch(ex => { + .catch((ex) => { console.error(ex); // eslint-disable-line no-console }); } @@ -59,7 +59,7 @@ export function openUserCountsBroadcast() { const currentUserId = typeof gon !== 'undefined' && gon && gon.current_user_id; if (currentUserId) { channel = new BroadcastChannel(`mr_count_channel_${currentUserId}`); - channel.onmessage = ev => { + channel.onmessage = (ev) => { updateUserMergeRequestCounts(ev.data); }; } diff --git a/app/assets/javascripts/compare_autocomplete.js b/app/assets/javascripts/compare_autocomplete.js index d0d4d9038ce..82384434e8f 100644 --- a/app/assets/javascripts/compare_autocomplete.js +++ b/app/assets/javascripts/compare_autocomplete.js @@ -63,7 +63,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( }, clicked: () => clickHandler($dropdown), }); - $filterInput.on('keyup', e => { + $filterInput.on('keyup', (e) => { const keyCode = e.keyCode || e.which; if (keyCode !== 13) return; const text = $filterInput.val(); @@ -72,7 +72,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( $dropdownContainer.removeClass('open'); }); - $dropdownContainer.on('click', '.dropdown-content a', e => { + $dropdownContainer.on('click', '.dropdown-content a', (e) => { $dropdown.prop('title', e.target.text.replace(/_+?/g, '-')); if ($dropdown.hasClass('has-tooltip')) { fixTitle($dropdown); diff --git a/app/assets/javascripts/confidential_merge_request/components/project_form_group.vue b/app/assets/javascripts/confidential_merge_request/components/project_form_group.vue index 3a6707bc573..58fe022b794 100644 --- a/app/assets/javascripts/confidential_merge_request/components/project_form_group.vue +++ b/app/assets/javascripts/confidential_merge_request/components/project_form_group.vue @@ -61,7 +61,7 @@ export default { } }, normalizeProjectData(data) { - return data.map(p => ({ + return data.map((p) => ({ id: p.id, name: p.name_with_namespace, pathWithNamespace: p.path_with_namespace, @@ -78,7 +78,7 @@ export default { this.projects = this.normalizeProjectData(data); this.selectProject(this.projects[0]); }) - .catch(e => { + .catch((e) => { createFlash(__('Error fetching forked projects. Please try again.')); throw e; }); diff --git a/app/assets/javascripts/confirm_danger_modal.js b/app/assets/javascripts/confirm_danger_modal.js index 4f7bc829b0c..5b9e70e3c09 100644 --- a/app/assets/javascripts/confirm_danger_modal.js +++ b/app/assets/javascripts/confirm_danger_modal.js @@ -47,7 +47,7 @@ function getModal($btn) { } export default function initConfirmDangerModal() { - $(document).on('click', '.js-confirm-danger', e => { + $(document).on('click', '.js-confirm-danger', (e) => { const $btn = $(e.target); const checkFieldName = $btn.data('checkFieldName'); const checkFieldCompareValue = $btn.data('checkCompareValue'); diff --git a/app/assets/javascripts/confirm_modal.js b/app/assets/javascripts/confirm_modal.js index bf2ea3ce38a..7a42b192b8a 100644 --- a/app/assets/javascripts/confirm_modal.js +++ b/app/assets/javascripts/confirm_modal.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import ConfirmModal from '~/vue_shared/components/confirm_modal.vue'; -const mountConfirmModal = optionalProps => +const mountConfirmModal = (optionalProps) => new Vue({ render(h) { return h(ConfirmModal, { diff --git a/app/assets/javascripts/contributors/components/contributors.vue b/app/assets/javascripts/contributors/components/contributors.vue index 3de1b2f0707..86580aa170b 100644 --- a/app/assets/javascripts/contributors/components/contributors.vue +++ b/app/assets/javascripts/contributors/components/contributors.vue @@ -39,7 +39,7 @@ export default { ...mapGetters(['showChart', 'parsedData']), masterChartData() { const data = {}; - this.xAxisRange.forEach(date => { + this.xAxisRange.forEach((date) => { data[date] = this.parsedData.total[date] || 0; }); return [ @@ -67,7 +67,7 @@ export default { const maxNumberOfIndividualContributorsCharts = 100; return Object.keys(this.parsedData.byAuthorEmail) - .map(email => { + .map((email) => { const author = this.parsedData.byAuthorEmail[email]; return { name: author.name, @@ -76,7 +76,7 @@ export default { dates: [ { name: __('Commits'), - data: this.xAxisRange.map(date => [date, author.dates[date] || 0]), + data: this.xAxisRange.map((date) => [date, author.dates[date] || 0]), }, ], }; @@ -101,7 +101,7 @@ export default { }, individualChartYAxisMax() { return this.individualChartsData.reduce((acc, item) => { - const values = item.dates[0].data.map(value => value[1]); + const values = item.dates[0].data.map((value) => value[1]); return Math.max(acc, ...values); }, 0); }, @@ -150,7 +150,7 @@ export default { }, setSvg(name) { return getSvgIconPathContent(name) - .then(path => { + .then((path) => { if (path) { this.$set(this.svgs, name, `path://${path}`); } @@ -177,7 +177,7 @@ export default { this.individualCharts.push(chart); }, setIndividualChartsZoom(options) { - this.charts.forEach(chart => + this.charts.forEach((chart) => chart.setOption( { dataZoom: { diff --git a/app/assets/javascripts/contributors/stores/actions.js b/app/assets/javascripts/contributors/stores/actions.js index f941c5aa944..72aae3af692 100644 --- a/app/assets/javascripts/contributors/stores/actions.js +++ b/app/assets/javascripts/contributors/stores/actions.js @@ -8,8 +8,8 @@ export const fetchChartData = ({ commit }, endpoint) => { return service .fetchChartData(endpoint) - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { commit(types.SET_CHART_DATA, data); commit(types.SET_LOADING_STATE, false); }) diff --git a/app/assets/javascripts/contributors/stores/getters.js b/app/assets/javascripts/contributors/stores/getters.js index 9022179d6c7..45b569066f8 100644 --- a/app/assets/javascripts/contributors/stores/getters.js +++ b/app/assets/javascripts/contributors/stores/getters.js @@ -1,6 +1,6 @@ -export const showChart = state => Boolean(!state.loading && state.chartData); +export const showChart = (state) => Boolean(!state.loading && state.chartData); -export const parsedData = state => { +export const parsedData = (state) => { const byAuthorEmail = {}; const total = {}; diff --git a/app/assets/javascripts/contributors/utils.js b/app/assets/javascripts/contributors/utils.js index 7d8932ce495..fa3f8154dfe 100644 --- a/app/assets/javascripts/contributors/utils.js +++ b/app/assets/javascripts/contributors/utils.js @@ -9,7 +9,7 @@ import { getMonthNames } from '~/lib/utils/datetime_utility'; * xAxisLabelFormatter('02-12-2019') will return 'Feb' * xAxisLabelFormatter('07-12-2019') will return 'Jul' */ -export const xAxisLabelFormatter = val => { +export const xAxisLabelFormatter = (val) => { const date = new Date(val); const month = date.getUTCMonth(); const year = date.getUTCFullYear(); @@ -21,7 +21,7 @@ export const xAxisLabelFormatter = val => { * @param {Date} * @returns {String} - formatted value */ -export const dateFormatter = date => { +export const dateFormatter = (date) => { const year = date.getUTCFullYear(); const month = date.getUTCMonth(); const day = date.getUTCDate(); diff --git a/app/assets/javascripts/create_cluster/components/cluster_form_dropdown.vue b/app/assets/javascripts/create_cluster/components/cluster_form_dropdown.vue index 1e3a19b9da1..7f4c3635119 100644 --- a/app/assets/javascripts/create_cluster/components/cluster_form_dropdown.vue +++ b/app/assets/javascripts/create_cluster/components/cluster_form_dropdown.vue @@ -6,9 +6,9 @@ import DropdownSearchInput from '~/vue_shared/components/dropdown/dropdown_searc import DropdownHiddenInput from '~/vue_shared/components/dropdown/dropdown_hidden_input.vue'; import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue'; -const toArray = value => (isNil(value) ? [] : [].concat(value)); -const itemsProp = (items, prop) => items.map(item => item[prop]); -const defaultSearchFn = (searchQuery, labelProp) => item => +const toArray = (value) => (isNil(value) ? [] : [].concat(value)); +const itemsProp = (items, prop) => items.map((item) => item[prop]); +const defaultSearchFn = (searchQuery, labelProp) => (item) => item[labelProp].toLowerCase().indexOf(searchQuery) > -1; export default { @@ -135,7 +135,7 @@ export default { const valueList = toArray(this.value); const items = this.getItemsOrEmptyList(); - return items.filter(item => valueList.some(value => item[valueProp] === value)); + return items.filter((item) => valueList.some((value) => item[valueProp] === value)); }, selectedItemsLabels() { return itemsProp(this.selectedItems, this.labelProperty).join(', '); diff --git a/app/assets/javascripts/create_cluster/eks_cluster/index.js b/app/assets/javascripts/create_cluster/eks_cluster/index.js index 6d1034b4a72..38b7eefd15b 100644 --- a/app/assets/javascripts/create_cluster/eks_cluster/index.js +++ b/app/assets/javascripts/create_cluster/eks_cluster/index.js @@ -6,7 +6,7 @@ import createStore from './store'; Vue.use(Vuex); -export default el => { +export default (el) => { const { gitlabManagedClusterHelpPath, namespacePerEnvironmentHelpPath, diff --git a/app/assets/javascripts/create_cluster/eks_cluster/services/aws_services_facade.js b/app/assets/javascripts/create_cluster/eks_cluster/services/aws_services_facade.js index 58568b5dedb..c2b59191997 100644 --- a/app/assets/javascripts/create_cluster/eks_cluster/services/aws_services_facade.js +++ b/app/assets/javascripts/create_cluster/eks_cluster/services/aws_services_facade.js @@ -37,7 +37,7 @@ export const fetchVpcs = ({ region }) => { .describeVpcs() .promise() .then(({ Vpcs: vpcs }) => - vpcs.map(vpc => ({ + vpcs.map((vpc) => ({ value: vpc.VpcId, name: lookupVpcName(vpc), })), diff --git a/app/assets/javascripts/create_cluster/eks_cluster/store/actions.js b/app/assets/javascripts/create_cluster/eks_cluster/store/actions.js index b182d4dff13..55576efd3b8 100644 --- a/app/assets/javascripts/create_cluster/eks_cluster/store/actions.js +++ b/app/assets/javascripts/create_cluster/eks_cluster/store/actions.js @@ -5,7 +5,7 @@ import axios from '~/lib/utils/axios_utils'; import { deprecatedCreateFlash as createFlash } from '~/flash'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -const getErrorMessage = data => { +const getErrorMessage = (data) => { const errorKey = Object.keys(data)[0]; return data[errorKey][0]; @@ -42,7 +42,7 @@ export const createRole = ({ dispatch, state: { createRolePath } }, payload) => dispatch('createRoleSuccess', awsData); }) - .catch(error => { + .catch((error) => { let message = error; if (error?.response?.data?.message) { message = error.response.data.message; diff --git a/app/assets/javascripts/create_cluster/eks_cluster/store/state.js b/app/assets/javascripts/create_cluster/eks_cluster/store/state.js index c957eca1f7a..c906ddf9011 100644 --- a/app/assets/javascripts/create_cluster/eks_cluster/store/state.js +++ b/app/assets/javascripts/create_cluster/eks_cluster/store/state.js @@ -1,6 +1,6 @@ import { KUBERNETES_VERSIONS } from '../constants'; -const kubernetesVersion = KUBERNETES_VERSIONS.find(version => version.default).value; +const kubernetesVersion = KUBERNETES_VERSIONS.find((version) => version.default).value; export default () => ({ createRolePath: null, diff --git a/app/assets/javascripts/create_cluster/gke_cluster/components/gke_dropdown_mixin.js b/app/assets/javascripts/create_cluster/gke_cluster/components/gke_dropdown_mixin.js index 3b91ce63744..f9d0d86e381 100644 --- a/app/assets/javascripts/create_cluster/gke_cluster/components/gke_dropdown_mixin.js +++ b/app/assets/javascripts/create_cluster/gke_cluster/components/gke_dropdown_mixin.js @@ -42,13 +42,13 @@ export default { return []; } - return this.items.filter(item => item.name.toLowerCase().indexOf(this.searchQuery) > -1); + return this.items.filter((item) => item.name.toLowerCase().indexOf(this.searchQuery) > -1); }, }, methods: { fetchSuccessHandler() { if (this.defaultValue) { - const itemToSelect = this.items.find(item => item.name === this.defaultValue); + const itemToSelect = this.items.find((item) => item.name === this.defaultValue); if (itemToSelect) { this.setItem(itemToSelect.name); diff --git a/app/assets/javascripts/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue b/app/assets/javascripts/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue index 8a3e6cf93fd..acbc4d1b3bc 100644 --- a/app/assets/javascripts/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue +++ b/app/assets/javascripts/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue @@ -106,7 +106,7 @@ export default { ...mapActions({ setItem: 'setProject' }), fetchSuccessHandler() { if (this.defaultValue) { - const projectToSelect = this.items.find(item => item.projectId === this.defaultValue); + const projectToSelect = this.items.find((item) => item.projectId === this.defaultValue); if (projectToSelect) { this.setItem(projectToSelect); diff --git a/app/assets/javascripts/create_cluster/gke_cluster/index.js b/app/assets/javascripts/create_cluster/gke_cluster/index.js index b9316353072..96043470b63 100644 --- a/app/assets/javascripts/create_cluster/gke_cluster/index.js +++ b/app/assets/javascripts/create_cluster/gke_cluster/index.js @@ -22,7 +22,7 @@ const mountComponent = (entryPoint, component, componentName, extraProps = {}) = components: { [componentName]: component, }, - render: createElement => + render: (createElement) => createElement(componentName, { props: { fieldName: hiddenInput.getAttribute('name'), diff --git a/app/assets/javascripts/create_cluster/gke_cluster/store/actions.js b/app/assets/javascripts/create_cluster/gke_cluster/store/actions.js index f0c41d1d230..62ff8358c87 100644 --- a/app/assets/javascripts/create_cluster/gke_cluster/store/actions.js +++ b/app/assets/javascripts/create_cluster/gke_cluster/store/actions.js @@ -6,14 +6,14 @@ const gapiResourceListRequest = ({ resource, params, commit, mutation, payloadKe const request = resource.list(params); return request.then( - resp => { + (resp) => { const { result } = resp; commit(mutation, result[payloadKey]); resolve(); }, - resp => { + (resp) => { reject(resp); }, ); @@ -54,14 +54,14 @@ export const validateProjectBilling = ({ dispatch, commit, state }) => commit(types.SET_MACHINE_TYPE, ''); return request.then( - resp => { + (resp) => { const { billingEnabled } = resp.result; commit(types.SET_PROJECT_BILLING_STATUS, Boolean(billingEnabled)); dispatch('setIsValidatingProjectBilling', false); resolve(); }, - resp => { + (resp) => { dispatch('setIsValidatingProjectBilling', false); reject(resp); }, diff --git a/app/assets/javascripts/create_cluster/gke_cluster/store/getters.js b/app/assets/javascripts/create_cluster/gke_cluster/store/getters.js index 4d4cd223832..99f8393ffdb 100644 --- a/app/assets/javascripts/create_cluster/gke_cluster/store/getters.js +++ b/app/assets/javascripts/create_cluster/gke_cluster/store/getters.js @@ -1,5 +1,5 @@ -export const hasProject = state => Boolean(state.selectedProject.projectId); -export const hasZone = state => Boolean(state.selectedZone); -export const hasMachineType = state => Boolean(state.selectedMachineType); +export const hasProject = (state) => Boolean(state.selectedProject.projectId); +export const hasZone = (state) => Boolean(state.selectedZone); +export const hasMachineType = (state) => Boolean(state.selectedMachineType); export const hasValidData = (state, getters) => Boolean(state.projectHasBillingEnabled) && getters.hasZone && getters.hasMachineType; diff --git a/app/assets/javascripts/create_cluster/gke_cluster_namespace/index.js b/app/assets/javascripts/create_cluster/gke_cluster_namespace/index.js index 0ec4d8807b0..2b3dfb99328 100644 --- a/app/assets/javascripts/create_cluster/gke_cluster_namespace/index.js +++ b/app/assets/javascripts/create_cluster/gke_cluster_namespace/index.js @@ -12,7 +12,7 @@ const setDisabled = (el, isDisabled) => { } }; -const setState = glManagedCheckbox => { +const setState = (glManagedCheckbox) => { const glManaged = document.querySelector('.js-namespace-prefixed'); const selfManaged = document.querySelector('.js-namespace'); diff --git a/app/assets/javascripts/create_cluster/init_create_cluster.js b/app/assets/javascripts/create_cluster/init_create_cluster.js index 2b09771d772..11e0d93f4fb 100644 --- a/app/assets/javascripts/create_cluster/init_create_cluster.js +++ b/app/assets/javascripts/create_cluster/init_create_cluster.js @@ -4,11 +4,11 @@ import PersistentUserCallout from '~/persistent_user_callout'; const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:create_user']; -const isProjectLevelCluster = page => page.startsWith('project:clusters'); +const isProjectLevelCluster = (page) => page.startsWith('project:clusters'); -export default document => { +export default (document) => { const { page } = document.body.dataset; - const isNewClusterView = newClusterViews.some(view => page.endsWith(view)); + const isNewClusterView = newClusterViews.some((view) => page.endsWith(view)); if (!isNewClusterView) { return; diff --git a/app/assets/javascripts/create_cluster/store/cluster_dropdown/actions.js b/app/assets/javascripts/create_cluster/store/cluster_dropdown/actions.js index 5d250b2e29e..669b0dcc732 100644 --- a/app/assets/javascripts/create_cluster/store/cluster_dropdown/actions.js +++ b/app/assets/javascripts/create_cluster/store/cluster_dropdown/actions.js @@ -1,6 +1,6 @@ import * as types from './mutation_types'; -export default fetchItems => ({ +export default (fetchItems) => ({ requestItems: ({ commit }) => commit(types.REQUEST_ITEMS), receiveItemsSuccess: ({ commit }, payload) => commit(types.RECEIVE_ITEMS_SUCCESS, payload), receiveItemsError: ({ commit }, payload) => commit(types.RECEIVE_ITEMS_ERROR, payload), @@ -8,7 +8,7 @@ export default fetchItems => ({ dispatch('requestItems'); return fetchItems(payload) - .then(items => dispatch('receiveItemsSuccess', { items })) - .catch(error => dispatch('receiveItemsError', { error })); + .then((items) => dispatch('receiveItemsSuccess', { items })) + .catch((error) => dispatch('receiveItemsError', { error })); }, }); diff --git a/app/assets/javascripts/create_item_dropdown.js b/app/assets/javascripts/create_item_dropdown.js index 75e8523adfa..1472adf458b 100644 --- a/app/assets/javascripts/create_item_dropdown.js +++ b/app/assets/javascripts/create_item_dropdown.js @@ -47,7 +47,7 @@ export default class CreateItemDropdown { return escape(item.id); }, onFilter: this.toggleCreateNewButton.bind(this), - clicked: options => { + clicked: (options) => { options.e.preventDefault(); this.onSelect(); }, @@ -79,7 +79,7 @@ export default class CreateItemDropdown { this.getDataOption(term, (data = []) => { // Ensure the selected item isn't already in the data to avoid duplicates const alreadyHasSelectedItem = - this.selectedItem && data.some(item => item.id === this.selectedItem.id); + this.selectedItem && data.some((item) => item.id === this.selectedItem.id); let uniqueData = data; if (!alreadyHasSelectedItem) { diff --git a/app/assets/javascripts/create_label.js b/app/assets/javascripts/create_label.js index 92060e19dec..07fe2c7e01f 100644 --- a/app/assets/javascripts/create_label.js +++ b/app/assets/javascripts/create_label.js @@ -56,7 +56,7 @@ export default class CreateLabelDropdown { this.$dropdownBack.on('click', this.resetForm.bind(this)); - this.$cancelButton.on('click', e => { + this.$cancelButton.on('click', (e) => { e.preventDefault(); e.stopPropagation(); @@ -105,7 +105,7 @@ export default class CreateLabelDropdown { title: this.$newLabelField.val(), color: this.$newColorField.val(), }, - label => { + (label) => { this.$newLabelCreateButton.enable(); if (label.message) { @@ -115,7 +115,7 @@ export default class CreateLabelDropdown { errors = label.message; } else { errors = Object.keys(label.message) - .map(key => `${humanize(key)} ${label.message[key].join(', ')}`) + .map((key) => `${humanize(key)} ${label.message[key].join(', ')}`) .join('<br/>'); } diff --git a/app/assets/javascripts/create_merge_request_dropdown.js b/app/assets/javascripts/create_merge_request_dropdown.js index 49091f5f140..aaaa7055799 100644 --- a/app/assets/javascripts/create_merge_request_dropdown.js +++ b/app/assets/javascripts/create_merge_request_dropdown.js @@ -191,7 +191,7 @@ export default class CreateMergeRequestDropdown { static findByValue(objects, ref, returnFirstMatch = false) { if (!objects || !objects.length) return false; if (objects.indexOf(ref) > -1) return ref; - if (returnFirstMatch) return objects.find(item => new RegExp(`^${ref}`).test(item)); + if (returnFirstMatch) return objects.find((item) => new RegExp(`^${ref}`).test(item)); return false; } @@ -356,7 +356,7 @@ export default class CreateMergeRequestDropdown { event.preventDefault(); if (isConfidentialIssue() && !event.target.classList.contains('js-create-target')) { - this.droplab.hooks.forEach(hook => hook.list.toggle()); + this.droplab.hooks.forEach((hook) => hook.list.toggle()); return; } @@ -404,8 +404,8 @@ export default class CreateMergeRequestDropdown { const inputClasses = ['gl-field-error-outline', 'gl-field-success-outline']; const messageClasses = ['text-muted', 'text-danger', 'text-success']; - inputClasses.forEach(cssClass => input.classList.remove(cssClass)); - messageClasses.forEach(cssClass => message.classList.remove(cssClass)); + inputClasses.forEach((cssClass) => input.classList.remove(cssClass)); + messageClasses.forEach((cssClass) => message.classList.remove(cssClass)); message.style.display = 'none'; } diff --git a/app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue b/app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue index 6f8455e4bcf..f3fa28dc2f3 100644 --- a/app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue +++ b/app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue @@ -22,7 +22,7 @@ let cancelTokenSource; function backOffRequest(makeRequestCallback) { return backOff((next, stop) => { makeRequestCallback() - .then(resp => { + .then((resp) => { if (resp.status === statusCodes.OK) { stop(resp); } else { @@ -32,7 +32,7 @@ function backOffRequest(makeRequestCallback) { // If the request is cancelled by axios // then consider it as noop so that its not // caught by subsequent catches - .catch(thrown => (axios.isCancel(thrown) ? undefined : stop(thrown))); + .catch((thrown) => (axios.isCancel(thrown) ? undefined : stop(thrown))); }, VALIDATION_REQUEST_TIMEOUT); } @@ -144,7 +144,7 @@ export default { // as well. cancelTokenSource = axiosCancelToken.source(); this.requestValidation(this.query, cancelTokenSource.token) - .then(res => { + .then((res) => { const response = res.data; const { valid, error } = response.query; if (response.success) { diff --git a/app/assets/javascripts/custom_metrics/constants.js b/app/assets/javascripts/custom_metrics/constants.js index 2526445fdf9..cd2ac6d8390 100644 --- a/app/assets/javascripts/custom_metrics/constants.js +++ b/app/assets/javascripts/custom_metrics/constants.js @@ -4,9 +4,9 @@ export const queryTypes = { system: 'system', }; -export const formDataValidator = val => { +export const formDataValidator = (val) => { const fieldNames = Object.keys(val); const requiredFields = ['title', 'query', 'yLabel', 'unit', 'group', 'legend']; - return requiredFields.every(name => fieldNames.includes(name)); + return requiredFields.every((name) => fieldNames.includes(name)); }; diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js index 70ebe91a3b2..bd5a6cc40c4 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js @@ -78,7 +78,7 @@ export default () => { $dropdown .find('li a') .off('click') - .on('click', e => { + .on('click', (e) => { e.preventDefault(); const $target = $(e.currentTarget); this.startDate = $target.data('value'); @@ -94,7 +94,7 @@ export default () => { this.service .fetchCycleAnalyticsData(fetchOptions) - .then(response => { + .then((response) => { this.store.setCycleAnalyticsData(response); this.selectDefaultStage(); this.initDropdown(); @@ -128,7 +128,7 @@ export default () => { startDate: this.startDate, projectIds: this.selectedProjectIds, }) - .then(response => { + .then((response) => { this.isEmptyStage = !response.events.length; this.store.setStageEvents(response.events, stage); this.isLoadingStage = false; diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_service.js b/app/assets/javascripts/cycle_analytics/cycle_analytics_service.js index babbfe93082..d7fcda24352 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_service.js +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_service.js @@ -17,7 +17,7 @@ export default class CycleAnalyticsService { 'cycle_analytics[project_ids]': projectIds, }, }) - .then(x => x.data); + .then((x) => x.data); } fetchStageData(options) { @@ -30,6 +30,6 @@ export default class CycleAnalyticsService { 'cycle_analytics[project_ids]': projectIds, }, }) - .then(x => x.data); + .then((x) => x.data); } } diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js index 3a160d0532c..7b04494892e 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js @@ -42,11 +42,11 @@ export default { newData.stages = data.stats || []; newData.summary = data.summary || []; - newData.summary.forEach(item => { + newData.summary.forEach((item) => { item.value = item.value || '-'; }); - newData.stages.forEach(item => { + newData.stages.forEach((item) => { const stageSlug = dasherize(item.name.toLowerCase()); item.active = false; item.isUserAllowed = data.permissions[stageSlug]; @@ -64,7 +64,7 @@ export default { this.state.hasError = state; }, deactivateAllStages() { - this.state.stages.forEach(stage => { + this.state.stages.forEach((stage) => { stage.active = false; }); }, @@ -78,7 +78,7 @@ export default { decorateEvents(events, stage) { const newEvents = []; - events.forEach(item => { + events.forEach((item) => { if (!item) return; const eventItem = { ...DEFAULT_EVENT_OBJECTS[stage.slug], ...item }; @@ -107,6 +107,6 @@ export default { return newEvents; }, currentActiveStage() { - return this.state.stages.find(stage => stage.active); + return this.state.stages.find((stage) => stage.active); }, }; diff --git a/app/assets/javascripts/deploy_freeze/store/actions.js b/app/assets/javascripts/deploy_freeze/store/actions.js index 2fbbba5a128..9a75c3cad2f 100644 --- a/app/assets/javascripts/deploy_freeze/store/actions.js +++ b/app/assets/javascripts/deploy_freeze/store/actions.js @@ -28,7 +28,7 @@ export const addFreezePeriod = ({ state, dispatch, commit }) => { commit(types.RESET_MODAL); dispatch('fetchFreezePeriods'); }) - .catch(error => { + .catch((error) => { createFlash(__('Error: Unable to create deploy freeze')); dispatch('receiveAddFreezePeriodError', error); }); diff --git a/app/assets/javascripts/deploy_freeze/store/index.js b/app/assets/javascripts/deploy_freeze/store/index.js index ca7ea8c783c..2da7ed31a13 100644 --- a/app/assets/javascripts/deploy_freeze/store/index.js +++ b/app/assets/javascripts/deploy_freeze/store/index.js @@ -6,7 +6,7 @@ import createState from './state'; Vue.use(Vuex); -export default initialState => +export default (initialState) => new Vuex.Store({ actions, mutations, diff --git a/app/assets/javascripts/deploy_freeze/store/mutations.js b/app/assets/javascripts/deploy_freeze/store/mutations.js index 89ce1dc5428..3b34f3950e6 100644 --- a/app/assets/javascripts/deploy_freeze/store/mutations.js +++ b/app/assets/javascripts/deploy_freeze/store/mutations.js @@ -4,7 +4,7 @@ import * as types from './mutation_types'; const formatTimezoneName = (freezePeriod, timezoneList) => convertObjectPropsToCamelCase({ ...freezePeriod, - cron_timezone: timezoneList.find(tz => tz.identifier === freezePeriod.cron_timezone)?.name, + cron_timezone: timezoneList.find((tz) => tz.identifier === freezePeriod.cron_timezone)?.name, }); export default { @@ -14,7 +14,7 @@ export default { [types.RECEIVE_FREEZE_PERIODS_SUCCESS](state, freezePeriods) { state.isLoading = false; - state.freezePeriods = freezePeriods.map(freezePeriod => + state.freezePeriods = freezePeriods.map((freezePeriod) => formatTimezoneName(freezePeriod, state.timezoneData), ); }, diff --git a/app/assets/javascripts/deploy_keys/components/app.vue b/app/assets/javascripts/deploy_keys/components/app.vue index 0ac16e6b6a0..92e80d15902 100644 --- a/app/assets/javascripts/deploy_keys/components/app.vue +++ b/app/assets/javascripts/deploy_keys/components/app.vue @@ -39,7 +39,7 @@ export default { }, computed: { tabs() { - return Object.keys(this.$options.scopes).map(scope => { + return Object.keys(this.$options.scopes).map((scope) => { const count = Array.isArray(this.keys[scope]) ? this.keys[scope].length : null; return { @@ -81,7 +81,7 @@ export default { return this.service .getKeys() - .then(data => { + .then((data) => { this.isLoading = false; this.store.keys = data; }) diff --git a/app/assets/javascripts/deploy_keys/components/key.vue b/app/assets/javascripts/deploy_keys/components/key.vue index 16eee094108..3ddaba7abcc 100644 --- a/app/assets/javascripts/deploy_keys/components/key.vue +++ b/app/assets/javascripts/deploy_keys/components/key.vue @@ -48,7 +48,7 @@ export default { if (this.projectId !== null) { const indexOfCurrentProject = projects.findIndex( - project => + (project) => project && project.project && project.project.id && diff --git a/app/assets/javascripts/deploy_keys/service/index.js b/app/assets/javascripts/deploy_keys/service/index.js index 10333752936..2837fc8ed88 100644 --- a/app/assets/javascripts/deploy_keys/service/index.js +++ b/app/assets/javascripts/deploy_keys/service/index.js @@ -6,14 +6,14 @@ export default class DeployKeysService { } getKeys() { - return axios.get(this.endpoint).then(response => response.data); + return axios.get(this.endpoint).then((response) => response.data); } enableKey(id) { - return axios.put(`${this.endpoint}/${id}/enable`).then(response => response.data); + return axios.put(`${this.endpoint}/${id}/enable`).then((response) => response.data); } disableKey(id) { - return axios.put(`${this.endpoint}/${id}/disable`).then(response => response.data); + return axios.put(`${this.endpoint}/${id}/disable`).then((response) => response.data); } } diff --git a/app/assets/javascripts/deploy_keys/store/index.js b/app/assets/javascripts/deploy_keys/store/index.js index a350bc99a70..dcd77e921cd 100644 --- a/app/assets/javascripts/deploy_keys/store/index.js +++ b/app/assets/javascripts/deploy_keys/store/index.js @@ -4,6 +4,6 @@ export default class DeployKeysStore { } isEnabled(id) { - return this.keys.enabled_keys.some(key => key.id === id); + return this.keys.enabled_keys.some((key) => key.id === id); } } diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js index 3d35ab2432f..99351231520 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js @@ -68,7 +68,7 @@ export class GitLabDropdown { this.remote = new GitLabDropdownRemote(this.options.data, { dataType: this.options.dataType, beforeSend: this.toggleLoading.bind(this), - success: data => { + success: (data) => { this.fullData = data; this.parseData(this.fullData); this.focusTextInput(); @@ -113,7 +113,7 @@ export class GitLabDropdown { return $(selector, this.dropdown); }, data: () => this.fullData, - callback: data => { + callback: (data) => { this.parseData(data); if (this.filterInput.val() !== '') { selector = SELECTABLE_CLASSES; @@ -135,13 +135,13 @@ export class GitLabDropdown { this.dropdown.on('hidden.bs.dropdown', this.hidden); $(this.el).on('update.label', this.updateLabel); this.dropdown.on('click', '.dropdown-menu, .dropdown-menu-close', this.shouldPropagate); - this.dropdown.on('keyup', e => { + this.dropdown.on('keyup', (e) => { // Escape key if (e.which === 27) { return $('.dropdown-menu-close', this.dropdown).trigger('click'); } }); - this.dropdown.on('blur', 'a', e => { + this.dropdown.on('blur', 'a', (e) => { let $dropdownMenu; let $relatedTarget; if (e.relatedTarget != null) { @@ -153,7 +153,7 @@ export class GitLabDropdown { } }); if (this.dropdown.find('.dropdown-toggle-page').length) { - this.dropdown.find('.dropdown-toggle-page, .dropdown-menu-back').on('click', e => { + this.dropdown.find('.dropdown-toggle-page, .dropdown-menu-back').on('click', (e) => { e.preventDefault(); e.stopPropagation(); return this.togglePage(); @@ -164,7 +164,7 @@ export class GitLabDropdown { if (this.dropdown.find('.dropdown-toggle-page').length) { selector = '.dropdown-page-one .dropdown-content a'; } - this.dropdown.on('click', selector, e => { + this.dropdown.on('click', selector, (e) => { const $el = $(e.currentTarget); const selected = self.rowClicked($el); const selectedObj = selected ? selected[0] : null; @@ -221,7 +221,7 @@ export class GitLabDropdown { else if (isObject(data)) { html = []; - Object.keys(data).forEach(name => { + Object.keys(data).forEach((name) => { groupData = data[name]; html.push( this.renderItem( @@ -232,7 +232,7 @@ export class GitLabDropdown { name, ), ); - this.renderData(groupData, name).map(item => html.push(item)); + this.renderData(groupData, name).map((item) => html.push(item)); }); } else { // Render each row @@ -271,7 +271,7 @@ export class GitLabDropdown { filteredFullData() { return this.fullData.filter( - r => + (r) => typeof r === 'object' && !Object.prototype.hasOwnProperty.call(r, 'beforeDivider') && !Object.prototype.hasOwnProperty.call(r, 'header'), @@ -389,7 +389,7 @@ export class GitLabDropdown { ...this.options, icon: this.icon, highlight: this.highlight, - highlightText: text => this.highlightTextMatches(text, this.filterInput.val()), + highlightText: (text) => this.highlightTextMatches(text, this.filterInput.val()), highlightTemplate: this.highlightTemplate.bind(this), parent, }, @@ -536,7 +536,7 @@ export class GitLabDropdown { } if (this.options.multiSelect) { - Object.keys(selectedObject).forEach(attribute => { + Object.keys(selectedObject).forEach((attribute) => { $input.attr(`data-${attribute}`, selectedObject[attribute]); }); } @@ -577,7 +577,7 @@ export class GitLabDropdown { if (this.dropdown.find('.dropdown-toggle-page').length) { selector = `.dropdown-page-one ${selector}`; } - return $('body').on('keydown', e => { + return $('body').on('keydown', (e) => { let $listItems; let PREV_INDEX; const currentKeyCode = e.which; diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js index 7b69a5f6308..ab9fb1ec332 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js @@ -18,7 +18,7 @@ export class GitLabDropdownFilter { this.filterInputBlur = (ref = this.options.filterInputBlur) != null ? ref : true; const $inputContainer = this.input.parent(); const $clearButton = $inputContainer.find('.js-dropdown-input-clear'); - $clearButton.on('click', e => { + $clearButton.on('click', (e) => { // Clear click e.preventDefault(); e.stopPropagation(); @@ -27,7 +27,7 @@ export class GitLabDropdownFilter { // Key events timeout = ''; this.input - .on('keydown', e => { + .on('keydown', (e) => { const keyCode = e.which; if (keyCode === 13 && !options.elIsInput) { e.preventDefault(); @@ -46,7 +46,7 @@ export class GitLabDropdownFilter { return (timeout = setTimeout(() => { $inputContainer.parent().addClass('is-loading'); - return this.options.query(this.input.val(), data => { + return this.options.query(this.input.val(), (data) => { $inputContainer.parent().removeClass('is-loading'); return this.options.callback(data); }); @@ -94,13 +94,13 @@ export class GitLabDropdownFilter { // } else if (isObject(data)) { results = {}; - Object.keys(data).forEach(key => { + Object.keys(data).forEach((key) => { group = data[key]; tmp = fuzzaldrinPlus.filter(group, searchText, { key: this.options.keys, }); if (tmp.length) { - results[key] = tmp.map(item => item); + results[key] = tmp.map((item) => item); } }); } diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js index 29185bb5a4d..61d3e5fbf38 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js @@ -5,7 +5,7 @@ export class GitLabDropdownInput { this.fieldName = this.options.fieldName || 'field-name'; const $inputContainer = this.input.parent(); const $clearButton = $inputContainer.find('.js-dropdown-input-clear'); - $clearButton.on('click', e => { + $clearButton.on('click', (e) => { // Clear click e.preventDefault(); e.stopPropagation(); @@ -13,13 +13,13 @@ export class GitLabDropdownInput { }); this.input - .on('keydown', e => { + .on('keydown', (e) => { const keyCode = e.which; if (keyCode === 13 && !options.elIsInput) { e.preventDefault(); } }) - .on('input', e => { + .on('input', (e) => { let val = e.currentTarget.value || this.options.inputFieldName; val = val .split(' ') diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js index 1f6a2e1f646..ae5d3298b62 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js @@ -15,7 +15,7 @@ export class GitLabDropdownRemote { if (this.options.beforeSend) { this.options.beforeSend(); } - return this.dataEndpoint('', data => { + return this.dataEndpoint('', (data) => { // Fetch the data by calling the data function if (this.options.success) { this.options.success(data); diff --git a/app/assets/javascripts/design_management/components/design_notes/design_discussion.vue b/app/assets/javascripts/design_management/components/design_notes/design_discussion.vue index 6aab4bf423e..ea4d5d7b570 100644 --- a/app/assets/javascripts/design_management/components/design_notes/design_discussion.vue +++ b/app/assets/javascripts/design_management/components/design_notes/design_discussion.vue @@ -171,7 +171,7 @@ export default { this.$emit('resolve-discussion-error', data.errors[0]); } }) - .catch(err => { + .catch((err) => { this.$emit('resolve-discussion-error', err); }) .finally(() => { diff --git a/app/assets/javascripts/design_management/components/design_presentation.vue b/app/assets/javascripts/design_management/components/design_presentation.vue index c4d904e0d91..a760adf8b14 100644 --- a/app/assets/javascripts/design_management/components/design_presentation.vue +++ b/app/assets/javascripts/design_management/components/design_presentation.vue @@ -58,7 +58,7 @@ export default { }, computed: { discussionStartingNotes() { - return this.discussions.map(discussion => ({ + return this.discussions.map((discussion) => ({ ...discussion.notes[0], index: discussion.index, })); diff --git a/app/assets/javascripts/design_management/components/design_sidebar.vue b/app/assets/javascripts/design_management/components/design_sidebar.vue index 41dcec38abe..9f824179616 100644 --- a/app/assets/javascripts/design_management/components/design_sidebar.vue +++ b/app/assets/javascripts/design_management/components/design_sidebar.vue @@ -63,10 +63,10 @@ export default { return extractParticipants(this.issue.participants.nodes); }, resolvedDiscussions() { - return this.discussions.filter(discussion => discussion.resolved); + return this.discussions.filter((discussion) => discussion.resolved); }, unresolvedDiscussions() { - return this.discussions.filter(discussion => !discussion.resolved); + return this.discussions.filter((discussion) => !discussion.resolved); }, resolvedCommentsToggleIcon() { return this.resolvedDiscussionsExpanded ? 'chevron-down' : 'chevron-right'; diff --git a/app/assets/javascripts/design_management/components/design_todo_button.vue b/app/assets/javascripts/design_management/components/design_todo_button.vue index 96c417561ac..51c48bf26ee 100644 --- a/app/assets/javascripts/design_management/components/design_todo_button.vue +++ b/app/assets/javascripts/design_management/components/design_todo_button.vue @@ -95,7 +95,7 @@ export default { .then(() => { this.incrementGlobalTodoCount(); }) - .catch(err => { + .catch((err) => { this.$emit('error', Error(CREATE_DESIGN_TODO_ERROR)); throw err; }) @@ -133,7 +133,7 @@ export default { .then(() => { this.decrementGlobalTodoCount(); }) - .catch(err => { + .catch((err) => { this.$emit('error', Error(DELETE_DESIGN_TODO_ERROR)); throw err; }) diff --git a/app/assets/javascripts/design_management/components/toolbar/design_navigation.vue b/app/assets/javascripts/design_management/components/toolbar/design_navigation.vue index 4edc2e410c7..6091a3183ac 100644 --- a/app/assets/javascripts/design_management/components/toolbar/design_navigation.vue +++ b/app/assets/javascripts/design_management/components/toolbar/design_navigation.vue @@ -26,7 +26,7 @@ export default { return this.designs.length; }, currentIndex() { - return this.designs.findIndex(design => design.filename === this.id); + return this.designs.findIndex((design) => design.filename === this.id); }, paginationText() { return sprintf(s__('DesignManagement|%{current_design} of %{designs_count}'), { diff --git a/app/assets/javascripts/design_management/components/toolbar/index.vue b/app/assets/javascripts/design_management/components/toolbar/index.vue index 4caee863df8..dac8298d80b 100644 --- a/app/assets/javascripts/design_management/components/toolbar/index.vue +++ b/app/assets/javascripts/design_management/components/toolbar/index.vue @@ -75,7 +75,7 @@ export default { iid: this.issueIid, }; }, - update: data => data.project.issue.userPermissions, + update: (data) => data.project.issue.userPermissions, }, }, computed: { diff --git a/app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue b/app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue index 4a1be7b720a..750f16bbe57 100644 --- a/app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue +++ b/app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue @@ -19,7 +19,7 @@ export default { if (!this.queryVersion) return 0; const idx = this.allVersions.findIndex( - version => this.findVersionId(version.id) === this.queryVersion, + (version) => this.findVersionId(version.id) === this.queryVersion, ); // if the currentVersionId isn't a valid version (i.e. not in allVersions) diff --git a/app/assets/javascripts/design_management/graphql.js b/app/assets/javascripts/design_management/graphql.js index d1fe977b969..b7aba315168 100644 --- a/app/assets/javascripts/design_management/graphql.js +++ b/app/assets/javascripts/design_management/graphql.js @@ -19,7 +19,7 @@ const resolvers = { updateActiveDiscussion: (_, { id = null, source }, { cache }) => { const sourceData = cache.readQuery({ query: activeDiscussionQuery }); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { // eslint-disable-next-line no-param-reassign draftData.activeDiscussion = { __typename: 'ActiveDiscussion', @@ -74,7 +74,7 @@ const defaultClient = createDefaultClient( // Should be removed as soon as https://gitlab.com/gitlab-org/gitlab/issues/13495 is resolved { cacheConfig: { - dataIdFromObject: object => { + dataIdFromObject: (object) => { // eslint-disable-next-line no-underscore-dangle, @gitlab/require-i18n-strings if (object.__typename === 'Design') { return object.id && object.image ? `${object.id}-${object.image}` : uniqueId(); diff --git a/app/assets/javascripts/design_management/mixins/all_designs.js b/app/assets/javascripts/design_management/mixins/all_designs.js index 466f61e21fa..4783382d563 100644 --- a/app/assets/javascripts/design_management/mixins/all_designs.js +++ b/app/assets/javascripts/design_management/mixins/all_designs.js @@ -17,7 +17,7 @@ export default { atVersion: this.designsVersion, }; }, - update: data => { + update: (data) => { const designNodes = propertyOf(data)([ 'project', 'issue', diff --git a/app/assets/javascripts/design_management/mixins/all_versions.js b/app/assets/javascripts/design_management/mixins/all_versions.js index 07cd0fc92bd..42cef35a08e 100644 --- a/app/assets/javascripts/design_management/mixins/all_versions.js +++ b/app/assets/javascripts/design_management/mixins/all_versions.js @@ -12,7 +12,7 @@ export default { atVersion: null, }; }, - update: data => data.project.issue.designCollection.versions.nodes, + update: (data) => data.project.issue.designCollection.versions.nodes, }, }, inject: { @@ -28,7 +28,7 @@ export default { return ( this.$route.query.version && this.allVersions && - this.allVersions.some(version => version.id.endsWith(this.$route.query.version)) + this.allVersions.some((version) => version.id.endsWith(this.$route.query.version)) ); }, designsVersion() { diff --git a/app/assets/javascripts/design_management/pages/design/index.vue b/app/assets/javascripts/design_management/pages/design/index.vue index fd1dca914ed..4564e03a3e0 100644 --- a/app/assets/javascripts/design_management/pages/design/index.vue +++ b/app/assets/javascripts/design_management/pages/design/index.vue @@ -81,7 +81,7 @@ export default { variables() { return this.designVariables; }, - update: data => extractDesign(data), + update: (data) => extractDesign(data), result(res) { this.onDesignQueryResult(res); }, @@ -139,7 +139,7 @@ export default { return Boolean(this.annotationCoordinates); }, resolvedDiscussions() { - return this.discussions.filter(discussion => discussion.resolved); + return this.discussions.filter((discussion) => discussion.resolved); }, }, watch: { @@ -203,7 +203,7 @@ export default { update: this.updateImageDiffNoteInStore, }; - return this.$apollo.mutate(mutationPayload).catch(e => this.onUpdateImageDiffNoteError(e)); + return this.$apollo.mutate(mutationPayload).catch((e) => this.onUpdateImageDiffNoteError(e)); }, onDesignQueryResult({ data, loading }) { // On the initial load with cache-and-network policy data is undefined while loading is true diff --git a/app/assets/javascripts/design_management/pages/index.vue b/app/assets/javascripts/design_management/pages/index.vue index b151dbf8a96..fb05788a401 100644 --- a/app/assets/javascripts/design_management/pages/index.vue +++ b/app/assets/javascripts/design_management/pages/index.vue @@ -69,7 +69,7 @@ export default { iid: this.issueIid, }; }, - update: data => data.project.issue.userPermissions, + update: (data) => data.project.issue.userPermissions, }, }, data() { @@ -184,7 +184,7 @@ export default { return this.$apollo .mutate(mutationPayload) - .then(res => this.onUploadDesignDone(res)) + .then((res) => this.onUploadDesignDone(res)) .catch(() => this.onUploadDesignError()); }, afterUploadDesign(store, { data: { designManagementUpload } }) { @@ -208,7 +208,7 @@ export default { this.trackUploadDesign(res); }, trackUploadDesign(res) { - (res?.data?.designManagementUpload?.designs || []).forEach(design => { + (res?.data?.designManagementUpload?.designs || []).forEach((design) => { if (design.event === 'CREATION') { trackDesignCreate(); } else if (design.event === 'MODIFICATION') { @@ -222,7 +222,7 @@ export default { }, changeSelectedDesigns(filename) { if (this.isDesignSelected(filename)) { - this.selectedDesigns = this.selectedDesigns.filter(design => design !== filename); + this.selectedDesigns = this.selectedDesigns.filter((design) => design !== filename); } else { this.selectedDesigns.push(filename); } @@ -231,14 +231,14 @@ export default { if (this.hasSelectedDesigns) { this.selectedDesigns = []; } else { - this.selectedDesigns = this.designs.map(design => design.filename); + this.selectedDesigns = this.designs.map((design) => design.filename); } }, isDesignSelected(filename) { return this.selectedDesigns.includes(filename); }, isDesignToBeSaved(filename) { - return this.filesToBeSaved.some(file => file.name === filename); + return this.filesToBeSaved.some((file) => file.name === filename); }, canSelectDesign(filename) { return this.isLatestVersion && this.canCreateDesign && !this.isDesignToBeSaved(filename); diff --git a/app/assets/javascripts/design_management/utils/cache_update.js b/app/assets/javascripts/design_management/utils/cache_update.js index 5bd0288d037..0c4ee0bf012 100644 --- a/app/assets/javascripts/design_management/utils/cache_update.js +++ b/app/assets/javascripts/design_management/utils/cache_update.js @@ -11,14 +11,14 @@ import { designDeletionError, } from './error_messages'; -const designsOf = data => data.project.issue.designCollection.designs; +const designsOf = (data) => data.project.issue.designCollection.designs; const deleteDesignsFromStore = (store, query, selectedDesigns) => { const sourceData = store.readQuery(query); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { const changedDesigns = designsOf(sourceData).nodes.filter( - design => !selectedDesigns.includes(design.filename), + (design) => !selectedDesigns.includes(design.filename), ); designsOf(draftData).nodes = [...changedDesigns]; }); @@ -40,7 +40,7 @@ const addNewVersionToStore = (store, query, version) => { if (!version) return; const sourceData = store.readQuery(query); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { // eslint-disable-next-line no-param-reassign draftData.project.issue.designCollection.versions.nodes = [ version, @@ -74,14 +74,14 @@ const addImageDiffNoteToStore = (store, createImageDiffNote, query, variables) = }, }; - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { const design = extractDesign(draftData); design.notesCount += 1; design.discussions.nodes = [...design.discussions.nodes, newDiscussion]; if ( !design.issue.participants.nodes.some( - participant => participant.username === createImageDiffNote.note.author.username, + (participant) => participant.username === createImageDiffNote.note.author.username, ) ) { design.issue.participants.nodes = [ @@ -107,7 +107,7 @@ const updateImageDiffNoteInStore = (store, repositionImageDiffNote, query, varia variables, }); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { const design = extractDesign(draftData); const discussion = extractCurrentDiscussion( design.discussions, @@ -130,18 +130,18 @@ const updateImageDiffNoteInStore = (store, repositionImageDiffNote, query, varia const addNewDesignToStore = (store, designManagementUpload, query) => { const sourceData = store.readQuery(query); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { const currentDesigns = extractDesigns(draftData); const difference = differenceBy(designManagementUpload.designs, currentDesigns, 'filename'); const newDesigns = currentDesigns - .map(design => { - return designManagementUpload.designs.find(d => d.filename === design.filename) || design; + .map((design) => { + return designManagementUpload.designs.find((d) => d.filename === design.filename) || design; }) .concat(difference); let newVersionNode; - const findNewVersions = designManagementUpload.designs.find(design => design.versions); + const findNewVersions = designManagementUpload.designs.find((design) => design.versions); if (findNewVersions) { const findNewVersionsNodes = findNewVersions.versions.nodes; @@ -181,7 +181,7 @@ const addNewDesignToStore = (store, designManagementUpload, query) => { const moveDesignInStore = (store, designManagementMove, query) => { const sourceData = store.readQuery(query); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { // eslint-disable-next-line no-param-reassign draftData.project.issue.designCollection.designs = designManagementMove.designCollection.designs; @@ -199,7 +199,7 @@ export const addPendingTodoToStore = (store, pendingTodo, query, queryVariables) variables: queryVariables, }); - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { const design = extractDesign(draftData); const existingTodos = design.currentUserTodos?.nodes || []; const newTodoNodes = [...existingTodos, { ...pendingTodo, __typename: 'Todo' }]; @@ -226,7 +226,7 @@ export const deletePendingTodoFromStore = (store, todoMarkDone, query, queryVari const { todo: { id: todoId }, } = todoMarkDone; - const data = produce(sourceData, draftData => { + const data = produce(sourceData, (draftData) => { const design = extractDesign(draftData); const existingTodos = design.currentUserTodos?.nodes || []; diff --git a/app/assets/javascripts/design_management/utils/design_management_utils.js b/app/assets/javascripts/design_management/utils/design_management_utils.js index a905230811c..05b220801f2 100644 --- a/app/assets/javascripts/design_management/utils/design_management_utils.js +++ b/app/assets/javascripts/design_management/utils/design_management_utils.js @@ -10,7 +10,7 @@ export const isValidDesignFile = ({ type }) => * @param {Array} discussions */ -export const extractDiscussions = discussions => +export const extractDiscussions = (discussions) => discussions.nodes.map((discussion, index) => ({ ...discussion, index: index + 1, @@ -24,27 +24,27 @@ export const extractDiscussions = discussions => */ export const extractCurrentDiscussion = (discussions, id) => - discussions.nodes.find(discussion => discussion.id === id); + discussions.nodes.find((discussion) => discussion.id === id); -export const findVersionId = id => (id.match('::Version/(.+$)') || [])[1]; +export const findVersionId = (id) => (id.match('::Version/(.+$)') || [])[1]; -export const findNoteId = id => (id.match('DiffNote/(.+$)') || [])[1]; +export const findNoteId = (id) => (id.match('DiffNote/(.+$)') || [])[1]; -export const findIssueId = id => (id.match('Issue/(.+$)') || [])[1]; +export const findIssueId = (id) => (id.match('Issue/(.+$)') || [])[1]; -export const findDesignId = id => (id.match('Design/(.+$)') || [])[1]; +export const findDesignId = (id) => (id.match('Design/(.+$)') || [])[1]; -export const extractDesigns = data => data.project.issue.designCollection.designs.nodes; +export const extractDesigns = (data) => data.project.issue.designCollection.designs.nodes; -export const extractDesign = data => (extractDesigns(data) || [])[0]; +export const extractDesign = (data) => (extractDesigns(data) || [])[0]; -export const toDiffNoteGid = noteId => `gid://gitlab/DiffNote/${noteId}`; +export const toDiffNoteGid = (noteId) => `gid://gitlab/DiffNote/${noteId}`; /** * Return the note ID from a URL hash parameter * @param {String} urlHash URL hash, including `#` prefix */ -export const extractDesignNoteId = urlHash => { +export const extractDesignNoteId = (urlHash) => { const [, noteId] = urlHash.match('#note_([0-9]+$)') || []; return noteId || null; }; @@ -53,8 +53,8 @@ export const extractDesignNoteId = urlHash => { * Generates optimistic response for a design upload mutation * @param {Array<File>} files */ -export const designUploadOptimisticResponse = files => { - const designs = files.map(file => ({ +export const designUploadOptimisticResponse = (files) => { + const designs = files.map((file) => ({ // False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26 // eslint-disable-next-line @gitlab/require-i18n-strings __typename: 'Design', @@ -128,7 +128,7 @@ export const repositionImageDiffNoteOptimisticResponse = (note, { position }) => * Generates optimistic response for a design upload mutation * @param {Array} designs */ -export const moveDesignOptimisticResponse = designs => ({ +export const moveDesignOptimisticResponse = (designs) => ({ // False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26 // eslint-disable-next-line @gitlab/require-i18n-strings __typename: 'Mutation', @@ -145,13 +145,13 @@ export const moveDesignOptimisticResponse = designs => ({ }, }); -const normalizeAuthor = author => ({ +const normalizeAuthor = (author) => ({ ...author, web_url: author.webUrl, avatar_url: author.avatarUrl, }); -export const extractParticipants = users => users.map(node => normalizeAuthor(node)); +export const extractParticipants = (users) => users.map((node) => normalizeAuthor(node)); export const getPageLayoutElement = () => document.querySelector('.layout-page'); @@ -160,14 +160,14 @@ export const getPageLayoutElement = () => document.querySelector('.layout-page') * Example of todoDeletePath: /delete/1234 * @param {String} todoDeletePath delete_path from REST API response */ -export const extractTodoIdFromDeletePath = todoDeletePath => +export const extractTodoIdFromDeletePath = (todoDeletePath) => (todoDeletePath.match('todos/([0-9]+$)') || [])[1]; -const createTodoGid = todoId => { +const createTodoGid = (todoId) => { return `gid://gitlab/Todo/${todoId}`; }; -export const createPendingTodo = todoId => { +export const createPendingTodo = (todoId) => { return { __typename: 'Todo', // eslint-disable-line @gitlab/require-i18n-strings id: createTodoGid(todoId), diff --git a/app/assets/javascripts/design_management/utils/error_messages.js b/app/assets/javascripts/design_management/utils/error_messages.js index bd21d711462..cb4bb6e26a8 100644 --- a/app/assets/javascripts/design_management/utils/error_messages.js +++ b/app/assets/javascripts/design_management/utils/error_messages.js @@ -54,7 +54,7 @@ export const TOGGLE_TODO_ERROR = __('Failed to toggle To-Do for the design.'); const MAX_SKIPPED_FILES_LISTINGS = 5; -const oneDesignSkippedMessage = filename => +const oneDesignSkippedMessage = (filename) => `${DESIGN_UPLOAD_SKIPPED_MESSAGE} ${sprintf(s__('DesignManagement|%{filename} did not change.'), { filename, })}`; @@ -64,7 +64,7 @@ const oneDesignSkippedMessage = filename => * files were skipped. * @param {Array<{ filename }>} skippedFiles */ -const someDesignsSkippedMessage = skippedFiles => { +const someDesignsSkippedMessage = (skippedFiles) => { const designsSkippedMessage = `${DESIGN_UPLOAD_SKIPPED_MESSAGE} ${s__( 'Some of the designs you tried uploading did not change:', )}`; diff --git a/app/assets/javascripts/diff.js b/app/assets/javascripts/diff.js index 34667d6fa31..c4e86638e9d 100644 --- a/app/assets/javascripts/diff.js +++ b/app/assets/javascripts/diff.js @@ -117,7 +117,7 @@ export default class Diff { table.removeClass('left-side-selected right-side-selected'); - const lineClass = ['left-side', 'right-side'].filter(name => line.hasClass(name))[0]; + const lineClass = ['left-side', 'right-side'].filter((name) => line.hasClass(name))[0]; if (lineClass) { table.addClass(`${lineClass}-selected`); } @@ -132,7 +132,7 @@ export default class Diff { if (children.length !== 2) { return [0, 0]; } - return children.map(elm => parseInt($(elm).data('linenumber'), 10) || 0); + return children.map((elm) => parseInt($(elm).data('linenumber'), 10) || 0); } // eslint-disable-next-line class-methods-use-this highlightSelectedLine() { diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 66540311014..c6e3b477256 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -141,19 +141,19 @@ export default { }, computed: { ...mapState({ - isLoading: state => state.diffs.isLoading, - isBatchLoading: state => state.diffs.isBatchLoading, - diffFiles: state => state.diffs.diffFiles, - diffViewType: state => state.diffs.diffViewType, - mergeRequestDiffs: state => state.diffs.mergeRequestDiffs, - mergeRequestDiff: state => state.diffs.mergeRequestDiff, - commit: state => state.diffs.commit, - renderOverflowWarning: state => state.diffs.renderOverflowWarning, - numTotalFiles: state => state.diffs.realSize, - numVisibleFiles: state => state.diffs.size, - plainDiffPath: state => state.diffs.plainDiffPath, - emailPatchPath: state => state.diffs.emailPatchPath, - retrievingBatches: state => state.diffs.retrievingBatches, + isLoading: (state) => state.diffs.isLoading, + isBatchLoading: (state) => state.diffs.isBatchLoading, + diffFiles: (state) => state.diffs.diffFiles, + diffViewType: (state) => state.diffs.diffViewType, + mergeRequestDiffs: (state) => state.diffs.mergeRequestDiffs, + mergeRequestDiff: (state) => state.diffs.mergeRequestDiff, + commit: (state) => state.diffs.commit, + renderOverflowWarning: (state) => state.diffs.renderOverflowWarning, + numTotalFiles: (state) => state.diffs.realSize, + numVisibleFiles: (state) => state.diffs.size, + plainDiffPath: (state) => state.diffs.plainDiffPath, + emailPatchPath: (state) => state.diffs.emailPatchPath, + retrievingBatches: (state) => state.diffs.retrievingBatches, }), ...mapState('diffs', [ 'showTreeList', diff --git a/app/assets/javascripts/diffs/components/compare_dropdown_layout.vue b/app/assets/javascripts/diffs/components/compare_dropdown_layout.vue index da34a7ee19b..2c249f71091 100644 --- a/app/assets/javascripts/diffs/components/compare_dropdown_layout.vue +++ b/app/assets/javascripts/diffs/components/compare_dropdown_layout.vue @@ -16,7 +16,7 @@ export default { }, computed: { selectedVersionName() { - return this.versions.find(x => x.selected)?.versionName || ''; + return this.versions.find((x) => x.selected)?.versionName || ''; }, }, }; diff --git a/app/assets/javascripts/diffs/components/diff_content.vue b/app/assets/javascripts/diffs/components/diff_content.vue index f938ea368d8..f4e2571dd09 100644 --- a/app/assets/javascripts/diffs/components/diff_content.vue +++ b/app/assets/javascripts/diffs/components/diff_content.vue @@ -50,7 +50,7 @@ export default { }, computed: { ...mapState({ - projectPath: state => state.diffs.projectPath, + projectPath: (state) => state.diffs.projectPath, }), ...mapGetters('diffs', [ 'isInlineView', diff --git a/app/assets/javascripts/diffs/components/diff_expansion_cell.vue b/app/assets/javascripts/diffs/components/diff_expansion_cell.vue index 2401e12e4f6..2d1a7237122 100644 --- a/app/assets/javascripts/diffs/components/diff_expansion_cell.vue +++ b/app/assets/javascripts/diffs/components/diff_expansion_cell.vue @@ -13,7 +13,7 @@ const EXPAND_DOWN = 2; const lineNumberByViewType = (viewType, diffLine) => { const numberGetters = { - [INLINE_DIFF_VIEW_TYPE]: line => line?.new_line, + [INLINE_DIFF_VIEW_TYPE]: (line) => line?.new_line, }; const numberGetter = numberGetters[viewType]; return numberGetter && numberGetter(diffLine); @@ -56,7 +56,7 @@ export default { }, computed: { ...mapState({ - diffFiles: state => state.diffs.diffFiles, + diffFiles: (state) => state.diffs.diffFiles, }), canExpandUp() { return !this.isBottom; diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 11940301819..e613b684345 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -210,7 +210,7 @@ export default { await this.$nextTick(); - eventsForThisFile.forEach(event => { + eventsForThisFile.forEach((event) => { eventHub.$emit(event); }); }, diff --git a/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue b/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue index 439319f487c..f62b31734c5 100644 --- a/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue +++ b/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue @@ -29,7 +29,7 @@ export default { return this.discussions.reduce((acc, note) => acc.concat(note.notes), []); }, notesInGutter() { - return this.allDiscussions.slice(0, COUNT_OF_AVATARS_IN_GUTTER).map(n => ({ + return this.allDiscussions.slice(0, COUNT_OF_AVATARS_IN_GUTTER).map((n) => ({ note: n.note, author: n.author, })); diff --git a/app/assets/javascripts/diffs/components/diff_line_note_form.vue b/app/assets/javascripts/diffs/components/diff_line_note_form.vue index 172a2bdde7d..6e22e181c02 100644 --- a/app/assets/javascripts/diffs/components/diff_line_note_form.vue +++ b/app/assets/javascripts/diffs/components/diff_line_note_form.vue @@ -56,8 +56,8 @@ export default { }, computed: { ...mapState({ - noteableData: state => state.notes.noteableData, - diffViewType: state => state.diffs.diffViewType, + noteableData: (state) => state.notes.noteableData, + diffViewType: (state) => state.diffs.diffViewType, }), ...mapState('diffs', ['showSuggestPopover']), ...mapGetters('diffs', ['getDiffFileByHash', 'diffLines']), diff --git a/app/assets/javascripts/diffs/components/diff_row_utils.js b/app/assets/javascripts/diffs/components/diff_row_utils.js index d5491d3cd56..42414e42558 100644 --- a/app/assets/javascripts/diffs/components/diff_row_utils.js +++ b/app/assets/javascripts/diffs/components/diff_row_utils.js @@ -15,22 +15,22 @@ export const isHighlighted = (state, line, isCommented) => { return lineCode ? lineCode === state.diffs.highlightedRow : false; }; -export const isContextLine = type => type === CONTEXT_LINE_TYPE; +export const isContextLine = (type) => type === CONTEXT_LINE_TYPE; -export const isMatchLine = type => type === MATCH_LINE_TYPE; +export const isMatchLine = (type) => type === MATCH_LINE_TYPE; -export const isMetaLine = type => +export const isMetaLine = (type) => [OLD_NO_NEW_LINE_TYPE, NEW_NO_NEW_LINE_TYPE, EMPTY_CELL_TYPE].includes(type); export const shouldRenderCommentButton = (isLoggedIn, isCommentButtonRendered) => { return isCommentButtonRendered && isLoggedIn; }; -export const hasDiscussions = line => line?.discussions?.length > 0; +export const hasDiscussions = (line) => line?.discussions?.length > 0; -export const lineHref = line => `#${line?.line_code || ''}`; +export const lineHref = (line) => `#${line?.line_code || ''}`; -export const lineCode = line => { +export const lineCode = (line) => { if (!line) return undefined; return line.line_code || line.left?.line_code || line.right?.line_code; }; @@ -48,7 +48,7 @@ export const classNameMapCell = (line, hll, isLoggedIn, isHover) => { ]; }; -export const addCommentTooltip = line => { +export const addCommentTooltip = (line) => { let tooltip; if (!line) return tooltip; @@ -84,7 +84,7 @@ export const shouldShowCommentButton = (hover, context, meta, discussions) => { return hover && !context && !meta && !discussions; }; -export const mapParallel = content => line => { +export const mapParallel = (content) => (line) => { let { left, right } = line; // Dicussions/Comments @@ -137,7 +137,7 @@ export const mapParallel = content => line => { }; // TODO: Delete this function when unifiedDiffComponents FF is removed -export const mapInline = content => line => { +export const mapInline = (content) => (line) => { // Discussions/Comments const renderCommentRow = line.hasForm || (line.discussions?.length && line.discussionsExpanded); diff --git a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue index 13cd0651ff2..b1618fb0688 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue @@ -112,8 +112,8 @@ export default { mounted() { this.scrollToLineIfNeededParallel(this.line); this.unwatchShouldShowCommentButton = this.$watch( - vm => [vm.shouldShowCommentButtonLeft, vm.shouldShowCommentButtonRight].join(), - newVal => { + (vm) => [vm.shouldShowCommentButtonLeft, vm.shouldShowCommentButtonRight].join(), + (newVal) => { if (newVal) { this.isCommentButtonRendered = true; this.unwatchShouldShowCommentButton(); @@ -150,7 +150,7 @@ export default { const table = line.closest('table'); table.removeClass('left-side-selected right-side-selected'); - const [lineClass] = ['left-side', 'right-side'].filter(name => line.hasClass(name)); + const [lineClass] = ['left-side', 'right-side'].filter((name) => line.hasClass(name)); if (lineClass) { table.addClass(`${lineClass}-selected`); diff --git a/app/assets/javascripts/diffs/components/tree_list.vue b/app/assets/javascripts/diffs/components/tree_list.vue index d03d450b12d..1a258695fa0 100644 --- a/app/assets/javascripts/diffs/components/tree_list.vue +++ b/app/assets/javascripts/diffs/components/tree_list.vue @@ -35,7 +35,7 @@ export default { } return this.allBlobs.reduce((acc, folder) => { - const tree = folder.tree.filter(f => f.path.toLowerCase().indexOf(search) >= 0); + const tree = folder.tree.filter((f) => f.path.toLowerCase().indexOf(search) >= 0); if (tree.length) { return acc.concat({ diff --git a/app/assets/javascripts/diffs/index.js b/app/assets/javascripts/diffs/index.js index 6cc9cbf750d..35ba937c1e2 100644 --- a/app/assets/javascripts/diffs/index.js +++ b/app/assets/javascripts/diffs/index.js @@ -87,7 +87,7 @@ export default function initDiffsApp(store) { }, computed: { ...mapState({ - activeTab: state => state.page.activeTab, + activeTab: (state) => state.page.activeTab, }), }, created() { diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index 9e331393ffa..ac34684bb16 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -127,7 +127,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { // We need to check that the currentDiffFileId points to a file that exists if ( state.currentDiffFileId && - !state.diffFiles.some(f => f.file_hash === state.currentDiffFileId) && + !state.diffFiles.some((f) => f.file_hash === state.currentDiffFileId) && !isNoteLink ) { commit(types.VIEW_DIFF_FILE, state.diffFiles[0].file_hash); @@ -135,11 +135,11 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { if (state.diffFiles?.length) { // eslint-disable-next-line promise/catch-or-return,promise/no-nesting - import('~/code_navigation').then(m => + import('~/code_navigation').then((m) => m.default({ blobs: state.diffFiles - .filter(f => f.code_navigation_path) - .map(f => ({ + .filter((f) => f.code_navigation_path) + .map((f) => ({ path: f.new_path, codeNavigationPath: f.code_navigation_path, })), @@ -161,7 +161,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { return pagination.next_page; }) - .then(nextPage => nextPage && getBatch(nextPage)) + .then((nextPage) => nextPage && getBatch(nextPage)) .catch(() => commit(types.SET_RETRIEVING_BATCHES, false)); return getBatch() @@ -211,7 +211,7 @@ export const fetchDiffFilesMeta = ({ commit, state }) => { export const fetchCoverageFiles = ({ commit, state }) => { const coveragePoll = new Poll({ resource: { - getCoverageReports: endpoint => axios.get(endpoint), + getCoverageReports: (endpoint) => axios.get(endpoint), }, data: state.endpointCoverage, method: 'getCoverageReports', @@ -246,8 +246,8 @@ export const assignDiscussionsToDiff = ( const hash = getLocationHash(); discussions - .filter(discussion => discussion.diff_discussion) - .forEach(discussion => { + .filter((discussion) => discussion.diff_discussion) + .forEach((discussion) => { commit(types.SET_LINE_DISCUSSIONS_FOR_FILE, { discussion, diffPositionByLineCode, @@ -274,10 +274,10 @@ export const toggleLineDiscussions = ({ commit }, options) => { }; export const renderFileForDiscussionId = ({ commit, rootState, state }, discussionId) => { - const discussion = rootState.notes.discussions.find(d => d.id === discussionId); + const discussion = rootState.notes.discussions.find((d) => d.id === discussionId); if (discussion && discussion.diff_file) { - const file = state.diffFiles.find(f => f.file_hash === discussion.diff_file.file_hash); + const file = state.diffFiles.find((f) => f.file_hash === discussion.diff_file.file_hash); if (file) { if (!file.renderIt) { @@ -303,9 +303,9 @@ export const renderFileForDiscussionId = ({ commit, rootState, state }, discussi export const startRenderDiffsQueue = ({ state, commit }) => { const checkItem = () => - new Promise(resolve => { + new Promise((resolve) => { const nextFile = state.diffFiles.find( - file => + (file) => !file.renderIt && file.viewer && (!isCollapsed(file) || file.viewer.name !== diffViewerModes.text), @@ -362,7 +362,7 @@ export const loadMoreLines = ({ commit }, options) => { params.from_merge_request = true; - return axios.get(endpoint, { params }).then(res => { + return axios.get(endpoint, { params }).then((res) => { const contextLines = res.data || []; commit(types.ADD_CONTEXT_LINES, { @@ -403,7 +403,7 @@ export const loadCollapsedDiff = ({ commit, getters, state }, file) => w: state.showWhitespace ? '0' : '1', }, }) - .then(res => { + .then((res) => { commit(types.ADD_COLLAPSED_DIFFS, { file, data: res.data, @@ -426,7 +426,7 @@ export const toggleFileDiscussions = ({ getters, dispatch }, diff) => { const shouldCloseAll = getters.diffHasAllExpandedDiscussions(diff); const shouldExpandAll = getters.diffHasAllCollapsedDiscussions(diff); - discussions.forEach(discussion => { + discussions.forEach((discussion) => { const data = { discussionId: discussion.id }; if (shouldCloseAll) { @@ -440,13 +440,13 @@ export const toggleFileDiscussions = ({ getters, dispatch }, diff) => { export const toggleFileDiscussionWrappers = ({ commit }, diff) => { const discussionWrappersExpanded = allDiscussionWrappersExpanded(diff); const lineCodesWithDiscussions = new Set(); - const lineHasDiscussion = line => Boolean(line?.discussions.length); - const registerDiscussionLine = line => lineCodesWithDiscussions.add(line.line_code); + const lineHasDiscussion = (line) => Boolean(line?.discussions.length); + const registerDiscussionLine = (line) => lineCodesWithDiscussions.add(line.line_code); diff[INLINE_DIFF_LINES_KEY].filter(lineHasDiscussion).forEach(registerDiscussionLine); if (lineCodesWithDiscussions.size) { - Array.from(lineCodesWithDiscussions).forEach(lineCode => { + Array.from(lineCodesWithDiscussions).forEach((lineCode) => { commit(types.TOGGLE_LINE_DISCUSSIONS, { fileHash: diff.file_hash, expanded: !discussionWrappersExpanded, @@ -464,8 +464,8 @@ export const saveDiffDiscussion = ({ state, dispatch }, { note, formData }) => { }); return dispatch('saveNote', postData, { root: true }) - .then(result => dispatch('updateDiscussion', result.discussion, { root: true })) - .then(discussion => dispatch('assignDiscussionsToDiff', [discussion])) + .then((result) => dispatch('updateDiscussion', result.discussion, { root: true })) + .then((discussion) => dispatch('assignDiscussionsToDiff', [discussion])) .then(() => dispatch('updateResolvableDiscussionsCounts', null, { root: true })) .then(() => dispatch('closeDiffFileCommentForm', formData.diffFile.file_hash)) .catch(() => createFlash(s__('MergeRequests|Saving the comment failed'))); @@ -565,7 +565,7 @@ export const setExpandedDiffLines = ({ commit }, { file, data }) => { }); commit(types.TOGGLE_DIFF_FILE_RENDERING_MORE, file.file_path); - const idleCb = t => { + const idleCb = (t) => { const startIndex = index; while ( @@ -613,7 +613,7 @@ export const fetchFullDiff = ({ commit, dispatch }, file) => .catch(() => dispatch('receiveFullDiffError', file.file_path)); export const toggleFullDiff = ({ dispatch, commit, getters, state }, filePath) => { - const file = state.diffFiles.find(f => f.file_path === filePath); + const file = state.diffFiles.find((f) => f.file_path === filePath); commit(types.REQUEST_FULL_DIFF, filePath); @@ -724,7 +724,7 @@ export const setCurrentDiffFileIdFromNote = ({ commit, state, rootGetters }, not const fileHash = rootGetters.getDiscussion(note.discussion_id).diff_file?.file_hash; - if (fileHash && state.diffFiles.some(f => f.file_hash === fileHash)) { + if (fileHash && state.diffFiles.some((f) => f.file_hash === fileHash)) { commit(types.VIEW_DIFF_FILE, fileHash); } }; diff --git a/app/assets/javascripts/diffs/store/getters_versions_dropdowns.js b/app/assets/javascripts/diffs/store/getters_versions_dropdowns.js index 135b1c61ef5..0d1fd26777f 100644 --- a/app/assets/javascripts/diffs/store/getters_versions_dropdowns.js +++ b/app/assets/javascripts/diffs/store/getters_versions_dropdowns.js @@ -2,10 +2,10 @@ import { __, n__, sprintf } from '~/locale'; import { getParameterByName, parseBoolean } from '~/lib/utils/common_utils'; import { DIFF_COMPARE_BASE_VERSION_INDEX, DIFF_COMPARE_HEAD_VERSION_INDEX } from '../constants'; -export const selectedTargetIndex = state => +export const selectedTargetIndex = (state) => state.startVersion?.version_index || DIFF_COMPARE_BASE_VERSION_INDEX; -export const selectedSourceIndex = state => state.mergeRequestDiff.version_index; +export const selectedSourceIndex = (state) => state.mergeRequestDiff.version_index; export const diffCompareDropdownTargetVersions = (state, getters) => { // startVersion only exists if the user has selected a version other @@ -40,7 +40,7 @@ export const diffCompareDropdownTargetVersions = (state, getters) => { selected: isHeadSelected, }; // Appended properties here are to make the compare_dropdown_layout easier to reason about - const formatVersion = v => { + const formatVersion = (v) => { return { href: v.compare_path, versionName: sprintf(__(`version %{versionIndex}`), { versionIndex: v.version_index }), @@ -53,7 +53,7 @@ export const diffCompareDropdownTargetVersions = (state, getters) => { ...state.mergeRequestDiffs.slice(1).map(formatVersion), baseVersion, state.mergeRequestDiff.head_version_path && headVersion, - ].filter(a => a); + ].filter((a) => a); }; export const diffCompareDropdownSourceVersions = (state, getters) => { diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index d3827a92426..4e772d17c29 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -105,11 +105,11 @@ export default { }, [types.TOGGLE_LINE_HAS_FORM](state, { lineCode, fileHash, hasForm }) { - const diffFile = state.diffFiles.find(f => f.file_hash === fileHash); + const diffFile = state.diffFiles.find((f) => f.file_hash === fileHash); if (!diffFile) return; - diffFile[INLINE_DIFF_LINES_KEY].find(l => l.line_code === lineCode).hasForm = hasForm; + diffFile[INLINE_DIFF_LINES_KEY].find((l) => l.line_code === lineCode).hasForm = hasForm; }, [types.ADD_CONTEXT_LINES](state, options) { @@ -125,7 +125,7 @@ export default { bottom, isExpandDown, nextLineNumbers, - ).map(line => { + ).map((line) => { const lineCode = line.type === 'match' ? `${fileHash}_${line.meta_data.old_pos}_${line.meta_data.new_pos}_match` @@ -149,8 +149,8 @@ export default { [types.ADD_COLLAPSED_DIFFS](state, { file, data }) { const files = prepareDiffData({ diff: data }); - const [newFileData] = files.filter(f => f.file_hash === file.file_hash); - const selectedFile = state.diffFiles.find(f => f.file_hash === file.file_hash); + const [newFileData] = files.filter((f) => f.file_hash === file.file_hash); + const selectedFile = state.diffFiles.find((f) => f.file_hash === file.file_hash); Object.assign(selectedFile, { ...newFileData }); }, @@ -159,9 +159,9 @@ export default { const discussionLineCodes = [discussion.line_code, ...(discussion.line_codes || [])]; const fileHash = discussion.diff_file.file_hash; - const lineCheck = line => + const lineCheck = (line) => discussionLineCodes.some( - discussionLineCode => + (discussionLineCode) => line.line_code === discussionLineCode && isDiscussionApplicableToLine({ discussion, @@ -179,26 +179,26 @@ export default { : [], }); - const setDiscussionsExpanded = line => { + const setDiscussionsExpanded = (line) => { const isLineNoteTargeted = line.discussions && line.discussions.some( - disc => disc.notes && disc.notes.find(note => hash === `note_${note.id}`), + (disc) => disc.notes && disc.notes.find((note) => hash === `note_${note.id}`), ); return { ...line, discussionsExpanded: line.discussions && line.discussions.length - ? line.discussions.some(disc => !disc.resolved) || isLineNoteTargeted + ? line.discussions.some((disc) => !disc.resolved) || isLineNoteTargeted : false, }; }; - state.diffFiles.forEach(file => { + state.diffFiles.forEach((file) => { if (file.file_hash === fileHash) { if (file[INLINE_DIFF_LINES_KEY].length) { - file[INLINE_DIFF_LINES_KEY].forEach(line => { + file[INLINE_DIFF_LINES_KEY].forEach((line) => { Object.assign( line, setDiscussionsExpanded(lineCheck(line) ? mapDiscussions(line) : line), @@ -208,7 +208,7 @@ export default { if (!file[INLINE_DIFF_LINES_KEY].length) { const newDiscussions = (file.discussions || []) - .filter(d => d.id !== discussion.id) + .filter((d) => d.id !== discussion.id) .concat(discussion); Object.assign(file, { @@ -220,26 +220,26 @@ export default { }, [types.REMOVE_LINE_DISCUSSIONS_FOR_FILE](state, { fileHash, lineCode }) { - const selectedFile = state.diffFiles.find(f => f.file_hash === fileHash); + const selectedFile = state.diffFiles.find((f) => f.file_hash === fileHash); if (selectedFile) { - updateLineInFile(selectedFile, lineCode, line => + updateLineInFile(selectedFile, lineCode, (line) => Object.assign(line, { - discussions: line.discussions.filter(discussion => discussion.notes.length), + discussions: line.discussions.filter((discussion) => discussion.notes.length), }), ); if (selectedFile.discussions && selectedFile.discussions.length) { selectedFile.discussions = selectedFile.discussions.filter( - discussion => discussion.notes.length, + (discussion) => discussion.notes.length, ); } } }, [types.TOGGLE_LINE_DISCUSSIONS](state, { fileHash, lineCode, expanded }) { - const selectedFile = state.diffFiles.find(f => f.file_hash === fileHash); + const selectedFile = state.diffFiles.find((f) => f.file_hash === fileHash); - updateLineInFile(selectedFile, lineCode, line => { + updateLineInFile(selectedFile, lineCode, (line) => { Object.assign(line, { discussionsExpanded: expanded }); }); }, @@ -262,7 +262,7 @@ export default { [types.UPDATE_DIFF_FILE_COMMENT_FORM](state, formData) { const { fileHash } = formData; - state.commentForms = state.commentForms.map(form => { + state.commentForms = state.commentForms.map((form) => { if (form.fileHash === fileHash) { return { ...formData, @@ -273,7 +273,7 @@ export default { }); }, [types.CLOSE_DIFF_FILE_COMMENT_FORM](state, fileHash) { - state.commentForms = state.commentForms.filter(form => form.fileHash !== fileHash); + state.commentForms = state.commentForms.filter((form) => form.fileHash !== fileHash); }, [types.SET_HIGHLIGHTED_ROW](state, lineCode) { state.highlightedRow = lineCode; @@ -313,7 +313,7 @@ export default { state, { filePath, collapsed, trigger = DIFF_FILE_AUTOMATIC_COLLAPSE }, ) { - const file = state.diffFiles.find(f => f.file_path === filePath); + const file = state.diffFiles.find((f) => f.file_path === filePath); if (file && file.viewer) { if (trigger === DIFF_FILE_MANUAL_COLLAPSE) { @@ -330,17 +330,17 @@ export default { } }, [types.SET_CURRENT_VIEW_DIFF_FILE_LINES](state, { filePath, lines }) { - const file = state.diffFiles.find(f => f.file_path === filePath); + const file = state.diffFiles.find((f) => f.file_path === filePath); file[INLINE_DIFF_LINES_KEY] = lines; }, [types.ADD_CURRENT_VIEW_DIFF_FILE_LINES](state, { filePath, line }) { - const file = state.diffFiles.find(f => f.file_path === filePath); + const file = state.diffFiles.find((f) => f.file_path === filePath); file[INLINE_DIFF_LINES_KEY].push(line); }, [types.TOGGLE_DIFF_FILE_RENDERING_MORE](state, filePath) { - const file = state.diffFiles.find(f => f.file_path === filePath); + const file = state.diffFiles.find((f) => f.file_path === filePath); file.renderingLines = !file.renderingLines; }, diff --git a/app/assets/javascripts/diffs/store/utils.js b/app/assets/javascripts/diffs/store/utils.js index 27702eaf91e..8712220b25e 100644 --- a/app/assets/javascripts/diffs/store/utils.js +++ b/app/assets/javascripts/diffs/store/utils.js @@ -23,15 +23,15 @@ import { } from '../constants'; import { prepareRawDiffFile } from '../utils/diff_file'; -export const isAdded = line => ['new', 'new-nonewline'].includes(line.type); -export const isRemoved = line => ['old', 'old-nonewline'].includes(line.type); -export const isUnchanged = line => !line.type; -export const isMeta = line => ['match', 'new-nonewline', 'old-nonewline'].includes(line.type); -export const isConflictMarker = line => +export const isAdded = (line) => ['new', 'new-nonewline'].includes(line.type); +export const isRemoved = (line) => ['old', 'old-nonewline'].includes(line.type); +export const isUnchanged = (line) => !line.type; +export const isMeta = (line) => ['match', 'new-nonewline', 'old-nonewline'].includes(line.type); +export const isConflictMarker = (line) => [CONFLICT_MARKER_OUR, CONFLICT_MARKER_THEIR].includes(line.type); -export const isConflictSeperator = line => line.type === CONFLICT_MARKER; -export const isConflictOur = line => line.type === CONFLICT_OUR; -export const isConflictTheir = line => line.type === CONFLICT_THEIR; +export const isConflictSeperator = (line) => line.type === CONFLICT_MARKER; +export const isConflictOur = (line) => line.type === CONFLICT_OUR; +export const isConflictTheir = (line) => line.type === CONFLICT_THEIR; /** * Pass in the inline diff lines array which gets converted @@ -117,10 +117,10 @@ export const parallelizeDiffLines = (diffLines, inline) => { }; export function findDiffFile(files, match, matchKey = 'file_hash') { - return files.find(file => file[matchKey] === match); + return files.find((file) => file[matchKey] === match); } -export const getReversePosition = linePosition => { +export const getReversePosition = (linePosition) => { if (linePosition === LINE_POSITION_RIGHT) { return LINE_POSITION_LEFT; } @@ -197,7 +197,7 @@ export const findIndexInInlineLines = (lines, lineNumbers) => { const { oldLineNumber, newLineNumber } = lineNumbers; return lines.findIndex( - line => line.old_line === oldLineNumber && line.new_line === newLineNumber, + (line) => line.old_line === oldLineNumber && line.new_line === newLineNumber, ); }; @@ -370,7 +370,7 @@ export function prepareLineForRenamedFile({ line, diffFile, index = 0 }) { function prepareDiffFileLines(file) { const inlineLines = file[INLINE_DIFF_LINES_KEY]; - inlineLines.forEach(line => prepareLine(line, file)); // WARNING: In-Place Mutations! + inlineLines.forEach((line) => prepareLine(line, file)); // WARNING: In-Place Mutations! Object.assign(file, { inlineLinesCount: inlineLines.length, @@ -424,7 +424,7 @@ export function getDiffPositionByLineCode(diffFiles) { let lines = []; lines = diffFiles.reduce((acc, diffFile) => { - diffFile[INLINE_DIFF_LINES_KEY].forEach(line => { + diffFile[INLINE_DIFF_LINES_KEY].forEach((line) => { acc.push({ file: diffFile, line }); }); @@ -471,21 +471,21 @@ export function isDiscussionApplicableToLine({ discussion, diffPosition, latestD ...(discussion.positions || []), ]; - const removeLineRange = position => { + const removeLineRange = (position) => { const { line_range: pNotUsed, ...positionNoLineRange } = position; return positionNoLineRange; }; return discussionPositions .map(removeLineRange) - .some(position => isEqual(position, diffPositionCopy)); + .some((position) => isEqual(position, diffPositionCopy)); } // eslint-disable-next-line return latestDiff && discussion.active && line_code === discussion.line_code; } -export const getLowestSingleFolder = folder => { +export const getLowestSingleFolder = (folder) => { const getFolder = (blob, start = []) => blob.tree.reduce( (acc, file) => { @@ -517,8 +517,8 @@ export const getLowestSingleFolder = folder => { }; }; -export const flattenTree = tree => { - const flatten = blobTree => +export const flattenTree = (tree) => { + const flatten = (blobTree) => blobTree.reduce((acc, file) => { const blob = file; let treeToFlatten = blob.tree; @@ -540,7 +540,7 @@ export const flattenTree = tree => { return flatten(tree); }; -export const generateTreeList = files => { +export const generateTreeList = (files) => { const { treeEntries, tree } = files.reduce( (acc, file) => { const split = file.new_path.split('/'); @@ -590,8 +590,8 @@ export const generateTreeList = files => { return { treeEntries, tree: flattenTree(tree) }; }; -export const getDiffMode = diffFile => { - const diffModeKey = Object.keys(diffModes).find(key => diffFile[`${key}_file`]); +export const getDiffMode = (diffFile) => { + const diffModeKey = Object.keys(diffModes).find((key) => diffFile[`${key}_file`]); return ( diffModes[diffModeKey] || (diffFile.viewer && @@ -639,11 +639,11 @@ export const convertExpandLines = ({ return lines; }; -export const idleCallback = cb => requestIdleCallback(cb); +export const idleCallback = (cb) => requestIdleCallback(cb); function getLinesFromFileByLineCode(file, lineCode) { const inlineLines = file[INLINE_DIFF_LINES_KEY]; - const matchesCode = line => line.line_code === lineCode; + const matchesCode = (line) => line.line_code === lineCode; return inlineLines.filter(matchesCode); } @@ -652,15 +652,15 @@ export const updateLineInFile = (selectedFile, lineCode, updateFn) => { getLinesFromFileByLineCode(selectedFile, lineCode).forEach(updateFn); }; -export const allDiscussionWrappersExpanded = diff => { +export const allDiscussionWrappersExpanded = (diff) => { let discussionsExpanded = true; - const changeExpandedResult = line => { + const changeExpandedResult = (line) => { if (line && line.discussions.length) { discussionsExpanded = discussionsExpanded && line.discussionsExpanded; } }; - diff[INLINE_DIFF_LINES_KEY].forEach(line => { + diff[INLINE_DIFF_LINES_KEY].forEach((line) => { changeExpandedResult(line); }); diff --git a/app/assets/javascripts/diffs/utils/diff_file.js b/app/assets/javascripts/diffs/utils/diff_file.js index 2cb88e34856..ce0398e75fc 100644 --- a/app/assets/javascripts/diffs/utils/diff_file.js +++ b/app/assets/javascripts/diffs/utils/diff_file.js @@ -8,8 +8,8 @@ import { getDerivedMergeRequestInformation } from './merge_request'; import { uuids } from './uuids'; function fileSymlinkInformation(file, fileList) { - const duplicates = fileList.filter(iteratedFile => iteratedFile.file_hash === file.file_hash); - const includesSymlink = duplicates.some(iteratedFile => { + const duplicates = fileList.filter((iteratedFile) => iteratedFile.file_hash === file.file_hash); + const includesSymlink = duplicates.some((iteratedFile) => { return [iteratedFile.a_mode, iteratedFile.b_mode].includes(DIFF_FILE_SYMLINK_MODE); }); const brokenSymlinkScenario = duplicates.length > 1 && includesSymlink; diff --git a/app/assets/javascripts/diffs/workers/tree_worker.js b/app/assets/javascripts/diffs/workers/tree_worker.js index 415c463fd19..2fa1934439e 100644 --- a/app/assets/javascripts/diffs/workers/tree_worker.js +++ b/app/assets/javascripts/diffs/workers/tree_worker.js @@ -2,7 +2,7 @@ import { sortTree } from '~/ide/stores/utils'; import { generateTreeList } from '../store/utils'; // eslint-disable-next-line no-restricted-globals -self.addEventListener('message', e => { +self.addEventListener('message', (e) => { const { data } = e; if (data === undefined) { diff --git a/app/assets/javascripts/dirty_submit/dirty_submit_collection.js b/app/assets/javascripts/dirty_submit/dirty_submit_collection.js index 42b051b2270..4886125d4ac 100644 --- a/app/assets/javascripts/dirty_submit/dirty_submit_collection.js +++ b/app/assets/javascripts/dirty_submit/dirty_submit_collection.js @@ -6,7 +6,7 @@ class DirtySubmitCollection { this.dirtySubmits = []; - this.forms.forEach(form => this.dirtySubmits.push(new DirtySubmitForm(form))); + this.forms.forEach((form) => this.dirtySubmits.push(new DirtySubmitForm(form))); } } diff --git a/app/assets/javascripts/dirty_submit/dirty_submit_form.js b/app/assets/javascripts/dirty_submit/dirty_submit_form.js index 903c31cb0d1..54fd5f91194 100644 --- a/app/assets/javascripts/dirty_submit/dirty_submit_form.js +++ b/app/assets/javascripts/dirty_submit/dirty_submit_form.js @@ -22,10 +22,10 @@ class DirtySubmitForm { registerListeners() { const getThrottledHandlerForInput = memoize(() => - throttle(event => this.updateDirtyInput(event), DirtySubmitForm.THROTTLE_DURATION), + throttle((event) => this.updateDirtyInput(event), DirtySubmitForm.THROTTLE_DURATION), ); - const throttledUpdateDirtyInput = event => { + const throttledUpdateDirtyInput = (event) => { const throttledHandler = getThrottledHandlerForInput(event.target.name); throttledHandler(event); }; @@ -33,7 +33,7 @@ class DirtySubmitForm { this.form.addEventListener('input', throttledUpdateDirtyInput); this.form.addEventListener('change', throttledUpdateDirtyInput); $(this.form).on('change.select2', throttledUpdateDirtyInput); - this.form.addEventListener('submit', event => this.formSubmit(event)); + this.form.addEventListener('submit', (event) => this.formSubmit(event)); } updateDirtyInput(event) { @@ -58,7 +58,7 @@ class DirtySubmitForm { toggleSubmission() { this.isDisabled = this.dirtyInputs.length === 0; - this.submits.forEach(element => { + this.submits.forEach((element) => { element.disabled = this.isDisabled; }); } diff --git a/app/assets/javascripts/droplab/drop_down.js b/app/assets/javascripts/droplab/drop_down.js index 31d32fb5060..f4a0b3ed727 100644 --- a/app/assets/javascripts/droplab/drop_down.js +++ b/app/assets/javascripts/droplab/drop_down.js @@ -68,7 +68,7 @@ class DropDown { removeSelectedClasses() { const items = this.items || this.getItems(); - items.forEach(item => item.classList.remove(SELECTED_CLASS)); + items.forEach((item) => item.classList.remove(SELECTED_CLASS)); } addEvents() { @@ -162,7 +162,7 @@ class DropDown { static setImagesSrc(template) { const images = [...template.querySelectorAll('img[data-src]')]; - images.forEach(image => { + images.forEach((image) => { const img = image; img.src = img.getAttribute('data-src'); diff --git a/app/assets/javascripts/droplab/drop_lab.js b/app/assets/javascripts/droplab/drop_lab.js index 33c05404493..537a05aebb9 100644 --- a/app/assets/javascripts/droplab/drop_lab.js +++ b/app/assets/javascripts/droplab/drop_lab.js @@ -28,7 +28,7 @@ class DropLab { } destroy() { - this.hooks.forEach(hook => hook.destroy()); + this.hooks.forEach((hook) => hook.destroy()); this.hooks = []; this.removeEvents(); } @@ -51,7 +51,7 @@ class DropLab { } processData(trigger, data, methodName) { - this.hooks.forEach(hook => { + this.hooks.forEach((hook) => { if (Array.isArray(trigger)) hook.list[methodName](trigger); if (hook.trigger.id === trigger) hook.list[methodName](data); @@ -70,7 +70,7 @@ class DropLab { if (utils.isDropDownParts(thisTag, this.hooks)) return; if (utils.isDropDownParts(e.target, this.hooks)) return; - this.hooks.forEach(hook => hook.list.hide()); + this.hooks.forEach((hook) => hook.list.hide()); } removeEvents() { @@ -115,7 +115,7 @@ class DropLab { } addHooks(hooks, plugins, config) { - hooks.forEach(hook => this.addHook(hook, null, plugins, config)); + hooks.forEach((hook) => this.addHook(hook, null, plugins, config)); return this; } @@ -147,7 +147,7 @@ class DropLab { this.fireReady(); - this.queuedData.forEach(data => this.addData(data)); + this.queuedData.forEach((data) => this.addData(data)); this.queuedData = []; return this; diff --git a/app/assets/javascripts/droplab/hook_button.js b/app/assets/javascripts/droplab/hook_button.js index af45eba74e7..c58d0052251 100644 --- a/app/assets/javascripts/droplab/hook_button.js +++ b/app/assets/javascripts/droplab/hook_button.js @@ -14,7 +14,7 @@ class HookButton extends Hook { } addPlugins() { - this.plugins.forEach(plugin => plugin.init(this)); + this.plugins.forEach((plugin) => plugin.init(this)); } clicked(e) { @@ -44,7 +44,7 @@ class HookButton extends Hook { } removePlugins() { - this.plugins.forEach(plugin => plugin.destroy()); + this.plugins.forEach((plugin) => plugin.destroy()); } destroy() { diff --git a/app/assets/javascripts/droplab/hook_input.js b/app/assets/javascripts/droplab/hook_input.js index 19131a64f2c..c523dae347f 100644 --- a/app/assets/javascripts/droplab/hook_input.js +++ b/app/assets/javascripts/droplab/hook_input.js @@ -14,7 +14,7 @@ class HookInput extends Hook { } addPlugins() { - this.plugins.forEach(plugin => plugin.init(this)); + this.plugins.forEach((plugin) => plugin.init(this)); } addEvents() { @@ -101,7 +101,7 @@ class HookInput extends Hook { } removePlugins() { - this.plugins.forEach(plugin => plugin.destroy()); + this.plugins.forEach((plugin) => plugin.destroy()); } destroy() { diff --git a/app/assets/javascripts/droplab/plugins/ajax.js b/app/assets/javascripts/droplab/plugins/ajax.js index fce29649c7b..77d60454d1a 100644 --- a/app/assets/javascripts/droplab/plugins/ajax.js +++ b/app/assets/javascripts/droplab/plugins/ajax.js @@ -43,7 +43,7 @@ const Ajax = { return AjaxCache.retrieve(config.endpoint) .then(self.preprocessing.bind(null, config)) - .then(data => self._loadData(data, config, self)) + .then((data) => self._loadData(data, config, self)) .catch(config.onError); }, destroy: function () { diff --git a/app/assets/javascripts/droplab/plugins/ajax_filter.js b/app/assets/javascripts/droplab/plugins/ajax_filter.js index 94ccae1a442..ac4d44adc17 100644 --- a/app/assets/javascripts/droplab/plugins/ajax_filter.js +++ b/app/assets/javascripts/droplab/plugins/ajax_filter.js @@ -63,7 +63,7 @@ const AjaxFilter = { params[config.searchKey] = searchValue; var url = config.endpoint + this.buildParams(params); return AjaxCache.retrieve(url) - .then(data => { + .then((data) => { this._loadData(data, config); if (config.onLoadingFinished) { config.onLoadingFinished(data); diff --git a/app/assets/javascripts/droplab/plugins/input_setter.js b/app/assets/javascripts/droplab/plugins/input_setter.js index 6cfc738a1e3..148d9a35b81 100644 --- a/app/assets/javascripts/droplab/plugins/input_setter.js +++ b/app/assets/javascripts/droplab/plugins/input_setter.js @@ -27,7 +27,7 @@ const InputSetter = { if (!Array.isArray(this.config)) this.config = [this.config]; - this.config.forEach(config => this.setInput(config, selectedItem)); + this.config.forEach((config) => this.setInput(config, selectedItem)); }, setInput(config, selectedItem) { diff --git a/app/assets/javascripts/due_date_select.js b/app/assets/javascripts/due_date_select.js index 25520c7edde..c311e1b561c 100644 --- a/app/assets/javascripts/due_date_select.js +++ b/app/assets/javascripts/due_date_select.js @@ -55,9 +55,9 @@ class DueDateSelect { field: $dueDateInput.get(0), theme: 'gitlab-theme', format: 'yyyy-mm-dd', - parse: dateString => parsePikadayDate(dateString), - toString: date => pikadayToString(date), - onSelect: dateText => { + parse: (dateString) => parsePikadayDate(dateString), + toString: (date) => pikadayToString(date), + onSelect: (dateText) => { $dueDateInput.val(calendar.toString(dateText)); if (this.$dropdown.hasClass('js-issue-boards-due-date')) { @@ -76,7 +76,7 @@ class DueDateSelect { } initRemoveDueDate() { - this.$block.on('click', '.js-remove-due-date', e => { + this.$block.on('click', '.js-remove-due-date', (e) => { const calendar = this.$datePicker.data('pikaday'); e.preventDefault(); @@ -103,7 +103,7 @@ class DueDateSelect { if (this.rawSelectedDate.length) { // Construct Date object manually to avoid buggy dateString support within Date constructor - const dateArray = this.rawSelectedDate.split('-').map(v => parseInt(v, 10)); + const dateArray = this.rawSelectedDate.split('-').map((v) => parseInt(v, 10)); const dateObj = new Date(dateArray[0], dateArray[1] - 1, dateArray[2]); this.displayedDate = dateFormat(dateObj, 'mmm d, yyyy'); } else { @@ -182,8 +182,8 @@ export default class DueDateSelectors { theme: 'gitlab-theme animate-picker', format: 'yyyy-mm-dd', container: $datePicker.parent().get(0), - parse: dateString => parsePikadayDate(dateString), - toString: date => pikadayToString(date), + parse: (dateString) => parsePikadayDate(dateString), + toString: (date) => pikadayToString(date), onSelect(dateText) { $datePicker.val(calendar.toString(dateText)); }, @@ -195,7 +195,7 @@ export default class DueDateSelectors { $datePicker.data('pikaday', calendar); }); - $('.js-clear-due-date,.js-clear-start-date').on('click', e => { + $('.js-clear-due-date,.js-clear-start-date').on('click', (e) => { e.preventDefault(); const calendar = $(e.target).siblings('.datepicker').data('pikaday'); calendar.setDate(null); diff --git a/app/assets/javascripts/editor/editor_lite.js b/app/assets/javascripts/editor/editor_lite.js index 2bd1cdc84d0..1808f968b8c 100644 --- a/app/assets/javascripts/editor/editor_lite.js +++ b/app/assets/javascripts/editor/editor_lite.js @@ -24,7 +24,7 @@ export default class EditorLite { static setupMonacoTheme() { const themeName = window.gon?.user_color_scheme || DEFAULT_THEME; - const theme = themes.find(t => t.name === themeName); + const theme = themes.find((t) => t.name === themeName); if (theme) monacoEditor.defineTheme(themeName, theme.data); monacoEditor.setTheme(theme ? themeName : DEFAULT_THEME); } @@ -35,7 +35,7 @@ export default class EditorLite { const ext = `.${path.split('.').pop()}`; const language = monacoLanguages .getLanguages() - .find(lang => lang.extensions.indexOf(ext) !== -1); + .find((lang) => lang.extensions.indexOf(ext) !== -1); const id = language ? language.id : 'plaintext'; monacoEditor.setModelLanguage(model, id); } @@ -51,7 +51,7 @@ export default class EditorLite { const promises = []; const extensionsArray = typeof extensions === 'string' ? extensions.split(',') : extensions; - extensionsArray.forEach(ext => { + extensionsArray.forEach((ext) => { const prefix = ext.includes('/') ? '' : 'editor/'; const trimmedExt = ext.replace(/^\//, '').trim(); EditorLite.pushToImportsArray(promises, `~/${prefix}${trimmedExt}`); @@ -66,7 +66,7 @@ export default class EditorLite { } const isClassInstance = source.constructor.prototype !== Object.prototype; const sanitizedSource = isClassInstance ? source.constructor.prototype : source; - Object.getOwnPropertyNames(sanitizedSource).forEach(prop => { + Object.getOwnPropertyNames(sanitizedSource).forEach((prop) => { if (prop !== 'constructor') { Object.assign(inst, { [prop]: source[prop] }); } @@ -110,17 +110,17 @@ export default class EditorLite { }); instance.setModel(model); instance.onDidDispose(() => { - const index = this.instances.findIndex(inst => inst === instance); + const index = this.instances.findIndex((inst) => inst === instance); this.instances.splice(index, 1); model.dispose(); }); - instance.updateModelLanguage = path => EditorLite.updateModelLanguage(path, instance); - instance.use = args => this.use(args, instance); + instance.updateModelLanguage = (path) => EditorLite.updateModelLanguage(path, instance); + instance.use = (args) => this.use(args, instance); EditorLite.loadExtensions(extensions, instance) - .then(modules => { + .then((modules) => { if (modules) { - modules.forEach(module => { + modules.forEach((module) => { instance.use(module.default); }); } @@ -128,7 +128,7 @@ export default class EditorLite { .then(() => { el.dispatchEvent(new Event('editor-ready')); }) - .catch(e => { + .catch((e) => { throw e; }); @@ -137,20 +137,20 @@ export default class EditorLite { } dispose() { - this.instances.forEach(instance => instance.dispose()); + this.instances.forEach((instance) => instance.dispose()); } use(exts = [], instance = null) { const extensions = Array.isArray(exts) ? exts : [exts]; - const initExtensions = inst => { - extensions.forEach(extension => { + const initExtensions = (inst) => { + extensions.forEach((extension) => { EditorLite.mixIntoInstance(extension, inst); }); }; if (instance) { initExtensions(instance); } else { - this.instances.forEach(inst => { + this.instances.forEach((inst) => { initExtensions(inst); }); } diff --git a/app/assets/javascripts/editor/editor_markdown_ext.js b/app/assets/javascripts/editor/editor_markdown_ext.js index 19e0037c175..2ce003753f7 100644 --- a/app/assets/javascripts/editor/editor_markdown_ext.js +++ b/app/assets/javascripts/editor/editor_markdown_ext.js @@ -76,7 +76,7 @@ export class EditorMarkdownExtension extends EditorLiteExtension { if (textLines.length > 1) { // Multi-line selection - lineShift = textLines.findIndex(line => line.indexOf(toSelect) !== -1); + lineShift = textLines.findIndex((line) => line.indexOf(toSelect) !== -1); newStartLineNumber = currentSelection.startLineNumber + lineShift; newStartColumn = textLines[lineShift].indexOf(toSelect) + 1; } else { diff --git a/app/assets/javascripts/editor/utils.js b/app/assets/javascripts/editor/utils.js index d8b6396b671..af4473413f4 100644 --- a/app/assets/javascripts/editor/utils.js +++ b/app/assets/javascripts/editor/utils.js @@ -1,4 +1,4 @@ -export const clearDomElement = el => { +export const clearDomElement = (el) => { if (!el || !el.firstChild) return; while (el.firstChild) { diff --git a/app/assets/javascripts/emoji/index.js b/app/assets/javascripts/emoji/index.js index b7ea972b643..fa1024a74a4 100644 --- a/app/assets/javascripts/emoji/index.js +++ b/app/assets/javascripts/emoji/index.js @@ -35,7 +35,7 @@ async function prepareEmojiMap() { validEmojiNames = [...Object.keys(emojiMap), ...Object.keys(emojiAliases)]; - Object.keys(emojiMap).forEach(name => { + Object.keys(emojiMap).forEach((name) => { emojiMap[name].aliases = []; emojiMap[name].name = name; }); @@ -122,23 +122,23 @@ const searchMatchers = { const searchPredicates = { // Search by name - name: (matcher, query) => emoji => { + name: (matcher, query) => (emoji) => { const m = matcher(emoji.name, query); return [{ ...m, emoji, field: emoji.name }]; }, // Search by alias - alias: (matcher, query) => emoji => - emoji.aliases.map(alias => { + alias: (matcher, query) => (emoji) => + emoji.aliases.map((alias) => { const m = matcher(alias, query); return { ...m, emoji, field: alias }; }), // Search by description - description: (matcher, query) => emoji => { + description: (matcher, query) => (emoji) => { const m = matcher(emoji.d, query); return [{ ...m, emoji, field: emoji.d }]; }, // Search by unicode value (always exact) - unicode: (matcher, query) => emoji => { + unicode: (matcher, query) => (emoji) => { return [{ emoji, field: emoji.e, success: emoji.e === query }]; }, }; @@ -196,18 +196,18 @@ export function searchEmoji(query, opts) { } const matcher = searchMatchers[match] || searchMatchers.exact; - const predicates = fields.map(f => searchPredicates[f](matcher, query)); + const predicates = fields.map((f) => searchPredicates[f](matcher, query)); const results = Object.values(emojiMap) - .flatMap(emoji => predicates.flatMap(predicate => predicate(emoji))) - .filter(r => r.success); + .flatMap((emoji) => predicates.flatMap((predicate) => predicate(emoji))) + .filter((r) => r.success); // Fallback to question mark for unknown emojis if (fallback && results.length === 0) { return raw ? [{ emoji: fallbackEmoji }] : [fallbackEmoji]; } - return raw ? results : results.map(r => r.emoji); + return raw ? results : results.map((r) => r.emoji); } let emojiCategoryMap; @@ -223,7 +223,7 @@ export function getEmojiCategoryMap() { symbols: [], flags: [], }; - Object.keys(emojiMap).forEach(name => { + Object.keys(emojiMap).forEach((name) => { const emoji = emojiMap[name]; if (emojiCategoryMap[emoji.c]) { emojiCategoryMap[emoji.c].push(name); diff --git a/app/assets/javascripts/emoji/no_emoji_validator.js b/app/assets/javascripts/emoji/no_emoji_validator.js index edef868619a..85c8204225a 100644 --- a/app/assets/javascripts/emoji/no_emoji_validator.js +++ b/app/assets/javascripts/emoji/no_emoji_validator.js @@ -9,7 +9,7 @@ export default class NoEmojiValidator extends InputValidator { const container = opts.container || ''; this.noEmojiEmelents = document.querySelectorAll(`${container} .js-block-emoji`); - this.noEmojiEmelents.forEach(element => + this.noEmojiEmelents.forEach((element) => element.addEventListener('input', this.eventHandler.bind(this)), ); } diff --git a/app/assets/javascripts/emoji/support/is_emoji_unicode_supported.js b/app/assets/javascripts/emoji/support/is_emoji_unicode_supported.js index c5f9fcf6358..cf9794e6a87 100644 --- a/app/assets/javascripts/emoji/support/is_emoji_unicode_supported.js +++ b/app/assets/javascripts/emoji/support/is_emoji_unicode_supported.js @@ -33,7 +33,7 @@ const tone5 = 127999; // parseInt('1F3FF', 16) function isSkinToneComboEmoji(emojiUnicode) { return ( emojiUnicode.length > 2 && - Array.from(emojiUnicode).some(char => { + Array.from(emojiUnicode).some((char) => { const cp = char.codePointAt(0); return cp >= tone1 && cp <= tone5; }) @@ -60,7 +60,7 @@ const personEndCodePoint = 128105; // parseInt('1F469', 16) function isPersonZwjEmoji(emojiUnicode) { let hasPersonEmoji = false; let hasZwj = false; - Array.from(emojiUnicode).forEach(character => { + Array.from(emojiUnicode).forEach((character) => { const cp = character.codePointAt(0); if (cp === zwj) { hasZwj = true; diff --git a/app/assets/javascripts/emoji/support/unicode_support_map.js b/app/assets/javascripts/emoji/support/unicode_support_map.js index 651169391fe..fe3bc75f9fd 100644 --- a/app/assets/javascripts/emoji/support/unicode_support_map.js +++ b/app/assets/javascripts/emoji/support/unicode_support_map.js @@ -89,9 +89,9 @@ function generateUnicodeSupportMap(testMap) { ctx.font = `${fontSize}px "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`; // Write each emoji to the canvas vertically let writeIndex = 0; - testMapKeys.forEach(testKey => { + testMapKeys.forEach((testKey) => { const testEntry = testMap[testKey]; - [].concat(testEntry).forEach(emojiUnicode => { + [].concat(testEntry).forEach((emojiUnicode) => { ctx.fillText(emojiUnicode, 0, writeIndex * fontSize + fontSize / 2); writeIndex += 1; }); @@ -100,11 +100,11 @@ function generateUnicodeSupportMap(testMap) { // Read from the canvas const resultMap = {}; let readIndex = 0; - testMapKeys.forEach(testKey => { + testMapKeys.forEach((testKey) => { const testEntry = testMap[testKey]; // This needs to be a `reduce` instead of `every` because we need to // keep the `readIndex` in sync from the writes by running all entries - const isTestSatisfied = [].concat(testEntry).reduce(isSatisfied => { + const isTestSatisfied = [].concat(testEntry).reduce((isSatisfied) => { // Sample along the vertical-middle for a couple of characters const imageData = ctx.getImageData(0, readIndex * fontSize + fontSize / 2, 2 * fontSize, 1) .data; diff --git a/app/assets/javascripts/environments/components/environment_item.vue b/app/assets/javascripts/environments/components/environment_item.vue index 347828888dc..1724cc692bd 100644 --- a/app/assets/javascripts/environments/components/environment_item.vue +++ b/app/assets/javascripts/environments/components/environment_item.vue @@ -226,7 +226,7 @@ export default { { deep: true }, ); const combinedActions = (manualActions || []).concat(scheduledActions || []); - return combinedActions.map(action => ({ + return combinedActions.map((action) => ({ ...action, name: action.name, })); diff --git a/app/assets/javascripts/environments/components/environment_rollback.vue b/app/assets/javascripts/environments/components/environment_rollback.vue index 32528e6c6ea..48edde82ce7 100644 --- a/app/assets/javascripts/environments/components/environment_rollback.vue +++ b/app/assets/javascripts/environments/components/environment_rollback.vue @@ -55,7 +55,7 @@ export default { retryUrl: this.retryUrl, isLastDeployment: this.isLastDeployment, }); - eventHub.$on('rollbackEnvironment', environment => { + eventHub.$on('rollbackEnvironment', (environment) => { if (environment.id === this.environment.id) { this.isLoading = true; } diff --git a/app/assets/javascripts/environments/components/environments_app.vue b/app/assets/javascripts/environments/components/environments_app.vue index b6a7cce36e9..13228873f44 100644 --- a/app/assets/javascripts/environments/components/environments_app.vue +++ b/app/assets/javascripts/environments/components/environments_app.vue @@ -116,7 +116,7 @@ export default { this.service .getFolderContent(folder.folder_path) - .then(response => this.store.setfolderContent(folder, response.data.environments)) + .then((response) => this.store.setfolderContent(folder, response.data.environments)) .then(() => this.store.updateEnvironmentProp(folder, 'isLoadingFolderContent', false)) .catch(() => { Flash(s__('Environments|An error occurred while fetching the environments.')); @@ -130,7 +130,7 @@ export default { // We need to verify if any folder is open to also update it const openFolders = this.store.getOpenFolders(); if (openFolders.length) { - openFolders.forEach(folder => this.fetchChildEnvironments(folder)); + openFolders.forEach((folder) => this.fetchChildEnvironments(folder)); } }, }, diff --git a/app/assets/javascripts/environments/components/environments_table.vue b/app/assets/javascripts/environments/components/environments_table.vue index d13c7204285..1efea30a5f7 100644 --- a/app/assets/javascripts/environments/components/environments_table.vue +++ b/app/assets/javascripts/environments/components/environments_table.vue @@ -67,7 +67,7 @@ export default { }, computed: { sortedEnvironments() { - return this.sortEnvironments(this.environments).map(env => + return this.sortEnvironments(this.environments).map((env) => this.shouldRenderFolderContent(env) ? { ...env, children: this.sortEnvironments(env.children) } : env, @@ -144,11 +144,11 @@ export default { * 5. Put folders first. */ return flow( - sortBy(env => (env.isFolder ? env.folderName : env.name)), + sortBy((env) => (env.isFolder ? env.folderName : env.name)), reverse, - sortBy(env => (env.last_deployment ? env.last_deployment.created_at : '0000')), + sortBy((env) => (env.last_deployment ? env.last_deployment.created_at : '0000')), reverse, - sortBy(env => (env.isFolder ? -1 : 1)), + sortBy((env) => (env.isFolder ? -1 : 1)), )(environments); }, changeCanaryWeight(model, weight) { diff --git a/app/assets/javascripts/environments/mixins/environments_mixin.js b/app/assets/javascripts/environments/mixins/environments_mixin.js index 9b0301bba07..3d301f6094d 100644 --- a/app/assets/javascripts/environments/mixins/environments_mixin.js +++ b/app/assets/javascripts/environments/mixins/environments_mixin.js @@ -64,7 +64,7 @@ export default { }, filterNilValues(obj) { - return omitBy(obj, value => value === undefined || value === null); + return omitBy(obj, (value) => value === undefined || value === null); }, /** @@ -80,7 +80,7 @@ export default { // fetch new data return this.service .fetchEnvironments(this.requestData) - .then(response => { + .then((response) => { this.successCallback(response); this.poll.enable({ data: this.requestData, response }); }) @@ -107,7 +107,7 @@ export default { this.service .postAction(endpoint) .then(() => this.fetchEnvironments()) - .catch(err => { + .catch((err) => { this.isLoading = false; Flash(isFunction(errorMessage) ? errorMessage(err.response.data) : errorMessage); }); @@ -219,7 +219,7 @@ export default { data: this.requestData, successCallback: this.successCallback, errorCallback: this.errorCallback, - notificationCallback: isMakingRequest => { + notificationCallback: (isMakingRequest) => { this.isMakingRequest = isMakingRequest; }, }); diff --git a/app/assets/javascripts/environments/stores/environments_store.js b/app/assets/javascripts/environments/stores/environments_store.js index 1992e753255..6ef8b9f643f 100644 --- a/app/assets/javascripts/environments/stores/environments_store.js +++ b/app/assets/javascripts/environments/stores/environments_store.js @@ -46,9 +46,9 @@ export default class EnvironmentsStore { * @returns {Array} */ storeEnvironments(environments = []) { - const filteredEnvironments = environments.map(env => { + const filteredEnvironments = environments.map((env) => { const oldEnvironmentState = - this.state.environments.find(element => { + this.state.environments.find((element) => { if (env.latest) { return element.id === env.latest.id; } @@ -163,7 +163,7 @@ export default class EnvironmentsStore { * @return {Object} */ setfolderContent(folder, environments) { - const updatedEnvironments = environments.map(env => { + const updatedEnvironments = environments.map((env) => { let updated = env; if (env.latest) { @@ -192,7 +192,7 @@ export default class EnvironmentsStore { updateEnvironmentProp(environment, prop, newValue) { const { environments } = this.state; - const updatedEnvironments = environments.map(env => { + const updatedEnvironments = environments.map((env) => { const updateEnv = { ...env }; if (env.id === environment.id) { updateEnv[prop] = newValue; @@ -207,6 +207,6 @@ export default class EnvironmentsStore { getOpenFolders() { const { environments } = this.state; - return environments.filter(env => env.isFolder && env.isOpen); + return environments.filter((env) => env.isFolder && env.isOpen); } } diff --git a/app/assets/javascripts/error_tracking/components/error_details.vue b/app/assets/javascripts/error_tracking/components/error_details.vue index 8272260705b..e21c6b62b91 100644 --- a/app/assets/javascripts/error_tracking/components/error_details.vue +++ b/app/assets/javascripts/error_tracking/components/error_details.vue @@ -87,7 +87,7 @@ export default { }; }, pollInterval: 2000, - update: data => data.project.sentryErrors.detailedError, + update: (data) => data.project.sentryErrors.detailedError, error: () => createFlash(__('Failed to load error details from Sentry.')), result(res) { if (res.data.project?.sentryErrors?.detailedError) { @@ -213,7 +213,7 @@ export default { this.errorStatus === errorStatus.RESOLVED ? errorStatus.UNRESOLVED : errorStatus.RESOLVED; // eslint-disable-next-line promise/catch-or-return - this.updateResolveStatus({ endpoint: this.issueUpdatePath, status }).then(res => { + this.updateResolveStatus({ endpoint: this.issueUpdatePath, status }).then((res) => { this.closedIssueId = res.closed_issue_iid; if (this.closedIssueId) { this.isAlertVisible = true; diff --git a/app/assets/javascripts/error_tracking/store/actions.js b/app/assets/javascripts/error_tracking/store/actions.js index b52405248d8..8f1e7e0b959 100644 --- a/app/assets/javascripts/error_tracking/store/actions.js +++ b/app/assets/javascripts/error_tracking/store/actions.js @@ -11,7 +11,7 @@ export const setStatus = ({ commit }, status) => { export const updateStatus = ({ commit }, { endpoint, redirectUrl, status }) => service .updateErrorStatus(endpoint, status) - .then(resp => { + .then((resp) => { commit(types.SET_ERROR_STATUS, status); if (redirectUrl) visitUrl(redirectUrl); diff --git a/app/assets/javascripts/error_tracking/store/details/actions.js b/app/assets/javascripts/error_tracking/store/details/actions.js index df5be5224a7..394dec938cf 100644 --- a/app/assets/javascripts/error_tracking/store/details/actions.js +++ b/app/assets/javascripts/error_tracking/store/details/actions.js @@ -6,7 +6,7 @@ import { __ } from '~/locale'; let stackTracePoll; -const stopPolling = poll => { +const stopPolling = (poll) => { if (poll) poll.stop(); }; diff --git a/app/assets/javascripts/error_tracking/store/details/getters.js b/app/assets/javascripts/error_tracking/store/details/getters.js index a3b31436c81..4e159b3931f 100644 --- a/app/assets/javascripts/error_tracking/store/details/getters.js +++ b/app/assets/javascripts/error_tracking/store/details/getters.js @@ -1,4 +1,4 @@ -export const stacktrace = state => +export const stacktrace = (state) => state.stacktraceData.stack_trace_entries ? state.stacktraceData.stack_trace_entries.reverse() : []; diff --git a/app/assets/javascripts/error_tracking/store/list/mutations.js b/app/assets/javascripts/error_tracking/store/list/mutations.js index be0cd4de78d..84a62fa9024 100644 --- a/app/assets/javascripts/error_tracking/store/list/mutations.js +++ b/app/assets/javascripts/error_tracking/store/list/mutations.js @@ -17,7 +17,7 @@ export default { return; } // remove any existing item, then add it to the start of the list - const recentSearches = state.recentSearches.filter(s => s !== searchTerm); + const recentSearches = state.recentSearches.filter((s) => s !== searchTerm); recentSearches.unshift(searchTerm); // only keep the last 5 state.recentSearches = recentSearches.slice(0, 5); @@ -60,7 +60,7 @@ export default { state.endpoint = endpoint; }, [types.REMOVE_IGNORED_RESOLVED_ERRORS](state, error) { - state.errors = state.errors.filter(err => err.id !== error); + state.errors = state.errors.filter((err) => err.id !== error); }, [types.SET_STATUS_FILTER](state, query) { state.statusFilter = query; diff --git a/app/assets/javascripts/error_tracking/utils.js b/app/assets/javascripts/error_tracking/utils.js index 5b705cc5510..aeed5450022 100644 --- a/app/assets/javascripts/error_tracking/utils.js +++ b/app/assets/javascripts/error_tracking/utils.js @@ -4,7 +4,7 @@ * Tracks snowplow event when User clicks on error link to Sentry * @param {String} externalUrl that will be send as a property for the event */ -export const trackClickErrorLinkToSentryOptions = url => ({ +export const trackClickErrorLinkToSentryOptions = (url) => ({ category: 'Error Tracking', action: 'click_error_link_to_sentry', label: 'Error Link', @@ -30,7 +30,7 @@ export const trackErrorDetailsViewsOptions = { /** * Tracks snowplow event when error status is updated */ -export const trackErrorStatusUpdateOptions = status => ({ +export const trackErrorStatusUpdateOptions = (status) => ({ category: 'Error Tracking', action: `update_${status}_status`, }); diff --git a/app/assets/javascripts/error_tracking_settings/store/actions.js b/app/assets/javascripts/error_tracking_settings/store/actions.js index 27433178c8e..2821798f82d 100644 --- a/app/assets/javascripts/error_tracking_settings/store/actions.js +++ b/app/assets/javascripts/error_tracking_settings/store/actions.js @@ -63,7 +63,7 @@ export const updateSettings = ({ dispatch, state }) => { .then(() => { refreshCurrentPage(); }) - .catch(err => { + .catch((err) => { dispatch('receiveSettingsError', err); }); }; diff --git a/app/assets/javascripts/error_tracking_settings/store/getters.js b/app/assets/javascripts/error_tracking_settings/store/getters.js index a02a4310ab9..30828778574 100644 --- a/app/assets/javascripts/error_tracking_settings/store/getters.js +++ b/app/assets/javascripts/error_tracking_settings/store/getters.js @@ -2,12 +2,12 @@ import { isMatch } from 'lodash'; import { __, s__, sprintf } from '~/locale'; import { getDisplayName } from '../utils'; -export const hasProjects = state => Boolean(state.projects) && state.projects.length > 0; +export const hasProjects = (state) => Boolean(state.projects) && state.projects.length > 0; export const isProjectInvalid = (state, getters) => Boolean(state.selectedProject) && getters.hasProjects && - !state.projects.some(project => isMatch(state.selectedProject, project)); + !state.projects.some((project) => isMatch(state.selectedProject, project)); export const dropdownLabel = (state, getters) => { if (state.selectedProject !== null) { @@ -19,7 +19,7 @@ export const dropdownLabel = (state, getters) => { return s__('ErrorTracking|Select project'); }; -export const invalidProjectLabel = state => { +export const invalidProjectLabel = (state) => { if (state.selectedProject) { return sprintf( __('Project "%{name}" is no longer available. Select another project to continue.'), @@ -31,7 +31,7 @@ export const invalidProjectLabel = state => { return ''; }; -export const projectSelectionLabel = state => { +export const projectSelectionLabel = (state) => { if (state.token) { return s__( "ErrorTracking|Click 'Connect' to re-establish the connection to Sentry and activate the dropdown.", diff --git a/app/assets/javascripts/error_tracking_settings/store/mutations.js b/app/assets/javascripts/error_tracking_settings/store/mutations.js index e1986eb694b..1fc028093c1 100644 --- a/app/assets/javascripts/error_tracking_settings/store/mutations.js +++ b/app/assets/javascripts/error_tracking_settings/store/mutations.js @@ -12,7 +12,7 @@ export default { .map(convertObjectPropsToCamelCase) // The `pick` strips out extra properties returned from Sentry. // Such properties could be problematic later, e.g. when checking whether `projects` contains `selectedProject` - .map(project => pick(project, projectKeys)); + .map((project) => pick(project, projectKeys)); }, [types.RESET_CONNECT](state) { state.connectSuccessful = false; diff --git a/app/assets/javascripts/error_tracking_settings/utils.js b/app/assets/javascripts/error_tracking_settings/utils.js index 9a09702a030..5d18ac8e802 100644 --- a/app/assets/javascripts/error_tracking_settings/utils.js +++ b/app/assets/javascripts/error_tracking_settings/utils.js @@ -13,4 +13,4 @@ export const transformFrontendSettings = ({ apiHost, enabled, token, selectedPro return { api_host: apiHost || null, enabled, token: token || null, project }; }; -export const getDisplayName = project => `${project.organizationName} | ${project.slug}`; +export const getDisplayName = (project) => `${project.organizationName} | ${project.slug}`; diff --git a/app/assets/javascripts/experimental_flags.js b/app/assets/javascripts/experimental_flags.js index 42b3fb8c6da..1d60847147b 100644 --- a/app/assets/javascripts/experimental_flags.js +++ b/app/assets/javascripts/experimental_flags.js @@ -2,7 +2,7 @@ import $ from 'jquery'; import Cookies from 'js-cookie'; export default () => { - $('.js-experiment-feature-toggle').on('change', e => { + $('.js-experiment-feature-toggle').on('change', (e) => { const el = e.target; Cookies.set(el.name, el.value, { diff --git a/app/assets/javascripts/feature_flags/components/edit_feature_flag.vue b/app/assets/javascripts/feature_flags/components/edit_feature_flag.vue index b89e9723606..26f12318fe3 100644 --- a/app/assets/javascripts/feature_flags/components/edit_feature_flag.vue +++ b/app/assets/javascripts/feature_flags/components/edit_feature_flag.vue @@ -122,7 +122,7 @@ export default { :submit-text="__('Save changes')" :active="active" :version="version" - @handleSubmit="data => updateFeatureFlag(data)" + @handleSubmit="(data) => updateFeatureFlag(data)" /> </template> </div> diff --git a/app/assets/javascripts/feature_flags/components/feature_flags.vue b/app/assets/javascripts/feature_flags/components/feature_flags.vue index fe327a98605..ddeefd7b827 100644 --- a/app/assets/javascripts/feature_flags/components/feature_flags.vue +++ b/app/assets/javascripts/feature_flags/components/feature_flags.vue @@ -133,7 +133,7 @@ export default { }, updateFeatureFlagOptions(parameters) { const queryString = Object.keys(parameters) - .map(parameter => { + .map((parameter) => { const value = parameters[parameter]; return `${parameter}=${encodeURIComponent(value)}`; }) diff --git a/app/assets/javascripts/feature_flags/components/feature_flags_table.vue b/app/assets/javascripts/feature_flags/components/feature_flags_table.vue index ba46bab2df0..15836d2311f 100644 --- a/app/assets/javascripts/feature_flags/components/feature_flags_table.vue +++ b/app/assets/javascripts/feature_flags/components/feature_flags_table.vue @@ -100,7 +100,7 @@ export default { return featureFlag.iid ? `^${featureFlag.iid}` : ''; }, canDeleteFlag(flag) { - return !this.permissions || (flag.scopes || []).every(scope => scope.can_update); + return !this.permissions || (flag.scopes || []).every((scope) => scope.can_update); }, setDeleteModalData(featureFlag) { this.deleteFeatureFlagUrl = featureFlag.destroy_path; diff --git a/app/assets/javascripts/feature_flags/components/form.vue b/app/assets/javascripts/feature_flags/components/form.vue index 12856b79f63..804c644f129 100644 --- a/app/assets/javascripts/feature_flags/components/form.vue +++ b/app/assets/javascripts/feature_flags/components/form.vue @@ -117,7 +117,7 @@ export default { formDescription: this.description, // operate on a clone to avoid mutating props - formScopes: this.scopes.map(s => ({ ...s })), + formScopes: this.scopes.map((s) => ({ ...s })), formStrategies: cloneDeep(this.strategies), newScope: '', @@ -125,13 +125,13 @@ export default { }, computed: { filteredScopes() { - return this.formScopes.filter(scope => !scope.shouldBeDestroyed); + return this.formScopes.filter((scope) => !scope.shouldBeDestroyed); }, filteredStrategies() { - return this.formStrategies.filter(s => !s.shouldBeDestroyed); + return this.formStrategies.filter((s) => !s.shouldBeDestroyed); }, canUpdateFlag() { - return !this.permissionsFlag || (this.formScopes || []).every(scope => scope.canUpdate); + return !this.permissionsFlag || (this.formScopes || []).every((scope) => scope.canUpdate); }, permissionsFlag() { return this.glFeatures.featureFlagPermissions; @@ -167,7 +167,7 @@ export default { if (isNumber(s.id)) { Vue.set(s, 'shouldBeDestroyed', true); } else { - this.formStrategies = this.formStrategies.filter(strategy => strategy !== s); + this.formStrategies = this.formStrategies.filter((strategy) => strategy !== s); } }, @@ -188,7 +188,7 @@ export default { */ removeScope(scope) { if (isString(scope.id) && scope.id.startsWith(INTERNAL_ID_PREFIX)) { - this.formScopes = this.formScopes.filter(s => s !== scope); + this.formScopes = this.formScopes.filter((s) => s !== scope); } else { Vue.set(scope, 'shouldBeDestroyed', true); } @@ -387,9 +387,9 @@ export default { class="col-12" :value="scope.environmentScope" :disabled="!canUpdateScope(scope) || scope.environmentScope !== ''" - @selectEnvironment="env => (scope.environmentScope = env)" - @createClicked="env => (scope.environmentScope = env)" - @clearInput="env => (scope.environmentScope = '')" + @selectEnvironment="(env) => (scope.environmentScope = env)" + @createClicked="(env) => (scope.environmentScope = env)" + @clearInput="(env) => (scope.environmentScope = '')" /> <gl-badge v-if="permissionsFlag && scope.protected" variant="success"> @@ -406,7 +406,7 @@ export default { <toggle-button :value="scope.active" :disabled-input="!active || !canUpdateScope(scope)" - @change="status => (scope.active = status)" + @change="(status) => (scope.active = status)" /> </div> </div> @@ -524,8 +524,8 @@ export default { <environments-dropdown class="js-new-scope-name col-12" :value="newScope" - @selectEnvironment="env => createNewScope({ environmentScope: env })" - @createClicked="env => createNewScope({ environmentScope: env })" + @selectEnvironment="(env) => createNewScope({ environmentScope: env })" + @createClicked="(env) => createNewScope({ environmentScope: env })" /> </div> </div> diff --git a/app/assets/javascripts/feature_flags/components/new_feature_flag.vue b/app/assets/javascripts/feature_flags/components/new_feature_flag.vue index e6949d8028b..529fefd7e45 100644 --- a/app/assets/javascripts/feature_flags/components/new_feature_flag.vue +++ b/app/assets/javascripts/feature_flags/components/new_feature_flag.vue @@ -71,7 +71,7 @@ export default { :scopes="scopes" :strategies="strategies" :version="version" - @handleSubmit="data => createFeatureFlag(data)" + @handleSubmit="(data) => createFeatureFlag(data)" /> </div> </template> diff --git a/app/assets/javascripts/feature_flags/store/edit/actions.js b/app/assets/javascripts/feature_flags/store/edit/actions.js index 3678c2f7788..c4515e07a00 100644 --- a/app/assets/javascripts/feature_flags/store/edit/actions.js +++ b/app/assets/javascripts/feature_flags/store/edit/actions.js @@ -29,7 +29,7 @@ export const updateFeatureFlag = ({ state, dispatch }, params) => { dispatch('receiveUpdateFeatureFlagSuccess'); visitUrl(state.path); }) - .catch(error => dispatch('receiveUpdateFeatureFlagError', error.response.data)); + .catch((error) => dispatch('receiveUpdateFeatureFlagError', error.response.data)); }; export const requestUpdateFeatureFlag = ({ commit }) => commit(types.REQUEST_UPDATE_FEATURE_FLAG); diff --git a/app/assets/javascripts/feature_flags/store/edit/index.js b/app/assets/javascripts/feature_flags/store/edit/index.js index 81edc791924..65ea61c3025 100644 --- a/app/assets/javascripts/feature_flags/store/edit/index.js +++ b/app/assets/javascripts/feature_flags/store/edit/index.js @@ -4,7 +4,7 @@ import state from './state'; import * as actions from './actions'; import mutations from './mutations'; -export default data => +export default (data) => new Vuex.Store({ actions, mutations, diff --git a/app/assets/javascripts/feature_flags/store/gitlab_user_list/actions.js b/app/assets/javascripts/feature_flags/store/gitlab_user_list/actions.js index d4587713fed..a834524df6c 100644 --- a/app/assets/javascripts/feature_flags/store/gitlab_user_list/actions.js +++ b/app/assets/javascripts/feature_flags/store/gitlab_user_list/actions.js @@ -1,14 +1,14 @@ import Api from '~/api'; import * as types from './mutation_types'; -const getErrorMessages = error => [].concat(error?.response?.data?.message ?? error.message); +const getErrorMessages = (error) => [].concat(error?.response?.data?.message ?? error.message); export const fetchUserLists = ({ commit, state: { filter, projectId } }) => { commit(types.FETCH_USER_LISTS); return Api.searchFeatureFlagUserLists(projectId, filter) .then(({ data }) => commit(types.RECEIVE_USER_LISTS_SUCCESS, data)) - .catch(error => commit(types.RECEIVE_USER_LISTS_ERROR, getErrorMessages(error))); + .catch((error) => commit(types.RECEIVE_USER_LISTS_ERROR, getErrorMessages(error))); }; export const setFilter = ({ commit, dispatch }, filter) => { diff --git a/app/assets/javascripts/feature_flags/store/gitlab_user_list/index.js b/app/assets/javascripts/feature_flags/store/gitlab_user_list/index.js index d25b574981f..5f2726770d5 100644 --- a/app/assets/javascripts/feature_flags/store/gitlab_user_list/index.js +++ b/app/assets/javascripts/feature_flags/store/gitlab_user_list/index.js @@ -3,7 +3,7 @@ import mutations from './mutations'; import * as actions from './actions'; import * as getters from './getters'; -export default data => ({ +export default (data) => ({ state: state(data), actions, getters, diff --git a/app/assets/javascripts/feature_flags/store/helpers.js b/app/assets/javascripts/feature_flags/store/helpers.js index d42e5c504db..2fa20e25f4e 100644 --- a/app/assets/javascripts/feature_flags/store/helpers.js +++ b/app/assets/javascripts/feature_flags/store/helpers.js @@ -17,16 +17,16 @@ import { * objects that is easier/nicer to bind to in Vue. * @param {Array} scopesFromRails An array of scope objects fetched from the API */ -export const mapToScopesViewModel = scopesFromRails => - (scopesFromRails || []).map(s => { +export const mapToScopesViewModel = (scopesFromRails) => + (scopesFromRails || []).map((s) => { const percentStrategy = (s.strategies || []).find( - strat => strat.name === ROLLOUT_STRATEGY_PERCENT_ROLLOUT, + (strat) => strat.name === ROLLOUT_STRATEGY_PERCENT_ROLLOUT, ); const rolloutPercentage = fetchPercentageParams(percentStrategy) || DEFAULT_PERCENT_ROLLOUT; const userStrategy = (s.strategies || []).find( - strat => strat.name === ROLLOUT_STRATEGY_USER_ID, + (strat) => strat.name === ROLLOUT_STRATEGY_USER_ID, ); const rolloutStrategy = @@ -36,7 +36,7 @@ export const mapToScopesViewModel = scopesFromRails => const rolloutUserIds = (fetchUserIdParams(userStrategy) || '') .split(',') - .filter(id => id) + .filter((id) => id) .join(', '); return { @@ -59,8 +59,8 @@ export const mapToScopesViewModel = scopesFromRails => * the shape that the Rails API expects. * @param {Array} scopesFromVue An array of scope objects from the Vue component */ -export const mapFromScopesViewModel = params => { - const scopes = (params.scopes || []).map(s => { +export const mapFromScopesViewModel = (params) => { + const scopes = (params.scopes || []).map((s) => { const parameters = {}; if (s.rolloutStrategy === ROLLOUT_STRATEGY_PERCENT_ROLLOUT) { parameters.groupId = PERCENT_ROLLOUT_GROUP_ID; @@ -145,32 +145,32 @@ export const createNewEnvironmentScope = (overrides = {}, featureFlagPermissions return newScope; }; -const mapStrategyScopesToRails = scopes => +const mapStrategyScopesToRails = (scopes) => scopes.length === 0 ? [{ environment_scope: '*' }] - : scopes.map(s => ({ + : scopes.map((s) => ({ id: s.id, _destroy: s.shouldBeDestroyed, environment_scope: s.environmentScope, })); -const mapStrategyScopesToView = scopes => - scopes.map(s => ({ +const mapStrategyScopesToView = (scopes) => + scopes.map((s) => ({ id: s.id, // eslint-disable-next-line no-underscore-dangle shouldBeDestroyed: Boolean(s._destroy), environmentScope: s.environment_scope, })); -const mapStrategiesParametersToViewModel = params => { +const mapStrategiesParametersToViewModel = (params) => { if (params.userIds) { return { ...params, userIds: params.userIds.split(',').join(', ') }; } return params; }; -export const mapStrategiesToViewModel = strategiesFromRails => - (strategiesFromRails || []).map(s => ({ +export const mapStrategiesToViewModel = (strategiesFromRails) => + (strategiesFromRails || []).map((s) => ({ id: s.id, name: s.name, parameters: mapStrategiesParametersToViewModel(s.parameters), @@ -180,14 +180,14 @@ export const mapStrategiesToViewModel = strategiesFromRails => scopes: mapStrategyScopesToView(s.scopes), })); -const mapStrategiesParametersToRails = params => { +const mapStrategiesParametersToRails = (params) => { if (params.userIds) { return { ...params, userIds: params.userIds.replace(/\s*,\s*/g, ',') }; } return params; }; -const mapStrategyToRails = strategy => { +const mapStrategyToRails = (strategy) => { const mappedStrategy = { id: strategy.id, name: strategy.name, @@ -202,7 +202,7 @@ const mapStrategyToRails = strategy => { return mappedStrategy; }; -export const mapStrategiesToRails = params => ({ +export const mapStrategiesToRails = (params) => ({ operations_feature_flag: { name: params.name, description: params.description, diff --git a/app/assets/javascripts/feature_flags/store/index/actions.js b/app/assets/javascripts/feature_flags/store/index/actions.js index a8c1a72c016..6b6b3d55e16 100644 --- a/app/assets/javascripts/feature_flags/store/index/actions.js +++ b/app/assets/javascripts/feature_flags/store/index/actions.js @@ -12,7 +12,7 @@ export const fetchFeatureFlags = ({ state, dispatch }) => { .get(state.endpoint, { params: state.options, }) - .then(response => + .then((response) => dispatch('receiveFeatureFlagsSuccess', { data: response.data || {}, headers: response.headers, @@ -46,7 +46,7 @@ export const toggleFeatureFlag = ({ dispatch }, flag) => { .put(flag.update_path, { operations_feature_flag: flag, }) - .then(response => dispatch('receiveUpdateFeatureFlagSuccess', response.data)) + .then((response) => dispatch('receiveUpdateFeatureFlagSuccess', response.data)) .catch(() => dispatch('receiveUpdateFeatureFlagError', flag.id)); }; @@ -62,7 +62,7 @@ export const deleteUserList = ({ state, dispatch }, list) => { return Api.deleteFeatureFlagUserList(state.projectId, list.iid) .then(() => dispatch('fetchUserLists')) - .catch(error => + .catch((error) => dispatch('receiveDeleteUserListError', { list, error: error?.response?.data ?? error, diff --git a/app/assets/javascripts/feature_flags/store/index/index.js b/app/assets/javascripts/feature_flags/store/index/index.js index f737e0517fc..76495a33232 100644 --- a/app/assets/javascripts/feature_flags/store/index/index.js +++ b/app/assets/javascripts/feature_flags/store/index/index.js @@ -3,7 +3,7 @@ import state from './state'; import * as actions from './actions'; import mutations from './mutations'; -export default data => +export default (data) => new Vuex.Store({ actions, mutations, diff --git a/app/assets/javascripts/feature_flags/store/index/mutations.js b/app/assets/javascripts/feature_flags/store/index/mutations.js index 3daa204f560..910b2ec42d4 100644 --- a/app/assets/javascripts/feature_flags/store/index/mutations.js +++ b/app/assets/javascripts/feature_flags/store/index/mutations.js @@ -4,7 +4,7 @@ import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils'; import { FEATURE_FLAG_SCOPE, USER_LIST_SCOPE } from '../../constants'; import { mapToScopesViewModel } from '../helpers'; -const mapFlag = flag => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []) }); +const mapFlag = (flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []) }); const updateFlag = (state, flag) => { const index = state[FEATURE_FLAG_SCOPE].findIndex(({ id }) => id === flag.id); @@ -94,7 +94,7 @@ export default { updateFlag(state, { ...flag, active: !flag.active }); }, [types.REQUEST_DELETE_USER_LIST](state, list) { - state.userLists = state.userLists.filter(l => l !== list); + state.userLists = state.userLists.filter((l) => l !== list); }, [types.RECEIVE_DELETE_USER_LIST_ERROR](state, { error, list }) { state.isLoading = false; diff --git a/app/assets/javascripts/feature_flags/store/new/actions.js b/app/assets/javascripts/feature_flags/store/new/actions.js index e21c128cd39..6d595603819 100644 --- a/app/assets/javascripts/feature_flags/store/new/actions.js +++ b/app/assets/javascripts/feature_flags/store/new/actions.js @@ -27,7 +27,7 @@ export const createFeatureFlag = ({ state, dispatch }, params) => { dispatch('receiveCreateFeatureFlagSuccess'); visitUrl(state.path); }) - .catch(error => dispatch('receiveCreateFeatureFlagError', error.response.data)); + .catch((error) => dispatch('receiveCreateFeatureFlagError', error.response.data)); }; export const requestCreateFeatureFlag = ({ commit }) => commit(types.REQUEST_CREATE_FEATURE_FLAG); diff --git a/app/assets/javascripts/feature_flags/store/new/index.js b/app/assets/javascripts/feature_flags/store/new/index.js index 81edc791924..65ea61c3025 100644 --- a/app/assets/javascripts/feature_flags/store/new/index.js +++ b/app/assets/javascripts/feature_flags/store/new/index.js @@ -4,7 +4,7 @@ import state from './state'; import * as actions from './actions'; import mutations from './mutations'; -export default data => +export default (data) => new Vuex.Store({ actions, mutations, diff --git a/app/assets/javascripts/feature_flags/utils.js b/app/assets/javascripts/feature_flags/utils.js index 24c570657e6..e77cb8406cc 100644 --- a/app/assets/javascripts/feature_flags/utils.js +++ b/app/assets/javascripts/feature_flags/utils.js @@ -48,7 +48,7 @@ const badgeTextByType = { const scopeName = ({ environment_scope: scope }) => scope === ALL_ENVIRONMENTS_NAME ? s__('FeatureFlags|All Environments') : scope; -export const labelForStrategy = strategy => { +export const labelForStrategy = (strategy) => { const { name, parameters } = badgeTextByType[strategy.name]; if (parameters) { diff --git a/app/assets/javascripts/feature_highlight/feature_highlight.js b/app/assets/javascripts/feature_highlight/feature_highlight.js index be55e6923c6..2da9aadd2b1 100644 --- a/app/assets/javascripts/feature_highlight/feature_highlight.js +++ b/app/assets/javascripts/feature_highlight/feature_highlight.js @@ -31,7 +31,7 @@ export function setupFeatureHighlightPopover(id, debounceTimeout = 300) { .removeAttr('disabled'); } -const getPriority = e => parseInt(e.dataset.highlightPriority, 10) || 0; +const getPriority = (e) => parseInt(e.dataset.highlightPriority, 10) || 0; export function findHighestPriorityFeature() { let priorityFeature; diff --git a/app/assets/javascripts/feature_highlight/feature_highlight_helper.js b/app/assets/javascripts/feature_highlight/feature_highlight_helper.js index cfadfb26db2..fabc905d756 100644 --- a/app/assets/javascripts/feature_highlight/feature_highlight_helper.js +++ b/app/assets/javascripts/feature_highlight/feature_highlight_helper.js @@ -5,7 +5,7 @@ import { deprecatedCreateFlash as Flash } from '../flash'; import LazyLoader from '../lazy_loader'; import { togglePopover } from '../shared/popover'; -export const getSelector = highlightId => `.js-feature-highlight[data-highlight=${highlightId}]`; +export const getSelector = (highlightId) => `.js-feature-highlight[data-highlight=${highlightId}]`; export function dismiss(highlightId) { axios diff --git a/app/assets/javascripts/file_pickers.js b/app/assets/javascripts/file_pickers.js index 956a4954afb..fa5a5f14adb 100644 --- a/app/assets/javascripts/file_pickers.js +++ b/app/assets/javascripts/file_pickers.js @@ -1,7 +1,7 @@ export default function initFilePickers() { const filePickers = document.querySelectorAll('.js-filepicker'); - filePickers.forEach(filePicker => { + filePickers.forEach((filePicker) => { const button = filePicker.querySelector('.js-filepicker-button'); button.addEventListener('click', () => { diff --git a/app/assets/javascripts/files_comment_button.js b/app/assets/javascripts/files_comment_button.js index aad5647c045..0d7a475eb8e 100644 --- a/app/assets/javascripts/files_comment_button.js +++ b/app/assets/javascripts/files_comment_button.js @@ -33,8 +33,8 @@ export default { if (this.userCanCreateNote) { $diffFile - .on('mouseover', LINE_COLUMN_CLASSES, e => this.showButton(this.isParallelView, e)) - .on('mouseleave', LINE_COLUMN_CLASSES, e => this.hideButton(this.isParallelView, e)); + .on('mouseover', LINE_COLUMN_CLASSES, (e) => this.showButton(this.isParallelView, e)) + .on('mouseleave', LINE_COLUMN_CLASSES, (e) => this.hideButton(this.isParallelView, e)); } }, diff --git a/app/assets/javascripts/filterable_list.js b/app/assets/javascripts/filterable_list.js index eabf3b0846e..a8670caf5b2 100644 --- a/app/assets/javascripts/filterable_list.js +++ b/app/assets/javascripts/filterable_list.js @@ -72,7 +72,7 @@ export default class FilterableList { .get(this.getFilterEndpoint(), { params, }) - .then(res => { + .then((res) => { this.onFilterSuccess(res, params); this.onFilterComplete(); }) diff --git a/app/assets/javascripts/filtered_search/available_dropdown_mappings.js b/app/assets/javascripts/filtered_search/available_dropdown_mappings.js index f6930e811f5..588bd534224 100644 --- a/app/assets/javascripts/filtered_search/available_dropdown_mappings.js +++ b/app/assets/javascripts/filtered_search/available_dropdown_mappings.js @@ -50,7 +50,7 @@ export default class AvailableDropdownMappings { }, }; - supportedTokens.forEach(type => { + supportedTokens.forEach((type) => { if (availableMappings[type]) { allowedMappings[type] = availableMappings[type]; } @@ -99,7 +99,7 @@ export default class AvailableDropdownMappings { // The DropdownNonUser class is hardcoded to look for and display a // "title" property, so we need to add this property to each release object - preprocessing: releases => releases.map(r => ({ ...r, title: r.tag })), + preprocessing: (releases) => releases.map((r) => ({ ...r, title: r.tag })), }, element: this.container.querySelector('#js-dropdown-release'), }, @@ -162,7 +162,7 @@ export default class AvailableDropdownMappings { extraArguments: { endpoint: this.getEnvironmentsEndpoint(), symbol: '', - preprocessing: data => data.map(env => ({ title: env })), + preprocessing: (data) => data.map((env) => ({ title: env })), }, element: this.container.querySelector('#js-dropdown-environment'), }, diff --git a/app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.vue b/app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.vue index 0c4abc14494..4c2f55fd174 100644 --- a/app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.vue +++ b/app/assets/javascripts/filtered_search/components/recent_searches_dropdown_content.vue @@ -28,16 +28,16 @@ export default { * fix by ignoring non-string recents while in Epic page. */ compatibleItems() { - return this.items.filter(item => typeof item === 'string'); + return this.items.filter((item) => typeof item === 'string'); }, processedItems() { - return this.compatibleItems.map(item => { + return this.compatibleItems.map((item) => { const { tokens, searchToken } = FilteredSearchTokenizer.processTokens( item, this.allowedKeys, ); - const resultantTokens = tokens.map(token => ({ + const resultantTokens = tokens.map((token) => ({ prefix: `${token.key}:`, operator: token.operator, suffix: `${token.symbol}${token.value}`, diff --git a/app/assets/javascripts/filtered_search/dropdown_ajax_filter.js b/app/assets/javascripts/filtered_search/dropdown_ajax_filter.js index 30f412e590f..2c0c3024d38 100644 --- a/app/assets/javascripts/filtered_search/dropdown_ajax_filter.js +++ b/app/assets/javascripts/filtered_search/dropdown_ajax_filter.js @@ -33,7 +33,7 @@ export default class DropdownAjaxFilter extends FilteredSearchDropdown { } itemClicked(e) { - super.itemClicked(e, selected => { + super.itemClicked(e, (selected) => { const title = selected.querySelector('.dropdown-light-content').innerText.trim(); return DropdownUtils.getEscapedText(title); diff --git a/app/assets/javascripts/filtered_search/dropdown_emoji.js b/app/assets/javascripts/filtered_search/dropdown_emoji.js index 1e3679b9e3c..001030b5f5f 100644 --- a/app/assets/javascripts/filtered_search/dropdown_emoji.js +++ b/app/assets/javascripts/filtered_search/dropdown_emoji.js @@ -53,7 +53,7 @@ export default class DropdownEmoji extends FilteredSearchDropdown { } itemClicked(e) { - super.itemClicked(e, selected => { + super.itemClicked(e, (selected) => { const name = selected.querySelector('.js-data-value').innerText.trim(); return DropdownUtils.getEscapedText(name); }); @@ -69,7 +69,7 @@ export default class DropdownEmoji extends FilteredSearchDropdown { // Replace empty gl-emoji tag to real content const dropdownItems = [...this.dropdown.querySelectorAll('.filter-dropdown-item')]; - dropdownItems.forEach(dropdownItem => { + dropdownItems.forEach((dropdownItem) => { const valueElement = dropdownItem.querySelector('.js-data-value'); if (valueElement !== null) { const name = valueElement.innerText; diff --git a/app/assets/javascripts/filtered_search/dropdown_hint.js b/app/assets/javascripts/filtered_search/dropdown_hint.js index 4f10b6ba9c3..1180f8683a1 100644 --- a/app/assets/javascripts/filtered_search/dropdown_hint.js +++ b/app/assets/javascripts/filtered_search/dropdown_hint.js @@ -83,7 +83,7 @@ export default class DropdownHint extends FilteredSearchDropdown { const dropdownData = this.tokenKeys .get() - .map(tokenKey => ({ + .map((tokenKey) => ({ icon: `${gon.sprite_icons}#${tokenKey.icon}`, hint: tokenKey.key, tag: `:${tokenKey.tag}`, diff --git a/app/assets/javascripts/filtered_search/dropdown_non_user.js b/app/assets/javascripts/filtered_search/dropdown_non_user.js index bfa9f4a57ca..11261debeda 100644 --- a/app/assets/javascripts/filtered_search/dropdown_non_user.js +++ b/app/assets/javascripts/filtered_search/dropdown_non_user.js @@ -30,7 +30,7 @@ export default class DropdownNonUser extends FilteredSearchDropdown { } itemClicked(e) { - super.itemClicked(e, selected => { + super.itemClicked(e, (selected) => { const title = selected.querySelector('.js-data-value').innerText.trim(); return `${this.symbol}${DropdownUtils.getEscapedText(title)}`; }); diff --git a/app/assets/javascripts/filtered_search/dropdown_utils.js b/app/assets/javascripts/filtered_search/dropdown_utils.js index 43de86b09ee..22c98f360ed 100644 --- a/app/assets/javascripts/filtered_search/dropdown_utils.js +++ b/app/assets/javascripts/filtered_search/dropdown_utils.js @@ -61,7 +61,7 @@ export default class DropdownUtils { const { lastToken, tokens } = FilteredSearchTokenizer.processTokens(searchInput, allowedKeys); const lastKey = lastToken.key || lastToken || ''; const allowMultiple = item.type === 'array'; - const itemInExistingTokens = tokens.some(t => t.key === item.hint); + const itemInExistingTokens = tokens.some((t) => t.key === item.hint); const isSearchItem = updatedItem.hint === 'search'; if (isSearchItem) { @@ -77,7 +77,7 @@ export default class DropdownUtils { const tokenName = last(split[0].split(' ')); const match = isSearchItem - ? allowedKeys.some(key => key.startsWith(tokenName.toLowerCase())) + ? allowedKeys.some((key) => key.startsWith(tokenName.toLowerCase())) : updatedItem.hint.indexOf(tokenName.toLowerCase()) === -1; updatedItem.droplab_hidden = tokenName ? match : false; @@ -129,12 +129,12 @@ export default class DropdownUtils { const values = []; if (untilInput) { - const inputIndex = tokens.findIndex(t => t.classList.contains('input-token')); + const inputIndex = tokens.findIndex((t) => t.classList.contains('input-token')); // Add one to include input-token to the tokens array tokens.splice(inputIndex + 1); } - tokens.forEach(token => { + tokens.forEach((token) => { if (token.classList.contains('js-visual-token')) { const name = token.querySelector('.name'); const operatorContainer = token.querySelector('.operator'); @@ -176,7 +176,7 @@ export default class DropdownUtils { } }); - return values.map(value => value.trim()).join(' '); + return values.map((value) => value.trim()).join(' '); } static getSearchInput(filteredSearchInput) { @@ -192,7 +192,7 @@ export default class DropdownUtils { // Replace all spaces inside quote marks with underscores // (will continue to match entire string until an end quote is found if any) // This helps with matching the beginning & end of a token:key - inputValue = inputValue.replace(/(('[^']*'{0,1})|("[^"]*"{0,1})|:\s+)/g, str => + inputValue = inputValue.replace(/(('[^']*'{0,1})|("[^"]*"{0,1})|:\s+)/g, (str) => str.replace(/\s/g, '_'), ); diff --git a/app/assets/javascripts/filtered_search/filtered_search_dropdown.js b/app/assets/javascripts/filtered_search/filtered_search_dropdown.js index 8626e1a3d18..7434cc4c5d1 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_dropdown.js +++ b/app/assets/javascripts/filtered_search/filtered_search_dropdown.js @@ -28,7 +28,7 @@ export default class FilteredSearchDropdown { } getCurrentHook() { - return this.droplab.hooks.filter(h => h.id === this.hookId)[0] || null; + return this.droplab.hooks.filter((h) => h.id === this.hookId)[0] || null; } itemClicked(e, getValueFunction) { @@ -134,7 +134,7 @@ export default class FilteredSearchDropdown { if (!data) return; - const results = data.map(o => { + const results = data.map((o) => { const updated = o; updated.droplab_hidden = false; return updated; @@ -157,7 +157,7 @@ export default class FilteredSearchDropdown { // Iterate over all the static dropdown values, // then hide `None` and `Any` items. - Array.from(dropdownEl.querySelectorAll('li[data-value]')).forEach(itemEl => { + Array.from(dropdownEl.querySelectorAll('li[data-value]')).forEach((itemEl) => { const { dataset: { value }, } = itemEl; diff --git a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js index d446e32394b..3c630c26bc7 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js @@ -23,7 +23,7 @@ export default class FilteredSearchDropdownManager { isGroupDecendent, filteredSearchTokenKeys, }) { - const removeTrailingSlash = url => url.replace(/\/$/, ''); + const removeTrailingSlash = (url) => url.replace(/\/$/, ''); this.container = FilteredSearchContainer.container; this.runnerTagsEndpoint = removeTrailingSlash(runnerTagsEndpoint); diff --git a/app/assets/javascripts/filtered_search/filtered_search_manager.js b/app/assets/javascripts/filtered_search/filtered_search_manager.js index 921d686bb28..11b2eb839ce 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_manager.js @@ -90,14 +90,14 @@ export default class FilteredSearchManager { // Fetch recent searches from localStorage this.fetchingRecentSearchesPromise = this.recentSearchesService .fetch() - .catch(error => { + .catch((error) => { if (error.name === 'RecentSearchesServiceError') return undefined; // eslint-disable-next-line no-new new Flash(__('An error occurred while parsing recent searches')); // Gracefully fail to empty array return []; }) - .then(searches => { + .then((searches) => { if (!searches) { return; } @@ -169,7 +169,7 @@ export default class FilteredSearchManager { if (this.stateFilters) { this.searchStateWrapper = this.searchState.bind(this); - this.applyToStateFilters(filterEl => { + this.applyToStateFilters((filterEl) => { filterEl.addEventListener('click', this.searchStateWrapper); }); } @@ -177,14 +177,14 @@ export default class FilteredSearchManager { unbindStateEvents() { if (this.stateFilters) { - this.applyToStateFilters(filterEl => { + this.applyToStateFilters((filterEl) => { filterEl.removeEventListener('click', this.searchStateWrapper); }); } } applyToStateFilters(callback) { - this.stateFilters.querySelectorAll('a[data-state]').forEach(filterEl => { + this.stateFilters.querySelectorAll('a[data-state]').forEach((filterEl) => { if (this.states.indexOf(filterEl.dataset.state) > -1) { callback(filterEl); } @@ -263,7 +263,7 @@ export default class FilteredSearchManager { let backspaceCount = 0; // closure for keeping track of the number of backspace keystrokes - return e => { + return (e) => { // 8 = Backspace Key // 46 = Delete Key // Handled by respective backspace-combination check functions @@ -447,7 +447,7 @@ export default class FilteredSearchManager { const removeElements = []; - [].forEach.call(this.tokensContainer.children, t => { + [].forEach.call(this.tokensContainer.children, (t) => { let canClearToken = t.classList.contains('js-visual-token'); if (canClearToken) { @@ -460,7 +460,7 @@ export default class FilteredSearchManager { } }); - removeElements.forEach(el => { + removeElements.forEach((el) => { el.parentElement.removeChild(el); }); @@ -488,7 +488,7 @@ export default class FilteredSearchManager { const { isLastVisualTokenValid } = FilteredSearchVisualTokens.getLastVisualTokenBeforeInput(); if (isLastVisualTokenValid) { - tokens.forEach(t => { + tokens.forEach((t) => { input.value = input.value.replace(`${t.key}:${t.operator}${t.symbol}${t.value}`, ''); FilteredSearchVisualTokens.addFilterVisualToken( @@ -585,7 +585,7 @@ export default class FilteredSearchManager { */ const notKeyValueRegex = new RegExp(/not\[(\w+)\]\[?\]?=(.*)/); - return params.map(query => { + return params.map((query) => { // Check if there are matches for `not` operator const matches = query.match(notKeyValueRegex); if (matches && matches.length === 3) { @@ -624,7 +624,7 @@ export default class FilteredSearchManager { const usernameParams = this.getUsernameParams(); let hasFilteredSearch = false; - params.forEach(p => { + params.forEach((p) => { const split = p.split('='); const keyParam = decodeURIComponent(split[0]); const value = split[1]; @@ -746,7 +746,7 @@ export default class FilteredSearchManager { paths.push(`state=${currentState}`); } - tokens.forEach(token => { + tokens.forEach((token) => { const condition = this.filteredSearchTokenKeys.searchByConditionKeyValue( token.key, token.operator, @@ -795,7 +795,7 @@ export default class FilteredSearchManager { if (searchToken) { const sanitized = searchToken .split(' ') - .map(t => encodeURIComponent(t)) + .map((t) => encodeURIComponent(t)) .join('+'); paths.push(`search=${sanitized}`); } @@ -817,7 +817,7 @@ export default class FilteredSearchManager { const usernamesById = {}; try { const attribute = this.filteredSearchInput.getAttribute('data-username-params'); - JSON.parse(attribute).forEach(user => { + JSON.parse(attribute).forEach((user) => { usernamesById[user.id] = user.username; }); } catch (e) { diff --git a/app/assets/javascripts/filtered_search/filtered_search_token_keys.js b/app/assets/javascripts/filtered_search/filtered_search_token_keys.js index 89fc8047b65..e766733547a 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_token_keys.js +++ b/app/assets/javascripts/filtered_search/filtered_search_token_keys.js @@ -14,7 +14,7 @@ export default class FilteredSearchTokenKeys { } getKeys() { - return this.tokenKeys.map(i => i.key); + return this.tokenKeys.map((i) => i.key); } getAlternatives() { @@ -36,16 +36,16 @@ export default class FilteredSearchTokenKeys { } searchByKey(key) { - return this.tokenKeys.find(tokenKey => tokenKey.key === key) || null; + return this.tokenKeys.find((tokenKey) => tokenKey.key === key) || null; } searchBySymbol(symbol) { - return this.tokenKeys.find(tokenKey => tokenKey.symbol === symbol) || null; + return this.tokenKeys.find((tokenKey) => tokenKey.symbol === symbol) || null; } searchByKeyParam(keyParam) { return ( - this.tokenKeysWithAlternative.find(tokenKey => { + this.tokenKeysWithAlternative.find((tokenKey) => { let tokenKeyParam = tokenKey.key; // Replace hyphen with underscore to compare keyParam with tokenKeyParam @@ -62,13 +62,13 @@ export default class FilteredSearchTokenKeys { } searchByConditionUrl(url) { - return this.conditions.find(condition => condition.url === url) || null; + return this.conditions.find((condition) => condition.url === url) || null; } searchByConditionKeyValue(key, operator, value) { return ( this.conditions.find( - condition => + (condition) => condition.tokenKey === key && condition.operator === operator && condition.value.toLowerCase() === value.toLowerCase(), diff --git a/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js b/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js index d797e6ecf1d..4e594dfa910 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js +++ b/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js @@ -8,7 +8,7 @@ export default class FilteredSearchVisualTokens { static getOperatorToken(value) { let token = null; - FilteredSearchVisualTokens.permissibleOperatorValues.forEach(operatorToken => { + FilteredSearchVisualTokens.permissibleOperatorValues.forEach((operatorToken) => { if (value.startsWith(operatorToken)) { token = operatorToken; } @@ -20,7 +20,7 @@ export default class FilteredSearchVisualTokens { static getValueToken(value) { let newValue = value; - FilteredSearchVisualTokens.permissibleOperatorValues.forEach(operatorToken => { + FilteredSearchVisualTokens.permissibleOperatorValues.forEach((operatorToken) => { if (value.startsWith(operatorToken)) { newValue = value.slice(operatorToken.length); } @@ -48,7 +48,7 @@ export default class FilteredSearchVisualTokens { const otherTokens = FilteredSearchContainer.container.querySelectorAll( '.js-visual-token .selectable.selected', ); - [].forEach.call(otherTokens, t => t.classList.remove('selected')); + [].forEach.call(otherTokens, (t) => t.classList.remove('selected')); } static selectToken(tokenButton, forceSelection = false) { diff --git a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js index f9388e9c5d8..46867b184c8 100644 --- a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js +++ b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js @@ -150,7 +150,7 @@ export const conditions = flattenDeep( tokenKey: 'my-reaction', value: __('Any'), }, - ].map(condition => { + ].map((condition) => { const [keyPart, valuePart] = condition.url.split('='); const hasBrackets = keyPart.includes('[]'); diff --git a/app/assets/javascripts/lib/utils/unit_format/formatter_factory.js b/app/assets/javascripts/lib/utils/unit_format/formatter_factory.js index 5d3dd79850e..9d47a1b7132 100644 --- a/app/assets/javascripts/lib/utils/unit_format/formatter_factory.js +++ b/app/assets/javascripts/lib/utils/unit_format/formatter_factory.js @@ -106,7 +106,7 @@ export const scaledSIFormatter = (unit = '', prefixOffset = 0) => { const multiplicative = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; const symbols = [...fractional, '', ...multiplicative]; - const units = symbols.slice(fractional.length + prefixOffset).map(prefix => { + const units = symbols.slice(fractional.length + prefixOffset).map((prefix) => { return `${prefix}${unit}`; }); @@ -126,7 +126,7 @@ export const scaledBinaryFormatter = (unit = '', prefixOffset = 0) => { const multiplicative = ['Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi']; const symbols = ['', ...multiplicative]; - const units = symbols.slice(prefixOffset).map(prefix => { + const units = symbols.slice(prefixOffset).map((prefix) => { return `${prefix}${unit}`; }); diff --git a/app/assets/javascripts/lib/utils/url_utility.js b/app/assets/javascripts/lib/utils/url_utility.js index a9f6901de32..44d3e78b334 100644 --- a/app/assets/javascripts/lib/utils/url_utility.js +++ b/app/assets/javascripts/lib/utils/url_utility.js @@ -112,13 +112,13 @@ export function mergeUrlParams(params, url, options = {}) { const mergedKeys = sort ? Object.keys(merged).sort() : Object.keys(merged); const newQuery = mergedKeys - .filter(key => merged[key] !== null) - .map(key => { + .filter((key) => merged[key] !== null) + .map((key) => { let value = merged[key]; const encodedKey = encodeURIComponent(key); if (spreadArrays && Array.isArray(value)) { value = merged[key] - .map(arrayValue => encodeURIComponent(arrayValue)) + .map((arrayValue) => encodeURIComponent(arrayValue)) .join(`&${encodedKey}[]=`); return `${encodedKey}[]=${value}`; } @@ -150,11 +150,11 @@ export function removeParams(params, url = window.location.href, skipEncoding = return url; } - const removableParams = skipEncoding ? params : params.map(param => encodeURIComponent(param)); + const removableParams = skipEncoding ? params : params.map((param) => encodeURIComponent(param)); const updatedQuery = query .split('&') - .filter(paramPair => { + .filter((paramPair) => { const [foundParam] = paramPair.split('='); return removableParams.indexOf(foundParam) < 0; }) @@ -237,7 +237,7 @@ export function redirectTo(url) { return window.location.assign(url); } -export const escapeFileUrl = fileUrl => encodeURIComponent(fileUrl).replace(/%2F/g, '/'); +export const escapeFileUrl = (fileUrl) => encodeURIComponent(fileUrl).replace(/%2F/g, '/'); export function webIDEUrl(route = undefined) { let returnUrl = `${gon.relative_url_root || ''}/-/ide/`; @@ -396,7 +396,7 @@ export function queryToObject(query, options = {}) { */ export function objectToQuery(obj) { return Object.keys(obj) - .map(k => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`) + .map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`) .join('&'); } @@ -420,7 +420,7 @@ export const setUrlParams = ( const queryString = urlObj.search; const searchParams = clearParams ? new URLSearchParams('') : new URLSearchParams(queryString); - Object.keys(params).forEach(key => { + Object.keys(params).forEach((key) => { if (params[key] === null || params[key] === undefined) { searchParams.delete(key); } else if (Array.isArray(params[key])) { diff --git a/app/assets/javascripts/line_highlighter.js b/app/assets/javascripts/line_highlighter.js index 3760dc60d0f..314ade0dc3e 100644 --- a/app/assets/javascripts/line_highlighter.js +++ b/app/assets/javascripts/line_highlighter.js @@ -55,7 +55,7 @@ LineHighlighter.prototype.bindEvents = function () { $fileHolder.on('click', 'a[data-line-number]', this.clickHandler); $fileHolder.on('highlight:line', this.highlightHash); - window.addEventListener('hashchange', e => this.highlightHash(e.target.location.hash)); + window.addEventListener('hashchange', (e) => this.highlightHash(e.target.location.hash)); }; LineHighlighter.prototype.highlightHash = function (newHash) { diff --git a/app/assets/javascripts/locale/ensure_single_line.js b/app/assets/javascripts/locale/ensure_single_line.js index 47c52fe6c50..c2c63777001 100644 --- a/app/assets/javascripts/locale/ensure_single_line.js +++ b/app/assets/javascripts/locale/ensure_single_line.js @@ -18,7 +18,7 @@ module.exports = function ensureSingleLine(str) { if (str.includes('\n') || str.includes('\r')) { return str .split(SPLIT_REGEX) - .filter(s => s !== '') + .filter((s) => s !== '') .join(' '); } return str; diff --git a/app/assets/javascripts/locale/index.js b/app/assets/javascripts/locale/index.js index 41aa0f4ddb9..35087b920c7 100644 --- a/app/assets/javascripts/locale/index.js +++ b/app/assets/javascripts/locale/index.js @@ -11,7 +11,7 @@ delete window.translations; @param text The text to be translated @returns {String} The translated text */ -const gettext = text => locale.gettext(ensureSingleLine(text)); +const gettext = (text) => locale.gettext(ensureSingleLine(text)); /** Translate the text with a number @@ -56,7 +56,7 @@ const pgettext = (keyOrContext, key) => { @param formatOptions for available options, please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat @returns {Intl.DateTimeFormat} */ -const createDateTimeFormat = formatOptions => Intl.DateTimeFormat(languageCode(), formatOptions); +const createDateTimeFormat = (formatOptions) => Intl.DateTimeFormat(languageCode(), formatOptions); export { languageCode }; export { gettext as __ }; diff --git a/app/assets/javascripts/locale/sprintf.js b/app/assets/javascripts/locale/sprintf.js index b4658a159d7..82fc816fe9e 100644 --- a/app/assets/javascripts/locale/sprintf.js +++ b/app/assets/javascripts/locale/sprintf.js @@ -15,7 +15,7 @@ export default (input, parameters, escapeParameters = true) => { let output = input; if (parameters) { - Object.keys(parameters).forEach(parameterName => { + Object.keys(parameters).forEach((parameterName) => { const parameterValue = parameters[parameterName]; const escapedParameterValue = escapeParameters ? escape(parameterValue) : parameterValue; output = output.replace(new RegExp(`%{${parameterName}}`, 'g'), escapedParameterValue); diff --git a/app/assets/javascripts/logs/components/log_advanced_filters.vue b/app/assets/javascripts/logs/components/log_advanced_filters.vue index 49bb80b3bfd..37fc4dc3735 100644 --- a/app/assets/javascripts/logs/components/log_advanced_filters.vue +++ b/app/assets/javascripts/logs/components/log_advanced_filters.vue @@ -42,7 +42,7 @@ export default { */ podOptions() { if (this.pods.options.length) { - return this.pods.options.map(podName => ({ value: podName, title: podName })); + return this.pods.options.map((podName) => ({ value: podName, title: podName })); } return null; }, diff --git a/app/assets/javascripts/logs/logs_tracking_helper.js b/app/assets/javascripts/logs/logs_tracking_helper.js index 91b0392f71f..26043d646b0 100644 --- a/app/assets/javascripts/logs/logs_tracking_helper.js +++ b/app/assets/javascripts/logs/logs_tracking_helper.js @@ -8,7 +8,7 @@ import Tracking from '~/tracking'; * 3. Change the time range * 4. Use the search bar */ -const trackLogs = label => +const trackLogs = (label) => Tracking.event(document.body.dataset.page, 'logs_view', { label, property: 'count', diff --git a/app/assets/javascripts/logs/stores/actions.js b/app/assets/javascripts/logs/stores/actions.js index 623516f349d..a26e6f694c9 100644 --- a/app/assets/javascripts/logs/stores/actions.js +++ b/app/assets/javascripts/logs/stores/actions.js @@ -11,14 +11,14 @@ const requestUntilData = (url, params) => backOff((next, stop) => { axios .get(url, { params }) - .then(res => { + .then((res) => { if (res.status === httpStatusCodes.ACCEPTED) { next(); return; } stop(res); }) - .catch(err => { + .catch((err) => { stop(err); }); }); @@ -66,12 +66,12 @@ const requestLogsUntilData = ({ commit, state }) => { const filtersToParams = (filters = []) => { // Strings become part of the `search` const search = filters - .filter(f => typeof f === 'string') + .filter((f) => typeof f === 'string') .join(' ') .trim(); // null podName to show all pods - const podName = filters.find(f => f?.type === TOKEN_TYPE_POD_NAME)?.value?.data ?? null; + const podName = filters.find((f) => f?.type === TOKEN_TYPE_POD_NAME)?.value?.data ?? null; return { search, podName }; }; diff --git a/app/assets/javascripts/logs/stores/getters.js b/app/assets/javascripts/logs/stores/getters.js index dc392af8381..836e6e82385 100644 --- a/app/assets/javascripts/logs/stores/getters.js +++ b/app/assets/javascripts/logs/stores/getters.js @@ -3,9 +3,9 @@ import { formatDate } from '../utils'; const mapTrace = ({ timestamp = null, pod = '', message = '' }) => [timestamp ? formatDate(timestamp) : '', pod, message].join(' | '); -export const trace = state => state.logs.lines.map(mapTrace).join('\n'); +export const trace = (state) => state.logs.lines.map(mapTrace).join('\n'); -export const showAdvancedFilters = state => { +export const showAdvancedFilters = (state) => { if (state.environments.current) { const environment = state.environments.options.find( ({ name }) => name === state.environments.current, diff --git a/app/assets/javascripts/logs/utils.js b/app/assets/javascripts/logs/utils.js index 880f762e225..8e21863dd0c 100644 --- a/app/assets/javascripts/logs/utils.js +++ b/app/assets/javascripts/logs/utils.js @@ -22,4 +22,4 @@ export const getTimeRange = (seconds = 0) => { }; }; -export const formatDate = timestamp => dateFormat(timestamp, dateFormatMask); +export const formatDate = (timestamp) => dateFormat(timestamp, dateFormatMask); diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index c74a25f39fe..ef0fef6085b 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -298,7 +298,7 @@ document.addEventListener('DOMContentLoaded', () => { if (flashContainer && flashContainer.children.length) { flashContainer .querySelectorAll('.flash-alert, .flash-notice, .flash-success') - .forEach(flashEl => { + .forEach((flashEl) => { removeFlashClickListener(flashEl); }); } diff --git a/app/assets/javascripts/manual_ordering.js b/app/assets/javascripts/manual_ordering.js index 559efa4c66c..04eaa0c77c3 100644 --- a/app/assets/javascripts/manual_ordering.js +++ b/app/assets/javascripts/manual_ordering.js @@ -39,7 +39,7 @@ const initManualOrdering = (draggableSelector = 'li.issue') => { onStart: () => { sortableStart(); }, - onUpdate: event => { + onUpdate: (event) => { const el = event.item; const url = el.getAttribute('url') || el.dataset.url; diff --git a/app/assets/javascripts/member_expiration_date.js b/app/assets/javascripts/member_expiration_date.js index de33a68ebf1..a28427eb9ac 100644 --- a/app/assets/javascripts/member_expiration_date.js +++ b/app/assets/javascripts/member_expiration_date.js @@ -24,8 +24,8 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d format: 'yyyy-mm-dd', minDate: new Date(), container: $input.parent().get(0), - parse: dateString => parsePikadayDate(dateString), - toString: date => pikadayToString(date), + parse: (dateString) => parsePikadayDate(dateString), + toString: (date) => pikadayToString(date), onSelect(dateText) { $input.val(calendar.toString(dateText)); diff --git a/app/assets/javascripts/members.js b/app/assets/javascripts/members.js index ab8ed1f4d11..4cf4fdd12bf 100644 --- a/app/assets/javascripts/members.js +++ b/app/assets/javascripts/members.js @@ -46,7 +46,7 @@ export default class Members { return $el.data('id'); }, toggleLabel: (selected, $el) => this.dropdownToggleLabel(selected, $el, $btn), - clicked: options => this.dropdownClicked(options), + clicked: (options) => this.dropdownClicked(options), }); }); } diff --git a/app/assets/javascripts/members/components/avatars/user_avatar.vue b/app/assets/javascripts/members/components/avatars/user_avatar.vue index fe45ca769af..e2264085e67 100644 --- a/app/assets/javascripts/members/components/avatars/user_avatar.vue +++ b/app/assets/javascripts/members/components/avatars/user_avatar.vue @@ -38,7 +38,7 @@ export default { return this.member.user; }, badges() { - return generateBadges(this.member, this.isCurrentUser).filter(badge => badge.show); + return generateBadges(this.member, this.isCurrentUser).filter((badge) => badge.show); }, statusEmoji() { return this.user?.status?.emoji; diff --git a/app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue b/app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue index c1df0b94234..cf7501d84fa 100644 --- a/app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue +++ b/app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue @@ -45,7 +45,7 @@ export default { computed: { ...mapState(['sourceId', 'filteredSearchBar', 'canManageMembers']), tokens() { - return this.$options.availableTokens.filter(token => { + return this.$options.availableTokens.filter((token) => { if ( Object.prototype.hasOwnProperty.call(token, 'requiredPermissions') && !this[token.requiredPermissions] @@ -61,8 +61,8 @@ export default { const query = queryToObject(window.location.search); const tokens = this.tokens - .filter(token => query[token.type]) - .map(token => ({ + .filter((token) => query[token.type]) + .map((token) => ({ type: token.type, value: { data: query[token.type], diff --git a/app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue b/app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue index de7fbc4241c..bcfe559768d 100644 --- a/app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue +++ b/app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue @@ -14,7 +14,7 @@ export default { return parseSortParam(this.tableSortableFields); }, activeOption() { - return FIELDS.find(field => field.key === this.sort.sortByKey); + return FIELDS.find((field) => field.key === this.sort.sortByKey); }, activeOptionLabel() { return this.activeOption?.label; @@ -23,18 +23,18 @@ export default { return !this.sort.sortDesc; }, filteredOptions() { - return FIELDS.filter(field => this.tableSortableFields.includes(field.key) && field.sort).map( - field => ({ - key: field.key, - label: field.label, - href: buildSortHref({ - sortBy: field.key, - sortDesc: false, - filteredSearchBarTokens: this.filteredSearchBar.tokens, - filteredSearchBarSearchParam: this.filteredSearchBar.searchParam, - }), + return FIELDS.filter( + (field) => this.tableSortableFields.includes(field.key) && field.sort, + ).map((field) => ({ + key: field.key, + label: field.label, + href: buildSortHref({ + sortBy: field.key, + sortDesc: false, + filteredSearchBarTokens: this.filteredSearchBar.tokens, + filteredSearchBarSearchParam: this.filteredSearchBar.searchParam, }), - ); + })); }, }, methods: { diff --git a/app/assets/javascripts/members/store/index.js b/app/assets/javascripts/members/store/index.js index f219f8931b0..34c102999d2 100644 --- a/app/assets/javascripts/members/store/index.js +++ b/app/assets/javascripts/members/store/index.js @@ -2,7 +2,7 @@ import createState from 'ee_else_ce/members/store/state'; import mutations from 'ee_else_ce/members/store/mutations'; import * as actions from 'ee_else_ce/members/store/actions'; -export default initialState => ({ +export default (initialState) => ({ state: createState(initialState), actions, mutations, diff --git a/app/assets/javascripts/members/utils.js b/app/assets/javascripts/members/utils.js index bf1fc2d7515..780b5a9df57 100644 --- a/app/assets/javascripts/members/utils.js +++ b/app/assets/javascripts/members/utils.js @@ -21,7 +21,7 @@ export const generateBadges = (member, isCurrentUser) => [ }, ]; -export const isGroup = member => { +export const isGroup = (member) => { return Boolean(member.sharedWithGroup); }; @@ -37,7 +37,7 @@ export const canRemove = (member, sourceId) => { return isDirectMember(member, sourceId) && member.canRemove; }; -export const canResend = member => { +export const canResend = (member) => { return Boolean(member.invite?.canResend); }; @@ -47,11 +47,11 @@ export const canUpdate = (member, currentUserId, sourceId) => { ); }; -export const parseSortParam = sortableFields => { +export const parseSortParam = (sortableFields) => { const sortParam = getParameterByName('sort'); - const sortedField = FIELDS.filter(field => sortableFields.includes(field.key)).find( - field => field.sort?.asc === sortParam || field.sort?.desc === sortParam, + const sortedField = FIELDS.filter((field) => sortableFields.includes(field.key)).find( + (field) => field.sort?.asc === sortParam || field.sort?.desc === sortParam, ); if (!sortedField) { @@ -70,7 +70,7 @@ export const buildSortHref = ({ filteredSearchBarTokens, filteredSearchBarSearchParam, }) => { - const sortDefinition = FIELDS.find(field => field.key === sortBy)?.sort; + const sortDefinition = FIELDS.find((field) => field.key === sortBy)?.sort; if (!sortDefinition) { return ''; diff --git a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js index 8cb4d77dc19..338fbd9078a 100644 --- a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js +++ b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js @@ -6,7 +6,7 @@ import axios from '~/lib/utils/axios_utils'; import { deprecatedCreateFlash as flash } from '~/flash'; import { __ } from '~/locale'; -(global => { +((global) => { global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts.diffFileEditor = Vue.extend({ diff --git a/app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js b/app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js index 827cf5f478d..bc926cb9155 100644 --- a/app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js +++ b/app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js @@ -4,7 +4,7 @@ import Vue from 'vue'; import actionsMixin from '../mixins/line_conflict_actions'; import utilsMixin from '../mixins/line_conflict_utils'; -(global => { +((global) => { global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts.inlineConflictLines = Vue.extend({ diff --git a/app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js b/app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js index 3cb406b819d..bb306e74825 100644 --- a/app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js +++ b/app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js @@ -4,7 +4,7 @@ import Vue from 'vue'; import actionsMixin from '../mixins/line_conflict_actions'; import utilsMixin from '../mixins/line_conflict_utils'; -(global => { +((global) => { global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts.parallelConflictLines = Vue.extend({ diff --git a/app/assets/javascripts/merge_conflicts/merge_conflict_store.js b/app/assets/javascripts/merge_conflicts/merge_conflict_store.js index c803774f4a7..693f0b619a8 100644 --- a/app/assets/javascripts/merge_conflicts/merge_conflict_store.js +++ b/app/assets/javascripts/merge_conflicts/merge_conflict_store.js @@ -5,7 +5,7 @@ import Vue from 'vue'; import Cookies from 'js-cookie'; import { s__ } from '~/locale'; -(global => { +((global) => { global.mergeConflicts = global.mergeConflicts || {}; const diffViewType = Cookies.get('diff_view'); @@ -48,7 +48,7 @@ import { s__ } from '~/locale'; }, decorateFiles(files) { - files.forEach(file => { + files.forEach((file) => { file.content = ''; file.resolutionData = {}; file.promptDiscardConfirmation = false; @@ -72,7 +72,7 @@ import { s__ } from '~/locale'; setInlineLine(file) { file.inlineLines = []; - file.sections.forEach(section => { + file.sections.forEach((section) => { let currentLineType = 'new'; const { conflict, lines, id } = section; @@ -80,7 +80,7 @@ import { s__ } from '~/locale'; file.inlineLines.push(this.getHeadHeaderLine(id)); } - lines.forEach(line => { + lines.forEach((line) => { const { type } = line; if ((type === 'new' || type === 'old') && currentLineType !== type) { @@ -102,7 +102,7 @@ import { s__ } from '~/locale'; file.parallelLines = []; const linesObj = { left: [], right: [] }; - file.sections.forEach(section => { + file.sections.forEach((section) => { const { conflict, lines, id } = section; if (conflict) { @@ -110,7 +110,7 @@ import { s__ } from '~/locale'; linesObj.right.push(this.getHeadHeaderLine(id)); } - lines.forEach(line => { + lines.forEach((line) => { const { type } = line; if (conflict) { @@ -156,9 +156,9 @@ import { s__ } from '~/locale'; const { files } = this.state.conflictsData; let count = 0; - files.forEach(file => { + files.forEach((file) => { if (file.type === CONFLICT_TYPES.TEXT) { - file.sections.forEach(section => { + file.sections.forEach((section) => { if (section.conflict) { count += 1; } @@ -287,14 +287,14 @@ import { s__ } from '~/locale'; }, restoreFileLinesState(file) { - file.inlineLines.forEach(line => { + file.inlineLines.forEach((line) => { if (line.hasConflict || line.isHeader) { line.isSelected = false; line.isUnselected = false; } }); - file.parallelLines.forEach(lines => { + file.parallelLines.forEach((lines) => { const left = lines[0]; const right = lines[1]; const isLeftMatch = left.hasConflict || left.isHeader; @@ -362,7 +362,7 @@ import { s__ } from '~/locale'; files: [], }; - this.state.conflictsData.files.forEach(file => { + this.state.conflictsData.files.forEach((file) => { const addFile = { old_path: file.old_path, new_path: file.new_path, @@ -388,13 +388,13 @@ import { s__ } from '~/locale'; handleSelected(file, sectionId, selection) { Vue.set(file.resolutionData, sectionId, selection); - file.inlineLines.forEach(line => { + file.inlineLines.forEach((line) => { if (line.id === sectionId && (line.hasConflict || line.isHeader)) { this.markLine(line, selection); } }); - file.parallelLines.forEach(lines => { + file.parallelLines.forEach((lines) => { const left = lines[0]; const right = lines[1]; const hasSameId = right.id === sectionId || left.id === sectionId; @@ -426,7 +426,7 @@ import { s__ } from '~/locale'; }, fileTextTypePresent() { - return this.state.conflictsData.files.some(f => f.type === CONFLICT_TYPES.TEXT); + return this.state.conflictsData.files.some((f) => f.type === CONFLICT_TYPES.TEXT); }, }; })(window.gl || (window.gl = {})); diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index f708ec82b5d..bf9e0a309dd 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -31,7 +31,7 @@ function MergeRequest(opts) { fieldName: 'description', selector: '.detail-page-description', lockVersion: this.$el.data('lockVersion'), - onSuccess: result => { + onSuccess: (result) => { document.querySelector('#task_status').innerText = result.task_status; document.querySelector('#task_status_short').innerText = result.task_status_short; }, @@ -69,8 +69,8 @@ MergeRequest.prototype.initMRBtnListeners = function () { const draftToggles = document.querySelectorAll('.js-draft-toggle-button'); if (draftToggles.length) { - draftToggles.forEach(draftToggle => { - draftToggle.addEventListener('click', e => { + draftToggles.forEach((draftToggle) => { + draftToggle.addEventListener('click', (e) => { e.preventDefault(); e.stopImmediatePropagation(); @@ -127,7 +127,7 @@ MergeRequest.prototype.submitNoteForm = function (form, $button) { }; MergeRequest.prototype.initCommitMessageListeners = function () { - $(document).on('click', 'a.js-with-description-link', e => { + $(document).on('click', 'a.js-with-description-link', (e) => { const textarea = $('textarea.js-commit-message'); e.preventDefault(); @@ -136,7 +136,7 @@ MergeRequest.prototype.initCommitMessageListeners = function () { $('.js-without-description-hint').show(); }); - $(document).on('click', 'a.js-without-description-link', e => { + $(document).on('click', 'a.js-without-description-link', (e) => { const textarea = $('textarea.js-commit-message'); e.preventDefault(); @@ -180,7 +180,7 @@ MergeRequest.toggleDraftStatus = function (title, isReady) { const draftToggles = document.querySelectorAll('.js-draft-toggle-button'); if (draftToggles.length) { - draftToggles.forEach(el => { + draftToggles.forEach((el) => { const draftToggle = el; const url = setUrlParams( { 'merge_request[wip_event]': isReady ? 'wip' : 'unwip' }, diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js index 6e9661ea1a8..071dd62ad52 100644 --- a/app/assets/javascripts/merge_request_tabs.js +++ b/app/assets/javascripts/merge_request_tabs.js @@ -128,7 +128,7 @@ export default class MergeRequestTabs { bindEvents() { $('.merge-request-tabs a[data-toggle="tabvue"]').on('click', this.clickTab); - window.addEventListener('popstate', event => { + window.addEventListener('popstate', (event) => { if (event.state && event.state.action) { this.tabShown(event.state.action, event.target.location); this.currentAction = event.state.action; @@ -177,14 +177,14 @@ export default class MergeRequestTabs { this.currentTab = action; if (this.mergeRequestTabPanesAll) { - this.mergeRequestTabPanesAll.forEach(el => { + this.mergeRequestTabPanesAll.forEach((el) => { const tabPane = el; tabPane.style.display = 'none'; }); } if (this.mergeRequestTabsAll) { - this.mergeRequestTabsAll.forEach(el => { + this.mergeRequestTabsAll.forEach((el) => { el.classList.remove('active'); }); } diff --git a/app/assets/javascripts/milestone.js b/app/assets/javascripts/milestone.js index 52e9b67c77d..717766578de 100644 --- a/app/assets/javascripts/milestone.js +++ b/app/assets/javascripts/milestone.js @@ -11,7 +11,7 @@ export default class Milestone { } bindTabsSwitching() { - return $('a[data-toggle="tab"]').on('show.bs.tab', e => { + return $('a[data-toggle="tab"]').on('show.bs.tab', (e) => { const $target = $(e.target); window.location.hash = $target.attr('href'); diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js index baa5e41989b..921925e15c5 100644 --- a/app/assets/javascripts/milestone_select.js +++ b/app/assets/javascripts/milestone_select.js @@ -89,7 +89,7 @@ export default class MilestoneSelect { return getMilestones(contextId, reqParams) .then(({ data }) => data - .map(m => ({ + .map((m) => ({ ...m, // Public API includes `title` instead of `name`. name: m.title, @@ -105,7 +105,7 @@ export default class MilestoneSelect { return 0; }), ) - .then(data => { + .then((data) => { const extraOptions = []; if (showAny) { extraOptions.push({ @@ -146,7 +146,7 @@ export default class MilestoneSelect { $(`[data-milestone-id="${selectedMilestone}"] > a`).addClass('is-active'); }); }, - renderRow: milestone => { + renderRow: (milestone) => { const milestoneName = milestone.title || milestone.name; let milestoneDisplayName = escape(milestoneName); @@ -178,8 +178,8 @@ export default class MilestoneSelect { }, defaultLabel, fieldName: $dropdown.data('fieldName'), - text: milestone => escape(milestone.title), - id: milestone => { + text: (milestone) => escape(milestone.title), + id: (milestone) => { if (milestone !== undefined) { if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) { return milestone.name; @@ -193,7 +193,7 @@ export default class MilestoneSelect { // display:block overrides the hide-collapse rule return $value.css('display', ''); }, - opened: e => { + opened: (e) => { const $el = $(e.currentTarget); if ($dropdown.hasClass('js-issue-board-sidebar') || options.handleClick) { selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault; @@ -202,7 +202,7 @@ export default class MilestoneSelect { $(`[data-milestone-id="${selectedMilestone}"] > a`, $el).addClass('is-active'); }, vue: $dropdown.hasClass('js-issue-board-sidebar'), - clicked: clickEvent => { + clicked: (clickEvent) => { const { e } = clickEvent; let selected = clickEvent.selectedObj; diff --git a/app/assets/javascripts/milestones/components/milestone_combobox.vue b/app/assets/javascripts/milestones/components/milestone_combobox.vue index 08fd5a5994f..1db2d10db20 100644 --- a/app/assets/javascripts/milestones/components/milestone_combobox.vue +++ b/app/assets/javascripts/milestones/components/milestone_combobox.vue @@ -112,7 +112,7 @@ export default { value: { immediate: true, handler() { - const milestoneTitles = this.value.map(milestone => + const milestoneTitles = this.value.map((milestone) => milestone.title ? milestone.title : milestone, ); if (!isEqual(milestoneTitles, this.selectedMilestones)) { diff --git a/app/assets/javascripts/milestones/stores/actions.js b/app/assets/javascripts/milestones/stores/actions.js index df45c7156ad..48fe0dd1e31 100644 --- a/app/assets/javascripts/milestones/stores/actions.js +++ b/app/assets/javascripts/milestones/stores/actions.js @@ -41,10 +41,10 @@ export const fetchProjectMilestones = ({ commit, state }) => { commit(types.REQUEST_START); Api.projectMilestones(state.projectId) - .then(response => { + .then((response) => { commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response); }) - .catch(error => { + .catch((error) => { commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error); }) .finally(() => { @@ -56,10 +56,10 @@ export const fetchGroupMilestones = ({ commit, state }) => { commit(types.REQUEST_START); Api.groupMilestones(state.groupId) - .then(response => { + .then((response) => { commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response); }) - .catch(error => { + .catch((error) => { commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error); }) .finally(() => { @@ -76,10 +76,10 @@ export const searchProjectMilestones = ({ commit, state }) => { commit(types.REQUEST_START); Api.projectSearch(state.projectId, options) - .then(response => { + .then((response) => { commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response); }) - .catch(error => { + .catch((error) => { commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error); }) .finally(() => { @@ -95,10 +95,10 @@ export const searchGroupMilestones = ({ commit, state }) => { commit(types.REQUEST_START); Api.groupMilestones(state.groupId, options) - .then(response => { + .then((response) => { commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response); }) - .catch(error => { + .catch((error) => { commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error); }) .finally(() => { diff --git a/app/assets/javascripts/milestones/stores/mutations.js b/app/assets/javascripts/milestones/stores/mutations.js index 601b88cb62a..3a7babf6fa0 100644 --- a/app/assets/javascripts/milestones/stores/mutations.js +++ b/app/assets/javascripts/milestones/stores/mutations.js @@ -22,7 +22,7 @@ export default { }, [types.REMOVE_SELECTED_MILESTONE](state, selectedMilestone) { const filteredMilestones = state.selectedMilestones.filter( - milestone => milestone !== selectedMilestone, + (milestone) => milestone !== selectedMilestone, ); Vue.set(state, 'selectedMilestones', filteredMilestones); }, diff --git a/app/assets/javascripts/mini_pipeline_graph_dropdown.js b/app/assets/javascripts/mini_pipeline_graph_dropdown.js index 5e805f857aa..05f2f15fa9a 100644 --- a/app/assets/javascripts/mini_pipeline_graph_dropdown.js +++ b/app/assets/javascripts/mini_pipeline_graph_dropdown.js @@ -47,7 +47,7 @@ export default class MiniPipelineGraph { $(document).on( 'click', `${this.container} .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item`, - e => { + (e) => { e.stopPropagation(); }, ); diff --git a/app/assets/javascripts/mirrors/mirror_repos.js b/app/assets/javascripts/mirrors/mirror_repos.js index 18ea27e9a34..f7200f22471 100644 --- a/app/assets/javascripts/mirrors/mirror_repos.js +++ b/app/assets/javascripts/mirrors/mirror_repos.js @@ -80,7 +80,7 @@ export default class MirrorRepos { this.debouncedUpdateUrl = debounce(() => this.updateUrl(), 200); this.$urlInput.on('input', () => this.debouncedUpdateUrl()); this.$protectedBranchesInput.on('change', () => this.updateProtectedBranches()); - this.$table.on('click', '.js-delete-mirror', event => this.deleteMirror(event)); + this.$table.on('click', '.js-delete-mirror', (event) => this.deleteMirror(event)); } togglePassword() { diff --git a/app/assets/javascripts/mirrors/ssh_mirror.js b/app/assets/javascripts/mirrors/ssh_mirror.js index c6486350f3b..b692db10e2d 100644 --- a/app/assets/javascripts/mirrors/ssh_mirror.js +++ b/app/assets/javascripts/mirrors/ssh_mirror.js @@ -29,10 +29,10 @@ export default class SSHMirror { this.handleRepositoryUrlInput(true); this.$repositoryUrl.on('keyup', () => this.handleRepositoryUrlInput()); - this.$knownHosts.on('keyup', e => this.handleSSHKnownHostsInput(e)); - this.$dropdownAuthType.on('change', e => this.handleAuthTypeChange(e)); - this.$btnDetectHostKeys.on('click', e => this.handleDetectHostKeys(e)); - this.$btnSSHHostsShowAdvanced.on('click', e => this.handleSSHHostsAdvanced(e)); + this.$knownHosts.on('keyup', (e) => this.handleSSHKnownHostsInput(e)); + this.$dropdownAuthType.on('change', (e) => this.handleAuthTypeChange(e)); + this.$btnDetectHostKeys.on('click', (e) => this.handleDetectHostKeys(e)); + this.$btnSSHHostsShowAdvanced.on('click', (e) => this.handleSSHHostsAdvanced(e)); } /** @@ -100,7 +100,7 @@ export default class SSHMirror { }) .catch(stop); }) - .then(res => { + .then((res) => { $btnLoadSpinner.addClass('d-none'); // Once data is received, we show verification info along with Host keys and fingerprints this.$hostKeysInformation @@ -160,7 +160,7 @@ export default class SSHMirror { showSSHInformation(sshHostKeys) { const $fingerprintsList = this.$hostKeysInformation.find('.js-fingerprints-list'); let fingerprints = ''; - sshHostKeys.fingerprints.forEach(fingerprint => { + sshHostKeys.fingerprints.forEach((fingerprint) => { const escFingerprints = escape(fingerprint.fingerprint); fingerprints += `<code>${escFingerprints}</code>`; }); diff --git a/app/assets/javascripts/monitoring/components/alert_widget.vue b/app/assets/javascripts/monitoring/components/alert_widget.vue index 8f9c181258f..bf31b86561a 100644 --- a/app/assets/javascripts/monitoring/components/alert_widget.vue +++ b/app/assets/javascripts/monitoring/components/alert_widget.vue @@ -97,12 +97,12 @@ export default { return Boolean(this.firingAlerts.length); }, firingAlerts() { - return values(this.alertsToManage).filter(alert => + return values(this.alertsToManage).filter((alert) => this.passedAlertThreshold(this.getQueryData(alert), alert), ); }, formattedFiringAlerts() { - return this.firingAlerts.map(alert => this.formatAlertSummary(alert.alert_path)); + return this.firingAlerts.map((alert) => this.formatAlertSummary(alert.alert_path)); }, configuredAlert() { return this.hasAlerts ? values(this.alertsToManage)[0].metricId : ''; @@ -116,13 +116,13 @@ export default { fetchAlertData() { this.isLoading = true; - const queriesWithAlerts = this.relevantQueries.filter(query => query.alert_path); + const queriesWithAlerts = this.relevantQueries.filter((query) => query.alert_path); return Promise.all( - queriesWithAlerts.map(query => + queriesWithAlerts.map((query) => this.service .readAlert(query.alert_path) - .then(alertAttributes => this.setAlert(alertAttributes, query.metricId)), + .then((alertAttributes) => this.setAlert(alertAttributes, query.metricId)), ), ) .then(() => { @@ -141,7 +141,7 @@ export default { }, formatAlertSummary(alertPath) { const alert = this.alertsToManage[alertPath]; - const alertQuery = this.relevantQueries.find(query => query.metricId === alert.metricId); + const alertQuery = this.relevantQueries.find((query) => query.metricId === alert.metricId); return `${alertQuery.label} ${alert.operator} ${alert.threshold}`; }, @@ -150,19 +150,19 @@ export default { switch (operator) { case OPERATORS.greaterThan: - return data.some(value => value > threshold); + return data.some((value) => value > threshold); case OPERATORS.lessThan: - return data.some(value => value < threshold); + return data.some((value) => value < threshold); case OPERATORS.equalTo: - return data.some(value => value === threshold); + return data.some((value) => value === threshold); default: return false; } }, getQueryData(alert) { - const alertQuery = this.relevantQueries.find(query => query.metricId === alert.metricId); + const alertQuery = this.relevantQueries.find((query) => query.metricId === alert.metricId); - return get(alertQuery, 'result[0].values', []).map(value => get(value, '[1]', null)); + return get(alertQuery, 'result[0].values', []).map((value) => get(value, '[1]', null)); }, showModal() { this.$root.$emit('bv::show::modal', this.modalId); @@ -179,7 +179,7 @@ export default { this.isLoading = true; this.service .createAlert(newAlert) - .then(alertAttributes => { + .then((alertAttributes) => { this.setAlert(alertAttributes, prometheus_metric_id); this.isLoading = false; this.hideModal(); @@ -194,7 +194,7 @@ export default { this.isLoading = true; this.service .updateAlert(alert, updatedAlert) - .then(alertAttributes => { + .then((alertAttributes) => { this.setAlert(alertAttributes, this.alertsToManage[alert].metricId); this.isLoading = false; this.hideModal(); diff --git a/app/assets/javascripts/monitoring/components/alert_widget_form.vue b/app/assets/javascripts/monitoring/components/alert_widget_form.vue index 71691429ece..b26941891e4 100644 --- a/app/assets/javascripts/monitoring/components/alert_widget_form.vue +++ b/app/assets/javascripts/monitoring/components/alert_widget_form.vue @@ -99,7 +99,7 @@ export default { return this.alertQuery.length ? true : null; }, currentQuery() { - return this.relevantQueries.find(query => query.metricId === this.prometheusMetricId) || {}; + return this.relevantQueries.find((query) => query.metricId === this.prometheusMetricId) || {}; }, formDisabled() { // We need a prometheusMetricId to determine whether we're @@ -151,7 +151,7 @@ export default { }, methods: { selectQuery(queryId) { - const existingAlertPath = findKey(this.alertsToManage, alert => alert.metricId === queryId); + const existingAlertPath = findKey(this.alertsToManage, (alert) => alert.metricId === queryId); const existingAlert = this.alertsToManage[existingAlertPath]; if (existingAlert) { diff --git a/app/assets/javascripts/monitoring/components/charts/annotations.js b/app/assets/javascripts/monitoring/components/charts/annotations.js index 418107c4126..aac9d2f8a01 100644 --- a/app/assets/javascripts/monitoring/components/charts/annotations.js +++ b/app/assets/javascripts/monitoring/components/charts/annotations.js @@ -52,7 +52,7 @@ export const annotationsYAxis = { * @param {Object} annotation object * @returns {Object} markLine object */ -export const parseAnnotations = annotations => +export const parseAnnotations = (annotations) => annotations.reduce( (acc, annotation) => { acc.lines.push({ @@ -87,7 +87,7 @@ export const parseAnnotations = annotations => */ export const generateAnnotationsSeries = ({ deployments = [], annotations = [] } = {}) => { // deployment data points - const data = deployments.map(deployment => { + const data = deployments.map((deployment) => { return { name: 'deployments', value: [deployment.createdAt, annotationsYAxisCoords.pos], diff --git a/app/assets/javascripts/monitoring/components/charts/anomaly.vue b/app/assets/javascripts/monitoring/components/charts/anomaly.vue index 14483fe04de..cb533c38fa0 100644 --- a/app/assets/javascripts/monitoring/components/charts/anomaly.vue +++ b/app/assets/javascripts/monitoring/components/charts/anomaly.vue @@ -62,7 +62,7 @@ export default { }, computed: { series() { - return this.graphData.metrics.map(metric => { + return this.graphData.metrics.map((metric) => { const values = metric.result && metric.result[0] ? metric.result[0].values : []; return { label: metric.label, @@ -78,14 +78,14 @@ export default { * This offset is the lowest value. */ yOffset() { - const values = flattenDeep(this.series.map(ser => ser.data.map(([, y]) => y))); + const values = flattenDeep(this.series.map((ser) => ser.data.map(([, y]) => y))); const min = values.length ? Math.floor(Math.min(...values)) : 0; return min < 0 ? -min : 0; }, metricData() { const originalMetricQuery = this.graphData.metrics[0]; - const metricQuery = produce(originalMetricQuery, draftQuery => { + const metricQuery = produce(originalMetricQuery, (draftQuery) => { // eslint-disable-next-line no-param-reassign draftQuery.result[0].values = draftQuery.result[0].values.map(([x, y]) => [ x, @@ -112,7 +112,7 @@ export default { }, showSymbol: true, itemStyle: { - color: params => { + color: (params) => { if (this.isDatapointAnomaly(params.dataIndex)) { return colorValues.anomalySymbol; } @@ -131,7 +131,7 @@ export default { const yAxisWithOffset = { axisLabel: { - formatter: num => roundOffFloat(num - this.yOffset, 3).toString(), + formatter: (num) => roundOffFloat(num - this.yOffset, 3).toString(), }, }; @@ -156,7 +156,7 @@ export default { boundarySeries.push( this.makeBoundarySeries({ name: this.formatLegendLabel(upperSeries), - data: calcOffsetY(upperSeries.data, i => -this.yValue(LOWER, i)), + data: calcOffsetY(upperSeries.data, (i) => -this.yValue(LOWER, i)), areaStyle: { color: AREA_COLOR, opacity: AREA_OPACITY, diff --git a/app/assets/javascripts/monitoring/components/charts/bar.vue b/app/assets/javascripts/monitoring/components/charts/bar.vue index e1018cd5952..a4cef5ea256 100644 --- a/app/assets/javascripts/monitoring/components/charts/bar.vue +++ b/app/assets/javascripts/monitoring/components/charts/bar.vue @@ -67,12 +67,12 @@ export default { }, setSvg(name) { getSvgIconPathContent(name) - .then(path => { + .then((path) => { if (path) { this.$set(this.svgs, name, `path://${path}`); } }) - .catch(e => { + .catch((e) => { // eslint-disable-next-line no-console, @gitlab/require-i18n-strings console.error('SVG could not be rendered correctly: ', e); }); diff --git a/app/assets/javascripts/monitoring/components/charts/column.vue b/app/assets/javascripts/monitoring/components/charts/column.vue index 511f77a441b..ba947c2fa9c 100644 --- a/app/assets/javascripts/monitoring/components/charts/column.vue +++ b/app/assets/javascripts/monitoring/components/charts/column.vue @@ -90,7 +90,7 @@ export default { }, setSvg(name) { getSvgIconPathContent(name) - .then(path => { + .then((path) => { if (path) { this.$set(this.svgs, name, `path://${path}`); } diff --git a/app/assets/javascripts/monitoring/components/charts/heatmap.vue b/app/assets/javascripts/monitoring/components/charts/heatmap.vue index 7003e2d37cf..22214a76aba 100644 --- a/app/assets/javascripts/monitoring/components/charts/heatmap.vue +++ b/app/assets/javascripts/monitoring/components/charts/heatmap.vue @@ -42,10 +42,10 @@ export default { return this.graphData.y_label || ''; }, xAxisLabels() { - return this.metrics.result.map(res => Object.values(res.metric)[0]); + return this.metrics.result.map((res) => Object.values(res.metric)[0]); }, yAxisLabels() { - return this.result.values.map(val => { + return this.result.values.map((val) => { const [yLabel] = val; return formatDate(new Date(yLabel), { diff --git a/app/assets/javascripts/monitoring/components/charts/options.js b/app/assets/javascripts/monitoring/components/charts/options.js index 0cd4a02311c..163a7be6973 100644 --- a/app/assets/javascripts/monitoring/components/charts/options.js +++ b/app/assets/javascripts/monitoring/components/charts/options.js @@ -51,7 +51,7 @@ const getDataAxisOptions = ({ format, precision, name }) => { nameLocation: 'center', // same as gitlab-ui's default scale: true, axisLabel: { - formatter: val => formatter(val, precision, maxDataAxisTickLength), + formatter: (val) => formatter(val, precision, maxDataAxisTickLength), }, }; }; @@ -85,7 +85,7 @@ export const getTimeAxisOptions = ({ name: __('Time'), type: axisTypes.time, axisLabel: { - formatter: date => formatDate(date, { format, timezone }), + formatter: (date) => formatDate(date, { format, timezone }), }, axisPointer: { snap: false, @@ -109,7 +109,7 @@ export const getTooltipFormatter = ({ precision = defaultTooltipPrecision, } = {}) => { const formatter = getFormatter(format); - return num => formatter(num, precision); + return (num) => formatter(num, precision); }; // Thresholds @@ -138,9 +138,9 @@ export const getValidThresholds = ({ mode, range = {}, values = [] } = {}) => { const uniqueThresholds = uniq(values); - const numberThresholds = uniqueThresholds.filter(threshold => isFinite(threshold)); + const numberThresholds = uniqueThresholds.filter((threshold) => isFinite(threshold)); - const validThresholds = numberThresholds.filter(threshold => { + const validThresholds = numberThresholds.filter((threshold) => { let isValid; if (mode === thresholdModeTypes.PERCENTAGE) { @@ -152,7 +152,7 @@ export const getValidThresholds = ({ mode, range = {}, values = [] } = {}) => { return isValid; }); - const transformedThresholds = validThresholds.map(threshold => { + const transformedThresholds = validThresholds.map((threshold) => { let transformedThreshold; if (mode === 'percentage') { diff --git a/app/assets/javascripts/monitoring/components/charts/stacked_column.vue b/app/assets/javascripts/monitoring/components/charts/stacked_column.vue index 66b4d0d86e6..b5ae6bcfd13 100644 --- a/app/assets/javascripts/monitoring/components/charts/stacked_column.vue +++ b/app/assets/javascripts/monitoring/components/charts/stacked_column.vue @@ -68,7 +68,7 @@ export default { if (!result || result.length === 0) { return []; } - return { name, data: result[0].values.map(val => val[1]) }; + return { name, data: result[0].values.map((val) => val[1]) }; }) .slice(0, 1); }, @@ -89,7 +89,7 @@ export default { if (!result || result.length === 0) { return []; } - return result[0].values.map(val => val[0]); + return result[0].values.map((val) => val[0]); }, dataZoomConfig() { const handleIcon = this.svgs['scroll-handle']; @@ -106,7 +106,7 @@ export default { }; }, seriesNames() { - return this.graphData.metrics.map(metric => metric.label); + return this.graphData.metrics.map((metric) => metric.label); }, }, created() { @@ -115,12 +115,12 @@ export default { methods: { setSvg(name) { getSvgIconPathContent(name) - .then(path => { + .then((path) => { if (path) { this.$set(this.svgs, name, `path://${path}`); } }) - .catch(e => { + .catch((e) => { // eslint-disable-next-line no-console, @gitlab/require-i18n-strings console.error('SVG could not be rendered correctly: ', e); }); diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue index 170c5ff7695..e9f7b11c977 100644 --- a/app/assets/javascripts/monitoring/components/charts/time_series.vue +++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue @@ -11,7 +11,7 @@ import { makeDataSeries } from '~/helpers/monitor_helper'; import { graphDataValidatorForValues } from '../../utils'; import { formatDate, timezones } from '../../format_date'; -export const timestampToISODate = timestamp => new Date(timestamp).toISOString(); +export const timestampToISODate = (timestamp) => new Date(timestamp).toISOString(); const THROTTLED_DATAZOOM_WAIT = 1000; // milliseconds @@ -304,7 +304,7 @@ export default { this.tooltip.content = []; - params.seriesData.forEach(dataPoint => { + params.seriesData.forEach((dataPoint) => { if (dataPoint.value) { const [, yVal] = dataPoint.value; this.tooltip.type = dataPoint.name; @@ -327,12 +327,12 @@ export default { }, setSvg(name) { getSvgIconPathContent(name) - .then(path => { + .then((path) => { if (path) { this.$set(this.svgs, name, `path://${path}`); } }) - .catch(e => { + .catch((e) => { // eslint-disable-next-line no-console, @gitlab/require-i18n-strings console.error('SVG could not be rendered correctly: ', e); }); diff --git a/app/assets/javascripts/monitoring/components/dashboard_panel.vue b/app/assets/javascripts/monitoring/components/dashboard_panel.vue index ad7127d97de..2b0c3d03b8d 100644 --- a/app/assets/javascripts/monitoring/components/dashboard_panel.vue +++ b/app/assets/javascripts/monitoring/components/dashboard_panel.vue @@ -271,8 +271,8 @@ export default { methods: { getGraphAlerts(queries) { if (!this.allAlerts) return {}; - const metricIdsForChart = queries.map(q => q.metricId); - return pickBy(this.allAlerts, alert => metricIdsForChart.includes(alert.metricId)); + const metricIdsForChart = queries.map((q) => q.metricId); + return pickBy(this.allAlerts, (alert) => metricIdsForChart.includes(alert.metricId)); }, getGraphAlertValues(queries) { return Object.values(this.getGraphAlerts(queries)); @@ -346,10 +346,10 @@ export default { } }, getAlertRunbooks(queries) { - const hasRunbook = alert => Boolean(alert.runbookUrl); + const hasRunbook = (alert) => Boolean(alert.runbookUrl); const graphAlertsWithRunbooks = pickBy(this.getGraphAlerts(queries), hasRunbook); - const alertToRunbookTransform = alert => { - const alertQuery = queries.find(query => query.metricId === alert.metricId); + const alertToRunbookTransform = (alert) => { + const alertQuery = queries.find((query) => query.metricId === alert.metricId); return { key: alert.metricId, href: alert.runbookUrl, diff --git a/app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue b/app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue index db5b853d451..627af202028 100644 --- a/app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue +++ b/app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue @@ -3,7 +3,7 @@ import { GlFormGroup, GlFormInput, GlFormRadioGroup, GlFormTextarea } from '@git import { escape as esc } from 'lodash'; import { __, s__, sprintf } from '~/locale'; -const defaultFileName = dashboard => dashboard.path.split('/').reverse()[0]; +const defaultFileName = (dashboard) => dashboard.path.split('/').reverse()[0]; export default { components: { diff --git a/app/assets/javascripts/monitoring/components/duplicate_dashboard_modal.vue b/app/assets/javascripts/monitoring/components/duplicate_dashboard_modal.vue index e64afc01fd9..b87934a1db2 100644 --- a/app/assets/javascripts/monitoring/components/duplicate_dashboard_modal.vue +++ b/app/assets/javascripts/monitoring/components/duplicate_dashboard_modal.vue @@ -42,7 +42,7 @@ export default { this.loading = true; this.alert = null; this.duplicateSystemDashboard(this.form) - .then(createdDashboard => { + .then((createdDashboard) => { this.loading = false; this.alert = null; @@ -55,7 +55,7 @@ export default { this.form.branch === this.defaultBranch ? createdDashboard : this.selectedDashboard; this.$emit(events.dashboardDuplicated, dashboard); }) - .catch(error => { + .catch((error) => { this.loading = false; this.alert = error; }); diff --git a/app/assets/javascripts/monitoring/components/embeds/embed_group.vue b/app/assets/javascripts/monitoring/components/embeds/embed_group.vue index 481ba3636cb..c114ae1809f 100644 --- a/app/assets/javascripts/monitoring/components/embeds/embed_group.vue +++ b/app/assets/javascripts/monitoring/components/embeds/embed_group.vue @@ -17,7 +17,7 @@ export default { urls: { type: Array, required: true, - validator: urls => urls.length > 0, + validator: (urls) => urls.length > 0, }, }, data() { diff --git a/app/assets/javascripts/monitoring/components/embeds/metric_embed.vue b/app/assets/javascripts/monitoring/components/embeds/metric_embed.vue index 1557a49137e..2fe49152c4f 100644 --- a/app/assets/javascripts/monitoring/components/embeds/metric_embed.vue +++ b/app/assets/javascripts/monitoring/components/embeds/metric_embed.vue @@ -101,7 +101,7 @@ export default { }, }), chartHasData(chart) { - return chart.metrics.some(metric => this.metricsWithData.includes(metric.metricId)); + return chart.metrics.some((metric) => this.metricsWithData.includes(metric.metricId)); }, onSidebarMutation() { setTimeout(() => { diff --git a/app/assets/javascripts/monitoring/components/empty_state.vue b/app/assets/javascripts/monitoring/components/empty_state.vue index 5e7c9b5d906..867f7139d71 100644 --- a/app/assets/javascripts/monitoring/components/empty_state.vue +++ b/app/assets/javascripts/monitoring/components/empty_state.vue @@ -12,7 +12,7 @@ export default { selectedState: { type: String, required: true, - validator: state => Object.values(dashboardEmptyStates).includes(state), + validator: (state) => Object.values(dashboardEmptyStates).includes(state), }, documentationPath: { type: String, diff --git a/app/assets/javascripts/monitoring/components/variables/dropdown_field.vue b/app/assets/javascripts/monitoring/components/variables/dropdown_field.vue index 4e48292c48d..ff0327f5f99 100644 --- a/app/assets/javascripts/monitoring/components/variables/dropdown_field.vue +++ b/app/assets/javascripts/monitoring/components/variables/dropdown_field.vue @@ -28,7 +28,7 @@ export default { }, computed: { text() { - const selectedOpt = this.options.values?.find(opt => opt.value === this.value); + const selectedOpt = this.options.values?.find((opt) => opt.value === this.value); return selectedOpt?.text || this.value; }, }, diff --git a/app/assets/javascripts/monitoring/csv_export.js b/app/assets/javascripts/monitoring/csv_export.js index 20cfa23e9b4..eaeed4a54d4 100644 --- a/app/assets/javascripts/monitoring/csv_export.js +++ b/app/assets/javascripts/monitoring/csv_export.js @@ -66,8 +66,8 @@ const csvMetricHeaders = (axisLabel, metrics) => * * @param {Array} metrics - Metrics with results */ -const csvMetricValues = metrics => - metrics.flatMap(({ result }) => result.map(res => res.values || [])); +const csvMetricValues = (metrics) => + metrics.flatMap(({ result }) => result.map((res) => res.values || [])); /** * Returns headers and rows for csv, sorted by their timestamp. @@ -99,7 +99,7 @@ const csvData = (metricHeaders, metricValues) => { const rows = Object.keys(rowsByTimestamp) .sort() - .map(timestamp => { + .map((timestamp) => { // force each row to have the same number of entries rowsByTimestamp[timestamp].length = metricHeaders.length; // add timestamp as the first entry @@ -111,7 +111,7 @@ const csvData = (metricHeaders, metricValues) => { // appearing inside a field must be escaped by preceding it with // another double quote." // https://tools.ietf.org/html/rfc4180#page-2 - const headers = metricHeaders.map(header => `"${header.replace(/"/g, '""')}"`); + const headers = metricHeaders.map((header) => `"${header.replace(/"/g, '""')}"`); return { headers: ['timestamp', ...headers], @@ -125,12 +125,12 @@ const csvData = (metricHeaders, metricValues) => { * @param {Object} graphData - Panel contents * @returns {String} */ -export const graphDataToCsv = graphData => { +export const graphDataToCsv = (graphData) => { const delimiter = ','; const br = '\r\n'; const { metrics = [], y_label: axisLabel } = graphData; - const metricsWithResults = metrics.filter(metric => metric.result); + const metricsWithResults = metrics.filter((metric) => metric.result); const metricHeaders = csvMetricHeaders(axisLabel, metricsWithResults); const metricValues = csvMetricValues(metricsWithResults); const { headers, rows } = csvData(metricHeaders, metricValues); @@ -140,7 +140,7 @@ export const graphDataToCsv = graphData => { } const headerLine = headers.join(delimiter) + br; - const lines = rows.map(row => row.join(delimiter)); + const lines = rows.map((row) => row.join(delimiter)); return headerLine + lines.join(br) + br; }; diff --git a/app/assets/javascripts/monitoring/requests/index.js b/app/assets/javascripts/monitoring/requests/index.js index 28064361768..4a12ca06197 100644 --- a/app/assets/javascripts/monitoring/requests/index.js +++ b/app/assets/javascripts/monitoring/requests/index.js @@ -3,10 +3,10 @@ import statusCodes from '~/lib/utils/http_status'; import { backOff } from '~/lib/utils/common_utils'; import { PROMETHEUS_TIMEOUT } from '../constants'; -const cancellableBackOffRequest = makeRequestCallback => +const cancellableBackOffRequest = (makeRequestCallback) => backOff((next, stop) => { makeRequestCallback() - .then(resp => { + .then((resp) => { if (resp.status === statusCodes.NO_CONTENT) { next(); } else { @@ -16,19 +16,19 @@ const cancellableBackOffRequest = makeRequestCallback => // If the request is cancelled by axios // then consider it as noop so that its not // caught by subsequent catches - .catch(thrown => (axios.isCancel(thrown) ? undefined : stop(thrown))); + .catch((thrown) => (axios.isCancel(thrown) ? undefined : stop(thrown))); }, PROMETHEUS_TIMEOUT); export const getDashboard = (dashboardEndpoint, params) => cancellableBackOffRequest(() => axios.get(dashboardEndpoint, { params })).then( - axiosResponse => axiosResponse.data, + (axiosResponse) => axiosResponse.data, ); export const getPrometheusQueryData = (prometheusEndpoint, params, opts) => cancellableBackOffRequest(() => axios.get(prometheusEndpoint, { params, ...opts })) - .then(axiosResponse => axiosResponse.data) - .then(prometheusResponse => prometheusResponse.data) - .catch(error => { + .then((axiosResponse) => axiosResponse.data) + .then((prometheusResponse) => prometheusResponse.data) + .catch((error) => { // Prometheus returns errors in specific cases // https://prometheus.io/docs/prometheus/latest/querying/api/#format-overview const { response = {} } = error; diff --git a/app/assets/javascripts/monitoring/services/alerts_service.js b/app/assets/javascripts/monitoring/services/alerts_service.js index a67675f1a3d..cb6dac7aa15 100644 --- a/app/assets/javascripts/monitoring/services/alerts_service.js +++ b/app/assets/javascripts/monitoring/services/alerts_service.js @@ -10,7 +10,7 @@ export default class AlertsService { } getAlerts() { - return axios.get(this.alertsEndpoint).then(resp => mapAlert(resp.data)); + return axios.get(this.alertsEndpoint).then((resp) => mapAlert(resp.data)); } createAlert({ prometheus_metric_id, operator, threshold, runbookUrl }) { @@ -21,23 +21,23 @@ export default class AlertsService { threshold, runbook_url: runbookUrl, }) - .then(resp => mapAlert(resp.data)); + .then((resp) => mapAlert(resp.data)); } // eslint-disable-next-line class-methods-use-this readAlert(alertPath) { - return axios.get(alertPath).then(resp => mapAlert(resp.data)); + return axios.get(alertPath).then((resp) => mapAlert(resp.data)); } // eslint-disable-next-line class-methods-use-this updateAlert(alertPath, { operator, threshold, runbookUrl }) { return axios .put(alertPath, { operator, threshold, runbook_url: runbookUrl }) - .then(resp => mapAlert(resp.data)); + .then((resp) => mapAlert(resp.data)); } // eslint-disable-next-line class-methods-use-this deleteAlert(alertPath) { - return axios.delete(alertPath).then(resp => resp.data); + return axios.delete(alertPath).then((resp) => resp.data); } } diff --git a/app/assets/javascripts/monitoring/stores/embed_group/getters.js b/app/assets/javascripts/monitoring/stores/embed_group/getters.js index 47db787dea5..8eddd830c58 100644 --- a/app/assets/javascripts/monitoring/stores/embed_group/getters.js +++ b/app/assets/javascripts/monitoring/stores/embed_group/getters.js @@ -1,2 +1,2 @@ export const metricsWithData = (state, getters, rootState, rootGetters) => - state.modules.map(module => rootGetters[`${module}/metricsWithData`]().length); + state.modules.map((module) => rootGetters[`${module}/metricsWithData`]().length); diff --git a/app/assets/javascripts/monitoring/stores/mutations.js b/app/assets/javascripts/monitoring/stores/mutations.js index 09a5861b475..5c5a7d03b97 100644 --- a/app/assets/javascripts/monitoring/stores/mutations.js +++ b/app/assets/javascripts/monitoring/stores/mutations.js @@ -15,9 +15,9 @@ import { optionsFromSeriesData } from './variable_mapping'; */ const findMetricInDashboard = (metricId, dashboard) => { let res = null; - dashboard.panelGroups.forEach(group => { - group.panels.forEach(panel => { - panel.metrics.forEach(metric => { + dashboard.panelGroups.forEach((group) => { + group.panels.forEach((panel) => { + panel.metrics.forEach((metric) => { if (metric.metricId === metricId) { res = metric; } @@ -31,7 +31,7 @@ const findMetricInDashboard = (metricId, dashboard) => { * Maps a backened error state to a `metricStates` constant * @param {Object} error - Error from backend response */ -const emptyStateFromError = error => { +const emptyStateFromError = (error) => { if (!error) { return metricStates.UNKNOWN_ERROR; } @@ -53,7 +53,7 @@ const emptyStateFromError = error => { return metricStates.UNKNOWN_ERROR; }; -export const metricStateFromData = data => { +export const metricStateFromData = (data) => { if (data?.result?.length) { const result = normalizeQueryResponseData(data); return { state: metricStates.OK, result: Object.freeze(result) }; @@ -93,7 +93,7 @@ export default { state.isUpdatingStarredValue = true; }, [types.RECEIVE_DASHBOARD_STARRING_SUCCESS](state, { selectedDashboard, newStarredValue }) { - const index = state.allDashboards.findIndex(d => d === selectedDashboard); + const index = state.allDashboards.findIndex((d) => d === selectedDashboard); state.isUpdatingStarredValue = false; @@ -196,7 +196,7 @@ export default { state.showErrorBanner = enabled; }, [types.SET_PANEL_GROUP_METRICS](state, payload) { - const panelGroup = state.dashboard.panelGroups.find(pg => payload.key === pg.key); + const panelGroup = state.dashboard.panelGroups.find((pg) => payload.key === pg.key); panelGroup.panels = payload.panels; }, [types.SET_ENVIRONMENTS_FILTER](state, searchTerm) { @@ -207,7 +207,7 @@ export default { state.expandedPanel.panel = panel; }, [types.UPDATE_VARIABLE_VALUE](state, { name, value }) { - const variable = state.variables.find(v => v.name === name); + const variable = state.variables.find((v) => v.name === name); if (variable) { Object.assign(variable, { value, diff --git a/app/assets/javascripts/monitoring/stores/utils.js b/app/assets/javascripts/monitoring/stores/utils.js index df7f22e622f..36e5a135d59 100644 --- a/app/assets/javascripts/monitoring/stores/utils.js +++ b/app/assets/javascripts/monitoring/stores/utils.js @@ -40,7 +40,7 @@ export const uniqMetricsId = ({ metric_id, id }) => `${metric_id || NOT_IN_DB_PR * @param {String} str String with leading slash * @returns {String} */ -export const removeLeadingSlash = str => (str || '').replace(/^\/+/, ''); +export const removeLeadingSlash = (str) => (str || '').replace(/^\/+/, ''); /** * GraphQL environments API returns only id and name. @@ -52,7 +52,7 @@ export const removeLeadingSlash = str => (str || '').replace(/^\/+/, ''); * @returns {Array} */ export const parseEnvironmentsResponse = (response = [], projectPath) => - (response || []).map(env => { + (response || []).map((env) => { const id = getIdFromGraphQLId(env.id); return { ...env, @@ -75,11 +75,11 @@ export const parseEnvironmentsResponse = (response = [], projectPath) => * @param {Array} response annotations response * @returns {Array} parsed responses */ -export const parseAnnotationsResponse = response => { +export const parseAnnotationsResponse = (response) => { if (!response) { return []; } - return response.map(annotation => ({ + return response.map((annotation) => ({ ...annotation, startingAt: new Date(annotation.startingAt), endingAt: annotation.endingAt ? new Date(annotation.endingAt) : null, @@ -99,7 +99,7 @@ export const parseAnnotationsResponse = response => { * @param {Array} metrics - Array of prometheus metrics * @returns {Object} */ -const mapToMetricsViewModel = metrics => +const mapToMetricsViewModel = (metrics) => metrics.map(({ label, id, metric_id, query_range, prometheus_endpoint_path, ...metric }) => ({ label, queryRange: query_range, @@ -230,7 +230,7 @@ const mapToPanelGroupViewModel = ({ group = '', panels = [] }, i) => { * @param {Object} timeRange * @returns {Object} */ -export const convertToGrafanaTimeRange = timeRange => { +export const convertToGrafanaTimeRange = (timeRange) => { const timeRangeType = getRangeType(timeRange); if (timeRangeType === DATETIME_RANGE_TYPES.fixed) { return { @@ -272,7 +272,7 @@ export const convertTimeRanges = (timeRange, type) => { * @param {Object} metadata * @returns {Function} */ -export const addDashboardMetaDataToLink = metadata => link => { +export const addDashboardMetaDataToLink = (metadata) => (link) => { let modifiedLink = { ...link }; if (metadata.timeRange) { modifiedLink = { @@ -307,7 +307,7 @@ export const mapToDashboardViewModel = ({ // Prometheus Results Parsing -const dateTimeFromUnixTime = unixTime => new Date(unixTime * 1000).toISOString(); +const dateTimeFromUnixTime = (unixTime) => new Date(unixTime * 1000).toISOString(); const mapScalarValue = ([unixTime, value]) => [dateTimeFromUnixTime(unixTime), Number(value)]; @@ -324,7 +324,7 @@ const mapStringValue = ([unixTime, value]) => [dateTimeFromUnixTime(unixTime), v * @param {array} result * @returns {array} */ -const normalizeScalarResult = result => [ +const normalizeScalarResult = (result) => [ { metric: {}, value: mapScalarValue(result), @@ -344,7 +344,7 @@ const normalizeScalarResult = result => [ * @param {array} result * @returns {array} */ -const normalizeStringResult = result => [ +const normalizeStringResult = (result) => [ { metric: {}, value: mapStringValue(result), @@ -379,7 +379,7 @@ const normalizeStringResult = result => [ * @param {array} result * @returns {array} */ -const normalizeVectorResult = result => +const normalizeVectorResult = (result) => result.map(({ metric, value }) => { const scalar = mapScalarValue(value); // Add a single element to `values`, to support matrix @@ -407,7 +407,7 @@ const normalizeVectorResult = result => * @param {array} result * @returns {object} Normalized result. */ -const normalizeResultMatrix = result => +const normalizeResultMatrix = (result) => result.map(({ metric, values }) => { const mappedValues = values.map(mapScalarValue); return { @@ -440,7 +440,7 @@ const normalizeResultMatrix = result => * ] * */ -export const normalizeQueryResponseData = data => { +export const normalizeQueryResponseData = (data) => { const { resultType, result } = data; if (resultType === 'vector') { return normalizeVectorResult(result); @@ -466,7 +466,7 @@ export const normalizeQueryResponseData = data => { * @param {String} name Variable key that needs to be prefixed * @returns {String} */ -export const addPrefixToCustomVariableParams = name => `variables[${name}]`; +export const addPrefixToCustomVariableParams = (name) => `variables[${name}]`; /** * Normalize custom dashboard paths. This method helps support diff --git a/app/assets/javascripts/monitoring/stores/variable_mapping.js b/app/assets/javascripts/monitoring/stores/variable_mapping.js index 4ae5cf04ff9..c9e0e383582 100644 --- a/app/assets/javascripts/monitoring/stores/variable_mapping.js +++ b/app/assets/javascripts/monitoring/stores/variable_mapping.js @@ -21,7 +21,7 @@ import { VARIABLE_TYPES } from '../constants'; * @param {String|Object} simpleTextVar * @returns {Object} */ -const textSimpleVariableParser = simpleTextVar => ({ +const textSimpleVariableParser = (simpleTextVar) => ({ type: VARIABLE_TYPES.text, label: null, value: simpleTextVar, @@ -34,7 +34,7 @@ const textSimpleVariableParser = simpleTextVar => ({ * @param {Object} advTextVar * @returns {Object} */ -const textAdvancedVariableParser = advTextVar => ({ +const textAdvancedVariableParser = (advTextVar) => ({ type: VARIABLE_TYPES.text, label: advTextVar.label, value: advTextVar.options.default_value, @@ -62,9 +62,9 @@ const normalizeVariableValues = ({ default: defaultOpt = false, text, value = nu * @param {Object} advVariable advanced custom variable * @returns {Object} */ -const customAdvancedVariableParser = advVariable => { +const customAdvancedVariableParser = (advVariable) => { const values = (advVariable?.options?.values ?? []).map(normalizeVariableValues); - const defaultValue = values.find(opt => opt.default === true) || values[0]; + const defaultValue = values.find((opt) => opt.default === true) || values[0]; return { type: VARIABLE_TYPES.custom, label: advVariable.label, @@ -82,7 +82,7 @@ const customAdvancedVariableParser = advVariable => { * @param {String} opt option from simple custom variable * @returns {Object} */ -export const parseSimpleCustomValues = opt => ({ text: opt, value: opt }); +export const parseSimpleCustomValues = (opt) => ({ text: opt, value: opt }); /** * Custom simple variables are rendered as dropdown elements in the dashboard @@ -96,7 +96,7 @@ export const parseSimpleCustomValues = opt => ({ text: opt, value: opt }); * @param {Array} customVariable array of options * @returns {Object} */ -const customSimpleVariableParser = simpleVar => { +const customSimpleVariableParser = (simpleVar) => { const values = (simpleVar || []).map(parseSimpleCustomValues); return { type: VARIABLE_TYPES.custom, @@ -126,7 +126,7 @@ const metricLabelValuesVariableParser = ({ label, options = {} }) => ({ * @param {Array|Object} customVar Array if simple, object if advanced * @returns {Boolean} true if simple, false if advanced */ -const isSimpleCustomVariable = customVar => Array.isArray(customVar); +const isSimpleCustomVariable = (customVar) => Array.isArray(customVar); /** * This method returns a parser based on the type of the variable. @@ -137,7 +137,7 @@ const isSimpleCustomVariable = customVar => Array.isArray(customVar); * @param {Array|Object} variable * @return {Function} parser method */ -const getVariableParser = variable => { +const getVariableParser = (variable) => { if (isString(variable)) { return textSimpleVariableParser; } else if (isSimpleCustomVariable(variable)) { @@ -200,7 +200,7 @@ export const parseTemplatingVariables = (ymlVariables = {}) => */ export const mergeURLVariables = (parsedYmlVariables = []) => { const varsFromURL = templatingVariablesFromUrl(); - parsedYmlVariables.forEach(variable => { + parsedYmlVariables.forEach((variable) => { const { name } = variable; if (Object.prototype.hasOwnProperty.call(varsFromURL, name)) { Object.assign(variable, { value: varsFromURL[name] }); diff --git a/app/assets/javascripts/monitoring/utils.js b/app/assets/javascripts/monitoring/utils.js index a4c5a881fae..01cae7127e5 100644 --- a/app/assets/javascripts/monitoring/utils.js +++ b/app/assets/javascripts/monitoring/utils.js @@ -81,15 +81,15 @@ export const graphDataValidatorForValues = (isValues, graphData) => { const responseValueKeyName = isValues ? 'value' : 'values'; return ( Array.isArray(graphData.metrics) && - graphData.metrics.filter(query => { + graphData.metrics.filter((query) => { if (Array.isArray(query.result)) { return ( - query.result.filter(res => Array.isArray(res[responseValueKeyName])).length === + query.result.filter((res) => Array.isArray(res[responseValueKeyName])).length === query.result.length ); } return false; - }).length === graphData.metrics.filter(query => query.result).length + }).length === graphData.metrics.filter((query) => query.result).length ); }; @@ -106,7 +106,7 @@ const isClusterHealthBoard = () => (document.body.dataset.page || '').includes(' * @param {String} chart link that will be sent as a property for the event * @return {Object} config object for event tracking */ -export const generateLinkToChartOptions = chartLink => { +export const generateLinkToChartOptions = (chartLink) => { const isCLusterHealthBoard = isClusterHealthBoard(); const category = isCLusterHealthBoard @@ -124,7 +124,7 @@ export const generateLinkToChartOptions = chartLink => { * @param {String} chart title that will be sent as a property for the event * @return {Object} config object for event tracking */ -export const downloadCSVOptions = title => { +export const downloadCSVOptions = (title) => { const isCLusterHealthBoard = isClusterHealthBoard(); const category = isCLusterHealthBoard @@ -157,7 +157,7 @@ export const getAddMetricTrackingOptions = () => ({ * @param {Object} graphData the graph data response from a prometheus request * @returns {boolean} true if the data is valid */ -export const graphDataValidatorForAnomalyValues = graphData => { +export const graphDataValidatorForAnomalyValues = (graphData) => { const anomalySeriesCount = 3; // metric, upper, lower return ( graphData.metrics && @@ -186,7 +186,7 @@ export const timeRangeFromUrl = (search = window.location.search) => { * @param {String} label label for the template variable * @returns {String} */ -export const addPrefixToLabel = label => `${VARIABLE_PREFIX}${label}`; +export const addPrefixToLabel = (label) => `${VARIABLE_PREFIX}${label}`; /** * Before the templating variables are passed to the backend the @@ -197,7 +197,7 @@ export const addPrefixToLabel = label => `${VARIABLE_PREFIX}${label}`; * @param {String} label label to remove prefix from * @returns {String} */ -export const removePrefixFromLabel = label => +export const removePrefixFromLabel = (label) => (label || '').replace(new RegExp(`^${VARIABLE_PREFIX}`), ''); /** @@ -210,7 +210,7 @@ export const removePrefixFromLabel = label => * @param {Object} variables * @returns {Object} */ -export const convertVariablesForURL = variables => +export const convertVariablesForURL = (variables) => variables.reduce((acc, { name, value }) => { if (value !== null) { acc[addPrefixToLabel(name)] = value; @@ -241,7 +241,7 @@ export const templatingVariablesFromUrl = (search = window.location.search) => { * * @param {Object} variables user defined variables */ -export const setCustomVariablesFromUrl = variables => { +export const setCustomVariablesFromUrl = (variables) => { // prep the variables to append to URL const parsedVariables = convertVariablesForURL(variables); // update the URL @@ -353,7 +353,7 @@ export const panelToUrl = ( * @param {Array} values data points * @returns {Number} */ -const metricValueMapper = values => values[0]?.[1]; +const metricValueMapper = (values) => values[0]?.[1]; /** * Get the metric name from metric object @@ -364,7 +364,7 @@ const metricValueMapper = values => values[0]?.[1]; * @param {Object} metric metric object * @returns {String} */ -const metricNameMapper = metric => Object.values(metric)?.[0]; +const metricNameMapper = (metric) => Object.values(metric)?.[0]; /** * Parse metric object to extract metric value and name in diff --git a/app/assets/javascripts/monitoring/validators.js b/app/assets/javascripts/monitoring/validators.js index c6b323f6360..05a9d8b9db5 100644 --- a/app/assets/javascripts/monitoring/validators.js +++ b/app/assets/javascripts/monitoring/validators.js @@ -1,6 +1,6 @@ import { isSafeURL } from '~/lib/utils/url_utility'; -const isRunbookUrlValid = runbookUrl => { +const isRunbookUrlValid = (runbookUrl) => { if (!runbookUrl) { return true; } @@ -21,7 +21,7 @@ const isRunbookUrlValid = runbookUrl => { // } // } export function alertsValidator(value) { - return Object.keys(value).every(key => { + return Object.keys(value).every((key) => { const alert = value[key]; return ( alert.alert_path && @@ -49,7 +49,7 @@ export function alertsValidator(value) { // ] export function queriesValidator(value) { return value.every( - query => + (query) => query.metricId && typeof query.metricId === 'string' && typeof query.label === 'string', ); } diff --git a/app/assets/javascripts/mr_notes/init_notes.js b/app/assets/javascripts/mr_notes/init_notes.js index 2be7cc951fc..ab88a610469 100644 --- a/app/assets/javascripts/mr_notes/init_notes.js +++ b/app/assets/javascripts/mr_notes/init_notes.js @@ -33,7 +33,7 @@ export default () => { computed: { ...mapGetters(['discussionTabCounter']), ...mapState({ - activeTab: state => state.page.activeTab, + activeTab: (state) => state.page.activeTab, }), isShowTabActive() { return this.activeTab === 'show'; diff --git a/app/assets/javascripts/mr_notes/stores/getters.js b/app/assets/javascripts/mr_notes/stores/getters.js index 245443d7ecf..556254486db 100644 --- a/app/assets/javascripts/mr_notes/stores/getters.js +++ b/app/assets/javascripts/mr_notes/stores/getters.js @@ -1,7 +1,7 @@ // Note: this getter is important because // `noteableData` is namespaced under `notes` for `~/mr_notes/stores` // while `noteableData` is directly available as `state.noteableData` for `~/notes/stores` -export const getNoteableData = state => state.notes.noteableData; +export const getNoteableData = (state) => state.notes.noteableData; export default { isLoggedIn(state, getters) { diff --git a/app/assets/javascripts/mr_popover/components/mr_popover.vue b/app/assets/javascripts/mr_popover/components/mr_popover.vue index bf810978648..2058f0c9b76 100644 --- a/app/assets/javascripts/mr_popover/components/mr_popover.vue +++ b/app/assets/javascripts/mr_popover/components/mr_popover.vue @@ -72,7 +72,7 @@ export default { apollo: { mergeRequest: { query, - update: data => data.project.mergeRequest, + update: (data) => data.project.mergeRequest, variables() { const { projectPath, mergeRequestIID } = this; diff --git a/app/assets/javascripts/mr_popover/index.js b/app/assets/javascripts/mr_popover/index.js index 18c0e201300..03ddfd13d50 100644 --- a/app/assets/javascripts/mr_popover/index.js +++ b/app/assets/javascripts/mr_popover/index.js @@ -42,7 +42,7 @@ const handleMRPopoverMount = ({ apolloProvider, projectPath, mrTitle, iid }) => }, 200); // 200ms delay so not every mouseover triggers Popover + API Call }; -export default elements => { +export default (elements) => { const mrLinks = elements || [...document.querySelectorAll('.gfm-merge_request')]; if (mrLinks.length > 0) { Vue.use(VueApollo); @@ -52,7 +52,7 @@ export default elements => { }); const listenerAddedAttr = 'data-mr-listener-added'; - mrLinks.forEach(el => { + mrLinks.forEach((el) => { const { projectPath, mrTitle, iid } = el.dataset; if (!el.getAttribute(listenerAddedAttr) && projectPath && mrTitle && iid) { diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js index 8e123c14814..e668b492ebe 100644 --- a/app/assets/javascripts/namespace_select.js +++ b/app/assets/javascripts/namespace_select.js @@ -25,7 +25,7 @@ export default class NamespaceSelect { return `${selected.kind}: ${selected.full_path}`; }, data(term, dataCallback) { - return Api.namespaces(term, namespaces => { + return Api.namespaces(term, (namespaces) => { if (isFilter) { const anyNamespace = { text: __('Any namespace'), diff --git a/app/assets/javascripts/network/branch_graph.js b/app/assets/javascripts/network/branch_graph.js index 9539f1c52c7..3574fc47088 100644 --- a/app/assets/javascripts/network/branch_graph.js +++ b/app/assets/javascripts/network/branch_graph.js @@ -66,12 +66,12 @@ export default class BranchGraph { collectParents() { const ref = this.commits; const results = []; - ref.forEach(c => { + ref.forEach((c) => { this.mtime = Math.max(this.mtime, c.time); this.mspace = Math.max(this.mspace, c.space); const ref1 = c.parents; const results1 = []; - ref1.forEach(p => { + ref1.forEach((p) => { this.parents[p[0]] = true; results1.push((this.mspace = Math.max(this.mspace, p[1]))); }); diff --git a/app/assets/javascripts/new_branch_form.js b/app/assets/javascripts/new_branch_form.js index dd820f1adae..d93db7399e6 100644 --- a/app/assets/javascripts/new_branch_form.js +++ b/app/assets/javascripts/new_branch_form.js @@ -60,7 +60,7 @@ export default class NewBranchForm { return values; }; const formatter = function (values, restriction) { - const formatted = values.map(value => { + const formatted = values.map((value) => { switch (false) { case !/\s/.test(value): return 'spaces'; diff --git a/app/assets/javascripts/notebook/cells/markdown.vue b/app/assets/javascripts/notebook/cells/markdown.vue index c04f2a2d465..d1d5ae5265a 100644 --- a/app/assets/javascripts/notebook/cells/markdown.vue +++ b/app/assets/javascripts/notebook/cells/markdown.vue @@ -77,11 +77,11 @@ function renderKatex(t) { } return [text, numInline > 0]; } -renderer.paragraph = t => { +renderer.paragraph = (t) => { const [text, inline] = renderKatex(t); return `<p class="${inline ? 'inline-katex' : ''}">${text}</p>`; }; -renderer.listitem = t => { +renderer.listitem = (t) => { const [text, inline] = renderKatex(t); return `<li class="${inline ? 'inline-katex' : ''}">${text}</li>`; }; diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index eb09468ca49..857e5a34db6 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -345,7 +345,7 @@ export default class Notes { votesBlock = $('.js-awards-block').eq(0); loadAwardsHandler() - .then(awardsHandler => { + .then((awardsHandler) => { awardsHandler.addAwardToEmojiBar(votesBlock, noteEntity.commands_changes.emoji_award); awardsHandler.scrollToAwards(); }) @@ -1396,7 +1396,7 @@ export default class Notes { let tempFormContent; // Identify executed quick actions from `formContent` - const executedCommands = availableQuickActions.filter(command => { + const executedCommands = availableQuickActions.filter((command) => { const commandRegex = new RegExp(`/${command.name}`); return commandRegex.test(formContent); }); @@ -1583,7 +1583,7 @@ export default class Notes { // Make request to submit comment on server return axios .post(`${formAction}?html=true`, formData) - .then(res => { + .then((res) => { const note = res.data; $submitBtn.prop('disabled', false); diff --git a/app/assets/javascripts/notes/components/diff_with_note.vue b/app/assets/javascripts/notes/components/diff_with_note.vue index 1580c94658a..b7355d4d927 100644 --- a/app/assets/javascripts/notes/components/diff_with_note.vue +++ b/app/assets/javascripts/notes/components/diff_with_note.vue @@ -31,7 +31,7 @@ export default { }, computed: { ...mapState({ - projectPath: state => state.diffs.projectPath, + projectPath: (state) => state.diffs.projectPath, }), diffMode() { return getDiffMode(this.discussion.diff_file); diff --git a/app/assets/javascripts/notes/components/discussion_actions.vue b/app/assets/javascripts/notes/components/discussion_actions.vue index 21ce608becb..7ad1538c3bb 100644 --- a/app/assets/javascripts/notes/components/discussion_actions.vue +++ b/app/assets/javascripts/notes/components/discussion_actions.vue @@ -42,10 +42,10 @@ export default { return this.glFeatures.hideJumpToNextUnresolvedInThreads; }, resolvableNotes() { - return this.discussion.notes.filter(x => x.resolvable); + return this.discussion.notes.filter((x) => x.resolvable); }, userCanResolveDiscussion() { - return this.resolvableNotes.every(note => note.current_user?.can_resolve_discussion); + return this.resolvableNotes.every((note) => note.current_user?.can_resolve_discussion); }, }, }; diff --git a/app/assets/javascripts/notes/components/discussion_counter.vue b/app/assets/javascripts/notes/components/discussion_counter.vue index 2427a3f98ad..0a72627834d 100644 --- a/app/assets/javascripts/notes/components/discussion_counter.vue +++ b/app/assets/javascripts/notes/components/discussion_counter.vue @@ -32,10 +32,10 @@ export default { return this.getNoteableData.create_issue_to_resolve_discussions_path; }, toggeableDiscussions() { - return this.discussions.filter(discussion => !discussion.individual_note); + return this.discussions.filter((discussion) => !discussion.individual_note); }, allExpanded() { - return this.toggeableDiscussions.every(discussion => discussion.expanded); + return this.toggeableDiscussions.every((discussion) => discussion.expanded); }, lineResolveClass() { return this.allResolved ? 'line-resolve-btn is-active' : 'line-resolve-text'; @@ -48,7 +48,7 @@ export default { ...mapActions(['setExpandDiscussions']), handleExpandDiscussions() { this.setExpandDiscussions({ - discussionIds: this.toggeableDiscussions.map(discussion => discussion.id), + discussionIds: this.toggeableDiscussions.map((discussion) => discussion.id), expanded: !this.allExpanded, }); }, diff --git a/app/assets/javascripts/notes/components/discussion_filter.vue b/app/assets/javascripts/notes/components/discussion_filter.vue index 08c22f0b4c6..aa61aa9b3cb 100644 --- a/app/assets/javascripts/notes/components/discussion_filter.vue +++ b/app/assets/javascripts/notes/components/discussion_filter.vue @@ -42,7 +42,7 @@ export default { ...mapGetters(['getNotesDataByProp', 'timelineEnabled']), currentFilter() { if (!this.currentValue) return this.filters[0]; - return this.filters.find(filter => filter.value === this.currentValue); + return this.filters.find((filter) => filter.value === this.currentValue); }, }, created() { diff --git a/app/assets/javascripts/notes/components/multiline_comment_utils.js b/app/assets/javascripts/notes/components/multiline_comment_utils.js index 2451400e980..4991695b97e 100644 --- a/app/assets/javascripts/notes/components/multiline_comment_utils.js +++ b/app/assets/javascripts/notes/components/multiline_comment_utils.js @@ -48,11 +48,11 @@ export function getLineClasses(line) { export function commentLineOptions(diffLines, startingLine, lineCode, side = 'left') { const preferredSide = side === 'left' ? 'old_line' : 'new_line'; const fallbackSide = preferredSide === 'new_line' ? 'old_line' : 'new_line'; - const notMatchType = l => l.type !== 'match'; + const notMatchType = (l) => l.type !== 'match'; const linesCopy = [...diffLines]; // don't mutate the argument const startingLineCode = startingLine.line_code; - const currentIndex = linesCopy.findIndex(line => line.line_code === lineCode); + const currentIndex = linesCopy.findIndex((line) => line.line_code === lineCode); // We're limiting adding comments to only lines above the current line // to make rendering simpler. Future interations will use a more @@ -66,10 +66,10 @@ export function commentLineOptions(diffLines, startingLine, lineCode, side = 'le // If the selected line is "hidden" in an unchanged line block // or "above" the current group of lines add it to the array so // that the drop down is not defaulted to empty - const selectedIndex = lines.findIndex(line => line.line_code === startingLineCode); + const selectedIndex = lines.findIndex((line) => line.line_code === startingLineCode); if (selectedIndex < 0) lines.unshift(startingLine); - return lines.map(l => { + return lines.map((l) => { const { line_code, type, old_line, new_line } = l; return { value: { line_code, type, old_line, new_line }, @@ -103,7 +103,7 @@ export function getCommentedLines(selectedCommentPosition, diffLines) { }; } - const findLineCodeIndex = line => position => { + const findLineCodeIndex = (line) => (position) => { return [position.line_code, position.left?.line_code, position.right?.line_code].includes( line.line_code, ); diff --git a/app/assets/javascripts/notes/components/note_actions.vue b/app/assets/javascripts/notes/components/note_actions.vue index fc131f548b4..b85cfa83e09 100644 --- a/app/assets/javascripts/notes/components/note_actions.vue +++ b/app/assets/javascripts/notes/components/note_actions.vue @@ -206,14 +206,14 @@ export default { const { project_id, iid } = this.getNoteableData; if (this.isUserAssigned) { - assignees = assignees.filter(assignee => assignee.id !== this.author.id); + assignees = assignees.filter((assignee) => assignee.id !== this.author.id); } else { assignees.push({ id: this.author.id }); } if (this.targetType === 'issue') { Api.updateIssue(project_id, iid, { - assignee_ids: assignees.map(assignee => assignee.id), + assignee_ids: assignees.map((assignee) => assignee.id), }) .then(() => this.handleAssigneeUpdate(assignees)) .catch(() => flash(__('Something went wrong while updating assignees'))); diff --git a/app/assets/javascripts/notes/components/note_body.vue b/app/assets/javascripts/notes/components/note_body.vue index 65b89b94eaa..094ebe5316a 100644 --- a/app/assets/javascripts/notes/components/note_body.vue +++ b/app/assets/javascripts/notes/components/note_body.vue @@ -52,7 +52,7 @@ export default { return this.getDiscussion(this.note.discussion_id); }, ...mapState({ - batchSuggestionsInfo: state => state.notes.batchSuggestionsInfo, + batchSuggestionsInfo: (state) => state.notes.batchSuggestionsInfo, }), noteBody() { return this.note.note; diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue index 87082a64400..47202d0e241 100644 --- a/app/assets/javascripts/notes/components/note_form.vue +++ b/app/assets/javascripts/notes/components/note_form.vue @@ -115,7 +115,7 @@ export default { 'getUserDataByProp', ]), ...mapState({ - withBatchComments: state => state.batchComments?.withBatchComments, + withBatchComments: (state) => state.batchComments?.withBatchComments, }), ...mapGetters('batchComments', ['hasDrafts']), showBatchCommentsActions() { @@ -126,8 +126,8 @@ export default { return ( this.discussion?.notes - .filter(n => n.resolvable) - .some(n => n.current_user?.can_resolve_discussion) || this.isDraft + .filter((n) => n.resolvable) + .some((n) => n.current_user?.can_resolve_discussion) || this.isDraft ); }, noteHash() { diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index 62ee7f30c57..0a9a3da6069 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -201,14 +201,14 @@ export default { }; this.saveNote(replyData) - .then(res => { + .then((res) => { if (res.hasFlash !== true) { this.isReplying = false; clearDraft(this.autosaveKey); } callback(); }) - .catch(err => { + .catch((err) => { this.removePlaceholderNotes(); const msg = __( 'Your comment could not be submitted! Please check your network connection and try again.', diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index 5073922e4a4..eaa64cf7c01 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -296,7 +296,7 @@ export default { this.updateSuccess(); callback(); }) - .catch(response => { + .catch((response) => { if (response.status === httpStatusCodes.GONE) { this.removeNote(this.note); this.updateSuccess(); diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue index 9eaa4e422d5..e9e687a8743 100644 --- a/app/assets/javascripts/notes/components/notes_app.vue +++ b/app/assets/javascripts/notes/components/notes_app.vue @@ -130,7 +130,7 @@ export default { const { parentElement } = this.$el; if (parentElement && parentElement.classList.contains('js-vue-notes-event')) { - parentElement.addEventListener('toggleAward', event => { + parentElement.addEventListener('toggleAward', (event) => { const { awardName, noteId } = event.detail; this.toggleAward({ awardName, noteId }); }); @@ -217,7 +217,7 @@ export default { const noteId = hash && hash.replace(/^note_/, ''); if (noteId) { - const discussion = this.discussions.find(d => d.notes.some(({ id }) => id === noteId)); + const discussion = this.discussions.find((d) => d.notes.some(({ id }) => id === noteId)); if (discussion) { this.expandDiscussion({ discussionId: discussion.id }); diff --git a/app/assets/javascripts/notes/components/toggle_replies_widget.vue b/app/assets/javascripts/notes/components/toggle_replies_widget.vue index 0628e1d8647..ab7fa793bdc 100644 --- a/app/assets/javascripts/notes/components/toggle_replies_widget.vue +++ b/app/assets/javascripts/notes/components/toggle_replies_widget.vue @@ -26,9 +26,9 @@ export default { return this.replies[this.replies.length - 1]; }, uniqueAuthors() { - const authors = this.replies.map(reply => reply.author || {}); + const authors = this.replies.map((reply) => reply.author || {}); - return uniqBy(authors, author => author.username); + return uniqBy(authors, (author) => author.username); }, className() { return this.collapsed ? 'collapsed' : 'expanded'; diff --git a/app/assets/javascripts/notes/discussion_filters.js b/app/assets/javascripts/notes/discussion_filters.js index cdf9a46c5aa..7c9e7703d59 100644 --- a/app/assets/javascripts/notes/discussion_filters.js +++ b/app/assets/javascripts/notes/discussion_filters.js @@ -1,13 +1,13 @@ import Vue from 'vue'; import DiscussionFilter from './components/discussion_filter.vue'; -export default store => { +export default (store) => { const discussionFilterEl = document.getElementById('js-vue-discussion-filter'); if (discussionFilterEl) { const { defaultFilter, notesFilters } = discussionFilterEl.dataset; const filterValues = notesFilters ? JSON.parse(notesFilters) : {}; - const filters = Object.keys(filterValues).map(entry => ({ + const filters = Object.keys(filterValues).map((entry) => ({ title: entry, value: filterValues[entry], })); diff --git a/app/assets/javascripts/notes/mixins/diff_line_note_form.js b/app/assets/javascripts/notes/mixins/diff_line_note_form.js index c4a42eb1a98..5ce541781d4 100644 --- a/app/assets/javascripts/notes/mixins/diff_line_note_form.js +++ b/app/assets/javascripts/notes/mixins/diff_line_note_form.js @@ -9,9 +9,9 @@ import { formatLineRange } from '~/notes/components/multiline_comment_utils'; export default { computed: { ...mapState({ - noteableData: state => state.notes.noteableData, - notesData: state => state.notes.notesData, - withBatchComments: state => state.batchComments?.withBatchComments, + noteableData: (state) => state.notes.noteableData, + notesData: (state) => state.notes.notesData, + withBatchComments: (state) => state.batchComments?.withBatchComments, }), ...mapGetters('diffs', ['getDiffFileByHash']), ...mapGetters('batchComments', ['shouldRenderDraftRowInDiscussion', 'draftForDiscussion']), diff --git a/app/assets/javascripts/notes/mixins/discussion_navigation.js b/app/assets/javascripts/notes/mixins/discussion_navigation.js index c6932bfacae..96974c4fa2d 100644 --- a/app/assets/javascripts/notes/mixins/discussion_navigation.js +++ b/app/assets/javascripts/notes/mixins/discussion_navigation.js @@ -99,7 +99,7 @@ export default { 'getDiscussion', ]), ...mapState({ - currentDiscussionId: state => state.notes.currentDiscussionId, + currentDiscussionId: (state) => state.notes.currentDiscussionId, }), }, methods: { diff --git a/app/assets/javascripts/notes/mixins/resolvable.js b/app/assets/javascripts/notes/mixins/resolvable.js index cef4475ed1d..baada4c5ce8 100644 --- a/app/assets/javascripts/notes/mixins/resolvable.js +++ b/app/assets/javascripts/notes/mixins/resolvable.js @@ -15,7 +15,7 @@ export default { if (notes) { // Decide resolved state using store. Only valid for discussions. - return notes.filter(note => !note.system).every(note => note.resolved); + return notes.filter((note) => !note.system).every((note) => note.resolved); } return resolved; diff --git a/app/assets/javascripts/notes/sort_discussions.js b/app/assets/javascripts/notes/sort_discussions.js index a06c23f5f76..ecfa3223039 100644 --- a/app/assets/javascripts/notes/sort_discussions.js +++ b/app/assets/javascripts/notes/sort_discussions.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import SortDiscussion from './components/sort_discussion.vue'; -export default store => { +export default (store) => { const el = document.getElementById('js-vue-sort-issue-discussions'); if (!el) return null; diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 1fe5d6c2955..2480ab82304 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -141,7 +141,7 @@ export const updateNote = ({ commit, dispatch }, { endpoint, note }) => export const updateOrCreateNotes = ({ commit, state, getters, dispatch }, notes) => { const { notesById } = getters; - const debouncedFetchDiscussions = isFetching => { + const debouncedFetchDiscussions = (isFetching) => { if (!isFetching) { commit(types.SET_FETCHING_DISCUSSIONS, true); dispatch('fetchDiscussions', { path: state.notesData.discussionsPath }); @@ -159,7 +159,7 @@ export const updateOrCreateNotes = ({ commit, state, getters, dispatch }, notes) } }; - notes.forEach(note => { + notes.forEach((note) => { if (notesById[note.id]) { commit(types.UPDATE_NOTE, note); } else if (note.type === constants.DISCUSSION_NOTE || note.type === constants.DIFF_NOTE) { @@ -329,7 +329,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { } } - const processQuickActions = res => { + const processQuickActions = (res) => { const { errors: { commands_only: message } = { commands_only: null } } = res; /* The following reply means that quick actions have been successfully applied: @@ -347,7 +347,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { return res; }; - const processEmojiAward = res => { + const processEmojiAward = (res) => { const { commands_changes: commandsChanges } = res; const { emoji_award: emojiAward } = commandsChanges || {}; if (!emojiAward) { @@ -357,7 +357,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { const votesBlock = $('.js-awards-block').eq(0); return loadAwardsHandler() - .then(awardsHandler => { + .then((awardsHandler) => { awardsHandler.addAwardToEmojiBar(votesBlock, emojiAward); awardsHandler.scrollToAwards(); }) @@ -371,7 +371,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { .then(() => res); }; - const processTimeTracking = res => { + const processTimeTracking = (res) => { const { commands_changes: commandsChanges } = res; const { spend_time: spendTime, time_estimate: timeEstimate } = commandsChanges || {}; if (spendTime != null || timeEstimate != null) { @@ -383,7 +383,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { return res; }; - const removePlaceholder = res => { + const removePlaceholder = (res) => { if (replyId) { commit(types.REMOVE_PLACEHOLDER_NOTES); } @@ -391,7 +391,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { return res; }; - const processErrors = error => { + const processErrors = (error) => { if (error.response) { const { response: { data = {} }, @@ -435,7 +435,7 @@ const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => { return resp; }; -const getFetchDataParams = state => { +const getFetchDataParams = (state) => { const endpoint = state.notesData.notesPath; const options = { headers: { @@ -570,7 +570,7 @@ export const submitSuggestion = ( return Api.applySuggestion(suggestionId) .then(() => commit(types.APPLY_SUGGESTION, { discussionId, noteId, suggestionId })) .then(dispatchResolveDiscussion) - .catch(err => { + .catch((err) => { const defaultMessage = __( 'Something went wrong while applying the suggestion. Please try again.', ); @@ -591,12 +591,12 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContai const suggestionIds = state.batchSuggestionsInfo.map(({ suggestionId }) => suggestionId); const applyAllSuggestions = () => - state.batchSuggestionsInfo.map(suggestionInfo => + state.batchSuggestionsInfo.map((suggestionInfo) => commit(types.APPLY_SUGGESTION, suggestionInfo), ); const resolveAllDiscussions = () => - state.batchSuggestionsInfo.map(suggestionInfo => { + state.batchSuggestionsInfo.map((suggestionInfo) => { const { discussionId } = suggestionInfo; return dispatch('resolveDiscussion', { discussionId }).catch(() => {}); }); @@ -609,7 +609,7 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContai .then(() => Promise.all(applyAllSuggestions())) .then(() => Promise.all(resolveAllDiscussions())) .then(() => commit(types.CLEAR_SUGGESTION_BATCH)) - .catch(err => { + .catch((err) => { const defaultMessage = __( 'Something went wrong while applying the batch of suggestions. Please try again.', ); @@ -652,10 +652,10 @@ export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersio return axios .get(requestUrl) - .then(res => { + .then((res) => { dispatch('receiveDescriptionVersion', { descriptionVersion: res.data, versionId }); }) - .catch(error => { + .catch((error) => { dispatch('receiveDescriptionVersionError', error); Flash(__('Something went wrong while fetching description changes. Please try again.')); }); @@ -687,7 +687,7 @@ export const softDeleteDescriptionVersion = ( .then(() => { dispatch('receiveDeleteDescriptionVersion', versionId); }) - .catch(error => { + .catch((error) => { dispatch('receiveDeleteDescriptionVersionError', error); Flash(__('Something went wrong while deleting description changes. Please try again.')); diff --git a/app/assets/javascripts/notes/stores/collapse_utils.js b/app/assets/javascripts/notes/stores/collapse_utils.js index f34247d4eb0..b2e2f6e2c31 100644 --- a/app/assets/javascripts/notes/stores/collapse_utils.js +++ b/app/assets/javascripts/notes/stores/collapse_utils.js @@ -18,7 +18,7 @@ export const getTimeDifferenceMinutes = (noteBeggining, noteEnd) => { * @param {Object} note * @returns {Boolean} */ -export const isDescriptionSystemNote = note => note.system && note.note === DESCRIPTION_TYPE; +export const isDescriptionSystemNote = (note) => note.system && note.note === DESCRIPTION_TYPE; /** * Collapses the system notes of a description type, e.g. Changed the description, n minutes ago @@ -29,7 +29,7 @@ export const isDescriptionSystemNote = note => note.system && note.note === DESC * @param {Array} notes * @returns {Array} */ -export const collapseSystemNotes = notes => { +export const collapseSystemNotes = (notes) => { let lastDescriptionSystemNote = null; let lastDescriptionSystemNoteIndex = -1; diff --git a/app/assets/javascripts/notes/stores/getters.js b/app/assets/javascripts/notes/stores/getters.js index 5b3ffa425a0..5891a2e63e3 100644 --- a/app/assets/javascripts/notes/stores/getters.js +++ b/app/assets/javascripts/notes/stores/getters.js @@ -2,14 +2,14 @@ import { flattenDeep, clone } from 'lodash'; import * as constants from '../constants'; import { collapseSystemNotes } from './collapse_utils'; -export const discussions = state => { +export const discussions = (state) => { let discussionsInState = clone(state.discussions); // NOTE: not testing bc will be removed when backend is finished. if (state.isTimelineEnabled) { discussionsInState = discussionsInState .reduce((acc, discussion) => { - const transformedToIndividualNotes = discussion.notes.map(note => ({ + const transformedToIndividualNotes = discussion.notes.map((note) => ({ ...discussion, id: note.id, created_at: note.created_at, @@ -29,52 +29,52 @@ export const discussions = state => { return collapseSystemNotes(discussionsInState); }; -export const convertedDisscussionIds = state => state.convertedDisscussionIds; +export const convertedDisscussionIds = (state) => state.convertedDisscussionIds; -export const targetNoteHash = state => state.targetNoteHash; +export const targetNoteHash = (state) => state.targetNoteHash; -export const getNotesData = state => state.notesData; +export const getNotesData = (state) => state.notesData; -export const isNotesFetched = state => state.isNotesFetched; +export const isNotesFetched = (state) => state.isNotesFetched; /* * WARNING: This is an example of an "unnecessary" getter * more info found here: https://gitlab.com/groups/gitlab-org/-/epics/2913. */ -export const sortDirection = state => state.discussionSortOrder; +export const sortDirection = (state) => state.discussionSortOrder; -export const persistSortOrder = state => state.persistSortOrder; +export const persistSortOrder = (state) => state.persistSortOrder; -export const timelineEnabled = state => state.isTimelineEnabled; +export const timelineEnabled = (state) => state.isTimelineEnabled; -export const isLoading = state => state.isLoading; +export const isLoading = (state) => state.isLoading; -export const getNotesDataByProp = state => prop => state.notesData[prop]; +export const getNotesDataByProp = (state) => (prop) => state.notesData[prop]; -export const getNoteableData = state => state.noteableData; +export const getNoteableData = (state) => state.noteableData; -export const getNoteableDataByProp = state => prop => state.noteableData[prop]; +export const getNoteableDataByProp = (state) => (prop) => state.noteableData[prop]; -export const getBlockedByIssues = state => state.noteableData.blocked_by_issues; +export const getBlockedByIssues = (state) => state.noteableData.blocked_by_issues; -export const userCanReply = state => Boolean(state.noteableData.current_user.can_create_note); +export const userCanReply = (state) => Boolean(state.noteableData.current_user.can_create_note); -export const openState = state => state.noteableData.state; +export const openState = (state) => state.noteableData.state; -export const getUserData = state => state.userData || {}; +export const getUserData = (state) => state.userData || {}; -export const getUserDataByProp = state => prop => state.userData && state.userData[prop]; +export const getUserDataByProp = (state) => (prop) => state.userData && state.userData[prop]; -export const descriptionVersions = state => state.descriptionVersions; +export const descriptionVersions = (state) => state.descriptionVersions; -export const notesById = state => +export const notesById = (state) => state.discussions.reduce((acc, note) => { - note.notes.every(n => Object.assign(acc, { [n.id]: n })); + note.notes.every((n) => Object.assign(acc, { [n.id]: n })); return acc; }, {}); -export const noteableType = state => { +export const noteableType = (state) => { const { ISSUE_NOTEABLE_TYPE, MERGE_REQUEST_NOTEABLE_TYPE, EPIC_NOTEABLE_TYPE } = constants; if (state.noteableData.noteableType === EPIC_NOTEABLE_TYPE) { @@ -84,21 +84,21 @@ export const noteableType = state => { return state.noteableData.merge_params ? MERGE_REQUEST_NOTEABLE_TYPE : ISSUE_NOTEABLE_TYPE; }; -const reverseNotes = array => array.slice(0).reverse(); +const reverseNotes = (array) => array.slice(0).reverse(); const isLastNote = (note, state) => !note.system && state.userData && note.author && note.author.id === state.userData.id; -export const getCurrentUserLastNote = state => - flattenDeep(reverseNotes(state.discussions).map(note => reverseNotes(note.notes))).find(el => +export const getCurrentUserLastNote = (state) => + flattenDeep(reverseNotes(state.discussions).map((note) => reverseNotes(note.notes))).find((el) => isLastNote(el, state), ); -export const getDiscussionLastNote = state => discussion => - reverseNotes(discussion.notes).find(el => isLastNote(el, state)); +export const getDiscussionLastNote = (state) => (discussion) => + reverseNotes(discussion.notes).find((el) => isLastNote(el, state)); -export const unresolvedDiscussionsCount = state => state.unresolvedDiscussionsCount; -export const resolvableDiscussionsCount = state => state.resolvableDiscussionsCount; +export const unresolvedDiscussionsCount = (state) => state.unresolvedDiscussionsCount; +export const resolvableDiscussionsCount = (state) => state.resolvableDiscussionsCount; export const showJumpToNextDiscussion = (state, getters) => (mode = 'discussion') => { const orderedDiffs = @@ -109,20 +109,20 @@ export const showJumpToNextDiscussion = (state, getters) => (mode = 'discussion' return orderedDiffs.length > 1; }; -export const isDiscussionResolved = (state, getters) => discussionId => +export const isDiscussionResolved = (state, getters) => (discussionId) => getters.resolvedDiscussionsById[discussionId] !== undefined; -export const allResolvableDiscussions = state => - state.discussions.filter(d => !d.individual_note && d.resolvable); +export const allResolvableDiscussions = (state) => + state.discussions.filter((d) => !d.individual_note && d.resolvable); -export const resolvedDiscussionsById = state => { +export const resolvedDiscussionsById = (state) => { const map = {}; state.discussions - .filter(d => d.resolvable) - .forEach(n => { + .filter((d) => d.resolvable) + .forEach((n) => { if (n.notes) { - const resolved = n.notes.filter(note => note.resolvable).every(note => note.resolved); + const resolved = n.notes.filter((note) => note.resolvable).every((note) => note.resolved); if (resolved) { map[n.id] = n; @@ -136,7 +136,7 @@ export const resolvedDiscussionsById = state => { // Gets Discussions IDs ordered by the date of their initial note export const unresolvedDiscussionsIdsByDate = (state, getters) => getters.allResolvableDiscussions - .filter(d => !d.resolved) + .filter((d) => !d.resolved) .sort((a, b) => { const aDate = new Date(a.notes[0].created_at); const bDate = new Date(b.notes[0].created_at); @@ -147,7 +147,7 @@ export const unresolvedDiscussionsIdsByDate = (state, getters) => return aDate === bDate ? 0 : 1; }) - .map(d => d.id); + .map((d) => d.id); // Gets Discussions IDs ordered by their position in the diff // @@ -156,7 +156,7 @@ export const unresolvedDiscussionsIdsByDate = (state, getters) => // line numbers. export const unresolvedDiscussionsIdsByDiff = (state, getters) => getters.allResolvableDiscussions - .filter(d => !d.resolved && d.active) + .filter((d) => !d.resolved && d.active) .sort((a, b) => { if (!a.diff_file || !b.diff_file) { return 0; @@ -176,7 +176,7 @@ export const unresolvedDiscussionsIdsByDiff = (state, getters) => ? -1 : 1; }) - .map(d => d.id); + .map((d) => d.id); export const resolvedDiscussionCount = (state, getters) => { const resolvedMap = getters.resolvedDiscussionsById; @@ -184,16 +184,16 @@ export const resolvedDiscussionCount = (state, getters) => { return Object.keys(resolvedMap).length; }; -export const discussionTabCounter = state => +export const discussionTabCounter = (state) => state.discussions.reduce( (acc, discussion) => - acc + discussion.notes.filter(note => !note.system && !note.placeholder).length, + acc + discussion.notes.filter((note) => !note.system && !note.placeholder).length, 0, ); // Returns the list of discussion IDs ordered according to given parameter // @param {Boolean} diffOrder - is ordered by diff? -export const unresolvedDiscussionsIdsOrdered = (state, getters) => diffOrder => { +export const unresolvedDiscussionsIdsOrdered = (state, getters) => (diffOrder) => { if (diffOrder) { return getters.unresolvedDiscussionsIdsByDiff; } @@ -241,17 +241,17 @@ export const previousUnresolvedDiscussionId = (state, getters) => (discussionId, getters.findUnresolvedDiscussionIdNeighbor({ discussionId, diffOrder, step: -1 }); // @param {Boolean} diffOrder - is ordered by diff? -export const firstUnresolvedDiscussionId = (state, getters) => diffOrder => { +export const firstUnresolvedDiscussionId = (state, getters) => (diffOrder) => { if (diffOrder) { return getters.unresolvedDiscussionsIdsByDiff[0]; } return getters.unresolvedDiscussionsIdsByDate[0]; }; -export const getDiscussion = state => discussionId => - state.discussions.find(discussion => discussion.id === discussionId); +export const getDiscussion = (state) => (discussionId) => + state.discussions.find((discussion) => discussion.id === discussionId); -export const commentsDisabled = state => state.commentsDisabled; +export const commentsDisabled = (state) => state.commentsDisabled; export const suggestionsCount = (state, getters) => - Object.values(getters.notesById).filter(n => n.suggestions.length).length; + Object.values(getters.notesById).filter((n) => n.suggestions.length).length; diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js index 53387b2eaff..2c51ce0d970 100644 --- a/app/assets/javascripts/notes/stores/mutations.js +++ b/app/assets/javascripts/notes/stores/mutations.js @@ -7,7 +7,7 @@ export default { [types.ADD_NEW_NOTE](state, data) { const note = data.discussion ? data.discussion.notes[0] : data; const { discussion_id, type } = note; - const [exists] = state.discussions.filter(n => n.id === note.discussion_id); + const [exists] = state.discussions.filter((n) => n.id === note.discussion_id); const isDiscussion = type === constants.DISCUSSION_NOTE || type === constants.DIFF_NOTE; if (!exists) { @@ -128,7 +128,7 @@ export default { // To support legacy notes, should be very rare case. if (discussion.individual_note && discussion.notes.length > 1) { - discussion.notes.forEach(n => { + discussion.notes.forEach((n) => { acc.push({ ...discussion, ...diffData, @@ -183,7 +183,7 @@ export default { const { id, name, username } = state.userData; const hasEmojiAwardedByCurrentUser = note.award_emoji.filter( - emoji => `${emoji.name}` === `${data.awardName}` && emoji.user.id === id, + (emoji) => `${emoji.name}` === `${data.awardName}` && emoji.user.id === id, ); if (hasEmojiAwardedByCurrentUser.length) { @@ -206,7 +206,7 @@ export default { [types.SET_EXPAND_DISCUSSIONS](state, { discussionIds, expanded }) { if (discussionIds?.length) { - discussionIds.forEach(discussionId => { + discussionIds.forEach((discussionId) => { const discussion = utils.findNoteObjectById(state.discussions, discussionId); Object.assign(discussion, { expanded }); }); @@ -236,7 +236,7 @@ export default { const noteObj = utils.findNoteObjectById(state.discussions, discussionId); const comment = utils.findNoteObjectById(noteObj.notes, noteId); - comment.suggestions = comment.suggestions.map(suggestion => ({ + comment.suggestions = comment.suggestions.map((suggestion) => ({ ...suggestion, applied: suggestion.applied || suggestion.id === suggestionId, appliable: false, @@ -244,13 +244,13 @@ export default { }, [types.SET_APPLYING_BATCH_STATE](state, isApplyingBatch) { - state.batchSuggestionsInfo.forEach(suggestionInfo => { + state.batchSuggestionsInfo.forEach((suggestionInfo) => { const { discussionId, noteId, suggestionId } = suggestionInfo; const noteObj = utils.findNoteObjectById(state.discussions, discussionId); const comment = utils.findNoteObjectById(noteObj.notes, noteId); - comment.suggestions = comment.suggestions.map(suggestion => ({ + comment.suggestions = comment.suggestions.map((suggestion) => ({ ...suggestion, is_applying_batch: suggestion.id === suggestionId && isApplyingBatch, })); @@ -278,7 +278,7 @@ export default { [types.UPDATE_DISCUSSION](state, noteData) { const note = noteData; - const selectedDiscussion = state.discussions.find(disc => disc.id === note.id); + const selectedDiscussion = state.discussions.find((disc) => disc.id === note.id); note.expanded = true; // override expand flag to prevent collapse if (note.diff_file) { Object.assign(note, { @@ -289,7 +289,7 @@ export default { }, [types.UPDATE_DISCUSSION_POSITION](state, { discussionId, position }) { - const selectedDiscussion = state.discussions.find(disc => disc.id === discussionId); + const selectedDiscussion = state.discussions.find((disc) => disc.id === discussionId); if (selectedDiscussion) Object.assign(selectedDiscussion.position, { ...position }); }, @@ -341,13 +341,13 @@ export default { }, [types.UPDATE_RESOLVABLE_DISCUSSIONS_COUNTS](state) { state.resolvableDiscussionsCount = state.discussions.filter( - discussion => !discussion.individual_note && discussion.resolvable, + (discussion) => !discussion.individual_note && discussion.resolvable, ).length; state.unresolvedDiscussionsCount = state.discussions.filter( - discussion => + (discussion) => !discussion.individual_note && discussion.resolvable && - discussion.notes.some(note => note.resolvable && !note.resolved), + discussion.notes.some((note) => note.resolvable && !note.resolved), ).length; }, diff --git a/app/assets/javascripts/notes/stores/utils.js b/app/assets/javascripts/notes/stores/utils.js index 10faac0c32b..6df926e1249 100644 --- a/app/assets/javascripts/notes/stores/utils.js +++ b/app/assets/javascripts/notes/stores/utils.js @@ -6,13 +6,13 @@ import createGqClient, { fetchPolicies } from '~/lib/graphql'; // factory function because global flag makes RegExp stateful const createQuickActionsRegex = () => /^\/\w+.*$/gm; -export const findNoteObjectById = (notes, id) => notes.filter(n => n.id === id)[0]; +export const findNoteObjectById = (notes, id) => notes.filter((n) => n.id === id)[0]; -export const getQuickActionText = note => { +export const getQuickActionText = (note) => { let text = __('Applying command'); const quickActions = AjaxCache.get(gl.GfmAutoComplete.dataSources.commands) || []; - const executedCommands = quickActions.filter(command => { + const executedCommands = quickActions.filter((command) => { const commandRegex = new RegExp(`/${command.name}`); return commandRegex.test(note); }); @@ -29,12 +29,12 @@ export const getQuickActionText = note => { return text; }; -export const hasQuickActions = note => createQuickActionsRegex().test(note); +export const hasQuickActions = (note) => createQuickActionsRegex().test(note); -export const stripQuickActions = note => note.replace(createQuickActionsRegex(), '').trim(); +export const stripQuickActions = (note) => note.replace(createQuickActionsRegex(), '').trim(); -export const prepareDiffLines = diffLines => - diffLines.map(line => ({ ...trimFirstCharOfLineContent(line) })); +export const prepareDiffLines = (diffLines) => + diffLines.map((line) => ({ ...trimFirstCharOfLineContent(line) })); export const gqClient = createGqClient( {}, diff --git a/app/assets/javascripts/notes/utils.js b/app/assets/javascripts/notes/utils.js index e6c2eb06a51..7966a884eab 100644 --- a/app/assets/javascripts/notes/utils.js +++ b/app/assets/javascripts/notes/utils.js @@ -4,7 +4,7 @@ * Tracks snowplow event when User toggles timeline view * @param {Boolean} enabled that will be send as a property for the event */ -export const trackToggleTimelineView = enabled => ({ +export const trackToggleTimelineView = (enabled) => ({ category: 'Incident Management', action: 'toggle_incident_comments_into_timeline_view', label: 'Status', diff --git a/app/assets/javascripts/notifications_dropdown.js b/app/assets/javascripts/notifications_dropdown.js index 4ad0af693fb..eaa5ec3a2e4 100644 --- a/app/assets/javascripts/notifications_dropdown.js +++ b/app/assets/javascripts/notifications_dropdown.js @@ -23,7 +23,7 @@ export default function notificationsDropdown() { Rails.fire(form[0], 'submit'); }); - $(document).on('ajax:success', '.notification-form', e => { + $(document).on('ajax:success', '.notification-form', (e) => { const data = e.detail[0]; if (data.saved) { diff --git a/app/assets/javascripts/onboarding_issues/index.js b/app/assets/javascripts/onboarding_issues/index.js index 27f2f7f0e9d..b23a10c9254 100644 --- a/app/assets/javascripts/onboarding_issues/index.js +++ b/app/assets/javascripts/onboarding_issues/index.js @@ -57,7 +57,7 @@ const showPopover = (el, path, footer, options) => { .popover('show'); // The previous popover actions have been taken, don't show those popovers anymore. - Object.keys(settings).forEach(pathSetting => { + Object.keys(settings).forEach((pathSetting) => { if (path !== pathSetting) { settings[pathSetting] = false; } else { @@ -71,7 +71,7 @@ const showPopover = (el, path, footer, options) => { } }; -export const showLearnGitLabGroupItemPopover = id => { +export const showLearnGitLabGroupItemPopover = (id) => { const el = document.querySelector(`#group-${id} .group-text a`); if (!el) return; diff --git a/app/assets/javascripts/operation_settings/store/actions.js b/app/assets/javascripts/operation_settings/store/actions.js index 1d3adeefbd8..bbbff6630d3 100644 --- a/app/assets/javascripts/operation_settings/store/actions.js +++ b/app/assets/javascripts/operation_settings/store/actions.js @@ -21,7 +21,7 @@ export const saveChanges = ({ state, dispatch }) => }, }) .then(() => dispatch('receiveSaveChangesSuccess')) - .catch(error => dispatch('receiveSaveChangesError', error)); + .catch((error) => dispatch('receiveSaveChangesError', error)); export const receiveSaveChangesSuccess = () => { /** diff --git a/app/assets/javascripts/operation_settings/store/index.js b/app/assets/javascripts/operation_settings/store/index.js index e96bb1e8aad..e3dcfd31a83 100644 --- a/app/assets/javascripts/operation_settings/store/index.js +++ b/app/assets/javascripts/operation_settings/store/index.js @@ -6,7 +6,7 @@ import mutations from './mutations'; Vue.use(Vuex); -export const createStore = initialState => +export const createStore = (initialState) => new Vuex.Store({ state: createState(initialState), actions, diff --git a/app/assets/javascripts/packages/details/components/package_files.vue b/app/assets/javascripts/packages/details/components/package_files.vue index dec443ca19d..3add454fda3 100644 --- a/app/assets/javascripts/packages/details/components/package_files.vue +++ b/app/assets/javascripts/packages/details/components/package_files.vue @@ -25,14 +25,14 @@ export default { }, computed: { filesTableRows() { - return this.packageFiles.map(pf => ({ + return this.packageFiles.map((pf) => ({ ...pf, size: this.formatSize(pf.size), pipeline: last(pf.pipelines), })); }, showCommitColumn() { - return this.filesTableRows.some(row => Boolean(row.pipeline?.id)); + return this.filesTableRows.some((row) => Boolean(row.pipeline?.id)); }, filesTableHeaderFields() { return [ @@ -55,7 +55,7 @@ export default { label: __('Created'), class: 'gl-text-right', }, - ].filter(c => !c.hide); + ].filter((c) => !c.hide); }, }, methods: { diff --git a/app/assets/javascripts/packages/list/components/packages_list.vue b/app/assets/javascripts/packages/list/components/packages_list.vue index 7067f70a923..1e38ee525b8 100644 --- a/app/assets/javascripts/packages/list/components/packages_list.vue +++ b/app/assets/javascripts/packages/list/components/packages_list.vue @@ -24,10 +24,10 @@ export default { }, computed: { ...mapState({ - perPage: state => state.pagination.perPage, - totalItems: state => state.pagination.total, - page: state => state.pagination.page, - isGroupPage: state => state.config.isGroupPage, + perPage: (state) => state.pagination.perPage, + totalItems: (state) => state.pagination.total, + page: (state) => state.pagination.page, + isGroupPage: (state) => state.config.isGroupPage, isLoading: 'isLoading', }), ...mapGetters({ list: 'getList' }), diff --git a/app/assets/javascripts/packages/list/components/packages_list_app.vue b/app/assets/javascripts/packages/list/components/packages_list_app.vue index 9439da3349d..2a786b92515 100644 --- a/app/assets/javascripts/packages/list/components/packages_list_app.vue +++ b/app/assets/javascripts/packages/list/components/packages_list_app.vue @@ -25,12 +25,12 @@ export default { }, computed: { ...mapState({ - emptyListIllustration: state => state.config.emptyListIllustration, - emptyListHelpUrl: state => state.config.emptyListHelpUrl, - filterQuery: state => state.filterQuery, - selectedType: state => state.selectedType, - packageHelpUrl: state => state.config.packageHelpUrl, - packagesCount: state => state.pagination?.total, + emptyListIllustration: (state) => state.config.emptyListIllustration, + emptyListHelpUrl: (state) => state.config.emptyListHelpUrl, + filterQuery: (state) => state.filterQuery, + selectedType: (state) => state.selectedType, + packageHelpUrl: (state) => state.config.packageHelpUrl, + packagesCount: (state) => state.pagination?.total, }), tabsToRender() { return PACKAGE_REGISTRY_TABS; diff --git a/app/assets/javascripts/packages/list/components/packages_sort.vue b/app/assets/javascripts/packages/list/components/packages_sort.vue index 47e51bbdca5..4b2d9091f8f 100644 --- a/app/assets/javascripts/packages/list/components/packages_sort.vue +++ b/app/assets/javascripts/packages/list/components/packages_sort.vue @@ -12,12 +12,12 @@ export default { }, computed: { ...mapState({ - isGroupPage: state => state.config.isGroupPage, - orderBy: state => state.sorting.orderBy, - sort: state => state.sorting.sort, + isGroupPage: (state) => state.config.isGroupPage, + orderBy: (state) => state.sorting.orderBy, + sort: (state) => state.sorting.sort, }), sortText() { - const field = this.sortableFields.find(s => s.orderBy === this.orderBy); + const field = this.sortableFields.find((s) => s.orderBy === this.orderBy); return field ? field.label : ''; }, sortableFields() { diff --git a/app/assets/javascripts/packages/list/stores/getters.js b/app/assets/javascripts/packages/list/stores/getters.js index 0af7e453f19..85c489deda0 100644 --- a/app/assets/javascripts/packages/list/stores/getters.js +++ b/app/assets/javascripts/packages/list/stores/getters.js @@ -1,5 +1,5 @@ import { LIST_KEY_PROJECT } from '../constants'; import { beautifyPath } from '../../shared/utils'; -export default state => - state.packages.map(p => ({ ...p, projectPathName: beautifyPath(p[LIST_KEY_PROJECT]) })); +export default (state) => + state.packages.map((p) => ({ ...p, projectPathName: beautifyPath(p[LIST_KEY_PROJECT]) })); diff --git a/app/assets/javascripts/packages/shared/components/package_tags.vue b/app/assets/javascripts/packages/shared/components/package_tags.vue index 3d7e233c1ba..5172b855fc3 100644 --- a/app/assets/javascripts/packages/shared/components/package_tags.vue +++ b/app/assets/javascripts/packages/shared/components/package_tags.vue @@ -43,7 +43,7 @@ export default { if (this.moreTagsDisplay) { return this.tags .slice(this.tagDisplayLimit) - .map(x => x.name) + .map((x) => x.name) .join(', '); } diff --git a/app/assets/javascripts/packages/shared/utils.js b/app/assets/javascripts/packages/shared/utils.js index d7a883e4397..677550f77ec 100644 --- a/app/assets/javascripts/packages/shared/utils.js +++ b/app/assets/javascripts/packages/shared/utils.js @@ -1,13 +1,13 @@ import { s__ } from '~/locale'; import { PackageType, TrackingCategories } from './constants'; -export const packageTypeToTrackCategory = type => +export const packageTypeToTrackCategory = (type) => // eslint-disable-next-line @gitlab/require-i18n-strings `UI::${TrackingCategories[type]}`; -export const beautifyPath = path => (path ? path.split('/').join(' / ') : ''); +export const beautifyPath = (path) => (path ? path.split('/').join(' / ') : ''); -export const getPackageTypeLabel = packageType => { +export const getPackageTypeLabel = (packageType) => { switch (packageType) { case PackageType.CONAN: return s__('PackageType|Conan'); diff --git a/app/assets/javascripts/pages/admin/admin.js b/app/assets/javascripts/pages/admin/admin.js index 038bbe392ba..e92262852cf 100644 --- a/app/assets/javascripts/pages/admin/admin.js +++ b/app/assets/javascripts/pages/admin/admin.js @@ -23,7 +23,7 @@ export default function adminInit() { } }); - $('body').on('click', '.js-toggle-colors-link', e => { + $('body').on('click', '.js-toggle-colors-link', (e) => { e.preventDefault(); $('.js-toggle-colors-container').toggleClass('hide'); }); @@ -33,7 +33,7 @@ export default function adminInit() { $(this).tab('show'); }); - $('.log-bottom').on('click', e => { + $('.log-bottom').on('click', (e) => { e.preventDefault(); const $visibleLog = $('.file-content:visible'); @@ -52,7 +52,7 @@ export default function adminInit() { modal.show(); }); - $('.change-owner-cancel-link').on('click', e => { + $('.change-owner-cancel-link').on('click', (e) => { e.preventDefault(); modal.hide(); $('.change-owner-link').show(); diff --git a/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js b/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js index f8fc53799a8..b995cb1d3dd 100644 --- a/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js +++ b/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js @@ -14,7 +14,7 @@ export default class PayloadPreviewer { this.spinner = this.trigger.querySelector('.js-spinner'); this.text = this.trigger.querySelector('.js-text'); - this.trigger.addEventListener('click', event => { + this.trigger.addEventListener('click', (event) => { event.preventDefault(); if (this.isVisible) return this.hidePayload(); diff --git a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js index a75f5d318a0..9e4c4d9f615 100644 --- a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js +++ b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js @@ -82,7 +82,7 @@ export default () => { return $jsBroadcastMessagePreview.css(selectedColorStyle); }; - const setSuggestedColor = e => { + const setSuggestedColor = (e) => { const color = $(e.currentTarget).data('color'); $broadcastMessageColor .val(color) diff --git a/app/assets/javascripts/pages/admin/jobs/index/components/stop_jobs_modal.vue b/app/assets/javascripts/pages/admin/jobs/index/components/stop_jobs_modal.vue index 4b6f52c09be..d65593963ce 100644 --- a/app/assets/javascripts/pages/admin/jobs/index/components/stop_jobs_modal.vue +++ b/app/assets/javascripts/pages/admin/jobs/index/components/stop_jobs_modal.vue @@ -26,11 +26,11 @@ export default { onSubmit() { return axios .post(this.url) - .then(response => { + .then((response) => { // follow the rediect to refresh the page redirectTo(response.request.responseURL); }) - .catch(error => { + .catch((error) => { createFlash(s__('AdminArea|Stopping jobs failed')); throw error; }); diff --git a/app/assets/javascripts/pages/admin/projects/index.js b/app/assets/javascripts/pages/admin/projects/index.js index d86c5e2ddb8..fa2b0546c02 100644 --- a/app/assets/javascripts/pages/admin/projects/index.js +++ b/app/assets/javascripts/pages/admin/projects/index.js @@ -24,5 +24,5 @@ document.addEventListener('DOMContentLoaded', () => { document .querySelectorAll('.js-namespace-select') - .forEach(dropdown => new NamespaceSelect({ dropdown })); + .forEach((dropdown) => new NamespaceSelect({ dropdown })); }); diff --git a/app/assets/javascripts/pages/admin/projects/index/index.js b/app/assets/javascripts/pages/admin/projects/index/index.js index ebb1a74e970..bf512ef395d 100644 --- a/app/assets/javascripts/pages/admin/projects/index/index.js +++ b/app/assets/javascripts/pages/admin/projects/index/index.js @@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', () => { }, mounted() { const deleteProjectButtons = document.querySelectorAll('.delete-project-button'); - deleteProjectButtons.forEach(button => { + deleteProjectButtons.forEach((button) => { button.addEventListener('click', () => { const buttonProps = button.dataset; deleteModal.deleteProjectUrl = buttonProps.deleteProjectUrl; diff --git a/app/assets/javascripts/pages/admin/users/index.js b/app/assets/javascripts/pages/admin/users/index.js index 07462b4592f..75a8284f5f8 100644 --- a/app/assets/javascripts/pages/admin/users/index.js +++ b/app/assets/javascripts/pages/admin/users/index.js @@ -17,7 +17,7 @@ function loadModalsConfigurationFromHtml(modalsElement) { throw new Error('Modals content element not found!'); } - Array.from(modalsElement.children).forEach(node => { + Array.from(modalsElement.children).forEach((node) => { const { modal, ...config } = node.dataset; modalsConfiguration[modal] = { title: node.dataset.title, diff --git a/app/assets/javascripts/pages/admin/users/new/index.js b/app/assets/javascripts/pages/admin/users/new/index.js index 3e6a090cb0e..7b7d4c169ef 100644 --- a/app/assets/javascripts/pages/admin/users/new/index.js +++ b/app/assets/javascripts/pages/admin/users/new/index.js @@ -15,7 +15,7 @@ export default class UserInternalRegexHandler { } addListenerToEmailField() { - $('#user_email').on('input', event => { + $('#user_email').on('input', (event) => { this.setExternalCheckbox(event.currentTarget.value); }); } diff --git a/app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue b/app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue index 9fa441348c7..bed753b0c40 100644 --- a/app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue +++ b/app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue @@ -57,7 +57,7 @@ export default { .post(this.calloutsPath, { feature_name: this.calloutsFeatureId, }) - .catch(e => { + .catch((e) => { // eslint-disable-next-line @gitlab/require-i18n-strings, no-console console.error('Failed to dismiss banner.', e); }); diff --git a/app/assets/javascripts/pages/dashboard/projects/index/init_customize_homepage_banner.js b/app/assets/javascripts/pages/dashboard/projects/index/init_customize_homepage_banner.js index c0735dde1da..8cdcd3134ee 100644 --- a/app/assets/javascripts/pages/dashboard/projects/index/init_customize_homepage_banner.js +++ b/app/assets/javascripts/pages/dashboard/projects/index/init_customize_homepage_banner.js @@ -11,6 +11,6 @@ export default () => { return new Vue({ el, provide: { ...el.dataset }, - render: createElement => createElement(CustomizeHomepageBanner), + render: (createElement) => createElement(CustomizeHomepageBanner), }); }; diff --git a/app/assets/javascripts/pages/groups/new/group_path_validator.js b/app/assets/javascripts/pages/groups/new/group_path_validator.js index 83b38b0f1a5..97f3d8cf7f5 100644 --- a/app/assets/javascripts/pages/groups/new/group_path_validator.js +++ b/app/assets/javascripts/pages/groups/new/group_path_validator.js @@ -21,11 +21,11 @@ export default class GroupPathValidator extends InputValidator { const container = opts.container || ''; const validateElements = document.querySelectorAll(`${container} .js-validate-group-path`); - this.debounceValidateInput = debounce(inputDomElement => { + this.debounceValidateInput = debounce((inputDomElement) => { GroupPathValidator.validateGroupPathInput(inputDomElement); }, debounceTimeoutDuration); - validateElements.forEach(element => + validateElements.forEach((element) => element.addEventListener('input', this.eventHandler.bind(this)), ); } @@ -45,7 +45,7 @@ export default class GroupPathValidator extends InputValidator { fetchGroupPathAvailability(groupPath) .then(({ data }) => data) - .then(data => { + .then((data) => { GroupPathValidator.setInputState(inputDomElement, !data.exists); GroupPathValidator.setMessageVisibility(inputDomElement, pendingMessageSelector, false); GroupPathValidator.setMessageVisibility( diff --git a/app/assets/javascripts/pages/groups/shared/group_tabs.js b/app/assets/javascripts/pages/groups/shared/group_tabs.js index c6fe61d2bd9..033843d8504 100644 --- a/app/assets/javascripts/pages/groups/shared/group_tabs.js +++ b/app/assets/javascripts/pages/groups/shared/group_tabs.js @@ -20,7 +20,7 @@ export default class GroupTabs extends UserTabs { bindEvents() { this.$parentEl .off('shown.bs.tab', '.nav-links a[data-toggle="tab"]') - .on('shown.bs.tab', '.nav-links a[data-toggle="tab"]', event => this.tabShown(event)); + .on('shown.bs.tab', '.nav-links a[data-toggle="tab"]', (event) => this.tabShown(event)); } tabShown(event) { @@ -117,7 +117,7 @@ export default class GroupTabs extends UserTabs { cleanFilterState() { const values = Object.values(this.loaded); - const loadedTabs = values.filter(e => e === true); + const loadedTabs = values.filter((e) => e === true); if (!loadedTabs.length) { return; diff --git a/app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue b/app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue index 93fe38831be..f47945c5a9f 100644 --- a/app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue +++ b/app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue @@ -82,7 +82,7 @@ Once deleted, it cannot be undone or recovered.`), return axios .delete(this.milestoneUrl) - .then(response => { + .then((response) => { eventHub.$emit('deleteMilestoneModal.requestFinished', { milestoneUrl: this.milestoneUrl, successful: true, @@ -91,7 +91,7 @@ Once deleted, it cannot be undone or recovered.`), // follow the rediect to milestones overview page redirectTo(response.request.responseURL); }) - .catch(error => { + .catch((error) => { eventHub.$emit('deleteMilestoneModal.requestFinished', { milestoneUrl: this.milestoneUrl, successful: false, diff --git a/app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue b/app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue index 0dc54b612ba..f80ab8c3b0b 100644 --- a/app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue +++ b/app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue @@ -43,14 +43,14 @@ export default { eventHub.$emit('promoteMilestoneModal.requestStarted', this.url); return axios .post(this.url, { params: { format: 'json' } }) - .then(response => { + .then((response) => { eventHub.$emit('promoteMilestoneModal.requestFinished', { milestoneUrl: this.url, successful: true, }); visitUrl(response.data.url); }) - .catch(error => { + .catch((error) => { eventHub.$emit('promoteMilestoneModal.requestFinished', { milestoneUrl: this.url, successful: false, diff --git a/app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js b/app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js index 6e68114e04b..e8b67891c42 100644 --- a/app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js +++ b/app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js @@ -20,7 +20,7 @@ export default () => { const deleteMilestoneButtons = document.querySelectorAll('.js-delete-milestone-button'); - const onRequestStarted = milestoneUrl => { + const onRequestStarted = (milestoneUrl) => { const button = document.querySelector( `.js-delete-milestone-button[data-milestone-url="${milestoneUrl}"]`, ); @@ -44,7 +44,7 @@ export default () => { }, mounted() { eventHub.$on('deleteMilestoneModal.props', this.setModalProps); - deleteMilestoneButtons.forEach(button => { + deleteMilestoneButtons.forEach((button) => { button.removeAttribute('disabled'); button.addEventListener('click', () => { this.$root.$emit('bv::show::modal', 'delete-milestone-modal'); diff --git a/app/assets/javascripts/pages/milestones/shared/promote_milestone_modal_init.js b/app/assets/javascripts/pages/milestones/shared/promote_milestone_modal_init.js index fcc62a2b2af..39e40b86442 100644 --- a/app/assets/javascripts/pages/milestones/shared/promote_milestone_modal_init.js +++ b/app/assets/javascripts/pages/milestones/shared/promote_milestone_modal_init.js @@ -16,7 +16,7 @@ export default () => { } }; - const onRequestStarted = milestoneUrl => { + const onRequestStarted = (milestoneUrl) => { const button = document.querySelector( `.js-promote-project-milestone-button[data-url="${milestoneUrl}"]`, ); @@ -24,7 +24,7 @@ export default () => { eventHub.$once('promoteMilestoneModal.requestFinished', onRequestFinished); }; - const onDeleteButtonClick = event => { + const onDeleteButtonClick = (event) => { const button = event.currentTarget; const modalProps = { milestoneTitle: button.dataset.milestoneTitle, @@ -36,12 +36,12 @@ export default () => { }; const promoteMilestoneButtons = document.querySelectorAll('.js-promote-project-milestone-button'); - promoteMilestoneButtons.forEach(button => { + promoteMilestoneButtons.forEach((button) => { button.addEventListener('click', onDeleteButtonClick); }); eventHub.$once('promoteMilestoneModal.mounted', () => { - promoteMilestoneButtons.forEach(button => { + promoteMilestoneButtons.forEach((button) => { button.removeAttribute('disabled'); }); }); diff --git a/app/assets/javascripts/pages/profiles/show/index.js b/app/assets/javascripts/pages/profiles/show/index.js index 60510eac384..b78f24ca2fb 100644 --- a/app/assets/javascripts/pages/profiles/show/index.js +++ b/app/assets/javascripts/pages/profiles/show/index.js @@ -14,7 +14,7 @@ document.addEventListener('DOMContentLoaded', () => { const statusEmojiField = document.getElementById('js-status-emoji-field'); const statusMessageField = document.getElementById('js-status-message-field'); - const toggleNoEmojiPlaceholder = isVisible => { + const toggleNoEmojiPlaceholder = (isVisible) => { const placeholderElement = document.getElementById('js-no-emoji-placeholder'); placeholderElement.classList.toggle('hidden', !isVisible); }; diff --git a/app/assets/javascripts/pages/projects/blob/show/index.js b/app/assets/javascripts/pages/projects/blob/show/index.js index a96b88732b4..57c4ffd3933 100644 --- a/app/assets/javascripts/pages/projects/blob/show/index.js +++ b/app/assets/javascripts/pages/projects/blob/show/index.js @@ -41,7 +41,7 @@ document.addEventListener('DOMContentLoaded', () => { const { codeNavigationPath, blobPath, definitionPathPrefix } = codeNavEl.dataset; // eslint-disable-next-line promise/catch-or-return - import('~/code_navigation').then(m => + import('~/code_navigation').then((m) => m.default({ blobs: [{ path: blobPath, codeNavigationPath }], definitionPathPrefix, diff --git a/app/assets/javascripts/pages/projects/graphs/charts/index.js b/app/assets/javascripts/pages/projects/graphs/charts/index.js index 6cf36463bda..ea38b8e15a4 100644 --- a/app/assets/javascripts/pages/projects/graphs/charts/index.js +++ b/app/assets/javascripts/pages/projects/graphs/charts/index.js @@ -5,7 +5,7 @@ import { __ } from '~/locale'; import CodeCoverage from '../components/code_coverage.vue'; import SeriesDataMixin from './series_data_mixin'; -const seriesDataToBarData = raw => Object.entries(raw).map(([name, data]) => ({ name, data })); +const seriesDataToBarData = (raw) => Object.entries(raw).map(([name, data]) => ({ name, data })); document.addEventListener('DOMContentLoaded', () => { waitForCSSLoaded(() => { @@ -43,7 +43,7 @@ document.addEventListener('DOMContentLoaded', () => { }, computed: { seriesData() { - return [{ name: 'full', data: this.chartData.map(d => [d.label, d.value]) }]; + return [{ name: 'full', data: this.chartData.map((d) => [d.label, d.value]) }]; }, }, render(h) { diff --git a/app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue b/app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue index 5d3ce30f9d9..3b5e764b712 100644 --- a/app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue +++ b/app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue @@ -74,7 +74,7 @@ export default { ); }, formattedData() { - return this.sortedData.map(value => [dateFormat(value.date, 'mmm dd'), value.coverage]); + return this.sortedData.map((value) => [dateFormat(value.date, 'mmm dd'), value.coverage]); }, chartData() { return [ diff --git a/app/assets/javascripts/pages/projects/issues/service_desk/filtered_search.js b/app/assets/javascripts/pages/projects/issues/service_desk/filtered_search.js index fc0922d9112..ccb453a59ea 100644 --- a/app/assets/javascripts/pages/projects/issues/service_desk/filtered_search.js +++ b/app/assets/javascripts/pages/projects/issues/service_desk/filtered_search.js @@ -21,7 +21,7 @@ export default class FilteredSearchServiceDesk extends FilteredSearchManager { modifyUrlParams(paramsArray) { const supportBotParamPair = `${AUTHOR_PARAM_KEY}=${this.supportBotData.username}`; - const onlyValidParams = paramsArray.filter(param => param.indexOf(AUTHOR_PARAM_KEY) === -1); + const onlyValidParams = paramsArray.filter((param) => param.indexOf(AUTHOR_PARAM_KEY) === -1); // unshift ensures author param is always first token element onlyValidParams.unshift(supportBotParamPair); diff --git a/app/assets/javascripts/pages/projects/issues/show.js b/app/assets/javascripts/pages/projects/issues/show.js index 5162023a111..7068574ecb8 100644 --- a/app/assets/javascripts/pages/projects/issues/show.js +++ b/app/assets/javascripts/pages/projects/issues/show.js @@ -37,7 +37,7 @@ export default function () { initRelatedMergeRequestsApp(); import(/* webpackChunkName: 'design_management' */ '~/design_management') - .then(module => module.default()) + .then((module) => module.default()) .catch(() => {}); new ZenMode(); // eslint-disable-line no-new diff --git a/app/assets/javascripts/pages/projects/jobs/index/index.js b/app/assets/javascripts/pages/projects/jobs/index/index.js index ae04d070e62..c343a37b292 100644 --- a/app/assets/javascripts/pages/projects/jobs/index/index.js +++ b/app/assets/javascripts/pages/projects/jobs/index/index.js @@ -5,7 +5,7 @@ import Tracking from '~/tracking'; document.addEventListener('DOMContentLoaded', () => { const remainingTimeElements = document.querySelectorAll('.js-remaining-time'); remainingTimeElements.forEach( - el => + (el) => new Vue({ ...GlCountdown, el, @@ -22,5 +22,5 @@ document.addEventListener('DOMContentLoaded', () => { } }; const buttons = document.querySelectorAll('.js-empty-state-button'); - buttons.forEach(button => button.addEventListener('click', trackButtonClick)); + buttons.forEach((button) => button.addEventListener('click', trackButtonClick)); }); diff --git a/app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue b/app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue index 7b5e0f70b7b..8626fd18233 100644 --- a/app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue +++ b/app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue @@ -58,14 +58,14 @@ export default { eventHub.$emit('promoteLabelModal.requestStarted', this.url); return axios .post(this.url, { params: { format: 'json' } }) - .then(response => { + .then((response) => { eventHub.$emit('promoteLabelModal.requestFinished', { labelUrl: this.url, successful: true, }); visitUrl(response.data.url); }) - .catch(error => { + .catch((error) => { eventHub.$emit('promoteLabelModal.requestFinished', { labelUrl: this.url, successful: false, diff --git a/app/assets/javascripts/pages/projects/labels/index/index.js b/app/assets/javascripts/pages/projects/labels/index/index.js index ee129011f9a..5270171724a 100644 --- a/app/assets/javascripts/pages/projects/labels/index/index.js +++ b/app/assets/javascripts/pages/projects/labels/index/index.js @@ -19,7 +19,7 @@ const initLabelIndex = () => { } }; - const onRequestStarted = labelUrl => { + const onRequestStarted = (labelUrl) => { const button = document.querySelector( `.js-promote-project-label-button[data-url="${labelUrl}"]`, ); @@ -46,7 +46,7 @@ const initLabelIndex = () => { eventHub.$on('promoteLabelModal.props', this.setModalProps); eventHub.$emit('promoteLabelModal.mounted'); - promoteLabelButtons.forEach(button => { + promoteLabelButtons.forEach((button) => { button.removeAttribute('disabled'); button.addEventListener('click', () => { this.$root.$emit('bv::show::modal', 'promote-label-modal'); diff --git a/app/assets/javascripts/pages/projects/merge_requests/creations/new/compare.js b/app/assets/javascripts/pages/projects/merge_requests/creations/new/compare.js index 4c766f94fba..eb2692c7cb4 100644 --- a/app/assets/javascripts/pages/projects/merge_requests/creations/new/compare.js +++ b/app/assets/javascripts/pages/projects/merge_requests/creations/new/compare.js @@ -19,7 +19,7 @@ const updateCommitList = (url, $loadingIndicator, $commitList, params) => { }); }; -export default mrNewCompareNode => { +export default (mrNewCompareNode) => { const { sourceBranchUrl, targetBranchUrl } = mrNewCompareNode.dataset; initTargetProjectDropdown(); @@ -44,7 +44,7 @@ export default mrNewCompareNode => { ref: $(mrNewCompareNode).find("input[name='merge_request[target_branch]']").val(), }, ); - initCompareAutocomplete('branches', $dropdown => { + initCompareAutocomplete('branches', ($dropdown) => { if ($dropdown.is('.js-target-branch')) { updateTargetBranchCommitList(); } else if ($dropdown.is('.js-source-branch')) { diff --git a/app/assets/javascripts/pages/projects/new/index.js b/app/assets/javascripts/pages/projects/new/index.js index 19aeb1d1ecf..e1a3fe8c600 100644 --- a/app/assets/javascripts/pages/projects/new/index.js +++ b/app/assets/javascripts/pages/projects/new/index.js @@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => { import( /* webpackChunkName: 'experiment_new_project_creation' */ '../../../projects/experiment_new_project_creation' ) - .then(m => { + .then((m) => { const el = document.querySelector('.js-experiment-new-project-creation'); if (!el) { diff --git a/app/assets/javascripts/pages/projects/pages_domains/form.js b/app/assets/javascripts/pages/projects/pages_domains/form.js index ae5368179b1..169530685ad 100644 --- a/app/assets/javascripts/pages/projects/pages_domains/form.js +++ b/app/assets/javascripts/pages/projects/pages_domains/form.js @@ -1,7 +1,7 @@ import setupToggleButtons from '~/toggle_buttons'; function updateVisibility(selector, isVisible) { - Array.from(document.querySelectorAll(selector)).forEach(el => { + Array.from(document.querySelectorAll(selector)).forEach((el) => { if (isVisible) { el.classList.remove('d-none'); } else { @@ -14,12 +14,12 @@ export default () => { const toggleContainer = document.querySelector('.js-auto-ssl-toggle-container'); if (toggleContainer) { - const onToggleButtonClicked = isAutoSslEnabled => { + const onToggleButtonClicked = (isAutoSslEnabled) => { updateVisibility('.js-shown-unless-auto-ssl', !isAutoSslEnabled); updateVisibility('.js-shown-if-auto-ssl', isAutoSslEnabled); - Array.from(document.querySelectorAll('.js-enabled-unless-auto-ssl')).forEach(el => { + Array.from(document.querySelectorAll('.js-enabled-unless-auto-ssl')).forEach((el) => { if (isAutoSslEnabled) { el.setAttribute('disabled', 'disabled'); } else { diff --git a/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js b/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js index 4b203891640..6017cd653e4 100644 --- a/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js +++ b/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js @@ -15,19 +15,19 @@ export default class TargetBranchDropdown { data: this.formatBranchesList(), filterable: true, selectable: true, - toggleLabel: item => item.name, + toggleLabel: (item) => item.name, search: { fields: ['name'], }, - clicked: cfg => this.updateInputValue(cfg), - text: item => item.name, + clicked: (cfg) => this.updateInputValue(cfg), + text: (item) => item.name, }); this.setDropdownToggle(); } formatBranchesList() { - return this.$dropdown.data('data').map(val => ({ name: val })); + return this.$dropdown.data('data').map((val) => ({ name: val })); } setDropdownToggle() { diff --git a/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/timezone_dropdown.js b/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/timezone_dropdown.js index 2a58e015ff1..16c4a6191b2 100644 --- a/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/timezone_dropdown.js +++ b/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/timezone_dropdown.js @@ -5,10 +5,10 @@ const defaults = { $inputEl: null, $dropdownEl: null, onSelectTimezone: null, - displayFormat: item => item.name, + displayFormat: (item) => item.name, }; -export const formatUtcOffset = offset => { +export const formatUtcOffset = (offset) => { const parsed = parseInt(offset, 10); if (Number.isNaN(parsed) || parsed === 0) { return `0`; @@ -17,11 +17,11 @@ export const formatUtcOffset = offset => { return `${prefix} ${Math.abs(offset / 3600)}`; }; -export const formatTimezone = item => `[UTC ${formatUtcOffset(item.offset)}] ${item.name}`; +export const formatTimezone = (item) => `[UTC ${formatUtcOffset(item.offset)}] ${item.name}`; export const findTimezoneByIdentifier = (tzList = [], identifier = null) => { if (tzList && tzList.length && identifier && identifier.length) { - return tzList.find(tz => tz.identifier === identifier) || null; + return tzList.find((tz) => tz.identifier === identifier) || null; } return null; }; @@ -52,8 +52,8 @@ export default class TimezoneDropdown { search: { fields: ['name'], }, - clicked: cfg => this.updateInputValue(cfg), - text: item => formatTimezone(item), + clicked: (cfg) => this.updateInputValue(cfg), + text: (item) => formatTimezone(item), }); this.setDropdownToggle(this.displayFormat(this.initialTimezone)); diff --git a/app/assets/javascripts/pages/projects/pipelines/init_pipelines.js b/app/assets/javascripts/pages/projects/pipelines/init_pipelines.js index 5fd3fce88aa..0c29f8817e7 100644 --- a/app/assets/javascripts/pages/projects/pipelines/init_pipelines.js +++ b/app/assets/javascripts/pages/projects/pipelines/init_pipelines.js @@ -6,7 +6,7 @@ export default () => { const fullMergeRequestList = document.querySelector('.js-full-mr-list'); if (mergeRequestListToggle) { - mergeRequestListToggle.addEventListener('click', e => { + mergeRequestListToggle.addEventListener('click', (e) => { e.preventDefault(); truncatedMergeRequestList.classList.toggle('hide'); fullMergeRequestList.classList.toggle('hide'); diff --git a/app/assets/javascripts/pages/projects/project.js b/app/assets/javascripts/pages/projects/project.js index 807063be463..ef6953db83b 100644 --- a/app/assets/javascripts/pages/projects/project.js +++ b/app/assets/javascripts/pages/projects/project.js @@ -46,7 +46,7 @@ export default class Project { static projectSelectDropdown() { projectSelect(); - $('.project-item-select').on('click', e => Project.changeProject($(e.currentTarget).val())); + $('.project-item-select').on('click', (e) => Project.changeProject($(e.currentTarget).val())); } static changeProject(url) { @@ -124,7 +124,7 @@ export default class Project { if (loc.includes('/-/')) { const refs = this.fullData.Branches.concat(this.fullData.Tags); - const currentRef = refs.find(ref => loc.indexOf(ref) > -1); + const currentRef = refs.find((ref) => loc.indexOf(ref) > -1); if (currentRef) { const targetPath = loc.split(currentRef)[1].slice(1); selectedUrl.searchParams.set('path', targetPath); diff --git a/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js b/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js index 83bec0092cb..35c0696f0f1 100644 --- a/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js +++ b/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js @@ -23,7 +23,7 @@ document.addEventListener('DOMContentLoaded', () => { // hide extra auto devops settings based checkbox state const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings'); const instanceDefaultBadge = document.querySelector('.js-instance-default-badge'); - document.querySelector('.js-toggle-extra-settings').addEventListener('click', event => { + document.querySelector('.js-toggle-extra-settings').addEventListener('click', (event) => { const { target } = event; if (instanceDefaultBadge) instanceDefaultBadge.style.display = 'none'; autoDevOpsExtraSettings.classList.toggle('hidden', !target.checked); diff --git a/app/assets/javascripts/pages/projects/shared/permissions/external.js b/app/assets/javascripts/pages/projects/shared/permissions/external.js index 460af4a2111..49f6ebcc20f 100644 --- a/app/assets/javascripts/pages/projects/shared/permissions/external.js +++ b/app/assets/javascripts/pages/projects/shared/permissions/external.js @@ -14,5 +14,5 @@ export function toggleHiddenClassBySelector(selector, hidden) { if (!selectorCache[selector]) { selectorCache[selector] = document.querySelectorAll(selector); } - selectorCache[selector].forEach(elm => toggleHiddenClass(elm, hidden)); + selectorCache[selector].forEach((elm) => toggleHiddenClass(elm, hidden)); } diff --git a/app/assets/javascripts/pages/projects/shared/permissions/index.js b/app/assets/javascripts/pages/projects/shared/permissions/index.js index dbde8dda634..d7bae44e96e 100644 --- a/app/assets/javascripts/pages/projects/shared/permissions/index.js +++ b/app/assets/javascripts/pages/projects/shared/permissions/index.js @@ -8,6 +8,6 @@ export default function initProjectPermissionsSettings() { return new Vue({ el: mountPoint, - render: createElement => createElement(settingsPanel, { props: { ...componentProps } }), + render: (createElement) => createElement(settingsPanel, { props: { ...componentProps } }), }); } diff --git a/app/assets/javascripts/pages/projects/tags/index/index.js b/app/assets/javascripts/pages/projects/tags/index/index.js index 7f85d84a2e8..96e52850936 100644 --- a/app/assets/javascripts/pages/projects/tags/index/index.js +++ b/app/assets/javascripts/pages/projects/tags/index/index.js @@ -2,7 +2,7 @@ import { initRemoveTag } from '../remove_tag'; document.addEventListener('DOMContentLoaded', () => { initRemoveTag({ - onDelete: path => { + onDelete: (path) => { document.querySelector(`[data-path="${path}"]`).closest('.js-tag-list').remove(); }, }); diff --git a/app/assets/javascripts/pages/search/show/refresh_counts.js b/app/assets/javascripts/pages/search/show/refresh_counts.js index fa75ee6075d..f3f6312cb7c 100644 --- a/app/assets/javascripts/pages/search/show/refresh_counts.js +++ b/app/assets/javascripts/pages/search/show/refresh_counts.js @@ -11,7 +11,7 @@ function refreshCount(el) { return axios .get(url) .then(({ data }) => showCount(el, data.count)) - .catch(e => { + .catch((e) => { // eslint-disable-next-line no-console console.error(`Failed to fetch search count from '${url}'.`, e); }); diff --git a/app/assets/javascripts/pages/sessions/new/length_validator.js b/app/assets/javascripts/pages/sessions/new/length_validator.js index 92482c81f3c..17acad10bc1 100644 --- a/app/assets/javascripts/pages/sessions/new/length_validator.js +++ b/app/assets/javascripts/pages/sessions/new/length_validator.js @@ -9,7 +9,7 @@ export default class LengthValidator extends InputValidator { const container = opts.container || ''; const validateLengthElements = document.querySelectorAll(`${container} .js-validate-length`); - validateLengthElements.forEach(element => + validateLengthElements.forEach((element) => element.addEventListener('input', this.eventHandler.bind(this)), ); } diff --git a/app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js b/app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js index 1d47a9aed47..70e5e336e78 100644 --- a/app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js +++ b/app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js @@ -13,7 +13,7 @@ export default function preserveUrlFragment(fragment = '') { // Append the fragment to all sign-in/sign-up form actions so it is preserved when the user is // eventually redirected back to the originally requested URL. const forms = document.querySelectorAll('#signin-container .tab-content form'); - Array.prototype.forEach.call(forms, form => { + Array.prototype.forEach.call(forms, (form) => { const actionWithFragment = setUrlFragment(form.getAttribute('action'), `#${normalFragment}`); form.setAttribute('action', actionWithFragment); }); @@ -21,7 +21,7 @@ export default function preserveUrlFragment(fragment = '') { // Append a redirect_fragment query param to all oauth provider links. The redirect_fragment // query param will be available in the omniauth callback upon successful authentication const oauthForms = document.querySelectorAll('#signin-container .omniauth-container form'); - Array.prototype.forEach.call(oauthForms, oauthForm => { + Array.prototype.forEach.call(oauthForms, (oauthForm) => { const newHref = mergeUrlParams( { redirect_fragment: normalFragment }, oauthForm.getAttribute('action'), diff --git a/app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js b/app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js index 2b8f1e8b0ef..1e7c29aefaa 100644 --- a/app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js +++ b/app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js @@ -20,7 +20,7 @@ export default class SigninTabsMemoizer { bootstrap() { const tabs = document.querySelectorAll(this.tabSelector); if (tabs.length > 0) { - tabs[0].addEventListener('click', e => { + tabs[0].addEventListener('click', (e) => { if (e.target && e.target.nodeName === 'A') { const anchorName = e.target.getAttribute('href'); this.saveData(anchorName); diff --git a/app/assets/javascripts/pages/sessions/new/username_validator.js b/app/assets/javascripts/pages/sessions/new/username_validator.js index 62f6e3fb84f..f3b0948a40d 100644 --- a/app/assets/javascripts/pages/sessions/new/username_validator.js +++ b/app/assets/javascripts/pages/sessions/new/username_validator.js @@ -20,11 +20,11 @@ export default class UsernameValidator extends InputValidator { const container = opts.container || ''; const validateLengthElements = document.querySelectorAll(`${container} .js-validate-username`); - this.debounceValidateInput = debounce(inputDomElement => { + this.debounceValidateInput = debounce((inputDomElement) => { UsernameValidator.validateUsernameInput(inputDomElement); }, debounceTimeoutDuration); - validateLengthElements.forEach(element => + validateLengthElements.forEach((element) => element.addEventListener('input', this.eventHandler.bind(this)), ); } @@ -42,7 +42,7 @@ export default class UsernameValidator extends InputValidator { if (inputDomElement.checkValidity() && username.length > 1) { UsernameValidator.setMessageVisibility(inputDomElement, pendingMessageSelector); UsernameValidator.fetchUsernameAvailability(username) - .then(usernameTaken => { + .then((usernameTaken) => { UsernameValidator.setInputState(inputDomElement, !usernameTaken); UsernameValidator.setMessageVisibility(inputDomElement, pendingMessageSelector, false); UsernameValidator.setMessageVisibility( diff --git a/app/assets/javascripts/pages/shared/mount_badge_settings.js b/app/assets/javascripts/pages/shared/mount_badge_settings.js index 1397c0834ff..aeb9f2fb8d3 100644 --- a/app/assets/javascripts/pages/shared/mount_badge_settings.js +++ b/app/assets/javascripts/pages/shared/mount_badge_settings.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import BadgeSettings from '~/badges/components/badge_settings.vue'; import store from '~/badges/store'; -export default kind => { +export default (kind) => { const badgeSettingsElement = document.getElementById('badge-settings'); store.dispatch('loadBadges', { diff --git a/app/assets/javascripts/pages/shared/wikis/wikis.js b/app/assets/javascripts/pages/shared/wikis/wikis.js index fe9caba351e..ee03de408c7 100644 --- a/app/assets/javascripts/pages/shared/wikis/wikis.js +++ b/app/assets/javascripts/pages/shared/wikis/wikis.js @@ -20,7 +20,7 @@ export default class Wikis { const sidebarToggles = document.querySelectorAll('.js-sidebar-wiki-toggle'); for (let i = 0; i < sidebarToggles.length; i += 1) { - sidebarToggles[i].addEventListener('click', e => this.handleToggleSidebar(e)); + sidebarToggles[i].addEventListener('click', (e) => this.handleToggleSidebar(e)); } this.isNewWikiPage = Boolean(document.querySelector('.js-new-wiki-page')); @@ -35,7 +35,7 @@ export default class Wikis { if (this.editTitleInput.value) this.setWikiCommitMessage(this.editTitleInput.value); // Set the commit message as the page title is changed - this.editTitleInput.addEventListener('keyup', e => this.handleWikiTitleChange(e)); + this.editTitleInput.addEventListener('keyup', (e) => this.handleWikiTitleChange(e)); } window.addEventListener('resize', () => this.renderSidebar()); @@ -45,7 +45,7 @@ export default class Wikis { const linkExample = document.querySelector('.js-markup-link-example'); if (changeFormatSelect) { - changeFormatSelect.addEventListener('change', e => { + changeFormatSelect.addEventListener('change', (e) => { linkExample.innerHTML = MARKDOWN_LINK_TEXT[e.target.value]; }); } @@ -121,6 +121,6 @@ export default class Wikis { static showToasts() { const toasts = document.querySelectorAll('.js-toast-message'); - toasts.forEach(toast => showToast(toast.dataset.message)); + toasts.forEach((toast) => showToast(toast.dataset.message)); } } diff --git a/app/assets/javascripts/pages/users/activity_calendar.js b/app/assets/javascripts/pages/users/activity_calendar.js index 1322dd0e4c8..149e666256b 100644 --- a/app/assets/javascripts/pages/users/activity_calendar.js +++ b/app/assets/javascripts/pages/users/activity_calendar.js @@ -173,17 +173,17 @@ export default class ActivityCalendar { return `translate(${this.daySizeWithSpace * i + 1 + this.daySizeWithSpace}, 18)`; }) .selectAll('rect') - .data(stamp => stamp) + .data((stamp) => stamp) .enter() .append('rect') .attr('x', '0') - .attr('y', stamp => this.dayYPos(stamp.day)) + .attr('y', (stamp) => this.dayYPos(stamp.day)) .attr('width', this.daySize) .attr('height', this.daySize) - .attr('fill', stamp => + .attr('fill', (stamp) => stamp.count !== 0 ? this.color(Math.min(stamp.count, 40)) : '#ededed', ) - .attr('title', stamp => formatTooltipText(stamp)) + .attr('title', (stamp) => formatTooltipText(stamp)) .attr('class', 'user-contrib-cell has-tooltip') .attr('data-html', true) .attr('data-container', 'body') @@ -226,8 +226,8 @@ export default class ActivityCalendar { .append('text') .attr('text-anchor', 'middle') .attr('x', 8) - .attr('y', day => day.y) - .text(day => day.text) + .attr('y', (day) => day.y) + .text((day) => day.text) .attr('class', 'user-contrib-text'); } @@ -239,10 +239,10 @@ export default class ActivityCalendar { .data(this.months) .enter() .append('text') - .attr('x', date => date.x) + .attr('x', (date) => date.x) .attr('y', 10) .attr('class', 'user-contrib-text') - .text(date => this.monthNames[date.month]); + .text((date) => this.monthNames[date.month]); } renderKey() { @@ -272,7 +272,7 @@ export default class ActivityCalendar { .attr('height', this.daySize) .attr('x', (color, i) => this.daySizeWithSpace * i) .attr('y', 0) - .attr('fill', color => color) + .attr('fill', (color) => color) .attr('class', 'has-tooltip') .attr('title', (color, i) => keyValues[i]) .attr('data-container', 'body') diff --git a/app/assets/javascripts/pages/users/index.js b/app/assets/javascripts/pages/users/index.js index 40574785879..b22287a0093 100644 --- a/app/assets/javascripts/pages/users/index.js +++ b/app/assets/javascripts/pages/users/index.js @@ -8,7 +8,7 @@ function initUserProfile(action) { new UserTabs({ parentEl: '.user-profile', action }); // hide project limit message - $('.hide-project-limit-message').on('click', e => { + $('.hide-project-limit-message').on('click', (e) => { e.preventDefault(); Cookies.set('hide_project_limit_message', 'false'); $(this).parents('.project-limit-message').remove(); diff --git a/app/assets/javascripts/pdf/index.vue b/app/assets/javascripts/pdf/index.vue index bbbd9789dc9..c8a04eb72c4 100644 --- a/app/assets/javascripts/pdf/index.vue +++ b/app/assets/javascripts/pdf/index.vue @@ -40,11 +40,11 @@ export default { cMapPacked: true, }) .promise.then(this.renderPages) - .then(pages => { + .then((pages) => { this.pages = pages; this.$emit('pdflabload'); }) - .catch(error => { + .catch((error) => { this.$emit('pdflaberror', error); }); }, diff --git a/app/assets/javascripts/pdf/page/index.vue b/app/assets/javascripts/pdf/page/index.vue index 843c50cf9bc..ae0a7f0298b 100644 --- a/app/assets/javascripts/pdf/page/index.vue +++ b/app/assets/javascripts/pdf/page/index.vue @@ -39,7 +39,7 @@ export default { .promise.then(() => { this.rendering = false; }) - .catch(error => { + .catch((error) => { this.$emit('pdflaberror', error); }); }, diff --git a/app/assets/javascripts/performance/utils.js b/app/assets/javascripts/performance/utils.js index 1c87ee2086e..0001ef54244 100644 --- a/app/assets/javascripts/performance/utils.js +++ b/app/assets/javascripts/performance/utils.js @@ -3,7 +3,7 @@ export const performanceMarkAndMeasure = ({ mark, measures = [] } = {}) => { if (mark && !performance.getEntriesByName(mark).length) { performance.mark(mark); } - measures.forEach(measure => { + measures.forEach((measure) => { performance.measure(measure.name, measure.start, measure.end); }); }); diff --git a/app/assets/javascripts/performance_bar/components/detailed_metric.vue b/app/assets/javascripts/performance_bar/components/detailed_metric.vue index 90e14d8325f..d9fe09958e5 100644 --- a/app/assets/javascripts/performance_bar/components/detailed_metric.vue +++ b/app/assets/javascripts/performance_bar/components/detailed_metric.vue @@ -76,12 +76,12 @@ export default { this.openedBacktraces = [...this.openedBacktraces, toggledIndex]; } else { this.openedBacktraces = this.openedBacktraces.filter( - openedIndex => openedIndex !== toggledIndex, + (openedIndex) => openedIndex !== toggledIndex, ); } }, itemHasOpenedBacktrace(toggledIndex) { - return this.openedBacktraces.find(openedIndex => openedIndex === toggledIndex) >= 0; + return this.openedBacktraces.find((openedIndex) => openedIndex === toggledIndex) >= 0; }, }, }; diff --git a/app/assets/javascripts/performance_bar/components/request_selector.vue b/app/assets/javascripts/performance_bar/components/request_selector.vue index 5a9d3a6d313..5666e038f02 100644 --- a/app/assets/javascripts/performance_bar/components/request_selector.vue +++ b/app/assets/javascripts/performance_bar/components/request_selector.vue @@ -25,7 +25,7 @@ export default { }, computed: { requestsWithWarnings() { - return this.requests.filter(request => request.hasWarnings); + return this.requests.filter((request) => request.hasWarnings); }, warningMessage() { return n__( diff --git a/app/assets/javascripts/performance_bar/index.js b/app/assets/javascripts/performance_bar/index.js index e0b7f2190ca..8ecf5971392 100644 --- a/app/assets/javascripts/performance_bar/index.js +++ b/app/assets/javascripts/performance_bar/index.js @@ -10,7 +10,7 @@ import initPerformanceBarLog from './performance_bar_log'; Vue.use(Translate); -const initPerformanceBar = el => { +const initPerformanceBar = (el) => { const performanceBarData = el.dataset; return new Vue({ @@ -55,7 +55,7 @@ const initPerformanceBar = el => { this.store.addRequest(requestId, requestUrl); PerformanceBarService.fetchRequestDetails(this.peekUrl, requestId) - .then(res => { + .then((res) => { this.store.addRequestDetails(requestId, res.data); if (this.requestId === requestId) this.collectFrontendPerformanceMetrics(); @@ -84,7 +84,7 @@ const initPerformanceBar = el => { if ('PerformanceObserver' in window) { // We start observing for more incoming timings - const observer = new PerformanceObserver(list => { + const observer = new PerformanceObserver((list) => { newEntries = newEntries.concat(list.getEntries().map(this.transformResourceEntry)); this.updateFrontendPerformanceMetrics(durationString, newEntries); }); diff --git a/app/assets/javascripts/performance_bar/performance_bar_log.js b/app/assets/javascripts/performance_bar/performance_bar_log.js index 3ba7ff1c221..c61b0cb32e8 100644 --- a/app/assets/javascripts/performance_bar/performance_bar_log.js +++ b/app/assets/javascripts/performance_bar/performance_bar_log.js @@ -3,7 +3,7 @@ import { getCLS, getFID, getLCP } from 'web-vitals'; import { PERFORMANCE_TYPE_MARK, PERFORMANCE_TYPE_MEASURE } from '~/performance/constants'; const initVitalsLog = () => { - const reportVital = data => { + const reportVital = (data) => { console.log(`${String.fromCodePoint(0x1f4c8)} ${data.name} : `, data); }; @@ -18,9 +18,9 @@ const initVitalsLog = () => { }; const logUserTimingMetrics = () => { - const metricsProcessor = list => { + const metricsProcessor = (list) => { const entries = list.getEntries(); - entries.forEach(entry => { + entries.forEach((entry) => { const { name, entryType, startTime, duration } = entry; const typeMapper = { [PERFORMANCE_TYPE_MARK]: String.fromCodePoint(0x1f3af), diff --git a/app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue b/app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue index 2fac02768bc..2e4a489f2cb 100644 --- a/app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue +++ b/app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue @@ -63,7 +63,9 @@ export default { }, computed: { formattedSize() { - return this.tag.totalSize ? numberToHumanSize(this.tag.totalSize) : NOT_AVAILABLE_SIZE; + return this.tag.totalSize + ? numberToHumanSize(Number(this.tag.totalSize)) + : NOT_AVAILABLE_SIZE; }, layers() { return this.tag.layers ? n__('%d layer', '%d layers', this.tag.layers) : ''; diff --git a/app/assets/javascripts/snippets/utils/blob.js b/app/assets/javascripts/snippets/utils/blob.js index 5081c648e36..a47418323f2 100644 --- a/app/assets/javascripts/snippets/utils/blob.js +++ b/app/assets/javascripts/snippets/utils/blob.js @@ -12,7 +12,7 @@ import { SNIPPET_MARK_BLOBS_CONTENT, SNIPPET_MEASURE_BLOBS_CONTENT } from '~/per const createLocalId = () => uniqueId('blob_local_'); -export const decorateBlob = blob => ({ +export const decorateBlob = (blob) => ({ ...blob, id: createLocalId(), isLoaded: false, @@ -54,7 +54,7 @@ const diff = ({ content, path }, origBlob) => { */ export const diffAll = (blobs, origBlobs) => { const deletedEntries = Object.values(origBlobs) - .filter(x => !blobs[x.id]) + .filter((x) => !blobs[x.id]) .map(({ path, content }) => ({ action: SNIPPET_BLOB_ACTION_DELETE, previousPath: path, @@ -63,15 +63,15 @@ export const diffAll = (blobs, origBlobs) => { })); const newEntries = Object.values(blobs) - .map(blob => diff(blob, origBlobs[blob.id])) - .filter(x => x); + .map((blob) => diff(blob, origBlobs[blob.id])) + .filter((x) => x); return [...deletedEntries, ...newEntries]; }; -export const defaultSnippetVisibilityLevels = arr => { +export const defaultSnippetVisibilityLevels = (arr) => { if (Array.isArray(arr)) { - return arr.map(l => { + return arr.map((l) => { const translatedLevel = SNIPPET_LEVELS_MAP[l]; return { value: translatedLevel, diff --git a/app/assets/javascripts/static_site_editor/graphql/index.js b/app/assets/javascripts/static_site_editor/graphql/index.js index a13f7d3ad53..bce320ed805 100644 --- a/app/assets/javascripts/static_site_editor/graphql/index.js +++ b/app/assets/javascripts/static_site_editor/graphql/index.js @@ -8,7 +8,7 @@ import hasSubmittedChangesResolver from './resolvers/has_submitted_changes'; Vue.use(VueApollo); -const createApolloProvider = appData => { +const createApolloProvider = (appData) => { const defaultClient = createDefaultClient( { Project: { @@ -26,7 +26,7 @@ const createApolloProvider = appData => { ); // eslint-disable-next-line @gitlab/require-i18n-strings - const mounts = appData.mounts.map(mount => ({ __typename: 'Mount', ...mount })); + const mounts = appData.mounts.map((mount) => ({ __typename: 'Mount', ...mount })); defaultClient.cache.writeData({ data: { diff --git a/app/assets/javascripts/static_site_editor/graphql/resolvers/file.js b/app/assets/javascripts/static_site_editor/graphql/resolvers/file.js index 16f176581cb..fc3cac52e2a 100644 --- a/app/assets/javascripts/static_site_editor/graphql/resolvers/file.js +++ b/app/assets/javascripts/static_site_editor/graphql/resolvers/file.js @@ -1,7 +1,7 @@ import loadSourceContent from '../../services/load_source_content'; const fileResolver = ({ fullPath: projectId }, { path: sourcePath }) => { - return loadSourceContent({ projectId, sourcePath }).then(sourceContent => ({ + return loadSourceContent({ projectId, sourcePath }).then((sourceContent) => ({ // eslint-disable-next-line @gitlab/require-i18n-strings __typename: 'File', ...sourceContent, diff --git a/app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js b/app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js index ea49b21eb0d..35ecf6d698c 100644 --- a/app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js +++ b/app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js @@ -4,7 +4,7 @@ import query from '../queries/app_data.query.graphql'; const hasSubmittedChangesResolver = (_, { input: { hasSubmittedChanges } }, { cache }) => { const oldData = cache.readQuery({ query }); - const data = produce(oldData, draftState => { + const data = produce(oldData, (draftState) => { // punctually modifying draftState as per immer docs upsets our linters return { ...draftState, diff --git a/app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js b/app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js index 1bd79d40071..0b74c99b319 100644 --- a/app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js +++ b/app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js @@ -25,8 +25,8 @@ const submitContentChangesResolver = ( images, mergeRequestMeta, formattedMarkdown, - }).then(savedContentMeta => { - const data = produce(savedContentMeta, draftState => { + }).then((savedContentMeta) => { + const data = produce(savedContentMeta, (draftState) => { return { savedContentMeta: { __typename: 'SavedContentMeta', diff --git a/app/assets/javascripts/static_site_editor/image_repository.js b/app/assets/javascripts/static_site_editor/image_repository.js index b5ff4385d3c..56b2434d2e2 100644 --- a/app/assets/javascripts/static_site_editor/image_repository.js +++ b/app/assets/javascripts/static_site_editor/image_repository.js @@ -4,15 +4,15 @@ import { getBinary } from './services/image_service'; const imageRepository = () => { const images = new Map(); - const flash = message => new Flash(message); + const flash = (message) => new Flash(message); const add = (file, url) => { getBinary(file) - .then(content => images.set(url, content)) + .then((content) => images.set(url, content)) .catch(() => flash(__('Something went wrong while inserting your image. Please try again.'))); }; - const get = path => images.get(path); + const get = (path) => images.get(path); const getAll = () => images; diff --git a/app/assets/javascripts/static_site_editor/index.js b/app/assets/javascripts/static_site_editor/index.js index b58564388de..fbb14be21ba 100644 --- a/app/assets/javascripts/static_site_editor/index.js +++ b/app/assets/javascripts/static_site_editor/index.js @@ -4,7 +4,7 @@ import App from './components/app.vue'; import createRouter from './router'; import createApolloProvider from './graphql'; -const initStaticSiteEditor = el => { +const initStaticSiteEditor = (el) => { const { isSupportedContent, path: sourcePath, diff --git a/app/assets/javascripts/static_site_editor/pages/home.vue b/app/assets/javascripts/static_site_editor/pages/home.vue index 1e52e73294e..6c958cb2d22 100644 --- a/app/assets/javascripts/static_site_editor/pages/home.vue +++ b/app/assets/javascripts/static_site_editor/pages/home.vue @@ -118,7 +118,7 @@ export default { }, }, }) - .catch(e => { + .catch((e) => { this.submitChangesError = e.message; }) .finally(() => { diff --git a/app/assets/javascripts/static_site_editor/services/formatter.js b/app/assets/javascripts/static_site_editor/services/formatter.js index 9a5dcd307eb..e841c664406 100644 --- a/app/assets/javascripts/static_site_editor/services/formatter.js +++ b/app/assets/javascripts/static_site_editor/services/formatter.js @@ -24,7 +24,7 @@ const nestedLineRegexp = /^\s+/; * This function attempts to correct this problem before the content is loaded * by Toast UI. */ -const correctNestedContentIndenation = source => { +const correctNestedContentIndenation = (source) => { const lines = source.split('\n'); let topLevelOrderedListDetected = false; @@ -40,7 +40,7 @@ const correctNestedContentIndenation = source => { .join('\n'); }; -const removeOrphanedBrTags = source => { +const removeOrphanedBrTags = (source) => { /* Until the underlying Squire editor of Toast UI Editor resolves duplicate `<br>` tags, this `replace` solution will clear out orphaned `<br>` tags that it generates. Additionally, it cleans up orphaned `<br>` tags in the source markdown document that should be new lines. @@ -49,7 +49,7 @@ const removeOrphanedBrTags = source => { return source.replace(/\n^<br>$/gm, ''); }; -const format = source => { +const format = (source) => { return correctNestedContentIndenation(removeOrphanedBrTags(source)); }; diff --git a/app/assets/javascripts/static_site_editor/services/front_matterify.js b/app/assets/javascripts/static_site_editor/services/front_matterify.js index 60a5d799d11..6b897b42648 100644 --- a/app/assets/javascripts/static_site_editor/services/front_matterify.js +++ b/app/assets/javascripts/static_site_editor/services/front_matterify.js @@ -8,7 +8,7 @@ const hasMatter = (firstThreeChars, fourthChar) => { return isYamlDelimiter && isFourthCharNewline; }; -export const frontMatterify = source => { +export const frontMatterify = (source) => { let index = 3; let offset; const delimiter = source.slice(0, index); diff --git a/app/assets/javascripts/static_site_editor/services/image_service.js b/app/assets/javascripts/static_site_editor/services/image_service.js index 25ab1084572..a9b85057e3d 100644 --- a/app/assets/javascripts/static_site_editor/services/image_service.js +++ b/app/assets/javascripts/static_site_editor/services/image_service.js @@ -1,8 +1,8 @@ -export const getBinary = file => { +export const getBinary = (file) => { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.readAsDataURL(file); reader.onload = () => resolve(reader.result.split(',')[1]); - reader.onerror = error => reject(error); + reader.onerror = (error) => reject(error); }); }; diff --git a/app/assets/javascripts/static_site_editor/services/load_source_content.js b/app/assets/javascripts/static_site_editor/services/load_source_content.js index 1af93a8a2bc..fcf69efafd8 100644 --- a/app/assets/javascripts/static_site_editor/services/load_source_content.js +++ b/app/assets/javascripts/static_site_editor/services/load_source_content.js @@ -1,6 +1,6 @@ import Api from '~/api'; -const extractTitle = content => { +const extractTitle = (content) => { const matches = content.match(/title: (.+)\n/i); return matches ? Array.from(matches)[1] : ''; diff --git a/app/assets/javascripts/static_site_editor/services/parse_source_file.js b/app/assets/javascripts/static_site_editor/services/parse_source_file.js index 39126eb7bcc..d7499d75a21 100644 --- a/app/assets/javascripts/static_site_editor/services/parse_source_file.js +++ b/app/assets/javascripts/static_site_editor/services/parse_source_file.js @@ -1,6 +1,6 @@ import { frontMatterify, stringify } from './front_matterify'; -const parseSourceFile = raw => { +const parseSourceFile = (raw) => { let editable; const syncContent = (newVal, isBody) => { @@ -20,7 +20,7 @@ const parseSourceFile = raw => { const matter = () => editable.matter; - const syncMatter = settings => { + const syncMatter = (settings) => { editable.matter = settings; }; diff --git a/app/assets/javascripts/static_site_editor/services/renderers/render_image.js b/app/assets/javascripts/static_site_editor/services/renderers/render_image.js index b0d863bdb5a..b5651e7163e 100644 --- a/app/assets/javascripts/static_site_editor/services/renderers/render_image.js +++ b/app/assets/javascripts/static_site_editor/services/renderers/render_image.js @@ -4,16 +4,16 @@ const canRender = ({ type }) => type === 'image'; let metadata; -const getCachedContent = basePath => metadata.imageRepository.get(basePath); +const getCachedContent = (basePath) => metadata.imageRepository.get(basePath); -const isRelativeToCurrentDirectory = basePath => !basePath.startsWith('/'); +const isRelativeToCurrentDirectory = (basePath) => !basePath.startsWith('/'); -const extractSourceDirectory = url => { +const extractSourceDirectory = (url) => { const sourceDir = /^(.+)\/([^/]+)$/.exec(url); // Extracts the base path and fileName from an image path return sourceDir || [null, null, url]; // If no source directory was extracted it means only a fileName was specified (e.g. url='file.png') }; -const parseCurrentDirectory = basePath => { +const parseCurrentDirectory = (basePath) => { const baseUrl = decodeURIComponent(metadata.baseUrl); const sourceDirectory = extractSourceDirectory(baseUrl)[1]; const currentDirectory = sourceDirectory.split(`/-/sse/${metadata.branch}`)[1]; @@ -23,7 +23,7 @@ const parseCurrentDirectory = basePath => { // For more context around this logic, please see the following comment: // https://gitlab.com/gitlab-org/gitlab/-/issues/241166#note_409413500 -const generateSourceDirectory = basePath => { +const generateSourceDirectory = (basePath) => { let sourceDir = ''; let defaultSourceDir = ''; diff --git a/app/assets/javascripts/static_site_editor/services/submit_content_changes.js b/app/assets/javascripts/static_site_editor/services/submit_content_changes.js index e57028ea05a..84e90deacfc 100644 --- a/app/assets/javascripts/static_site_editor/services/submit_content_changes.js +++ b/app/assets/javascripts/static_site_editor/services/submit_content_changes.js @@ -32,7 +32,7 @@ const createImageActions = (images, markdown) => { } images.forEach((imageContent, filePath) => { - const imageExistsInMarkdown = path => new RegExp(`!\\[([^[\\]\\n]*)\\](\\(${path})\\)`); // matches the image markdown syntax: ![<any-string-except-newline>](<path>) + const imageExistsInMarkdown = (path) => new RegExp(`!\\[([^[\\]\\n]*)\\](\\(${path})\\)`); // matches the image markdown syntax: ![<any-string-except-newline>](<path>) if (imageExistsInMarkdown(filePath).test(markdown)) { actions.push( diff --git a/app/assets/javascripts/static_site_editor/services/templater.js b/app/assets/javascripts/static_site_editor/services/templater.js index d302aea78a3..47fc36c3d18 100644 --- a/app/assets/javascripts/static_site_editor/services/templater.js +++ b/app/assets/javascripts/static_site_editor/services/templater.js @@ -40,10 +40,10 @@ const mark = (source, groups) => { const hash = {}; Object.entries(groups).forEach(([groupKey, group]) => { - group.forEach(pattern => { + group.forEach((pattern) => { const matches = text.match(pattern); if (matches) { - matches.forEach(match => { + matches.forEach((match) => { const key = `${markPrefix}-${groupKey}-${id}`; text = text.replace(match, key); hash[key] = match; @@ -67,12 +67,12 @@ const unmark = (text, hash) => { return source; }; -const unwrap = source => { +const unwrap = (source) => { let text = source; const matches = text.match(reTemplated); if (matches) { - matches.forEach(match => { + matches.forEach((match) => { const initial = match.replace(`${wrapPrefix}`, '').replace(`${wrapPostfix}`, ''); text = text.replace(match, initial); }); @@ -81,7 +81,7 @@ const unwrap = source => { return text; }; -const wrap = source => { +const wrap = (source) => { const { text, hash } = mark(unwrap(source), patternGroups); return unmark(text, hash); }; diff --git a/app/assets/javascripts/task_list.js b/app/assets/javascripts/task_list.js index b51951674d5..81d9d9d37a7 100644 --- a/app/assets/javascripts/task_list.js +++ b/app/assets/javascripts/task_list.js @@ -35,7 +35,7 @@ export default class TaskList { `${this.taskListContainerSelector} .js-task-list-field[data-value]`, ); - taskListFields.forEach(taskListField => { + taskListFields.forEach((taskListField) => { // eslint-disable-next-line no-param-reassign taskListField.value = taskListField.dataset.value; }); diff --git a/app/assets/javascripts/terminal/terminal.js b/app/assets/javascripts/terminal/terminal.js index bae320cb705..26cc538994f 100644 --- a/app/assets/javascripts/terminal/terminal.js +++ b/app/assets/javascripts/terminal/terminal.js @@ -64,11 +64,11 @@ export default class GLTerminal { const decoder = new TextDecoder('utf-8'); const encoder = new TextEncoder('utf-8'); - this.terminal.on('data', data => { + this.terminal.on('data', (data) => { this.socket.send(encoder.encode(data)); }); - this.socket.addEventListener('message', ev => { + this.socket.addEventListener('message', (ev) => { this.terminal.write(decoder.decode(ev.data)); }); @@ -110,7 +110,7 @@ export default class GLTerminal { this.terminal.dispose(); this.socket.close(); - this.onDispose.forEach(fn => fn()); + this.onDispose.forEach((fn) => fn()); this.onDispose.length = 0; } diff --git a/app/assets/javascripts/terraform/components/terraform_list.vue b/app/assets/javascripts/terraform/components/terraform_list.vue index 26a0bfe5fa5..b71133d8813 100644 --- a/app/assets/javascripts/terraform/components/terraform_list.vue +++ b/app/assets/javascripts/terraform/components/terraform_list.vue @@ -15,7 +15,7 @@ export default { ...this.cursor, }; }, - update: data => data, + update: (data) => data, error() { this.states = null; }, diff --git a/app/assets/javascripts/test_utils/simulate_input.js b/app/assets/javascripts/test_utils/simulate_input.js index c300c806e6d..90c1b7cb57e 100644 --- a/app/assets/javascripts/test_utils/simulate_input.js +++ b/app/assets/javascripts/test_utils/simulate_input.js @@ -12,7 +12,7 @@ export default function simulateInput(target, text) { } if (text.length > 0) { - Array.prototype.forEach.call(text, char => { + Array.prototype.forEach.call(text, (char) => { input.value += char; triggerEvents(input); }); diff --git a/app/assets/javascripts/toggle_buttons.js b/app/assets/javascripts/toggle_buttons.js index 10a9d29e694..2f933823842 100644 --- a/app/assets/javascripts/toggle_buttons.js +++ b/app/assets/javascripts/toggle_buttons.js @@ -49,7 +49,7 @@ function onToggleClicked(toggle, input, clickCallback) { export default function setupToggleButtons(container, clickCallback = () => {}) { const toggles = container.querySelectorAll('.js-project-feature-toggle'); - toggles.forEach(toggle => { + toggles.forEach((toggle) => { const input = toggle.querySelector('.js-project-feature-toggle-input'); const isOn = parseBoolean(input.value); diff --git a/app/assets/javascripts/tooltips/components/tooltips.vue b/app/assets/javascripts/tooltips/components/tooltips.vue index 15fc84368b2..90bdf06bc4c 100644 --- a/app/assets/javascripts/tooltips/components/tooltips.vue +++ b/app/assets/javascripts/tooltips/components/tooltips.vue @@ -2,7 +2,7 @@ import { GlTooltip, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import { uniqueId } from 'lodash'; -const getTooltipTitle = element => { +const getTooltipTitle = (element) => { return element.getAttribute('title') || element.dataset.title; }; @@ -37,8 +37,8 @@ export default { }; }, created() { - this.observer = new MutationObserver(mutations => { - mutations.forEach(mutation => { + this.observer = new MutationObserver((mutations) => { + mutations.forEach((mutation) => { mutation.removedNodes.forEach(this.dispose); }); }); @@ -49,11 +49,11 @@ export default { methods: { addTooltips(elements, config) { const newTooltips = elements - .filter(element => !this.tooltipExists(element)) - .map(element => newTooltip(element, config)) - .filter(tooltip => tooltip.title); + .filter((element) => !this.tooltipExists(element)) + .map((element) => newTooltip(element, config)) + .filter((tooltip) => tooltip.title); - newTooltips.forEach(tooltip => this.observe(tooltip)); + newTooltips.forEach((tooltip) => this.observe(tooltip)); this.tooltips.push(...newTooltips); }, @@ -91,7 +91,7 @@ export default { return Boolean(this.findTooltipByTarget(element)); }, findTooltipByTarget(element) { - return this.tooltips.find(tooltip => tooltip.target === element); + return this.tooltips.find((tooltip) => tooltip.target === element); }, }, safeHtmlConfig: { diff --git a/app/assets/javascripts/tooltips/index.js b/app/assets/javascripts/tooltips/index.js index 335925aec5f..b216affc818 100644 --- a/app/assets/javascripts/tooltips/index.js +++ b/app/assets/javascripts/tooltips/index.js @@ -81,12 +81,12 @@ const tooltipApiInvoker = ({ glHandler, bsHandler }) => (elements, ...params) => export const initTooltips = (config = {}) => { if (isGlTooltipsEnabled()) { const triggers = config?.triggers || DEFAULT_TRIGGER; - const events = triggers.split(' ').map(trigger => EVENTS_MAP[trigger]); + const events = triggers.split(' ').map((trigger) => EVENTS_MAP[trigger]); - events.forEach(event => { + events.forEach((event) => { document.addEventListener( event, - e => handleTooltipEvent(document, e, config.selector, config), + (e) => handleTooltipEvent(document, e, config.selector, config), true, ); }); @@ -103,28 +103,28 @@ export const add = (elements, config = {}) => { return invokeBootstrapApi(elements, config); }; export const dispose = tooltipApiInvoker({ - glHandler: element => tooltipsApp().dispose(element), - bsHandler: elements => invokeBootstrapApi(elements, 'dispose'), + glHandler: (element) => tooltipsApp().dispose(element), + bsHandler: (elements) => invokeBootstrapApi(elements, 'dispose'), }); export const fixTitle = tooltipApiInvoker({ - glHandler: element => tooltipsApp().fixTitle(element), - bsHandler: elements => invokeBootstrapApi(elements, '_fixTitle'), + glHandler: (element) => tooltipsApp().fixTitle(element), + bsHandler: (elements) => invokeBootstrapApi(elements, '_fixTitle'), }); export const enable = tooltipApiInvoker({ - glHandler: element => tooltipsApp().triggerEvent(element, 'enable'), - bsHandler: elements => invokeBootstrapApi(elements, 'enable'), + glHandler: (element) => tooltipsApp().triggerEvent(element, 'enable'), + bsHandler: (elements) => invokeBootstrapApi(elements, 'enable'), }); export const disable = tooltipApiInvoker({ - glHandler: element => tooltipsApp().triggerEvent(element, 'disable'), - bsHandler: elements => invokeBootstrapApi(elements, 'disable'), + glHandler: (element) => tooltipsApp().triggerEvent(element, 'disable'), + bsHandler: (elements) => invokeBootstrapApi(elements, 'disable'), }); export const hide = tooltipApiInvoker({ - glHandler: element => tooltipsApp().triggerEvent(element, 'close'), - bsHandler: elements => invokeBootstrapApi(elements, 'hide'), + glHandler: (element) => tooltipsApp().triggerEvent(element, 'close'), + bsHandler: (elements) => invokeBootstrapApi(elements, 'hide'), }); export const show = tooltipApiInvoker({ - glHandler: element => tooltipsApp().triggerEvent(element, 'open'), - bsHandler: elements => invokeBootstrapApi(elements, 'show'), + glHandler: (element) => tooltipsApp().triggerEvent(element, 'open'), + bsHandler: (elements) => invokeBootstrapApi(elements, 'show'), }); export const destroy = () => { tooltipsApp().$destroy(); diff --git a/app/assets/javascripts/tracking.js b/app/assets/javascripts/tracking.js index 0a1211d0a76..5d82d56f4ba 100644 --- a/app/assets/javascripts/tracking.js +++ b/app/assets/javascripts/tracking.js @@ -43,7 +43,7 @@ const eventHandler = (e, func, opts = {}) => { }; const eventHandlers = (category, func) => { - const handler = opts => e => eventHandler(e, func, { ...{ category }, ...opts }); + const handler = (opts) => (e) => eventHandler(e, func, { ...{ category }, ...opts }); const handlers = []; handlers.push({ name: 'click', func: handler() }); handlers.push({ name: 'show.bs.dropdown', func: handler({ suffix: '_show' }) }); @@ -79,7 +79,7 @@ export default class Tracking { parent.trackingBound = true; const handlers = eventHandlers(category, (...args) => this.event(...args)); - handlers.forEach(event => parent.addEventListener(event.name, event.func)); + handlers.forEach((event) => parent.addEventListener(event.name, event.func)); return handlers; } @@ -88,7 +88,7 @@ export default class Tracking { const loadEvents = parent.querySelectorAll('[data-track-event="render"]'); - loadEvents.forEach(element => { + loadEvents.forEach((element) => { const { action, data } = createEventPayload(element); this.event(category, action, data); }); diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js index 25a14107bbc..58bff370fa5 100644 --- a/app/assets/javascripts/tree.js +++ b/app/assets/javascripts/tree.js @@ -26,7 +26,7 @@ export default class TreeView { initKeyNav() { const li = $('tr.tree-item'); let liSelected = null; - return $('body').keydown(e => { + return $('body').keydown((e) => { let next, path; if ($('input:focus').length > 0 && (e.which === 38 || e.which === 40)) { return false; diff --git a/app/assets/javascripts/ui_development_kit.js b/app/assets/javascripts/ui_development_kit.js index 4f32e143de8..028b047d9f5 100644 --- a/app/assets/javascripts/ui_development_kit.js +++ b/app/assets/javascripts/ui_development_kit.js @@ -10,19 +10,19 @@ export default () => { { order_by: 'last_activity_at', }, - data => { + (data) => { callback(data); }, ); }, - text: project => project.name_with_namespace || project.name, + text: (project) => project.name_with_namespace || project.name, selectable: true, fieldName: 'author_id', filterable: true, search: { fields: ['name_with_namespace'], }, - id: data => data.id, - isSelected: data => data.id === 2, + id: (data) => data.id, + isSelected: (data) => data.id === 2, }); }; diff --git a/app/assets/javascripts/usage_ping_consent.js b/app/assets/javascripts/usage_ping_consent.js index a69620c1762..94d476d13ae 100644 --- a/app/assets/javascripts/usage_ping_consent.js +++ b/app/assets/javascripts/usage_ping_consent.js @@ -5,7 +5,7 @@ import { parseBoolean } from './lib/utils/common_utils'; import { __ } from './locale'; export default () => { - $('body').on('click', '.js-usage-consent-action', e => { + $('body').on('click', '.js-usage-consent-action', (e) => { e.preventDefault(); e.stopImmediatePropagation(); // overwrite rails listener diff --git a/app/assets/javascripts/user_callout.js b/app/assets/javascripts/user_callout.js index df00f38dd70..44e54c85f3c 100644 --- a/app/assets/javascripts/user_callout.js +++ b/app/assets/javascripts/user_callout.js @@ -15,7 +15,7 @@ export default class UserCallout { init() { if (!this.isCalloutDismissed || this.isCalloutDismissed === 'false') { - this.userCalloutBody.find('.js-close-callout').on('click', e => this.dismissCallout(e)); + this.userCalloutBody.find('.js-close-callout').on('click', (e) => this.dismissCallout(e)); } } diff --git a/app/assets/javascripts/user_lists/store/edit/actions.js b/app/assets/javascripts/user_lists/store/edit/actions.js index 8f0a2bafec7..6db2e65cf04 100644 --- a/app/assets/javascripts/user_lists/store/edit/actions.js +++ b/app/assets/javascripts/user_lists/store/edit/actions.js @@ -7,7 +7,7 @@ export const fetchUserList = ({ commit, state }) => { commit(types.REQUEST_USER_LIST); return Api.fetchFeatureFlagUserList(state.projectId, state.userListIid) .then(({ data }) => commit(types.RECEIVE_USER_LIST_SUCCESS, data)) - .catch(response => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response))); + .catch((response) => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response))); }; export const dismissErrorAlert = ({ commit }) => commit(types.DISMISS_ERROR_ALERT); @@ -18,5 +18,5 @@ export const updateUserList = ({ commit, state }, userList) => { name: userList.name, }) .then(({ data }) => redirectTo(data.path)) - .catch(response => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response))); + .catch((response) => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response))); }; diff --git a/app/assets/javascripts/user_lists/store/edit/index.js b/app/assets/javascripts/user_lists/store/edit/index.js index b30b0b04b9e..3b19b2b12ec 100644 --- a/app/assets/javascripts/user_lists/store/edit/index.js +++ b/app/assets/javascripts/user_lists/store/edit/index.js @@ -3,7 +3,7 @@ import createState from './state'; import * as actions from './actions'; import mutations from './mutations'; -export default initialState => +export default (initialState) => new Vuex.Store({ actions, mutations, diff --git a/app/assets/javascripts/user_lists/store/new/actions.js b/app/assets/javascripts/user_lists/store/new/actions.js index 185508bcfbc..478fca40142 100644 --- a/app/assets/javascripts/user_lists/store/new/actions.js +++ b/app/assets/javascripts/user_lists/store/new/actions.js @@ -11,5 +11,5 @@ export const createUserList = ({ commit, state }, userList) => { ...userList, }) .then(({ data }) => redirectTo(data.path)) - .catch(response => commit(types.RECEIVE_CREATE_USER_LIST_ERROR, getErrorMessages(response))); + .catch((response) => commit(types.RECEIVE_CREATE_USER_LIST_ERROR, getErrorMessages(response))); }; diff --git a/app/assets/javascripts/user_lists/store/new/index.js b/app/assets/javascripts/user_lists/store/new/index.js index b30b0b04b9e..3b19b2b12ec 100644 --- a/app/assets/javascripts/user_lists/store/new/index.js +++ b/app/assets/javascripts/user_lists/store/new/index.js @@ -3,7 +3,7 @@ import createState from './state'; import * as actions from './actions'; import mutations from './mutations'; -export default initialState => +export default (initialState) => new Vuex.Store({ actions, mutations, diff --git a/app/assets/javascripts/user_lists/store/show/actions.js b/app/assets/javascripts/user_lists/store/show/actions.js index 15b971aa5e8..dcd57efc146 100644 --- a/app/assets/javascripts/user_lists/store/show/actions.js +++ b/app/assets/javascripts/user_lists/store/show/actions.js @@ -5,7 +5,7 @@ import * as types from './mutation_types'; export const fetchUserList = ({ commit, state }) => { commit(types.REQUEST_USER_LIST); return Api.fetchFeatureFlagUserList(state.projectId, state.userListIid) - .then(response => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data)) + .then((response) => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data)) .catch(() => commit(types.RECEIVE_USER_LIST_ERROR)); }; @@ -27,6 +27,6 @@ export const updateUserList = ({ commit, state }) => { ...state.userList, user_xids: stringifyUserIds(state.userIds), }) - .then(response => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data)) + .then((response) => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data)) .catch(() => commit(types.RECEIVE_USER_LIST_ERROR)); }; diff --git a/app/assets/javascripts/user_lists/store/show/index.js b/app/assets/javascripts/user_lists/store/show/index.js index b30b0b04b9e..3b19b2b12ec 100644 --- a/app/assets/javascripts/user_lists/store/show/index.js +++ b/app/assets/javascripts/user_lists/store/show/index.js @@ -3,7 +3,7 @@ import createState from './state'; import * as actions from './actions'; import mutations from './mutations'; -export default initialState => +export default (initialState) => new Vuex.Store({ actions, mutations, diff --git a/app/assets/javascripts/user_lists/store/show/mutations.js b/app/assets/javascripts/user_lists/store/show/mutations.js index c3e766465a7..3cf3b2d8371 100644 --- a/app/assets/javascripts/user_lists/store/show/mutations.js +++ b/app/assets/javascripts/user_lists/store/show/mutations.js @@ -20,10 +20,10 @@ export default { [types.ADD_USER_IDS](state, ids) { state.userIds = [ ...state.userIds, - ...parseUserIds(ids).filter(id => id && !state.userIds.includes(id)), + ...parseUserIds(ids).filter((id) => id && !state.userIds.includes(id)), ]; }, [types.REMOVE_USER_ID](state, id) { - state.userIds = state.userIds.filter(uid => uid !== id); + state.userIds = state.userIds.filter((uid) => uid !== id); }, }; diff --git a/app/assets/javascripts/user_popovers.js b/app/assets/javascripts/user_popovers.js index 3521c1a105f..c18f4fb46cc 100644 --- a/app/assets/javascripts/user_popovers.js +++ b/app/assets/javascripts/user_popovers.js @@ -5,14 +5,14 @@ import { sanitize } from '~/lib/dompurify'; import UsersCache from './lib/utils/users_cache'; import UserPopover from './vue_shared/components/user_popover/user_popover.vue'; -const removeTitle = el => { +const removeTitle = (el) => { // Removing titles so its not showing tooltips also el.dataset.originalTitle = ''; el.setAttribute('title', ''); }; -const getPreloadedUserInfo = dataset => { +const getPreloadedUserInfo = (dataset) => { const userId = dataset.user || dataset.userId; const { username, name, avatarUrl } = dataset; @@ -28,7 +28,7 @@ const getPreloadedUserInfo = dataset => { * Adds a UserPopover component to the body, hands over as much data as the target element has in data attributes. * loads based on data-user-id more data about a user from the API and sets it on the popover */ -const populateUserInfo = user => { +const populateUserInfo = (user) => { const { userId } = user; return Promise.all([UsersCache.retrieveById(userId), UsersCache.retrieveStatusById(userId)]).then( @@ -66,7 +66,7 @@ export default (elements = document.querySelectorAll('.js-user-link')) => { return userLinks .filter(({ dataset }) => dataset.user || dataset.userId) - .map(el => { + .map((el) => { if (initializedPopovers.has(el)) { return initializedPopovers.get(el); } diff --git a/app/assets/javascripts/users_select/index.js b/app/assets/javascripts/users_select/index.js index 9288af0bbf7..79dc20fd498 100644 --- a/app/assets/javascripts/users_select/index.js +++ b/app/assets/javascripts/users_select/index.js @@ -145,14 +145,14 @@ function UsersSelect(currentUser, els, options = {}) { }; const getMultiSelectDropdownTitle = function (selectedUser, isSelected) { - const selectedUsers = getSelected().filter(u => u !== 0); + const selectedUsers = getSelected().filter((u) => u !== 0); const firstUser = getSelectedUserInputs() .map((index, input) => ({ name: input.dataset.meta, value: parseInt(input.value, 10), })) - .filter(u => u.id !== 0) + .filter((u) => u.id !== 0) .get(0); if (selectedUsers.length === 0) { @@ -160,7 +160,7 @@ function UsersSelect(currentUser, els, options = {}) { } else if (selectedUsers.length === 1) { return firstUser.name; } else if (isSelected) { - const otherSelected = selectedUsers.filter(s => s !== selectedUser.id); + const otherSelected = selectedUsers.filter((s) => s !== selectedUser.id); return sprintf(s__('UsersSelect|%{name} + %{length} more'), { name: selectedUser.name, length: otherSelected.length, @@ -172,7 +172,7 @@ function UsersSelect(currentUser, els, options = {}) { }); }; - $assignToMeLink.on('click', e => { + $assignToMeLink.on('click', (e) => { e.preventDefault(); $(e.currentTarget).hide(); @@ -196,7 +196,7 @@ function UsersSelect(currentUser, els, options = {}) { } }); - $block.on('click', '.js-assign-yourself', e => { + $block.on('click', '.js-assign-yourself', (e) => { e.preventDefault(); return assignTo(userSelect.currentUser.id); }); @@ -250,7 +250,7 @@ function UsersSelect(currentUser, els, options = {}) { return initDeprecatedJQueryDropdown($dropdown, { showMenuAbove, data(term, callback) { - return userSelect.users(term, options, users => { + return userSelect.users(term, options, (users) => { // GitLabDropdownFilter returns this.instance // GitLabDropdownRemote returns this.options.instance const deprecatedJQueryDropdown = this.instance || this.options.instance; @@ -266,14 +266,14 @@ function UsersSelect(currentUser, els, options = {}) { // Potential duplicate entries when dealing with issue board // because issue board is also managed by vue - const selectedUsers = uniqBy(selectedInputs, a => a.value) - .filter(input => { + const selectedUsers = uniqBy(selectedInputs, (a) => a.value) + .filter((input) => { const userId = parseInt(input.value, 10); - const inUsersArray = users.find(u => u.id === userId); + const inUsersArray = users.find((u) => u.id === userId); return !inUsersArray && userId !== 0; }) - .map(input => { + .map((input) => { const userId = parseInt(input.value, 10); const { avatarUrl, avatar_url, name, username, canMerge } = input.dataset; return { @@ -334,7 +334,7 @@ function UsersSelect(currentUser, els, options = {}) { } if ($dropdown.hasClass('js-multiselect')) { - const selected = getSelected().filter(i => i !== 0); + const selected = getSelected().filter((i) => i !== 0); if (selected.length > 0) { if ($dropdown.data('dropdownHeader')) { @@ -346,12 +346,12 @@ function UsersSelect(currentUser, els, options = {}) { } const selectedUsers = users - .filter(u => selected.indexOf(u.id) !== -1) + .filter((u) => selected.indexOf(u.id) !== -1) .sort((a, b) => a.name > b.name); - users = users.filter(u => selected.indexOf(u.id) === -1); + users = users.filter((u) => selected.indexOf(u.id) === -1); - selectedUsers.forEach(selectedUser => { + selectedUsers.forEach((selectedUser) => { showDivider += 1; users.splice(showDivider, 0, selectedUser); }); @@ -477,7 +477,7 @@ function UsersSelect(currentUser, els, options = {}) { } } - if (getSelected().find(u => u === gon.current_user_id)) { + if (getSelected().find((u) => u === gon.current_user_id)) { $assignToMeLink.hide(); } else { $assignToMeLink.show(); @@ -544,7 +544,7 @@ function UsersSelect(currentUser, els, options = {}) { } if (selected.length > 0) { - getSelected().forEach(selectedId => highlightSelected(selectedId)); + getSelected().forEach((selectedId) => highlightSelected(selectedId)); } else if ($dropdown.hasClass('js-issue-board-sidebar')) { highlightSelected(0); } else { @@ -559,7 +559,7 @@ function UsersSelect(currentUser, els, options = {}) { let selected = false; if (this.multiSelect) { - selected = getSelected().find(u => user.id === u); + selected = getSelected().find((u) => user.id === u); const { fieldName } = this; const field = $dropdown @@ -613,7 +613,7 @@ function UsersSelect(currentUser, els, options = {}) { multiple: $(select).hasClass('multiselect'), minimumInputLength: 0, query(query) { - return userSelect.users(query.term, options, users => { + return userSelect.users(query.term, options, (users) => { let name; const data = { results: users, diff --git a/app/assets/javascripts/vue_alerts.js b/app/assets/javascripts/vue_alerts.js index 6550eb31491..abc1dd75645 100644 --- a/app/assets/javascripts/vue_alerts.js +++ b/app/assets/javascripts/vue_alerts.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import { parseBoolean } from '~/lib/utils/common_utils'; import DismissibleAlert from '~/vue_shared/components/dismissible_alert.vue'; -const mountVueAlert = el => { +const mountVueAlert = (el) => { const props = { html: el.innerHTML, }; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue b/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue index 7297f8f8677..9b822657184 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue @@ -74,7 +74,7 @@ export default { return this.mr.approvals || {}; }, approvedBy() { - return this.approvals.approved_by ? this.approvals.approved_by.map(x => x.user) : []; + return this.approvals.approved_by ? this.approvals.approved_by.map((x) => x.user) : []; }, userHasApproved() { return Boolean(this.approvals.user_has_approved); @@ -136,7 +136,7 @@ export default { approveWithAuth(data) { this.updateApproval( () => this.service.approveMergeRequestWithAuth(data), - error => { + (error) => { if (error && error.response && error.response.status === 401) { this.hasApprovalAuthError = true; return; @@ -155,7 +155,7 @@ export default { this.isApproving = true; this.clearError(); return serviceFn() - .then(data => { + .then((data) => { this.mr.setApprovals(data); eventHub.$emit('MRWidgetUpdateRequested'); this.$emit('updated'); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue index b90cbfd1a1a..215df8acece 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue @@ -121,7 +121,7 @@ export default { this.actionInProgress = actionName; MRWidgetService.executeInlineAction(endpoint) - .then(resp => { + .then((resp) => { const redirectUrl = resp?.data?.redirect_url; if (redirectUrl) { visitUrl(redirectUrl); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_view_button.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_view_button.vue index e3c0b7935d7..abc831c8abe 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_view_button.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_view_button.vue @@ -57,7 +57,7 @@ export default { return this.deployment.changes && this.deployment.changes.length > 1; }, filteredChanges() { - return this.deployment?.changes?.filter(change => change.path.includes(this.searchTerm)); + return this.deployment?.changes?.filter((change) => change.path.includes(this.searchTerm)); }, }, }; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue index 322444ce14b..2f27216f2e9 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue @@ -102,7 +102,7 @@ export default { loadMetrics() { backOff((next, stop) => { MRWidgetService.fetchMetrics(this.metricsUrl) - .then(res => { + .then((res) => { if (res.status === statusCodes.NO_CONTENT) { this.backOffRequestCounter += 1; /* eslint-disable no-unused-expressions */ @@ -113,14 +113,14 @@ export default { }) .catch(stop); }) - .then(res => { + .then((res) => { if (res.status === statusCodes.NO_CONTENT) { return res; } return res.data; }) - .then(data => { + .then((data) => { this.computeGraphData(data.metrics, data.deployment_time); return data; }) diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue index eff26729fa7..33809b953ee 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue @@ -67,11 +67,11 @@ export default { }, mounted() { this.fetchCollapsedData(this.$props) - .then(data => { + .then((data) => { this.collapsedData = data; this.loadingState = null; }) - .catch(e => { + .catch((e) => { this.loadingState = LOADING_STATES.collapsedError; throw e; }); @@ -86,11 +86,11 @@ export default { this.loadingState = LOADING_STATES.expandedLoading; this.fetchFullData(this.$props) - .then(data => { + .then((data) => { this.loadingState = null; this.fullData = data; }) - .catch(e => { + .catch((e) => { this.loadingState = null; throw e; }); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/container.js b/app/assets/javascripts/vue_merge_request_widget/components/extensions/container.js index 5014c12dc30..529160de6a7 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/container.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/container.js @@ -11,7 +11,7 @@ export default { return h( 'div', {}, - extensions.map(extension => + extensions.map((extension) => h(extension, { props: extensions[0].props.reduce( (acc, key) => ({ diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/index.js b/app/assets/javascripts/vue_merge_request_widget/components/extensions/index.js index 2bfaec8a1c9..9796bb44939 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/index.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/index.js @@ -3,7 +3,7 @@ import ExtensionBase from './base.vue'; // Holds all the currently registered extensions export const extensions = []; -export const registerExtension = extension => { +export const registerExtension = (extension) => { // Pushes into the extenions array a dynamically created Vue component // that gets exteneded from `base.vue` extensions.push({ diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_alert_message.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_alert_message.vue index a2636ce52ad..5be1ce66d60 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_alert_message.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_alert_message.vue @@ -13,7 +13,7 @@ export default { type: String, required: false, default: DANGER, - validator: value => [WARNING, DANGER].includes(value), + validator: (value) => [WARNING, DANGER].includes(value), }, helpPath: { type: String, diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue index 750014c599a..17a880036e7 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue @@ -51,8 +51,8 @@ export default { this.isCancellingAutoMerge = true; this.service .cancelAutomaticMerge() - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { eventHub.$emit('UpdateWidgetData', data); }) .catch(() => { @@ -70,8 +70,8 @@ export default { this.isRemovingSourceBranch = true; this.service .merge(options) - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { if (AUTO_MERGE_STRATEGIES.includes(data.status)) { eventHub.$emit('MRWidgetUpdateRequested'); } diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue index 87c59e5ece9..3d5daa4979b 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue @@ -30,7 +30,7 @@ export default { variables() { return this.mergeRequestQueryVariables; }, - update: data => data.project.mergeRequest.userPermissions, + update: (data) => data.project.mergeRequest.userPermissions, }, stateData: { query: conflictsStateQuery, @@ -40,7 +40,7 @@ export default { variables() { return this.mergeRequestQueryVariables; }, - update: data => data.project.mergeRequest, + update: (data) => data.project.mergeRequest, }, }, props: { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue index 17cd740ddd9..9d646dbfb3e 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue @@ -83,8 +83,8 @@ export default { this.service .removeSourceBranch() - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { // False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26 // eslint-disable-next-line @gitlab/require-i18n-strings if (data.message === 'Branch was deleted') { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue index 8511797286d..3f68979bc0e 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue @@ -25,7 +25,7 @@ export default { variables() { return this.mergeRequestQueryVariables; }, - update: data => data.project.mergeRequest, + update: (data) => data.project.mergeRequest, }, }, props: { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue index 14c2e9fa828..9d27bb5dde4 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue @@ -65,7 +65,7 @@ export default { .then(() => { simplePoll(this.checkRebaseStatus); }) - .catch(error => { + .catch((error) => { this.isMakingRequest = false; if (error.response && error.response.data && error.response.data.merge_error) { @@ -78,8 +78,8 @@ export default { checkRebaseStatus(continuePolling, stopPolling) { this.service .poll() - .then(res => res.data) - .then(res => { + .then((res) => res.data) + .then((res) => { if (res.rebase_in_progress) { continuePolling(); } else { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue index 2c1f2285dda..78ac7e496e1 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue @@ -188,8 +188,8 @@ export default { this.isMakingRequest = true; this.service .merge(options) - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { const hasError = data.status === MERGE_FAILED_STATUS || data.status === MERGE_HOOK_VALIDATION_ERROR_STATUS; @@ -228,8 +228,8 @@ export default { handleMergePolling(continuePolling, stopPolling) { this.service .poll() - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { if (data.state === 'merged') { // If state is merged we should update the widget and stop the polling eventHub.$emit('MRWidgetUpdateRequested'); @@ -270,8 +270,8 @@ export default { handleRemoveBranchPolling(continuePolling, stopPolling) { this.service .poll() - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { // If source branch exists then we should continue polling // because removing a source branch is a background task and takes time if (data.source_branch_exists) { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue index 1c9909e7178..12fdfe601a4 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue @@ -46,7 +46,7 @@ export default { name="squash" class="qa-squash-checkbox js-squash-checkbox gl-mb-0 gl-mr-2" :title="tooltipTitle" - @change="checked => $emit('input', checked)" + @change="(checked) => $emit('input', checked)" > {{ $options.i18n.checkboxLabel }} </gl-form-checkbox> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue index 322d4124935..3f1db815f95 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue @@ -29,7 +29,7 @@ export default { variables() { return this.mergeRequestQueryVariables; }, - update: data => data.project.mergeRequest.userPermissions, + update: (data) => data.project.mergeRequest.userPermissions, }, }, props: { @@ -86,7 +86,7 @@ export default { variables: mergeRequestQueryVariables, }); - const data = produce(sourceData, draftState => { + const data = produce(sourceData, (draftState) => { // eslint-disable-next-line no-param-reassign draftState.project.mergeRequest.workInProgress = workInProgress; // eslint-disable-next-line no-param-reassign @@ -137,8 +137,8 @@ export default { this.isMakingRequest = true; this.service .removeWIP() - .then(res => res.data) - .then(data => { + .then((res) => res.data) + .then((data) => { eventHub.$emit('UpdateWidgetData', data); MergeRequest.toggleDraftStatus(this.mr.title, true); }) diff --git a/app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue b/app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue index 4de41dd5887..180db7828a8 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue @@ -40,7 +40,7 @@ export default { ); }, numberOfInvalidPlans() { - return Object.values(this.plansObject).filter(plan => plan.tf_report_error).length; + return Object.values(this.plansObject).filter((plan) => plan.tf_report_error).length; }, numberOfPlans() { return Object.keys(this.plansObject).length; diff --git a/app/assets/javascripts/vue_merge_request_widget/extensions/issues.js b/app/assets/javascripts/vue_merge_request_widget/extensions/issues.js index 2d21ced1b28..6c6f5e7fc73 100644 --- a/app/assets/javascripts/vue_merge_request_widget/extensions/issues.js +++ b/app/assets/javascripts/vue_merge_request_widget/extensions/issues.js @@ -38,7 +38,7 @@ export default { .query({ query: issuesQuery, variables: { projectPath: targetProjectFullPath } }) .then(({ data }) => { // Return some transformed data to be rendered in the expanded state - return data.project.issues.nodes.map(issue => ({ + return data.project.issues.nodes.map((issue) => ({ id: issue.id, // Required: The ID of the object text: issue.title, // Required: The text to get used on each row // Icon to get rendered on the side of each row diff --git a/app/assets/javascripts/vue_merge_request_widget/mixins/approvals.js b/app/assets/javascripts/vue_merge_request_widget/mixins/approvals.js index e50555ca875..943011949fd 100644 --- a/app/assets/javascripts/vue_merge_request_widget/mixins/approvals.js +++ b/app/assets/javascripts/vue_merge_request_widget/mixins/approvals.js @@ -11,7 +11,7 @@ export default { } }, refreshApprovals() { - return this.service.fetchApprovals().then(data => { + return this.service.fetchApprovals().then((data) => { this.mr.setApprovals(data); }); }, diff --git a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue index fc9a73f991c..a620e155ff5 100644 --- a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue +++ b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue @@ -358,7 +358,7 @@ export default { fetchActionsContent() { this.service .fetchMergeActionsContent() - .then(res => { + .then((res) => { if (res.data) { const el = document.createElement('div'); el.innerHTML = res.data; @@ -388,26 +388,26 @@ export default { this.pollingInterval.stopTimer(); }, bindEventHubListeners() { - eventHub.$on('MRWidgetUpdateRequested', cb => { + eventHub.$on('MRWidgetUpdateRequested', (cb) => { this.checkStatus(cb); }); - eventHub.$on('MRWidgetRebaseSuccess', cb => { + eventHub.$on('MRWidgetRebaseSuccess', (cb) => { this.checkStatus(cb, true); }); // `params` should be an Array contains a Boolean, like `[true]` // Passing parameter as Boolean didn't work. - eventHub.$on('SetBranchRemoveFlag', params => { + eventHub.$on('SetBranchRemoveFlag', (params) => { [this.mr.isRemovingSourceBranch] = params; }); - eventHub.$on('FailedToMerge', mergeError => { + eventHub.$on('FailedToMerge', (mergeError) => { this.mr.state = 'failedToMerge'; this.mr.mergeError = mergeError; }); - eventHub.$on('UpdateWidgetData', data => { + eventHub.$on('UpdateWidgetData', (data) => { this.mr.setData(data); }); diff --git a/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js b/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js index 2ad15f231bb..7dcb4881e7f 100644 --- a/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js +++ b/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js @@ -60,15 +60,15 @@ export default class MRWidgetService { } fetchApprovals() { - return axios.get(this.apiApprovalsPath).then(res => res.data); + return axios.get(this.apiApprovalsPath).then((res) => res.data); } approveMergeRequest() { - return axios.post(this.apiApprovePath).then(res => res.data); + return axios.post(this.apiApprovePath).then((res) => res.data); } unapproveMergeRequest() { - return axios.post(this.apiUnapprovePath).then(res => res.data); + return axios.post(this.apiUnapprovePath).then((res) => res.data); } static executeInlineAction(url) { diff --git a/app/assets/javascripts/vue_merge_request_widget/stores/artifacts_list/getters.js b/app/assets/javascripts/vue_merge_request_widget/stores/artifacts_list/getters.js index 15d67ea18ea..7740147c8e4 100644 --- a/app/assets/javascripts/vue_merge_request_widget/stores/artifacts_list/getters.js +++ b/app/assets/javascripts/vue_merge_request_widget/stores/artifacts_list/getters.js @@ -1,6 +1,6 @@ import { s__, n__ } from '~/locale'; -export const title = state => { +export const title = (state) => { if (state.isLoading) { return s__('BuildArtifacts|Loading artifacts'); } diff --git a/app/assets/javascripts/vue_shared/components/actions_button.vue b/app/assets/javascripts/vue_shared/components/actions_button.vue index cb4c5f20377..2dc2c27f7ea 100644 --- a/app/assets/javascripts/vue_shared/components/actions_button.vue +++ b/app/assets/javascripts/vue_shared/components/actions_button.vue @@ -43,7 +43,7 @@ export default { return this.actions.length > 1; }, selectedAction() { - return this.actions.find(x => x.key === this.selectedKey) || this.actions[0]; + return this.actions.find((x) => x.key === this.selectedKey) || this.actions[0]; }, }, methods: { diff --git a/app/assets/javascripts/vue_shared/components/awards_list.vue b/app/assets/javascripts/vue_shared/components/awards_list.vue index 9a6433963bc..c1da2b8c305 100644 --- a/app/assets/javascripts/vue_shared/components/awards_list.vue +++ b/app/assets/javascripts/vue_shared/components/awards_list.vue @@ -48,7 +48,7 @@ export default { groupedAwards() { const { thumbsup, thumbsdown, ...rest } = { ...this.groupedDefaultAwards, - ...groupBy(this.awards, x => x.name), + ...groupBy(this.awards, (x) => x.name), }; return [ @@ -73,7 +73,7 @@ export default { return false; } - return awardList.some(award => award.user.id === this.currentUserId); + return awardList.some((award) => award.user.id === this.currentUserId); }, createAwardList(name, list) { return { @@ -95,11 +95,11 @@ export default { // Filter myself from list if I am awarded. if (hasReactionByCurrentUser) { - awardList = awardList.filter(award => award.user.id !== this.currentUserId); + awardList = awardList.filter((award) => award.user.id !== this.currentUserId); } // Get only 9-10 usernames to show in tooltip text. - const namesToShow = awardList.slice(0, TOOLTIP_NAME_COUNT).map(award => award.user.name); + const namesToShow = awardList.slice(0, TOOLTIP_NAME_COUNT).map((award) => award.user.name); // Get the remaining list to use in `and x more` text. const remainingAwardList = awardList.slice(TOOLTIP_NAME_COUNT, awardList.length); diff --git a/app/assets/javascripts/vue_shared/components/commit.vue b/app/assets/javascripts/vue_shared/components/commit.vue index e01a651806d..0f860d90756 100644 --- a/app/assets/javascripts/vue_shared/components/commit.vue +++ b/app/assets/javascripts/vue_shared/components/commit.vue @@ -54,7 +54,7 @@ export default { type: Object, required: false, default: undefined, - validator: ref => + validator: (ref) => ref === undefined || (Number.isFinite(ref.iid) && isString(ref.path) && !isEmpty(ref.path)), }, diff --git a/app/assets/javascripts/vue_shared/components/confirm_modal.vue b/app/assets/javascripts/vue_shared/components/confirm_modal.vue index 96f800511d2..7c1d3772acd 100644 --- a/app/assets/javascripts/vue_shared/components/confirm_modal.vue +++ b/app/assets/javascripts/vue_shared/components/confirm_modal.vue @@ -30,8 +30,8 @@ export default { }; }, mounted() { - document.querySelectorAll(this.selector).forEach(button => { - button.addEventListener('click', e => { + document.querySelectorAll(this.selector).forEach((button) => { + button.addEventListener('click', (e) => { e.preventDefault(); this.path = button.dataset.path; diff --git a/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue b/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue index 79cdf308ac5..d0c2672b162 100644 --- a/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue +++ b/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue @@ -202,7 +202,7 @@ export default { <template> <tooltip-on-truncate :title="timeWindowText" - :truncate-target="elem => elem.querySelector('.gl-dropdown-toggle-text')" + :truncate-target="(elem) => elem.querySelector('.gl-dropdown-toggle-text')" placement="top" class="d-inline-block" > diff --git a/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_input.vue b/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_input.vue index 32a24844d71..39c1caf928e 100644 --- a/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_input.vue +++ b/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_input.vue @@ -20,12 +20,12 @@ export default { state: { default: null, required: true, - validator: prop => typeof prop === 'boolean' || prop === null, + validator: (prop) => typeof prop === 'boolean' || prop === null, }, value: { default: null, required: false, - validator: prop => typeof prop === 'string' || prop === null, + validator: (prop) => typeof prop === 'string' || prop === null, }, label: { type: String, diff --git a/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_lib.js b/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_lib.js index aaadc9766db..aec67a18a05 100644 --- a/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_lib.js +++ b/app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_lib.js @@ -25,7 +25,7 @@ export const defaultTimeRanges = [ }, ]; -export const defaultTimeRange = defaultTimeRanges.find(tr => tr.default); +export const defaultTimeRange = defaultTimeRanges.find((tr) => tr.default); export const dateFormats = { /** @@ -49,7 +49,7 @@ export const dateFormats = { * @param {string} value - Value as typed by the user * @returns true if the value can be parsed as a valid date, false otherwise */ -export const isValidInputString = value => { +export const isValidInputString = (value) => { try { // dateformat throws error that can be caught. // This is better than using `new Date()` diff --git a/app/assets/javascripts/vue_shared/components/deprecated_modal_2.vue b/app/assets/javascripts/vue_shared/components/deprecated_modal_2.vue index 65768487e9b..b856bbcdedd 100644 --- a/app/assets/javascripts/vue_shared/components/deprecated_modal_2.vue +++ b/app/assets/javascripts/vue_shared/components/deprecated_modal_2.vue @@ -21,7 +21,7 @@ export default { type: String, required: false, default: 'md', - validator: value => sizeVariants.includes(value), + validator: (value) => sizeVariants.includes(value), }, headerTitleText: { type: String, @@ -32,7 +32,7 @@ export default { type: String, required: false, default: 'primary', - validator: value => buttonVariants.includes(value), + validator: (value) => buttonVariants.includes(value), }, footerPrimaryButtonText: { type: String, diff --git a/app/assets/javascripts/vue_shared/components/dismissible_container.vue b/app/assets/javascripts/vue_shared/components/dismissible_container.vue index 6d5fd065751..2eaf833a6be 100644 --- a/app/assets/javascripts/vue_shared/components/dismissible_container.vue +++ b/app/assets/javascripts/vue_shared/components/dismissible_container.vue @@ -22,7 +22,7 @@ export default { .post(this.path, { feature_name: this.featureId, }) - .catch(e => { + .catch((e) => { // eslint-disable-next-line @gitlab/require-i18n-strings, no-console console.error('Failed to dismiss message.', e); }); diff --git a/app/assets/javascripts/vue_shared/components/file_finder/index.vue b/app/assets/javascripts/vue_shared/components/file_finder/index.vue index 05403b38850..27933f87929 100644 --- a/app/assets/javascripts/vue_shared/components/file_finder/index.vue +++ b/app/assets/javascripts/vue_shared/components/file_finder/index.vue @@ -128,7 +128,7 @@ export default { this.focusedIndex = 0; } - Mousetrap.bind(['t', 'mod+p'], e => { + Mousetrap.bind(['t', 'mod+p'], (e) => { if (e.preventDefault) { e.preventDefault(); } diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue index 3988b3814f9..4dac72df2b5 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue @@ -59,7 +59,7 @@ export default { type: String, required: false, default: '', - validator: value => value === '' || /(_desc)|(_asc)/g.test(value), + validator: (value) => value === '' || /(_desc)|(_asc)/g.test(value), }, showCheckbox: { type: Boolean, @@ -89,7 +89,7 @@ export default { if (this.initialSortBy) { selectedSortOption = this.sortOptions .filter( - sortBy => + (sortBy) => sortBy.sortDirection.ascending === this.initialSortBy || sortBy.sortDirection.descending === this.initialSortBy, ) @@ -204,12 +204,12 @@ export default { this.recentSearchesStore = new RecentSearchesStore({ isLocalStorageAvailable: RecentSearchesService.isAvailable(), - allowedKeys: this.tokens.map(token => token.type), + allowedKeys: this.tokens.map((token) => token.type), }); this.recentSearchesPromise = this.recentSearchesService .fetch() - .catch(error => { + .catch((error) => { if (error.name === 'RecentSearchesServiceError') return undefined; createFlash(__('An error occurred while parsing recent searches')); @@ -217,7 +217,7 @@ export default { // Gracefully fail to empty array return []; }) - .then(searches => { + .then((searches) => { if (!searches) return; // Put any searches that may have come in before @@ -250,7 +250,7 @@ export default { * spaces. */ removeQuotesEnclosure(filters = []) { - return filters.map(filter => { + return filters.map((filter) => { if (typeof filter === 'object') { const valueString = filter.value.data; return { @@ -305,8 +305,8 @@ export default { }, historyTokenOptionTitle(historyToken) { const tokenOption = this.tokens - .find(token => token.type === historyToken.type) - ?.options?.find(option => option.value === historyToken.value.data); + .find((token) => token.type === historyToken.type) + ?.options?.find((option) => option.value === historyToken.value.data); if (!tokenOption?.title) { return historyToken.value.data; diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js index e7d7b7d9f1b..a15cf220ee5 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js @@ -8,7 +8,7 @@ import { queryToObject } from '~/lib/utils/url_utility'; * * @returns {String} String without any enclosure */ -export const stripQuotes = value => value.replace(/^('|")(.*)('|")$/, '$2'); +export const stripQuotes = (value) => value.replace(/^('|")(.*)('|")$/, '$2'); /** * This method removes duplicate tokens from tokens array. @@ -17,7 +17,7 @@ export const stripQuotes = value => value.replace(/^('|")(.*)('|")$/, '$2'); * * @returns {Array} Unique array of tokens */ -export const uniqueTokens = tokens => { +export const uniqueTokens = (tokens) => { const knownTokens = []; return tokens.reduce((uniques, token) => { if (typeof token === 'object' && token.type !== 'filtered-search-term') { @@ -61,7 +61,7 @@ export function prepareTokens(filters = {}) { return memo; } if (Array.isArray(value)) { - return [...memo, ...value.map(filterValue => createToken(key, filterValue))]; + return [...memo, ...value.map((filterValue) => createToken(key, filterValue))]; } return [...memo, createToken(key, value)]; @@ -99,8 +99,8 @@ export function filterToQueryObject(filters = {}) { let selected; let unselected; if (Array.isArray(filter)) { - selected = filter.filter(item => item.operator === '=').map(item => item.value); - unselected = filter.filter(item => item.operator === '!=').map(item => item.value); + selected = filter.filter((item) => item.operator === '=').map((item) => item.value); + unselected = filter.filter((item) => item.operator === '!=').map((item) => item.value); } else { selected = filter?.operator === '=' ? filter.value : null; unselected = filter?.operator === '!=' ? filter.value : null; @@ -155,7 +155,7 @@ export function urlQueryToFilter(query = '') { previousValues = memo[filterName]; } if (Array.isArray(value)) { - const newAdditions = value.filter(Boolean).map(item => ({ value: item, operator })); + const newAdditions = value.filter(Boolean).map((item) => ({ value: item, operator })); return { ...memo, [filterName]: [...previousValues, ...newAdditions] }; } diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/store/modules/filters/actions.js b/app/assets/javascripts/vue_shared/components/filtered_search_bar/store/modules/filters/actions.js index 443cb28cf10..411654d15f4 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/store/modules/filters/actions.js +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/store/modules/filters/actions.js @@ -17,7 +17,7 @@ export function fetchBranches({ commit, state }, search = '') { commit(types.REQUEST_BRANCHES); return Api.branches(projectEndpoint, search) - .then(response => { + .then((response) => { commit(types.RECEIVE_BRANCHES_SUCCESS, response.data); return response; }) @@ -34,7 +34,7 @@ export const fetchMilestones = ({ commit, state }, search_title = '') => { return axios .get(milestonesEndpoint, { params: { search_title } }) - .then(response => { + .then((response) => { commit(types.RECEIVE_MILESTONES_SUCCESS, response.data); return response; }) @@ -50,7 +50,7 @@ export const fetchLabels = ({ commit, state }, search = '') => { return axios .get(state.labelsEndpoint, { params: { search } }) - .then(response => { + .then((response) => { commit(types.RECEIVE_LABELS_SUCCESS, response.data); return response; }) @@ -67,13 +67,13 @@ function fetchUser(options = {}) { let fetchUserPromise; if (projectEndpoint) { - fetchUserPromise = Api.projectUsers(projectEndpoint, query).then(data => ({ data })); + fetchUserPromise = Api.projectUsers(projectEndpoint, query).then((data) => ({ data })); } else { fetchUserPromise = Api.groupMembers(groupEndpoint, { query }); } return fetchUserPromise - .then(response => { + .then((response) => { commit(`RECEIVE_${action}_SUCCESS`, response.data); return response; }) diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue index ee0e00b0f5d..d53c829a48e 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue @@ -43,7 +43,7 @@ export default { return this.value.data.toLowerCase(); }, activeAuthor() { - return this.authors.find(author => author.username.toLowerCase() === this.currentValue); + return this.authors.find((author) => author.username.toLowerCase() === this.currentValue); }, }, watch: { @@ -63,7 +63,7 @@ export default { : this.config.fetchAuthors(searchTerm); fetchPromise - .then(res => { + .then((res) => { // We'd want to avoid doing this check but // users.json and /groups/:id/members & /projects/:id/users // return response differently. diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/branch_token.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/branch_token.vue index c18bdfc5c20..694dcd95b5e 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/branch_token.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/branch_token.vue @@ -43,7 +43,7 @@ export default { return this.value.data.toLowerCase(); }, activeBranch() { - return this.branches.find(branch => branch.name.toLowerCase() === this.currentValue); + return this.branches.find((branch) => branch.name.toLowerCase() === this.currentValue); }, }, watch: { diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/label_token.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/label_token.vue index 7a9c5c277eb..d59e9200e6c 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/label_token.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/label_token.vue @@ -47,7 +47,7 @@ export default { }, activeLabel() { return this.labels.find( - label => label.title.toLowerCase() === stripQuotes(this.currentValue), + (label) => label.title.toLowerCase() === stripQuotes(this.currentValue), ); }, containerStyle() { @@ -74,7 +74,7 @@ export default { this.loading = true; this.config .fetchLabels(searchTerm) - .then(res => { + .then((res) => { // We'd want to avoid doing this check but // labels.json and /groups/:id/labels & /projects/:id/labels // return response differently. diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue index c24df5e081d..0dd7820073a 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue @@ -43,7 +43,7 @@ export default { }, activeMilestone() { return this.milestones.find( - milestone => milestone.title.toLowerCase() === stripQuotes(this.currentValue), + (milestone) => milestone.title.toLowerCase() === stripQuotes(this.currentValue), ); }, }, diff --git a/app/assets/javascripts/vue_shared/components/gfm_autocomplete/gfm_autocomplete.vue b/app/assets/javascripts/vue_shared/components/gfm_autocomplete/gfm_autocomplete.vue index 02d89175ceb..9ab91e567e6 100644 --- a/app/assets/javascripts/vue_shared/components/gfm_autocomplete/gfm_autocomplete.vue +++ b/app/assets/javascripts/vue_shared/components/gfm_autocomplete/gfm_autocomplete.vue @@ -28,7 +28,7 @@ export default { }, computed: { config() { - return this.autocompleteTypes.map(type => ({ + return this.autocompleteTypes.map((type) => ({ ...tributeConfig[type].config, loadingItemTemplate: `<span class="gl-spinner gl-vertical-align-text-bottom gl-ml-3 gl-mr-2"></span>${__( 'Loading', @@ -56,7 +56,7 @@ export default { if (!this.assignees || !isAssigneesLengthSame) { this.assignees = - SidebarMediator.singleton?.store?.assignees?.map(assignee => assignee.username) || []; + SidebarMediator.singleton?.store?.assignees?.map((assignee) => assignee.username) || []; } }, filterValues(type) { @@ -88,7 +88,7 @@ export default { } else if (this.dataSources[type]) { axios .get(this.dataSources[type]) - .then(response => { + .then((response) => { this.cache[type] = response.data; processValues(this.filterValues(type)); }) diff --git a/app/assets/javascripts/vue_shared/components/gfm_autocomplete/utils.js b/app/assets/javascripts/vue_shared/components/gfm_autocomplete/utils.js index df9228718ca..4949a73d372 100644 --- a/app/assets/javascripts/vue_shared/components/gfm_autocomplete/utils.js +++ b/app/assets/javascripts/vue_shared/components/gfm_autocomplete/utils.js @@ -27,7 +27,7 @@ export const tributeConfig = { [GfmAutocompleteType.Emojis]: { config: { trigger: ':', - lookup: value => value, + lookup: (value) => value, menuItemTemplate: ({ original }) => `${original} ${Emoji.glEmojiTag(original)}`, selectTemplate: ({ original }) => `:${original}:`, }, @@ -36,7 +36,7 @@ export const tributeConfig = { [GfmAutocompleteType.Issues]: { config: { trigger: '#', - lookup: value => `${value.iid}${value.title}`, + lookup: (value) => `${value.iid}${value.title}`, menuItemTemplate: ({ original }) => `<small>${original.reference || original.iid}</small> ${escape(original.title)}`, selectTemplate: ({ original }) => original.reference || `#${original.iid}`, @@ -57,11 +57,11 @@ export const tributeConfig = { }, filterValues({ collection, fullText, selectionStart }) { if (doesCurrentLineStartWith('/label', fullText, selectionStart)) { - return collection.filter(label => !label.set); + return collection.filter((label) => !label.set); } if (doesCurrentLineStartWith('/unlabel', fullText, selectionStart)) { - return collection.filter(label => label.set); + return collection.filter((label) => label.set); } return collection; @@ -72,7 +72,7 @@ export const tributeConfig = { config: { trigger: '@', fillAttr: 'username', - lookup: value => + lookup: (value) => value.type === groupType ? last(value.name.split(' / ')) : `${value.name}${value.username}`, menuItemTemplate: ({ original }) => { const commonClasses = 'gl-avatar gl-avatar-s24 gl-flex-shrink-0'; @@ -113,11 +113,11 @@ export const tributeConfig = { }, filterValues({ assignees, collection, fullText, selectionStart }) { if (doesCurrentLineStartWith('/assign', fullText, selectionStart)) { - return collection.filter(member => !assignees.includes(member.username)); + return collection.filter((member) => !assignees.includes(member.username)); } if (doesCurrentLineStartWith('/unassign', fullText, selectionStart)) { - return collection.filter(member => assignees.includes(member.username)); + return collection.filter((member) => assignees.includes(member.username)); } return collection; @@ -127,7 +127,7 @@ export const tributeConfig = { [GfmAutocompleteType.MergeRequests]: { config: { trigger: '!', - lookup: value => `${value.iid}${value.title}`, + lookup: (value) => `${value.iid}${value.title}`, menuItemTemplate: ({ original }) => `<small>${original.reference || original.iid}</small> ${escape(original.title)}`, selectTemplate: ({ original }) => original.reference || `!${original.iid}`, @@ -147,7 +147,7 @@ export const tributeConfig = { config: { trigger: '/', fillAttr: 'name', - lookup: value => `${value.name}${value.aliases.join()}`, + lookup: (value) => `${value.name}${value.aliases.join()}`, menuItemTemplate: ({ original }) => { const aliases = original.aliases.length ? `<small>(or /${original.aliases.join(', /')})</small>` @@ -175,7 +175,7 @@ export const tributeConfig = { config: { trigger: '$', fillAttr: 'id', - lookup: value => `${value.id}${value.title}`, + lookup: (value) => `${value.id}${value.title}`, menuItemTemplate: ({ original }) => `<small>${original.id}</small> ${escape(original.title)}`, }, }, diff --git a/app/assets/javascripts/vue_shared/components/lib/utils/diff_utils.js b/app/assets/javascripts/vue_shared/components/lib/utils/diff_utils.js index 221c4f5b8a8..0a6b50674f0 100644 --- a/app/assets/javascripts/vue_shared/components/lib/utils/diff_utils.js +++ b/app/assets/javascripts/vue_shared/components/lib/utils/diff_utils.js @@ -15,5 +15,5 @@ function cleanSuggestionLine(line = {}) { } export function selectDiffLines(lines) { - return lines.filter(line => line.type !== 'match').map(line => cleanSuggestionLine(line)); + return lines.filter((line) => line.type !== 'match').map((line) => cleanSuggestionLine(line)); } diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue index d977a034002..b6e167524aa 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/field.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue @@ -158,7 +158,7 @@ export default { const mediaInPreview = this.$refs['markdown-preview'].querySelectorAll('video, audio'); if (mediaInPreview) { - mediaInPreview.forEach(media => { + mediaInPreview.forEach((media) => { media.pause(); }); } @@ -199,7 +199,7 @@ export default { this.markdownPreview = __('Loading…'); axios .post(this.markdownPreviewPath, { text: this.textareaValue }) - .then(response => this.renderMarkdown(response.data)) + .then((response) => this.renderMarkdown(response.data)) .catch(() => new Flash(__('Error loading markdown preview'))); } else { this.renderMarkdown(); diff --git a/app/assets/javascripts/vue_shared/components/markdown/header.vue b/app/assets/javascripts/vue_shared/components/markdown/header.vue index d0a0560846a..173d192dab0 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/header.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/header.vue @@ -110,7 +110,7 @@ export default { const area = this.$el.parentNode.querySelector('textarea'); CopyAsGFM.nodeToGFM(transformed) - .then(gfm => { + .then((gfm) => { CopyAsGFM.insertPastedText(area, documentFragment.textContent, CopyAsGFM.quoted(gfm)); }) .catch(() => {}); diff --git a/app/assets/javascripts/vue_shared/components/markdown/suggestions.vue b/app/assets/javascripts/vue_shared/components/markdown/suggestions.vue index 927a93487e6..a1b3b9c2eba 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/suggestions.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/suggestions.vue @@ -98,11 +98,11 @@ export default { this.$emit('applyBatch', { flashContainer: this.$el }); }); - suggestionDiff.$on('addToBatch', suggestionId => { + suggestionDiff.$on('addToBatch', (suggestionId) => { this.$emit('addToBatch', suggestionId); }); - suggestionDiff.$on('removeFromBatch', suggestionId => { + suggestionDiff.$on('removeFromBatch', (suggestionId) => { this.$emit('removeFromBatch', suggestionId); }); diff --git a/app/assets/javascripts/vue_shared/components/modal_copy_button.vue b/app/assets/javascripts/vue_shared/components/modal_copy_button.vue index de9c84dd157..6b251c6c125 100644 --- a/app/assets/javascripts/vue_shared/components/modal_copy_button.vue +++ b/app/assets/javascripts/vue_shared/components/modal_copy_button.vue @@ -70,14 +70,14 @@ export default { document.body, }); this.clipboard - .on('success', e => { + .on('success', (e) => { this.$root.$emit('bv::hide::tooltip', this.id); this.$emit('success', e); // Clear the selection and blur the trigger so it loses its border e.clearSelection(); e.trigger.blur(); }) - .on('error', e => this.$emit('error', e)); + .on('error', (e) => this.$emit('error', e)); }); }, destroyed() { diff --git a/app/assets/javascripts/vue_shared/components/ordered_layout.vue b/app/assets/javascripts/vue_shared/components/ordered_layout.vue index 117e79ca39f..a57ff10de71 100644 --- a/app/assets/javascripts/vue_shared/components/ordered_layout.vue +++ b/app/assets/javascripts/vue_shared/components/ordered_layout.vue @@ -4,7 +4,7 @@ export default { render(h, context) { const { slotKeys } = context.props; const slots = context.slots(); - const children = slotKeys.map(key => slots[key]).filter(x => x); + const children = slotKeys.map((key) => slots[key]).filter((x) => x); return children; }, diff --git a/app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs.vue b/app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs.vue index 1fc39c7cb8e..d03987bbbe0 100644 --- a/app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs.vue +++ b/app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs.vue @@ -203,7 +203,7 @@ export default { this.resetPagination(); const filterParams = { authorUsername: '', assigneeUsername: '', search: '' }; - filters.forEach(filter => { + filters.forEach((filter) => { if (typeof filter === 'object') { switch (filter.type) { case 'author_username': diff --git a/app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/utils.js b/app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/utils.js index 7de4263acbb..7855c7ea6cb 100644 --- a/app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/utils.js +++ b/app/assets/javascripts/vue_shared/components/paginated_table_with_search_and_tabs/utils.js @@ -6,6 +6,6 @@ import { __ } from '~/locale'; * @param {String} value * @returns {String} */ -export const isAny = value => { +export const isAny = (value) => { return value === __('Any') ? '' : value; }; diff --git a/app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue b/app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue index 154671fe9fa..65bd4e4382d 100644 --- a/app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue +++ b/app/assets/javascripts/vue_shared/components/project_selector/project_list_item.vue @@ -13,7 +13,7 @@ export default { project: { type: Object, required: true, - validator: p => + validator: (p) => (Number.isFinite(p.id) || isString(p.id)) && isString(p.name) && (isString(p.name_with_namespace) || isString(p.nameWithNamespace)), diff --git a/app/assets/javascripts/vue_shared/components/registry/list_item.vue b/app/assets/javascripts/vue_shared/components/registry/list_item.vue index 7046ac5be03..8965dba3e83 100644 --- a/app/assets/javascripts/vue_shared/components/registry/list_item.vue +++ b/app/assets/javascripts/vue_shared/components/registry/list_item.vue @@ -39,7 +39,7 @@ export default { }, }, mounted() { - this.detailsSlots = Object.keys(this.$slots).filter(k => k.startsWith('details-')); + this.detailsSlots = Object.keys(this.$slots).filter((k) => k.startsWith('details-')); }, methods: { toggleDetails() { diff --git a/app/assets/javascripts/vue_shared/components/registry/title_area.vue b/app/assets/javascripts/vue_shared/components/registry/title_area.vue index bb9fe472138..afe114517b5 100644 --- a/app/assets/javascripts/vue_shared/components/registry/title_area.vue +++ b/app/assets/javascripts/vue_shared/components/registry/title_area.vue @@ -38,11 +38,11 @@ export default { }, async mounted() { const METADATA_PREFIX = 'metadata-'; - this.metadataSlots = Object.keys(this.$slots).filter(k => k.startsWith(METADATA_PREFIX)); + this.metadataSlots = Object.keys(this.$slots).filter((k) => k.startsWith(METADATA_PREFIX)); // we need to wait for next tick to ensure that dynamic names slots are picked up await this.$nextTick(); - this.metadataSlots = Object.keys(this.$slots).filter(k => k.startsWith(METADATA_PREFIX)); + this.metadataSlots = Object.keys(this.$slots).filter((k) => k.startsWith(METADATA_PREFIX)); }, }; </script> diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/rich_content_editor.vue b/app/assets/javascripts/vue_shared/components/rich_content_editor/rich_content_editor.vue index fe50a459e52..5d4c192c78f 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/rich_content_editor.vue +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/rich_content_editor.vue @@ -20,7 +20,7 @@ export default { components: { ToastEditor: () => import(/* webpackChunkName: 'toast_editor' */ '@toast-ui/vue-editor').then( - toast => toast.Editor, + (toast) => toast.Editor, ), AddImageModal, InsertVideoModal, diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_custom_renderer.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_custom_renderer.js index 108c60c3edb..624b5b09b38 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_custom_renderer.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_custom_renderer.js @@ -17,12 +17,12 @@ const listItemRenderers = [renderListItem]; const softbreakRenderers = [renderSoftbreak]; const executeRenderer = (renderers, node, context) => { - const availableRenderer = renderers.find(renderer => renderer.canRender(node, context)); + const availableRenderer = renderers.find((renderer) => renderer.canRender(node, context)); return availableRenderer ? availableRenderer.render(node, context) : context.origin(); }; -const buildCustomHTMLRenderer = customRenderers => { +const buildCustomHTMLRenderer = (customRenderers) => { const renderersByType = { ...customRenderers, htmlBlock: union(htmlBlockRenderers, customRenderers?.htmlBlock), @@ -34,7 +34,7 @@ const buildCustomHTMLRenderer = customRenderers => { softbreak: union(softbreakRenderers, customRenderers?.softbreak), }; - return mapValues(renderersByType, renderers => { + return mapValues(renderersByType, (renderers) => { return (node, context) => executeRenderer(renderers, node, context); }); }; diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer.js index 9744e25a8e1..273e0a59963 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer.js @@ -9,7 +9,7 @@ const DEFAULTS = { emphasis: '_', }; -const countIndentSpaces = text => { +const countIndentSpaces = (text) => { const matches = text.match(/^\s+/m); return matches ? matches[0].length : 0; @@ -52,7 +52,7 @@ const buildHTMLToMarkdownRender = (baseRenderer, formattingPreferences = {}) => const firstLevelIndentSpacesCount = countIndentSpaces(baseResult) || 1; const reindentedList = baseResult .split('\n') - .map(line => { + .map((line) => { const itemIndentSpacesCount = countIndentSpaces(line); const nestingLevel = Math.ceil(itemIndentSpacesCount / firstLevelIndentSpacesCount); const indentSpaces = repeat(' ', subListIndentSpaces * nestingLevel); diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/editor_service.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/editor_service.js index 463e64b4936..be78651d38d 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/editor_service.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/editor_service.js @@ -6,7 +6,7 @@ import buildCustomHTMLRenderer from './build_custom_renderer'; import { TOOLBAR_ITEM_CONFIGS, VIDEO_ATTRIBUTES } from '../constants'; import sanitizeHTML from './sanitize_html'; -const buildWrapper = propsData => { +const buildWrapper = (propsData) => { const instance = new Vue({ render(createElement) { return createElement(ToolbarItem, propsData); @@ -17,7 +17,7 @@ const buildWrapper = propsData => { return instance.$el; }; -const buildVideoIframe = src => { +const buildVideoIframe = (src) => { const wrapper = document.createElement('figure'); const iframe = document.createElement('iframe'); const videoAttributes = { ...VIDEO_ATTRIBUTES, src }; @@ -48,7 +48,7 @@ const buildImg = (alt, originalSrc, file) => { return img; }; -export const generateToolbarItem = config => { +export const generateToolbarItem = (config) => { const { icon, classes, event, command, tooltip, isDivider } = config; if (isDivider) { @@ -92,14 +92,14 @@ export const insertVideo = ({ editor }, url) => { } }; -export const getMarkdown = editorInstance => editorInstance.invoke('getMarkdown'); +export const getMarkdown = (editorInstance) => editorInstance.invoke('getMarkdown'); /** * This function allow us to extend Toast UI HTML to Markdown renderer. It is * a temporary measure because Toast UI does not provide an API * to achieve this goal. */ -export const registerHTMLToMarkdownRenderer = editorApi => { +export const registerHTMLToMarkdownRenderer = (editorApi) => { const { renderer } = editorApi.toMarkOptions; Object.assign(editorApi.toMarkOptions, { @@ -107,10 +107,10 @@ export const registerHTMLToMarkdownRenderer = editorApi => { }); }; -export const getEditorOptions = externalOptions => { +export const getEditorOptions = (externalOptions) => { return defaults({ customHTMLRenderer: buildCustomHTMLRenderer(externalOptions?.customRenderers), - toolbarItems: TOOLBAR_ITEM_CONFIGS.map(toolbarItem => generateToolbarItem(toolbarItem)), - customHTMLSanitizer: html => sanitizeHTML(html), + toolbarItems: TOOLBAR_ITEM_CONFIGS.map((toolbarItem) => generateToolbarItem(toolbarItem)), + customHTMLSanitizer: (html) => sanitizeHTML(html), }); }; diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token.js index 1dcecd5fb8c..638e5fd6f60 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token.js @@ -32,20 +32,20 @@ export const buildUneditableCloseTokens = (token, tagType = TAG_TYPES.block) => // Complete helpers (open plus close) -export const buildTextToken = content => buildToken('text', null, { content }); +export const buildTextToken = (content) => buildToken('text', null, { content }); -export const buildUneditableBlockTokens = token => { +export const buildUneditableBlockTokens = (token) => { return [...buildUneditableOpenTokens(token), buildUneditableCloseToken()]; }; -export const buildUneditableInlineTokens = token => { +export const buildUneditableInlineTokens = (token) => { return [ ...buildUneditableOpenTokens(token, TAG_TYPES.inline), buildUneditableCloseToken(TAG_TYPES.inline), ]; }; -export const buildUneditableHtmlAsTextTokens = node => { +export const buildUneditableHtmlAsTextTokens = (node) => { /* Toast UI internally appends ' data-tomark-pass ' attribute flags so it can target certain nested nodes for internal use during Markdown <=> WYSIWYG conversions. In our case, we want diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_html_block.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_html_block.js index 18bd17d43d9..30012c1123f 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_html_block.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_html_block.js @@ -2,7 +2,7 @@ import { buildUneditableHtmlAsTextTokens } from './build_uneditable_token'; import { ALLOWED_VIDEO_ORIGINS } from '../../constants'; import { getURLOrigin } from '~/lib/utils/url_utility'; -const isVideoFrame = html => { +const isVideoFrame = (html) => { const parser = new DOMParser(); const doc = parser.parseFromString(html, 'text/html'); const { @@ -18,6 +18,6 @@ const canRender = ({ type, literal }) => { return type === 'htmlBlock' && !isVideoFrame(literal); }; -const render = node => buildUneditableHtmlAsTextTokens(node); +const render = (node) => buildUneditableHtmlAsTextTokens(node); export default { canRender, render }; diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text.js index a9c3dfcd728..d7716543b53 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text.js @@ -17,7 +17,7 @@ Regexp notes: */ const identifierInstanceRegex = /((?:\[.+?\]){1}(?:\[\]|\[.+?\])?(?!:))/g; -const isIdentifierInstance = literal => { +const isIdentifierInstance = (literal) => { // Reset lastIndex as global flag in regexp are stateful (https://stackoverflow.com/a/11477448) identifierInstanceRegex.lastIndex = 0; return identifierInstanceRegex.test(literal); @@ -25,9 +25,9 @@ const isIdentifierInstance = literal => { const canRender = ({ literal }) => isIdentifierInstance(literal); -const tokenize = text => { +const tokenize = (text) => { const matches = text.split(identifierInstanceRegex); - const tokens = matches.map(match => { + const tokens = matches.map((match) => { const token = buildTextToken(match); return isIdentifierInstance(match) ? buildUneditableInlineTokens(token) : token; }); diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph.js index 3f9c6291d1b..4829f0f2243 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph.js @@ -1,6 +1,6 @@ const identifierRegex = /(^\[.+\]: .+)/; -const isIdentifier = text => { +const isIdentifier = (text) => { return identifierRegex.test(text); }; diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_softbreak.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_softbreak.js index 389ade5f27a..c004e839821 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_softbreak.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_softbreak.js @@ -1,4 +1,4 @@ -const canRender = node => ['emph', 'strong'].includes(node.parent?.type); +const canRender = (node) => ['emph', 'strong'].includes(node.parent?.type); const render = () => ({ type: 'text', content: ' ', diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_utils.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_utils.js index 4cba2c70486..eff5dbf59f2 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_utils.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/renderers/render_utils.js @@ -11,9 +11,9 @@ export const renderUneditableBranch = (_, { entering, origin }) => const attributeDefinitionRegexp = /(^{:.+}$)/; -export const isAttributeDefinition = text => attributeDefinitionRegexp.test(text); +export const isAttributeDefinition = (text) => attributeDefinitionRegexp.test(text); -const findAttributeDefinition = node => { +const findAttributeDefinition = (node) => { const literal = node?.next?.firstChild?.literal || node?.firstChild?.firstChild?.next?.next?.literal; // for headings // for list items; diff --git a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/sanitize_html.js b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/sanitize_html.js index eae2e0335c1..cb0f1d51cb1 100644 --- a/app/assets/javascripts/vue_shared/components/rich_content_editor/services/sanitize_html.js +++ b/app/assets/javascripts/vue_shared/components/rich_content_editor/services/sanitize_html.js @@ -5,7 +5,7 @@ import { getURLOrigin } from '~/lib/utils/url_utility'; const sanitizer = createSanitizer(window); const ADD_TAGS = ['iframe']; -sanitizer.addHook('uponSanitizeElement', node => { +sanitizer.addHook('uponSanitizeElement', (node) => { if (node.tagName !== 'IFRAME') { return; } @@ -17,6 +17,6 @@ sanitizer.addHook('uponSanitizeElement', node => { } }); -const sanitize = content => sanitizer.sanitize(content, { ADD_TAGS }); +const sanitize = (content) => sanitizer.sanitize(content, { ADD_TAGS }); export default sanitize; diff --git a/app/assets/javascripts/vue_shared/components/select2_select.vue b/app/assets/javascripts/vue_shared/components/select2_select.vue index 3dbf0ccdfa9..6574a5ddfde 100644 --- a/app/assets/javascripts/vue_shared/components/select2_select.vue +++ b/app/assets/javascripts/vue_shared/components/select2_select.vue @@ -26,7 +26,7 @@ export default { $(this.$refs.dropdownInput) .val(this.value) .select2(this.options) - .on('change', event => this.$emit('input', event.target.value)); + .on('change', (event) => this.$emit('input', event.target.value)); }) .catch(() => {}); }, diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label.vue index 434aabc3df9..795f16f4efc 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_create_label.vue @@ -18,7 +18,7 @@ export default { }, created() { const rawLabelsColors = gon.suggested_label_colors; - this.suggestedColors = Object.keys(rawLabelsColors).map(colorCode => ({ + this.suggestedColors = Object.keys(rawLabelsColors).map((colorCode) => ({ colorCode, title: rawLabelsColors[colorCode], })); diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed.vue index 973cc314ee3..122250d1ce7 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed.vue @@ -20,7 +20,7 @@ export default { const labelsString = this.labels.length ? this.labels .slice(0, 5) - .map(label => label.title) + .map((label) => label.title) .join(', ') : s__('LabelSelect|Labels'); diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue index 55e2fb68275..41308e352e3 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue @@ -25,7 +25,7 @@ export default { }, suggestedColors() { const colorsMap = gon.suggested_label_colors; - return Object.keys(colorsMap).map(color => ({ [color]: colorsMap[color] })); + return Object.keys(colorsMap).map((color) => ({ [color]: colorsMap[color] })); }, }, methods: { diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue index 8ce624aa303..683889b8611 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue @@ -182,9 +182,9 @@ export default { !state.showDropdownButton && !state.showDropdownContents ) { - let filterFn = label => label.touched; + let filterFn = (label) => label.touched; if (this.isDropdownVariantEmbedded) { - filterFn = label => label.set; + filterFn = (label) => label.set; } this.handleDropdownClose(state.labels.filter(filterFn)); } @@ -204,13 +204,13 @@ export default { 'js-btn-cancel-create', 'js-sidebar-dropdown-toggle', ].some( - className => + (className) => target?.classList.contains(className) || target?.parentElement?.classList.contains(className), ); const hadExceptionParent = ['.js-btn-back', '.js-labels-list'].some( - className => $(target).parents(className).length, + (className) => $(target).parents(className).length, ); if ( diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/getters.js b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/getters.js index 5a30e29cad3..d14f96720b7 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/getters.js +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/getters.js @@ -9,7 +9,7 @@ import { DropdownVariant } from '../constants'; */ export const dropdownButtonText = (state, getters) => { const selectedLabels = getters.isDropdownVariantSidebar - ? state.labels.filter(label => label.set) + ? state.labels.filter((label) => label.set) : state.selectedLabels; if (!selectedLabels.length) { @@ -28,25 +28,25 @@ export const dropdownButtonText = (state, getters) => { * selectedLabels array. * @param {object} state */ -export const selectedLabelsList = state => state.selectedLabels.map(label => label.id); +export const selectedLabelsList = (state) => state.selectedLabels.map((label) => label.id); /** * Returns boolean representing whether dropdown variant * is `sidebar` * @param {object} state */ -export const isDropdownVariantSidebar = state => state.variant === DropdownVariant.Sidebar; +export const isDropdownVariantSidebar = (state) => state.variant === DropdownVariant.Sidebar; /** * Returns boolean representing whether dropdown variant * is `standalone` * @param {object} state */ -export const isDropdownVariantStandalone = state => state.variant === DropdownVariant.Standalone; +export const isDropdownVariantStandalone = (state) => state.variant === DropdownVariant.Standalone; /** * Returns boolean representing whether dropdown variant * is `embedded` * @param {object} state */ -export const isDropdownVariantEmbedded = state => state.variant === DropdownVariant.Embedded; +export const isDropdownVariantEmbedded = (state) => state.variant === DropdownVariant.Embedded; diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js index 54f8c78b4e1..6de436ffd13 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js @@ -33,7 +33,7 @@ export default { // Iterate over every label and add a `set` prop // to determine whether it is already a part of // selectedLabels array. - const selectedLabelIds = state.selectedLabels.map(label => label.id); + const selectedLabelIds = state.selectedLabels.map((label) => label.id); state.labelsFetchInProgress = false; state.labels = labels.reduce((allLabels, label) => { allLabels.push({ @@ -61,7 +61,7 @@ export default { // Find the label to update from all the labels // and change `set` prop value to represent their current state. const labelId = labels.pop()?.id; - const candidateLabel = state.labels.find(label => labelId === label.id); + const candidateLabel = state.labels.find((label) => labelId === label.id); if (candidateLabel) { candidateLabel.touched = true; candidateLabel.set = !candidateLabel.set; diff --git a/app/assets/javascripts/vue_shared/components/split_button.vue b/app/assets/javascripts/vue_shared/components/split_button.vue index 11049028ff6..61b317d0d1d 100644 --- a/app/assets/javascripts/vue_shared/components/split_button.vue +++ b/app/assets/javascripts/vue_shared/components/split_button.vue @@ -2,7 +2,7 @@ import { isString } from 'lodash'; import { GlDropdown, GlDropdownDivider, GlDropdownItem } from '@gitlab/ui'; -const isValidItem = item => +const isValidItem = (item) => isString(item.eventName) && isString(item.title) && isString(item.description); export default { diff --git a/app/assets/javascripts/vue_shared/components/tabs/tabs.js b/app/assets/javascripts/vue_shared/components/tabs/tabs.js index 9b9e4bb47bd..233df96a520 100644 --- a/app/assets/javascripts/vue_shared/components/tabs/tabs.js +++ b/app/assets/javascripts/vue_shared/components/tabs/tabs.js @@ -17,8 +17,8 @@ export default { }, methods: { updateTabs() { - this.tabs = this.$children.filter(child => child.isTab); - this.currentIndex = this.tabs.findIndex(tab => tab.localActive); + this.tabs = this.$children.filter((child) => child.isTab); + this.currentIndex = this.tabs.findIndex((tab) => tab.localActive); }, setTab(e, index) { if (this.stopPropagation) { @@ -48,7 +48,7 @@ export default { href: '#', }, on: { - click: e => this.setTab(e, i), + click: (e) => this.setTab(e, i), }, }, tab.$slots.title || tab.title, diff --git a/app/assets/javascripts/vue_shared/components/timezone_dropdown.vue b/app/assets/javascripts/vue_shared/components/timezone_dropdown.vue index 3fa8efcd145..f1db26ff4fc 100644 --- a/app/assets/javascripts/vue_shared/components/timezone_dropdown.vue +++ b/app/assets/javascripts/vue_shared/components/timezone_dropdown.vue @@ -36,14 +36,14 @@ export default { }, computed: { timezones() { - return this.timezoneData.map(timezone => ({ + return this.timezoneData.map((timezone) => ({ formattedTimezone: this.formatTimezone(timezone), identifier: timezone.identifier, })); }, filteredResults() { const lowerCasedSearchTerm = this.searchTerm.toLowerCase(); - return this.timezones.filter(timezone => + return this.timezones.filter((timezone) => timezone.formattedTimezone.toLowerCase().includes(lowerCasedSearchTerm), ); }, diff --git a/app/assets/javascripts/vue_shared/components/web_ide_link.vue b/app/assets/javascripts/vue_shared/components/web_ide_link.vue index dbb1a075e76..c957876f8ab 100644 --- a/app/assets/javascripts/vue_shared/components/web_ide_link.vue +++ b/app/assets/javascripts/vue_shared/components/web_ide_link.vue @@ -72,7 +72,7 @@ export default { }, computed: { actions() { - return [this.webIdeAction, this.editAction, this.gitpodAction].filter(action => action); + return [this.webIdeAction, this.editAction, this.gitpodAction].filter((action) => action); }, editAction() { if (!this.showEditButton) { diff --git a/app/assets/javascripts/vue_shared/directives/autofocusonshow.js b/app/assets/javascripts/vue_shared/directives/autofocusonshow.js index 4659ec20ceb..1be4612a7e4 100644 --- a/app/assets/javascripts/vue_shared/directives/autofocusonshow.js +++ b/app/assets/javascripts/vue_shared/directives/autofocusonshow.js @@ -11,8 +11,8 @@ export default { inserted(el) { if ('IntersectionObserver' in window) { // Element visibility is dynamic, so we attach observer - el.visibilityObserver = new IntersectionObserver(entries => { - entries.forEach(entry => { + el.visibilityObserver = new IntersectionObserver((entries) => { + entries.forEach((entry) => { // Combining `intersectionRatio > 0` and // element's `offsetParent` presence will // deteremine if element is truely visible diff --git a/app/assets/javascripts/vue_shared/directives/validation.js b/app/assets/javascripts/vue_shared/directives/validation.js index 772c4b3a082..ece09df272c 100644 --- a/app/assets/javascripts/vue_shared/directives/validation.js +++ b/app/assets/javascripts/vue_shared/directives/validation.js @@ -12,19 +12,19 @@ import { s__ } from '~/locale'; */ const defaultFeedbackMap = { valueMissing: { - isInvalid: el => el.validity?.valueMissing, + isInvalid: (el) => el.validity?.valueMissing, message: s__('Please fill out this field.'), }, urlTypeMismatch: { - isInvalid: el => el.type === 'url' && el.validity?.typeMismatch, + isInvalid: (el) => el.type === 'url' && el.validity?.typeMismatch, message: s__('Please enter a valid URL format, ex: http://www.example.com/home'), }, }; const getFeedbackForElement = (feedbackMap, el) => - Object.values(feedbackMap).find(f => f.isInvalid(el))?.message || el.validationMessage; + Object.values(feedbackMap).find((f) => f.isInvalid(el))?.message || el.validationMessage; -const focusFirstInvalidInput = e => { +const focusFirstInvalidInput = (e) => { const { target: formEl } = e; const invalidInput = formEl.querySelector('input:invalid'); @@ -33,7 +33,7 @@ const focusFirstInvalidInput = e => { } }; -const isEveryFieldValid = form => Object.values(form.fields).every(({ state }) => state === true); +const isEveryFieldValid = (form) => Object.values(form.fields).every(({ state }) => state === true); const createValidator = (context, feedbackMap) => ({ el, reportInvalidInput = false }) => { const { form } = context; diff --git a/app/assets/javascripts/vue_shared/gl_feature_flags_plugin.js b/app/assets/javascripts/vue_shared/gl_feature_flags_plugin.js index 3488a44bd0f..e1734809bce 100644 --- a/app/assets/javascripts/vue_shared/gl_feature_flags_plugin.js +++ b/app/assets/javascripts/vue_shared/gl_feature_flags_plugin.js @@ -1,4 +1,4 @@ -export default Vue => { +export default (Vue) => { Vue.mixin({ provide: { glFeatures: { ...((window.gon && window.gon.features) || {}) }, diff --git a/app/assets/javascripts/vue_shared/mixins/ci_pagination_api_mixin.js b/app/assets/javascripts/vue_shared/mixins/ci_pagination_api_mixin.js index cdbde55901d..be04ff158e7 100644 --- a/app/assets/javascripts/vue_shared/mixins/ci_pagination_api_mixin.js +++ b/app/assets/javascripts/vue_shared/mixins/ci_pagination_api_mixin.js @@ -48,7 +48,7 @@ export default { this.poll.stop(); const queryString = Object.keys(parameters) - .map(parameter => { + .map((parameter) => { const value = parameters[parameter]; // update internal state for UI this[parameter] = value; diff --git a/app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue b/app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue index bdbf9957ad4..a6c7b59aa71 100644 --- a/app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue +++ b/app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue @@ -97,7 +97,7 @@ export default { projectPath: this.targetProjectFullPath, iid: String(this.mrIid), reportTypes: this.$options.reportTypes.map( - reportType => reportTypeToSecurityReportTypeEnum[reportType], + (reportType) => reportTypeToSecurityReportTypeEnum[reportType], ), }; }, @@ -151,7 +151,7 @@ export default { created() { if (!this.canShowDownloads) { this.checkAvailableSecurityReports(this.$options.reportTypes) - .then(availableSecurityReports => { + .then((availableSecurityReports) => { this.onCheckingAvailableSecurityReports(Array.from(availableSecurityReports)); }) .catch(this.showError); diff --git a/app/assets/javascripts/vue_shared/security_reports/store/getters.js b/app/assets/javascripts/vue_shared/security_reports/store/getters.js index 1e5a60c32fd..443255b0e6a 100644 --- a/app/assets/javascripts/vue_shared/security_reports/store/getters.js +++ b/app/assets/javascripts/vue_shared/security_reports/store/getters.js @@ -3,7 +3,7 @@ import { countVulnerabilities, groupedTextBuilder } from './utils'; import { LOADING, ERROR, SUCCESS } from '~/reports/constants'; import { TRANSLATION_IS_LOADING } from './messages'; -export const summaryCounts = state => +export const summaryCounts = (state) => countVulnerabilities( state.reportTypes.reduce((acc, reportType) => { acc.push(...state[reportType].newIssues); @@ -50,17 +50,17 @@ export const summaryStatus = (state, getters) => { return SUCCESS; }; -export const areReportsLoading = state => - state.reportTypes.some(reportType => state[reportType].isLoading); +export const areReportsLoading = (state) => + state.reportTypes.some((reportType) => state[reportType].isLoading); -export const areAllReportsLoading = state => - state.reportTypes.every(reportType => state[reportType].isLoading); +export const areAllReportsLoading = (state) => + state.reportTypes.every((reportType) => state[reportType].isLoading); -export const allReportsHaveError = state => - state.reportTypes.every(reportType => state[reportType].hasError); +export const allReportsHaveError = (state) => + state.reportTypes.every((reportType) => state[reportType].hasError); -export const anyReportHasError = state => - state.reportTypes.some(reportType => state[reportType].hasError); +export const anyReportHasError = (state) => + state.reportTypes.some((reportType) => state[reportType].hasError); -export const anyReportHasIssues = state => - state.reportTypes.some(reportType => state[reportType].newIssues.length > 0); +export const anyReportHasIssues = (state) => + state.reportTypes.some((reportType) => state[reportType].newIssues.length > 0); diff --git a/app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js b/app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js index 22a45341c51..0f26e3c30ef 100644 --- a/app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js +++ b/app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js @@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => { dispatch('requestDiff'); return fetchDiffData(rootState, state.paths.diffEndpoint, 'sast') - .then(data => { + .then((data) => { dispatch('receiveDiffSuccess', data); }) .catch(() => { diff --git a/app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js b/app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js index c9da824613d..e3ae5435f5d 100644 --- a/app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js +++ b/app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js @@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => { dispatch('requestDiff'); return fetchDiffData(rootState, state.paths.diffEndpoint, 'secret_detection') - .then(data => { + .then((data) => { dispatch('receiveDiffSuccess', data); }) .catch(() => { diff --git a/app/assets/javascripts/vue_shared/security_reports/store/utils.js b/app/assets/javascripts/vue_shared/security_reports/store/utils.js index c5e786c92b1..fd6613ae11c 100644 --- a/app/assets/javascripts/vue_shared/security_reports/store/utils.js +++ b/app/assets/javascripts/vue_shared/security_reports/store/utils.js @@ -29,7 +29,7 @@ export const fetchDiffData = (state, endpoint, category) => { */ export const enrichVulnerabilityWithFeedback = (vulnerability, feedback = []) => feedback - .filter(fb => fb.project_fingerprint === vulnerability.project_fingerprint) + .filter((fb) => fb.project_fingerprint === vulnerability.project_fingerprint) .reduce((vuln, fb) => { if (fb.feedback_type === FEEDBACK_TYPE_DISMISSAL) { return { @@ -63,7 +63,7 @@ export const enrichVulnerabilityWithFeedback = (vulnerability, feedback = []) => * @returns {Object} */ export const parseDiff = (diff, enrichData) => { - const enrichVulnerability = vulnerability => ({ + const enrichVulnerability = (vulnerability) => ({ ...enrichVulnerabilityWithFeedback(vulnerability, enrichData), category: vulnerability.report_type, title: vulnerability.message || vulnerability.name, diff --git a/app/assets/javascripts/vue_shared/translate.js b/app/assets/javascripts/vue_shared/translate.js index e0baf03acc3..616848639f1 100644 --- a/app/assets/javascripts/vue_shared/translate.js +++ b/app/assets/javascripts/vue_shared/translate.js @@ -1,6 +1,6 @@ import { __, n__, s__, sprintf } from '../locale'; -export default Vue => { +export default (Vue) => { Vue.mixin({ methods: { /** diff --git a/app/assets/javascripts/vuex_shared/bindings.js b/app/assets/javascripts/vuex_shared/bindings.js index cc18b41e2de..741690886b7 100644 --- a/app/assets/javascripts/vuex_shared/bindings.js +++ b/app/assets/javascripts/vuex_shared/bindings.js @@ -11,7 +11,7 @@ */ export const mapComputed = (list, defaultUpdateFn, root) => { const result = {}; - list.forEach(item => { + list.forEach((item) => { const [getter, key, updateFn] = typeof item === 'string' ? [false, item, defaultUpdateFn] diff --git a/app/assets/javascripts/whats_new/components/app.vue b/app/assets/javascripts/whats_new/components/app.vue index 854e6c52701..9fc60fa804f 100644 --- a/app/assets/javascripts/whats_new/components/app.vue +++ b/app/assets/javascripts/whats_new/components/app.vue @@ -71,7 +71,7 @@ export default { this.setDrawerBodyHeight(height); }, featuresForVersion(version) { - return this.features.filter(feature => { + return this.features.filter((feature) => { return feature.release === parseFloat(version); }); }, diff --git a/app/assets/javascripts/whats_new/index.js b/app/assets/javascripts/whats_new/index.js index ed0258c3992..6da141cb19a 100644 --- a/app/assets/javascripts/whats_new/index.js +++ b/app/assets/javascripts/whats_new/index.js @@ -6,7 +6,7 @@ import { getStorageKey, setNotification } from './utils/notification'; let whatsNewApp; -export default el => { +export default (el) => { if (whatsNewApp) { store.dispatch('openDrawer'); } else { diff --git a/app/assets/javascripts/whats_new/utils/get_drawer_body_height.js b/app/assets/javascripts/whats_new/utils/get_drawer_body_height.js index 21fc90c34a4..7d6c2392974 100644 --- a/app/assets/javascripts/whats_new/utils/get_drawer_body_height.js +++ b/app/assets/javascripts/whats_new/utils/get_drawer_body_height.js @@ -1,4 +1,4 @@ -export const getDrawerBodyHeight = drawer => { +export const getDrawerBodyHeight = (drawer) => { const drawerViewableHeight = drawer.clientHeight - drawer.getBoundingClientRect().top; const drawerHeaderHeight = drawer.querySelector('.gl-drawer-header').clientHeight; diff --git a/app/assets/javascripts/whats_new/utils/notification.js b/app/assets/javascripts/whats_new/utils/notification.js index f261a089554..52ca8058d1c 100644 --- a/app/assets/javascripts/whats_new/utils/notification.js +++ b/app/assets/javascripts/whats_new/utils/notification.js @@ -1,6 +1,6 @@ -export const getStorageKey = appEl => appEl.getAttribute('data-storage-key'); +export const getStorageKey = (appEl) => appEl.getAttribute('data-storage-key'); -export const setNotification = appEl => { +export const setNotification = (appEl) => { const storageKey = getStorageKey(appEl); const notificationEl = document.querySelector('.header-help'); let notificationCountEl = notificationEl.querySelector('.js-whats-new-notification-count'); diff --git a/app/assets/javascripts/zen_mode.js b/app/assets/javascripts/zen_mode.js index 260ee972783..3ee9a19e2d9 100644 --- a/app/assets/javascripts/zen_mode.js +++ b/app/assets/javascripts/zen_mode.js @@ -39,21 +39,21 @@ export default class ZenMode { constructor() { this.active_backdrop = null; this.active_textarea = null; - $(document).on('click', '.js-zen-enter', e => { + $(document).on('click', '.js-zen-enter', (e) => { e.preventDefault(); return $(e.currentTarget).trigger('zen_mode:enter'); }); - $(document).on('click', '.js-zen-leave', e => { + $(document).on('click', '.js-zen-leave', (e) => { e.preventDefault(); return $(e.currentTarget).trigger('zen_mode:leave'); }); - $(document).on('zen_mode:enter', e => { + $(document).on('zen_mode:enter', (e) => { this.enter($(e.target).closest('.md-area').find('.zen-backdrop')); }); $(document).on('zen_mode:leave', () => { this.exit(); }); - $(document).on('keydown', e => { + $(document).on('keydown', (e) => { // Esc if (e.keyCode === 27) { e.preventDefault(); diff --git a/app/graphql/types/container_repository_tag_type.rb b/app/graphql/types/container_repository_tag_type.rb index f293655c9e9..6de16416395 100644 --- a/app/graphql/types/container_repository_tag_type.rb +++ b/app/graphql/types/container_repository_tag_type.rb @@ -14,7 +14,7 @@ module Types field :digest, GraphQL::STRING_TYPE, null: true, description: 'Digest of the tag.' field :revision, GraphQL::STRING_TYPE, null: true, description: 'Revision of the tag.' field :short_revision, GraphQL::STRING_TYPE, null: true, description: 'Short revision of the tag.' - field :total_size, GraphQL::INT_TYPE, null: true, description: 'The size of the tag.' + field :total_size, GraphQL::Types::BigInt, null: true, description: 'The size of the tag.' field :created_at, Types::TimeType, null: true, description: 'Timestamp when the tag was created.' field :can_delete, GraphQL::BOOLEAN_TYPE, null: false, description: 'Can the current user delete this tag.' diff --git a/changelogs/unreleased/10io-fix-graphql-container-repository-tag-size-type.yml b/changelogs/unreleased/10io-fix-graphql-container-repository-tag-size-type.yml new file mode 100644 index 00000000000..5323ac46f9f --- /dev/null +++ b/changelogs/unreleased/10io-fix-graphql-container-repository-tag-size-type.yml @@ -0,0 +1,5 @@ +--- +title: Fix the graphQL type for container repository tags +merge_request: 50419 +author: +type: fixed diff --git a/changelogs/unreleased/294221-gitlab-pages-deployments-over-the-max-int-size-in-bytes-fail-to-up.yml b/changelogs/unreleased/294221-gitlab-pages-deployments-over-the-max-int-size-in-bytes-fail-to-up.yml new file mode 100644 index 00000000000..233d52f0df5 --- /dev/null +++ b/changelogs/unreleased/294221-gitlab-pages-deployments-over-the-max-int-size-in-bytes-fail-to-up.yml @@ -0,0 +1,5 @@ +--- +title: Change pages deployments size to bigint +merge_request: 50262 +author: +type: fixed diff --git a/config/helpers/is_eslint.js b/config/helpers/is_eslint.js index 55ec42e68c1..60528796962 100644 --- a/config/helpers/is_eslint.js +++ b/config/helpers/is_eslint.js @@ -1,7 +1,7 @@ /** * Returns true if the given module is required from eslint */ -const isESLint = mod => { +const isESLint = (mod) => { let parent = mod.parent; while (parent) { diff --git a/config/helpers/vendor_dll_hash.js b/config/helpers/vendor_dll_hash.js index ca7b564a07c..2df97e7b95d 100644 --- a/config/helpers/vendor_dll_hash.js +++ b/config/helpers/vendor_dll_hash.js @@ -9,9 +9,9 @@ const CACHE_PATHS = [ './yarn.lock', ]; -const resolvePath = file => path.resolve(__dirname, '../..', file); -const readFile = file => fs.readFileSync(file); -const fileHash = buffer => crypto.createHash('md5').update(buffer).digest('hex'); +const resolvePath = (file) => path.resolve(__dirname, '../..', file); +const readFile = (file) => fs.readFileSync(file); +const fileHash = (buffer) => crypto.createHash('md5').update(buffer).digest('hex'); module.exports = () => { const fileBuffers = CACHE_PATHS.map(resolvePath).map(readFile); diff --git a/config/karma.config.js b/config/karma.config.js index 23afc437608..1d65e65ce2a 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -71,13 +71,13 @@ const createContext = (specFiles, regex, suffix) => { if (specFilters.length) { // resolve filters - let filteredSpecFiles = specFilters.map(filter => + let filteredSpecFiles = specFilters.map((filter) => glob .sync(filter, { root: ROOT_PATH, matchBase: true, }) - .filter(path => path.endsWith('spec.js')), + .filter((path) => path.endsWith('spec.js')), ); // flatten @@ -92,14 +92,14 @@ if (specFilters.length) { exit('Your filter did not match any test files.', isError); } - if (!filteredSpecFiles.every(file => SPECS_PATH.test(file))) { + if (!filteredSpecFiles.every((file) => SPECS_PATH.test(file))) { exitError('Test files must be located within /spec/javascripts.'); } - const CE_FILES = filteredSpecFiles.filter(file => !file.startsWith('ee')); + const CE_FILES = filteredSpecFiles.filter((file) => !file.startsWith('ee')); createContext(CE_FILES, /[^e]{2}[\\\/]spec[\\\/]javascripts$/, 'spec/javascripts'); - const EE_FILES = filteredSpecFiles.filter(file => file.startsWith('ee')); + const EE_FILES = filteredSpecFiles.filter((file) => file.startsWith('ee')); createContext(EE_FILES, /ee[\\\/]spec[\\\/]javascripts$/, 'ee/spec/javascripts'); } diff --git a/config/plugins/monaco_webpack.js b/config/plugins/monaco_webpack.js index 698d1b9b1fa..01d88ca37db 100644 --- a/config/plugins/monaco_webpack.js +++ b/config/plugins/monaco_webpack.js @@ -6,7 +6,7 @@ const { languagesArr } = require('monaco-editor-webpack-plugin/out/languages'); // a known issue in the library and this workaround was suggested here: // https://github.com/pengx17/monaco-yaml/issues/20 -const yamlLang = languagesArr.find(t => t.label === 'yaml'); +const yamlLang = languagesArr.find((t) => t.label === 'yaml'); yamlLang.entry = [yamlLang.entry, '../../monaco-yaml/lib/esm/monaco.contribution']; yamlLang.worker = { diff --git a/config/webpack.config.js b/config/webpack.config.js index 62410cbb92a..958b27d674d 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -63,13 +63,13 @@ function generateEntries() { autoEntriesMap[chunkName] = `${prefix}/${path}`; } - pageEntries.forEach(path => generateAutoEntries(path)); + pageEntries.forEach((path) => generateAutoEntries(path)); if (IS_EE) { const eePageEntries = glob.sync('pages/**/index.js', { cwd: path.join(ROOT_PATH, 'ee/app/assets/javascripts'), }); - eePageEntries.forEach(path => generateAutoEntries(path, 'ee')); + eePageEntries.forEach((path) => generateAutoEntries(path, 'ee')); watchAutoEntries.push(path.join(ROOT_PATH, 'ee/app/assets/javascripts/pages/')); } @@ -77,7 +77,7 @@ function generateEntries() { autoEntriesCount = autoEntryKeys.length; // import ancestor entrypoints within their children - autoEntryKeys.forEach(entry => { + autoEntryKeys.forEach((entry) => { const entryPaths = [autoEntriesMap[entry]]; const segments = entry.split('.'); while (segments.pop()) { @@ -188,7 +188,7 @@ module.exports = { }, { test: /\.js$/, - exclude: path => + exclude: (path) => /node_modules\/(?!tributejs)|node_modules|vendor[\\/]assets/.test(path) && !/\.vue\.js/.test(path), loader: 'babel-loader', @@ -448,7 +448,7 @@ module.exports = { ]), !IS_EE && - new webpack.NormalModuleReplacementPlugin(/^ee_component\/(.*)\.vue/, resource => { + new webpack.NormalModuleReplacementPlugin(/^ee_component\/(.*)\.vue/, (resource) => { resource.request = path.join( ROOT_PATH, 'app/assets/javascripts/vue_shared/components/empty_component.js', @@ -485,14 +485,14 @@ module.exports = { const missingDeps = Array.from(compilation.missingDependencies); const nodeModulesPath = path.join(ROOT_PATH, 'node_modules'); const hasMissingNodeModules = missingDeps.some( - file => file.indexOf(nodeModulesPath) !== -1, + (file) => file.indexOf(nodeModulesPath) !== -1, ); // watch for changes to missing node_modules if (hasMissingNodeModules) compilation.contextDependencies.add(nodeModulesPath); // watch for changes to automatic entrypoints - watchAutoEntries.forEach(watchPath => compilation.contextDependencies.add(watchPath)); + watchAutoEntries.forEach((watchPath) => compilation.contextDependencies.add(watchPath)); // report our auto-generated bundle count console.log( @@ -518,7 +518,7 @@ module.exports = { ); } const memoryUsage = process.memoryUsage().heapUsed; - const toMB = bytes => Math.floor(bytes / 1024 / 1024); + const toMB = (bytes) => Math.floor(bytes / 1024 / 1024); console.log(`Webpack heap size: ${toMB(memoryUsage)} MB`); diff --git a/db/migrate/20201217111448_change_pages_deployment_size_to_bigint.rb b/db/migrate/20201217111448_change_pages_deployment_size_to_bigint.rb new file mode 100644 index 00000000000..75420166b87 --- /dev/null +++ b/db/migrate/20201217111448_change_pages_deployment_size_to_bigint.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class ChangePagesDeploymentSizeToBigint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + change_column_type_concurrently :pages_deployments, :size, :bigint + end + + def down + undo_change_column_type_concurrently :pages_deployments, :size + end +end diff --git a/db/post_migrate/20201217112249_change_pages_deployment_size_to_bigint_cleanup.rb b/db/post_migrate/20201217112249_change_pages_deployment_size_to_bigint_cleanup.rb new file mode 100644 index 00000000000..4ed29ba61f9 --- /dev/null +++ b/db/post_migrate/20201217112249_change_pages_deployment_size_to_bigint_cleanup.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class ChangePagesDeploymentSizeToBigintCleanup < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + cleanup_concurrent_column_type_change :pages_deployments, :size + end + + def down + undo_cleanup_concurrent_column_type_change :pages_deployments, :size, :integer, limit: 4 + end +end diff --git a/db/schema_migrations/20201217111448 b/db/schema_migrations/20201217111448 new file mode 100644 index 00000000000..02526b55a3d --- /dev/null +++ b/db/schema_migrations/20201217111448 @@ -0,0 +1 @@ +32330327aa8db01b5bc2c533af5387e77ad3dc0c34eacaac16a793df75634ce6
\ No newline at end of file diff --git a/db/schema_migrations/20201217112249 b/db/schema_migrations/20201217112249 new file mode 100644 index 00000000000..b5b280bbf07 --- /dev/null +++ b/db/schema_migrations/20201217112249 @@ -0,0 +1 @@ +938aa97919e5a15143a72f33bebb27e501d5ef7cc53cf4e7debe9dee398b7255
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index f16ecc2f472..dc25377bf29 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -14869,10 +14869,11 @@ CREATE TABLE pages_deployments ( project_id bigint NOT NULL, ci_build_id bigint, file_store smallint NOT NULL, - size integer NOT NULL, file text NOT NULL, file_count integer NOT NULL, file_sha256 bytea NOT NULL, + size bigint, + CONSTRAINT check_5f9132a958 CHECK ((size IS NOT NULL)), CONSTRAINT check_f0fe8032dd CHECK ((char_length(file) <= 255)) ); diff --git a/doc/api/graphql/index.md b/doc/api/graphql/index.md index 681130e82c1..45a327d323b 100644 --- a/doc/api/graphql/index.md +++ b/doc/api/graphql/index.md @@ -82,6 +82,10 @@ The process is as follows: release post (at or prior to X.11 and X.5 releases). 1. Fields meeting criteria are removed in X.0 or X.6. +NOTE: +Fields behind a feature flag and disabled by default are exempt from the deprecation process, +and can be removed at any time without notice. + ### List of removed items View the [fields, enums, and other items we removed](removed_items.md) from the GraphQL API. diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index 6af179c5718..a949b2a997a 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -1149,6 +1149,12 @@ type BaseService implements Service { type: String } +""" +Represents non-fractional signed whole numeric values. Since the value may +exceed the size of a 32-bit integer, it's encoded as a string. +""" +scalar BigInt + type Blob implements Entry { """ Flat path of the entry @@ -4075,7 +4081,7 @@ type ContainerRepositoryTag { """ The size of the tag. """ - totalSize: Int + totalSize: BigInt } """ @@ -9500,11 +9506,6 @@ type GeoNode { first: Int """ - Global ID of a specific compliance framework to return. - """ - id: ComplianceManagementFrameworkID - - """ Returns the last _n_ elements from the list. """ last: Int @@ -9740,6 +9741,11 @@ type Group { first: Int """ + Global ID of a specific compliance framework to return. + """ + id: ComplianceManagementFrameworkID + + """ Returns the last _n_ elements from the list. """ last: Int diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index 0e72319c4b0..078c4e045ce 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -3010,6 +3010,16 @@ "possibleTypes": null }, { + "kind": "SCALAR", + "name": "BigInt", + "description": "Represents non-fractional signed whole numeric values. Since the value may exceed the size of a 32-bit integer, it's encoded as a string.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { "kind": "OBJECT", "name": "Blob", "description": null, @@ -11105,7 +11115,7 @@ ], "type": { "kind": "SCALAR", - "name": "Int", + "name": "BigInt", "ofType": null }, "isDeprecated": false, @@ -26177,16 +26187,6 @@ "ofType": null }, "defaultValue": null - }, - { - "name": "id", - "description": "Global ID of a specific compliance framework to return.", - "type": { - "kind": "SCALAR", - "name": "ComplianceManagementFrameworkID", - "ofType": null - }, - "defaultValue": null } ], "type": { @@ -26979,6 +26979,16 @@ "ofType": null }, "defaultValue": null + }, + { + "name": "id", + "description": "Global ID of a specific compliance framework to return.", + "type": { + "kind": "SCALAR", + "name": "ComplianceManagementFrameworkID", + "ofType": null + }, + "defaultValue": null } ], "type": { diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 720c7ca557f..007809f24d7 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -640,7 +640,7 @@ A tag from a container repository. | `path` | String! | Path of the tag. | | `revision` | String | Revision of the tag. | | `shortRevision` | String | Short revision of the tag. | -| `totalSize` | Int | The size of the tag. | +| `totalSize` | BigInt | The size of the tag. | ### CreateAlertIssuePayload diff --git a/doc/development/documentation/styleguide/index.md b/doc/development/documentation/styleguide/index.md index 878a6a55216..d67b2a6a50b 100644 --- a/doc/development/documentation/styleguide/index.md +++ b/doc/development/documentation/styleguide/index.md @@ -1137,10 +1137,10 @@ When documenting navigation through the user interface: - Use the exact wording as shown in the UI, including any capital letters as-is. - Use bold text for navigation items and the char "greater than" (`>`) as a - separator. For example: `Navigate to your project's **Settings > CI/CD**`. + separator. For example: `From your project, go to **Settings > CI/CD**`. - If there are any expandable menus, make sure to mention that the user needs to expand the tab to find the settings you're referring to. For example: - `Navigate to your project's **Settings > CI/CD** and expand **General pipelines**`. + `From your group, go to **Settings > CI/CD** and expand **General pipelines**`. ### Navigational elements @@ -1436,10 +1436,10 @@ readability of the text. For example, the following adds little to the accompanying text: ```markdown -1. Go to **{home}** **Project overview > Details** +1. Go to **{home}** **Project overview > Details**. ``` -1. Go to **{home}** **Project overview > Details** +1. Go to **{home}** **Project overview > Details**. However, the following might help the reader connect the text to the user interface: diff --git a/doc/user/clusters/agent/index.md b/doc/user/clusters/agent/index.md index 5963485aebc..e829d90e0cb 100644 --- a/doc/user/clusters/agent/index.md +++ b/doc/user/clusters/agent/index.md @@ -20,7 +20,7 @@ tasks in a secure and cloud-native way. It enables: (network address translation). - Pull-based GitOps deployments by leveraging the [GitOps Engine](https://github.com/argoproj/gitops-engine). -- Real-time access to API endpoints within a cluster. +- Real-time access to API endpoints in a cluster. Many more features are planned. Please [review our roadmap](https://gitlab.com/groups/gitlab-org/-/epics/3329). @@ -169,7 +169,7 @@ gitops: GitLab [versions 13.7 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/259669) also supports manifest projects containing multiple directories (or subdirectories) of YAML files. For more information see our -documentation on the [Kubernetes Agent configuration respository](repository.md). +documentation on the [Kubernetes Agent configuration repository](repository.md). ### Create an Agent record in GitLab @@ -266,7 +266,7 @@ example [`resources.yml` file](#example-resourcesyml-file) in the following ways [Support TLS for gRPC communication issue](https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/issues/7) for progress updates. - When deploying KAS through the [GitLab chart](https://docs.gitlab.com/charts/), it's possible to customize the `kas-address` for `wss` and `ws` schemes to whatever you need. - Check the [chart's KAS Ingress docs](https://docs.gitlab.com/charts/charts/gitlab/kas/#ingress) + Check the [chart's KAS Ingress documentation](https://docs.gitlab.com/charts/charts/gitlab/kas/#ingress) to learn more about it. - In the near future, Omnibus GitLab intends to provision `gitlab-kas` under a sub-domain by default, instead of the `/-/kubernetes-agent` path. Please follow [this issue](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/5784) for details. - If you defined your own secret name, replace `gitlab-agent-token` with your @@ -436,12 +436,9 @@ spec: The following example projects can help you get started with the Kubernetes Agent. -### Simple NGINX deployment - -This basic GitOps example deploys NGINX: - - [Configuration repository](https://gitlab.com/gitlab-org/configure/examples/kubernetes-agent) -- [Manifest repository](https://gitlab.com/gitlab-org/configure/examples/gitops-project) +- This basic GitOps example deploys NGINX: [Manifest repository](https://gitlab.com/gitlab-org/configure/examples/gitops-project) +- [Install GitLab Runner](runner.md) ### Deploying GitLab Runner with the Agent diff --git a/doc/user/clusters/agent/runner.md b/doc/user/clusters/agent/runner.md new file mode 100644 index 00000000000..715b27f951a --- /dev/null +++ b/doc/user/clusters/agent/runner.md @@ -0,0 +1,452 @@ +--- +stage: Configure +group: Configure +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments +--- + +# Install GitLab Runner with Kubernetes Agent **(PREMIUM ONLY)** + +These instructions to install the GitLab Runner assume the +[GitLab Kubernetes Agent](index.md) is already configured. + +1. Review the possible [Runner chart YAML values](https://gitlab.com/gitlab-org/charts/gitlab-runner/blob/master/values.yaml) in the Runner chart documentation, + and create a `runner-chart-values.yaml` file with the configuration that fits + your needs, such as: + + ```yaml + # The GitLab Server URL (with protocol) that want to register the runner against + # ref: https://docs.gitlab.com/runner/commands/README.html#gitlab-runner-register + # + gitlabUrl: https://gitlab.my.domain.example.com/ + + # The Registration Token for adding new Runners to the GitLab Server. This must + # be retrieved from your GitLab Instance. + # ref: https://docs.gitlab.com/ce/ci/runners/README.html + # + runnerRegistrationToken: "yrnZW46BrtBFqM7xDzE7dddd" + + # For RBAC support: + rbac: + create: true + + # Run all containers with the privileged flag enabled + # This will allow the docker:dind image to run if you need to run Docker + # commands. Please read the docs before turning this on: + # ref: https://docs.gitlab.com/runner/executors/kubernetes.html#using-dockerdind + runners: + privileged: true + ``` + +1. Create a single manifest file to install the Runner chart with your cluster agent, + replacing `GITLAB GITLAB-RUNNER` with your namespace: + + ```shell + helm template --namespace GITLAB GITLAB-RUNNER -f runner-chart-values.yaml gitlab/gitlab-runner > runner-manifest.yaml + ``` + + An [example file is available](#example-runner-manifest). + +1. Push your `runner-manifest.yaml` to your manifest repository. + +## Example Runner manifest + +```yaml +# This code is an example of a runner manifest looks like. +# Create your own manifest.yaml file to meet your project's needs. + +--- +# Source: gitlab-runner/templates/service-account.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + annotations: + name: gitlab-runner-gitlab-runner + labels: + app: gitlab-runner-gitlab-runner + chart: gitlab-runner-0.21.1 + release: "gitlab-runner" + heritage: "Helm" +--- +# Source: gitlab-runner/templates/secrets.yaml +apiVersion: v1 +kind: Secret +metadata: + name: "gitlab-runner-gitlab-runner" + labels: + app: gitlab-runner-gitlab-runner + chart: gitlab-runner-0.21.1 + release: "gitlab-runner" + heritage: "Helm" +type: Opaque +data: + runner-registration-token: "FAKE-TOKEN" + runner-token: "" +--- +# Source: gitlab-runner/templates/configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: gitlab-runner-gitlab-runner + labels: + app: gitlab-runner-gitlab-runner + chart: gitlab-runner-0.21.1 + release: "gitlab-runner" + heritage: "Helm" +data: + entrypoint: | + #!/bin/bash + set -e + mkdir -p /home/gitlab-runner/.gitlab-runner/ + cp /scripts/config.toml /home/gitlab-runner/.gitlab-runner/ + + # Register the runner + if [[ -f /secrets/accesskey && -f /secrets/secretkey ]]; then + export CACHE_S3_ACCESS_KEY=$(cat /secrets/accesskey) + export CACHE_S3_SECRET_KEY=$(cat /secrets/secretkey) + fi + + if [[ -f /secrets/gcs-applicaton-credentials-file ]]; then + export GOOGLE_APPLICATION_CREDENTIALS="/secrets/gcs-applicaton-credentials-file" + elif [[ -f /secrets/gcs-application-credentials-file ]]; then + export GOOGLE_APPLICATION_CREDENTIALS="/secrets/gcs-application-credentials-file" + else + if [[ -f /secrets/gcs-access-id && -f /secrets/gcs-private-key ]]; then + export CACHE_GCS_ACCESS_ID=$(cat /secrets/gcs-access-id) + # echo -e used to make private key multiline (in google json auth key private key is oneline with \n) + export CACHE_GCS_PRIVATE_KEY=$(echo -e $(cat /secrets/gcs-private-key)) + fi + fi + + if [[ -f /secrets/runner-registration-token ]]; then + export REGISTRATION_TOKEN=$(cat /secrets/runner-registration-token) + fi + + if [[ -f /secrets/runner-token ]]; then + export CI_SERVER_TOKEN=$(cat /secrets/runner-token) + fi + + if ! sh /scripts/register-the-runner; then + exit 1 + fi + + # Run pre-entrypoint-script + if ! bash /scripts/pre-entrypoint-script; then + exit 1 + fi + + # Start the runner + exec /entrypoint run --user=gitlab-runner \ + --working-directory=/home/gitlab-runner + + config.toml: | + concurrent = 10 + check_interval = 30 + log_level = "info" + listen_address = ':9252' + configure: | + set -e + cp /init-secrets/* /secrets + register-the-runner: | + #!/bin/bash + MAX_REGISTER_ATTEMPTS=30 + + for i in $(seq 1 "${MAX_REGISTER_ATTEMPTS}"); do + echo "Registration attempt ${i} of ${MAX_REGISTER_ATTEMPTS}" + /entrypoint register \ + --non-interactive + + retval=$? + + if [ ${retval} = 0 ]; then + break + elif [ ${i} = ${MAX_REGISTER_ATTEMPTS} ]; then + exit 1 + fi + + sleep 5 + done + + exit 0 + + check-live: | + #!/bin/bash + if /usr/bin/pgrep -f .*register-the-runner; then + exit 0 + elif /usr/bin/pgrep gitlab.*runner; then + exit 0 + else + exit 1 + fi + + pre-entrypoint-script: | +--- +# Source: gitlab-runner/templates/role.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: "Role" +metadata: + name: gitlab-runner-gitlab-runner + labels: + app: gitlab-runner-gitlab-runner + chart: gitlab-runner-0.21.1 + release: "gitlab-runner" + heritage: "Helm" +rules: +- apiGroups: [""] + resources: ["*"] + verbs: ["*"] +--- +# Source: gitlab-runner/templates/role-binding.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: "RoleBinding" +metadata: + name: gitlab-runner-gitlab-runner + labels: + app: gitlab-runner-gitlab-runner + chart: gitlab-runner-0.21.1 + release: "gitlab-runner" + heritage: "Helm" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: "Role" + name: gitlab-runner-gitlab-runner +subjects: +- kind: ServiceAccount + name: gitlab-runner-gitlab-runner + namespace: "gitlab" +--- +# Source: gitlab-runner/templates/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gitlab-runner-gitlab-runner + labels: + app: gitlab-runner-gitlab-runner + chart: gitlab-runner-0.21.1 + release: "gitlab-runner" + heritage: "Helm" +spec: + replicas: 1 + selector: + matchLabels: + app: gitlab-runner-gitlab-runner + template: + metadata: + labels: + app: gitlab-runner-gitlab-runner + chart: gitlab-runner-0.21.1 + release: "gitlab-runner" + heritage: "Helm" + annotations: + checksum/configmap: a6623303f6fcc3a043e87ea937bb8399d2d0068a901aa9c3419ed5c7a5afa9db + checksum/secrets: 32c7d2c16918961b7b84a005680f748e774f61c6f4e4da30650d400d781bbb30 + prometheus.io/scrape: 'true' + prometheus.io/port: '9252' + spec: + securityContext: + runAsUser: 100 + fsGroup: 65533 + terminationGracePeriodSeconds: 3600 + initContainers: + - name: configure + command: ['sh', '/config/configure'] + image: gitlab/gitlab-runner:alpine-v13.4.1 + imagePullPolicy: "IfNotPresent" + env: + + - name: CI_SERVER_URL + value: "https://gitlab.qa.joaocunha.eu/" + - name: CLONE_URL + value: "" + - name: RUNNER_REQUEST_CONCURRENCY + value: "1" + - name: RUNNER_EXECUTOR + value: "kubernetes" + - name: REGISTER_LOCKED + value: "true" + - name: RUNNER_TAG_LIST + value: "" + - name: RUNNER_OUTPUT_LIMIT + value: "4096" + - name: KUBERNETES_IMAGE + value: "ubuntu:16.04" + + - name: KUBERNETES_PRIVILEGED + value: "true" + + - name: KUBERNETES_NAMESPACE + value: "gitlab" + - name: KUBERNETES_POLL_TIMEOUT + value: "180" + - name: KUBERNETES_CPU_LIMIT + value: "" + - name: KUBERNETES_CPU_LIMIT_OVERWRITE_MAX_ALLOWED + value: "" + - name: KUBERNETES_MEMORY_LIMIT + value: "" + - name: KUBERNETES_MEMORY_LIMIT_OVERWRITE_MAX_ALLOWED + value: "" + - name: KUBERNETES_CPU_REQUEST + value: "" + - name: KUBERNETES_CPU_REQUEST_OVERWRITE_MAX_ALLOWED + value: "" + - name: KUBERNETES_MEMORY_REQUEST + value: "" + - name: KUBERNETES_MEMORY_REQUEST_OVERWRITE_MAX_ALLOWED + value: "" + - name: KUBERNETES_SERVICE_ACCOUNT + value: "" + - name: KUBERNETES_SERVICE_CPU_LIMIT + value: "" + - name: KUBERNETES_SERVICE_MEMORY_LIMIT + value: "" + - name: KUBERNETES_SERVICE_CPU_REQUEST + value: "" + - name: KUBERNETES_SERVICE_MEMORY_REQUEST + value: "" + - name: KUBERNETES_HELPER_CPU_LIMIT + value: "" + - name: KUBERNETES_HELPER_MEMORY_LIMIT + value: "" + - name: KUBERNETES_HELPER_CPU_REQUEST + value: "" + - name: KUBERNETES_HELPER_MEMORY_REQUEST + value: "" + - name: KUBERNETES_HELPER_IMAGE + value: "" + - name: KUBERNETES_PULL_POLICY + value: "" + volumeMounts: + - name: runner-secrets + mountPath: /secrets + readOnly: false + - name: scripts + mountPath: /config + readOnly: true + - name: init-runner-secrets + mountPath: /init-secrets + readOnly: true + resources: + {} + serviceAccountName: gitlab-runner-gitlab-runner + containers: + - name: gitlab-runner-gitlab-runner + image: gitlab/gitlab-runner:alpine-v13.4.1 + imagePullPolicy: "IfNotPresent" + lifecycle: + preStop: + exec: + command: ["/entrypoint", "unregister", "--all-runners"] + command: ["/bin/bash", "/scripts/entrypoint"] + env: + + - name: CI_SERVER_URL + value: "https://gitlab.qa.joaocunha.eu/" + - name: CLONE_URL + value: "" + - name: RUNNER_REQUEST_CONCURRENCY + value: "1" + - name: RUNNER_EXECUTOR + value: "kubernetes" + - name: REGISTER_LOCKED + value: "true" + - name: RUNNER_TAG_LIST + value: "" + - name: RUNNER_OUTPUT_LIMIT + value: "4096" + - name: KUBERNETES_IMAGE + value: "ubuntu:16.04" + + - name: KUBERNETES_PRIVILEGED + value: "true" + + - name: KUBERNETES_NAMESPACE + value: "gitlab" + - name: KUBERNETES_POLL_TIMEOUT + value: "180" + - name: KUBERNETES_CPU_LIMIT + value: "" + - name: KUBERNETES_CPU_LIMIT_OVERWRITE_MAX_ALLOWED + value: "" + - name: KUBERNETES_MEMORY_LIMIT + value: "" + - name: KUBERNETES_MEMORY_LIMIT_OVERWRITE_MAX_ALLOWED + value: "" + - name: KUBERNETES_CPU_REQUEST + value: "" + - name: KUBERNETES_CPU_REQUEST_OVERWRITE_MAX_ALLOWED + value: "" + - name: KUBERNETES_MEMORY_REQUEST + value: "" + - name: KUBERNETES_MEMORY_REQUEST_OVERWRITE_MAX_ALLOWED + value: "" + - name: KUBERNETES_SERVICE_ACCOUNT + value: "" + - name: KUBERNETES_SERVICE_CPU_LIMIT + value: "" + - name: KUBERNETES_SERVICE_MEMORY_LIMIT + value: "" + - name: KUBERNETES_SERVICE_CPU_REQUEST + value: "" + - name: KUBERNETES_SERVICE_MEMORY_REQUEST + value: "" + - name: KUBERNETES_HELPER_CPU_LIMIT + value: "" + - name: KUBERNETES_HELPER_MEMORY_LIMIT + value: "" + - name: KUBERNETES_HELPER_CPU_REQUEST + value: "" + - name: KUBERNETES_HELPER_MEMORY_REQUEST + value: "" + - name: KUBERNETES_HELPER_IMAGE + value: "" + - name: KUBERNETES_PULL_POLICY + value: "" + livenessProbe: + exec: + command: ["/bin/bash", "/scripts/check-live"] + initialDelaySeconds: 60 + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + exec: + command: ["/usr/bin/pgrep","gitlab.*runner"] + initialDelaySeconds: 10 + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + ports: + - name: metrics + containerPort: 9252 + volumeMounts: + - name: runner-secrets + mountPath: /secrets + - name: etc-gitlab-runner + mountPath: /home/gitlab-runner/.gitlab-runner + - name: scripts + mountPath: /scripts + resources: + {} + volumes: + - name: runner-secrets + emptyDir: + medium: "Memory" + - name: etc-gitlab-runner + emptyDir: + medium: "Memory" + - name: init-runner-secrets + projected: + sources: + - secret: + name: "gitlab-runner-gitlab-runner" + items: + - key: runner-registration-token + path: runner-registration-token + - key: runner-token + path: runner-token + - name: scripts + configMap: + name: gitlab-runner-gitlab-runner +``` diff --git a/jest.config.base.js b/jest.config.base.js index 939c05985f5..ffd365b9eaa 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -1,7 +1,7 @@ const IS_EE = require('./config/helpers/is_ee_env'); const isESLint = require('./config/helpers/is_eslint'); -module.exports = path => { +module.exports = (path) => { const reporters = ['default']; // To have consistent date time parsing both in local and CI environments we set @@ -27,7 +27,7 @@ module.exports = path => { // workaround for eslint-import-resolver-jest only resolving in test files // see https://github.com/JoinColony/eslint-import-resolver-jest#note if (isESLint(module)) { - testMatch = testMatch.map(path => path.replace('_spec.js', '')); + testMatch = testMatch.map((path) => path.replace('_spec.js', '')); } const TEST_FIXTURES_PATTERN = 'test_fixtures(/.*)$'; diff --git a/jest.config.js b/jest.config.js index 4627462c730..cfc8e254791 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,7 +4,7 @@ module.exports = { ...baseConfig('spec/frontend'), }; -const karmaTestFile = process.argv.find(arg => arg.includes('spec/javascripts/')); +const karmaTestFile = process.argv.find((arg) => arg.includes('spec/javascripts/')); if (karmaTestFile) { console.error(` Files in spec/javascripts/ and ee/spec/javascripts need to be run with Karma. diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 66b6ce1ec55..164fce5a5a3 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -578,7 +578,7 @@ module Gitlab # type_cast_function - Required if the conversion back to the original type is not automatic # batch_column_name - option for tables without a primary key, in this case # another unique integer column can be used. Example: :user_id - def undo_cleanup_concurrent_column_type_change(table, column, old_type, type_cast_function: nil, batch_column_name: :id) + def undo_cleanup_concurrent_column_type_change(table, column, old_type, type_cast_function: nil, batch_column_name: :id, limit: nil) temp_column = "#{column}_for_type_change" # Using a descriptive name that includes orinal column's name risks @@ -604,7 +604,8 @@ module Gitlab temp_undo_cleanup_column, type: old_type, batch_column_name: batch_column_name, - type_cast_function: type_cast_function + type_cast_function: type_cast_function, + limit: limit ) transaction do @@ -1489,12 +1490,13 @@ into similar problems in the future (e.g. when new tables are created). "ON DELETE #{on_delete.upcase}" end - def create_column_from(table, old, new, type: nil, batch_column_name: :id, type_cast_function: nil) + def create_column_from(table, old, new, type: nil, batch_column_name: :id, type_cast_function: nil, limit: nil) old_col = column_for(table, old) new_type = type || old_col.type + new_limit = limit || old_col.limit add_column(table, new, new_type, - limit: old_col.limit, + limit: new_limit, precision: old_col.precision, scale: old_col.scale) diff --git a/scripts/frontend/block_dependencies.js b/scripts/frontend/block_dependencies.js index c9257c9f72b..a1ff8d5ee36 100644 --- a/scripts/frontend/block_dependencies.js +++ b/scripts/frontend/block_dependencies.js @@ -5,13 +5,13 @@ const dependencies = packageJson.dependencies; const devDependencies = packageJson.devDependencies; const blockedDependenciesNames = Object.keys(blockedDependencies); const blockedDependenciesFound = blockedDependenciesNames.filter( - blockedDependency => dependencies[blockedDependency] || devDependencies[blockedDependency], + (blockedDependency) => dependencies[blockedDependency] || devDependencies[blockedDependency], ); if (blockedDependenciesFound.length) { console.log('The following package.json dependencies are not allowed:'); - blockedDependenciesFound.forEach(blockedDependency => { + blockedDependenciesFound.forEach((blockedDependency) => { const infoLink = blockedDependencies[blockedDependency]; console.log(`- ${blockedDependency}: See ${infoLink} for more information.`); diff --git a/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js b/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js index a2bb9f56d84..34e939e3ceb 100755 --- a/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js +++ b/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js @@ -27,7 +27,7 @@ const file = fs.readFileSync(paths[0], 'utf-8'); const parsed = pjs.parse(file); -if (parsed.nodes.every(node => ['comment', 'atrule'].includes(node.type))) { +if (parsed.nodes.every((node) => ['comment', 'atrule'].includes(node.type))) { console.log('The file does not introduce any side effects, we are all good.'); process.exit(0); } diff --git a/scripts/frontend/extract_gettext_all.js b/scripts/frontend/extract_gettext_all.js index 725522a3540..c34c9a0233d 100644 --- a/scripts/frontend/extract_gettext_all.js +++ b/scripts/frontend/extract_gettext_all.js @@ -45,7 +45,7 @@ function printJson() { text += `\u0000${message.textPlural}`; } - message.references.forEach(reference => { + message.references.forEach((reference) => { const filename = reference.replace(/:\d+$/, ''); if (!Array.isArray(result[filename])) { diff --git a/scripts/frontend/file_test_coverage.js b/scripts/frontend/file_test_coverage.js index 7d1eb45d4bc..ec6ec4a1e9d 100755 --- a/scripts/frontend/file_test_coverage.js +++ b/scripts/frontend/file_test_coverage.js @@ -17,11 +17,11 @@ const sourceDirectories = ['app/assets/javascripts']; const testDirectories = ['spec/javascripts', 'spec/frontend']; if (fs.existsSync('ee')) { - sourceDirectories.forEach(dir => { + sourceDirectories.forEach((dir) => { sourceDirectories.push(`ee/${dir}`); }); - testDirectories.forEach(dir => { + testDirectories.forEach((dir) => { testDirectories.push(`ee/${dir}`); }); } @@ -29,10 +29,10 @@ if (fs.existsSync('ee')) { let numSourceFiles = 0; let numTestFiles = 0; -const isVerbose = process.argv.some(arg => arg === '-v'); +const isVerbose = process.argv.some((arg) => arg === '-v'); -const countSourceFiles = path => - forEachFileIn(path, fileName => { +const countSourceFiles = (path) => + forEachFileIn(path, (fileName) => { if (fileName.endsWith('.vue') || fileName.endsWith('.js')) { if (isVerbose) { console.log(`source file: ${fileName}`); @@ -42,8 +42,8 @@ const countSourceFiles = path => } }); -const countTestFiles = path => - forEachFileIn(path, fileName => { +const countTestFiles = (path) => + forEachFileIn(path, (fileName) => { if (fileName.endsWith('_spec.js')) { if (isVerbose) { console.log(`test file: ${fileName}`); @@ -63,7 +63,7 @@ function forEachFileIn(dirPath, callback) { return; } - files.forEach(fileName => { + files.forEach((fileName) => { const absolutePath = path.join(dirPath, fileName); const stats = fs.statSync(absolutePath); if (stats.isFile()) { diff --git a/scripts/frontend/frontend_script_utils.js b/scripts/frontend/frontend_script_utils.js index 5614737d278..43016dce6a4 100644 --- a/scripts/frontend/frontend_script_utils.js +++ b/scripts/frontend/frontend_script_utils.js @@ -9,10 +9,10 @@ const exec = (command, args) => { return execFileSync(command, args, options); }; -const execGitCmd = args => exec('git', args).trim().toString().split('\n').filter(Boolean); +const execGitCmd = (args) => exec('git', args).trim().toString().split('\n').filter(Boolean); module.exports = { - getStagedFiles: fileExtensionFilter => { + getStagedFiles: (fileExtensionFilter) => { const gitOptions = ['diff', '--name-only', '--cached', '--diff-filter=ACMRTUB']; if (fileExtensionFilter) gitOptions.push(...fileExtensionFilter); return execGitCmd(gitOptions); diff --git a/scripts/frontend/merge_coverage_frontend.js b/scripts/frontend/merge_coverage_frontend.js index 99034176b29..0c45a38b9b5 100644 --- a/scripts/frontend/merge_coverage_frontend.js +++ b/scripts/frontend/merge_coverage_frontend.js @@ -11,7 +11,7 @@ const reportFiles = sync(`${coverageDir}/*/coverage-final.json`); // Normalize coverage report generated by jest that has additional "data" key // https://github.com/facebook/jest/issues/2418#issuecomment-423806659 -const normalizeReport = report => { +const normalizeReport = (report) => { const normalizedReport = Object.assign({}, report); Object.entries(normalizedReport).forEach(([k, v]) => { if (v.data) normalizedReport[k] = v.data; @@ -20,12 +20,12 @@ const normalizeReport = report => { }; reportFiles - .map(reportFile => require(reportFile)) + .map((reportFile) => require(reportFile)) .map(normalizeReport) - .forEach(report => coverageMap.merge(report)); + .forEach((report) => coverageMap.merge(report)); const context = createContext({ coverageMap: coverageMap, dir: 'coverage-frontend' }); -['json', 'lcov', 'text-summary', 'clover', 'cobertura'].forEach(reporter => { +['json', 'lcov', 'text-summary', 'clover', 'cobertura'].forEach((reporter) => { create(reporter, {}).execute(context); }); diff --git a/scripts/frontend/prettier.js b/scripts/frontend/prettier.js index b55822505c3..8e9ecc2ba85 100644 --- a/scripts/frontend/prettier.js +++ b/scripts/frontend/prettier.js @@ -35,7 +35,7 @@ console.log( `Loading all ${allFiles ? '' : 'staged '}files ${globDir ? `within ${globDir} ` : ''}...`, ); -const globPatterns = matchExtensions.map(ext => `${globDir}**/*.${ext}`); +const globPatterns = matchExtensions.map((ext) => `${globDir}**/*.${ext}`); const matchedFiles = allFiles ? glob.sync(`{${globPatterns.join(',')}}`, { ignore: globIgnore }) : getStagedFiles(globPatterns); @@ -62,7 +62,7 @@ Please format each file listed below or run "${fixCommand}" `; const checkFileWithOptions = (filePath, options) => - readFileAsync(filePath, 'utf8').then(input => { + readFileAsync(filePath, 'utf8').then((input) => { if (shouldSave) { const output = prettier.format(input, options); if (input === output) { @@ -92,7 +92,7 @@ const checkFileWithOptions = (filePath, options) => } }); -const checkFileWithPrettierConfig = filePath => +const checkFileWithPrettierConfig = (filePath) => prettier .getFileInfo(filePath, { ignorePath: '.prettierignore' }) .then(({ ignored, inferredParser }) => { @@ -100,7 +100,7 @@ const checkFileWithPrettierConfig = filePath => ignoredCount += 1; return; } - return prettier.resolveConfig(filePath).then(fileOptions => { + return prettier.resolveConfig(filePath).then((fileOptions) => { const options = { ...fileOptions, parser: inferredParser }; return checkFileWithOptions(filePath, options); }); @@ -115,7 +115,7 @@ Promise.all(matchedFiles.map(checkFileWithPrettierConfig)) if (didWarn) process.exit(1); }) - .catch(e => { + .catch((e) => { console.log(`\nAn error occurred while processing files with prettier: ${e.message}\n`); process.exit(1); }); diff --git a/scripts/frontend/stylelint/stylelint-utility-map.js b/scripts/frontend/stylelint/stylelint-utility-map.js index cc555fb6d2a..bf8ee362740 100644 --- a/scripts/frontend/stylelint/stylelint-utility-map.js +++ b/scripts/frontend/stylelint/stylelint-utility-map.js @@ -32,7 +32,7 @@ sass.render( // This suppresses a postcss warning from: undefined, }) - .then(result => { + .then((result) => { const selectorGroups = {}; utils.createPropertiesHashmap(result.root, result, null, null, selectorGroups, true); diff --git a/scripts/frontend/stylelint/stylelint-utils.js b/scripts/frontend/stylelint/stylelint-utils.js index 09b75bb1d63..e7452b0cdb2 100644 --- a/scripts/frontend/stylelint/stylelint-utils.js +++ b/scripts/frontend/stylelint/stylelint-utils.js @@ -9,7 +9,7 @@ module.exports.createPropertiesHashmap = ( selectorGroups, addSelectors, ) => { - ruleRoot.walkRules(rule => { + ruleRoot.walkRules((rule) => { const selector = rule.selector.replace(/(?:\r\n|\r|\n)/g, ' '); if ( diff --git a/spec/fixtures/api/schemas/graphql/container_repository_details.json b/spec/fixtures/api/schemas/graphql/container_repository_details.json index 1b1ed473aaa..3156b6d58d5 100644 --- a/spec/fixtures/api/schemas/graphql/container_repository_details.json +++ b/spec/fixtures/api/schemas/graphql/container_repository_details.json @@ -32,7 +32,7 @@ "type": "string" }, "totalSize": { - "type": "integer" + "type": "string" }, "createdAt": { "type": "string" diff --git a/spec/frontend/__mocks__/@gitlab/ui.js b/spec/frontend/__mocks__/@gitlab/ui.js index 94e3f624c25..e27aba2dd8f 100644 --- a/spec/frontend/__mocks__/@gitlab/ui.js +++ b/spec/frontend/__mocks__/@gitlab/ui.js @@ -38,7 +38,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({ required: false, default: () => [], }, - ...Object.fromEntries(['target', 'triggers', 'placement'].map(prop => [prop, {}])), + ...Object.fromEntries(['target', 'triggers', 'placement'].map((prop) => [prop, {}])), }, render(h) { return h( @@ -47,7 +47,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({ class: 'gl-popover', ...this.$attrs, }, - Object.keys(this.$slots).map(s => this.$slots[s]), + Object.keys(this.$slots).map((s) => this.$slots[s]), ); }, })); diff --git a/spec/frontend/__mocks__/lodash/debounce.js b/spec/frontend/__mocks__/lodash/debounce.js index e8b61c80147..d4fe2ce5406 100644 --- a/spec/frontend/__mocks__/lodash/debounce.js +++ b/spec/frontend/__mocks__/lodash/debounce.js @@ -8,7 +8,7 @@ // [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378 // Further reference: https://github.com/facebook/jest/issues/3465 -export default fn => { +export default (fn) => { const debouncedFn = jest.fn().mockImplementation(fn); debouncedFn.cancel = jest.fn(); debouncedFn.flush = jest.fn().mockImplementation(() => { diff --git a/spec/frontend/__mocks__/lodash/throttle.js b/spec/frontend/__mocks__/lodash/throttle.js index aef391afd0c..e8a82654c78 100644 --- a/spec/frontend/__mocks__/lodash/throttle.js +++ b/spec/frontend/__mocks__/lodash/throttle.js @@ -1,4 +1,4 @@ // Similar to `lodash/debounce`, `lodash/throttle` also causes flaky specs. // See `./debounce.js` for more details. -export default fn => fn; +export default (fn) => fn; diff --git a/spec/frontend/activities_spec.js b/spec/frontend/activities_spec.js index 5033cabcf37..00519148b30 100644 --- a/spec/frontend/activities_spec.js +++ b/spec/frontend/activities_spec.js @@ -44,14 +44,14 @@ describe('Activities', () => { }); for (let i = 0; i < filters.length; i += 1) { - (i => { + ((i) => { describe(`when selecting ${getEventName(i)}`, () => { beforeEach(() => { $(getSelector(i)).click(); }); for (let x = 0; x < filters.length; x += 1) { - (x => { + ((x) => { const shouldHighlight = i === x; const testName = shouldHighlight ? 'should highlight' : 'should not highlight'; diff --git a/spec/frontend/add_context_commits_modal/store/actions_spec.js b/spec/frontend/add_context_commits_modal/store/actions_spec.js index 24948dd6073..0c4ac2d3ecd 100644 --- a/spec/frontend/add_context_commits_modal/store/actions_spec.js +++ b/spec/frontend/add_context_commits_modal/store/actions_spec.js @@ -42,7 +42,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('setBaseConfig', () => { - it('commits SET_BASE_CONFIG', done => { + it('commits SET_BASE_CONFIG', (done) => { const options = { contextCommitsPath, mergeRequestIid, projectId }; testAction( setBaseConfig, @@ -65,7 +65,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('setTabIndex', () => { - it('commits SET_TABINDEX', done => { + it('commits SET_TABINDEX', (done) => { testAction( setTabIndex, { tabIndex: 1 }, @@ -78,7 +78,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('setCommits', () => { - it('commits SET_COMMITS', done => { + it('commits SET_COMMITS', (done) => { testAction( setCommits, { commits: [], silentAddition: false }, @@ -89,7 +89,7 @@ describe('AddContextCommitsModalStoreActions', () => { ); }); - it('commits SET_COMMITS_SILENT', done => { + it('commits SET_COMMITS_SILENT', (done) => { testAction( setCommits, { commits: [], silentAddition: true }, @@ -102,7 +102,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('createContextCommits', () => { - it('calls API to create context commits', done => { + it('calls API to create context commits', (done) => { mock.onPost(contextCommitEndpoint).reply(200, {}); testAction(createContextCommits, { commits: [] }, {}, [], [], done); @@ -126,7 +126,7 @@ describe('AddContextCommitsModalStoreActions', () => { ) .reply(200, [dummyCommit]); }); - it('commits FETCH_CONTEXT_COMMITS', done => { + it('commits FETCH_CONTEXT_COMMITS', (done) => { const contextCommit = { ...dummyCommit, isSelected: true }; testAction( fetchContextCommits, @@ -150,7 +150,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('setContextCommits', () => { - it('commits SET_CONTEXT_COMMITS', done => { + it('commits SET_CONTEXT_COMMITS', (done) => { testAction( setContextCommits, { data: [] }, @@ -168,7 +168,7 @@ describe('AddContextCommitsModalStoreActions', () => { .onDelete('/api/v4/projects/gitlab-org%2Fgitlab/merge_requests/1/context_commits') .reply(204); }); - it('calls API to remove context commits', done => { + it('calls API to remove context commits', (done) => { testAction( removeContextCommits, { forceReload: false }, @@ -181,7 +181,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('setSelectedCommits', () => { - it('commits SET_SELECTED_COMMITS', done => { + it('commits SET_SELECTED_COMMITS', (done) => { testAction( setSelectedCommits, [dummyCommit], @@ -194,7 +194,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('setSearchText', () => { - it('commits SET_SEARCH_TEXT', done => { + it('commits SET_SEARCH_TEXT', (done) => { const searchText = 'Dummy Text'; testAction( setSearchText, @@ -208,7 +208,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('setToRemoveCommits', () => { - it('commits SET_TO_REMOVE_COMMITS', done => { + it('commits SET_TO_REMOVE_COMMITS', (done) => { const commitId = 'abcde'; testAction( @@ -223,7 +223,7 @@ describe('AddContextCommitsModalStoreActions', () => { }); describe('resetModalState', () => { - it('commits RESET_MODAL_STATE', done => { + it('commits RESET_MODAL_STATE', (done) => { const commitId = 'abcde'; testAction( diff --git a/spec/frontend/admin/statistics_panel/components/app_spec.js b/spec/frontend/admin/statistics_panel/components/app_spec.js index dda0c2b857c..a4dcfa1a480 100644 --- a/spec/frontend/admin/statistics_panel/components/app_spec.js +++ b/spec/frontend/admin/statistics_panel/components/app_spec.js @@ -34,7 +34,7 @@ describe('Admin statistics app', () => { wrapper.destroy(); }); - const findStats = idx => wrapper.findAll('.js-stats').at(idx); + const findStats = (idx) => wrapper.findAll('.js-stats').at(idx); describe('template', () => { describe('when app is loading', () => { diff --git a/spec/frontend/admin/statistics_panel/store/actions_spec.js b/spec/frontend/admin/statistics_panel/store/actions_spec.js index 9b18b1aebda..ecbc823be12 100644 --- a/spec/frontend/admin/statistics_panel/store/actions_spec.js +++ b/spec/frontend/admin/statistics_panel/store/actions_spec.js @@ -22,7 +22,7 @@ describe('Admin statistics panel actions', () => { mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(200, mockStatistics); }); - it('dispatches success with received data', done => + it('dispatches success with received data', (done) => testAction( actions.fetchStatistics, null, @@ -46,7 +46,7 @@ describe('Admin statistics panel actions', () => { mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(500); }); - it('dispatches error', done => + it('dispatches error', (done) => testAction( actions.fetchStatistics, null, @@ -67,7 +67,7 @@ describe('Admin statistics panel actions', () => { }); describe('requestStatistic', () => { - it('should commit the request mutation', done => + it('should commit the request mutation', (done) => testAction( actions.requestStatistics, null, @@ -79,7 +79,7 @@ describe('Admin statistics panel actions', () => { }); describe('receiveStatisticsSuccess', () => { - it('should commit received data', done => + it('should commit received data', (done) => testAction( actions.receiveStatisticsSuccess, mockStatistics, @@ -96,7 +96,7 @@ describe('Admin statistics panel actions', () => { }); describe('receiveStatisticsError', () => { - it('should commit error', done => { + it('should commit error', (done) => { testAction( actions.receiveStatisticsError, 500, diff --git a/spec/frontend/alert_handler_spec.js b/spec/frontend/alert_handler_spec.js index 0cee28112a8..e4cd38a7799 100644 --- a/spec/frontend/alert_handler_spec.js +++ b/spec/frontend/alert_handler_spec.js @@ -7,7 +7,7 @@ describe('Alert Handler', () => { const DISMISS_CLASS = 'gl-alert-dismiss'; const DISMISS_LABEL = 'Dismiss'; - const generateHtml = parentClass => + const generateHtml = (parentClass) => `<div class="${parentClass}"> <button aria-label="${DISMISS_LABEL}">Dismiss</button> </div>`; diff --git a/spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js b/spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js index ed78a593944..053d6492698 100644 --- a/spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js +++ b/spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js @@ -35,7 +35,7 @@ describe('AlertsServiceForm', () => { const findUrl = () => wrapper.find('#url'); const findAuthorizationKey = () => wrapper.find('#authorization-key'); const findDescription = () => wrapper.find('[data-testid="description"'); - const findActiveStatusIcon = val => + const findActiveStatusIcon = (val) => document.querySelector(`.js-service-active-status[data-value=${val.toString()}]`); beforeEach(() => { diff --git a/spec/frontend/alerts_settings/alert_mapping_builder_spec.js b/spec/frontend/alerts_settings/alert_mapping_builder_spec.js index 5acf0f050ae..5d48ff02e35 100644 --- a/spec/frontend/alerts_settings/alert_mapping_builder_spec.js +++ b/spec/frontend/alerts_settings/alert_mapping_builder_spec.js @@ -63,7 +63,7 @@ describe('AlertMappingBuilder', () => { const dropdownItems = dropdown.findAll(GlDropdownItem); const { nodes } = parsedMapping.samplePayload.payloadAlerFields; const numberOfMappingOptions = nodes.filter(({ type }) => - type.some(t => compatibleTypes.includes(t)), + type.some((t) => compatibleTypes.includes(t)), ); expect(dropdown.exists()).toBe(true); @@ -82,7 +82,7 @@ describe('AlertMappingBuilder', () => { const dropdownItems = dropdown.findAll(GlDropdownItem); const { nodes } = parsedMapping.samplePayload.payloadAlerFields; const numberOfMappingOptions = nodes.filter(({ type }) => - type.some(t => compatibleTypes.includes(t)), + type.some((t) => compatibleTypes.includes(t)), ); expect(searchBox.exists()).toBe(Boolean(numberOfFallbacks)); diff --git a/spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js b/spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js index fe187d9e8f9..d831dbd653a 100644 --- a/spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js +++ b/spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js @@ -379,7 +379,7 @@ describe('AlertsSettingsWrapper', () => { // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657 describe('Opsgenie integration', () => { - it.each([true, false])('it shows/hides the alert when opsgenie is %s', active => { + it.each([true, false])('it shows/hides the alert when opsgenie is %s', (active) => { createComponent({ data: { integrations: { list: mockIntegrations }, currentIntegration: mockIntegrations[0] }, provide: { opsgenie: { active } }, diff --git a/spec/frontend/analytics/instance_statistics/components/app_spec.js b/spec/frontend/analytics/instance_statistics/components/app_spec.js index 8ac663b3046..cc676e86e99 100644 --- a/spec/frontend/analytics/instance_statistics/components/app_spec.js +++ b/spec/frontend/analytics/instance_statistics/components/app_spec.js @@ -25,11 +25,11 @@ describe('InstanceStatisticsApp', () => { expect(wrapper.find(InstanceCounts).exists()).toBe(true); }); - ['Pipelines', 'Issues & Merge Requests'].forEach(instance => { + ['Pipelines', 'Issues & Merge Requests'].forEach((instance) => { it(`displays the ${instance} chart`, () => { const chartTitles = wrapper .findAll(InstanceStatisticsCountChart) - .wrappers.map(chartComponent => chartComponent.props('chartTitle')); + .wrappers.map((chartComponent) => chartComponent.props('chartTitle')); expect(chartTitles).toContain(instance); }); diff --git a/spec/frontend/api_spec.js b/spec/frontend/api_spec.js index 37630c15b89..ef900446ad5 100644 --- a/spec/frontend/api_spec.js +++ b/spec/frontend/api_spec.js @@ -34,7 +34,7 @@ describe('Api', () => { expect(builtUrl).toEqual(expectedOutput); }); - [null, '', '/'].forEach(root => { + [null, '', '/'].forEach((root) => { it(`works when relative_url_root is ${root}`, () => { window.gon.relative_url_root = root; const input = '/api/:version/foo/bar'; @@ -137,14 +137,14 @@ describe('Api', () => { }); describe('group', () => { - it('fetches a group', done => { + it('fetches a group', (done) => { const groupId = '123456'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}`; mock.onGet(expectedUrl).reply(httpStatus.OK, { name: 'test', }); - Api.group(groupId, response => { + Api.group(groupId, (response) => { expect(response.name).toBe('test'); done(); }); @@ -152,7 +152,7 @@ describe('Api', () => { }); describe('groupMembers', () => { - it('fetches group members', done => { + it('fetches group members', (done) => { const groupId = '54321'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/members`; const expectedData = [{ id: 7 }]; @@ -168,7 +168,7 @@ describe('Api', () => { }); describe('groupMilestones', () => { - it('fetches group milestones', done => { + it('fetches group milestones', (done) => { const groupId = '16'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/milestones`; const expectedData = [ @@ -198,7 +198,7 @@ describe('Api', () => { }); describe('groups', () => { - it('fetches groups', done => { + it('fetches groups', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups.json`; @@ -208,7 +208,7 @@ describe('Api', () => { }, ]); - Api.groups(query, options, response => { + Api.groups(query, options, (response) => { expect(response.length).toBe(1); expect(response[0].name).toBe('test'); done(); @@ -217,7 +217,7 @@ describe('Api', () => { }); describe('namespaces', () => { - it('fetches namespaces', done => { + it('fetches namespaces', (done) => { const query = 'dummy query'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/namespaces.json`; mock.onGet(expectedUrl).reply(httpStatus.OK, [ @@ -226,7 +226,7 @@ describe('Api', () => { }, ]); - Api.namespaces(query, response => { + Api.namespaces(query, (response) => { expect(response.length).toBe(1); expect(response[0].name).toBe('test'); done(); @@ -235,7 +235,7 @@ describe('Api', () => { }); describe('projects', () => { - it('fetches projects with membership when logged in', done => { + it('fetches projects with membership when logged in', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects.json`; @@ -246,14 +246,14 @@ describe('Api', () => { }, ]); - Api.projects(query, options, response => { + Api.projects(query, options, (response) => { expect(response.length).toBe(1); expect(response[0].name).toBe('test'); done(); }); }); - it('fetches projects without membership when not logged in', done => { + it('fetches projects without membership when not logged in', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects.json`; @@ -263,7 +263,7 @@ describe('Api', () => { }, ]); - Api.projects(query, options, response => { + Api.projects(query, options, (response) => { expect(response.length).toBe(1); expect(response[0].name).toBe('test'); done(); @@ -272,7 +272,7 @@ describe('Api', () => { }); describe('updateProject', () => { - it('update a project with the given payload', done => { + it('update a project with the given payload', (done) => { const projectPath = 'foo'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}`; mock.onPut(expectedUrl).reply(httpStatus.OK, { foo: 'bar' }); @@ -287,7 +287,7 @@ describe('Api', () => { }); describe('projectUsers', () => { - it('fetches all users of a particular project', done => { + it('fetches all users of a particular project', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; const projectPath = 'gitlab-org%2Fgitlab-ce'; @@ -299,7 +299,7 @@ describe('Api', () => { ]); Api.projectUsers('gitlab-org/gitlab-ce', query, options) - .then(response => { + .then((response) => { expect(response.length).toBe(1); expect(response[0].name).toBe('test'); }) @@ -312,7 +312,7 @@ describe('Api', () => { const projectPath = 'abc'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests`; - it('fetches all merge requests for a project', done => { + it('fetches all merge requests for a project', (done) => { const mockData = [{ source_branch: 'foo' }, { source_branch: 'bar' }]; mock.onGet(expectedUrl).reply(httpStatus.OK, mockData); Api.projectMergeRequests(projectPath) @@ -325,7 +325,7 @@ describe('Api', () => { .catch(done.fail); }); - it('fetches merge requests filtered with passed params', done => { + it('fetches merge requests filtered with passed params', (done) => { const params = { source_branch: 'bar', }; @@ -343,7 +343,7 @@ describe('Api', () => { }); describe('projectMergeRequest', () => { - it('fetches a merge request', done => { + it('fetches a merge request', (done) => { const projectPath = 'abc'; const mergeRequestId = '123456'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests/${mergeRequestId}`; @@ -361,7 +361,7 @@ describe('Api', () => { }); describe('projectMergeRequestChanges', () => { - it('fetches the changes of a merge request', done => { + it('fetches the changes of a merge request', (done) => { const projectPath = 'abc'; const mergeRequestId = '123456'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests/${mergeRequestId}/changes`; @@ -379,7 +379,7 @@ describe('Api', () => { }); describe('projectMergeRequestVersions', () => { - it('fetches the versions of a merge request', done => { + it('fetches the versions of a merge request', (done) => { const projectPath = 'abc'; const mergeRequestId = '123456'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests/${mergeRequestId}/versions`; @@ -400,7 +400,7 @@ describe('Api', () => { }); describe('projectRunners', () => { - it('fetches the runners of a project', done => { + it('fetches the runners of a project', (done) => { const projectPath = 7; const params = { scope: 'active' }; const mockData = [{ id: 4 }]; @@ -417,7 +417,7 @@ describe('Api', () => { }); describe('projectMilestones', () => { - it('fetches project milestones', done => { + it('fetches project milestones', (done) => { const projectId = 1; const options = { state: 'active' }; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/1/milestones`; @@ -459,7 +459,7 @@ describe('Api', () => { }); describe('newLabel', () => { - it('creates a new label', done => { + it('creates a new label', (done) => { const namespace = 'some namespace'; const project = 'some project'; const labelData = { some: 'data' }; @@ -467,7 +467,7 @@ describe('Api', () => { const expectedData = { label: labelData, }; - mock.onPost(expectedUrl).reply(config => { + mock.onPost(expectedUrl).reply((config) => { expect(config.data).toBe(JSON.stringify(expectedData)); return [ @@ -478,20 +478,20 @@ describe('Api', () => { ]; }); - Api.newLabel(namespace, project, labelData, response => { + Api.newLabel(namespace, project, labelData, (response) => { expect(response.name).toBe('test'); done(); }); }); - it('creates a group label', done => { + it('creates a group label', (done) => { const namespace = 'group/subgroup'; const labelData = { some: 'data' }; const expectedUrl = Api.buildUrl(Api.groupLabelsPath).replace(':namespace_path', namespace); const expectedData = { label: labelData, }; - mock.onPost(expectedUrl).reply(config => { + mock.onPost(expectedUrl).reply((config) => { expect(config.data).toBe(JSON.stringify(expectedData)); return [ @@ -502,7 +502,7 @@ describe('Api', () => { ]; }); - Api.newLabel(namespace, undefined, labelData, response => { + Api.newLabel(namespace, undefined, labelData, (response) => { expect(response.name).toBe('test'); done(); }); @@ -510,7 +510,7 @@ describe('Api', () => { }); describe('groupProjects', () => { - it('fetches group projects', done => { + it('fetches group projects', (done) => { const groupId = '123456'; const query = 'dummy query'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/projects.json`; @@ -520,7 +520,7 @@ describe('Api', () => { }, ]); - Api.groupProjects(groupId, query, {}, response => { + Api.groupProjects(groupId, query, {}, (response) => { expect(response.length).toBe(1); expect(response[0].name).toBe('test'); done(); @@ -561,7 +561,7 @@ describe('Api', () => { templateKey, )}`; - it('fetches an issue template', done => { + it('fetches an issue template', (done) => { mock.onGet(expectedUrl).reply(httpStatus.OK, 'test'); Api.issueTemplate(namespace, project, templateKey, templateType, (error, response) => { @@ -587,7 +587,7 @@ describe('Api', () => { const templateType = 'template type'; const expectedUrl = `${dummyUrlRoot}/${namespace}/${project}/templates/${templateType}`; - it('fetches all templates by type', done => { + it('fetches all templates by type', (done) => { const expectedData = [ { key: 'Template1', name: 'Template 1', content: 'This is template 1!' }, ]; @@ -615,12 +615,12 @@ describe('Api', () => { }); describe('projectTemplates', () => { - it('fetches a list of templates', done => { + it('fetches a list of templates', (done) => { const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/gitlab-org%2Fgitlab-ce/templates/licenses`; mock.onGet(expectedUrl).reply(httpStatus.OK, 'test'); - Api.projectTemplates('gitlab-org/gitlab-ce', 'licenses', {}, response => { + Api.projectTemplates('gitlab-org/gitlab-ce', 'licenses', {}, (response) => { expect(response).toBe('test'); done(); }); @@ -628,13 +628,13 @@ describe('Api', () => { }); describe('projectTemplate', () => { - it('fetches a single template', done => { + it('fetches a single template', (done) => { const data = { unused: 'option' }; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/gitlab-org%2Fgitlab-ce/templates/licenses/test%20license`; mock.onGet(expectedUrl).reply(httpStatus.OK, 'test'); - Api.projectTemplate('gitlab-org/gitlab-ce', 'licenses', 'test license', data, response => { + Api.projectTemplate('gitlab-org/gitlab-ce', 'licenses', 'test license', data, (response) => { expect(response).toBe('test'); done(); }); @@ -642,7 +642,7 @@ describe('Api', () => { }); describe('users', () => { - it('fetches users', done => { + it('fetches users', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/users.json`; @@ -663,7 +663,7 @@ describe('Api', () => { }); describe('user', () => { - it('fetches single user', done => { + it('fetches single user', (done) => { const userId = '123456'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/users/${userId}`; mock.onGet(expectedUrl).reply(httpStatus.OK, { @@ -680,7 +680,7 @@ describe('Api', () => { }); describe('user counts', () => { - it('fetches single user counts', done => { + it('fetches single user counts', (done) => { const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/user_counts`; mock.onGet(expectedUrl).reply(httpStatus.OK, { merge_requests: 4, @@ -696,7 +696,7 @@ describe('Api', () => { }); describe('user status', () => { - it('fetches single user status', done => { + it('fetches single user status', (done) => { const userId = '123456'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/users/${userId}/status`; mock.onGet(expectedUrl).reply(httpStatus.OK, { @@ -713,7 +713,7 @@ describe('Api', () => { }); describe('user projects', () => { - it('fetches all projects that belong to a particular user', done => { + it('fetches all projects that belong to a particular user', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; const userId = '123456'; @@ -724,7 +724,7 @@ describe('Api', () => { }, ]); - Api.userProjects(userId, query, options, response => { + Api.userProjects(userId, query, options, (response) => { expect(response.length).toBe(1); expect(response[0].name).toBe('test'); done(); @@ -733,7 +733,7 @@ describe('Api', () => { }); describe('commitPipelines', () => { - it('fetches pipelines for a given commit', done => { + it('fetches pipelines for a given commit', (done) => { const projectId = 'example/foobar'; const commitSha = 'abc123def'; const expectedUrl = `${dummyUrlRoot}/${projectId}/commit/${commitSha}/pipelines`; @@ -756,7 +756,7 @@ describe('Api', () => { describe('pipelineJobs', () => { it.each([undefined, {}, { foo: true }])( 'fetches the jobs for a given pipeline given %p params', - async params => { + async (params) => { const projectId = 123; const pipelineId = 456; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectId}/pipelines/${pipelineId}/jobs`; @@ -774,7 +774,7 @@ describe('Api', () => { }); describe('createBranch', () => { - it('creates new branch', done => { + it('creates new branch', (done) => { const ref = 'master'; const branch = 'new-branch-name'; const dummyProjectPath = 'gitlab-org/gitlab-ce'; @@ -799,7 +799,7 @@ describe('Api', () => { }); describe('projectForks', () => { - it('gets forked projects', done => { + it('gets forked projects', (done) => { const dummyProjectPath = 'gitlab-org/gitlab-ce'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${encodeURIComponent( dummyProjectPath, @@ -822,7 +822,7 @@ describe('Api', () => { }); describe('createContextCommits', () => { - it('creates a new context commit', done => { + it('creates a new context commit', (done) => { const projectPath = 'abc'; const mergeRequestId = '123456'; const commitsData = ['abcdefg']; @@ -851,7 +851,7 @@ describe('Api', () => { }); describe('allContextCommits', () => { - it('gets all context commits', done => { + it('gets all context commits', (done) => { const projectPath = 'abc'; const mergeRequestId = '123456'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests/${mergeRequestId}/context_commits`; @@ -872,7 +872,7 @@ describe('Api', () => { }); describe('removeContextCommits', () => { - it('removes context commits', done => { + it('removes context commits', (done) => { const projectPath = 'abc'; const mergeRequestId = '123456'; const commitsData = ['abcdefg']; @@ -1120,7 +1120,7 @@ describe('Api', () => { }); describe('updateIssue', () => { - it('update an issue with the given payload', done => { + it('update an issue with the given payload', (done) => { const projectId = 8; const issue = 1; const expectedArray = [1, 2, 3]; @@ -1137,7 +1137,7 @@ describe('Api', () => { }); describe('updateMergeRequest', () => { - it('update an issue with the given payload', done => { + it('update an issue with the given payload', (done) => { const projectId = 8; const mergeRequest = 1; const expectedArray = [1, 2, 3]; @@ -1154,7 +1154,7 @@ describe('Api', () => { }); describe('tags', () => { - it('fetches all tags of a particular project', done => { + it('fetches all tags of a particular project', (done) => { const query = 'dummy query'; const options = { unused: 'option' }; const projectId = 8; diff --git a/spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js b/spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js index 025e605b920..98c8ed4b95d 100644 --- a/spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js +++ b/spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js @@ -34,8 +34,8 @@ describe('RecoveryCodes', () => { const findAlert = () => wrapper.find(GlAlert); const findRecoveryCodes = () => wrapper.findByTestId('recovery-codes'); const findCopyButton = () => wrapper.find(ClipboardButton); - const findButtonByText = text => - wrapper.findAll(GlButton).wrappers.find(buttonWrapper => buttonWrapper.text() === text); + const findButtonByText = (text) => + wrapper.findAll(GlButton).wrappers.find((buttonWrapper) => buttonWrapper.text() === text); const findDownloadButton = () => findButtonByText('Download codes'); const findPrintButton = () => findButtonByText('Print codes'); const findProceedButton = () => findButtonByText('Proceed'); @@ -59,7 +59,7 @@ describe('RecoveryCodes', () => { it('renders codes', () => { const recoveryCodes = findRecoveryCodes().text(); - codes.forEach(code => { + codes.forEach((code) => { expect(recoveryCodes).toContain(code); }); }); diff --git a/spec/frontend/authentication/u2f/authenticate_spec.js b/spec/frontend/authentication/u2f/authenticate_spec.js index 427e2cef00c..bf50ee88035 100644 --- a/spec/frontend/authentication/u2f/authenticate_spec.js +++ b/spec/frontend/authentication/u2f/authenticate_spec.js @@ -38,7 +38,7 @@ describe('U2FAuthenticate', () => { window.u2f = oldu2f; }); - it('falls back to normal 2fa', done => { + it('falls back to normal 2fa', (done) => { component .start() .then(() => { @@ -50,7 +50,7 @@ describe('U2FAuthenticate', () => { }); describe('with u2f available', () => { - beforeEach(done => { + beforeEach((done) => { // bypass automatic form submission within renderAuthenticated jest.spyOn(component, 'renderAuthenticated').mockReturnValue(true); u2fDevice = new MockU2FDevice(); diff --git a/spec/frontend/authentication/u2f/register_spec.js b/spec/frontend/authentication/u2f/register_spec.js index 1c2e7c45a23..9cbadbc2fef 100644 --- a/spec/frontend/authentication/u2f/register_spec.js +++ b/spec/frontend/authentication/u2f/register_spec.js @@ -10,7 +10,7 @@ describe('U2FRegister', () => { preloadFixtures('u2f/register.html'); - beforeEach(done => { + beforeEach((done) => { loadFixtures('u2f/register.html'); u2fDevice = new MockU2FDevice(); container = $('#js-register-token-2fa'); diff --git a/spec/frontend/awards_handler_spec.js b/spec/frontend/awards_handler_spec.js index 2462026be0f..e9482ffbd3d 100644 --- a/spec/frontend/awards_handler_spec.js +++ b/spec/frontend/awards_handler_spec.js @@ -63,7 +63,7 @@ describe('AwardsHandler', () => { const $menu = $('.emoji-menu'); - return new Promise(resolve => { + return new Promise((resolve) => { $menu.one('build-emoji-menu-finish', () => { resolve(); }); @@ -356,7 +356,7 @@ describe('AwardsHandler', () => { await openAndWaitForEmojiMenu(); const emojiMenu = document.querySelector('.emoji-menu'); - Array.prototype.forEach.call(emojiMenu.querySelectorAll('.emoji-menu-title'), title => { + Array.prototype.forEach.call(emojiMenu.querySelectorAll('.emoji-menu-title'), (title) => { expect(title.textContent.trim().toLowerCase()).not.toBe('frequently used'); }); }); @@ -369,7 +369,7 @@ describe('AwardsHandler', () => { const emojiMenu = document.querySelector('.emoji-menu'); const hasFrequentlyUsedHeading = Array.prototype.some.call( emojiMenu.querySelectorAll('.emoji-menu-title'), - title => title.textContent.trim().toLowerCase() === 'frequently used', + (title) => title.textContent.trim().toLowerCase() === 'frequently used', ); expect(hasFrequentlyUsedHeading).toBe(true); diff --git a/spec/frontend/badges/components/badge_form_spec.js b/spec/frontend/badges/components/badge_form_spec.js index 1edc9adbfb2..34c65d51115 100644 --- a/spec/frontend/badges/components/badge_form_spec.js +++ b/spec/frontend/badges/components/badge_form_spec.js @@ -50,7 +50,7 @@ describe('BadgeForm component', () => { }); }); - const sharedSubmitTests = submitAction => { + const sharedSubmitTests = (submitAction) => { const nameSelector = '#badge-name'; const imageUrlSelector = '#badge-image-url'; const findImageUrlElement = () => vm.$el.querySelector(imageUrlSelector); @@ -65,7 +65,7 @@ describe('BadgeForm component', () => { const submitButton = vm.$el.querySelector('button[type="submit"]'); submitButton.click(); }; - const expectInvalidInput = inputElementSelector => { + const expectInvalidInput = (inputElementSelector) => { const inputElement = vm.$el.querySelector(inputElementSelector); expect(inputElement.checkValidity()).toBe(false); @@ -74,7 +74,7 @@ describe('BadgeForm component', () => { expect(feedbackElement).toBeVisible(); }; - beforeEach(done => { + beforeEach((done) => { jest.spyOn(vm, submitAction).mockReturnValue(Promise.resolve()); store.replaceState({ ...store.state, diff --git a/spec/frontend/badges/components/badge_list_row_spec.js b/spec/frontend/badges/components/badge_list_row_spec.js index 32898abb4f7..c559c979cb3 100644 --- a/spec/frontend/badges/components/badge_list_row_spec.js +++ b/spec/frontend/badges/components/badge_list_row_spec.js @@ -73,7 +73,7 @@ describe('BadgeListRow component', () => { expect(vm.editBadge).toHaveBeenCalled(); }); - it('calls updateBadgeInModal and shows modal when clicking then delete button', done => { + it('calls updateBadgeInModal and shows modal when clicking then delete button', (done) => { jest.spyOn(vm, 'updateBadgeInModal').mockImplementation(() => {}); const deleteButton = vm.$el.querySelector('.table-button-footer button:last-of-type'); @@ -88,7 +88,7 @@ describe('BadgeListRow component', () => { }); describe('for a group badge', () => { - beforeEach(done => { + beforeEach((done) => { badge.kind = GROUP_BADGE; Vue.nextTick().then(done).catch(done.fail); diff --git a/spec/frontend/badges/components/badge_list_spec.js b/spec/frontend/badges/components/badge_list_spec.js index 4b61fc6658a..da59e13e1e9 100644 --- a/spec/frontend/badges/components/badge_list_spec.js +++ b/spec/frontend/badges/components/badge_list_spec.js @@ -48,7 +48,7 @@ describe('BadgeList component', () => { expect(rows).toHaveLength(numberOfDummyBadges); }); - it('renders a message if no badges exist', done => { + it('renders a message if no badges exist', (done) => { store.state.badges = []; Vue.nextTick() @@ -59,7 +59,7 @@ describe('BadgeList component', () => { .catch(done.fail); }); - it('shows a loading icon when loading', done => { + it('shows a loading icon when loading', (done) => { store.state.isLoading = true; Vue.nextTick() @@ -73,13 +73,13 @@ describe('BadgeList component', () => { }); describe('for group badges', () => { - beforeEach(done => { + beforeEach((done) => { store.state.kind = GROUP_BADGE; Vue.nextTick().then(done).catch(done.fail); }); - it('renders a message if no badges exist', done => { + it('renders a message if no badges exist', (done) => { store.state.badges = []; Vue.nextTick() diff --git a/spec/frontend/badges/components/badge_spec.js b/spec/frontend/badges/components/badge_spec.js index 43004004fb2..990bc094d59 100644 --- a/spec/frontend/badges/components/badge_spec.js +++ b/spec/frontend/badges/components/badge_spec.js @@ -23,7 +23,7 @@ describe('Badge component', () => { const createComponent = (props, el = null) => { vm = mountComponent(Component, props, el); const { badgeImage } = findElements(); - return new Promise(resolve => { + return new Promise((resolve) => { badgeImage.addEventListener('load', resolve); // Manually dispatch load event as it is not triggered badgeImage.dispatchEvent(new Event('load')); @@ -36,7 +36,7 @@ describe('Badge component', () => { describe('watchers', () => { describe('imageUrl', () => { - it('sets isLoading and resets numRetries and hasError', done => { + it('sets isLoading and resets numRetries and hasError', (done) => { const props = { ...dummyProps }; createComponent(props) .then(() => { @@ -60,7 +60,7 @@ describe('Badge component', () => { }); describe('methods', () => { - beforeEach(done => { + beforeEach((done) => { createComponent({ ...dummyProps }) .then(done) .catch(done.fail); @@ -98,7 +98,7 @@ describe('Badge component', () => { }); describe('behavior', () => { - beforeEach(done => { + beforeEach((done) => { setFixtures('<div id="dummy-element"></div>'); createComponent({ ...dummyProps }, '#dummy-element') .then(done) @@ -116,7 +116,7 @@ describe('Badge component', () => { expect(vm.$el.querySelector('.btn-group')).toBeHidden(); }); - it('shows a loading icon when loading', done => { + it('shows a loading icon when loading', (done) => { vm.isLoading = true; Vue.nextTick() @@ -132,7 +132,7 @@ describe('Badge component', () => { .catch(done.fail); }); - it('shows an error and reload button if loading failed', done => { + it('shows an error and reload button if loading failed', (done) => { vm.hasError = true; Vue.nextTick() diff --git a/spec/frontend/badges/store/actions_spec.js b/spec/frontend/badges/store/actions_spec.js index 365520d709c..52ae29affac 100644 --- a/spec/frontend/badges/store/actions_spec.js +++ b/spec/frontend/badges/store/actions_spec.js @@ -33,7 +33,7 @@ describe('Badges store actions', () => { }); describe('requestNewBadge', () => { - it('commits REQUEST_NEW_BADGE', done => { + it('commits REQUEST_NEW_BADGE', (done) => { testAction( actions.requestNewBadge, null, @@ -46,7 +46,7 @@ describe('Badges store actions', () => { }); describe('receiveNewBadge', () => { - it('commits RECEIVE_NEW_BADGE', done => { + it('commits RECEIVE_NEW_BADGE', (done) => { const newBadge = createDummyBadge(); testAction( actions.receiveNewBadge, @@ -60,7 +60,7 @@ describe('Badges store actions', () => { }); describe('receiveNewBadgeError', () => { - it('commits RECEIVE_NEW_BADGE_ERROR', done => { + it('commits RECEIVE_NEW_BADGE_ERROR', (done) => { testAction( actions.receiveNewBadgeError, null, @@ -87,10 +87,10 @@ describe('Badges store actions', () => { }; }); - it('dispatches requestNewBadge and receiveNewBadge for successful response', done => { + it('dispatches requestNewBadge and receiveNewBadge for successful response', (done) => { const dummyResponse = createDummyBadgeResponse(); - endpointMock.replyOnce(req => { + endpointMock.replyOnce((req) => { expect(req.data).toBe( JSON.stringify({ name: 'TestBadge', @@ -114,8 +114,8 @@ describe('Badges store actions', () => { .catch(done.fail); }); - it('dispatches requestNewBadge and receiveNewBadgeError for error response', done => { - endpointMock.replyOnce(req => { + it('dispatches requestNewBadge and receiveNewBadgeError for error response', (done) => { + endpointMock.replyOnce((req) => { expect(req.data).toBe( JSON.stringify({ name: 'TestBadge', @@ -141,7 +141,7 @@ describe('Badges store actions', () => { }); describe('requestDeleteBadge', () => { - it('commits REQUEST_DELETE_BADGE', done => { + it('commits REQUEST_DELETE_BADGE', (done) => { testAction( actions.requestDeleteBadge, badgeId, @@ -154,7 +154,7 @@ describe('Badges store actions', () => { }); describe('receiveDeleteBadge', () => { - it('commits RECEIVE_DELETE_BADGE', done => { + it('commits RECEIVE_DELETE_BADGE', (done) => { testAction( actions.receiveDeleteBadge, badgeId, @@ -167,7 +167,7 @@ describe('Badges store actions', () => { }); describe('receiveDeleteBadgeError', () => { - it('commits RECEIVE_DELETE_BADGE_ERROR', done => { + it('commits RECEIVE_DELETE_BADGE_ERROR', (done) => { testAction( actions.receiveDeleteBadgeError, badgeId, @@ -188,7 +188,7 @@ describe('Badges store actions', () => { dispatch = jest.fn(); }); - it('dispatches requestDeleteBadge and receiveDeleteBadge for successful response', done => { + it('dispatches requestDeleteBadge and receiveDeleteBadge for successful response', (done) => { endpointMock.replyOnce(() => { expect(dispatch.mock.calls).toEqual([['requestDeleteBadge', badgeId]]); dispatch.mockClear(); @@ -204,7 +204,7 @@ describe('Badges store actions', () => { .catch(done.fail); }); - it('dispatches requestDeleteBadge and receiveDeleteBadgeError for error response', done => { + it('dispatches requestDeleteBadge and receiveDeleteBadgeError for error response', (done) => { endpointMock.replyOnce(() => { expect(dispatch.mock.calls).toEqual([['requestDeleteBadge', badgeId]]); dispatch.mockClear(); @@ -223,7 +223,7 @@ describe('Badges store actions', () => { }); describe('editBadge', () => { - it('commits START_EDITING', done => { + it('commits START_EDITING', (done) => { const dummyBadge = createDummyBadge(); testAction( actions.editBadge, @@ -237,7 +237,7 @@ describe('Badges store actions', () => { }); describe('requestLoadBadges', () => { - it('commits REQUEST_LOAD_BADGES', done => { + it('commits REQUEST_LOAD_BADGES', (done) => { const dummyData = 'this is not real data'; testAction( actions.requestLoadBadges, @@ -251,7 +251,7 @@ describe('Badges store actions', () => { }); describe('receiveLoadBadges', () => { - it('commits RECEIVE_LOAD_BADGES', done => { + it('commits RECEIVE_LOAD_BADGES', (done) => { const badges = dummyBadges; testAction( actions.receiveLoadBadges, @@ -265,7 +265,7 @@ describe('Badges store actions', () => { }); describe('receiveLoadBadgesError', () => { - it('commits RECEIVE_LOAD_BADGES_ERROR', done => { + it('commits RECEIVE_LOAD_BADGES_ERROR', (done) => { testAction( actions.receiveLoadBadgesError, null, @@ -286,7 +286,7 @@ describe('Badges store actions', () => { dispatch = jest.fn(); }); - it('dispatches requestLoadBadges and receiveLoadBadges for successful response', done => { + it('dispatches requestLoadBadges and receiveLoadBadges for successful response', (done) => { const dummyData = 'this is just some data'; const dummyReponse = [ createDummyBadgeResponse(), @@ -310,7 +310,7 @@ describe('Badges store actions', () => { .catch(done.fail); }); - it('dispatches requestLoadBadges and receiveLoadBadgesError for error response', done => { + it('dispatches requestLoadBadges and receiveLoadBadgesError for error response', (done) => { const dummyData = 'this is just some data'; endpointMock.replyOnce(() => { expect(dispatch.mock.calls).toEqual([['requestLoadBadges', dummyData]]); @@ -330,7 +330,7 @@ describe('Badges store actions', () => { }); describe('requestRenderedBadge', () => { - it('commits REQUEST_RENDERED_BADGE', done => { + it('commits REQUEST_RENDERED_BADGE', (done) => { testAction( actions.requestRenderedBadge, null, @@ -343,7 +343,7 @@ describe('Badges store actions', () => { }); describe('receiveRenderedBadge', () => { - it('commits RECEIVE_RENDERED_BADGE', done => { + it('commits RECEIVE_RENDERED_BADGE', (done) => { const dummyBadge = createDummyBadge(); testAction( actions.receiveRenderedBadge, @@ -357,7 +357,7 @@ describe('Badges store actions', () => { }); describe('receiveRenderedBadgeError', () => { - it('commits RECEIVE_RENDERED_BADGE_ERROR', done => { + it('commits RECEIVE_RENDERED_BADGE_ERROR', (done) => { testAction( actions.receiveRenderedBadgeError, null, @@ -388,7 +388,7 @@ describe('Badges store actions', () => { dispatch = jest.fn(); }); - it('returns immediately if imageUrl is empty', done => { + it('returns immediately if imageUrl is empty', (done) => { jest.spyOn(axios, 'get').mockImplementation(() => {}); badgeInForm.imageUrl = ''; @@ -401,7 +401,7 @@ describe('Badges store actions', () => { .catch(done.fail); }); - it('returns immediately if linkUrl is empty', done => { + it('returns immediately if linkUrl is empty', (done) => { jest.spyOn(axios, 'get').mockImplementation(() => {}); badgeInForm.linkUrl = ''; @@ -414,7 +414,7 @@ describe('Badges store actions', () => { .catch(done.fail); }); - it('escapes user input', done => { + it('escapes user input', (done) => { jest .spyOn(axios, 'get') .mockImplementation(() => Promise.resolve({ data: createDummyBadgeResponse() })); @@ -437,7 +437,7 @@ describe('Badges store actions', () => { .catch(done.fail); }); - it('dispatches requestRenderedBadge and receiveRenderedBadge for successful response', done => { + it('dispatches requestRenderedBadge and receiveRenderedBadge for successful response', (done) => { const dummyReponse = createDummyBadgeResponse(); endpointMock.replyOnce(() => { expect(dispatch.mock.calls).toEqual([['requestRenderedBadge']]); @@ -456,7 +456,7 @@ describe('Badges store actions', () => { .catch(done.fail); }); - it('dispatches requestRenderedBadge and receiveRenderedBadgeError for error response', done => { + it('dispatches requestRenderedBadge and receiveRenderedBadgeError for error response', (done) => { endpointMock.replyOnce(() => { expect(dispatch.mock.calls).toEqual([['requestRenderedBadge']]); dispatch.mockClear(); @@ -475,7 +475,7 @@ describe('Badges store actions', () => { }); describe('requestUpdatedBadge', () => { - it('commits REQUEST_UPDATED_BADGE', done => { + it('commits REQUEST_UPDATED_BADGE', (done) => { testAction( actions.requestUpdatedBadge, null, @@ -488,7 +488,7 @@ describe('Badges store actions', () => { }); describe('receiveUpdatedBadge', () => { - it('commits RECEIVE_UPDATED_BADGE', done => { + it('commits RECEIVE_UPDATED_BADGE', (done) => { const updatedBadge = createDummyBadge(); testAction( actions.receiveUpdatedBadge, @@ -502,7 +502,7 @@ describe('Badges store actions', () => { }); describe('receiveUpdatedBadgeError', () => { - it('commits RECEIVE_UPDATED_BADGE_ERROR', done => { + it('commits RECEIVE_UPDATED_BADGE_ERROR', (done) => { testAction( actions.receiveUpdatedBadgeError, null, @@ -529,10 +529,10 @@ describe('Badges store actions', () => { dispatch = jest.fn(); }); - it('dispatches requestUpdatedBadge and receiveUpdatedBadge for successful response', done => { + it('dispatches requestUpdatedBadge and receiveUpdatedBadge for successful response', (done) => { const dummyResponse = createDummyBadgeResponse(); - endpointMock.replyOnce(req => { + endpointMock.replyOnce((req) => { expect(req.data).toBe( JSON.stringify({ name: 'TestBadge', @@ -556,8 +556,8 @@ describe('Badges store actions', () => { .catch(done.fail); }); - it('dispatches requestUpdatedBadge and receiveUpdatedBadgeError for error response', done => { - endpointMock.replyOnce(req => { + it('dispatches requestUpdatedBadge and receiveUpdatedBadgeError for error response', (done) => { + endpointMock.replyOnce((req) => { expect(req.data).toBe( JSON.stringify({ name: 'TestBadge', @@ -583,7 +583,7 @@ describe('Badges store actions', () => { }); describe('stopEditing', () => { - it('commits STOP_EDITING', done => { + it('commits STOP_EDITING', (done) => { testAction( actions.stopEditing, null, @@ -596,7 +596,7 @@ describe('Badges store actions', () => { }); describe('updateBadgeInForm', () => { - it('commits UPDATE_BADGE_IN_FORM', done => { + it('commits UPDATE_BADGE_IN_FORM', (done) => { const dummyBadge = createDummyBadge(); testAction( actions.updateBadgeInForm, @@ -609,7 +609,7 @@ describe('Badges store actions', () => { }); describe('updateBadgeInModal', () => { - it('commits UPDATE_BADGE_IN_MODAL', done => { + it('commits UPDATE_BADGE_IN_MODAL', (done) => { const dummyBadge = createDummyBadge(); testAction( actions.updateBadgeInModal, diff --git a/spec/frontend/batch_comments/components/draft_note_spec.js b/spec/frontend/batch_comments/components/draft_note_spec.js index 99980c98f8b..ae7134b63c8 100644 --- a/spec/frontend/batch_comments/components/draft_note_spec.js +++ b/spec/frontend/batch_comments/components/draft_note_spec.js @@ -65,7 +65,7 @@ describe('Batch comments draft note component', () => { ); }); - it('sets as loading when draft is publishing', done => { + it('sets as loading when draft is publishing', (done) => { createComponent(); wrapper.vm.$store.state.batchComments.currentlyPublishingDrafts.push(1); @@ -80,7 +80,7 @@ describe('Batch comments draft note component', () => { }); describe('update', () => { - it('dispatches updateDraft', done => { + it('dispatches updateDraft', (done) => { createComponent(); const note = wrapper.find(NoteableNote); @@ -121,7 +121,7 @@ describe('Batch comments draft note component', () => { }); describe('quick actions', () => { - it('renders referenced commands', done => { + it('renders referenced commands', (done) => { createComponent(); wrapper.setProps({ draft: { diff --git a/spec/frontend/batch_comments/components/drafts_count_spec.js b/spec/frontend/batch_comments/components/drafts_count_spec.js index 83d2f9eb639..5f74de9c014 100644 --- a/spec/frontend/batch_comments/components/drafts_count_spec.js +++ b/spec/frontend/batch_comments/components/drafts_count_spec.js @@ -27,7 +27,7 @@ describe('Batch comments drafts count component', () => { expect(vm.$el.textContent).toContain('1'); }); - it('renders screen reader text', done => { + it('renders screen reader text', (done) => { const el = vm.$el.querySelector('.sr-only'); expect(el.textContent).toContain('draft'); diff --git a/spec/frontend/batch_comments/components/preview_item_spec.js b/spec/frontend/batch_comments/components/preview_item_spec.js index 8ddad3dacfe..173b2710a30 100644 --- a/spec/frontend/batch_comments/components/preview_item_spec.js +++ b/spec/frontend/batch_comments/components/preview_item_spec.js @@ -85,7 +85,7 @@ describe('Batch comments draft preview item component', () => { describe('for thread', () => { beforeEach(() => { - createComponent(false, { discussion_id: '1', resolve_discussion: true }, store => { + createComponent(false, { discussion_id: '1', resolve_discussion: true }, (store) => { store.state.notes.discussions.push({ id: '1', notes: [ diff --git a/spec/frontend/batch_comments/components/publish_button_spec.js b/spec/frontend/batch_comments/components/publish_button_spec.js index 4032713150c..eca424814b4 100644 --- a/spec/frontend/batch_comments/components/publish_button_spec.js +++ b/spec/frontend/batch_comments/components/publish_button_spec.js @@ -29,7 +29,7 @@ describe('Batch comments publish button component', () => { expect(vm.$store.dispatch).toHaveBeenCalledWith('batchComments/publishReview', undefined); }); - it('sets loading when isPublishing is true', done => { + it('sets loading when isPublishing is true', (done) => { vm.$store.state.batchComments.isPublishing = true; vm.$nextTick(() => { diff --git a/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js b/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js index e66f36aa3a2..f774b332c68 100644 --- a/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js +++ b/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js @@ -28,7 +28,7 @@ describe('Batch comments store actions', () => { }); describe('addDraftToDiscussion', () => { - it('commits ADD_NEW_DRAFT if no errors returned', done => { + it('commits ADD_NEW_DRAFT if no errors returned', (done) => { res = { id: 1 }; mock.onAny().reply(200, res); @@ -42,7 +42,7 @@ describe('Batch comments store actions', () => { ); }); - it('does not commit ADD_NEW_DRAFT if errors returned', done => { + it('does not commit ADD_NEW_DRAFT if errors returned', (done) => { mock.onAny().reply(500); testAction( @@ -57,7 +57,7 @@ describe('Batch comments store actions', () => { }); describe('createNewDraft', () => { - it('commits ADD_NEW_DRAFT if no errors returned', done => { + it('commits ADD_NEW_DRAFT if no errors returned', (done) => { res = { id: 1 }; mock.onAny().reply(200, res); @@ -71,7 +71,7 @@ describe('Batch comments store actions', () => { ); }); - it('does not commit ADD_NEW_DRAFT if errors returned', done => { + it('does not commit ADD_NEW_DRAFT if errors returned', (done) => { mock.onAny().reply(500); testAction(actions.createNewDraft, { endpoint: TEST_HOST, data: 'test' }, null, [], [], done); @@ -89,7 +89,7 @@ describe('Batch comments store actions', () => { }; }); - it('commits DELETE_DRAFT if no errors returned', done => { + it('commits DELETE_DRAFT if no errors returned', (done) => { const commit = jest.fn(); const context = { getters, @@ -107,7 +107,7 @@ describe('Batch comments store actions', () => { .catch(done.fail); }); - it('does not commit DELETE_DRAFT if errors returned', done => { + it('does not commit DELETE_DRAFT if errors returned', (done) => { const commit = jest.fn(); const context = { getters, @@ -136,7 +136,7 @@ describe('Batch comments store actions', () => { }; }); - it('commits SET_BATCH_COMMENTS_DRAFTS with returned data', done => { + it('commits SET_BATCH_COMMENTS_DRAFTS with returned data', (done) => { const commit = jest.fn(); const context = { getters, @@ -170,7 +170,7 @@ describe('Batch comments store actions', () => { rootGetters = { discussionsStructuredByLineCode: 'discussions' }; }); - it('dispatches actions & commits', done => { + it('dispatches actions & commits', (done) => { mock.onAny().reply(200); actions @@ -185,7 +185,7 @@ describe('Batch comments store actions', () => { .catch(done.fail); }); - it('dispatches error commits', done => { + it('dispatches error commits', (done) => { mock.onAny().reply(500); actions @@ -210,7 +210,7 @@ describe('Batch comments store actions', () => { }; }); - it('commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data', done => { + it('commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data', (done) => { const commit = jest.fn(); const context = { getters, @@ -228,7 +228,7 @@ describe('Batch comments store actions', () => { .catch(done.fail); }); - it('calls passed callback', done => { + it('calls passed callback', (done) => { const commit = jest.fn(); const context = { getters, @@ -249,7 +249,7 @@ describe('Batch comments store actions', () => { }); describe('expandAllDiscussions', () => { - it('dispatches expandDiscussion for all drafts', done => { + it('dispatches expandDiscussion for all drafts', (done) => { const state = { drafts: [ { diff --git a/spec/frontend/behaviors/autosize_spec.js b/spec/frontend/behaviors/autosize_spec.js index 3444c7b4075..352bd8a0ed0 100644 --- a/spec/frontend/behaviors/autosize_spec.js +++ b/spec/frontend/behaviors/autosize_spec.js @@ -6,7 +6,7 @@ function load() { jest.mock('~/helpers/startup_css_helper', () => { return { - waitForCSSLoaded: jest.fn().mockImplementation(cb => cb.apply()), + waitForCSSLoaded: jest.fn().mockImplementation((cb) => cb.apply()), }; }); diff --git a/spec/frontend/behaviors/copy_as_gfm_spec.js b/spec/frontend/behaviors/copy_as_gfm_spec.js index 46d4451c941..16ea4ba8624 100644 --- a/spec/frontend/behaviors/copy_as_gfm_spec.js +++ b/spec/frontend/behaviors/copy_as_gfm_spec.js @@ -57,7 +57,7 @@ describe('CopyAsGFM', () => { const fragment = document.createDocumentFragment(); const node = document.createElement('div'); node.innerHTML = html; - Array.from(node.childNodes).forEach(item => fragment.appendChild(item)); + Array.from(node.childNodes).forEach((item) => fragment.appendChild(item)); return fragment; }, }), @@ -80,7 +80,7 @@ describe('CopyAsGFM', () => { return clipboardData; }; - beforeAll(done => { + beforeAll((done) => { initCopyAsGFM(); // Fake call to nodeToGfm so the import of lazy bundle happened @@ -94,7 +94,7 @@ describe('CopyAsGFM', () => { beforeEach(() => jest.spyOn(clipboardData, 'setData')); describe('list handling', () => { - it('uses correct gfm for unordered lists', done => { + it('uses correct gfm for unordered lists', (done) => { const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'UL'); window.getSelection = jest.fn(() => selection); @@ -108,7 +108,7 @@ describe('CopyAsGFM', () => { }); }); - it('uses correct gfm for ordered lists', done => { + it('uses correct gfm for ordered lists', (done) => { const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'OL'); window.getSelection = jest.fn(() => selection); @@ -127,7 +127,7 @@ describe('CopyAsGFM', () => { describe('CopyAsGFM.quoted', () => { const sampleGFM = '* List 1\n* List 2\n\n`Some code`'; - it('adds quote char `> ` to each line', done => { + it('adds quote char `> ` to each line', (done) => { const expectedQuotedGFM = '> * List 1\n> * List 2\n> \n> `Some code`'; expect(CopyAsGFM.quoted(sampleGFM)).toEqual(expectedQuotedGFM); done(); diff --git a/spec/frontend/behaviors/load_startup_css_spec.js b/spec/frontend/behaviors/load_startup_css_spec.js index 81222ac5aaa..59f49585645 100644 --- a/spec/frontend/behaviors/load_startup_css_spec.js +++ b/spec/frontend/behaviors/load_startup_css_spec.js @@ -7,7 +7,7 @@ describe('behaviors/load_startup_css', () => { const setupListeners = () => { document .querySelectorAll('link') - .forEach(x => x.addEventListener('load', () => loadListener(x))); + .forEach((x) => x.addEventListener('load', () => loadListener(x))); }; beforeEach(() => { diff --git a/spec/frontend/behaviors/markdown/paste_markdown_table_spec.js b/spec/frontend/behaviors/markdown/paste_markdown_table_spec.js index eab805382bd..7044618fd9e 100644 --- a/spec/frontend/behaviors/markdown/paste_markdown_table_spec.js +++ b/spec/frontend/behaviors/markdown/paste_markdown_table_spec.js @@ -8,7 +8,7 @@ describe('PasteMarkdownTable', () => { Object.defineProperty(event, 'dataTransfer', { value: { - getData: jest.fn().mockImplementation(type => { + getData: jest.fn().mockImplementation((type) => { if (type === 'text/html') { return '<table><tr><td>First</td><td>Second</td></tr></table>'; } @@ -48,7 +48,7 @@ describe('PasteMarkdownTable', () => { it('returns false when the number of rows are not consistent', () => { data.types = ['text/html', 'text/plain']; - data.getData = jest.fn().mockImplementation(mimeType => { + data.getData = jest.fn().mockImplementation((mimeType) => { if (mimeType === 'text/html') { return '<table><tr><td>def test<td></tr></table>'; } @@ -60,7 +60,7 @@ describe('PasteMarkdownTable', () => { it('returns false when the table copy comes from a diff', () => { data.types = ['text/html', 'text/plain']; - data.getData = jest.fn().mockImplementation(mimeType => { + data.getData = jest.fn().mockImplementation((mimeType) => { if (mimeType === 'text/html') { return '<table class="diff-wrap-lines"><tr><td>First</td><td>Second</td></tr></table>'; } @@ -74,7 +74,7 @@ describe('PasteMarkdownTable', () => { describe('convertToTableMarkdown', () => { it('returns a Markdown table', () => { data.types = ['text/html', 'text/plain']; - data.getData = jest.fn().mockImplementation(type => { + data.getData = jest.fn().mockImplementation((type) => { if (type === 'text/html') { return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>Doe</td></table>'; } else if (type === 'text/plain') { @@ -99,7 +99,7 @@ describe('PasteMarkdownTable', () => { it('returns a Markdown table with rows normalized', () => { data.types = ['text/html', 'text/plain']; - data.getData = jest.fn().mockImplementation(type => { + data.getData = jest.fn().mockImplementation((type) => { if (type === 'text/html') { return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>/td></table>'; } else if (type === 'text/plain') { diff --git a/spec/frontend/behaviors/quick_submit_spec.js b/spec/frontend/behaviors/quick_submit_spec.js index 2dc2bb198e8..d3d65892aff 100644 --- a/spec/frontend/behaviors/quick_submit_spec.js +++ b/spec/frontend/behaviors/quick_submit_spec.js @@ -17,7 +17,7 @@ describe('Quick Submit behavior', () => { submit: jest.fn(), }; - $('form').submit(e => { + $('form').submit((e) => { // Prevent a form submit from moving us off the testing page e.preventDefault(); // Explicitly call the spie to know this function get's not called diff --git a/spec/frontend/behaviors/secret_values_spec.js b/spec/frontend/behaviors/secret_values_spec.js index 5aaab093c0c..06155017dd1 100644 --- a/spec/frontend/behaviors/secret_values_spec.js +++ b/spec/frontend/behaviors/secret_values_spec.js @@ -18,7 +18,7 @@ function generateValueMarkup( function generateFixtureMarkup(secrets, isRevealed, valueClass, placeholderClass) { return ` <div class="js-secret-container"> - ${secrets.map(secret => generateValueMarkup(secret, valueClass, placeholderClass)).join('')} + ${secrets.map((secret) => generateValueMarkup(secret, valueClass, placeholderClass)).join('')} <button class="js-secret-value-reveal-button" data-secret-reveal-status="${isRevealed}" @@ -122,12 +122,12 @@ describe('setupSecretValues', () => { const placeholders = wrapper.querySelectorAll('.js-secret-value-placeholder'); expect(values.length).toEqual(3); - values.forEach(value => { + values.forEach((value) => { expect(value.classList.contains('hide')).toEqual(true); }); expect(placeholders.length).toEqual(3); - placeholders.forEach(placeholder => { + placeholders.forEach((placeholder) => { expect(placeholder.classList.contains('hide')).toEqual(false); }); }); @@ -141,24 +141,24 @@ describe('setupSecretValues', () => { revealButton.click(); expect(values.length).toEqual(3); - values.forEach(value => { + values.forEach((value) => { expect(value.classList.contains('hide')).toEqual(false); }); expect(placeholders.length).toEqual(3); - placeholders.forEach(placeholder => { + placeholders.forEach((placeholder) => { expect(placeholder.classList.contains('hide')).toEqual(true); }); revealButton.click(); expect(values.length).toEqual(3); - values.forEach(value => { + values.forEach((value) => { expect(value.classList.contains('hide')).toEqual(true); }); expect(placeholders.length).toEqual(3); - placeholders.forEach(placeholder => { + placeholders.forEach((placeholder) => { expect(placeholder.classList.contains('hide')).toEqual(false); }); }); @@ -181,24 +181,24 @@ describe('setupSecretValues', () => { revealButton.click(); expect(values.length).toEqual(4); - values.forEach(value => { + values.forEach((value) => { expect(value.classList.contains('hide')).toEqual(false); }); expect(placeholders.length).toEqual(4); - placeholders.forEach(placeholder => { + placeholders.forEach((placeholder) => { expect(placeholder.classList.contains('hide')).toEqual(true); }); revealButton.click(); expect(values.length).toEqual(4); - values.forEach(value => { + values.forEach((value) => { expect(value.classList.contains('hide')).toEqual(true); }); expect(placeholders.length).toEqual(4); - placeholders.forEach(placeholder => { + placeholders.forEach((placeholder) => { expect(placeholder.classList.contains('hide')).toEqual(false); }); }); diff --git a/spec/frontend/behaviors/shortcuts/keybindings_spec.js b/spec/frontend/behaviors/shortcuts/keybindings_spec.js index 23fea79f828..d05b3fbdce2 100644 --- a/spec/frontend/behaviors/shortcuts/keybindings_spec.js +++ b/spec/frontend/behaviors/shortcuts/keybindings_spec.js @@ -9,7 +9,7 @@ describe('~/behaviors/shortcuts/keybindings.js', () => { useLocalStorageSpy(); }); - const setupCustomizations = async customizationsAsString => { + const setupCustomizations = async (customizationsAsString) => { localStorage.clear(); if (customizationsAsString) { diff --git a/spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js b/spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js index 77dcc28dd48..94ba1615c89 100644 --- a/spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js +++ b/spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js @@ -15,7 +15,7 @@ describe('ShortcutsIssuable', () => { preloadFixtures(snippetShowFixtureName, mrShowFixtureName); - beforeAll(done => { + beforeAll((done) => { initCopyAsGFM(); // Fake call to nodeToGfm so the import of lazy bundle happened @@ -81,7 +81,7 @@ describe('ShortcutsIssuable', () => { stubSelection('<p>Selected text.</p>'); }); - it('leaves existing input intact', done => { + it('leaves existing input intact', (done) => { $(FORM_SELECTOR).val('This text was already here.'); expect($(FORM_SELECTOR).val()).toBe('This text was already here.'); @@ -96,7 +96,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('triggers `input`', done => { + it('triggers `input`', (done) => { let triggered = false; $(FORM_SELECTOR).on('input', () => { triggered = true; @@ -110,7 +110,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('triggers `focus`', done => { + it('triggers `focus`', (done) => { const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); ShortcutsIssuable.replyWithSelectedText(true); @@ -122,7 +122,7 @@ describe('ShortcutsIssuable', () => { }); describe('with a one-line selection', () => { - it('quotes the selection', done => { + it('quotes the selection', (done) => { stubSelection('<p>This text has been selected.</p>'); ShortcutsIssuable.replyWithSelectedText(true); @@ -134,7 +134,7 @@ describe('ShortcutsIssuable', () => { }); describe('with a multi-line selection', () => { - it('quotes the selected lines as a group', done => { + it('quotes the selected lines as a group', (done) => { stubSelection( '<p>Selected line one.</p>\n<p>Selected line two.</p>\n<p>Selected line three.</p>', ); @@ -154,7 +154,7 @@ describe('ShortcutsIssuable', () => { stubSelection('<p>Selected text.</p>', true); }); - it('does not add anything to the input', done => { + it('does not add anything to the input', (done) => { ShortcutsIssuable.replyWithSelectedText(true); setImmediate(() => { @@ -163,7 +163,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('triggers `focus`', done => { + it('triggers `focus`', (done) => { const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); ShortcutsIssuable.replyWithSelectedText(true); @@ -179,7 +179,7 @@ describe('ShortcutsIssuable', () => { stubSelection('<div class="md">Selected text.</div><p>Invalid selected text.</p>', true); }); - it('only adds the valid part to the input', done => { + it('only adds the valid part to the input', (done) => { ShortcutsIssuable.replyWithSelectedText(true); setImmediate(() => { @@ -188,7 +188,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('triggers `focus`', done => { + it('triggers `focus`', (done) => { const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); ShortcutsIssuable.replyWithSelectedText(true); @@ -198,7 +198,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('triggers `input`', done => { + it('triggers `input`', (done) => { let triggered = false; $(FORM_SELECTOR).on('input', () => { triggered = true; @@ -233,7 +233,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('adds the quoted selection to the input', done => { + it('adds the quoted selection to the input', (done) => { ShortcutsIssuable.replyWithSelectedText(true); setImmediate(() => { @@ -242,7 +242,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('triggers `focus`', done => { + it('triggers `focus`', (done) => { const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); ShortcutsIssuable.replyWithSelectedText(true); @@ -252,7 +252,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('triggers `input`', done => { + it('triggers `input`', (done) => { let triggered = false; $(FORM_SELECTOR).on('input', () => { triggered = true; @@ -287,7 +287,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('does not add anything to the input', done => { + it('does not add anything to the input', (done) => { ShortcutsIssuable.replyWithSelectedText(true); setImmediate(() => { @@ -296,7 +296,7 @@ describe('ShortcutsIssuable', () => { }); }); - it('triggers `focus`', done => { + it('triggers `focus`', (done) => { const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); ShortcutsIssuable.replyWithSelectedText(true); @@ -308,7 +308,7 @@ describe('ShortcutsIssuable', () => { }); describe('with a valid selection with no text content', () => { - it('returns the proper markdown', done => { + it('returns the proper markdown', (done) => { stubSelection('<img src="https://gitlab.com/logo.png" alt="logo" />'); ShortcutsIssuable.replyWithSelectedText(true); @@ -334,7 +334,7 @@ describe('ShortcutsIssuable', () => { '.sidebar-source-branch button', ); - [sidebarCollapsedBtn, sidebarExpandedBtn].forEach(btn => jest.spyOn(btn, 'click')); + [sidebarCollapsedBtn, sidebarExpandedBtn].forEach((btn) => jest.spyOn(btn, 'click')); }); afterEach(() => { diff --git a/spec/frontend/blob/components/blob_content_error_spec.js b/spec/frontend/blob/components/blob_content_error_spec.js index 0c6d269ad05..95686be8294 100644 --- a/spec/frontend/blob/components/blob_content_error_spec.js +++ b/spec/frontend/blob/components/blob_content_error_spec.js @@ -32,7 +32,7 @@ describe('Blob Content Error component', () => { viewerError: error.id, }); expect(wrapper.text()).toContain(reason); - options.forEach(option => { + options.forEach((option) => { expect(wrapper.text()).toContain(option); }); }); @@ -52,7 +52,7 @@ describe('Blob Content Error component', () => { }, }); expect(wrapper.text()).toContain(reason); - options.forEach(option => { + options.forEach((option) => { expect(wrapper.text()).toContain(option); }); }); diff --git a/spec/frontend/blob/components/blob_edit_content_spec.js b/spec/frontend/blob/components/blob_edit_content_spec.js index dbed086a552..7de8d9236ed 100644 --- a/spec/frontend/blob/components/blob_edit_content_spec.js +++ b/spec/frontend/blob/components/blob_edit_content_spec.js @@ -40,7 +40,7 @@ describe('Blob Header Editing', () => { wrapper.destroy(); }); - const triggerChangeContent = val => { + const triggerChangeContent = (val) => { getValue.mockReturnValue(val); const [cb] = onDidChangeModelContent.mock.calls[0]; diff --git a/spec/frontend/blob/components/blob_edit_header_spec.js b/spec/frontend/blob/components/blob_edit_header_spec.js index 4355f46db7e..22e8e6d986c 100644 --- a/spec/frontend/blob/components/blob_edit_header_spec.js +++ b/spec/frontend/blob/components/blob_edit_header_spec.js @@ -15,7 +15,7 @@ describe('Blob Header Editing', () => { }); }; const findDeleteButton = () => - wrapper.findAll(GlButton).wrappers.find(x => x.text() === 'Delete file'); + wrapper.findAll(GlButton).wrappers.find((x) => x.text() === 'Delete file'); beforeEach(() => { createComponent(); diff --git a/spec/frontend/blob/components/blob_header_spec.js b/spec/frontend/blob/components/blob_header_spec.js index 3e84347bee4..b3f80183f6b 100644 --- a/spec/frontend/blob/components/blob_header_spec.js +++ b/spec/frontend/blob/components/blob_header_spec.js @@ -75,7 +75,7 @@ describe('Blob Header Default Actions', () => { expect(wrapper.find(DefaultActions).exists()).toBe(false); }); - Object.keys(slots).forEach(slot => { + Object.keys(slots).forEach((slot) => { it('renders the slots', () => { const slotContent = slots[slot]; createComponent( diff --git a/spec/frontend/blob/sketch/index_spec.js b/spec/frontend/blob/sketch/index_spec.js index cd12d5e17a8..a24e7de9037 100644 --- a/spec/frontend/blob/sketch/index_spec.js +++ b/spec/frontend/blob/sketch/index_spec.js @@ -11,7 +11,7 @@ describe('Sketch viewer', () => { }); describe('with error message', () => { - beforeEach(done => { + beforeEach((done) => { jest.spyOn(SketchLoader.prototype, 'getZipFile').mockImplementation( () => new Promise((resolve, reject) => { @@ -37,7 +37,7 @@ describe('Sketch viewer', () => { }); describe('success', () => { - beforeEach(done => { + beforeEach((done) => { const loadAsyncMock = { files: { 'previews/preview.png': { @@ -48,7 +48,7 @@ describe('Sketch viewer', () => { loadAsyncMock.files['previews/preview.png'].async.mockImplementation( () => - new Promise(resolve => { + new Promise((resolve) => { resolve('foo'); done(); }), diff --git a/spec/frontend/blob/utils_spec.js b/spec/frontend/blob/utils_spec.js index ab9e325e963..fa83690c104 100644 --- a/spec/frontend/blob/utils_spec.js +++ b/spec/frontend/blob/utils_spec.js @@ -26,7 +26,7 @@ describe('Blob utilities', () => { it.each([[{}], [{ blobPath, blobContent, blobGlobalId }]])( 'creates the instance with the passed parameters %s', - extraParams => { + (extraParams) => { const params = { el: editorEl, ...extraParams, diff --git a/spec/frontend/blob/viewer/index_spec.js b/spec/frontend/blob/viewer/index_spec.js index a4b4044f5f9..4a5eb31602d 100644 --- a/spec/frontend/blob/viewer/index_spec.js +++ b/spec/frontend/blob/viewer/index_spec.js @@ -37,7 +37,7 @@ describe('Blob viewer', () => { window.location.hash = ''; }); - it('loads source file after switching views', done => { + it('loads source file after switching views', (done) => { document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); setImmediate(() => { @@ -51,7 +51,7 @@ describe('Blob viewer', () => { }); }); - it('loads source file when line number is in hash', done => { + it('loads source file when line number is in hash', (done) => { window.location.hash = '#L1'; new BlobViewer(); @@ -117,7 +117,7 @@ describe('Blob viewer', () => { expect(copyButton.blur).not.toHaveBeenCalled(); }); - it('enables after switching to simple view', done => { + it('enables after switching to simple view', (done) => { document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); setImmediate(() => { @@ -127,7 +127,7 @@ describe('Blob viewer', () => { }); }); - it('updates tooltip after switching to simple view', done => { + it('updates tooltip after switching to simple view', (done) => { document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); setImmediate(() => { @@ -171,7 +171,7 @@ describe('Blob viewer', () => { ${['simple', 'rich']} `('when view switches to $views', ({ views }) => { beforeEach(async () => { - views.forEach(view => blob.switchToViewer(view)); + views.forEach((view) => blob.switchToViewer(view)); await axios.waitForAll(); }); diff --git a/spec/frontend/blob_edit/edit_blob_spec.js b/spec/frontend/blob_edit/edit_blob_spec.js index 9637ea09a3a..f1f22010a2a 100644 --- a/spec/frontend/blob_edit/edit_blob_spec.js +++ b/spec/frontend/blob_edit/edit_blob_spec.js @@ -31,7 +31,7 @@ describe('Blob Editing', () => { FileTemplateExtension.mockClear(); }); - const editorInst = isMarkdown => { + const editorInst = (isMarkdown) => { return new EditBlob({ isMarkdown, }); diff --git a/spec/frontend/boards/board_list_new_spec.js b/spec/frontend/boards/board_list_new_spec.js index 96b03ed927e..56784611322 100644 --- a/spec/frontend/boards/board_list_new_spec.js +++ b/spec/frontend/boards/board_list_new_spec.js @@ -82,7 +82,7 @@ const createComponent = ({ describe('Board list component', () => { let wrapper; - const findByTestId = testId => wrapper.find(`[data-testid="${testId}"]`); + const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`); useFakeRequestAnimationFrame(); afterEach(() => { diff --git a/spec/frontend/boards/board_list_spec.js b/spec/frontend/boards/board_list_spec.js index 0fe3c88f518..257ea887eb8 100644 --- a/spec/frontend/boards/board_list_spec.js +++ b/spec/frontend/boards/board_list_spec.js @@ -72,7 +72,7 @@ describe('Board list component', () => { } describe('When Expanded', () => { - beforeEach(done => { + beforeEach((done) => { getIssues = jest.spyOn(List.prototype, 'getIssues').mockReturnValue(new Promise(() => {})); ({ mock, component } = createComponent({ done })); }); @@ -204,7 +204,7 @@ describe('Board list component', () => { }); describe('When Collapsed', () => { - beforeEach(done => { + beforeEach((done) => { getIssues = jest.spyOn(List.prototype, 'getIssues').mockReturnValue(new Promise(() => {})); ({ mock, component } = createComponent({ done, @@ -228,7 +228,7 @@ describe('Board list component', () => { }); describe('max issue count warning', () => { - beforeEach(done => { + beforeEach((done) => { ({ mock, component } = createComponent({ done, listProps: { type: 'closed', collapsed: true, issuesSize: 50 }, diff --git a/spec/frontend/boards/boards_store_spec.js b/spec/frontend/boards/boards_store_spec.js index c89f6d22ef2..09a5535537e 100644 --- a/spec/frontend/boards/boards_store_spec.js +++ b/spec/frontend/boards/boards_store_spec.js @@ -77,7 +77,7 @@ describe('boardsStore', () => { beforeEach(() => { requestSpy = jest.fn(); - axiosMock.onPost(endpoints.listsEndpoint).replyOnce(config => requestSpy(config)); + axiosMock.onPost(endpoints.listsEndpoint).replyOnce((config) => requestSpy(config)); }); it('makes a request to create a list', () => { @@ -114,7 +114,7 @@ describe('boardsStore', () => { beforeEach(() => { requestSpy = jest.fn(); - axiosMock.onPut(`${endpoints.listsEndpoint}/${id}`).replyOnce(config => requestSpy(config)); + axiosMock.onPut(`${endpoints.listsEndpoint}/${id}`).replyOnce((config) => requestSpy(config)); }); it('makes a request to update a list position', () => { @@ -148,7 +148,7 @@ describe('boardsStore', () => { requestSpy = jest.fn(); axiosMock .onDelete(`${endpoints.listsEndpoint}/${id}`) - .replyOnce(config => requestSpy(config)); + .replyOnce((config) => requestSpy(config)); }); it('makes a request to delete a list', () => { @@ -269,7 +269,7 @@ describe('boardsStore', () => { requestSpy = jest.fn(); axiosMock .onPut(`${urlRoot}/-/boards/${boardId}/issues/${id}`) - .replyOnce(config => requestSpy(config)); + .replyOnce((config) => requestSpy(config)); }); it('makes a request to move an issue between lists', () => { @@ -308,7 +308,7 @@ describe('boardsStore', () => { beforeEach(() => { requestSpy = jest.fn(); - axiosMock.onPost(url).replyOnce(config => requestSpy(config)); + axiosMock.onPost(url).replyOnce((config) => requestSpy(config)); }); it('makes a request to create a new issue', () => { @@ -378,7 +378,7 @@ describe('boardsStore', () => { beforeEach(() => { requestSpy = jest.fn(); - axiosMock.onPost(endpoints.bulkUpdatePath).replyOnce(config => requestSpy(config)); + axiosMock.onPost(endpoints.bulkUpdatePath).replyOnce((config) => requestSpy(config)); }); it('makes a request to create a list', () => { diff --git a/spec/frontend/boards/components/board_assignee_dropdown_spec.js b/spec/frontend/boards/components/board_assignee_dropdown_spec.js index 1797437d282..2c1ea619741 100644 --- a/spec/frontend/boards/components/board_assignee_dropdown_spec.js +++ b/spec/frontend/boards/components/board_assignee_dropdown_spec.js @@ -93,8 +93,8 @@ describe('BoardCardAssigneeDropdown', () => { await wrapper.vm.$nextTick(); }; - const findByText = text => { - return wrapper.findAll(GlDropdownItem).wrappers.find(node => node.text().indexOf(text) === 0); + const findByText = (text) => { + return wrapper.findAll(GlDropdownItem).wrappers.find((node) => node.text().indexOf(text) === 0); }; const findLoadingIcon = () => wrapper.find(GlLoadingIcon); diff --git a/spec/frontend/boards/components/board_card_layout_spec.js b/spec/frontend/boards/components/board_card_layout_spec.js index c3204a3064b..d627f971724 100644 --- a/spec/frontend/boards/components/board_card_layout_spec.js +++ b/spec/frontend/boards/components/board_card_layout_spec.js @@ -22,7 +22,7 @@ describe('Board card layout', () => { let list; // this particular mount component needs to be used after the root beforeEach because it depends on list being initialized - const mountComponent = propsData => { + const mountComponent = (propsData) => { wrapper = shallowMount(BoardCardLayout, { stubs: { issueCardInner, diff --git a/spec/frontend/boards/components/board_card_spec.js b/spec/frontend/boards/components/board_card_spec.js index e600bc8704d..1084009caad 100644 --- a/spec/frontend/boards/components/board_card_spec.js +++ b/spec/frontend/boards/components/board_card_spec.js @@ -29,7 +29,7 @@ describe('BoardCard', () => { const findUserAvatarLink = () => wrapper.find(userAvatarLink); // this particular mount component needs to be used after the root beforeEach because it depends on list being initialized - const mountComponent = propsData => { + const mountComponent = (propsData) => { wrapper = mount(BoardCard, { stubs: { issueCardInner, diff --git a/spec/frontend/boards/components/board_list_header_new_spec.js b/spec/frontend/boards/components/board_list_header_new_spec.js index 7428dfae83f..7fae2108e52 100644 --- a/spec/frontend/boards/components/board_list_header_new_spec.js +++ b/spec/frontend/boards/components/board_list_header_new_spec.js @@ -80,13 +80,13 @@ describe('Board List Header Component', () => { const hasNoAddButton = [ListType.closed]; const hasAddButton = [ListType.backlog, ListType.label, ListType.milestone, ListType.assignee]; - it.each(hasNoAddButton)('does not render when List Type is `%s`', listType => { + it.each(hasNoAddButton)('does not render when List Type is `%s`', (listType) => { createComponent({ listType }); expect(findAddIssueButton().exists()).toBe(false); }); - it.each(hasAddButton)('does render when List Type is `%s`', listType => { + it.each(hasAddButton)('does render when List Type is `%s`', (listType) => { createComponent({ listType }); expect(findAddIssueButton().exists()).toBe(true); @@ -95,7 +95,7 @@ describe('Board List Header Component', () => { it('has a test for each list type', () => { createComponent(); - Object.values(ListType).forEach(value => { + Object.values(ListType).forEach((value) => { expect([...hasAddButton, ...hasNoAddButton]).toContain(value); }); }); @@ -171,14 +171,14 @@ describe('Board List Header Component', () => { it.each(cannotDragList)( 'does not have user-can-drag-class so user cannot drag list', - listType => { + (listType) => { createComponent({ listType }); expect(findTitle().classes()).not.toContain('user-can-drag'); }, ); - it.each(canDragList)('has user-can-drag-class so user can drag list', listType => { + it.each(canDragList)('has user-can-drag-class so user can drag list', (listType) => { createComponent({ listType }); expect(findTitle().classes()).toContain('user-can-drag'); diff --git a/spec/frontend/boards/components/board_list_header_spec.js b/spec/frontend/boards/components/board_list_header_spec.js index 656a503bb86..58469a1ac9a 100644 --- a/spec/frontend/boards/components/board_list_header_spec.js +++ b/spec/frontend/boards/components/board_list_header_spec.js @@ -76,20 +76,20 @@ describe('Board List Header Component', () => { const hasNoAddButton = [ListType.closed]; const hasAddButton = [ListType.backlog, ListType.label, ListType.milestone, ListType.assignee]; - it.each(hasNoAddButton)('does not render when List Type is `%s`', listType => { + it.each(hasNoAddButton)('does not render when List Type is `%s`', (listType) => { createComponent({ listType }); expect(findAddIssueButton().exists()).toBe(false); }); - it.each(hasAddButton)('does render when List Type is `%s`', listType => { + it.each(hasAddButton)('does render when List Type is `%s`', (listType) => { createComponent({ listType }); expect(findAddIssueButton().exists()).toBe(true); }); it('has a test for each list type', () => { - Object.values(ListType).forEach(value => { + Object.values(ListType).forEach((value) => { expect([...hasAddButton, ...hasNoAddButton]).toContain(value); }); }); diff --git a/spec/frontend/boards/components/boards_selector_spec.js b/spec/frontend/boards/components/boards_selector_spec.js index db3c8c22950..95c888fe5d4 100644 --- a/spec/frontend/boards/components/boards_selector_spec.js +++ b/spec/frontend/boards/components/boards_selector_spec.js @@ -26,7 +26,7 @@ describe('BoardsSelector', () => { const boards = boardGenerator(20); const recentBoards = boardGenerator(5); - const fillSearchBox = filterTerm => { + const fillSearchBox = (filterTerm) => { const searchBox = wrapper.find({ ref: 'searchBox' }); const searchBoxInput = searchBox.find('input'); searchBoxInput.setValue(filterTerm); @@ -59,7 +59,7 @@ describe('BoardsSelector', () => { data: { group: { boards: { - edges: boards.map(board => ({ node: board })), + edges: boards.map((board) => ({ node: board })), }, }, }, @@ -152,7 +152,7 @@ describe('BoardsSelector', () => { it('shows only matching boards when filtering', () => { const filterTerm = 'board1'; - const expectedCount = boards.filter(board => board.name.includes(filterTerm)).length; + const expectedCount = boards.filter((board) => board.name.includes(filterTerm)).length; fillSearchBox(filterTerm); diff --git a/spec/frontend/boards/components/issue_count_spec.js b/spec/frontend/boards/components/issue_count_spec.js index d1ff0bdbf88..f1870e9cc9e 100644 --- a/spec/frontend/boards/components/issue_count_spec.js +++ b/spec/frontend/boards/components/issue_count_spec.js @@ -6,7 +6,7 @@ describe('IssueCount', () => { let maxIssueCount; let issuesSize; - const createComponent = props => { + const createComponent = (props) => { vm = shallowMount(IssueCount, { propsData: props }); }; diff --git a/spec/frontend/boards/components/issue_due_date_spec.js b/spec/frontend/boards/components/issue_due_date_spec.js index 880859287e1..73340c1b96b 100644 --- a/spec/frontend/boards/components/issue_due_date_spec.js +++ b/spec/frontend/boards/components/issue_due_date_spec.js @@ -10,7 +10,7 @@ const createComponent = (dueDate = new Date(), closed = false) => }, }); -const findTime = wrapper => wrapper.find('time'); +const findTime = (wrapper) => wrapper.find('time'); describe('Issue Due Date component', () => { let wrapper; diff --git a/spec/frontend/boards/components/issue_time_estimate_deprecated_spec.js b/spec/frontend/boards/components/issue_time_estimate_deprecated_spec.js index 21b3fac15ef..fafebaf3a4e 100644 --- a/spec/frontend/boards/components/issue_time_estimate_deprecated_spec.js +++ b/spec/frontend/boards/components/issue_time_estimate_deprecated_spec.js @@ -31,7 +31,7 @@ describe('Issue Time Estimate component', () => { expect(wrapper.find('.js-issue-time-estimate').text()).toContain('2 weeks 3 days 1 minute'); }); - it('prevents tooltip xss', done => { + it('prevents tooltip xss', (done) => { const alertSpy = jest.spyOn(window, 'alert'); wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' }); wrapper.vm.$nextTick(() => { diff --git a/spec/frontend/boards/components/issue_time_estimate_spec.js b/spec/frontend/boards/components/issue_time_estimate_spec.js index b09f879ea85..185efae1f5e 100644 --- a/spec/frontend/boards/components/issue_time_estimate_spec.js +++ b/spec/frontend/boards/components/issue_time_estimate_spec.js @@ -28,7 +28,7 @@ describe('Issue Time Estimate component', () => { expect(wrapper.find('.js-issue-time-estimate').text()).toContain('2 weeks 3 days 1 minute'); }); - it('prevents tooltip xss', done => { + it('prevents tooltip xss', (done) => { const alertSpy = jest.spyOn(window, 'alert'); wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' }); wrapper.vm.$nextTick(() => { diff --git a/spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js b/spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js index ee54c662167..b1df0f2d771 100644 --- a/spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js +++ b/spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js @@ -83,7 +83,7 @@ describe('~/boards/components/sidebar/board_sidebar_subscription_spec.vue', () = }); describe('Board sidebar subscription component `behavior`', () => { - const mockSetActiveIssueSubscribed = subscribedState => { + const mockSetActiveIssueSubscribed = (subscribedState) => { jest.spyOn(wrapper.vm, 'setActiveIssueSubscribed').mockImplementation(async () => { store.commit(types.UPDATE_ISSUE_BY_ID, { issueId: mockActiveIssue.id, diff --git a/spec/frontend/boards/components/sidebar/remove_issue_spec.js b/spec/frontend/boards/components/sidebar/remove_issue_spec.js index a33e4046724..1b7a78e6e58 100644 --- a/spec/frontend/boards/components/sidebar/remove_issue_spec.js +++ b/spec/frontend/boards/components/sidebar/remove_issue_spec.js @@ -8,7 +8,7 @@ describe('boards sidebar remove issue', () => { const findButton = () => wrapper.find(GlButton); - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = shallowMount(RemoveIssue, { propsData: { issue: {}, diff --git a/spec/frontend/boards/issue_card_deprecated_spec.js b/spec/frontend/boards/issue_card_deprecated_spec.js index 0b34be65029..fd7b0edb97e 100644 --- a/spec/frontend/boards/issue_card_deprecated_spec.js +++ b/spec/frontend/boards/issue_card_deprecated_spec.js @@ -79,7 +79,7 @@ describe('Issue card component', () => { expect(wrapper.find('.issue-blocked-icon').exists()).toBe(false); }); - it('renders confidential icon', done => { + it('renders confidential icon', (done) => { wrapper.setProps({ issue: { ...wrapper.props('issue'), @@ -102,7 +102,7 @@ describe('Issue card component', () => { }); describe('exists', () => { - beforeEach(done => { + beforeEach((done) => { wrapper.setProps({ issue: { ...wrapper.props('issue'), @@ -132,7 +132,7 @@ describe('Issue card component', () => { expect(wrapper.find('.board-card-assignee img').exists()).toBe(true); }); - it('renders the avatar using avatar_url property', done => { + it('renders the avatar using avatar_url property', (done) => { wrapper.props('issue').updateData({ ...wrapper.props('issue'), assignees: [ @@ -156,7 +156,7 @@ describe('Issue card component', () => { }); describe('assignee default avatar', () => { - beforeEach(done => { + beforeEach((done) => { global.gon.default_avatar_url = 'default_avatar'; wrapper.setProps({ @@ -189,7 +189,7 @@ describe('Issue card component', () => { }); describe('multiple assignees', () => { - beforeEach(done => { + beforeEach((done) => { wrapper.setProps({ issue: { ...wrapper.props('issue'), @@ -224,7 +224,7 @@ describe('Issue card component', () => { }); describe('more than three assignees', () => { - beforeEach(done => { + beforeEach((done) => { const { assignees } = wrapper.props('issue'); assignees.push( new ListAssignee({ @@ -252,11 +252,11 @@ describe('Issue card component', () => { expect(wrapper.findAll('.board-card-assignee .avatar').length).toEqual(2); }); - it('renders 99+ avatar counter', done => { + it('renders 99+ avatar counter', (done) => { const assignees = [ ...wrapper.props('issue').assignees, ...range(5, 103).map( - i => + (i) => new ListAssignee({ id: i, name: 'name', @@ -281,7 +281,7 @@ describe('Issue card component', () => { }); describe('labels', () => { - beforeEach(done => { + beforeEach((done) => { issue.addLabel(label1); wrapper.setProps({ issue: { ...issue } }); @@ -296,7 +296,7 @@ describe('Issue card component', () => { expect(label.props('backgroundColor')).toEqual(label1.color); }); - it('does not render label if label does not have an ID', done => { + it('does not render label if label does not have an ID', (done) => { issue.addLabel( new ListLabel({ title: 'closed', @@ -315,7 +315,7 @@ describe('Issue card component', () => { }); describe('blocked', () => { - beforeEach(done => { + beforeEach((done) => { wrapper.setProps({ issue: { ...wrapper.props('issue'), diff --git a/spec/frontend/boards/issue_card_inner_spec.js b/spec/frontend/boards/issue_card_inner_spec.js index d6029c4b66f..f9ad78494af 100644 --- a/spec/frontend/boards/issue_card_inner_spec.js +++ b/spec/frontend/boards/issue_card_inner_spec.js @@ -260,7 +260,7 @@ describe('Issue card component', () => { it('renders 99+ avatar counter', async () => { const assignees = [ ...wrapper.props('issue').assignees, - ...range(5, 103).map(i => ({ + ...range(5, 103).map((i) => ({ id: i, name: 'name', username: 'username', diff --git a/spec/frontend/boards/list_spec.js b/spec/frontend/boards/list_spec.js index b731bb6e474..db01f62c9a6 100644 --- a/spec/frontend/boards/list_spec.js +++ b/spec/frontend/boards/list_spec.js @@ -37,7 +37,7 @@ describe('List model', () => { describe('list type', () => { const notExpandableList = ['blank']; - const table = Object.keys(ListType).map(k => { + const table = Object.keys(ListType).map((k) => { const value = ListType[k]; return [value, !notExpandableList.includes(value)]; }); @@ -186,7 +186,7 @@ describe('List model', () => { list.issues = []; }); - it('adds new issue to top of list', done => { + it('adds new issue to top of list', (done) => { const user = new ListAssignee({ id: 1, name: 'testing 123', diff --git a/spec/frontend/boards/mock_data.js b/spec/frontend/boards/mock_data.js index 1319640b93c..47cc5baff26 100644 --- a/spec/frontend/boards/mock_data.js +++ b/spec/frontend/boards/mock_data.js @@ -263,7 +263,7 @@ export const BoardsMockData = { }, }; -export const boardsMockInterceptor = config => { +export const boardsMockInterceptor = (config) => { const body = BoardsMockData[config.method.toUpperCase()][config.url]; return [200, body]; }; @@ -318,7 +318,7 @@ export const mockLists = [mockList, mockLabelList]; export const mockListsById = keyBy(mockLists, 'id'); -export const mockListsWithModel = mockLists.map(listMock => +export const mockListsWithModel = mockLists.map((listMock) => Vue.observable(new List({ ...listMock, doNotFetchIssues: true })), ); diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index efe9afde530..b486f153170 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -21,7 +21,7 @@ import createFlash from '~/flash'; jest.mock('~/flash'); -const expectNotImplemented = action => { +const expectNotImplemented = (action) => { it('is not implemented', () => { expect(action).toThrow(new Error('Not implemented!')); }); @@ -29,7 +29,7 @@ const expectNotImplemented = action => { // We need this helper to make sure projectPath is including // subgroups when the movIssue action is called. -const getProjectPath = path => path.split('#')[0]; +const getProjectPath = (path) => path.split('#')[0]; beforeEach(() => { window.gon = { features: {} }; @@ -53,7 +53,7 @@ describe('setInitialBoardData', () => { }); describe('setFilters', () => { - it('should commit mutation SET_FILTERS', done => { + it('should commit mutation SET_FILTERS', (done) => { const state = { filters: {}, }; @@ -72,11 +72,11 @@ describe('setFilters', () => { }); describe('performSearch', () => { - it('should dispatch setFilters action', done => { + it('should dispatch setFilters action', (done) => { testAction(actions.performSearch, {}, {}, [], [{ type: 'setFilters', payload: {} }], done); }); - it('should dispatch setFilters, fetchLists and resetIssues action when graphqlBoardLists FF is on', done => { + it('should dispatch setFilters, fetchLists and resetIssues action when graphqlBoardLists FF is on', (done) => { window.gon = { features: { graphqlBoardLists: true } }; testAction( actions.performSearch, @@ -90,7 +90,7 @@ describe('performSearch', () => { }); describe('setActiveId', () => { - it('should commit mutation SET_ACTIVE_ID', done => { + it('should commit mutation SET_ACTIVE_ID', (done) => { const state = { activeId: inactiveId, }; @@ -129,7 +129,7 @@ describe('fetchLists', () => { const formattedLists = formatBoardLists(queryResponse.data.group.board.lists); - it('should commit mutations RECEIVE_BOARD_LISTS_SUCCESS on success', done => { + it('should commit mutations RECEIVE_BOARD_LISTS_SUCCESS on success', (done) => { jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); testAction( @@ -147,7 +147,7 @@ describe('fetchLists', () => { ); }); - it('dispatch createList action when backlog list does not exist and is not hidden', done => { + it('dispatch createList action when backlog list does not exist and is not hidden', (done) => { queryResponse = { data: { group: { @@ -179,7 +179,7 @@ describe('fetchLists', () => { }); describe('createList', () => { - it('should dispatch addList action when creating backlog list', done => { + it('should dispatch addList action when creating backlog list', (done) => { const backlogList = { id: 'gid://gitlab/List/1', listType: 'backlog', @@ -216,7 +216,7 @@ describe('createList', () => { ); }); - it('should commit CREATE_LIST_FAILURE mutation when API returns an error', done => { + it('should commit CREATE_LIST_FAILURE mutation when API returns an error', (done) => { jest.spyOn(gqlClient, 'mutate').mockReturnValue( Promise.resolve({ data: { @@ -248,7 +248,7 @@ describe('createList', () => { }); describe('moveList', () => { - it('should commit MOVE_LIST mutation and dispatch updateList action', done => { + it('should commit MOVE_LIST mutation and dispatch updateList action', (done) => { const initialBoardListsState = { 'gid://gitlab/List/1': mockLists[0], 'gid://gitlab/List/2': mockLists[1], @@ -321,7 +321,7 @@ describe('moveList', () => { }); describe('updateList', () => { - it('should commit UPDATE_LIST_FAILURE mutation when API returns an error', done => { + it('should commit UPDATE_LIST_FAILURE mutation when API returns an error', (done) => { jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ data: { updateBoardList: { @@ -438,7 +438,7 @@ describe('fetchIssuesForList', () => { boardType: 'group', }; - const mockIssuesNodes = mockIssues.map(issue => ({ node: issue })); + const mockIssuesNodes = mockIssues.map((issue) => ({ node: issue })); const pageInfo = { endCursor: '', @@ -471,7 +471,7 @@ describe('fetchIssuesForList', () => { [listId]: pageInfo, }; - it('should commit mutations REQUEST_ISSUES_FOR_LIST and RECEIVE_ISSUES_FOR_LIST_SUCCESS on success', done => { + it('should commit mutations REQUEST_ISSUES_FOR_LIST and RECEIVE_ISSUES_FOR_LIST_SUCCESS on success', (done) => { jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); testAction( @@ -493,7 +493,7 @@ describe('fetchIssuesForList', () => { ); }); - it('should commit mutations REQUEST_ISSUES_FOR_LIST and RECEIVE_ISSUES_FOR_LIST_FAILURE on failure', done => { + it('should commit mutations REQUEST_ISSUES_FOR_LIST and RECEIVE_ISSUES_FOR_LIST_FAILURE on failure', (done) => { jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject()); testAction( @@ -540,7 +540,7 @@ describe('moveIssue', () => { issues, }; - it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_SUCCESS mutation when successful', done => { + it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_SUCCESS mutation when successful', (done) => { jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ data: { issueMoveList: { @@ -615,7 +615,7 @@ describe('moveIssue', () => { expect(gqlClient.mutate).toHaveBeenCalledWith(mutationVariables); }); - it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful', done => { + it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful', (done) => { jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ data: { issueMoveList: { @@ -686,7 +686,7 @@ describe('setAssignees', () => { }); }); - it('calls the correct mutation with the correct values', done => { + it('calls the correct mutation with the correct values', (done) => { testAction( actions.setAssignees, {}, @@ -743,7 +743,7 @@ describe('createNewIssue', () => { expect(result).toEqual(mockIssue); }); - it('should commit CREATE_ISSUE_FAILURE mutation when API returns an error', done => { + it('should commit CREATE_ISSUE_FAILURE mutation when API returns an error', (done) => { jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ data: { createIssue: { @@ -767,7 +767,7 @@ describe('createNewIssue', () => { }); describe('addListIssue', () => { - it('should commit ADD_ISSUE_TO_LIST mutation', done => { + it('should commit ADD_ISSUE_TO_LIST mutation', (done) => { const payload = { list: mockLists[0], issue: mockIssue, @@ -788,14 +788,14 @@ describe('addListIssue', () => { describe('setActiveIssueLabels', () => { const state = { issues: { [mockIssue.id]: mockIssue } }; const getters = { activeIssue: mockIssue }; - const testLabelIds = labels.map(label => label.id); + const testLabelIds = labels.map((label) => label.id); const input = { addLabelIds: testLabelIds, removeLabelIds: [], projectPath: 'h/b', }; - it('should assign labels on success', done => { + it('should assign labels on success', (done) => { jest .spyOn(gqlClient, 'mutate') .mockResolvedValue({ data: { updateIssue: { issue: { labels: { nodes: labels } } } } }); @@ -839,7 +839,7 @@ describe('setActiveIssueDueDate', () => { projectPath: 'h/b', }; - it('should commit due date after setting the issue', done => { + it('should commit due date after setting the issue', (done) => { jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ data: { updateIssue: { @@ -890,7 +890,7 @@ describe('setActiveIssueSubscribed', () => { projectPath: 'gitlab-org/gitlab-test', }; - it('should commit subscribed status', done => { + it('should commit subscribed status', (done) => { jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ data: { issueSetSubscription: { @@ -944,7 +944,7 @@ describe('setActiveIssueMilestone', () => { projectPath: 'h/b', }; - it('should commit milestone after setting the issue', done => { + it('should commit milestone after setting the issue', (done) => { jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ data: { updateIssue: { diff --git a/spec/frontend/boards/stores/getters_spec.js b/spec/frontend/boards/stores/getters_spec.js index 8a9ff8232e7..44b41b5667d 100644 --- a/spec/frontend/boards/stores/getters_spec.js +++ b/spec/frontend/boards/stores/getters_spec.js @@ -84,7 +84,7 @@ describe('Boards - Getters', () => { issues, }; it('returns issues for a given listId', () => { - const getIssueById = issueId => [mockIssue, mockIssue2].find(({ id }) => id === issueId); + const getIssueById = (issueId) => [mockIssue, mockIssue2].find(({ id }) => id === issueId); expect(getters.getIssuesByList(boardsState, { getIssueById })('gid://gitlab/List/2')).toEqual( mockIssues, diff --git a/spec/frontend/boards/stores/mutations_spec.js b/spec/frontend/boards/stores/mutations_spec.js index 1fa948b3848..fa5357856dc 100644 --- a/spec/frontend/boards/stores/mutations_spec.js +++ b/spec/frontend/boards/stores/mutations_spec.js @@ -3,7 +3,7 @@ import * as types from '~/boards/stores/mutation_types'; import defaultState from '~/boards/stores/state'; import { mockLists, rawIssue, mockIssue, mockIssue2 } from '../mock_data'; -const expectNotImplemented = action => { +const expectNotImplemented = (action) => { it('is not implemented', () => { expect(action).toThrow(new Error('Not implemented!')); }); diff --git a/spec/frontend/branches/branches_delete_modal_spec.js b/spec/frontend/branches/branches_delete_modal_spec.js index 21608feafc8..8b10cca7a11 100644 --- a/spec/frontend/branches/branches_delete_modal_spec.js +++ b/spec/frontend/branches/branches_delete_modal_spec.js @@ -15,7 +15,7 @@ describe('branches delete modal', () => { </div> `); $deleteButton = $('.js-delete-branch'); - submitSpy = jest.fn(event => event.preventDefault()); + submitSpy = jest.fn((event) => event.preventDefault()); $('#modal-delete-branch form').on('submit', submitSpy); // eslint-disable-next-line no-new new DeleteModal(); diff --git a/spec/frontend/ci_settings_pipeline_triggers/components/triggers_list_spec.js b/spec/frontend/ci_settings_pipeline_triggers/components/triggers_list_spec.js index b10f4984aff..30aa634fc81 100644 --- a/spec/frontend/ci_settings_pipeline_triggers/components/triggers_list_spec.js +++ b/spec/frontend/ci_settings_pipeline_triggers/components/triggers_list_spec.js @@ -16,14 +16,14 @@ describe('TriggersList', () => { }; const findTable = () => wrapper.find(GlTable); - const findHeaderAt = i => wrapper.findAll('thead th').at(i); + const findHeaderAt = (i) => wrapper.findAll('thead th').at(i); const findRows = () => wrapper.findAll('tbody tr'); - const findRowAt = i => findRows().at(i); + const findRowAt = (i) => findRows().at(i); const findCell = (i, col) => findRowAt(i).findAll('td').at(col); - const findClipboardBtn = i => findCell(i, 0).find(ClipboardButton); - const findInvalidBadge = i => findCell(i, 0).find(GlBadge); - const findEditBtn = i => findRowAt(i).find('[data-testid="edit-btn"]'); - const findRevokeBtn = i => findRowAt(i).find('[data-testid="trigger_revoke_button"]'); + const findClipboardBtn = (i) => findCell(i, 0).find(ClipboardButton); + const findInvalidBadge = (i) => findCell(i, 0).find(GlBadge); + const findEditBtn = (i) => findRowAt(i).find('[data-testid="edit-btn"]'); + const findRevokeBtn = (i) => findRowAt(i).find('[data-testid="trigger_revoke_button"]'); beforeEach(() => { createComponent(); diff --git a/spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js b/spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js index 7bcd558c60f..faa88394447 100644 --- a/spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js +++ b/spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js @@ -10,7 +10,7 @@ describe('Ci environments dropdown', () => { let wrapper; let store; - const createComponent = term => { + const createComponent = (term) => { store = new Vuex.Store({ getters: { joinedEnvironments: () => ['dev', 'prod', 'staging'], @@ -27,8 +27,8 @@ describe('Ci environments dropdown', () => { }; const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem); - const findDropdownItemByIndex = index => wrapper.findAll(GlDropdownItem).at(index); - const findActiveIconByIndex = index => findDropdownItemByIndex(index).find(GlIcon); + const findDropdownItemByIndex = (index) => wrapper.findAll(GlDropdownItem).at(index); + const findActiveIconByIndex = (index) => findDropdownItemByIndex(index).find(GlIcon); afterEach(() => { wrapper.destroy(); @@ -78,7 +78,7 @@ describe('Ci environments dropdown', () => { }); it('should not display create button', () => { - const environments = findAllDropdownItems().filter(env => env.text().startsWith('Create')); + const environments = findAllDropdownItems().filter((env) => env.text().startsWith('Create')); expect(environments).toHaveLength(0); expect(findAllDropdownItems()).toHaveLength(1); }); diff --git a/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js b/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js index 5c2d096418d..c57ff3ef20a 100644 --- a/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js +++ b/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js @@ -31,11 +31,11 @@ describe('Ci variable modal', () => { const findAddorUpdateButton = () => findModal() .findAll(GlButton) - .wrappers.find(button => button.props('variant') === 'success'); + .wrappers.find((button) => button.props('variant') === 'success'); const deleteVariableButton = () => findModal() .findAll(GlButton) - .wrappers.find(button => button.props('variant') === 'danger'); + .wrappers.find((button) => button.props('variant') === 'danger'); afterEach(() => { wrapper.destroy(); diff --git a/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js b/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js index 7dcd82eac5e..12449fc7615 100644 --- a/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js +++ b/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js @@ -11,7 +11,7 @@ describe('Ci variable table', () => { let store; let isGroup; - const createComponent = groupState => { + const createComponent = (groupState) => { store = createStore(); store.state.isGroup = groupState; jest.spyOn(store, 'dispatch').mockImplementation(); diff --git a/spec/frontend/ci_variable_list/store/actions_spec.js b/spec/frontend/ci_variable_list/store/actions_spec.js index 4b89e467df0..075e5829305 100644 --- a/spec/frontend/ci_variable_list/store/actions_spec.js +++ b/spec/frontend/ci_variable_list/store/actions_spec.js @@ -86,7 +86,7 @@ describe('CI variable list store actions', () => { }); describe('deleteVariable', () => { - it('dispatch correct actions on successful deleted variable', done => { + it('dispatch correct actions on successful deleted variable', (done) => { mock.onPatch(state.endpoint).reply(200); testAction( @@ -105,7 +105,7 @@ describe('CI variable list store actions', () => { ); }); - it('should show flash error and set error in state on delete failure', done => { + it('should show flash error and set error in state on delete failure', (done) => { mock.onPatch(state.endpoint).reply(500, ''); testAction( @@ -129,7 +129,7 @@ describe('CI variable list store actions', () => { }); describe('updateVariable', () => { - it('dispatch correct actions on successful updated variable', done => { + it('dispatch correct actions on successful updated variable', (done) => { mock.onPatch(state.endpoint).reply(200); testAction( @@ -148,7 +148,7 @@ describe('CI variable list store actions', () => { ); }); - it('should show flash error and set error in state on update failure', done => { + it('should show flash error and set error in state on update failure', (done) => { mock.onPatch(state.endpoint).reply(500, ''); testAction( @@ -172,7 +172,7 @@ describe('CI variable list store actions', () => { }); describe('addVariable', () => { - it('dispatch correct actions on successful added variable', done => { + it('dispatch correct actions on successful added variable', (done) => { mock.onPatch(state.endpoint).reply(200); testAction( @@ -191,7 +191,7 @@ describe('CI variable list store actions', () => { ); }); - it('should show flash error and set error in state on add failure', done => { + it('should show flash error and set error in state on add failure', (done) => { mock.onPatch(state.endpoint).reply(500, ''); testAction( @@ -215,7 +215,7 @@ describe('CI variable list store actions', () => { }); describe('fetchVariables', () => { - it('dispatch correct actions on fetchVariables', done => { + it('dispatch correct actions on fetchVariables', (done) => { mock.onGet(state.endpoint).reply(200, { variables: mockData.mockVariables }); testAction( @@ -236,7 +236,7 @@ describe('CI variable list store actions', () => { ); }); - it('should show flash error and set error in state on fetch variables failure', done => { + it('should show flash error and set error in state on fetch variables failure', (done) => { mock.onGet(state.endpoint).reply(500); testAction(actions.fetchVariables, {}, state, [], [{ type: 'requestVariables' }], () => { @@ -247,7 +247,7 @@ describe('CI variable list store actions', () => { }); describe('fetchEnvironments', () => { - it('dispatch correct actions on fetchEnvironments', done => { + it('dispatch correct actions on fetchEnvironments', (done) => { Api.environments = jest.fn().mockResolvedValue({ data: mockData.mockEnvironments }); testAction( @@ -268,7 +268,7 @@ describe('CI variable list store actions', () => { ); }); - it('should show flash error and set error in state on fetch environments failure', done => { + it('should show flash error and set error in state on fetch environments failure', (done) => { Api.environments = jest.fn().mockRejectedValue(); testAction( diff --git a/spec/frontend/clusters/clusters_bundle_spec.js b/spec/frontend/clusters/clusters_bundle_spec.js index d3277cdb7cc..cd0eda2ab49 100644 --- a/spec/frontend/clusters/clusters_bundle_spec.js +++ b/spec/frontend/clusters/clusters_bundle_spec.js @@ -279,7 +279,7 @@ describe('Clusters', () => { }); describe('uninstallApplication', () => { - it.each(APPLICATIONS)('tries to uninstall %s', applicationId => { + it.each(APPLICATIONS)('tries to uninstall %s', (applicationId) => { jest.spyOn(cluster.service, 'uninstallApplication').mockResolvedValueOnce(); cluster.store.state.applications[applicationId].status = INSTALLED; diff --git a/spec/frontend/clusters/components/application_row_spec.js b/spec/frontend/clusters/components/application_row_spec.js index 0a964426c95..49a299cfb3c 100644 --- a/spec/frontend/clusters/components/application_row_spec.js +++ b/spec/frontend/clusters/components/application_row_spec.js @@ -15,7 +15,7 @@ describe('Application Row', () => { wrapper.destroy(); }); - const mountComponent = data => { + const mountComponent = (data) => { wrapper = shallowMount(ApplicationRow, { stubs: { GlSprintf }, propsData: { diff --git a/spec/frontend/clusters/components/applications_spec.js b/spec/frontend/clusters/components/applications_spec.js index 5438f3053a8..de3588cff1a 100644 --- a/spec/frontend/clusters/components/applications_spec.js +++ b/spec/frontend/clusters/components/applications_spec.js @@ -29,8 +29,8 @@ describe('Applications', () => { }); }; - const createShallowApp = options => createApp(options, true); - const findByTestId = id => wrapper.find(`[data-testid="${id}"]`); + const createShallowApp = (options) => createApp(options, true); + const findByTestId = (id) => wrapper.find(`[data-testid="${id}"]`); afterEach(() => { wrapper.destroy(); }); diff --git a/spec/frontend/clusters/components/fluentd_output_settings_spec.js b/spec/frontend/clusters/components/fluentd_output_settings_spec.js index 25db8785edc..cd996ae915b 100644 --- a/spec/frontend/clusters/components/fluentd_output_settings_spec.js +++ b/spec/frontend/clusters/components/fluentd_output_settings_spec.js @@ -37,11 +37,11 @@ describe('FluentdOutputSettings', () => { const findSaveButton = () => wrapper.find({ ref: 'saveBtn' }); const findCancelButton = () => wrapper.find({ ref: 'cancelBtn' }); const findProtocolDropdown = () => wrapper.find(GlDropdown); - const findCheckbox = name => - wrapper.findAll(GlFormCheckbox).wrappers.find(x => x.text() === name); + const findCheckbox = (name) => + wrapper.findAll(GlFormCheckbox).wrappers.find((x) => x.text() === name); const findHost = () => wrapper.find('#fluentd-host'); const findPort = () => wrapper.find('#fluentd-port'); - const changeCheckbox = checkbox => { + const changeCheckbox = (checkbox) => { const currentValue = checkbox.attributes('checked')?.toString() === 'true'; checkbox.vm.$emit('input', !currentValue); }; @@ -49,9 +49,9 @@ describe('FluentdOutputSettings', () => { element.value = val; element.dispatchEvent(new Event('input')); }; - const changePort = val => changeInput(findPort(), val); - const changeHost = val => changeInput(findHost(), val); - const changeProtocol = idx => findProtocolDropdown().vm.$children[idx].$emit('click'); + const changePort = (val) => changeInput(findPort(), val); + const changeHost = (val) => changeInput(findHost(), val); + const changeProtocol = (idx) => findProtocolDropdown().vm.$children[idx].$emit('click'); const toApplicationSettings = ({ wafLogEnabled, ciliumLogEnabled, ...settings }) => ({ ...settings, waf_log_enabled: wafLogEnabled, diff --git a/spec/frontend/clusters/services/application_state_machine_spec.js b/spec/frontend/clusters/services/application_state_machine_spec.js index 7eee54949fa..a3850a64f3b 100644 --- a/spec/frontend/clusters/services/application_state_machine_spec.js +++ b/spec/frontend/clusters/services/application_state_machine_spec.js @@ -25,7 +25,7 @@ const { const NO_EFFECTS = 'no effects'; describe('applicationStateMachine', () => { - const noEffectsToEmptyObject = effects => (typeof effects === 'string' ? {} : effects); + const noEffectsToEmptyObject = (effects) => (typeof effects === 'string' ? {} : effects); describe(`current state is ${NO_STATUS}`, () => { it.each` @@ -42,7 +42,7 @@ describe('applicationStateMachine', () => { ${UNINSTALLING} | ${UNINSTALLING} | ${NO_EFFECTS} ${INSTALLED} | ${UNINSTALL_ERRORED} | ${{ uninstallFailed: true }} ${UNINSTALLED} | ${UNINSTALLED} | ${NO_EFFECTS} - `(`transitions to $expectedState on $event event and applies $effects`, data => { + `(`transitions to $expectedState on $event event and applies $effects`, (data) => { const { expectedState, event, effects } = data; const currentAppState = { status: NO_STATUS, @@ -59,7 +59,7 @@ describe('applicationStateMachine', () => { it.each` expectedState | event | effects ${INSTALLABLE} | ${INSTALLABLE} | ${NO_EFFECTS} - `(`transitions to $expectedState on $event event and applies $effects`, data => { + `(`transitions to $expectedState on $event event and applies $effects`, (data) => { const { expectedState, event, effects } = data; const currentAppState = { status: NOT_INSTALLABLE, @@ -79,7 +79,7 @@ describe('applicationStateMachine', () => { ${INSTALLED} | ${INSTALLED} | ${{ installFailed: false }} ${NOT_INSTALLABLE} | ${NOT_INSTALLABLE} | ${NO_EFFECTS} ${UNINSTALLED} | ${UNINSTALLED} | ${{ installFailed: false }} - `(`transitions to $expectedState on $event event and applies $effects`, data => { + `(`transitions to $expectedState on $event event and applies $effects`, (data) => { const { expectedState, event, effects } = data; const currentAppState = { status: INSTALLABLE, @@ -97,7 +97,7 @@ describe('applicationStateMachine', () => { expectedState | event | effects ${INSTALLED} | ${INSTALLED} | ${NO_EFFECTS} ${INSTALLABLE} | ${ERROR} | ${{ installFailed: true }} - `(`transitions to $expectedState on $event event and applies $effects`, data => { + `(`transitions to $expectedState on $event event and applies $effects`, (data) => { const { expectedState, event, effects } = data; const currentAppState = { status: INSTALLING, @@ -118,7 +118,7 @@ describe('applicationStateMachine', () => { ${NOT_INSTALLABLE} | ${NOT_INSTALLABLE} | ${NO_EFFECTS} ${UNINSTALLED} | ${UNINSTALLED} | ${NO_EFFECTS} ${INSTALLABLE} | ${ERROR} | ${{ installFailed: true }} - `(`transitions to $expectedState on $event event and applies $effects`, data => { + `(`transitions to $expectedState on $event event and applies $effects`, (data) => { const { expectedState, event, effects } = data; const currentAppState = { status: INSTALLED, @@ -136,7 +136,7 @@ describe('applicationStateMachine', () => { expectedState | event | effects ${INSTALLED} | ${UPDATED} | ${{ updateSuccessful: true }} ${INSTALLED} | ${UPDATE_ERRORED} | ${{ updateFailed: true }} - `(`transitions to $expectedState on $event event and applies $effects`, data => { + `(`transitions to $expectedState on $event event and applies $effects`, (data) => { const { expectedState, event, effects } = data; const currentAppState = { status: UPDATING, @@ -154,7 +154,7 @@ describe('applicationStateMachine', () => { expectedState | event | effects ${INSTALLABLE} | ${INSTALLABLE} | ${{ uninstallSuccessful: true }} ${INSTALLED} | ${UNINSTALL_ERRORED} | ${{ uninstallFailed: true }} - `(`transitions to $expectedState on $event event and applies $effects`, data => { + `(`transitions to $expectedState on $event event and applies $effects`, (data) => { const { expectedState, event, effects } = data; const currentAppState = { status: UNINSTALLING, @@ -172,7 +172,7 @@ describe('applicationStateMachine', () => { expectedState | event | effects ${INSTALLED} | ${INSTALLED} | ${NO_EFFECTS} ${INSTALLABLE} | ${ERROR} | ${{ installFailed: true }} - `(`transitions to $expectedState on $event event and applies $effects`, data => { + `(`transitions to $expectedState on $event event and applies $effects`, (data) => { const { expectedState, event, effects } = data; const currentAppState = { status: UNINSTALLED, diff --git a/spec/frontend/clusters_list/components/node_error_help_text_spec.js b/spec/frontend/clusters_list/components/node_error_help_text_spec.js index 4d157b3a8ab..fa566c2dc57 100644 --- a/spec/frontend/clusters_list/components/node_error_help_text_spec.js +++ b/spec/frontend/clusters_list/components/node_error_help_text_spec.js @@ -5,7 +5,7 @@ import NodeErrorHelpText from '~/clusters_list/components/node_error_help_text.v describe('NodeErrorHelpText', () => { let wrapper; - const createWrapper = propsData => { + const createWrapper = (propsData) => { wrapper = shallowMount(NodeErrorHelpText, { propsData, stubs: { GlPopover } }); return wrapper.vm.$nextTick(); }; diff --git a/spec/frontend/clusters_list/store/actions_spec.js b/spec/frontend/clusters_list/store/actions_spec.js index 3d4e07d00eb..6214cb50e13 100644 --- a/spec/frontend/clusters_list/store/actions_spec.js +++ b/spec/frontend/clusters_list/store/actions_spec.js @@ -24,7 +24,7 @@ describe('Clusters store actions', () => { captureException.mockRestore(); }); - it('should report sentry error', done => { + it('should report sentry error', (done) => { const sentryError = new Error('New Sentry Error'); const tag = 'sentryErrorTag'; @@ -62,7 +62,7 @@ describe('Clusters store actions', () => { afterEach(() => mock.restore()); - it('should commit SET_CLUSTERS_DATA with received response', done => { + it('should commit SET_CLUSTERS_DATA with received response', (done) => { mock.onGet().reply(200, apiData, headers); testAction( @@ -79,7 +79,7 @@ describe('Clusters store actions', () => { ); }); - it('should show flash on API error', done => { + it('should show flash on API error', (done) => { mock.onGet().reply(400, 'Not Found'); testAction( @@ -126,7 +126,7 @@ describe('Clusters store actions', () => { pollStop.mockRestore(); }); - it('should stop polling after MAX Requests', done => { + it('should stop polling after MAX Requests', (done) => { testAction( actions.fetchClusters, { endpoint: apiData.endpoint }, @@ -173,7 +173,7 @@ describe('Clusters store actions', () => { ); }); - it('should stop polling and report to Sentry when data is invalid', done => { + it('should stop polling and report to Sentry when data is invalid', (done) => { const badApiResponse = { clusters: {} }; mock.onGet().reply(200, badApiResponse, pollHeaders); diff --git a/spec/frontend/code_navigation/store/actions_spec.js b/spec/frontend/code_navigation/store/actions_spec.js index fbd93b10a14..39cf4acd5ce 100644 --- a/spec/frontend/code_navigation/store/actions_spec.js +++ b/spec/frontend/code_navigation/store/actions_spec.js @@ -8,7 +8,7 @@ jest.mock('~/code_navigation/utils'); describe('Code navigation actions', () => { describe('setInitialData', () => { - it('commits SET_INITIAL_DATA', done => { + it('commits SET_INITIAL_DATA', (done) => { testAction( actions.setInitialData, { projectPath: 'test' }, @@ -57,7 +57,7 @@ describe('Code navigation actions', () => { ]); }); - it('commits REQUEST_DATA_SUCCESS with normalized data', done => { + it('commits REQUEST_DATA_SUCCESS with normalized data', (done) => { testAction( actions.fetchData, null, @@ -84,7 +84,7 @@ describe('Code navigation actions', () => { ); }); - it('calls addInteractionClass with data', done => { + it('calls addInteractionClass with data', (done) => { testAction( actions.fetchData, null, @@ -125,7 +125,7 @@ describe('Code navigation actions', () => { mock.onGet(codeNavigationPath).replyOnce(500); }); - it('dispatches requestDataError', done => { + it('dispatches requestDataError', (done) => { testAction( actions.fetchData, null, @@ -175,15 +175,15 @@ describe('Code navigation actions', () => { target = document.querySelector('.js-test'); }); - it('returns early when no data exists', done => { + it('returns early when no data exists', (done) => { testAction(actions.showDefinition, { target }, {}, [], [], done); }); - it('commits SET_CURRENT_DEFINITION when target is not code navitation element', done => { + it('commits SET_CURRENT_DEFINITION when target is not code navitation element', (done) => { testAction(actions.showDefinition, { target }, { data: {} }, [], [], done); }); - it('commits SET_CURRENT_DEFINITION with LSIF data', done => { + it('commits SET_CURRENT_DEFINITION with LSIF data', (done) => { target.classList.add('js-code-navigation'); target.setAttribute('data-line-index', '0'); target.setAttribute('data-char-index', '0'); diff --git a/spec/frontend/collapsed_sidebar_todo_spec.js b/spec/frontend/collapsed_sidebar_todo_spec.js index 86f4c450c05..3892cb9cd0a 100644 --- a/spec/frontend/collapsed_sidebar_todo_spec.js +++ b/spec/frontend/collapsed_sidebar_todo_spec.js @@ -62,7 +62,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => { ).toBe('Add a to do'); }); - it('toggle todo state', done => { + it('toggle todo state', (done) => { document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click(); setImmediate(() => { @@ -80,7 +80,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => { }); }); - it('toggle todo state of expanded todo toggle', done => { + it('toggle todo state of expanded todo toggle', (done) => { document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click(); setImmediate(() => { @@ -92,7 +92,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => { }); }); - it('toggles todo button tooltip', done => { + it('toggles todo button tooltip', (done) => { document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click(); setImmediate(() => { @@ -106,7 +106,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => { }); }); - it('marks todo as done', done => { + it('marks todo as done', (done) => { document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click(); waitForPromises() @@ -131,7 +131,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => { .catch(done.fail); }); - it('updates aria-label to Mark as done', done => { + it('updates aria-label to Mark as done', (done) => { document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click(); setImmediate(() => { @@ -145,7 +145,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => { }); }); - it('updates aria-label to add todo', done => { + it('updates aria-label to add todo', (done) => { document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click(); waitForPromises() diff --git a/spec/frontend/commit/commit_pipeline_status_component_spec.js b/spec/frontend/commit/commit_pipeline_status_component_spec.js index 625024ee61f..19e831453af 100644 --- a/spec/frontend/commit/commit_pipeline_status_component_spec.js +++ b/spec/frontend/commit/commit_pipeline_status_component_spec.js @@ -105,7 +105,7 @@ describe('Commit pipeline status component', () => { describe('when polling', () => { let pollConfig; beforeEach(() => { - Poll.mockImplementation(config => { + Poll.mockImplementation((config) => { pollConfig = config; return { makeRequest: jest.fn(), restart: jest.fn(), stop: jest.fn() }; }); diff --git a/spec/frontend/commit/pipelines/pipelines_spec.js b/spec/frontend/commit/pipelines/pipelines_spec.js index a196b66daa0..15b1f224699 100644 --- a/spec/frontend/commit/pipelines/pipelines_spec.js +++ b/spec/frontend/commit/pipelines/pipelines_spec.js @@ -31,7 +31,7 @@ describe('Pipelines table in Commits and Merge requests', () => { const { pipelines } = getJSONFixture(jsonFixtureName); PipelinesTable = Vue.extend(pipelinesTable); - pipeline = pipelines.find(p => p.user !== null && p.commit !== null); + pipeline = pipelines.find((p) => p.user !== null && p.commit !== null); }); afterEach(() => { @@ -47,7 +47,7 @@ describe('Pipelines table in Commits and Merge requests', () => { vm = mountComponent(PipelinesTable, props); }); - it('should render the empty state', done => { + it('should render the empty state', (done) => { setImmediate(() => { expect(vm.$el.querySelector('.empty-state')).toBeDefined(); expect(vm.$el.querySelector('.realtime-loading')).toBe(null); @@ -63,7 +63,7 @@ describe('Pipelines table in Commits and Merge requests', () => { vm = mountComponent(PipelinesTable, props); }); - it('should render a table with the received pipelines', done => { + it('should render a table with the received pipelines', (done) => { setImmediate(() => { expect(vm.$el.querySelectorAll('.ci-table .commit').length).toEqual(1); expect(vm.$el.querySelector('.realtime-loading')).toBe(null); @@ -74,7 +74,7 @@ describe('Pipelines table in Commits and Merge requests', () => { }); describe('with pagination', () => { - it('should make an API request when using pagination', done => { + it('should make an API request when using pagination', (done) => { setImmediate(() => { jest.spyOn(vm, 'updateContent').mockImplementation(() => {}); @@ -102,11 +102,11 @@ describe('Pipelines table in Commits and Merge requests', () => { mock.onGet('endpoint.json').reply(200, [pipeline]); }); - it('should receive update-pipelines-count event', done => { + it('should receive update-pipelines-count event', (done) => { const element = document.createElement('div'); document.body.appendChild(element); - element.addEventListener('update-pipelines-count', event => { + element.addEventListener('update-pipelines-count', (event) => { expect(event.detail.pipelines).toEqual([pipeline]); done(); }); @@ -126,7 +126,7 @@ describe('Pipelines table in Commits and Merge requests', () => { }); describe('when latest pipeline has detached flag', () => { - it('renders the run pipeline button', done => { + it('renders the run pipeline button', (done) => { pipelineCopy.flags.detached_merge_request_pipeline = true; pipelineCopy.flags.merge_request_pipeline = true; @@ -143,7 +143,7 @@ describe('Pipelines table in Commits and Merge requests', () => { }); describe('when latest pipeline does not have detached flag', () => { - it('does not render the run pipeline button', done => { + it('does not render the run pipeline button', (done) => { pipelineCopy.flags.detached_merge_request_pipeline = false; pipelineCopy.flags.merge_request_pipeline = false; @@ -163,7 +163,7 @@ describe('Pipelines table in Commits and Merge requests', () => { const findModal = () => document.querySelector('#create-pipeline-for-fork-merge-request-modal'); - beforeEach(done => { + beforeEach((done) => { pipelineCopy.flags.detached_merge_request_pipeline = true; mock.onGet('endpoint.json').reply(200, [pipelineCopy]); @@ -182,7 +182,7 @@ describe('Pipelines table in Commits and Merge requests', () => { }); }); - it('on desktop, shows a loading button', done => { + it('on desktop, shows a loading button', (done) => { findRunPipelineBtn().click(); vm.$nextTick(() => { @@ -200,7 +200,7 @@ describe('Pipelines table in Commits and Merge requests', () => { }); }); - it('on mobile, shows a loading button', done => { + it('on mobile, shows a loading button', (done) => { findRunPipelineBtnMobile().click(); vm.$nextTick(() => { @@ -223,7 +223,7 @@ describe('Pipelines table in Commits and Merge requests', () => { const findModal = () => document.querySelector('#create-pipeline-for-fork-merge-request-modal'); - beforeEach(done => { + beforeEach((done) => { pipelineCopy.flags.detached_merge_request_pipeline = true; mock.onGet('endpoint.json').reply(200, [pipelineCopy]); @@ -244,7 +244,7 @@ describe('Pipelines table in Commits and Merge requests', () => { }); }); - it('on desktop, shows a security warning modal', done => { + it('on desktop, shows a security warning modal', (done) => { findRunPipelineBtn().click(); vm.$nextTick(() => { @@ -253,7 +253,7 @@ describe('Pipelines table in Commits and Merge requests', () => { }); }); - it('on mobile, shows a security warning modal', done => { + it('on mobile, shows a security warning modal', (done) => { findRunPipelineBtnMobile().click(); vm.$nextTick(() => { @@ -271,7 +271,7 @@ describe('Pipelines table in Commits and Merge requests', () => { vm = mountComponent(PipelinesTable, props); }); - it('should render error state', done => { + it('should render error state', (done) => { setImmediate(() => { expect(vm.$el.querySelector('.js-pipelines-error-state')).toBeDefined(); expect(vm.$el.querySelector('.realtime-loading')).toBe(null); diff --git a/spec/frontend/commits_spec.js b/spec/frontend/commits_spec.js index 42bd37570b1..e1b947ddd0d 100644 --- a/spec/frontend/commits_spec.js +++ b/spec/frontend/commits_spec.js @@ -70,7 +70,7 @@ describe('Commits List', () => { mock.restore(); }); - it('should save the last search string', done => { + it('should save the last search string', (done) => { commitsList.searchField.val('GitLab'); commitsList .filterResults() @@ -83,7 +83,7 @@ describe('Commits List', () => { .catch(done.fail); }); - it('should not make ajax call if the input does not change', done => { + it('should not make ajax call if the input does not change', (done) => { commitsList .filterResults() .then(() => { diff --git a/spec/frontend/confirm_modal_spec.js b/spec/frontend/confirm_modal_spec.js index 1b7edfb8ee6..8a12ff3a01f 100644 --- a/spec/frontend/confirm_modal_spec.js +++ b/spec/frontend/confirm_modal_spec.js @@ -29,7 +29,7 @@ describe('ConfirmModal', () => { beforeEach(() => { const buttonContainer = document.createElement('div'); - buttons.forEach(x => { + buttons.forEach((x) => { const button = document.createElement('button'); button.setAttribute('class', 'js-confirm-modal-button'); button.setAttribute('data-path', x.path); @@ -50,7 +50,7 @@ describe('ConfirmModal', () => { const findModal = () => document.querySelector('.gl-modal'); const findModalOkButton = (modal, variant) => modal.querySelector(`.modal-footer .btn-${variant}`); - const findModalCancelButton = modal => modal.querySelector('.modal-footer .btn-secondary'); + const findModalCancelButton = (modal) => modal.querySelector('.modal-footer .btn-secondary'); const modalIsHidden = () => findModal() === null; const serializeModal = (modal, buttonIndex) => { @@ -63,7 +63,7 @@ describe('ConfirmModal', () => { title: modal.querySelector('.modal-title').innerHTML, message: modal.querySelector('.modal-body div').innerHTML, okVariant: [...findModalOkButton(modal, modalAttributes.okVariant).classList] - .find(x => x.match('btn-')) + .find((x) => x.match('btn-')) .replace('btn-', ''), okTitle: findModalOkButton(modal, modalAttributes.okVariant).innerHTML, }, diff --git a/spec/frontend/contributors/store/actions_spec.js b/spec/frontend/contributors/store/actions_spec.js index ad490ea4b67..7d2f93c4940 100644 --- a/spec/frontend/contributors/store/actions_spec.js +++ b/spec/frontend/contributors/store/actions_spec.js @@ -17,7 +17,7 @@ describe('Contributors store actions', () => { mock = new MockAdapter(axios); }); - it('should commit SET_CHART_DATA with received response', done => { + it('should commit SET_CHART_DATA with received response', (done) => { mock.onGet().reply(200, chartData); testAction( @@ -37,7 +37,7 @@ describe('Contributors store actions', () => { ); }); - it('should show flash on API error', done => { + it('should show flash on API error', (done) => { mock.onGet().reply(400, 'Not Found'); testAction( diff --git a/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js b/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js index f9984091df0..a4835f8c1c1 100644 --- a/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js @@ -128,7 +128,7 @@ describe('EksClusterConfigurationForm', () => { }); }; - const createValidStateStore = initialState => { + const createValidStateStore = (initialState) => { createStore({ initialState: { clusterName: 'cluster name', diff --git a/spec/frontend/create_cluster/eks_cluster/store/actions_spec.js b/spec/frontend/create_cluster/eks_cluster/store/actions_spec.js index f14a555f357..35348d3a03b 100644 --- a/spec/frontend/create_cluster/eks_cluster/store/actions_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/store/actions_spec.js @@ -94,7 +94,7 @@ describe('EKS Cluster Store Actions', () => { ${'setNodeCount'} | ${SET_NODE_COUNT} | ${{ nodeCount }} | ${'node count'} ${'setGitlabManagedCluster'} | ${SET_GITLAB_MANAGED_CLUSTER} | ${gitlabManagedCluster} | ${'gitlab managed cluster'} ${'setNamespacePerEnvironment'} | ${SET_NAMESPACE_PER_ENVIRONMENT} | ${namespacePerEnvironment} | ${'namespace per environment'} - `(`$action commits $mutation with $payloadDescription payload`, data => { + `(`$action commits $mutation with $payloadDescription payload`, (data) => { const { action, mutation, payload } = data; testAction(actions[action], payload, state, [{ type: mutation, payload }]); diff --git a/spec/frontend/create_cluster/eks_cluster/store/getters_spec.js b/spec/frontend/create_cluster/eks_cluster/store/getters_spec.js index 7c26aeb9b93..46c37961dd3 100644 --- a/spec/frontend/create_cluster/eks_cluster/store/getters_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/store/getters_spec.js @@ -6,7 +6,7 @@ describe('EKS Cluster Store Getters', () => { expect(subnetValid({ selectedSubnet: [1, 2] })).toBe(true); }); - it.each([[[], [1]]])('returns false if there are 1 or less selected subnets', subnets => { + it.each([[[], [1]]])('returns false if there are 1 or less selected subnets', (subnets) => { expect(subnetValid({ selectedSubnet: subnets })).toBe(false); }); }); diff --git a/spec/frontend/create_cluster/eks_cluster/store/mutations_spec.js b/spec/frontend/create_cluster/eks_cluster/store/mutations_spec.js index 8bb014d4758..633cea595d1 100644 --- a/spec/frontend/create_cluster/eks_cluster/store/mutations_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/store/mutations_spec.js @@ -66,7 +66,7 @@ describe('Create EKS cluster store mutations', () => { ${SET_INSTANCE_TYPE} | ${'selectedInstanceType'} | ${{ instanceType }} | ${instanceType} | ${'selected instance type payload'} ${SET_NODE_COUNT} | ${'nodeCount'} | ${{ nodeCount }} | ${nodeCount} | ${'node count payload'} ${SET_GITLAB_MANAGED_CLUSTER} | ${'gitlabManagedCluster'} | ${{ gitlabManagedCluster }} | ${gitlabManagedCluster} | ${'gitlab managed cluster'} - `(`$mutation sets $mutatedProperty to $expectedValueDescription`, data => { + `(`$mutation sets $mutatedProperty to $expectedValueDescription`, (data) => { const { mutation, mutatedProperty, payload, expectedValue } = data; mutations[mutation](state, payload); diff --git a/spec/frontend/create_cluster/gke_cluster/helpers.js b/spec/frontend/create_cluster/gke_cluster/helpers.js index 52b43b82698..026e99fa8f4 100644 --- a/spec/frontend/create_cluster/gke_cluster/helpers.js +++ b/spec/frontend/create_cluster/gke_cluster/helpers.js @@ -8,7 +8,7 @@ const cloudbilling = { projects: { getBillingInfo: jest.fn( () => - new Promise(resolve => { + new Promise((resolve) => { resolve({ result: { billingEnabled: true }, }); @@ -21,7 +21,7 @@ const cloudresourcemanager = { projects: { list: jest.fn( () => - new Promise(resolve => { + new Promise((resolve) => { resolve({ result: { ...gapiProjectsResponseMock }, }); @@ -34,7 +34,7 @@ const compute = { zones: { list: jest.fn( () => - new Promise(resolve => { + new Promise((resolve) => { resolve({ result: { ...gapiZonesResponseMock }, }); @@ -44,7 +44,7 @@ const compute = { machineTypes: { list: jest.fn( () => - new Promise(resolve => { + new Promise((resolve) => { resolve({ result: { ...gapiMachineTypesResponseMock }, }); diff --git a/spec/frontend/create_cluster/gke_cluster/stores/actions_spec.js b/spec/frontend/create_cluster/gke_cluster/stores/actions_spec.js index c1ac3841136..eb58c4c6904 100644 --- a/spec/frontend/create_cluster/gke_cluster/stores/actions_spec.js +++ b/spec/frontend/create_cluster/gke_cluster/stores/actions_spec.js @@ -14,7 +14,7 @@ import { describe('GCP Cluster Dropdown Store Actions', () => { describe('setProject', () => { - it('should set project', done => { + it('should set project', (done) => { testAction( actions.setProject, selectedProjectMock, @@ -27,7 +27,7 @@ describe('GCP Cluster Dropdown Store Actions', () => { }); describe('setZone', () => { - it('should set zone', done => { + it('should set zone', (done) => { testAction( actions.setZone, selectedZoneMock, @@ -40,7 +40,7 @@ describe('GCP Cluster Dropdown Store Actions', () => { }); describe('setMachineType', () => { - it('should set machine type', done => { + it('should set machine type', (done) => { testAction( actions.setMachineType, selectedMachineTypeMock, @@ -53,7 +53,7 @@ describe('GCP Cluster Dropdown Store Actions', () => { }); describe('setIsValidatingProjectBilling', () => { - it('should set machine type', done => { + it('should set machine type', (done) => { testAction( actions.setIsValidatingProjectBilling, true, @@ -92,7 +92,7 @@ describe('GCP Cluster Dropdown Store Actions', () => { }); describe('validateProjectBilling', () => { - it('checks project billing status from Google API', done => { + it('checks project billing status from Google API', (done) => { testAction( actions.validateProjectBilling, true, diff --git a/spec/frontend/create_cluster/gke_cluster_namespace/gke_cluster_namespace_spec.js b/spec/frontend/create_cluster/gke_cluster_namespace/gke_cluster_namespace_spec.js index b1c25d8fff7..c22167a078c 100644 --- a/spec/frontend/create_cluster/gke_cluster_namespace/gke_cluster_namespace_spec.js +++ b/spec/frontend/create_cluster/gke_cluster_namespace/gke_cluster_namespace_spec.js @@ -2,8 +2,8 @@ import initGkeNamespace from '~/create_cluster/gke_cluster_namespace'; describe('GKE cluster namespace', () => { const changeEvent = new Event('change'); - const isHidden = el => el.classList.contains('hidden'); - const hasDisabledInput = el => el.querySelector('input').disabled; + const isHidden = (el) => el.classList.contains('hidden'); + const hasDisabledInput = (el) => el.querySelector('input').disabled; let glManagedCheckbox; let selfManaged; diff --git a/spec/frontend/create_cluster/store/cluster_dropdown/mutations_spec.js b/spec/frontend/create_cluster/store/cluster_dropdown/mutations_spec.js index 5edd237133d..4b700e31675 100644 --- a/spec/frontend/create_cluster/store/cluster_dropdown/mutations_spec.js +++ b/spec/frontend/create_cluster/store/cluster_dropdown/mutations_spec.js @@ -27,7 +27,7 @@ describe('Cluster dropdown store mutations', () => { ${RECEIVE_ITEMS_SUCCESS} | ${'items'} | ${{ items }} | ${items} | ${'items payload'} ${RECEIVE_ITEMS_ERROR} | ${'isLoadingItems'} | ${{ error }} | ${false} | ${false} ${RECEIVE_ITEMS_ERROR} | ${'error'} | ${{ error }} | ${error} | ${'received error object'} - `(`$mutation sets $mutatedProperty to $expectedValueDescription`, data => { + `(`$mutation sets $mutatedProperty to $expectedValueDescription`, (data) => { const { mutation, mutatedProperty, payload, expectedValue } = data; mutations[mutation](state, payload); diff --git a/spec/frontend/create_item_dropdown_spec.js b/spec/frontend/create_item_dropdown_spec.js index 148b3468ff2..7314eb5eee8 100644 --- a/spec/frontend/create_item_dropdown_spec.js +++ b/spec/frontend/create_item_dropdown_spec.js @@ -162,7 +162,7 @@ describe('CreateItemDropdown', () => { getData: (term, callback) => { callback(DROPDOWN_ITEM_DATA); }, - createNewItemFromValue: newValue => ({ + createNewItemFromValue: (newValue) => ({ title: `${newValue}-title`, id: `${newValue}-id`, text: `${newValue}-text`, diff --git a/spec/frontend/create_merge_request_dropdown_spec.js b/spec/frontend/create_merge_request_dropdown_spec.js index bdf03853597..414f7052e43 100644 --- a/spec/frontend/create_merge_request_dropdown_spec.js +++ b/spec/frontend/create_merge_request_dropdown_spec.js @@ -36,7 +36,7 @@ describe('CreateMergeRequestDropdown', () => { }); describe('getRef', () => { - it('escapes branch names correctly', done => { + it('escapes branch names correctly', (done) => { const endpoint = `${dropdown.refsPath}contains%23hash`; jest.spyOn(axios, 'get'); axiosMock.onGet(endpoint).replyOnce({}); diff --git a/spec/frontend/custom_metrics/components/custom_metrics_form_fields_spec.js b/spec/frontend/custom_metrics/components/custom_metrics_form_fields_spec.js index 79c37293fe5..54880faf46e 100644 --- a/spec/frontend/custom_metrics/components/custom_metrics_form_fields_spec.js +++ b/spec/frontend/custom_metrics/components/custom_metrics_form_fields_spec.js @@ -11,7 +11,7 @@ describe('custom metrics form fields component', () => { let component; let mockAxios; - const getNamedInput = name => component.element.querySelector(`input[name="${name}"]`); + const getNamedInput = (name) => component.element.querySelector(`input[name="${name}"]`); const validateQueryPath = `${TEST_HOST}/mock/path`; const validQueryResponse = { data: { success: true, query: { valid: true, error: '' } } }; const csrfToken = 'mockToken'; @@ -50,7 +50,7 @@ describe('custom metrics form fields component', () => { mockAxios.restore(); }); - it('checks form validity', done => { + it('checks form validity', (done) => { mountComponent({ metricPersisted: true, ...makeFormData({ @@ -157,7 +157,7 @@ describe('custom metrics form fields component', () => { { requestValidation: jest.fn().mockImplementation( () => - new Promise(resolve => + new Promise((resolve) => setTimeout(() => { resolve(validQueryResponse); }, 4000), @@ -171,7 +171,7 @@ describe('custom metrics form fields component', () => { jest.clearAllTimers(); }); - it('expect queryValidateInFlight is in flight', done => { + it('expect queryValidateInFlight is in flight', (done) => { const queryInput = component.find(`input[name="${queryInputName}"]`); queryInput.setValue('query'); queryInput.trigger('input'); @@ -191,7 +191,7 @@ describe('custom metrics form fields component', () => { }); }); - it('expect loading message to display', done => { + it('expect loading message to display', (done) => { const queryInput = component.find(`input[name="${queryInputName}"]`); queryInput.setValue('query'); queryInput.trigger('input'); @@ -202,7 +202,7 @@ describe('custom metrics form fields component', () => { }); }); - it('expect loading message to disappear', done => { + it('expect loading message to disappear', (done) => { const queryInput = component.find(`input[name="${queryInputName}"]`); queryInput.setValue('query'); queryInput.trigger('input'); @@ -239,7 +239,7 @@ describe('custom metrics form fields component', () => { ); }); - it('sets queryIsValid to false', done => { + it('sets queryIsValid to false', (done) => { component.vm.$nextTick(() => { expect(component.vm.queryValidateInFlight).toBe(false); expect(component.vm.queryIsValid).toBe(false); @@ -247,7 +247,7 @@ describe('custom metrics form fields component', () => { }); }); - it('shows invalid query message', done => { + it('shows invalid query message', (done) => { component.vm.$nextTick(() => { expect(component.text()).toContain(errorMessage); done(); @@ -267,7 +267,7 @@ describe('custom metrics form fields component', () => { ); }); - it('sets queryIsValid to true when query is valid', done => { + it('sets queryIsValid to true when query is valid', (done) => { component.vm.$nextTick(() => { expect(component.vm.queryIsValid).toBe(true); done(); diff --git a/spec/frontend/cycle_analytics/limit_warning_component_spec.js b/spec/frontend/cycle_analytics/limit_warning_component_spec.js index e712dea67cb..edde3725dd6 100644 --- a/spec/frontend/cycle_analytics/limit_warning_component_spec.js +++ b/spec/frontend/cycle_analytics/limit_warning_component_spec.js @@ -5,7 +5,7 @@ import LimitWarningComponent from '~/cycle_analytics/components/limit_warning_co Vue.use(Translate); -const createComponent = props => +const createComponent = (props) => shallowMount(LimitWarningComponent, { propsData: { ...props, diff --git a/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js b/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js index 2aa977dfa5a..1b03cc03d02 100644 --- a/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js +++ b/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js @@ -30,7 +30,7 @@ describe('Deploy freeze timezone dropdown', () => { }; const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem); - const findDropdownItemByIndex = index => wrapper.findAll(GlDropdownItem).at(index); + const findDropdownItemByIndex = (index) => wrapper.findAll(GlDropdownItem).at(index); afterEach(() => { wrapper.destroy(); diff --git a/spec/frontend/deploy_keys/components/key_spec.js b/spec/frontend/deploy_keys/components/key_spec.js index f1305a45adc..fcb4e31dec8 100644 --- a/spec/frontend/deploy_keys/components/key_spec.js +++ b/spec/frontend/deploy_keys/components/key_spec.js @@ -9,9 +9,9 @@ describe('Deploy keys key', () => { const data = getJSONFixture('deploy_keys/keys.json'); - const findTextAndTrim = selector => wrapper.find(selector).text().trim(); + const findTextAndTrim = (selector) => wrapper.find(selector).text().trim(); - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = mount(key, { propsData: { store, diff --git a/spec/frontend/deploy_keys/components/keys_panel_spec.js b/spec/frontend/deploy_keys/components/keys_panel_spec.js index ecfbcaec894..34b592017e9 100644 --- a/spec/frontend/deploy_keys/components/keys_panel_spec.js +++ b/spec/frontend/deploy_keys/components/keys_panel_spec.js @@ -8,7 +8,7 @@ describe('Deploy keys panel', () => { const findTableRowHeader = () => wrapper.find('.table-row-header'); - const mountComponent = props => { + const mountComponent = (props) => { const store = new DeployKeysStore(); store.keys = data; wrapper = mount(deployKeysPanel, { diff --git a/spec/frontend/deprecated_jquery_dropdown_spec.js b/spec/frontend/deprecated_jquery_dropdown_spec.js index 32e3a1532a4..6070532a1bf 100644 --- a/spec/frontend/deprecated_jquery_dropdown_spec.js +++ b/spec/frontend/deprecated_jquery_dropdown_spec.js @@ -56,8 +56,8 @@ describe('deprecatedJQueryDropdown', () => { search: { fields: ['name'], }, - text: project => project.name_with_namespace || project.name, - id: project => project.id, + text: (project) => project.name_with_namespace || project.name, + id: (project) => project.id, ...extraOpts, }; test.dropdownButtonElement = $('#js-project-dropdown', test.dropdownContainerElement); diff --git a/spec/frontend/design_management/components/design_notes/design_discussion_spec.js b/spec/frontend/design_management/components/design_notes/design_discussion_spec.js index 0687db177b4..77fc70e08d1 100644 --- a/spec/frontend/design_management/components/design_notes/design_discussion_spec.js +++ b/spec/frontend/design_management/components/design_notes/design_discussion_spec.js @@ -108,7 +108,7 @@ describe('Design discussions component', () => { it('renders correct amount of discussion notes', () => { expect(findDesignNotes()).toHaveLength(2); - expect(findDesignNotes().wrappers.every(w => w.isVisible())).toBe(true); + expect(findDesignNotes().wrappers.every((w) => w.isVisible())).toBe(true); }); it('renders reply placeholder', () => { @@ -251,7 +251,7 @@ describe('Design discussions component', () => { describe('when any note from a discussion is active', () => { it.each([notes[0], notes[0].discussion.notes.nodes[1]])( 'applies correct class to all notes in the active discussion', - note => { + (note) => { createComponent( { discussion: mockDiscussion }, { @@ -265,7 +265,7 @@ describe('Design discussions component', () => { expect( wrapper .findAll(DesignNote) - .wrappers.every(designNote => designNote.classes('gl-bg-blue-50')), + .wrappers.every((designNote) => designNote.classes('gl-bg-blue-50')), ).toBe(true); }, ); diff --git a/spec/frontend/design_management/components/design_overlay_spec.js b/spec/frontend/design_management/components/design_overlay_spec.js index f4fd4c70dfc..a026cc39c84 100644 --- a/spec/frontend/design_management/components/design_overlay_spec.js +++ b/spec/frontend/design_management/components/design_overlay_spec.js @@ -13,7 +13,7 @@ describe('Design overlay component', () => { const findAllNotes = () => wrapper.findAll('.js-image-badge'); const findCommentBadge = () => wrapper.find('.comment-indicator'); - const findBadgeAtIndex = noteIndex => findAllNotes().at(noteIndex); + const findBadgeAtIndex = (noteIndex) => findAllNotes().at(noteIndex); const findFirstBadge = () => findBadgeAtIndex(0); const findSecondBadge = () => findBadgeAtIndex(1); @@ -108,7 +108,7 @@ describe('Design overlay component', () => { describe('when no discussion is active', () => { it('should not apply inactive class to any pins', () => { expect( - findAllNotes(0).wrappers.every(designNote => designNote.classes('gl-bg-blue-50')), + findAllNotes(0).wrappers.every((designNote) => designNote.classes('gl-bg-blue-50')), ).toBe(false); }); }); @@ -116,7 +116,7 @@ describe('Design overlay component', () => { describe('when a discussion is active', () => { it.each([notes[0].discussion.notes.nodes[1], notes[0].discussion.notes.nodes[0]])( 'should not apply inactive class to the pin for the active discussion', - note => { + (note) => { wrapper.setData({ activeDiscussion: { id: note.id, diff --git a/spec/frontend/design_management/components/design_scaler_spec.js b/spec/frontend/design_management/components/design_scaler_spec.js index 290ec3a18e3..40f53e8d0bf 100644 --- a/spec/frontend/design_management/components/design_scaler_spec.js +++ b/spec/frontend/design_management/components/design_scaler_spec.js @@ -10,7 +10,7 @@ describe('Design management design scaler component', () => { const getResetScaleButton = () => getButtons().at(1); const getIncreaseScaleButton = () => getButtons().at(2); - const setScale = scale => wrapper.vm.setScale(scale); + const setScale = (scale) => wrapper.vm.setScale(scale); const createComponent = () => { wrapper = shallowMount(DesignScaler); diff --git a/spec/frontend/design_management/components/upload/design_version_dropdown_spec.js b/spec/frontend/design_management/components/upload/design_version_dropdown_spec.js index 4ef787ac754..d841aabf2f3 100644 --- a/spec/frontend/design_management/components/upload/design_version_dropdown_spec.js +++ b/spec/frontend/design_management/components/upload/design_version_dropdown_spec.js @@ -6,7 +6,7 @@ import mockAllVersions from './mock_data/all_versions'; const LATEST_VERSION_ID = 3; const PREVIOUS_VERSION_ID = 2; -const designRouteFactory = versionId => ({ +const designRouteFactory = (versionId) => ({ path: `/designs?version=${versionId}`, query: { version: `${versionId}`, @@ -42,7 +42,7 @@ describe('Design management design version dropdown component', () => { wrapper.destroy(); }); - const findVersionLink = index => wrapper.findAll(GlDropdownItem).at(index); + const findVersionLink = (index) => wrapper.findAll(GlDropdownItem).at(index); it('renders design version dropdown button', () => { createComponent(); diff --git a/spec/frontend/design_management/pages/index_spec.js b/spec/frontend/design_management/pages/index_spec.js index 31810fc34f0..f2f15e286f5 100644 --- a/spec/frontend/design_management/pages/index_spec.js +++ b/spec/frontend/design_management/pages/index_spec.js @@ -572,7 +572,7 @@ describe('Design management index page', () => { return wrapper.vm.$nextTick().then(() => { expect(findDeleteButton().props().hasSelectedDesigns).toBe(true); expect(findSelectAllButton().text()).toBe('Deselect all'); - expect(wrapper.vm.selectedDesigns).toEqual(mockDesigns.map(design => design.filename)); + expect(wrapper.vm.selectedDesigns).toEqual(mockDesigns.map((design) => design.filename)); }); }); diff --git a/spec/frontend/design_management/router_spec.js b/spec/frontend/design_management/router_spec.js index fac4f7d368d..0b4e68eea78 100644 --- a/spec/frontend/design_management/router_spec.js +++ b/spec/frontend/design_management/router_spec.js @@ -40,7 +40,7 @@ describe('Design management router', () => { window.location.hash = ''; }); - describe.each([['/'], [{ name: DESIGNS_ROUTE_NAME }]])('root route', routeArg => { + describe.each([['/'], [{ name: DESIGNS_ROUTE_NAME }]])('root route', (routeArg) => { it('pushes home component', () => { const wrapper = factory(routeArg); @@ -50,7 +50,7 @@ describe('Design management router', () => { describe.each([['/designs/1'], [{ name: DESIGN_ROUTE_NAME, params: { id: '1' } }]])( 'designs detail route', - routeArg => { + (routeArg) => { it('pushes designs detail component', () => { const wrapper = factory(routeArg); diff --git a/spec/frontend/design_management/utils/error_messages_spec.js b/spec/frontend/design_management/utils/error_messages_spec.js index f5072c3b6b7..b80dcd9abde 100644 --- a/spec/frontend/design_management/utils/error_messages_spec.js +++ b/spec/frontend/design_management/utils/error_messages_spec.js @@ -3,7 +3,7 @@ import { designUploadSkippedWarning, } from '~/design_management/utils/error_messages'; -const mockFilenames = n => +const mockFilenames = (n) => Array(n) .fill(0) .map((_, i) => ({ filename: `${i + 1}.jpg` })); @@ -14,7 +14,7 @@ describe('Error message', () => { const pluralMsg = 'Could not archive designs. Please try again.'; describe('when [singular=true]', () => { - it.each([[undefined], [true]])('uses singular grammar', singularOption => { + it.each([[undefined], [true]])('uses singular grammar', (singularOption) => { expect(designDeletionError({ singular: singularOption })).toEqual(singularMsg); }); }); diff --git a/spec/frontend/diffs/components/app_spec.js b/spec/frontend/diffs/components/app_spec.js index 416564b72c3..34eca7eee35 100644 --- a/spec/frontend/diffs/components/app_spec.js +++ b/spec/frontend/diffs/components/app_spec.js @@ -102,13 +102,13 @@ describe('diffs/components/app', () => { }); describe('fetch diff methods', () => { - beforeEach(done => { + beforeEach((done) => { const fetchResolver = () => { store.state.diffs.retrievingBatches = false; store.state.notes.discussions = 'test'; return Promise.resolve({ real_size: 100 }); }; - jest.spyOn(window, 'requestIdleCallback').mockImplementation(fn => fn()); + jest.spyOn(window, 'requestIdleCallback').mockImplementation((fn) => fn()); createComponent(); jest.spyOn(wrapper.vm, 'fetchDiffFilesMeta').mockImplementation(fetchResolver); jest.spyOn(wrapper.vm, 'fetchDiffFilesBatch').mockImplementation(fetchResolver); @@ -122,7 +122,7 @@ describe('diffs/components/app', () => { wrapper.vm.$nextTick(done); }); - it('calls batch methods if diffsBatchLoad is enabled, and not latest version', done => { + it('calls batch methods if diffsBatchLoad is enabled, and not latest version', (done) => { expect(wrapper.vm.diffFilesLength).toEqual(0); wrapper.vm.isLatestVersion = () => false; wrapper.vm.fetchData(false); @@ -139,7 +139,7 @@ describe('diffs/components/app', () => { }); }); - it('calls batch methods if diffsBatchLoad is enabled, and latest version', done => { + it('calls batch methods if diffsBatchLoad is enabled, and latest version', (done) => { expect(wrapper.vm.diffFilesLength).toEqual(0); wrapper.vm.fetchData(false); @@ -216,7 +216,7 @@ describe('diffs/components/app', () => { window.location.hash = 'ABC_123'; }); - it('sets highlighted row if hash exists in location object', done => { + it('sets highlighted row if hash exists in location object', (done) => { createComponent({ shouldShow: true, }); @@ -267,7 +267,7 @@ describe('diffs/components/app', () => { }); }); - it('marks current diff file based on currently highlighted row', done => { + it('marks current diff file based on currently highlighted row', (done) => { createComponent({ shouldShow: true, }); @@ -439,7 +439,7 @@ describe('diffs/components/app', () => { wrapper.destroy(); }); - it('jumps to next and previous files in the list', done => { + it('jumps to next and previous files in the list', (done) => { wrapper.vm .$nextTick() .then(() => { @@ -459,7 +459,7 @@ describe('diffs/components/app', () => { .catch(done.fail); }); - it('does not jump to previous file from the first one', done => { + it('does not jump to previous file from the first one', (done) => { wrapper.vm .$nextTick() .then(() => { @@ -476,7 +476,7 @@ describe('diffs/components/app', () => { .catch(done.fail); }); - it('does not jump to next file from the last one', done => { + it('does not jump to next file from the last one', (done) => { wrapper.vm .$nextTick() .then(() => { diff --git a/spec/frontend/diffs/components/compare_dropdown_layout_spec.js b/spec/frontend/diffs/components/compare_dropdown_layout_spec.js index 92e4a2d9c62..d99933a1ee9 100644 --- a/spec/frontend/diffs/components/compare_dropdown_layout_spec.js +++ b/spec/frontend/diffs/components/compare_dropdown_layout_spec.js @@ -31,7 +31,7 @@ describe('CompareDropdownLayout', () => { const findListItems = () => wrapper.findAll('li'); const findListItemsData = () => - findListItems().wrappers.map(listItem => ({ + findListItems().wrappers.map((listItem) => ({ href: listItem.find('a').attributes('href'), text: trimText(listItem.text()), createdAt: listItem.findAll(TimeAgo).wrappers[0]?.props('time'), diff --git a/spec/frontend/diffs/components/compare_versions_spec.js b/spec/frontend/diffs/components/compare_versions_spec.js index 09e9669c474..cd7697676c4 100644 --- a/spec/frontend/diffs/components/compare_versions_spec.js +++ b/spec/frontend/diffs/components/compare_versions_spec.js @@ -13,7 +13,7 @@ describe('CompareVersions', () => { let wrapper; const targetBranchName = 'tmp-wine-dev'; - const createWrapper = props => { + const createWrapper = (props) => { const store = createStore(); const mergeRequestDiff = diffsMockData[0]; @@ -121,7 +121,7 @@ describe('CompareVersions', () => { }); describe('commit', () => { - beforeEach(done => { + beforeEach((done) => { wrapper.vm.$store.state.diffs.commit = getDiffWithCommit().commit; wrapper.mergeRequestDiffs = []; diff --git a/spec/frontend/diffs/components/diff_content_spec.js b/spec/frontend/diffs/components/diff_content_spec.js index 43d295ff1b3..c1cf4793c88 100644 --- a/spec/frontend/diffs/components/diff_content_spec.js +++ b/spec/frontend/diffs/components/diff_content_spec.js @@ -102,7 +102,7 @@ describe('DiffContent', () => { describe('with text based files', () => { afterEach(() => { - [isParallelViewGetterMock, isInlineViewGetterMock].forEach(m => m.mockRestore()); + [isParallelViewGetterMock, isInlineViewGetterMock].forEach((m) => m.mockRestore()); }); const textDiffFile = { ...defaultProps.diffFile, viewer: { name: diffViewerModes.text } }; diff --git a/spec/frontend/diffs/components/diff_discussions_spec.js b/spec/frontend/diffs/components/diff_discussions_spec.js index 4f2fa4b84e3..5c390054247 100644 --- a/spec/frontend/diffs/components/diff_discussions_spec.js +++ b/spec/frontend/diffs/components/diff_discussions_spec.js @@ -15,7 +15,7 @@ describe('DiffDiscussions', () => { let wrapper; const getDiscussionsMockData = () => [{ ...discussionsMockData }]; - const createComponent = props => { + const createComponent = (props) => { store = createStore(); wrapper = mount(localVue.extend(DiffDiscussions), { store, diff --git a/spec/frontend/diffs/components/diff_expansion_cell_spec.js b/spec/frontend/diffs/components/diff_expansion_cell_spec.js index a3b4b5c3abb..1e28d48fe1b 100644 --- a/spec/frontend/diffs/components/diff_expansion_cell_spec.js +++ b/spec/frontend/diffs/components/diff_expansion_cell_spec.js @@ -14,7 +14,7 @@ const lineSources = { [INLINE_DIFF_VIEW_TYPE]: 'highlighted_diff_lines', }; const lineHandlers = { - [INLINE_DIFF_VIEW_TYPE]: line => line, + [INLINE_DIFF_VIEW_TYPE]: (line) => line, }; function makeLoadMoreLinesPayload({ diff --git a/spec/frontend/diffs/components/diff_file_spec.js b/spec/frontend/diffs/components/diff_file_spec.js index 71e0ffd176f..77d83b102aa 100644 --- a/spec/frontend/diffs/components/diff_file_spec.js +++ b/spec/frontend/diffs/components/diff_file_spec.js @@ -96,13 +96,13 @@ function createComponent({ file, first = false, last = false }) { }; } -const findDiffHeader = wrapper => wrapper.find(DiffFileHeaderComponent); -const findDiffContentArea = wrapper => wrapper.find('[data-testid="content-area"]'); -const findLoader = wrapper => wrapper.find('[data-testid="loader-icon"]'); -const findToggleButton = wrapper => wrapper.find('[data-testid="expand-button"]'); +const findDiffHeader = (wrapper) => wrapper.find(DiffFileHeaderComponent); +const findDiffContentArea = (wrapper) => wrapper.find('[data-testid="content-area"]'); +const findLoader = (wrapper) => wrapper.find('[data-testid="loader-icon"]'); +const findToggleButton = (wrapper) => wrapper.find('[data-testid="expand-button"]'); -const toggleFile = wrapper => findDiffHeader(wrapper).vm.$emit('toggleFile'); -const isDisplayNone = element => element.style.display === 'none'; +const toggleFile = (wrapper) => findDiffHeader(wrapper).vm.$emit('toggleFile'); +const isDisplayNone = (element) => element.style.display === 'none'; const getReadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataReadable)); const getUnreadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataUnreadable)); @@ -157,7 +157,7 @@ describe('DiffFile', () => { await wrapper.vm.$nextTick(); expect(eventHub.$emit).toHaveBeenCalledTimes(events.length); - events.forEach(event => { + events.forEach((event) => { expect(eventHub.$emit).toHaveBeenCalledWith(event); }); }, @@ -174,7 +174,7 @@ describe('DiffFile', () => { })); jest.spyOn(wrapper.vm, 'loadCollapsedDiff').mockResolvedValue(getReadableFile()); - jest.spyOn(window, 'requestIdleCallback').mockImplementation(fn => fn()); + jest.spyOn(window, 'requestIdleCallback').mockImplementation((fn) => fn()); makeFileAutomaticallyCollapsed(store); @@ -247,7 +247,7 @@ describe('DiffFile', () => { it('should not have any content at all', async () => { await wrapper.vm.$nextTick(); - Array.from(findDiffContentArea(wrapper).element.children).forEach(child => { + Array.from(findDiffContentArea(wrapper).element.children).forEach((child) => { expect(isDisplayNone(child)).toBe(true); }); }); diff --git a/spec/frontend/diffs/components/diff_line_note_form_spec.js b/spec/frontend/diffs/components/diff_line_note_form_spec.js index 75ec5c202af..42815e63ef7 100644 --- a/spec/frontend/diffs/components/diff_line_note_form_spec.js +++ b/spec/frontend/diffs/components/diff_line_note_form_spec.js @@ -51,7 +51,7 @@ describe('DiffLineNoteForm', () => { expect(window.confirm).not.toHaveBeenCalled(); }); - it('should call cancelCommentForm with lineCode', done => { + it('should call cancelCommentForm with lineCode', (done) => { jest.spyOn(window, 'confirm').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'cancelCommentForm').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'resetAutoSave').mockImplementation(() => {}); @@ -72,7 +72,7 @@ describe('DiffLineNoteForm', () => { }); describe('saveNoteForm', () => { - it('should call saveNote action with proper params', done => { + it('should call saveNote action with proper params', (done) => { const saveDiffDiscussionSpy = jest .spyOn(wrapper.vm, 'saveDiffDiscussion') .mockReturnValue(Promise.resolve()); diff --git a/spec/frontend/diffs/components/diff_stats_spec.js b/spec/frontend/diffs/components/diff_stats_spec.js index 4dcbb3ec332..0aaec027c0a 100644 --- a/spec/frontend/diffs/components/diff_stats_spec.js +++ b/spec/frontend/diffs/components/diff_stats_spec.js @@ -39,7 +39,7 @@ describe('diff_stats', () => { }); describe('line changes', () => { - const findFileLine = name => wrapper.find(name); + const findFileLine = (name) => wrapper.find(name); it('shows the amount of lines added', () => { expect(findFileLine('.js-file-addition-line').text()).toBe(TEST_ADDED_LINES.toString()); @@ -51,10 +51,10 @@ describe('diff_stats', () => { }); describe('files changes', () => { - const findIcon = name => + const findIcon = (name) => wrapper .findAll(GlIcon) - .filter(c => c.attributes('name') === name) + .filter((c) => c.attributes('name') === name) .at(0).element.parentNode; it('shows amount of file changed with plural "files" when 0 files has changed', () => { diff --git a/spec/frontend/diffs/components/diff_view_spec.js b/spec/frontend/diffs/components/diff_view_spec.js index 2190aa1794f..9d1242e4b77 100644 --- a/spec/frontend/diffs/components/diff_view_spec.js +++ b/spec/frontend/diffs/components/diff_view_spec.js @@ -11,7 +11,7 @@ describe('DiffView', () => { const DiffRow = { template: `<div/>` }; const DiffCommentCell = { template: `<div/>` }; const DraftNote = { template: `<div/>` }; - const createWrapper = props => { + const createWrapper = (props) => { const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/diffs/components/image_diff_overlay_spec.js b/spec/frontend/diffs/components/image_diff_overlay_spec.js index 209c101d09f..21e154578a1 100644 --- a/spec/frontend/diffs/components/image_diff_overlay_spec.js +++ b/spec/frontend/diffs/components/image_diff_overlay_spec.js @@ -114,7 +114,7 @@ describe('Diffs image diff overlay component', () => { describe('comment form', () => { const getCommentIndicator = () => wrapper.find('.comment-indicator'); beforeEach(() => { - createComponent({ canComment: true }, store => { + createComponent({ canComment: true }, (store) => { store.state.diffs.commentForms.push({ fileHash: 'ABC', x: 20, diff --git a/spec/frontend/diffs/components/no_changes_spec.js b/spec/frontend/diffs/components/no_changes_spec.js index 78805a1cddc..5d00a04d415 100644 --- a/spec/frontend/diffs/components/no_changes_spec.js +++ b/spec/frontend/diffs/components/no_changes_spec.js @@ -28,7 +28,7 @@ describe('Diff no changes empty state', () => { }); it('prevents XSS', () => { - createComponent(store => { + createComponent((store) => { // eslint-disable-next-line no-param-reassign store.state.notes.noteableData = { source_branch: '<script>alert("test");</script>', diff --git a/spec/frontend/diffs/components/parallel_diff_table_row_spec.js b/spec/frontend/diffs/components/parallel_diff_table_row_spec.js index 57eff177261..445553706b7 100644 --- a/spec/frontend/diffs/components/parallel_diff_table_row_spec.js +++ b/spec/frontend/diffs/components/parallel_diff_table_row_spec.js @@ -40,7 +40,7 @@ describe('ParallelDiffTableRow', () => { vm = wrapper.vm; }); - it('does not highlight non empty line content when line does not match highlighted row', done => { + it('does not highlight non empty line content when line does not match highlighted row', (done) => { vm.$nextTick() .then(() => { expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll'); @@ -49,7 +49,7 @@ describe('ParallelDiffTableRow', () => { .catch(done.fail); }); - it('highlights nonempty line content when line is the highlighted row', done => { + it('highlights nonempty line content when line is the highlighted row', (done) => { vm.$nextTick() .then(() => { vm.$store.state.diffs.highlightedRow = rightLine.line_code; @@ -86,7 +86,7 @@ describe('ParallelDiffTableRow', () => { }).$mount(); }); - it('does not highlight either line when line does not match highlighted row', done => { + it('does not highlight either line when line does not match highlighted row', (done) => { vm.$nextTick() .then(() => { expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll'); @@ -96,7 +96,7 @@ describe('ParallelDiffTableRow', () => { .catch(done.fail); }); - it('adds hll class to lineContent when line is the highlighted row', done => { + it('adds hll class to lineContent when line is the highlighted row', (done) => { vm.$nextTick() .then(() => { vm.$store.state.diffs.highlightedRow = rightLine.line_code; @@ -112,7 +112,7 @@ describe('ParallelDiffTableRow', () => { }); describe('sets coverage title and class', () => { - it('for lines with coverage', done => { + it('for lines with coverage', (done) => { vm.$nextTick() .then(() => { const name = diffFileMockData.file_path; @@ -132,7 +132,7 @@ describe('ParallelDiffTableRow', () => { .catch(done.fail); }); - it('for lines without coverage', done => { + it('for lines without coverage', (done) => { vm.$nextTick() .then(() => { const name = diffFileMockData.file_path; @@ -152,7 +152,7 @@ describe('ParallelDiffTableRow', () => { .catch(done.fail); }); - it('for unknown lines', done => { + it('for unknown lines', (done) => { vm.$nextTick() .then(() => { vm.$store.state.diffs.coverageFiles = {}; diff --git a/spec/frontend/diffs/components/settings_dropdown_spec.js b/spec/frontend/diffs/components/settings_dropdown_spec.js index eb9f9b4db73..fcb627c570a 100644 --- a/spec/frontend/diffs/components/settings_dropdown_spec.js +++ b/spec/frontend/diffs/components/settings_dropdown_spec.js @@ -73,7 +73,7 @@ describe('Diff settings dropdown component', () => { }); it('sets list button as selected when renderTreeList is false', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { renderTreeList: false, }); @@ -84,7 +84,7 @@ describe('Diff settings dropdown component', () => { }); it('sets tree button as selected when renderTreeList is true', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { renderTreeList: true, }); @@ -97,7 +97,7 @@ describe('Diff settings dropdown component', () => { describe('compare changes', () => { it('sets inline button as selected', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { diffViewType: INLINE_DIFF_VIEW_TYPE, }); @@ -108,7 +108,7 @@ describe('Diff settings dropdown component', () => { }); it('sets parallel button as selected', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { diffViewType: PARALLEL_DIFF_VIEW_TYPE, }); @@ -137,7 +137,7 @@ describe('Diff settings dropdown component', () => { describe('whitespace toggle', () => { it('does not set as checked when showWhitespace is false', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { showWhitespace: false, }); @@ -147,7 +147,7 @@ describe('Diff settings dropdown component', () => { }); it('sets as checked when showWhitespace is true', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { showWhitespace: true, }); @@ -183,7 +183,7 @@ describe('Diff settings dropdown component', () => { `( 'sets the checkbox to { checked: $checked } if the fileByFile setting is $fileByFile', async ({ fileByFile, checked }) => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { viewDiffsFileByFile: fileByFile, }); @@ -202,7 +202,7 @@ describe('Diff settings dropdown component', () => { `( 'when the file by file setting starts as $start, toggling the checkbox should emit an event set to $emit', async ({ start, emit }) => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { viewDiffsFileByFile: start, }); diff --git a/spec/frontend/diffs/store/actions_spec.js b/spec/frontend/diffs/store/actions_spec.js index b351f4e4eca..662f2506ba5 100644 --- a/spec/frontend/diffs/store/actions_spec.js +++ b/spec/frontend/diffs/store/actions_spec.js @@ -78,22 +78,22 @@ describe('DiffsStoreActions', () => { jest.spyOn(commonUtils, 'scrollToElement').mockImplementation(() => null); jest.spyOn(utils, 'convertExpandLines').mockImplementation(() => null); jest.spyOn(utils, 'idleCallback').mockImplementation(() => null); - ['requestAnimationFrame', 'requestIdleCallback'].forEach(method => { - global[method] = cb => { + ['requestAnimationFrame', 'requestIdleCallback'].forEach((method) => { + global[method] = (cb) => { cb(); }; }); }); afterEach(() => { - ['requestAnimationFrame', 'requestIdleCallback'].forEach(method => { + ['requestAnimationFrame', 'requestIdleCallback'].forEach((method) => { global[method] = originalMethods[method]; }); createFlash.mockClear(); }); describe('setBaseConfig', () => { - it('should set given endpoint and project path', done => { + it('should set given endpoint and project path', (done) => { const endpoint = '/diffs/set/endpoint'; const endpointMetadata = '/diffs/set/endpoint/metadata'; const endpointBatch = '/diffs/set/endpoint/batch'; @@ -153,7 +153,7 @@ describe('DiffsStoreActions', () => { mock.restore(); }); - it('should fetch batch diff files', done => { + it('should fetch batch diff files', (done) => { const endpointBatch = '/fetch/diffs_batch'; const res1 = { diff_files: [{ file_hash: 'test' }], pagination: { next_page: 2 } }; const res2 = { diff_files: [{ file_hash: 'test2' }], pagination: {} }; @@ -241,7 +241,7 @@ describe('DiffsStoreActions', () => { mock.onGet(endpointMetadata).reply(200, diffMetadata); }); - it('should fetch diff meta information', done => { + it('should fetch diff meta information', (done) => { testAction( fetchDiffFilesMeta, {}, @@ -271,7 +271,7 @@ describe('DiffsStoreActions', () => { afterEach(() => mock.restore()); - it('should commit SET_COVERAGE_DATA with received response', done => { + it('should commit SET_COVERAGE_DATA with received response', (done) => { const data = { files: { 'app.js': { 1: 0, 2: 1 } } }; mock.onGet(endpointCoverage).reply(200, { data }); @@ -286,7 +286,7 @@ describe('DiffsStoreActions', () => { ); }); - it('should show flash on API error', done => { + it('should show flash on API error', (done) => { mock.onGet(endpointCoverage).reply(400); testAction(fetchCoverageFiles, {}, { endpointCoverage }, [], [], () => { @@ -311,7 +311,7 @@ describe('DiffsStoreActions', () => { window.location.hash = ''; }); - it('should merge discussions into diffs', done => { + it('should merge discussions into diffs', (done) => { window.location.hash = 'ABC_123'; const state = { @@ -405,7 +405,7 @@ describe('DiffsStoreActions', () => { ); }); - it('dispatches setCurrentDiffFileIdFromNote with note ID', done => { + it('dispatches setCurrentDiffFileIdFromNote with note ID', (done) => { window.location.hash = 'note_123'; testAction( @@ -420,7 +420,7 @@ describe('DiffsStoreActions', () => { }); describe('removeDiscussionsFromDiff', () => { - it('should remove discussions from diffs', done => { + it('should remove discussions from diffs', (done) => { const state = { diffFiles: [ { @@ -512,7 +512,7 @@ describe('DiffsStoreActions', () => { }); describe('setInlineDiffViewType', () => { - it('should set diff view type to inline and also set the cookie properly', done => { + it('should set diff view type to inline and also set the cookie properly', (done) => { testAction( setInlineDiffViewType, null, @@ -530,7 +530,7 @@ describe('DiffsStoreActions', () => { }); describe('setParallelDiffViewType', () => { - it('should set diff view type to parallel and also set the cookie properly', done => { + it('should set diff view type to parallel and also set the cookie properly', (done) => { testAction( setParallelDiffViewType, null, @@ -548,7 +548,7 @@ describe('DiffsStoreActions', () => { }); describe('showCommentForm', () => { - it('should call mutation to show comment form', done => { + it('should call mutation to show comment form', (done) => { const payload = { lineCode: 'lineCode', fileHash: 'hash' }; testAction( @@ -563,7 +563,7 @@ describe('DiffsStoreActions', () => { }); describe('cancelCommentForm', () => { - it('should call mutation to cancel comment form', done => { + it('should call mutation to cancel comment form', (done) => { const payload = { lineCode: 'lineCode', fileHash: 'hash' }; testAction( @@ -578,7 +578,7 @@ describe('DiffsStoreActions', () => { }); describe('loadMoreLines', () => { - it('should call mutation to show comment form', done => { + it('should call mutation to show comment form', (done) => { const endpoint = '/diffs/load/more/lines'; const params = { since: 6, to: 26 }; const lineNumbers = { oldLineNumber: 3, newLineNumber: 5 }; @@ -611,7 +611,7 @@ describe('DiffsStoreActions', () => { describe('loadCollapsedDiff', () => { const state = { showWhitespace: true }; - it('should fetch data and call mutation with response and the give parameter', done => { + it('should fetch data and call mutation with response and the give parameter', (done) => { const file = { hash: 123, load_collapsed_diff_url: '/load/collapsed/diff/url' }; const data = { hash: 123, parallelDiffLines: [{ lineCode: 1 }] }; const mock = new MockAdapter(axios); @@ -811,7 +811,7 @@ describe('DiffsStoreActions', () => { }); describe('saveDiffDiscussion', () => { - it('dispatches actions', done => { + it('dispatches actions', (done) => { const commitId = 'something'; const formData = { diffFile: { ...mockDiffFile }, @@ -823,7 +823,7 @@ describe('DiffsStoreActions', () => { id: commitId, }, }; - const dispatch = jest.fn(name => { + const dispatch = jest.fn((name) => { switch (name) { case 'saveNote': return Promise.resolve({ @@ -855,7 +855,7 @@ describe('DiffsStoreActions', () => { }); describe('toggleTreeOpen', () => { - it('commits TOGGLE_FOLDER_OPEN', done => { + it('commits TOGGLE_FOLDER_OPEN', (done) => { testAction( toggleTreeOpen, 'path', @@ -904,7 +904,7 @@ describe('DiffsStoreActions', () => { }); describe('setShowTreeList', () => { - it('commits toggle', done => { + it('commits toggle', (done) => { testAction( setShowTreeList, { showTreeList: true }, @@ -992,7 +992,7 @@ describe('DiffsStoreActions', () => { }); describe('setRenderTreeList', () => { - it('commits SET_RENDER_TREE_LIST', done => { + it('commits SET_RENDER_TREE_LIST', (done) => { testAction( setRenderTreeList, true, @@ -1015,7 +1015,7 @@ describe('DiffsStoreActions', () => { jest.spyOn(eventHub, '$emit').mockImplementation(); }); - it('commits SET_SHOW_WHITESPACE', done => { + it('commits SET_SHOW_WHITESPACE', (done) => { testAction( setShowWhitespace, { showWhitespace: true }, @@ -1058,13 +1058,13 @@ describe('DiffsStoreActions', () => { }); describe('setRenderIt', () => { - it('commits RENDER_FILE', done => { + it('commits RENDER_FILE', (done) => { testAction(setRenderIt, 'file', {}, [{ type: types.RENDER_FILE, payload: 'file' }], [], done); }); }); describe('receiveFullDiffError', () => { - it('updates state with the file that did not load', done => { + it('updates state with the file that did not load', (done) => { testAction( receiveFullDiffError, 'file', @@ -1092,7 +1092,7 @@ describe('DiffsStoreActions', () => { mock.onGet(`${TEST_HOST}/context`).replyOnce(200, ['test']); }); - it('commits the success and dispatches an action to expand the new lines', done => { + it('commits the success and dispatches an action to expand the new lines', (done) => { const file = { context_lines_path: `${TEST_HOST}/context`, file_path: 'test', @@ -1114,7 +1114,7 @@ describe('DiffsStoreActions', () => { mock.onGet(`${TEST_HOST}/context`).replyOnce(500); }); - it('dispatches receiveFullDiffError', done => { + it('dispatches receiveFullDiffError', (done) => { testAction( fetchFullDiff, { context_lines_path: `${TEST_HOST}/context`, file_path: 'test', file_hash: 'test' }, @@ -1136,7 +1136,7 @@ describe('DiffsStoreActions', () => { }; }); - it('dispatches fetchFullDiff when file is not expanded', done => { + it('dispatches fetchFullDiff when file is not expanded', (done) => { testAction( toggleFullDiff, 'test', @@ -1212,7 +1212,7 @@ describe('DiffsStoreActions', () => { }); describe('setFileUserCollapsed', () => { - it('commits SET_FILE_COLLAPSED', done => { + it('commits SET_FILE_COLLAPSED', (done) => { testAction( setFileCollapsedByUser, { filePath: 'test', collapsed: true }, @@ -1231,12 +1231,12 @@ describe('DiffsStoreActions', () => { describe('setExpandedDiffLines', () => { beforeEach(() => { - utils.idleCallback.mockImplementation(cb => { + utils.idleCallback.mockImplementation((cb) => { cb({ timeRemaining: () => 50 }); }); }); - it('commits SET_CURRENT_VIEW_DIFF_FILE_LINES when lines less than MAX_RENDERING_DIFF_LINES', done => { + it('commits SET_CURRENT_VIEW_DIFF_FILE_LINES when lines less than MAX_RENDERING_DIFF_LINES', (done) => { utils.convertExpandLines.mockImplementation(() => ['test']); testAction( @@ -1254,7 +1254,7 @@ describe('DiffsStoreActions', () => { ); }); - it('commits ADD_CURRENT_VIEW_DIFF_FILE_LINES when lines more than MAX_RENDERING_DIFF_LINES', done => { + it('commits ADD_CURRENT_VIEW_DIFF_FILE_LINES when lines more than MAX_RENDERING_DIFF_LINES', (done) => { const lines = new Array(501).fill().map((_, i) => `line-${i}`); utils.convertExpandLines.mockReturnValue(lines); @@ -1281,7 +1281,7 @@ describe('DiffsStoreActions', () => { }); describe('setSuggestPopoverDismissed', () => { - it('commits SET_SHOW_SUGGEST_POPOVER', done => { + it('commits SET_SHOW_SUGGEST_POPOVER', (done) => { const state = { dismissEndpoint: `${TEST_HOST}/-/user_callouts` }; const mock = new MockAdapter(axios); mock.onPost(state.dismissEndpoint).reply(200, {}); @@ -1446,7 +1446,7 @@ describe('DiffsStoreActions', () => { }); describe('navigateToDiffFileIndex', () => { - it('commits VIEW_DIFF_FILE', done => { + it('commits VIEW_DIFF_FILE', (done) => { testAction( navigateToDiffFileIndex, 0, diff --git a/spec/frontend/diffs/store/getters_versions_dropdowns_spec.js b/spec/frontend/diffs/store/getters_versions_dropdowns_spec.js index 0343ef75732..19f3d28e45e 100644 --- a/spec/frontend/diffs/store/getters_versions_dropdowns_spec.js +++ b/spec/frontend/diffs/store/getters_versions_dropdowns_spec.js @@ -49,7 +49,7 @@ describe('Compare diff version dropdowns', () => { let expectedHeadVersion; const originalLocation = window.location; - const setupTest = includeDiffHeadParam => { + const setupTest = (includeDiffHeadParam) => { const diffHeadParam = includeDiffHeadParam ? '?diff_head=true' : ''; Object.defineProperty(window, 'location', { @@ -81,7 +81,7 @@ describe('Compare diff version dropdowns', () => { }; }; - const assertVersions = targetVersions => { + const assertVersions = (targetVersions) => { // base and head should be the last two versions in that order const targetBaseVersion = targetVersions[targetVersions.length - 2]; const targetHeadVersion = targetVersions[targetVersions.length - 1]; diff --git a/spec/frontend/diffs/store/utils_spec.js b/spec/frontend/diffs/store/utils_spec.js index 3c44ba3fc07..9fef48ccf42 100644 --- a/spec/frontend/diffs/store/utils_spec.js +++ b/spec/frontend/diffs/store/utils_spec.js @@ -481,7 +481,7 @@ describe('DiffsStoreUtils', () => { }); it('adds the `.brokenSymlink` property to each diff file', () => { - preparedDiff.diff_files.forEach(file => { + preparedDiff.diff_files.forEach((file) => { expect(file).toEqual(expect.objectContaining({ brokenSymlink: false })); }); }); @@ -492,9 +492,9 @@ describe('DiffsStoreUtils', () => { ...splitInlineDiff.diff_files, ...splitParallelDiff.diff_files, ...completedDiff.diff_files, - ].flatMap(file => [...file[INLINE_DIFF_LINES_KEY]]); + ].flatMap((file) => [...file[INLINE_DIFF_LINES_KEY]]); - lines.forEach(line => { + lines.forEach((line) => { expect(line.commentsDisabled).toBe(false); }); }); @@ -560,7 +560,7 @@ describe('DiffsStoreUtils', () => { }); it('adds the `.brokenSymlink` property to each meta diff file', () => { - preparedDiffFiles.forEach(file => { + preparedDiffFiles.forEach((file) => { expect(file).toMatchObject({ brokenSymlink: false }); }); }); diff --git a/spec/frontend/diffs/utils/uuids_spec.js b/spec/frontend/diffs/utils/uuids_spec.js index 79d3ebadd4f..8d0a01e8cbd 100644 --- a/spec/frontend/diffs/utils/uuids_spec.js +++ b/spec/frontend/diffs/utils/uuids_spec.js @@ -32,7 +32,7 @@ describe('UUIDs Util', () => { const ids = uuids({ count: 11 }); expect(ids.length).toEqual(11); - expect(ids.every(id => UUIDV4.test(id))).toEqual(true); + expect(ids.every((id) => UUIDV4.test(id))).toEqual(true); }); it.each` diff --git a/spec/frontend/dirty_submit/dirty_submit_collection_spec.js b/spec/frontend/dirty_submit/dirty_submit_collection_spec.js index 170d581be23..465391633e6 100644 --- a/spec/frontend/dirty_submit/dirty_submit_collection_spec.js +++ b/spec/frontend/dirty_submit/dirty_submit_collection_spec.js @@ -1,15 +1,15 @@ import DirtySubmitCollection from '~/dirty_submit/dirty_submit_collection'; import { setInputValue, createForm } from './helper'; -jest.mock('lodash/throttle', () => jest.fn(fn => fn)); +jest.mock('lodash/throttle', () => jest.fn((fn) => fn)); describe('DirtySubmitCollection', () => { const testElementsCollection = [createForm(), createForm()]; - const forms = testElementsCollection.map(testElements => testElements.form); + const forms = testElementsCollection.map((testElements) => testElements.form); new DirtySubmitCollection(forms); // eslint-disable-line no-new - it.each(testElementsCollection)('disables submits until there are changes', testElements => { + it.each(testElementsCollection)('disables submits until there are changes', (testElements) => { const { input, submit } = testElements; const originalValue = input.value; diff --git a/spec/frontend/dirty_submit/dirty_submit_form_spec.js b/spec/frontend/dirty_submit/dirty_submit_form_spec.js index d7f690df1f3..cfcf1be609e 100644 --- a/spec/frontend/dirty_submit/dirty_submit_form_spec.js +++ b/spec/frontend/dirty_submit/dirty_submit_form_spec.js @@ -2,7 +2,7 @@ import { range as rge, throttle } from 'lodash'; import DirtySubmitForm from '~/dirty_submit/dirty_submit_form'; import { getInputValue, setInputValue, createForm } from './helper'; -jest.mock('lodash/throttle', () => jest.fn(fn => fn)); +jest.mock('lodash/throttle', () => jest.fn((fn) => fn)); const lodash = jest.requireActual('lodash'); function expectToToggleDisableOnDirtyUpdate(submit, input) { @@ -66,7 +66,7 @@ describe('DirtySubmitForm', () => { const { form, input } = createForm(); const updateDirtyInputSpy = jest.spyOn(new DirtySubmitForm(form), 'updateDirtyInput'); - rge(10).forEach(i => { + rge(10).forEach((i) => { setInputValue(input, `change ${i}`, false); }); @@ -78,13 +78,13 @@ describe('DirtySubmitForm', () => { it('does not throttle updates when rapid changes are made to different form elements', () => { const form = document.createElement('form'); const range = rge(10); - range.forEach(i => { + range.forEach((i) => { form.innerHTML += `<input type="text" name="input-${i}" class="js-input-${i}"/>`; }); const updateDirtyInputSpy = jest.spyOn(new DirtySubmitForm(form), 'updateDirtyInput'); - range.forEach(i => { + range.forEach((i) => { const input = form.querySelector(`.js-input-${i}`); setInputValue(input, `change`, false); }); diff --git a/spec/frontend/droplab/drop_down_spec.js b/spec/frontend/droplab/drop_down_spec.js index d33d6bb70f1..c1fbda6f211 100644 --- a/spec/frontend/droplab/drop_down_spec.js +++ b/spec/frontend/droplab/drop_down_spec.js @@ -151,7 +151,7 @@ describe('DropLab DropDown', () => { }; testContext.dummyListItem = document.createElement('li'); - jest.spyOn(testContext.event.target, 'closest').mockImplementation(selector => { + jest.spyOn(testContext.event.target, 'closest').mockImplementation((selector) => { if (selector === 'li') { return testContext.dummyListItem; } @@ -402,7 +402,7 @@ describe('DropLab DropDown', () => { beforeEach(() => { testContext.renderableList = {}; testContext.list = { - querySelector: q => { + querySelector: (q) => { if (q === '.filter-dropdown-loading') { return false; } @@ -414,7 +414,7 @@ describe('DropLab DropDown', () => { testContext.data = [0, 1]; testContext.customEvent = {}; - jest.spyOn(testContext.dropdown, 'renderChildren').mockImplementation(data => data); + jest.spyOn(testContext.dropdown, 'renderChildren').mockImplementation((data) => data); jest.spyOn(testContext.list, 'dispatchEvent').mockImplementation(() => {}); jest.spyOn(testContext.data, 'map'); jest.spyOn(window, 'CustomEvent').mockReturnValue(testContext.customEvent); @@ -465,7 +465,7 @@ describe('DropLab DropDown', () => { testContext.dropdown = { renderChildren: () => {}, list: testContext.list }; testContext.data = [0, 1]; - jest.spyOn(testContext.dropdown, 'renderChildren').mockImplementation(data => data); + jest.spyOn(testContext.dropdown, 'renderChildren').mockImplementation((data) => data); jest.spyOn(testContext.list, 'querySelector').mockImplementation(() => {}); jest.spyOn(testContext.data, 'map'); diff --git a/spec/frontend/droplab/plugins/ajax_filter_spec.js b/spec/frontend/droplab/plugins/ajax_filter_spec.js index 5ec0400cbc5..d91884a60e5 100644 --- a/spec/frontend/droplab/plugins/ajax_filter_spec.js +++ b/spec/frontend/droplab/plugins/ajax_filter_spec.js @@ -28,7 +28,7 @@ describe('AjaxFilter', () => { let ajaxSpy; beforeEach(() => { - jest.spyOn(AjaxCache, 'retrieve').mockImplementation(url => ajaxSpy(url)); + jest.spyOn(AjaxCache, 'retrieve').mockImplementation((url) => ajaxSpy(url)); jest.spyOn(AjaxFilter, '_loadData').mockImplementation(() => {}); dummyConfig.onLoadingFinished = jest.fn(); @@ -38,8 +38,8 @@ describe('AjaxFilter', () => { dummyList.list.appendChild(dynamicList); }); - it('calls onLoadingFinished after loading data', done => { - ajaxSpy = url => { + it('calls onLoadingFinished after loading data', (done) => { + ajaxSpy = (url) => { expect(url).toBe('dummy endpoint?dummy search key='); return Promise.resolve(dummyData); }; @@ -52,16 +52,16 @@ describe('AjaxFilter', () => { .catch(done.fail); }); - it('does not call onLoadingFinished if Ajax call fails', done => { + it('does not call onLoadingFinished if Ajax call fails', (done) => { const dummyError = new Error('My dummy is sick! :-('); - ajaxSpy = url => { + ajaxSpy = (url) => { expect(url).toBe('dummy endpoint?dummy search key='); return Promise.reject(dummyError); }; AjaxFilter.trigger() .then(done.fail) - .catch(error => { + .catch((error) => { expect(error).toBe(dummyError); expect(dummyConfig.onLoadingFinished.mock.calls.length).toBe(0); }) diff --git a/spec/frontend/editor/editor_lite_extension_base_spec.js b/spec/frontend/editor/editor_lite_extension_base_spec.js index ff53640b096..8261864b7a2 100644 --- a/spec/frontend/editor/editor_lite_extension_base_spec.js +++ b/spec/frontend/editor/editor_lite_extension_base_spec.js @@ -16,7 +16,7 @@ describe('The basis for an Editor Lite extension', () => { if (instance) { if (options) { - Object.entries(options).forEach(prop => { + Object.entries(options).forEach((prop) => { expect(instance[prop]).toBeUndefined(); }); // Both instance and options are passed diff --git a/spec/frontend/editor/editor_lite_spec.js b/spec/frontend/editor/editor_lite_spec.js index 3a7680f6d17..7d8acd8599a 100644 --- a/spec/frontend/editor/editor_lite_spec.js +++ b/spec/frontend/editor/editor_lite_spec.js @@ -324,13 +324,13 @@ describe('Base editor', () => { ${'multiple simple objects'} | ${[FooObjExt, BarObjExt]} | ${['foo', 'bar']} | ${[fooRes, barRes]} ${'combination of ES6 classes and objects'} | ${[AlphaExt, BarObjExt]} | ${['alpha', 'bar']} | ${[alphaRes, barRes]} `('is extensible with $type', ({ extensions, methods, expectations } = {}) => { - methods.forEach(method => { + methods.forEach((method) => { expect(instance[method]).toBeUndefined(); }); instance.use(extensions); - methods.forEach(method => { + methods.forEach((method) => { expect(instance[method]).toBeDefined(); }); @@ -359,7 +359,7 @@ describe('Base editor', () => { it.each([WithStaticMethod, WithStaticMethodExtended])( 'properly resolves data for an extension with private data', - ExtClass => { + (ExtClass) => { const base = 1; expect(instance.base).toBeUndefined(); expect(instance.boo).toBeUndefined(); @@ -408,7 +408,7 @@ describe('Base editor', () => { }; beforeEach(() => { - editorExtensionSpy = jest.spyOn(Editor, 'pushToImportsArray').mockImplementation(arr => { + editorExtensionSpy = jest.spyOn(Editor, 'pushToImportsArray').mockImplementation((arr) => { arr.push( Promise.resolve({ default: {}, @@ -524,7 +524,7 @@ describe('Base editor', () => { }); it('sets default syntax highlighting theme', () => { - const expectedTheme = themes.find(t => t.name === DEFAULT_THEME); + const expectedTheme = themes.find((t) => t.name === DEFAULT_THEME); editor = new Editor(); @@ -533,7 +533,7 @@ describe('Base editor', () => { }); it('sets correct theme if it is set in users preferences', () => { - const expectedTheme = themes.find(t => t.name !== DEFAULT_THEME); + const expectedTheme = themes.find((t) => t.name !== DEFAULT_THEME); expect(expectedTheme.name).not.toBe(DEFAULT_THEME); diff --git a/spec/frontend/editor/editor_markdown_ext_spec.js b/spec/frontend/editor/editor_markdown_ext_spec.js index b432d4d66ad..f3b5add0b70 100644 --- a/spec/frontend/editor/editor_markdown_ext_spec.js +++ b/spec/frontend/editor/editor_markdown_ext_spec.js @@ -114,7 +114,7 @@ describe('Markdown Extension for Editor Lite', () => { }); describe('moveCursor', () => { - const setPosition = endCol => { + const setPosition = (endCol) => { const currentPos = new Position(2, endCol); instance.setPosition(currentPos); }; diff --git a/spec/frontend/emoji/emoji_spec.js b/spec/frontend/emoji/emoji_spec.js index f528313ef02..feec445bc8d 100644 --- a/spec/frontend/emoji/emoji_spec.js +++ b/spec/frontend/emoji/emoji_spec.js @@ -369,11 +369,11 @@ describe('gl_emoji', () => { describe('searchEmoji', () => { const { atom, grey_question } = emojiFixtureMap; const search = (query, opts) => searchEmoji(query, opts).map(({ name }) => name); - const mangle = str => str.slice(0, 1) + str.slice(-1); - const partial = str => str.slice(0, 2); + const mangle = (str) => str.slice(0, 1) + str.slice(-1); + const partial = (str) => str.slice(0, 2); describe('with default options', () => { - const subject = query => search(query); + const subject = (query) => search(query); describeEmojiFields('with $field', ({ accessor }) => { it(`should match by lower case: ${accessor(atom)}`, () => { @@ -403,7 +403,7 @@ describe('gl_emoji', () => { }); describe('with fuzzy match', () => { - const subject = query => search(query, { match: 'fuzzy' }); + const subject = (query) => search(query, { match: 'fuzzy' }); describeEmojiFields('with $field', ({ accessor }) => { it(`should match by lower case: ${accessor(atom)}`, () => { @@ -421,7 +421,7 @@ describe('gl_emoji', () => { }); describe('with contains match', () => { - const subject = query => search(query, { match: 'contains' }); + const subject = (query) => search(query, { match: 'contains' }); describeEmojiFields('with $field', ({ accessor }) => { it(`should match by lower case: ${accessor(atom)}`, () => { @@ -443,7 +443,7 @@ describe('gl_emoji', () => { }); describe('with fallback', () => { - const subject = query => search(query, { fallback: true }); + const subject = (query) => search(query, { fallback: true }); it.each` query @@ -454,7 +454,7 @@ describe('gl_emoji', () => { }); describe('with name and alias fields', () => { - const subject = query => search(query, { fields: ['name', 'alias'] }); + const subject = (query) => search(query, { fields: ['name', 'alias'] }); it(`should match by name: ${atom.name}`, () => { expect(subject(atom.name)).toContain(atom.name); diff --git a/spec/frontend/environment.js b/spec/frontend/environment.js index 733bf4378eb..54ef73ac9f7 100644 --- a/spec/frontend/environment.js +++ b/spec/frontend/environment.js @@ -37,7 +37,7 @@ class CustomEnvironment extends JSDOMEnvironment { this.rejectedPromises = []; - this.global.promiseRejectionHandler = error => { + this.global.promiseRejectionHandler = (error) => { this.rejectedPromises.push(error); }; diff --git a/spec/frontend/environments/environment_actions_spec.js b/spec/frontend/environments/environment_actions_spec.js index cc5153d6eba..875a01c07ea 100644 --- a/spec/frontend/environments/environment_actions_spec.js +++ b/spec/frontend/environments/environment_actions_spec.js @@ -38,9 +38,9 @@ describe('EnvironmentActions Component', () => { return createComponent({ actions: [scheduledJobAction, expiredJobAction] }, opts); } - const findDropdownItem = action => { + const findDropdownItem = (action) => { const buttons = wrapper.findAll(GlDropdownItem); - return buttons.filter(button => button.text().startsWith(action.name)).at(0); + return buttons.filter((button) => button.text().startsWith(action.name)).at(0); }; afterEach(() => { diff --git a/spec/frontend/environments/environment_table_spec.js b/spec/frontend/environments/environment_table_spec.js index b8ef40e2568..aa29cc1fa2b 100644 --- a/spec/frontend/environments/environment_table_spec.js +++ b/spec/frontend/environments/environment_table_spec.js @@ -266,7 +266,7 @@ describe('Environment table', () => { }, }); - expect(wrapper.vm.sortedEnvironments.map(env => env.name)).toEqual([ + expect(wrapper.vm.sortedEnvironments.map((env) => env.name)).toEqual([ review.name, staging.name, production.name, diff --git a/spec/frontend/environments/environment_terminal_button_spec.js b/spec/frontend/environments/environment_terminal_button_spec.js index 274186fbbd6..2475785a927 100644 --- a/spec/frontend/environments/environment_terminal_button_spec.js +++ b/spec/frontend/environments/environment_terminal_button_spec.js @@ -5,7 +5,7 @@ describe('Stop Component', () => { let wrapper; const terminalPath = '/path'; - const mountWithProps = props => { + const mountWithProps = (props) => { wrapper = shallowMount(TerminalComponent, { propsData: props, }); diff --git a/spec/frontend/environments/folder/environments_folder_view_spec.js b/spec/frontend/environments/folder/environments_folder_view_spec.js index f55cb851dde..abead001832 100644 --- a/spec/frontend/environments/folder/environments_folder_view_spec.js +++ b/spec/frontend/environments/folder/environments_folder_view_spec.js @@ -23,7 +23,7 @@ describe('Environments Folder View', () => { helpCanaryDeploymentsPath: 'help/canary-deployments', }; - const mockEnvironments = environmentList => { + const mockEnvironments = (environmentList) => { mock.onGet(mockData.endpoint).reply( 200, { diff --git a/spec/frontend/error_tracking/components/error_details_spec.js b/spec/frontend/error_tracking/components/error_details_spec.js index ef3eeb8c7e4..0b9e0008ed7 100644 --- a/spec/frontend/error_tracking/components/error_details_spec.js +++ b/spec/frontend/error_tracking/components/error_details_spec.js @@ -38,8 +38,8 @@ describe('ErrorDetails', () => { let mocks; const externalUrl = 'https://sentry.io/organizations/test-sentry-nk/issues/1/?project=1'; - const findInput = name => { - const inputs = wrapper.findAll(GlFormInput).filter(c => c.attributes('name') === name); + const findInput = (name) => { + const inputs = wrapper.findAll(GlFormInput).filter((c) => c.attributes('name') === name); return inputs.length ? inputs.at(0) : inputs; }; @@ -245,7 +245,7 @@ describe('ErrorDetails', () => { it.each(Object.keys(severityLevel))( 'should set correct severity level variant for %s badge', - level => { + (level) => { wrapper.setData({ error: { tags: { level: severityLevel[level] }, diff --git a/spec/frontend/error_tracking/components/error_tracking_list_spec.js b/spec/frontend/error_tracking/components/error_tracking_list_spec.js index fa8992a8d9f..da12237b1d9 100644 --- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js +++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js @@ -147,7 +147,7 @@ describe('ErrorTrackingList', () => { }); it('each error in the list should have an action button set', () => { - findErrorListRows().wrappers.forEach(row => { + findErrorListRows().wrappers.forEach((row) => { expect(row.find(ErrorTrackingActions).exists()).toBe(true); }); }); diff --git a/spec/frontend/error_tracking/store/actions_spec.js b/spec/frontend/error_tracking/store/actions_spec.js index 43037473a61..34ad600af05 100644 --- a/spec/frontend/error_tracking/store/actions_spec.js +++ b/spec/frontend/error_tracking/store/actions_spec.js @@ -28,7 +28,7 @@ describe('Sentry common store actions', () => { const params = { endpoint, redirectUrl, status }; describe('updateStatus', () => { - it('should handle successful status update', done => { + it('should handle successful status update', (done) => { mock.onPut().reply(200, {}); testAction( actions.updateStatus, @@ -48,7 +48,7 @@ describe('Sentry common store actions', () => { ); }); - it('should handle unsuccessful status update', done => { + it('should handle unsuccessful status update', (done) => { mock.onPut().reply(400, {}); testAction(actions.updateStatus, params, {}, [], [], () => { expect(visitUrl).not.toHaveBeenCalled(); diff --git a/spec/frontend/error_tracking/store/details/actions_spec.js b/spec/frontend/error_tracking/store/details/actions_spec.js index 58e77c46e02..152ecde6985 100644 --- a/spec/frontend/error_tracking/store/details/actions_spec.js +++ b/spec/frontend/error_tracking/store/details/actions_spec.js @@ -28,7 +28,7 @@ describe('Sentry error details store actions', () => { describe('startPollingStacktrace', () => { const endpoint = '123/stacktrace'; - it('should commit SET_ERROR with received response', done => { + it('should commit SET_ERROR with received response', (done) => { const payload = { error: [1, 2, 3] }; mockedAdapter.onGet().reply(200, payload); testAction( @@ -46,7 +46,7 @@ describe('Sentry error details store actions', () => { ); }); - it('should show flash on API error', done => { + it('should show flash on API error', (done) => { mockedAdapter.onGet().reply(400); testAction( @@ -62,7 +62,7 @@ describe('Sentry error details store actions', () => { ); }); - it('should not restart polling when receiving an empty 204 response', done => { + it('should not restart polling when receiving an empty 204 response', (done) => { mockedRestart = jest.spyOn(Poll.prototype, 'restart'); mockedAdapter.onGet().reply(204); diff --git a/spec/frontend/error_tracking/store/list/actions_spec.js b/spec/frontend/error_tracking/store/list/actions_spec.js index e829912580a..a93608fe70d 100644 --- a/spec/frontend/error_tracking/store/list/actions_spec.js +++ b/spec/frontend/error_tracking/store/list/actions_spec.js @@ -20,7 +20,7 @@ describe('error tracking actions', () => { }); describe('startPolling', () => { - it('should start polling for data', done => { + it('should start polling for data', (done) => { const payload = { errors: [{ id: 1 }, { id: 2 }] }; mock.onGet().reply(httpStatusCodes.OK, payload); @@ -41,7 +41,7 @@ describe('error tracking actions', () => { ); }); - it('should show flash on API error', done => { + it('should show flash on API error', (done) => { mock.onGet().reply(httpStatusCodes.BAD_REQUEST); testAction( diff --git a/spec/frontend/error_tracking_settings/store/actions_spec.js b/spec/frontend/error_tracking_settings/store/actions_spec.js index b076e6ecd31..216bf8011e8 100644 --- a/spec/frontend/error_tracking_settings/store/actions_spec.js +++ b/spec/frontend/error_tracking_settings/store/actions_spec.js @@ -27,7 +27,7 @@ describe('error tracking settings actions', () => { refreshCurrentPage.mockClear(); }); - it('should request and transform the project list', done => { + it('should request and transform the project list', (done) => { mock.onGet(TEST_HOST).reply(() => [200, { projects: projectList }]); testAction( actions.fetchProjects, @@ -48,7 +48,7 @@ describe('error tracking settings actions', () => { ); }); - it('should handle a server error', done => { + it('should handle a server error', (done) => { mock.onGet(`${TEST_HOST}.json`).reply(() => [400]); testAction( actions.fetchProjects, @@ -68,7 +68,7 @@ describe('error tracking settings actions', () => { ); }); - it('should request projects correctly', done => { + it('should request projects correctly', (done) => { testAction( actions.requestProjects, null, @@ -79,7 +79,7 @@ describe('error tracking settings actions', () => { ); }); - it('should receive projects correctly', done => { + it('should receive projects correctly', (done) => { const testPayload = []; testAction( actions.receiveProjectsSuccess, @@ -95,7 +95,7 @@ describe('error tracking settings actions', () => { ); }); - it('should handle errors when receiving projects', done => { + it('should handle errors when receiving projects', (done) => { const testPayload = []; testAction( actions.receiveProjectsError, @@ -126,7 +126,7 @@ describe('error tracking settings actions', () => { mock.restore(); }); - it('should save the page', done => { + it('should save the page', (done) => { mock.onPatch(TEST_HOST).reply(200); testAction(actions.updateSettings, null, state, [], [{ type: 'requestSettings' }], () => { expect(mock.history.patch.length).toBe(1); @@ -135,7 +135,7 @@ describe('error tracking settings actions', () => { }); }); - it('should handle a server error', done => { + it('should handle a server error', (done) => { mock.onPatch(TEST_HOST).reply(400); testAction( actions.updateSettings, @@ -156,7 +156,7 @@ describe('error tracking settings actions', () => { ); }); - it('should request to save the page', done => { + it('should request to save the page', (done) => { testAction( actions.requestSettings, null, @@ -167,7 +167,7 @@ describe('error tracking settings actions', () => { ); }); - it('should handle errors when requesting to save the page', done => { + it('should handle errors when requesting to save the page', (done) => { testAction( actions.receiveSettingsError, {}, @@ -181,7 +181,7 @@ describe('error tracking settings actions', () => { describe('generic actions to update the store', () => { const testData = 'test'; - it('should reset the `connect success` flag when updating the api host', done => { + it('should reset the `connect success` flag when updating the api host', (done) => { testAction( actions.updateApiHost, testData, @@ -192,7 +192,7 @@ describe('error tracking settings actions', () => { ); }); - it('should reset the `connect success` flag when updating the token', done => { + it('should reset the `connect success` flag when updating the token', (done) => { testAction( actions.updateToken, testData, diff --git a/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js b/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js index 06b9385b112..21b894ccbef 100644 --- a/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js +++ b/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js @@ -36,7 +36,7 @@ describe('Configure Feature Flags Modal', () => { const findPrimaryAction = () => findGlModal().props('actionPrimary'); const findProjectNameInput = () => wrapper.find('#project_name_verification'); const findDangerGlAlert = () => - wrapper.findAll(GlAlert).filter(c => c.props('variant') === 'danger'); + wrapper.findAll(GlAlert).filter((c) => c.props('variant') === 'danger'); describe('idle', () => { afterEach(() => wrapper.destroy()); diff --git a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js index f8e25925774..a754c682356 100644 --- a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js @@ -42,7 +42,7 @@ describe('Edit feature flag form', () => { }); }; - beforeEach(done => { + beforeEach((done) => { mock = new MockAdapter(axios); mock.onGet(`${TEST_HOST}/feature_flags.json`).replyOnce(200, { id: 21, diff --git a/spec/frontend/feature_flags/components/environments_dropdown_spec.js b/spec/frontend/feature_flags/components/environments_dropdown_spec.js index 39ec05ebd4f..042fccaa369 100644 --- a/spec/frontend/feature_flags/components/environments_dropdown_spec.js +++ b/spec/frontend/feature_flags/components/environments_dropdown_spec.js @@ -11,7 +11,7 @@ describe('Feature flags > Environments dropdown ', () => { let wrapper; let mock; const results = ['production', 'staging']; - const factory = props => { + const factory = (props) => { wrapper = shallowMount(EnvironmentsDropdown, { propsData: { ...props, @@ -100,7 +100,7 @@ describe('Feature flags > Environments dropdown ', () => { it('emits event when a suggestion is clicked', async () => { const button = wrapper .findAll(GlButton) - .filter(b => b.text() === 'production') + .filter((b) => b.text() === 'production') .at(0); button.vm.$emit('click'); await wrapper.vm.$nextTick(); diff --git a/spec/frontend/feature_flags/components/feature_flags_spec.js b/spec/frontend/feature_flags/components/feature_flags_spec.js index 83a2293be89..8242d667d2e 100644 --- a/spec/frontend/feature_flags/components/feature_flags_spec.js +++ b/spec/frontend/feature_flags/components/feature_flags_spec.js @@ -85,7 +85,7 @@ describe('Feature flags', () => { describe('when limit exceeded', () => { const provideData = { ...mockData, featureFlagsLimitExceeded: true }; - beforeEach(done => { + beforeEach((done) => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .reply(200, getRequestData, {}); @@ -132,7 +132,7 @@ describe('Feature flags', () => { newUserListPath: null, }; - beforeEach(done => { + beforeEach((done) => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .reply(200, getRequestData, {}); @@ -217,7 +217,7 @@ describe('Feature flags', () => { }); describe('with paginated feature flags', () => { - beforeEach(done => { + beforeEach((done) => { mock .onGet(mockState.endpoint, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .replyOnce(200, getRequestData, { @@ -297,7 +297,7 @@ describe('Feature flags', () => { }); describe('in user lists tab', () => { - beforeEach(done => { + beforeEach((done) => { factory(); setImmediate(done); }); @@ -317,7 +317,7 @@ describe('Feature flags', () => { }); describe('unsuccessful request', () => { - beforeEach(done => { + beforeEach((done) => { mock .onGet(mockState.endpoint, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .replyOnce(500, {}); @@ -350,7 +350,7 @@ describe('Feature flags', () => { }); describe('rotate instance id', () => { - beforeEach(done => { + beforeEach((done) => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .reply(200, getRequestData, {}); diff --git a/spec/frontend/feature_flags/components/form_spec.js b/spec/frontend/feature_flags/components/form_spec.js index 2473c59e450..3a057aedde9 100644 --- a/spec/frontend/feature_flags/components/form_spec.js +++ b/spec/frontend/feature_flags/components/form_spec.js @@ -118,7 +118,7 @@ describe('feature flag form', () => { }); }); - it('should be disabled if the feature flag is not active', done => { + it('should be disabled if the feature flag is not active', (done) => { wrapper.setProps({ active: false }); wrapper.vm.$nextTick(() => { expect(wrapper.find(ToggleButton).props('disabledInput')).toBe(true); @@ -191,7 +191,7 @@ describe('feature flag form', () => { expect(wrapper.vm.formScopes[0].active).toBe(false); }); - it('should be disabled if the feature flag is not active', done => { + it('should be disabled if the feature flag is not active', (done) => { wrapper.setProps({ active: false }); wrapper.vm.$nextTick(() => { @@ -301,7 +301,7 @@ describe('feature flag form', () => { }); describe('on submit', () => { - const selectFirstRolloutStrategyOption = dropdownIndex => { + const selectFirstRolloutStrategyOption = (dropdownIndex) => { wrapper .findAll('select.js-rollout-strategy') .at(dropdownIndex) diff --git a/spec/frontend/feature_flags/components/new_environments_dropdown_spec.js b/spec/frontend/feature_flags/components/new_environments_dropdown_spec.js index 12dc98fbde8..ad58ceaf5f8 100644 --- a/spec/frontend/feature_flags/components/new_environments_dropdown_spec.js +++ b/spec/frontend/feature_flags/components/new_environments_dropdown_spec.js @@ -94,7 +94,7 @@ describe('New Environments Dropdown', () => { }); it('should not display a create label', () => { - items = items.filter(i => i.text().startsWith('Create')); + items = items.filter((i) => i.text().startsWith('Create')); expect(items).toHaveLength(0); }); diff --git a/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js b/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js index b34fe7779e3..1c85eadc678 100644 --- a/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js +++ b/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js @@ -66,7 +66,7 @@ describe('~/feature_flags/components/strategies/gitlab_user_list.vue', () => { it('should search when the filter changes', async () => { let r; Api.searchFeatureFlagUserLists.mockReturnValue( - new Promise(resolve => { + new Promise((resolve) => { r = resolve; }), ); diff --git a/spec/frontend/feature_flags/components/user_lists_table_spec.js b/spec/frontend/feature_flags/components/user_lists_table_spec.js index d6ced3be168..974f63ba934 100644 --- a/spec/frontend/feature_flags/components/user_lists_table_spec.js +++ b/spec/frontend/feature_flags/components/user_lists_table_spec.js @@ -42,7 +42,7 @@ describe('User Lists Table', () => { it('should display a user list entry per user list', () => { const lists = wrapper.findAll('[data-testid="ffUserList"]'); expect(lists).toHaveLength(5); - lists.wrappers.forEach(list => { + lists.wrappers.forEach((list) => { expect(list.find('[data-testid="ffUserListName"]').exists()).toBe(true); expect(list.find('[data-testid="ffUserListIds"]').exists()).toBe(true); expect(list.find('[data-testid="ffUserListTimestamp"]').exists()).toBe(true); diff --git a/spec/frontend/feature_flags/store/edit/actions_spec.js b/spec/frontend/feature_flags/store/edit/actions_spec.js index 9d764799d09..20cec5daac0 100644 --- a/spec/frontend/feature_flags/store/edit/actions_spec.js +++ b/spec/frontend/feature_flags/store/edit/actions_spec.js @@ -44,7 +44,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('success', () => { - it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagSuccess ', done => { + it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagSuccess ', (done) => { const featureFlag = { name: 'feature_flag', description: 'feature flag', @@ -80,7 +80,7 @@ describe('Feature flags Edit Module actions', () => { done, ); }); - it('handles new version flags as well', done => { + it('handles new version flags as well', (done) => { const featureFlag = { name: 'name', description: 'description', @@ -117,7 +117,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('error', () => { - it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagError ', done => { + it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagError ', (done) => { mock.onPut(`${TEST_HOST}/endpoint.json`).replyOnce(500, { message: [] }); testAction( @@ -145,7 +145,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('requestUpdateFeatureFlag', () => { - it('should commit REQUEST_UPDATE_FEATURE_FLAG mutation', done => { + it('should commit REQUEST_UPDATE_FEATURE_FLAG mutation', (done) => { testAction( requestUpdateFeatureFlag, null, @@ -158,7 +158,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('receiveUpdateFeatureFlagSuccess', () => { - it('should commit RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS mutation', done => { + it('should commit RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS mutation', (done) => { testAction( receiveUpdateFeatureFlagSuccess, null, @@ -175,7 +175,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('receiveUpdateFeatureFlagError', () => { - it('should commit RECEIVE_UPDATE_FEATURE_FLAG_ERROR mutation', done => { + it('should commit RECEIVE_UPDATE_FEATURE_FLAG_ERROR mutation', (done) => { testAction( receiveUpdateFeatureFlagError, 'There was an error', @@ -200,7 +200,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('success', () => { - it('dispatches requestFeatureFlag and receiveFeatureFlagSuccess ', done => { + it('dispatches requestFeatureFlag and receiveFeatureFlagSuccess ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, { id: 1 }); testAction( @@ -223,7 +223,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('error', () => { - it('dispatches requestFeatureFlag and receiveUpdateFeatureFlagError ', done => { + it('dispatches requestFeatureFlag and receiveUpdateFeatureFlagError ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); testAction( @@ -246,7 +246,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('requestFeatureFlag', () => { - it('should commit REQUEST_FEATURE_FLAG mutation', done => { + it('should commit REQUEST_FEATURE_FLAG mutation', (done) => { testAction( requestFeatureFlag, null, @@ -259,7 +259,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('receiveFeatureFlagSuccess', () => { - it('should commit RECEIVE_FEATURE_FLAG_SUCCESS mutation', done => { + it('should commit RECEIVE_FEATURE_FLAG_SUCCESS mutation', (done) => { testAction( receiveFeatureFlagSuccess, { id: 1 }, @@ -272,7 +272,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('receiveFeatureFlagError', () => { - it('should commit RECEIVE_FEATURE_FLAG_ERROR mutation', done => { + it('should commit RECEIVE_FEATURE_FLAG_ERROR mutation', (done) => { testAction( receiveFeatureFlagError, null, @@ -289,7 +289,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('toggelActive', () => { - it('should commit TOGGLE_ACTIVE mutation', done => { + it('should commit TOGGLE_ACTIVE mutation', (done) => { testAction( toggleActive, true, diff --git a/spec/frontend/feature_flags/store/index/actions_spec.js b/spec/frontend/feature_flags/store/index/actions_spec.js index d223bb2c292..82e16958d33 100644 --- a/spec/frontend/feature_flags/store/index/actions_spec.js +++ b/spec/frontend/feature_flags/store/index/actions_spec.js @@ -40,7 +40,7 @@ describe('Feature flags actions', () => { }); describe('setFeatureFlagsOptions', () => { - it('should commit SET_FEATURE_FLAGS_OPTIONS mutation', done => { + it('should commit SET_FEATURE_FLAGS_OPTIONS mutation', (done) => { testAction( setFeatureFlagsOptions, { page: '1', scope: 'all' }, @@ -65,7 +65,7 @@ describe('Feature flags actions', () => { }); describe('success', () => { - it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess ', done => { + it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, getRequestData, {}); testAction( @@ -88,7 +88,7 @@ describe('Feature flags actions', () => { }); describe('error', () => { - it('dispatches requestFeatureFlags and receiveFeatureFlagsError ', done => { + it('dispatches requestFeatureFlags and receiveFeatureFlagsError ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); testAction( @@ -111,7 +111,7 @@ describe('Feature flags actions', () => { }); describe('requestFeatureFlags', () => { - it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', done => { + it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', (done) => { testAction( requestFeatureFlags, null, @@ -124,7 +124,7 @@ describe('Feature flags actions', () => { }); describe('receiveFeatureFlagsSuccess', () => { - it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', done => { + it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', (done) => { testAction( receiveFeatureFlagsSuccess, { data: getRequestData, headers: {} }, @@ -142,7 +142,7 @@ describe('Feature flags actions', () => { }); describe('receiveFeatureFlagsError', () => { - it('should commit RECEIVE_FEATURE_FLAGS_ERROR mutation', done => { + it('should commit RECEIVE_FEATURE_FLAGS_ERROR mutation', (done) => { testAction( receiveFeatureFlagsError, null, @@ -160,7 +160,7 @@ describe('Feature flags actions', () => { }); describe('success', () => { - it('dispatches requestUserLists and receiveUserListsSuccess ', done => { + it('dispatches requestUserLists and receiveUserListsSuccess ', (done) => { testAction( fetchUserLists, null, @@ -181,7 +181,7 @@ describe('Feature flags actions', () => { }); describe('error', () => { - it('dispatches requestUserLists and receiveUserListsError ', done => { + it('dispatches requestUserLists and receiveUserListsError ', (done) => { Api.fetchFeatureFlagUserLists.mockRejectedValue(); testAction( @@ -204,7 +204,7 @@ describe('Feature flags actions', () => { }); describe('requestUserLists', () => { - it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', done => { + it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', (done) => { testAction( requestUserLists, null, @@ -217,7 +217,7 @@ describe('Feature flags actions', () => { }); describe('receiveUserListsSuccess', () => { - it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', done => { + it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', (done) => { testAction( receiveUserListsSuccess, { data: [userList], headers: {} }, @@ -235,7 +235,7 @@ describe('Feature flags actions', () => { }); describe('receiveUserListsError', () => { - it('should commit RECEIVE_USER_LISTS_ERROR mutation', done => { + it('should commit RECEIVE_USER_LISTS_ERROR mutation', (done) => { testAction( receiveUserListsError, null, @@ -260,7 +260,7 @@ describe('Feature flags actions', () => { }); describe('success', () => { - it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess ', done => { + it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess ', (done) => { mock.onPost(`${TEST_HOST}/endpoint.json`).replyOnce(200, rotateData, {}); testAction( @@ -283,7 +283,7 @@ describe('Feature flags actions', () => { }); describe('error', () => { - it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError ', done => { + it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); testAction( @@ -306,7 +306,7 @@ describe('Feature flags actions', () => { }); describe('requestRotateInstanceId', () => { - it('should commit REQUEST_ROTATE_INSTANCE_ID mutation', done => { + it('should commit REQUEST_ROTATE_INSTANCE_ID mutation', (done) => { testAction( requestRotateInstanceId, null, @@ -319,7 +319,7 @@ describe('Feature flags actions', () => { }); describe('receiveRotateInstanceIdSuccess', () => { - it('should commit RECEIVE_ROTATE_INSTANCE_ID_SUCCESS mutation', done => { + it('should commit RECEIVE_ROTATE_INSTANCE_ID_SUCCESS mutation', (done) => { testAction( receiveRotateInstanceIdSuccess, { data: rotateData, headers: {} }, @@ -337,7 +337,7 @@ describe('Feature flags actions', () => { }); describe('receiveRotateInstanceIdError', () => { - it('should commit RECEIVE_ROTATE_INSTANCE_ID_ERROR mutation', done => { + it('should commit RECEIVE_ROTATE_INSTANCE_ID_ERROR mutation', (done) => { testAction( receiveRotateInstanceIdError, null, @@ -353,7 +353,7 @@ describe('Feature flags actions', () => { let mock; beforeEach(() => { - mockedState.featureFlags = getRequestData.feature_flags.map(flag => ({ + mockedState.featureFlags = getRequestData.feature_flags.map((flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []), })); @@ -364,7 +364,7 @@ describe('Feature flags actions', () => { mock.restore(); }); describe('success', () => { - it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', done => { + it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', (done) => { mock.onPut(featureFlag.update_path).replyOnce(200, featureFlag, {}); testAction( @@ -387,7 +387,7 @@ describe('Feature flags actions', () => { }); }); describe('error', () => { - it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', done => { + it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', (done) => { mock.onPut(featureFlag.update_path).replyOnce(500); testAction( @@ -412,13 +412,13 @@ describe('Feature flags actions', () => { }); describe('updateFeatureFlag', () => { beforeEach(() => { - mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ + mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({ ...f, scopes: mapToScopesViewModel(f.scopes || []), })); }); - it('commits UPDATE_FEATURE_FLAG with the given flag', done => { + it('commits UPDATE_FEATURE_FLAG with the given flag', (done) => { testAction( updateFeatureFlag, featureFlag, @@ -436,13 +436,13 @@ describe('Feature flags actions', () => { }); describe('receiveUpdateFeatureFlagSuccess', () => { beforeEach(() => { - mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ + mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({ ...f, scopes: mapToScopesViewModel(f.scopes || []), })); }); - it('commits RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS with the given flag', done => { + it('commits RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS with the given flag', (done) => { testAction( receiveUpdateFeatureFlagSuccess, featureFlag, @@ -460,13 +460,13 @@ describe('Feature flags actions', () => { }); describe('receiveUpdateFeatureFlagError', () => { beforeEach(() => { - mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ + mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({ ...f, scopes: mapToScopesViewModel(f.scopes || []), })); }); - it('commits RECEIVE_UPDATE_FEATURE_FLAG_ERROR with the given flag id', done => { + it('commits RECEIVE_UPDATE_FEATURE_FLAG_ERROR with the given flag id', (done) => { testAction( receiveUpdateFeatureFlagError, featureFlag.id, @@ -492,7 +492,7 @@ describe('Feature flags actions', () => { Api.deleteFeatureFlagUserList.mockResolvedValue(); }); - it('should refresh the user lists', done => { + it('should refresh the user lists', (done) => { testAction( deleteUserList, userList, @@ -509,7 +509,7 @@ describe('Feature flags actions', () => { Api.deleteFeatureFlagUserList.mockRejectedValue({ response: { data: 'some error' } }); }); - it('should dispatch receiveDeleteUserListError', done => { + it('should dispatch receiveDeleteUserListError', (done) => { testAction( deleteUserList, userList, @@ -529,7 +529,7 @@ describe('Feature flags actions', () => { }); describe('receiveDeleteUserListError', () => { - it('should commit RECEIVE_DELETE_USER_LIST_ERROR with the given list', done => { + it('should commit RECEIVE_DELETE_USER_LIST_ERROR with the given list', (done) => { testAction( receiveDeleteUserListError, { list: userList, error: 'mock error' }, @@ -547,7 +547,7 @@ describe('Feature flags actions', () => { }); describe('clearAlert', () => { - it('should commit RECEIVE_CLEAR_ALERT', done => { + it('should commit RECEIVE_CLEAR_ALERT', (done) => { const alertIndex = 3; testAction( diff --git a/spec/frontend/feature_flags/store/index/mutations_spec.js b/spec/frontend/feature_flags/store/index/mutations_spec.js index 376c7b069fa..eec56800a8d 100644 --- a/spec/frontend/feature_flags/store/index/mutations_spec.js +++ b/spec/frontend/feature_flags/store/index/mutations_spec.js @@ -50,7 +50,7 @@ describe('Feature flags store Mutations', () => { }); it('should set featureFlags with the transformed data', () => { - const expected = getRequestData.feature_flags.map(flag => ({ + const expected = getRequestData.feature_flags.map((flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []), })); @@ -183,7 +183,7 @@ describe('Feature flags store Mutations', () => { describe('UPDATE_FEATURE_FLAG', () => { beforeEach(() => { - stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ + stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []), })); @@ -209,7 +209,7 @@ describe('Feature flags store Mutations', () => { describe('RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS', () => { const runUpdate = (stateCount, flagState, featureFlagUpdateParams) => { - stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ + stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({ ...flag, ...flagState, scopes: mapToScopesViewModel(flag.scopes || []), @@ -237,7 +237,7 @@ describe('Feature flags store Mutations', () => { describe('RECEIVE_UPDATE_FEATURE_FLAG_ERROR', () => { beforeEach(() => { - stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ + stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []), })); diff --git a/spec/frontend/feature_flags/store/new/actions_spec.js b/spec/frontend/feature_flags/store/new/actions_spec.js index 130c5235aa0..9168f11fdfb 100644 --- a/spec/frontend/feature_flags/store/new/actions_spec.js +++ b/spec/frontend/feature_flags/store/new/actions_spec.js @@ -59,7 +59,7 @@ describe('Feature flags New Module Actions', () => { }); describe('success', () => { - it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagSuccess ', done => { + it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagSuccess ', (done) => { const convertedActionParams = mapFromScopesViewModel(actionParams); mock.onPost(`${TEST_HOST}/endpoint.json`, convertedActionParams).replyOnce(200); @@ -81,7 +81,7 @@ describe('Feature flags New Module Actions', () => { ); }); - it('sends strategies for new style feature flags', done => { + it('sends strategies for new style feature flags', (done) => { const newVersionFlagParams = { name: 'name', description: 'description', @@ -120,7 +120,7 @@ describe('Feature flags New Module Actions', () => { }); describe('error', () => { - it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagError ', done => { + it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagError ', (done) => { const convertedActionParams = mapFromScopesViewModel(actionParams); mock @@ -148,7 +148,7 @@ describe('Feature flags New Module Actions', () => { }); describe('requestCreateFeatureFlag', () => { - it('should commit REQUEST_CREATE_FEATURE_FLAG mutation', done => { + it('should commit REQUEST_CREATE_FEATURE_FLAG mutation', (done) => { testAction( requestCreateFeatureFlag, null, @@ -161,7 +161,7 @@ describe('Feature flags New Module Actions', () => { }); describe('receiveCreateFeatureFlagSuccess', () => { - it('should commit RECEIVE_CREATE_FEATURE_FLAG_SUCCESS mutation', done => { + it('should commit RECEIVE_CREATE_FEATURE_FLAG_SUCCESS mutation', (done) => { testAction( receiveCreateFeatureFlagSuccess, null, @@ -178,7 +178,7 @@ describe('Feature flags New Module Actions', () => { }); describe('receiveCreateFeatureFlagError', () => { - it('should commit RECEIVE_CREATE_FEATURE_FLAG_ERROR mutation', done => { + it('should commit RECEIVE_CREATE_FEATURE_FLAG_ERROR mutation', (done) => { testAction( receiveCreateFeatureFlagError, 'There was an error', diff --git a/spec/frontend/feature_highlight/feature_highlight_helper_spec.js b/spec/frontend/feature_highlight/feature_highlight_helper_spec.js index 2c3c3e3267a..beae5041156 100644 --- a/spec/frontend/feature_highlight/feature_highlight_helper_spec.js +++ b/spec/frontend/feature_highlight/feature_highlight_helper_spec.js @@ -44,7 +44,7 @@ describe('feature highlight helper', () => { }); describe('inserted', () => { - it('registers click event callback', done => { + it('registers click event callback', (done) => { const context = { getAttribute: () => 'popoverId', dataset: { @@ -52,7 +52,7 @@ describe('feature highlight helper', () => { }, }; - jest.spyOn($.fn, 'on').mockImplementation(event => { + jest.spyOn($.fn, 'on').mockImplementation((event) => { expect(event).toEqual('click'); done(); }); diff --git a/spec/frontend/filtered_search/components/recent_searches_dropdown_content_spec.js b/spec/frontend/filtered_search/components/recent_searches_dropdown_content_spec.js index 36782403d6d..f1cff02261d 100644 --- a/spec/frontend/filtered_search/components/recent_searches_dropdown_content_spec.js +++ b/spec/frontend/filtered_search/components/recent_searches_dropdown_content_spec.js @@ -10,7 +10,7 @@ describe('Recent Searches Dropdown Content', () => { const findDropdownItems = () => wrapper.findAll({ ref: 'dropdownItem' }); const findDropdownNote = () => wrapper.find({ ref: 'dropdownNote' }); - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(RecentSearchesDropdownContent, { propsData: { allowedKeys: IssuableFilteredSearchTokenKeys.getKeys(), diff --git a/spec/frontend/filtered_search/filtered_search_manager_spec.js b/spec/frontend/filtered_search/filtered_search_manager_spec.js index b1c299ba91f..f2f42ee3803 100644 --- a/spec/frontend/filtered_search/filtered_search_manager_spec.js +++ b/spec/frontend/filtered_search/filtered_search_manager_spec.js @@ -188,11 +188,11 @@ describe('Filtered Search Manager', () => { const defaultParams = '?scope=all&utf8=%E2%9C%93'; const defaultState = '&state=opened'; - it('should search with a single word', done => { + it('should search with a single word', (done) => { initializeManager(); input.value = 'searchTerm'; - visitUrl.mockImplementation(url => { + visitUrl.mockImplementation((url) => { expect(url).toEqual(`${defaultParams}&search=searchTerm`); done(); }); @@ -200,11 +200,11 @@ describe('Filtered Search Manager', () => { manager.search(); }); - it('sets default state', done => { + it('sets default state', (done) => { initializeManager({ useDefaultState: true }); input.value = 'searchTerm'; - visitUrl.mockImplementation(url => { + visitUrl.mockImplementation((url) => { expect(url).toEqual(`${defaultParams}${defaultState}&search=searchTerm`); done(); }); @@ -212,11 +212,11 @@ describe('Filtered Search Manager', () => { manager.search(); }); - it('should search with multiple words', done => { + it('should search with multiple words', (done) => { initializeManager(); input.value = 'awesome search terms'; - visitUrl.mockImplementation(url => { + visitUrl.mockImplementation((url) => { expect(url).toEqual(`${defaultParams}&search=awesome+search+terms`); done(); }); @@ -224,11 +224,11 @@ describe('Filtered Search Manager', () => { manager.search(); }); - it('should search with special characters', done => { + it('should search with special characters', (done) => { initializeManager(); input.value = '~!@#$%^&*()_+{}:<>,.?/'; - visitUrl.mockImplementation(url => { + visitUrl.mockImplementation((url) => { expect(url).toEqual( `${defaultParams}&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`, ); @@ -238,13 +238,13 @@ describe('Filtered Search Manager', () => { manager.search(); }); - it('should use replacement URL for condition', done => { + it('should use replacement URL for condition', (done) => { initializeManager(); tokensContainer.innerHTML = FilteredSearchSpecHelper.createTokensContainerHTML( FilteredSearchSpecHelper.createFilterVisualTokenHTML('milestone', '=', '13', true), ); - visitUrl.mockImplementation(url => { + visitUrl.mockImplementation((url) => { expect(url).toEqual(`${defaultParams}&milestone_title=replaced`); done(); }); @@ -259,14 +259,14 @@ describe('Filtered Search Manager', () => { manager.search(); }); - it('removes duplicated tokens', done => { + it('removes duplicated tokens', (done) => { initializeManager(); tokensContainer.innerHTML = FilteredSearchSpecHelper.createTokensContainerHTML(` ${FilteredSearchSpecHelper.createFilterVisualTokenHTML('label', '=', '~bug')} ${FilteredSearchSpecHelper.createFilterVisualTokenHTML('label', '=', '~bug')} `); - visitUrl.mockImplementation(url => { + visitUrl.mockImplementation((url) => { expect(url).toEqual(`${defaultParams}&label_name[]=bug`); done(); }); @@ -605,7 +605,7 @@ describe('Filtered Search Manager', () => { it('correctly modifies params when custom modifier is passed', () => { const modifedParams = manager.getAllParams.call( { - modifyUrlParams: params => params.reverse(), + modifyUrlParams: (params) => params.reverse(), }, [].concat(paramsArr), ); diff --git a/spec/frontend/filtered_search/filtered_search_token_keys_spec.js b/spec/frontend/filtered_search/filtered_search_token_keys_spec.js index f24d2b118c2..da6d9ac3ff2 100644 --- a/spec/frontend/filtered_search/filtered_search_token_keys_spec.js +++ b/spec/frontend/filtered_search/filtered_search_token_keys_spec.js @@ -33,7 +33,7 @@ describe('Filtered Search Token Keys', () => { describe('getKeys', () => { it('should return keys', () => { const getKeys = new FilteredSearchTokenKeys(tokenKeys).getKeys(); - const keys = new FilteredSearchTokenKeys(tokenKeys).get().map(i => i.key); + const keys = new FilteredSearchTokenKeys(tokenKeys).get().map((i) => i.key); keys.forEach((key, i) => { expect(key).toEqual(getKeys[i]); diff --git a/spec/frontend/filtered_search/filtered_search_visual_tokens_spec.js b/spec/frontend/filtered_search/filtered_search_visual_tokens_spec.js index 6a00065c9fe..d0d461fd562 100644 --- a/spec/frontend/filtered_search/filtered_search_visual_tokens_spec.js +++ b/spec/frontend/filtered_search/filtered_search_visual_tokens_spec.js @@ -7,7 +7,7 @@ describe('Filtered Search Visual Tokens', () => { let mock; const subject = FilteredSearchVisualTokens; - const findElements = tokenElement => { + const findElements = (tokenElement) => { const tokenNameElement = tokenElement.querySelector('.name'); const tokenOperatorElement = tokenElement.querySelector('.operator'); const tokenValueContainer = tokenElement.querySelector('.value-container'); diff --git a/spec/frontend/filtered_search/issues_filtered_search_token_keys_spec.js b/spec/frontend/filtered_search/issues_filtered_search_token_keys_spec.js index c7be900ba2c..2d514b36591 100644 --- a/spec/frontend/filtered_search/issues_filtered_search_token_keys_spec.js +++ b/spec/frontend/filtered_search/issues_filtered_search_token_keys_spec.js @@ -23,7 +23,7 @@ describe('Issues Filtered Search Token Keys', () => { }); it('should return assignee as a string', () => { - const assignee = tokenKeys.find(tokenKey => tokenKey.key === 'assignee'); + const assignee = tokenKeys.find((tokenKey) => tokenKey.key === 'assignee'); expect(assignee.type).toEqual('string'); }); @@ -32,7 +32,7 @@ describe('Issues Filtered Search Token Keys', () => { describe('getKeys', () => { it('should return keys', () => { const getKeys = IssuableFilteredSearchTokenKeys.getKeys(); - const keys = IssuableFilteredSearchTokenKeys.get().map(i => i.key); + const keys = IssuableFilteredSearchTokenKeys.get().map((i) => i.key); keys.forEach((key, i) => { expect(key).toEqual(getKeys[i]); diff --git a/spec/frontend/filtered_search/recent_searches_root_spec.js b/spec/frontend/filtered_search/recent_searches_root_spec.js index 281d406e013..6bb9e68d591 100644 --- a/spec/frontend/filtered_search/recent_searches_root_spec.js +++ b/spec/frontend/filtered_search/recent_searches_root_spec.js @@ -16,7 +16,7 @@ describe('RecentSearchesRoot', () => { }, }; - Vue.mockImplementation(options => { + Vue.mockImplementation((options) => { ({ data, template } = options); }); diff --git a/spec/frontend/filtered_search/services/recent_searches_service_spec.js b/spec/frontend/filtered_search/services/recent_searches_service_spec.js index afeca54b949..6711ce03d40 100644 --- a/spec/frontend/filtered_search/services/recent_searches_service_spec.js +++ b/spec/frontend/filtered_search/services/recent_searches_service_spec.js @@ -18,49 +18,49 @@ describe('RecentSearchesService', () => { jest.spyOn(RecentSearchesService, 'isAvailable').mockReturnValue(true); }); - it('should default to empty array', done => { + it('should default to empty array', (done) => { const fetchItemsPromise = service.fetch(); fetchItemsPromise - .then(items => { + .then((items) => { expect(items).toEqual([]); }) .then(done) .catch(done.fail); }); - it('should reject when unable to parse', done => { + it('should reject when unable to parse', (done) => { jest.spyOn(localStorage, 'getItem').mockReturnValue('fail'); const fetchItemsPromise = service.fetch(); fetchItemsPromise .then(done.fail) - .catch(error => { + .catch((error) => { expect(error).toEqual(expect.any(SyntaxError)); }) .then(done) .catch(done.fail); }); - it('should reject when service is unavailable', done => { + it('should reject when service is unavailable', (done) => { RecentSearchesService.isAvailable.mockReturnValue(false); service .fetch() .then(done.fail) - .catch(error => { + .catch((error) => { expect(error).toEqual(expect.any(Error)); }) .then(done) .catch(done.fail); }); - it('should return items from localStorage', done => { + it('should return items from localStorage', (done) => { jest.spyOn(localStorage, 'getItem').mockReturnValue('["foo", "bar"]'); const fetchItemsPromise = service.fetch(); fetchItemsPromise - .then(items => { + .then((items) => { expect(items).toEqual(['foo', 'bar']); }) .then(done) @@ -74,11 +74,11 @@ describe('RecentSearchesService', () => { jest.spyOn(Storage.prototype, 'getItem').mockImplementation(() => {}); }); - it('should not call .getItem', done => { + it('should not call .getItem', (done) => { RecentSearchesService.prototype .fetch() .then(done.fail) - .catch(err => { + .catch((err) => { expect(err).toEqual(new RecentSearchesServiceError()); expect(localStorage.getItem).not.toHaveBeenCalled(); }) diff --git a/spec/frontend/filtered_search/visual_token_value_spec.js b/spec/frontend/filtered_search/visual_token_value_spec.js index e2855b29b70..8b3bc4f457a 100644 --- a/spec/frontend/filtered_search/visual_token_value_spec.js +++ b/spec/frontend/filtered_search/visual_token_value_spec.js @@ -7,7 +7,7 @@ import DropdownUtils from '~/filtered_search//dropdown_utils'; import FilteredSearchSpecHelper from '../helpers/filtered_search_spec_helper'; describe('Filtered Search Visual Tokens', () => { - const findElements = tokenElement => { + const findElements = (tokenElement) => { const tokenNameElement = tokenElement.querySelector('.name'); const tokenValueContainer = tokenElement.querySelector('.value-container'); const tokenValueElement = tokenValueContainer.querySelector('.value'); @@ -39,15 +39,15 @@ describe('Filtered Search Visual Tokens', () => { let usersCacheSpy; beforeEach(() => { - jest.spyOn(UsersCache, 'retrieve').mockImplementation(username => usersCacheSpy(username)); + jest.spyOn(UsersCache, 'retrieve').mockImplementation((username) => usersCacheSpy(username)); }); - it('ignores error if UsersCache throws', done => { + it('ignores error if UsersCache throws', (done) => { jest.spyOn(window, 'Flash').mockImplementation(() => {}); const dummyError = new Error('Earth rotated backwards'); const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken); const tokenValue = tokenValueElement.innerText; - usersCacheSpy = username => { + usersCacheSpy = (username) => { expect(`@${username}`).toBe(tokenValue); return Promise.reject(dummyError); }; @@ -61,10 +61,10 @@ describe('Filtered Search Visual Tokens', () => { .catch(done.fail); }); - it('does nothing if user cannot be found', done => { + it('does nothing if user cannot be found', (done) => { const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken); const tokenValue = tokenValueElement.innerText; - usersCacheSpy = username => { + usersCacheSpy = (username) => { expect(`@${username}`).toBe(tokenValue); return Promise.resolve(undefined); }; @@ -78,14 +78,14 @@ describe('Filtered Search Visual Tokens', () => { .catch(done.fail); }); - it('replaces author token with avatar and display name', done => { + it('replaces author token with avatar and display name', (done) => { const dummyUser = { name: 'Important Person', avatar_url: 'https://host.invalid/mypics/avatar.png', }; const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken); const tokenValue = tokenValueElement.innerText; - usersCacheSpy = username => { + usersCacheSpy = (username) => { expect(`@${username}`).toBe(tokenValue); return Promise.resolve(dummyUser); }; @@ -104,14 +104,14 @@ describe('Filtered Search Visual Tokens', () => { .catch(done.fail); }); - it('escapes user name when creating token', done => { + it('escapes user name when creating token', (done) => { const dummyUser = { name: '<script>', avatar_url: `${TEST_HOST}/mypics/avatar.png`, }; const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken); const tokenValue = tokenValueElement.innerText; - usersCacheSpy = username => { + usersCacheSpy = (username) => { expect(`@${username}`).toBe(tokenValue); return Promise.resolve(dummyUser); }; @@ -168,7 +168,7 @@ describe('Filtered Search Visual Tokens', () => { AjaxCache.internalStorage[`${filteredSearchInput.dataset.labelsEndpoint}.json`] = labelData; }); - const parseColor = color => { + const parseColor = (color) => { const dummyElement = document.createElement('div'); dummyElement.style.color = color; return dummyElement.style.color; @@ -180,10 +180,10 @@ describe('Filtered Search Visual Tokens', () => { expect(tokenValueContainer.style.color).toBe(parseColor(label.text_color)); }; - const findLabel = tokenValue => - labelData.find(label => tokenValue === `~${DropdownUtils.getEscapedText(label.title)}`); + const findLabel = (tokenValue) => + labelData.find((label) => tokenValue === `~${DropdownUtils.getEscapedText(label.title)}`); - it('updates the color of a label token', done => { + it('updates the color of a label token', (done) => { const { subject, tokenValueContainer, tokenValueElement } = findElements(bugLabelToken); const tokenValue = tokenValueElement.innerText; const matchingLabel = findLabel(tokenValue); @@ -197,7 +197,7 @@ describe('Filtered Search Visual Tokens', () => { .catch(done.fail); }); - it('updates the color of a label token with spaces', done => { + it('updates the color of a label token with spaces', (done) => { const { subject, tokenValueContainer, tokenValueElement } = findElements(spaceLabelToken); const tokenValue = tokenValueElement.innerText; const matchingLabel = findLabel(tokenValue); @@ -211,7 +211,7 @@ describe('Filtered Search Visual Tokens', () => { .catch(done.fail); }); - it('does not change color of a missing label', done => { + it('does not change color of a missing label', (done) => { const { subject, tokenValueContainer, tokenValueElement } = findElements(missingLabelToken); const tokenValue = tokenValueElement.innerText; const matchingLabel = findLabel(tokenValue); @@ -260,7 +260,7 @@ describe('Filtered Search Visual Tokens', () => { }); describe('render', () => { - const setupSpies = subject => { + const setupSpies = (subject) => { jest.spyOn(subject, 'updateLabelTokenColor').mockImplementation(() => {}); const updateLabelTokenColorSpy = subject.updateLabelTokenColor; diff --git a/spec/frontend/flash_spec.js b/spec/frontend/flash_spec.js index a37d57b03fd..228c897ab00 100644 --- a/spec/frontend/flash_spec.js +++ b/spec/frontend/flash_spec.js @@ -325,7 +325,7 @@ describe('Flash', () => { `; }); - it('removes global flash on click', done => { + it('removes global flash on click', (done) => { const flashEl = document.querySelector('.flash'); removeFlashClickListener(flashEl, false); diff --git a/spec/frontend/frequent_items/components/app_spec.js b/spec/frontend/frequent_items/components/app_spec.js index 439a410eaa1..b74e4ac45cf 100644 --- a/spec/frontend/frequent_items/components/app_spec.js +++ b/spec/frontend/frequent_items/components/app_spec.js @@ -65,7 +65,7 @@ describe('Frequent Items App Component', () => { storage[storageKey] = value; }); - localStorage.getItem.mockImplementation(storageKey => { + localStorage.getItem.mockImplementation((storageKey) => { if (storage[storageKey]) { return storage[storageKey]; } @@ -160,7 +160,7 @@ describe('Frequent Items App Component', () => { }); describe('created', () => { - it('should bind event listeners on eventHub', done => { + it('should bind event listeners on eventHub', (done) => { jest.spyOn(eventHub, '$on').mockImplementation(() => {}); createComponentWithStore().$mount(); @@ -173,7 +173,7 @@ describe('Frequent Items App Component', () => { }); describe('beforeDestroy', () => { - it('should unbind event listeners on eventHub', done => { + it('should unbind event listeners on eventHub', (done) => { jest.spyOn(eventHub, '$off').mockImplementation(() => {}); vm.$mount(); @@ -191,7 +191,7 @@ describe('Frequent Items App Component', () => { expect(vm.$el.querySelector('.search-input-container')).toBeDefined(); }); - it('should render loading animation', done => { + it('should render loading animation', (done) => { vm.$store.dispatch('fetchSearchedItems'); Vue.nextTick(() => { @@ -204,7 +204,7 @@ describe('Frequent Items App Component', () => { }); }); - it('should render frequent projects list header', done => { + it('should render frequent projects list header', (done) => { Vue.nextTick(() => { const sectionHeaderEl = vm.$el.querySelector('.section-header'); @@ -214,7 +214,7 @@ describe('Frequent Items App Component', () => { }); }); - it('should render frequent projects list', done => { + it('should render frequent projects list', (done) => { const expectedResult = getTopFrequentItems(mockFrequentProjects); localStorage.getItem.mockImplementation(() => JSON.stringify(mockFrequentProjects)); @@ -229,7 +229,7 @@ describe('Frequent Items App Component', () => { }); }); - it('should render searched projects list', done => { + it('should render searched projects list', (done) => { mock.onGet(/\/api\/v4\/projects.json(.*)$/).replyOnce(200, mockSearchedProjects); expect(vm.$el.querySelectorAll('.frequent-items-list-container li').length).toBe(1); diff --git a/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js b/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js index 1160ed5c84b..19095c4474e 100644 --- a/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js +++ b/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js @@ -114,7 +114,7 @@ describe('FrequentItemsListItemComponent', () => { const link = wrapper.find('a'); // NOTE: this listener is required to prevent the click from going through and causing: // `Error: Not implemented: navigation ...` - link.element.addEventListener('click', e => { + link.element.addEventListener('click', (e) => { e.preventDefault(); }); link.trigger('click'); diff --git a/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js b/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js index f5e654e6bcb..cdd8b127676 100644 --- a/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js +++ b/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js @@ -46,7 +46,7 @@ describe('FrequentItemsSearchInputComponent', () => { }); describe('mounted', () => { - it('should listen `dropdownOpen` event', done => { + it('should listen `dropdownOpen` event', (done) => { jest.spyOn(eventHub, '$on').mockImplementation(() => {}); const vmX = createComponent().vm; @@ -61,7 +61,7 @@ describe('FrequentItemsSearchInputComponent', () => { }); describe('beforeDestroy', () => { - it('should unbind event listeners on eventHub', done => { + it('should unbind event listeners on eventHub', (done) => { const vmX = createComponent().vm; jest.spyOn(eventHub, '$off').mockImplementation(() => {}); diff --git a/spec/frontend/frequent_items/store/actions_spec.js b/spec/frontend/frequent_items/store/actions_spec.js index 304098e85f1..351fde25f49 100644 --- a/spec/frontend/frequent_items/store/actions_spec.js +++ b/spec/frontend/frequent_items/store/actions_spec.js @@ -29,7 +29,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('setNamespace', () => { - it('should set namespace', done => { + it('should set namespace', (done) => { testAction( actions.setNamespace, mockNamespace, @@ -42,7 +42,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('setStorageKey', () => { - it('should set storage key', done => { + it('should set storage key', (done) => { testAction( actions.setStorageKey, mockStorageKey, @@ -55,7 +55,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('requestFrequentItems', () => { - it('should request frequent items', done => { + it('should request frequent items', (done) => { testAction( actions.requestFrequentItems, null, @@ -68,7 +68,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('receiveFrequentItemsSuccess', () => { - it('should set frequent items', done => { + it('should set frequent items', (done) => { testAction( actions.receiveFrequentItemsSuccess, mockFrequentProjects, @@ -81,7 +81,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('receiveFrequentItemsError', () => { - it('should set frequent items error state', done => { + it('should set frequent items error state', (done) => { testAction( actions.receiveFrequentItemsError, null, @@ -94,7 +94,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('fetchFrequentItems', () => { - it('should dispatch `receiveFrequentItemsSuccess`', done => { + it('should dispatch `receiveFrequentItemsSuccess`', (done) => { mockedState.namespace = mockNamespace; mockedState.storageKey = mockStorageKey; @@ -108,7 +108,7 @@ describe('Frequent Items Dropdown Store Actions', () => { ); }); - it('should dispatch `receiveFrequentItemsError`', done => { + it('should dispatch `receiveFrequentItemsError`', (done) => { jest.spyOn(AccessorUtilities, 'isLocalStorageAccessSafe').mockReturnValue(false); mockedState.namespace = mockNamespace; mockedState.storageKey = mockStorageKey; @@ -125,7 +125,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('requestSearchedItems', () => { - it('should request searched items', done => { + it('should request searched items', (done) => { testAction( actions.requestSearchedItems, null, @@ -138,7 +138,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('receiveSearchedItemsSuccess', () => { - it('should set searched items', done => { + it('should set searched items', (done) => { testAction( actions.receiveSearchedItemsSuccess, mockSearchedProjects, @@ -151,7 +151,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('receiveSearchedItemsError', () => { - it('should set searched items error state', done => { + it('should set searched items error state', (done) => { testAction( actions.receiveSearchedItemsError, null, @@ -168,7 +168,7 @@ describe('Frequent Items Dropdown Store Actions', () => { gon.api_version = 'v4'; }); - it('should dispatch `receiveSearchedItemsSuccess`', done => { + it('should dispatch `receiveSearchedItemsSuccess`', (done) => { mock.onGet(/\/api\/v4\/projects.json(.*)$/).replyOnce(200, mockSearchedProjects, {}); testAction( @@ -187,7 +187,7 @@ describe('Frequent Items Dropdown Store Actions', () => { ); }); - it('should dispatch `receiveSearchedItemsError`', done => { + it('should dispatch `receiveSearchedItemsError`', (done) => { gon.api_version = 'v4'; mock.onGet(/\/api\/v4\/projects.json(.*)$/).replyOnce(500); @@ -203,7 +203,7 @@ describe('Frequent Items Dropdown Store Actions', () => { }); describe('setSearchQuery', () => { - it('should commit query and dispatch `fetchSearchedItems` when query is present', done => { + it('should commit query and dispatch `fetchSearchedItems` when query is present', (done) => { testAction( actions.setSearchQuery, { query: 'test' }, @@ -214,7 +214,7 @@ describe('Frequent Items Dropdown Store Actions', () => { ); }); - it('should commit query and dispatch `fetchFrequentItems` when query is empty', done => { + it('should commit query and dispatch `fetchFrequentItems` when query is empty', (done) => { testAction( actions.setSearchQuery, null, diff --git a/spec/frontend/gfm_auto_complete_spec.js b/spec/frontend/gfm_auto_complete_spec.js index 048491683b9..633ac4ebe2f 100644 --- a/spec/frontend/gfm_auto_complete_spec.js +++ b/spec/frontend/gfm_auto_complete_spec.js @@ -164,7 +164,7 @@ describe('GfmAutoComplete', () => { }); }); - it.each([200, 500])('should set the loading state', async responseStatus => { + it.each([200, 500])('should set the loading state', async (responseStatus) => { mock.onGet('vulnerabilities_autocomplete_url').replyOnce(responseStatus); fetchData.call(context, {}, '[vulnerability:', 'query'); @@ -371,9 +371,9 @@ describe('GfmAutoComplete', () => { const jointAllowedSymbols = allowedSymbols.join(''); describe('should match regular symbols', () => { - flagsUseDefaultMatcher.forEach(flag => { - allowedSymbols.forEach(symbol => { - argumentSize.forEach(size => { + flagsUseDefaultMatcher.forEach((flag) => { + allowedSymbols.forEach((symbol) => { + argumentSize.forEach((size) => { const query = new Array(size + 1).join(symbol); const subtext = flag + query; @@ -395,8 +395,8 @@ describe('GfmAutoComplete', () => { const shouldNotBeFollowedBy = flags.concat(['\x00', '\x10', '\x3f', '\n', ' ']); const shouldNotBePrependedBy = ['`']; - flagsUseDefaultMatcher.forEach(atSign => { - shouldNotBeFollowedBy.forEach(followedSymbol => { + flagsUseDefaultMatcher.forEach((atSign) => { + shouldNotBeFollowedBy.forEach((followedSymbol) => { const seq = atSign + followedSymbol; it(`should not match ${JSON.stringify(seq)}`, () => { @@ -404,7 +404,7 @@ describe('GfmAutoComplete', () => { }); }); - shouldNotBePrependedBy.forEach(prependedSymbol => { + shouldNotBePrependedBy.forEach((prependedSymbol) => { const seq = prependedSymbol + atSign; it(`should not match "${seq}"`, () => { @@ -638,8 +638,8 @@ describe('GfmAutoComplete', () => { }; const allLabels = labelsFixture; - const assignedLabels = allLabels.filter(label => label.set); - const unassignedLabels = allLabels.filter(label => !label.set); + const assignedLabels = allLabels.filter((label) => label.set); + const unassignedLabels = allLabels.filter((label) => !label.set); let autocomplete; let $textarea; @@ -655,7 +655,7 @@ describe('GfmAutoComplete', () => { autocomplete.destroy(); }); - const triggerDropdown = text => { + const triggerDropdown = (text) => { $textarea.trigger('focus').val(text).caret('pos', -1); $textarea.trigger('keyup'); @@ -665,12 +665,12 @@ describe('GfmAutoComplete', () => { const getDropdownItems = () => { const dropdown = document.getElementById('at-view-labels'); const items = dropdown.getElementsByTagName('li'); - return [].map.call(items, item => item.textContent.trim()); + return [].map.call(items, (item) => item.textContent.trim()); }; const expectLabels = ({ input, output }) => triggerDropdown(input).then(() => { - expect(getDropdownItems()).toEqual(output.map(label => label.title)); + expect(getDropdownItems()).toEqual(output.map((label) => label.title)); }); describe('with no labels assigned', () => { @@ -739,9 +739,9 @@ describe('GfmAutoComplete', () => { }); describe.each` - name | inputFormat | assert - ${'insertTemplateFunction'} | ${name => ({ name })} | ${assertInserted} - ${'templateFunction'} | ${name => name} | ${assertTemplated} + name | inputFormat | assert + ${'insertTemplateFunction'} | ${(name) => ({ name })} | ${assertInserted} + ${'templateFunction'} | ${(name) => name} | ${assertTemplated} `('Emoji.$name', ({ name, inputFormat, assert }) => { const execute = (accessor, input, emoji) => assert({ @@ -808,7 +808,7 @@ describe('GfmAutoComplete', () => { const item = GfmAutoComplete.Emoji.templateFunction('heart') .replace(/(<gl-emoji)\s+(data-name)/, '$1 $2') - .replace(/>\s+|\s+</g, s => s.trim()); + .replace(/>\s+|\s+</g, (s) => s.trim()); expect(item).toEqual( `<li>${heart.name}<gl-emoji data-name="${heart.name}"></gl-emoji></li>`, ); @@ -820,7 +820,7 @@ describe('GfmAutoComplete', () => { const item = GfmAutoComplete.Emoji.templateFunction('star') .replace(/(<gl-emoji)\s+(data-name)/, '$1 $2') - .replace(/>\s+|\s+</g, s => s.trim()); + .replace(/>\s+|\s+</g, (s) => s.trim()); expect(item).toEqual(`<li>${star.name}<gl-emoji data-name="${star.name}"></gl-emoji></li>`); }); }); diff --git a/spec/frontend/gl_field_errors_spec.js b/spec/frontend/gl_field_errors_spec.js index f5b50c238df..a1737211252 100644 --- a/spec/frontend/gl_field_errors_spec.js +++ b/spec/frontend/gl_field_errors_spec.js @@ -33,7 +33,7 @@ describe('GL Style Field Errors', () => { expect(customErrorElem.length).toBe(1); - const customErrors = testContext.fieldErrors.state.inputs.filter(input => { + const customErrors = testContext.fieldErrors.state.inputs.filter((input) => { return input.inputElement.hasClass(customErrorFlag); }); diff --git a/spec/frontend/gl_form_spec.js b/spec/frontend/gl_form_spec.js index 52e1693f8a6..5dbded720bb 100644 --- a/spec/frontend/gl_form_spec.js +++ b/spec/frontend/gl_form_spec.js @@ -8,7 +8,7 @@ describe('GLForm', () => { const testContext = {}; describe('when instantiated', () => { - beforeEach(done => { + beforeEach((done) => { window.gl = window.gl || {}; testContext.form = $('<form class="gfm-form"><textarea class="js-gfm-input"></form>'); @@ -28,7 +28,7 @@ describe('GLForm', () => { }); describe('setupAutosize', () => { - beforeEach(done => { + beforeEach((done) => { testContext.glForm.setupAutosize(); setImmediate(() => { diff --git a/spec/frontend/gpg_badges_spec.js b/spec/frontend/gpg_badges_spec.js index 644b687aa19..7c1f83e577c 100644 --- a/spec/frontend/gpg_badges_spec.js +++ b/spec/frontend/gpg_badges_spec.js @@ -36,7 +36,7 @@ describe('GpgBadges', () => { mock.restore(); }); - it('does not make a request if there is no container element', done => { + it('does not make a request if there is no container element', (done) => { setFixtures(''); jest.spyOn(axios, 'get').mockImplementation(() => {}); @@ -48,13 +48,13 @@ describe('GpgBadges', () => { .catch(done.fail); }); - it('throws an error if the endpoint is missing', done => { + it('throws an error if the endpoint is missing', (done) => { setFixtures('<div class="js-signature-container"></div>'); jest.spyOn(axios, 'get').mockImplementation(() => {}); GpgBadges.fetch() .then(() => done.fail('Expected error to be thrown')) - .catch(error => { + .catch((error) => { expect(error.message).toBe('Missing commit signatures endpoint!'); expect(axios.get).not.toHaveBeenCalled(); }) @@ -62,7 +62,7 @@ describe('GpgBadges', () => { .catch(done.fail); }); - it('displays a loading spinner', done => { + it('displays a loading spinner', (done) => { mock.onGet(dummyUrl).replyOnce(200); GpgBadges.fetch() @@ -76,7 +76,7 @@ describe('GpgBadges', () => { .catch(done.fail); }); - it('replaces the loading spinner', done => { + it('replaces the loading spinner', (done) => { mock.onGet(dummyUrl).replyOnce(200, dummyResponse); GpgBadges.fetch() diff --git a/spec/frontend/group_settings/components/shared_runners_form_spec.js b/spec/frontend/group_settings/components/shared_runners_form_spec.js index 9e3ee8a2cb1..4ec739122c8 100644 --- a/spec/frontend/group_settings/components/shared_runners_form_spec.js +++ b/spec/frontend/group_settings/components/shared_runners_form_spec.js @@ -32,7 +32,7 @@ describe('group_settings/components/shared_runners_form', () => { const findErrorAlert = () => wrapper.find(GlAlert); const findEnabledToggle = () => wrapper.find('[data-testid="enable-runners-toggle"]'); const findOverrideToggle = () => wrapper.find('[data-testid="override-runners-toggle"]'); - const changeToggle = toggle => toggle.vm.$emit('change', !toggle.props('value')); + const changeToggle = (toggle) => toggle.vm.$emit('change', !toggle.props('value')); const getRequestPayload = () => JSON.parse(mock.history.put[0].data); const isLoadingIconVisible = () => findLoadingIcon().exists(); diff --git a/spec/frontend/groups/components/group_item_spec.js b/spec/frontend/groups/components/group_item_spec.js index 32bae812c86..d70ea709dee 100644 --- a/spec/frontend/groups/components/group_item_spec.js +++ b/spec/frontend/groups/components/group_item_spec.js @@ -31,7 +31,7 @@ describe('GroupItemComponent', () => { vm.$destroy(); }); - const withMicrodata = group => ({ + const withMicrodata = (group) => ({ ...group, microdata: getGroupItemMicrodata(group), }); @@ -49,7 +49,7 @@ describe('GroupItemComponent', () => { const { rowClass } = vm; expect(Object.keys(rowClass).length).toBe(classes.length); - Object.keys(rowClass).forEach(className => { + Object.keys(rowClass).forEach((className) => { expect(classes.indexOf(className)).toBeGreaterThan(-1); }); }); @@ -220,13 +220,13 @@ describe('GroupItemComponent', () => { }); describe('schema.org props', () => { describe('when showSchemaMarkup is disabled on the group', () => { - it.each(['itemprop', 'itemtype', 'itemscope'], 'it does not set %s', attr => { + it.each(['itemprop', 'itemtype', 'itemscope'], 'it does not set %s', (attr) => { expect(vm.$el.getAttribute(attr)).toBeNull(); }); it.each( ['.js-group-avatar', '.js-group-name', '.js-group-description'], 'it does not set `itemprop` on sub-nodes', - selector => { + (selector) => { expect(vm.$el.querySelector(selector).getAttribute('itemprop')).toBeNull(); }, ); diff --git a/spec/frontend/groups/components/visibility_level_dropdown_spec.js b/spec/frontend/groups/components/visibility_level_dropdown_spec.js index 8f65a0e9c13..61b7bbb0833 100644 --- a/spec/frontend/groups/components/visibility_level_dropdown_spec.js +++ b/spec/frontend/groups/components/visibility_level_dropdown_spec.js @@ -11,7 +11,7 @@ describe('Visibility Level Dropdown', () => { ]; const defaultLevel = 0; - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = shallowMount(Component, { propsData, }); @@ -33,7 +33,7 @@ describe('Visibility Level Dropdown', () => { wrapper.find("input[name='group[visibility_level]']").attributes('value'); const dropdownText = () => wrapper.find(GlDropdown).props('text'); const findDropdownItems = () => - wrapper.findAll(GlDropdownItem).wrappers.map(option => ({ + wrapper.findAll(GlDropdownItem).wrappers.map((option) => ({ text: option.text(), secondaryText: option.props('secondaryText'), })); diff --git a/spec/frontend/helpers/backoff_helper.js b/spec/frontend/helpers/backoff_helper.js index e5c0308d3fb..a971fcb0945 100644 --- a/spec/frontend/helpers/backoff_helper.js +++ b/spec/frontend/helpers/backoff_helper.js @@ -16,9 +16,9 @@ * * @param {Function} callback */ -export const backoffMockImplementation = callback => { +export const backoffMockImplementation = (callback) => { const q = new Promise((resolve, reject) => { - const stop = arg => (arg instanceof Error ? reject(arg) : resolve(arg)); + const stop = (arg) => (arg instanceof Error ? reject(arg) : resolve(arg)); const next = () => callback(next, stop); // Define a timeout based on a mock timer setTimeout(() => { diff --git a/spec/frontend/helpers/dom_events_helper.js b/spec/frontend/helpers/dom_events_helper.js index 423e5c58bb4..865ea97903f 100644 --- a/spec/frontend/helpers/dom_events_helper.js +++ b/spec/frontend/helpers/dom_events_helper.js @@ -1,4 +1,4 @@ -export const triggerDOMEvent = type => { +export const triggerDOMEvent = (type) => { window.document.dispatchEvent( new Event(type, { bubbles: true, diff --git a/spec/frontend/helpers/dom_shims/size_properties.js b/spec/frontend/helpers/dom_shims/size_properties.js index a2d5940bd1e..fbb919868b1 100644 --- a/spec/frontend/helpers/dom_shims/size_properties.js +++ b/spec/frontend/helpers/dom_shims/size_properties.js @@ -1,4 +1,4 @@ -const convertFromStyle = style => { +const convertFromStyle = (style) => { if (style.match(/[0-9](px|rem)/g)) { return Number(style.replace(/[^0-9]/g, '')); } diff --git a/spec/frontend/helpers/emoji.js b/spec/frontend/helpers/emoji.js index e8a93e21818..ea6613b53c9 100644 --- a/spec/frontend/helpers/emoji.js +++ b/spec/frontend/helpers/emoji.js @@ -55,7 +55,7 @@ export const emojiFixtureMap = { }, }; -Object.keys(emojiFixtureMap).forEach(k => { +Object.keys(emojiFixtureMap).forEach((k) => { emojiFixtureMap[k].name = k; if (!emojiFixtureMap[k].aliases) { emojiFixtureMap[k].aliases = []; @@ -64,7 +64,7 @@ Object.keys(emojiFixtureMap).forEach(k => { export async function initEmojiMock() { const emojiData = Object.fromEntries( - Object.values(emojiFixtureMap).map(m => { + Object.values(emojiFixtureMap).map((m) => { const { name: n, moji: e, unicodeVersion: u, category: c, description: d } = m; return [n, { c, e, d, u }]; }), @@ -81,8 +81,8 @@ export async function initEmojiMock() { export function describeEmojiFields(label, tests) { describe.each` field | accessor - ${'name'} | ${e => e.name} - ${'alias'} | ${e => e.aliases[0]} - ${'description'} | ${e => e.description} + ${'name'} | ${(e) => e.name} + ${'alias'} | ${(e) => e.aliases[0]} + ${'description'} | ${(e) => e.description} `(label, tests); } diff --git a/spec/frontend/helpers/event_hub_factory_spec.js b/spec/frontend/helpers/event_hub_factory_spec.js index c4f63ff6049..2491e8d5dda 100644 --- a/spec/frontend/helpers/event_hub_factory_spec.js +++ b/spec/frontend/helpers/event_hub_factory_spec.js @@ -93,7 +93,7 @@ describe('event bus factory', () => { describe('$off', () => { beforeEach(() => { - otherHandlers.forEach(x => eventBus.$on(TEST_EVENT, x)); + otherHandlers.forEach((x) => eventBus.$on(TEST_EVENT, x)); eventBus.$on(TEST_EVENT, handler); }); @@ -115,7 +115,7 @@ describe('event bus factory', () => { eventBus.$emit(TEST_EVENT); expect(handler).not.toHaveBeenCalled(); - expect(otherHandlers.map(x => x.mock.calls.length)).toEqual(otherHandlers.map(() => 1)); + expect(otherHandlers.map((x) => x.mock.calls.length)).toEqual(otherHandlers.map(() => 1)); }); it('without a handler, will no longer call any handlers', () => { @@ -124,13 +124,13 @@ describe('event bus factory', () => { eventBus.$emit(TEST_EVENT); expect(handler).not.toHaveBeenCalled(); - expect(otherHandlers.map(x => x.mock.calls.length)).toEqual(otherHandlers.map(() => 0)); + expect(otherHandlers.map((x) => x.mock.calls.length)).toEqual(otherHandlers.map(() => 0)); }); }); describe('$emit', () => { beforeEach(() => { - otherHandlers.forEach(x => eventBus.$on(TEST_EVENT_2, x)); + otherHandlers.forEach((x) => eventBus.$on(TEST_EVENT_2, x)); eventBus.$on(TEST_EVENT, handler); }); @@ -138,7 +138,7 @@ describe('event bus factory', () => { eventBus.$emit(TEST_EVENT, 'arg1'); expect(handler).toHaveBeenCalledWith('arg1'); - expect(otherHandlers.map(x => x.mock.calls.length)).toEqual(otherHandlers.map(() => 0)); + expect(otherHandlers.map((x) => x.mock.calls.length)).toEqual(otherHandlers.map(() => 0)); }); }); }); diff --git a/spec/frontend/helpers/fake_date.js b/spec/frontend/helpers/fake_date.js index 387747ab5bd..5391ae04797 100644 --- a/spec/frontend/helpers/fake_date.js +++ b/spec/frontend/helpers/fake_date.js @@ -3,9 +3,9 @@ export const DEFAULT_ARGS = [2020, 6, 6]; const RealDate = Date; -const isMocked = val => Boolean(val.mock); +const isMocked = (val) => Boolean(val.mock); -export const createFakeDateClass = ctorDefault => { +export const createFakeDateClass = (ctorDefault) => { const FakeDate = new Proxy(RealDate, { construct: (target, argArray) => { const ctorArgs = argArray.length ? argArray : ctorDefault; @@ -25,7 +25,7 @@ export const createFakeDateClass = ctorDefault => { return target[prop]; }, - getPrototypeOf: target => { + getPrototypeOf: (target) => { return target.prototype; }, // We need to be able to set props so that `jest.spyOn` will work. diff --git a/spec/frontend/helpers/fake_request_animation_frame.js b/spec/frontend/helpers/fake_request_animation_frame.js index f6fc29df4dc..ca9d82b6c3a 100644 --- a/spec/frontend/helpers/fake_request_animation_frame.js +++ b/spec/frontend/helpers/fake_request_animation_frame.js @@ -3,7 +3,7 @@ export const useFakeRequestAnimationFrame = () => { beforeEach(() => { orig = global.requestAnimationFrame; - global.requestAnimationFrame = cb => cb(); + global.requestAnimationFrame = (cb) => cb(); }); afterEach(() => { diff --git a/spec/frontend/helpers/fixtures.js b/spec/frontend/helpers/fixtures.js index a89ceab3f8e..4b86724df93 100644 --- a/spec/frontend/helpers/fixtures.js +++ b/spec/frontend/helpers/fixtures.js @@ -20,7 +20,7 @@ Did you run bin/rake frontend:fixtures?`, return fs.readFileSync(absolutePath, 'utf8'); } -export const getJSONFixture = relativePath => JSON.parse(getFixture(relativePath)); +export const getJSONFixture = (relativePath) => JSON.parse(getFixture(relativePath)); export const resetHTMLFixture = () => { document.head.innerHTML = ''; diff --git a/spec/frontend/helpers/jest_helpers.js b/spec/frontend/helpers/jest_helpers.js index 0b623e0a59b..273d2c91966 100644 --- a/spec/frontend/helpers/jest_helpers.js +++ b/spec/frontend/helpers/jest_helpers.js @@ -15,7 +15,7 @@ Try not to use these in new tests - this module is provided primarily for conven */ export function createSpyObj(baseName, methods) { const obj = {}; - methods.forEach(method => { + methods.forEach((method) => { obj[method] = jest.fn().mockName(`${baseName}#${method}`); }); return obj; diff --git a/spec/frontend/helpers/local_storage_helper.js b/spec/frontend/helpers/local_storage_helper.js index 0318b80aaef..21749fd8070 100644 --- a/spec/frontend/helpers/local_storage_helper.js +++ b/spec/frontend/helpers/local_storage_helper.js @@ -8,7 +8,7 @@ * * @param {() => any} fn Function that returns the object to use for localStorage */ -const useLocalStorage = fn => { +const useLocalStorage = (fn) => { const origLocalStorage = window.localStorage; let currentLocalStorage = origLocalStorage; @@ -35,11 +35,11 @@ export const createLocalStorageSpy = () => { clear: jest.fn(() => { storage = {}; }), - getItem: jest.fn(key => (key in storage ? storage[key] : null)), + getItem: jest.fn((key) => (key in storage ? storage[key] : null)), setItem: jest.fn((key, value) => { storage[key] = value; }), - removeItem: jest.fn(key => delete storage[key]), + removeItem: jest.fn((key) => delete storage[key]), }; }; diff --git a/spec/frontend/helpers/locale_helper.js b/spec/frontend/helpers/locale_helper.js index 283d9bc14c9..bb4a2eccf4e 100644 --- a/spec/frontend/helpers/locale_helper.js +++ b/spec/frontend/helpers/locale_helper.js @@ -1,4 +1,4 @@ -export const setLanguage = languageCode => { +export const setLanguage = (languageCode) => { const htmlElement = document.querySelector('html'); if (languageCode) { diff --git a/spec/frontend/helpers/mock_window_location_helper.js b/spec/frontend/helpers/mock_window_location_helper.js index 175044d1fce..08a28fbbbd6 100644 --- a/spec/frontend/helpers/mock_window_location_helper.js +++ b/spec/frontend/helpers/mock_window_location_helper.js @@ -8,7 +8,7 @@ * * @param {() => any} fn Function that returns the object to use for window.location */ -const useMockLocation = fn => { +const useMockLocation = (fn) => { const origWindowLocation = window.location; let currentWindowLocation; diff --git a/spec/frontend/helpers/set_timeout_promise_helper.js b/spec/frontend/helpers/set_timeout_promise_helper.js index 47087619187..afd18d92d15 100644 --- a/spec/frontend/helpers/set_timeout_promise_helper.js +++ b/spec/frontend/helpers/set_timeout_promise_helper.js @@ -1,4 +1,4 @@ export default (time = 0) => - new Promise(resolve => { + new Promise((resolve) => { setTimeout(resolve, time); }); diff --git a/spec/frontend/helpers/set_window_location_helper_spec.js b/spec/frontend/helpers/set_window_location_helper_spec.js index da609b6bbf0..98f26854822 100644 --- a/spec/frontend/helpers/set_window_location_helper_spec.js +++ b/spec/frontend/helpers/set_window_location_helper_spec.js @@ -32,7 +32,7 @@ describe('setWindowLocation', () => { it.each([null, 1, undefined, false, '', 'gitlab.com'])( 'throws an error when called with an invalid url: "%s"', - invalidUrl => { + (invalidUrl) => { expect(() => setWindowLocation(invalidUrl)).toThrow(/Invalid URL/); expect(window.location).toBe(originalLocation); }, diff --git a/spec/frontend/helpers/startup_css_helper_spec.js b/spec/frontend/helpers/startup_css_helper_spec.js index 2d560c43fa5..0484f3d6852 100644 --- a/spec/frontend/helpers/startup_css_helper_spec.js +++ b/spec/frontend/helpers/startup_css_helper_spec.js @@ -75,7 +75,7 @@ describe('waitForCSSLoaded', () => { const events = waitForCSSLoaded(mockedCallback); document .querySelectorAll('[data-startupcss="loading"]') - .forEach(elem => elem.setAttribute('data-startupcss', 'loaded')); + .forEach((elem) => elem.setAttribute('data-startupcss', 'loaded')); document.dispatchEvent(new CustomEvent('CSSStartupLinkLoaded')); await events; diff --git a/spec/frontend/helpers/stub_children.js b/spec/frontend/helpers/stub_children.js index 91171eb3d8c..0711563699f 100644 --- a/spec/frontend/helpers/stub_children.js +++ b/spec/frontend/helpers/stub_children.js @@ -1,3 +1,3 @@ export default function stubChildren(Component) { - return Object.fromEntries(Object.keys(Component.components).map(c => [c, true])); + return Object.fromEntries(Object.keys(Component.components).map((c) => [c, true])); } diff --git a/spec/frontend/helpers/text_helper.js b/spec/frontend/helpers/text_helper.js index e0fe18e5560..164f18faadc 100644 --- a/spec/frontend/helpers/text_helper.js +++ b/spec/frontend/helpers/text_helper.js @@ -2,17 +2,17 @@ * Replaces line break with an empty space * @param {*} data */ -export const removeBreakLine = data => data.replace(/\r?\n|\r/g, ' '); +export const removeBreakLine = (data) => data.replace(/\r?\n|\r/g, ' '); /** * Removes line breaks, spaces and trims the given text * @param {String} str * @returns {String} */ -export const trimText = str => +export const trimText = (str) => str .replace(/\r?\n|\r/g, '') .replace(/\s\s+/g, ' ') .trim(); -export const removeWhitespace = str => str.replace(/\s\s+/g, ' '); +export const removeWhitespace = (str) => str.replace(/\s\s+/g, ' '); diff --git a/spec/frontend/helpers/timeout.js b/spec/frontend/helpers/timeout.js index 702ef0be5aa..8688625a95e 100644 --- a/spec/frontend/helpers/timeout.js +++ b/spec/frontend/helpers/timeout.js @@ -4,7 +4,7 @@ const IS_DEBUGGING = process.execArgv.join(' ').includes('--inspect-brk'); let testTimeoutNS; -export const setTestTimeout = newTimeoutMS => { +export const setTestTimeout = (newTimeoutMS) => { const newTimeoutNS = newTimeoutMS * NS_PER_MS; // never accept a smaller timeout than the default if (newTimeoutNS < testTimeoutNS) { @@ -18,7 +18,7 @@ export const setTestTimeout = newTimeoutMS => { // Allows slow tests to set their own timeout. // Useful for tests with jQuery, which is very slow in big DOMs. let temporaryTimeoutNS = null; -export const setTestTimeoutOnce = newTimeoutMS => { +export const setTestTimeoutOnce = (newTimeoutMS) => { const newTimeoutNS = newTimeoutMS * NS_PER_MS; // never accept a smaller timeout than the default if (newTimeoutNS < testTimeoutNS) { @@ -28,7 +28,7 @@ export const setTestTimeoutOnce = newTimeoutMS => { temporaryTimeoutNS = newTimeoutNS; }; -export const initializeTestTimeout = defaultTimeoutMS => { +export const initializeTestTimeout = (defaultTimeoutMS) => { setTestTimeout(defaultTimeoutMS); let testStartTime; diff --git a/spec/frontend/helpers/tracking_helper.js b/spec/frontend/helpers/tracking_helper.js index bd3bd24028c..08ba5a6628e 100644 --- a/spec/frontend/helpers/tracking_helper.js +++ b/spec/frontend/helpers/tracking_helper.js @@ -14,7 +14,7 @@ export function mockTracking(category = '_category_', documentOverride, spyMetho export function unmockTracking() { window.snowplow = undefined; - handlers.forEach(event => document.removeEventListener(event.name, event.func)); + handlers.forEach((event) => document.removeEventListener(event.name, event.func)); } export function triggerEvent(selectorOrEl, eventName = 'click') { diff --git a/spec/frontend/helpers/vue_mock_directive.js b/spec/frontend/helpers/vue_mock_directive.js index 28d4708835d..e952f258c4d 100644 --- a/spec/frontend/helpers/vue_mock_directive.js +++ b/spec/frontend/helpers/vue_mock_directive.js @@ -1,4 +1,4 @@ -export const getKey = name => `$_gl_jest_${name}`; +export const getKey = (name) => `$_gl_jest_${name}`; export const getBinding = (el, name) => el[getKey(name)]; diff --git a/spec/frontend/helpers/vue_test_utils_helper.js b/spec/frontend/helpers/vue_test_utils_helper.js index 0e9127b5c65..ffccfb249c2 100644 --- a/spec/frontend/helpers/vue_test_utils_helper.js +++ b/spec/frontend/helpers/vue_test_utils_helper.js @@ -2,7 +2,7 @@ import { isArray } from 'lodash'; const vNodeContainsText = (vnode, text) => (vnode.text && vnode.text.includes(text)) || - (vnode.children && vnode.children.filter(child => vNodeContainsText(child, text)).length); + (vnode.children && vnode.children.filter((child) => vNodeContainsText(child, text)).length); /** * Determines whether a `shallowMount` Wrapper contains text @@ -17,7 +17,7 @@ const vNodeContainsText = (vnode, text) => */ export const shallowWrapperContainsSlotText = (shallowWrapper, slotName, text) => Boolean( - shallowWrapper.vm.$slots[slotName].filter(vnode => vNodeContainsText(vnode, text)).length, + shallowWrapper.vm.$slots[slotName].filter((vnode) => vNodeContainsText(vnode, text)).length, ); /** @@ -27,8 +27,8 @@ export const shallowWrapperContainsSlotText = (shallowWrapper, slotName, text) = * @param {String} expectedMutationType - The Mutation to wait for */ export const waitForMutation = (store, expectedMutationType) => - new Promise(resolve => { - const unsubscribe = store.subscribe(mutation => { + new Promise((resolve) => { + const unsubscribe = store.subscribe((mutation) => { if (mutation.type === expectedMutationType) { unsubscribe(); resolve(); @@ -36,7 +36,7 @@ export const waitForMutation = (store, expectedMutationType) => }); }); -export const extendedWrapper = wrapper => { +export const extendedWrapper = (wrapper) => { if (isArray(wrapper) || !wrapper?.find) { // eslint-disable-next-line no-console console.warn( diff --git a/spec/frontend/helpers/vuex_action_helper.js b/spec/frontend/helpers/vuex_action_helper.js index 64dd3888d47..e482a8fbc71 100644 --- a/spec/frontend/helpers/vuex_action_helper.js +++ b/spec/frontend/helpers/vuex_action_helper.js @@ -116,12 +116,12 @@ export default ( payload, ); - return (result || new Promise(resolve => setImmediate(resolve))) - .catch(error => { + return (result || new Promise((resolve) => setImmediate(resolve))) + .catch((error) => { validateResults(); throw error; }) - .then(data => { + .then((data) => { validateResults(); return data; }); diff --git a/spec/frontend/helpers/vuex_action_helper_spec.js b/spec/frontend/helpers/vuex_action_helper_spec.js index 4d7bf21820a..b4f5a291774 100644 --- a/spec/frontend/helpers/vuex_action_helper_spec.js +++ b/spec/frontend/helpers/vuex_action_helper_spec.js @@ -10,7 +10,7 @@ const testActionFnWithOptionsArg = (...args) => { describe.each([testActionFn, testActionFnWithOptionsArg])( 'VueX test helper (testAction)', - testAction => { + (testAction) => { let originalExpect; let assertion; let mock; @@ -25,7 +25,7 @@ describe.each([testActionFn, testActionFnWithOptionsArg])( */ originalExpect = expect; assertion = null; - global.expect = actual => ({ + global.expect = (actual) => ({ toEqual: () => { originalExpect(actual).toEqual(assertion); }, @@ -72,13 +72,13 @@ describe.each([testActionFn, testActionFnWithOptionsArg])( testAction(action, null, {}, assertion.mutations, assertion.actions, noop); }); - it('works with done callback once finished', done => { + it('works with done callback once finished', (done) => { assertion = { mutations: [], actions: [] }; testAction(noop, null, {}, assertion.mutations, assertion.actions, done); }); - it('returns a promise', done => { + it('returns a promise', (done) => { assertion = { mutations: [], actions: [] }; testAction(noop, null, {}, assertion.mutations, assertion.actions) @@ -96,7 +96,7 @@ describe.each([testActionFn, testActionFnWithOptionsArg])( return axios .get(TEST_HOST) - .catch(error => { + .catch((error) => { commit('ERROR'); lastError = error; throw error; @@ -111,7 +111,7 @@ describe.each([testActionFn, testActionFnWithOptionsArg])( lastError = null; }); - it('works with done callback once finished', done => { + it('works with done callback once finished', (done) => { mock.onGet(TEST_HOST).replyOnce(200, 42); assertion = { mutations: [{ type: 'SUCCESS' }], actions: [{ type: 'ACTION' }] }; @@ -119,34 +119,34 @@ describe.each([testActionFn, testActionFnWithOptionsArg])( testAction(asyncAction, null, {}, assertion.mutations, assertion.actions, done); }); - it('returns original data of successful promise while checking actions/mutations', done => { + it('returns original data of successful promise while checking actions/mutations', (done) => { mock.onGet(TEST_HOST).replyOnce(200, 42); assertion = { mutations: [{ type: 'SUCCESS' }], actions: [{ type: 'ACTION' }] }; testAction(asyncAction, null, {}, assertion.mutations, assertion.actions) - .then(res => { + .then((res) => { originalExpect(res).toEqual(data); done(); }) .catch(done.fail); }); - it('returns original error of rejected promise while checking actions/mutations', done => { + it('returns original error of rejected promise while checking actions/mutations', (done) => { mock.onGet(TEST_HOST).replyOnce(500, ''); assertion = { mutations: [{ type: 'ERROR' }], actions: [{ type: 'ACTION' }] }; testAction(asyncAction, null, {}, assertion.mutations, assertion.actions) .then(done.fail) - .catch(error => { + .catch((error) => { originalExpect(error).toBe(lastError); done(); }); }); }); - it('works with async actions not returning promises', done => { + it('works with async actions not returning promises', (done) => { const data = { FOO: 'BAR' }; const asyncAction = ({ commit, dispatch }) => { @@ -158,7 +158,7 @@ describe.each([testActionFn, testActionFnWithOptionsArg])( commit('SUCCESS'); return data; }) - .catch(error => { + .catch((error) => { commit('ERROR'); throw error; }); diff --git a/spec/frontend/helpers/wait_for_promises.js b/spec/frontend/helpers/wait_for_promises.js index 1d2b53fc770..2fd1cc6ba0d 100644 --- a/spec/frontend/helpers/wait_for_promises.js +++ b/spec/frontend/helpers/wait_for_promises.js @@ -1 +1 @@ -export default () => new Promise(resolve => requestAnimationFrame(resolve)); +export default () => new Promise((resolve) => requestAnimationFrame(resolve)); diff --git a/spec/frontend/helpers/wait_using_real_timer.js b/spec/frontend/helpers/wait_using_real_timer.js index ddf23cd97b4..110d5f46c08 100644 --- a/spec/frontend/helpers/wait_using_real_timer.js +++ b/spec/frontend/helpers/wait_using_real_timer.js @@ -1,6 +1,6 @@ /* useful for timing promises when jest fakeTimers are not reliable enough */ -export default timeout => - new Promise(resolve => { +export default (timeout) => + new Promise((resolve) => { jest.useRealTimers(); setTimeout(resolve, timeout); jest.useFakeTimers(); diff --git a/spec/frontend/ide/components/activity_bar_spec.js b/spec/frontend/ide/components/activity_bar_spec.js index 762f3c5dad1..b3d0475f942 100644 --- a/spec/frontend/ide/components/activity_bar_spec.js +++ b/spec/frontend/ide/components/activity_bar_spec.js @@ -59,7 +59,7 @@ describe('IDE activity bar', () => { expect(vm.$el.querySelector('.js-ide-edit-mode').classList).toContain('active'); }); - it('sets commit item active', done => { + it('sets commit item active', (done) => { vm.$store.state.currentActivityView = leftSidebarViews.commit.name; vm.$nextTick(() => { diff --git a/spec/frontend/ide/components/branches/search_list_spec.js b/spec/frontend/ide/components/branches/search_list_spec.js index fe142d70698..85776f8cc0e 100644 --- a/spec/frontend/ide/components/branches/search_list_spec.js +++ b/spec/frontend/ide/components/branches/search_list_spec.js @@ -71,7 +71,7 @@ describe('IDE branches search list', () => { it('renders check next to active branch', () => { const activeBranch = 'regular'; createComponent({ branches }, activeBranch); - const items = wrapper.findAll(Item).filter(w => w.props('isActive')); + const items = wrapper.findAll(Item).filter((w) => w.props('isActive')); expect(items.length).toBe(1); expect(items.at(0).props('item').name).toBe(activeBranch); diff --git a/spec/frontend/ide/components/commit_sidebar/actions_spec.js b/spec/frontend/ide/components/commit_sidebar/actions_spec.js index 0003e13c92f..91751bd34ea 100644 --- a/spec/frontend/ide/components/commit_sidebar/actions_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/actions_spec.js @@ -30,7 +30,7 @@ describe('IDE commit sidebar actions', () => { vm.$store.state.currentProjectId = 'abcproject'; const proj = { ...projectData }; - proj.branches[currentBranchId] = branches.find(branch => branch.name === currentBranchId); + proj.branches[currentBranchId] = branches.find((branch) => branch.name === currentBranchId); proj.empty_repo = emptyRepo; Vue.set(vm.$store.state.projects, 'abcproject', proj); @@ -72,7 +72,7 @@ describe('IDE commit sidebar actions', () => { expect(findText()).toContain('Commit to master branch'); }); - it('hides merge request option when project merge requests are disabled', done => { + it('hides merge request option when project merge requests are disabled', (done) => { createComponent({ hasMR: false }); vm.$nextTick(() => { @@ -106,7 +106,7 @@ describe('IDE commit sidebar actions', () => { expect(vm.$store.dispatch).not.toHaveBeenCalled(); }); - it('calls again after staged changes', done => { + it('calls again after staged changes', (done) => { createComponent({ currentBranchId: null }); vm.$store.state.currentBranchId = 'master'; diff --git a/spec/frontend/ide/components/commit_sidebar/list_item_spec.js b/spec/frontend/ide/components/commit_sidebar/list_item_spec.js index 7ce628d4da7..baa25a11c2a 100644 --- a/spec/frontend/ide/components/commit_sidebar/list_item_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/list_item_spec.js @@ -41,7 +41,7 @@ describe('Multi-file editor commit sidebar list item', () => { expect(findPathText()).toContain(f.path); }); - it('correctly renders renamed entries', done => { + it('correctly renders renamed entries', (done) => { Vue.set(vm.file, 'prevName', 'Old name'); vm.$nextTick() @@ -52,7 +52,7 @@ describe('Multi-file editor commit sidebar list item', () => { .catch(done.fail); }); - it('correctly renders entry, the name of which did not change after rename (as within a folder)', done => { + it('correctly renders entry, the name of which did not change after rename (as within a folder)', (done) => { Vue.set(vm.file, 'prevName', f.name); vm.$nextTick() @@ -63,7 +63,7 @@ describe('Multi-file editor commit sidebar list item', () => { .catch(done.fail); }); - it('opens a closed file in the editor when clicking the file path', done => { + it('opens a closed file in the editor when clicking the file path', (done) => { jest.spyOn(vm, 'openPendingTab'); jest.spyOn(router, 'push').mockImplementation(() => {}); @@ -77,7 +77,7 @@ describe('Multi-file editor commit sidebar list item', () => { }); }); - it('calls updateViewer with diff when clicking file', done => { + it('calls updateViewer with diff when clicking file', (done) => { jest.spyOn(vm, 'openFileInEditor'); jest.spyOn(vm, 'updateViewer'); jest.spyOn(router, 'push').mockImplementation(() => {}); @@ -134,7 +134,7 @@ describe('Multi-file editor commit sidebar list item', () => { expect(vm.$el.querySelector('.is-active')).toBe(null); }); - it('adds active class when keys match', done => { + it('adds active class when keys match', (done) => { vm.keyPrefix = 'staged'; vm.$nextTick(() => { diff --git a/spec/frontend/ide/components/commit_sidebar/list_spec.js b/spec/frontend/ide/components/commit_sidebar/list_spec.js index 636dfbf0b2a..898ec4bebce 100644 --- a/spec/frontend/ide/components/commit_sidebar/list_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/list_spec.js @@ -31,7 +31,7 @@ describe('Multi-file editor commit sidebar list', () => { }); describe('with a list of files', () => { - beforeEach(done => { + beforeEach((done) => { const f = file('file name'); f.changed = true; vm.fileList.push(f); diff --git a/spec/frontend/ide/components/commit_sidebar/message_field_spec.js b/spec/frontend/ide/components/commit_sidebar/message_field_spec.js index d6ea8b9a4bd..1514fbc2c3b 100644 --- a/spec/frontend/ide/components/commit_sidebar/message_field_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/message_field_spec.js @@ -23,7 +23,7 @@ describe('IDE commit message field', () => { vm.$destroy(); }); - it('adds is-focused class on focus', done => { + it('adds is-focused class on focus', (done) => { vm.$el.querySelector('textarea').focus(); vm.$nextTick(() => { @@ -33,7 +33,7 @@ describe('IDE commit message field', () => { }); }); - it('removed is-focused class on blur', done => { + it('removed is-focused class on blur', (done) => { vm.$el.querySelector('textarea').focus(); vm.$nextTick() @@ -66,7 +66,7 @@ describe('IDE commit message field', () => { describe('highlights', () => { describe('subject line', () => { - it('does not highlight less than 50 characters', done => { + it('does not highlight less than 50 characters', (done) => { vm.text = 'text less than 50 chars'; vm.$nextTick() @@ -81,7 +81,7 @@ describe('IDE commit message field', () => { .catch(done.fail); }); - it('highlights characters over 50 length', done => { + it('highlights characters over 50 length', (done) => { vm.text = 'text less than 50 chars that should not highlighted. text more than 50 should be highlighted'; @@ -102,7 +102,7 @@ describe('IDE commit message field', () => { }); describe('body text', () => { - it('does not highlight body text less tan 72 characters', done => { + it('does not highlight body text less tan 72 characters', (done) => { vm.text = 'subject line\nbody content'; vm.$nextTick() @@ -114,7 +114,7 @@ describe('IDE commit message field', () => { .catch(done.fail); }); - it('highlights body text more than 72 characters', done => { + it('highlights body text more than 72 characters', (done) => { vm.text = 'subject line\nbody content that will be highlighted when it is more than 72 characters in length'; @@ -128,7 +128,7 @@ describe('IDE commit message field', () => { .catch(done.fail); }); - it('highlights body text & subject line', done => { + it('highlights body text & subject line', (done) => { vm.text = 'text less than 50 chars that should not highlighted\nbody content that will be highlighted when it is more than 72 characters in length'; @@ -147,7 +147,7 @@ describe('IDE commit message field', () => { }); describe('scrolling textarea', () => { - it('updates transform of highlights', done => { + it('updates transform of highlights', (done) => { vm.text = 'subject line\n\n\n\n\n\n\n\n\n\n\nbody content'; vm.$nextTick() diff --git a/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js b/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js index 7cbf5ebc61a..50da64abbbe 100644 --- a/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js @@ -17,7 +17,7 @@ describe('create new MR checkbox', () => { ] = { foo: 'bar' }; }; - const setPermissions = permissions => { + const setPermissions = (permissions) => { store.state.projects[store.state.currentProjectId].userPermissions = permissions; }; @@ -33,7 +33,7 @@ describe('create new MR checkbox', () => { vm.$store.state.currentBranchId = currentBranchId; store.state.projects.abcproject.branches[currentBranchId] = branches.find( - branch => branch.name === currentBranchId, + (branch) => branch.name === currentBranchId, ); return vm.$mount(); @@ -69,7 +69,7 @@ describe('create new MR checkbox', () => { expect(vm.$el.textContent).not.toBe(''); }); - it('has new MR', done => { + it('has new MR', (done) => { setMR(); vm.$nextTick() @@ -93,7 +93,7 @@ describe('create new MR checkbox', () => { expect(vm.$el.textContent).toBe(''); }); - it('has new MR', done => { + it('has new MR', (done) => { setMR(); vm.$nextTick() @@ -118,7 +118,7 @@ describe('create new MR checkbox', () => { expect(vm.$el.textContent).not.toBe(''); }); - it('is rendered if MR exists', done => { + it('is rendered if MR exists', (done) => { setMR(); vm.$nextTick() @@ -141,7 +141,7 @@ describe('create new MR checkbox', () => { expect(vm.$el.textContent).not.toBe(''); }); - it('is hidden if MR exists', done => { + it('is hidden if MR exists', (done) => { setMR(); vm.$nextTick() @@ -165,7 +165,7 @@ describe('create new MR checkbox', () => { expect(vm.$el.textContent).not.toBe(''); }); - it('is hidden if MR exists', done => { + it('is hidden if MR exists', (done) => { setMR(); vm.$nextTick() diff --git a/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js b/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js index bf61f4bbe77..73d811f99b8 100644 --- a/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/radio_group_spec.js @@ -7,7 +7,7 @@ describe('IDE commit sidebar radio group', () => { let vm; let store; - beforeEach(done => { + beforeEach((done) => { store = createStore(); const Component = Vue.extend(radioGroup); @@ -33,7 +33,7 @@ describe('IDE commit sidebar radio group', () => { expect(vm.$el.textContent).toContain('test'); }); - it('uses slot if label is not present', done => { + it('uses slot if label is not present', (done) => { vm.$destroy(); vm = new Vue({ @@ -41,7 +41,7 @@ describe('IDE commit sidebar radio group', () => { radioGroup, }, store, - render: createElement => + render: (createElement) => createElement('radio-group', { props: { value: '1' } }, 'Testing slot'), }); @@ -54,7 +54,7 @@ describe('IDE commit sidebar radio group', () => { }); }); - it('updates store when changing radio button', done => { + it('updates store when changing radio button', (done) => { vm.$el.querySelector('input').dispatchEvent(new Event('change')); Vue.nextTick(() => { @@ -65,7 +65,7 @@ describe('IDE commit sidebar radio group', () => { }); describe('with input', () => { - beforeEach(done => { + beforeEach((done) => { vm.$destroy(); const Component = Vue.extend(radioGroup); @@ -89,7 +89,7 @@ describe('IDE commit sidebar radio group', () => { expect(vm.$el.querySelector('.form-control')).not.toBeNull(); }); - it('hides input when commitAction doesnt match value', done => { + it('hides input when commitAction doesnt match value', (done) => { store.state.commit.commitAction = '2'; Vue.nextTick(() => { @@ -98,7 +98,7 @@ describe('IDE commit sidebar radio group', () => { }); }); - it('updates branch name in store on input', done => { + it('updates branch name in store on input', (done) => { const input = vm.$el.querySelector('.form-control'); input.value = 'testing-123'; input.dispatchEvent(new Event('input')); diff --git a/spec/frontend/ide/components/commit_sidebar/success_message_spec.js b/spec/frontend/ide/components/commit_sidebar/success_message_spec.js index db13c90fbb9..48c07b4557c 100644 --- a/spec/frontend/ide/components/commit_sidebar/success_message_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/success_message_spec.js @@ -23,7 +23,7 @@ describe('IDE commit panel successful commit state', () => { vm.$destroy(); }); - it('renders last commit message when it exists', done => { + it('renders last commit message when it exists', (done) => { vm.$store.state.lastCommitMsg = 'testing commit message'; Vue.nextTick(() => { diff --git a/spec/frontend/ide/components/error_message_spec.js b/spec/frontend/ide/components/error_message_spec.js index 8b7e7da3b51..fa6816d3546 100644 --- a/spec/frontend/ide/components/error_message_spec.js +++ b/spec/frontend/ide/components/error_message_spec.js @@ -10,7 +10,7 @@ describe('IDE error message component', () => { let wrapper; const setErrorMessageMock = jest.fn(); - const createComponent = messageProps => { + const createComponent = (messageProps) => { const fakeStore = new Vuex.Store({ actions: { setErrorMessage: setErrorMessageMock }, }); @@ -103,7 +103,7 @@ describe('IDE error message component', () => { let resolveAction; actionMock.mockImplementation( () => - new Promise(resolve => { + new Promise((resolve) => { resolveAction = resolve; }), ); diff --git a/spec/frontend/ide/components/file_row_extra_spec.js b/spec/frontend/ide/components/file_row_extra_spec.js index b6ad801d589..275b98bc154 100644 --- a/spec/frontend/ide/components/file_row_extra_spec.js +++ b/spec/frontend/ide/components/file_row_extra_spec.js @@ -70,7 +70,7 @@ describe('IDE extra file row component', () => { expect(vm.$el.querySelector('.ide-tree-changes')).toBe(null); }); - it('does not show when tree is open', done => { + it('does not show when tree is open', (done) => { vm.file.type = 'tree'; vm.file.opened = true; changesCount = 1; @@ -82,7 +82,7 @@ describe('IDE extra file row component', () => { }); }); - it('shows for trees with changes', done => { + it('shows for trees with changes', (done) => { vm.file.type = 'tree'; vm.file.opened = false; changesCount = 1; @@ -100,7 +100,7 @@ describe('IDE extra file row component', () => { expect(vm.$el.querySelector('.file-changed-icon')).toBe(null); }); - it('shows when file is changed', done => { + it('shows when file is changed', (done) => { vm.file.changed = true; vm.$nextTick(() => { @@ -110,7 +110,7 @@ describe('IDE extra file row component', () => { }); }); - it('shows when file is staged', done => { + it('shows when file is staged', (done) => { vm.file.staged = true; vm.$nextTick(() => { @@ -120,7 +120,7 @@ describe('IDE extra file row component', () => { }); }); - it('shows when file is a tempFile', done => { + it('shows when file is a tempFile', (done) => { vm.file.tempFile = true; vm.$nextTick(() => { @@ -130,7 +130,7 @@ describe('IDE extra file row component', () => { }); }); - it('shows when file is renamed', done => { + it('shows when file is renamed', (done) => { vm.file.prevPath = 'original-file'; vm.$nextTick(() => { @@ -140,7 +140,7 @@ describe('IDE extra file row component', () => { }); }); - it('hides when file is renamed', done => { + it('hides when file is renamed', (done) => { vm.file.prevPath = 'original-file'; vm.file.type = 'tree'; @@ -157,7 +157,7 @@ describe('IDE extra file row component', () => { expect(vm.$el.querySelector('[data-testid="git-merge-icon"]')).toBe(null); }); - it('shows when a merge request change', done => { + it('shows when a merge request change', (done) => { vm.file.mrChange = true; vm.$nextTick(() => { diff --git a/spec/frontend/ide/components/file_templates/bar_spec.js b/spec/frontend/ide/components/file_templates/bar_spec.js index 75bc9ca73ea..158995c9c9c 100644 --- a/spec/frontend/ide/components/file_templates/bar_spec.js +++ b/spec/frontend/ide/components/file_templates/bar_spec.js @@ -46,7 +46,7 @@ describe('IDE file templates bar component', () => { }); describe('template dropdown', () => { - beforeEach(done => { + beforeEach((done) => { vm.$store.state.fileTemplates.templates = [ { name: 'test', @@ -75,7 +75,7 @@ describe('IDE file templates bar component', () => { }); }); - it('shows undo button if updateSuccess is true', done => { + it('shows undo button if updateSuccess is true', (done) => { vm.$store.state.fileTemplates.updateSuccess = true; vm.$nextTick(() => { @@ -93,7 +93,7 @@ describe('IDE file templates bar component', () => { expect(vm.undoFileTemplate).toHaveBeenCalled(); }); - it('calls setSelectedTemplateType if activeFile name matches a template', done => { + it('calls setSelectedTemplateType if activeFile name matches a template', (done) => { const fileName = '.gitlab-ci.yml'; jest.spyOn(vm, 'setSelectedTemplateType').mockImplementation(() => {}); diff --git a/spec/frontend/ide/components/file_templates/dropdown_spec.js b/spec/frontend/ide/components/file_templates/dropdown_spec.js index 3cffbc3362f..628580103a4 100644 --- a/spec/frontend/ide/components/file_templates/dropdown_spec.js +++ b/spec/frontend/ide/components/file_templates/dropdown_spec.js @@ -109,7 +109,7 @@ describe('IDE file templates dropdown component', () => { }); const items = findItemButtons(); - expect(items.wrappers.map(x => x.text())).toEqual(templates.map(x => x.name)); + expect(items.wrappers.map((x) => x.text())).toEqual(templates.map((x) => x.name)); }); it('searches template data', () => { @@ -124,7 +124,7 @@ describe('IDE file templates dropdown component', () => { const items = findItemButtons(); expect(items.length).toBe(matches.length); - expect(items.wrappers.map(x => x.text())).toEqual(matches); + expect(items.wrappers.map((x) => x.text())).toEqual(matches); }); }); @@ -151,7 +151,7 @@ describe('IDE file templates dropdown component', () => { const items = findItemButtons(); expect(items.length).toBe(data.length); - expect(items.wrappers.map(x => x.text())).toEqual(data.map(x => x.name)); + expect(items.wrappers.map((x) => x.text())).toEqual(data.map((x) => x.name)); }); it('renders input when `searchable` is true', () => { @@ -169,7 +169,7 @@ describe('IDE file templates dropdown component', () => { const items = findItemButtons(); expect(items.length).toBe(matches.length); - expect(items.wrappers.map(x => x.text())).toEqual(matches); + expect(items.wrappers.map((x) => x.text())).toEqual(matches); }); }); }); diff --git a/spec/frontend/ide/components/ide_sidebar_nav_spec.js b/spec/frontend/ide/components/ide_sidebar_nav_spec.js index 502d64fb86b..6b4cb9bd03d 100644 --- a/spec/frontend/ide/components/ide_sidebar_nav_spec.js +++ b/spec/frontend/ide/components/ide_sidebar_nav_spec.js @@ -48,7 +48,7 @@ describe('ide/components/ide_sidebar_nav', () => { const findButtons = () => wrapper.findAll('li button'); const findButtonsData = () => - findButtons().wrappers.map(button => { + findButtons().wrappers.map((button) => { return { title: button.attributes('title'), ariaLabel: button.attributes('aria-label'), diff --git a/spec/frontend/ide/components/ide_spec.js b/spec/frontend/ide/components/ide_spec.js index 315298eaf26..805fa898611 100644 --- a/spec/frontend/ide/components/ide_spec.js +++ b/spec/frontend/ide/components/ide_spec.js @@ -25,7 +25,7 @@ describe('WebIDE', () => { tree: [], loading: false, }; - Object.keys(state).forEach(key => { + Object.keys(state).forEach((key) => { store.state[key] = state[key]; }); diff --git a/spec/frontend/ide/components/ide_status_bar_spec.js b/spec/frontend/ide/components/ide_status_bar_spec.js index bc8144f544c..cca1264cd59 100644 --- a/spec/frontend/ide/components/ide_status_bar_spec.js +++ b/spec/frontend/ide/components/ide_status_bar_spec.js @@ -73,7 +73,7 @@ describe('ideStatusBar', () => { }); describe('pipeline status', () => { - it('opens right sidebar on clicking icon', done => { + it('opens right sidebar on clicking icon', (done) => { jest.spyOn(vm, 'openRightPane').mockImplementation(() => {}); Vue.set(vm.$store.state.pipelines, 'latestPipeline', { details: { diff --git a/spec/frontend/ide/components/ide_status_mr_spec.js b/spec/frontend/ide/components/ide_status_mr_spec.js index 4d9ad61201d..ac1be4b21c0 100644 --- a/spec/frontend/ide/components/ide_status_mr_spec.js +++ b/spec/frontend/ide/components/ide_status_mr_spec.js @@ -9,7 +9,7 @@ const TEST_URL = `${TEST_HOST}merge-requests/9001`; describe('ide/components/ide_status_mr', () => { let wrapper; - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(IdeStatusMr, { propsData: props, }); diff --git a/spec/frontend/ide/components/ide_tree_list_spec.js b/spec/frontend/ide/components/ide_tree_list_spec.js index dd57a5c5f4d..bee556511ae 100644 --- a/spec/frontend/ide/components/ide_tree_list_spec.js +++ b/spec/frontend/ide/components/ide_tree_list_spec.js @@ -41,7 +41,7 @@ describe('IDE tree list', () => { vm.$mount(); }); - it('renders loading indicator', done => { + it('renders loading indicator', (done) => { store.state.trees['abcproject/master'].loading = true; vm.$nextTick(() => { diff --git a/spec/frontend/ide/components/jobs/detail/scroll_button_spec.js b/spec/frontend/ide/components/jobs/detail/scroll_button_spec.js index 57174181a3d..b323ad8320c 100644 --- a/spec/frontend/ide/components/jobs/detail/scroll_button_spec.js +++ b/spec/frontend/ide/components/jobs/detail/scroll_button_spec.js @@ -5,7 +5,7 @@ import ScrollButton from '~/ide/components/jobs/detail/scroll_button.vue'; describe('IDE job log scroll button', () => { let wrapper; - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(ScrollButton, { propsData: { direction: 'up', diff --git a/spec/frontend/ide/components/jobs/detail_spec.js b/spec/frontend/ide/components/jobs/detail_spec.js index 496d8284fdd..067fbbfaf39 100644 --- a/spec/frontend/ide/components/jobs/detail_spec.js +++ b/spec/frontend/ide/components/jobs/detail_spec.js @@ -48,7 +48,7 @@ describe('IDE jobs detail view', () => { expect(vm.$el.querySelector('.bash').textContent).toContain('testing'); }); - it('renders empty message output', done => { + it('renders empty message output', (done) => { vm.$store.state.pipelines.detailJob.output = ''; vm.$nextTick(() => { @@ -68,7 +68,7 @@ describe('IDE jobs detail view', () => { expect(vm.$el.querySelector('.bash').style.display).toBe('none'); }); - it('hide loading icon when isLoading is false', done => { + it('hide loading icon when isLoading is false', (done) => { vm.$store.state.pipelines.detailJob.isLoading = false; vm.$nextTick(() => { diff --git a/spec/frontend/ide/components/jobs/item_spec.js b/spec/frontend/ide/components/jobs/item_spec.js index 93c01640b54..9742763d38f 100644 --- a/spec/frontend/ide/components/jobs/item_spec.js +++ b/spec/frontend/ide/components/jobs/item_spec.js @@ -27,7 +27,7 @@ describe('IDE jobs item', () => { expect(vm.$el.querySelector('[data-testid="status_success_borderless-icon"]')).not.toBe(null); }); - it('does not render view logs button if not started', done => { + it('does not render view logs button if not started', (done) => { vm.job.started = false; vm.$nextTick(() => { diff --git a/spec/frontend/ide/components/jobs/list_spec.js b/spec/frontend/ide/components/jobs/list_spec.js index e821a585e18..5c5c6602374 100644 --- a/spec/frontend/ide/components/jobs/list_spec.js +++ b/spec/frontend/ide/components/jobs/list_spec.js @@ -36,7 +36,7 @@ describe('IDE stages list', () => { status: { icon: 'status_success' }, })); - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(StageList, { propsData: { ...defaultProps, @@ -48,7 +48,7 @@ describe('IDE stages list', () => { }; afterEach(() => { - Object.values(storeActions).forEach(actionMock => actionMock.mockClear()); + Object.values(storeActions).forEach((actionMock) => actionMock.mockClear()); }); afterAll(() => { diff --git a/spec/frontend/ide/components/jobs/stage_spec.js b/spec/frontend/ide/components/jobs/stage_spec.js index 97d601e0a11..e80215b9d13 100644 --- a/spec/frontend/ide/components/jobs/stage_spec.js +++ b/spec/frontend/ide/components/jobs/stage_spec.js @@ -20,7 +20,7 @@ describe('IDE pipeline stage', () => { const findHeader = () => wrapper.find({ ref: 'cardHeader' }); const findJobList = () => wrapper.find({ ref: 'jobList' }); - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(Stage, { propsData: { ...defaultProps, diff --git a/spec/frontend/ide/components/merge_requests/list_spec.js b/spec/frontend/ide/components/merge_requests/list_spec.js index d1b980156b3..f0ac852fa67 100644 --- a/spec/frontend/ide/components/merge_requests/list_spec.js +++ b/spec/frontend/ide/components/merge_requests/list_spec.js @@ -151,8 +151,8 @@ describe('IDE merge requests list', () => { it('shows search types', () => { const buttons = findSearchTypeButtons(); - expect(buttons.wrappers.map(x => x.text().trim())).toEqual( - wrapper.vm.$options.searchTypes.map(x => x.label), + expect(buttons.wrappers.map((x) => x.text().trim())).toEqual( + wrapper.vm.$options.searchTypes.map((x) => x.label), ); }); diff --git a/spec/frontend/ide/components/nav_dropdown_button_spec.js b/spec/frontend/ide/components/nav_dropdown_button_spec.js index c98aa313f40..a02bfa5c391 100644 --- a/spec/frontend/ide/components/nav_dropdown_button_spec.js +++ b/spec/frontend/ide/components/nav_dropdown_button_spec.js @@ -23,7 +23,7 @@ describe('NavDropdown', () => { vm.$mount(); }; - const findIcon = name => vm.$el.querySelector(`[data-testid="${name}-icon"]`); + const findIcon = (name) => vm.$el.querySelector(`[data-testid="${name}-icon"]`); const findMRIcon = () => findIcon('merge-request'); const findBranchIcon = () => findIcon('branch'); @@ -36,7 +36,7 @@ describe('NavDropdown', () => { expect(trimText(vm.$el.textContent)).toEqual('- -'); }); - it('renders branch name, if state has currentBranchId', done => { + it('renders branch name, if state has currentBranchId', (done) => { vm.$store.state.currentBranchId = TEST_BRANCH_ID; vm.$nextTick() @@ -47,7 +47,7 @@ describe('NavDropdown', () => { .catch(done.fail); }); - it('renders mr id, if state has currentMergeRequestId', done => { + it('renders mr id, if state has currentMergeRequestId', (done) => { vm.$store.state.currentMergeRequestId = TEST_MR_ID; vm.$nextTick() @@ -58,7 +58,7 @@ describe('NavDropdown', () => { .catch(done.fail); }); - it('renders branch and mr, if state has both', done => { + it('renders branch and mr, if state has both', (done) => { vm.$store.state.currentBranchId = TEST_BRANCH_ID; vm.$store.state.currentMergeRequestId = TEST_MR_ID; diff --git a/spec/frontend/ide/components/nav_dropdown_spec.js b/spec/frontend/ide/components/nav_dropdown_spec.js index 2f91ab7af0a..12a1a4c8013 100644 --- a/spec/frontend/ide/components/nav_dropdown_spec.js +++ b/spec/frontend/ide/components/nav_dropdown_spec.js @@ -39,7 +39,7 @@ describe('IDE NavDropdown', () => { }); }; - const findIcon = name => wrapper.find(`[data-testid="${name}-icon"]`); + const findIcon = (name) => wrapper.find(`[data-testid="${name}-icon"]`); const findMRIcon = () => findIcon('merge-request'); const findNavForm = () => wrapper.find('.ide-nav-form'); const showDropdown = () => { @@ -58,7 +58,7 @@ describe('IDE NavDropdown', () => { expect(findNavForm().exists()).toBe(false); }); - it('renders nav form when show.bs.dropdown', done => { + it('renders nav form when show.bs.dropdown', (done) => { showDropdown(); wrapper.vm @@ -70,7 +70,7 @@ describe('IDE NavDropdown', () => { .catch(done.fail); }); - it('destroys nav form when closed', done => { + it('destroys nav form when closed', (done) => { showDropdown(); hideDropdown(); diff --git a/spec/frontend/ide/components/new_dropdown/button_spec.js b/spec/frontend/ide/components/new_dropdown/button_spec.js index 66317296ee9..32fa2babcdb 100644 --- a/spec/frontend/ide/components/new_dropdown/button_spec.js +++ b/spec/frontend/ide/components/new_dropdown/button_spec.js @@ -37,7 +37,7 @@ describe('IDE new entry dropdown button component', () => { expect(vm.$emit).toHaveBeenCalledWith('click'); }); - it('hides label if showLabel is false', done => { + it('hides label if showLabel is false', (done) => { vm.showLabel = false; vm.$nextTick(() => { @@ -52,7 +52,7 @@ describe('IDE new entry dropdown button component', () => { expect(vm.tooltipTitle).toBe(''); }); - it('returns label', done => { + it('returns label', (done) => { vm.showLabel = false; vm.$nextTick(() => { diff --git a/spec/frontend/ide/components/new_dropdown/index_spec.js b/spec/frontend/ide/components/new_dropdown/index_spec.js index c6cebf36de3..793d950b3e0 100644 --- a/spec/frontend/ide/components/new_dropdown/index_spec.js +++ b/spec/frontend/ide/components/new_dropdown/index_spec.js @@ -57,7 +57,7 @@ describe('new dropdown component', () => { }); describe('isOpen', () => { - it('scrolls dropdown into view', done => { + it('scrolls dropdown into view', (done) => { jest.spyOn(vm.$refs.dropdownMenu, 'scrollIntoView').mockImplementation(() => {}); vm.isOpen = true; diff --git a/spec/frontend/ide/components/new_dropdown/modal_spec.js b/spec/frontend/ide/components/new_dropdown/modal_spec.js index ea8ba24c9d0..06434081e39 100644 --- a/spec/frontend/ide/components/new_dropdown/modal_spec.js +++ b/spec/frontend/ide/components/new_dropdown/modal_spec.js @@ -19,7 +19,7 @@ describe('new file modal component', () => { ${'tree'} | ${'Create new directory'} | ${'Create directory'} | ${false} ${'blob'} | ${'Create new file'} | ${'Create file'} | ${true} `('$entryType', ({ entryType, modalTitle, btnTitle, showsFileTemplates }) => { - beforeEach(done => { + beforeEach((done) => { const store = createStore(); vm = createComponentWithStore(Component, store).$mount(); diff --git a/spec/frontend/ide/components/new_dropdown/upload_spec.js b/spec/frontend/ide/components/new_dropdown/upload_spec.js index 5937256112d..7303f81aad0 100644 --- a/spec/frontend/ide/components/new_dropdown/upload_spec.js +++ b/spec/frontend/ide/components/new_dropdown/upload_spec.js @@ -69,8 +69,8 @@ describe('new dropdown upload', () => { jest.spyOn(FileReader.prototype, 'readAsText'); }); - it('calls readAsText and creates file in plain text (without encoding) if the file content is plain text', done => { - const waitForCreate = new Promise(resolve => vm.$on('create', resolve)); + it('calls readAsText and creates file in plain text (without encoding) if the file content is plain text', (done) => { + const waitForCreate = new Promise((resolve) => vm.$on('create', resolve)); vm.createFile(textTarget, textFile); diff --git a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js index bb9ba32a699..571509ae426 100644 --- a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js +++ b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js @@ -15,7 +15,7 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => { const width = 350; const fakeComponentName = 'fake-component'; - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(CollapsibleSidebar, { localVue, store, diff --git a/spec/frontend/ide/components/panes/right_spec.js b/spec/frontend/ide/components/panes/right_spec.js index 203d35ed335..57fd0e49e94 100644 --- a/spec/frontend/ide/components/panes/right_spec.js +++ b/spec/frontend/ide/components/panes/right_spec.js @@ -14,7 +14,7 @@ describe('ide/components/panes/right.vue', () => { let wrapper; let store; - const createComponent = props => { + const createComponent = (props) => { extendStore(store, document.createElement('div')); wrapper = shallowMount(RightPane, { diff --git a/spec/frontend/ide/components/repo_commit_section_spec.js b/spec/frontend/ide/components/repo_commit_section_spec.js index 47e99677a70..6850e3a355a 100644 --- a/spec/frontend/ide/components/repo_commit_section_spec.js +++ b/spec/frontend/ide/components/repo_commit_section_spec.js @@ -32,7 +32,7 @@ describe('RepoCommitSection', () => { }, }; - const files = [file('file1'), file('file2')].map(f => + const files = [file('file1'), file('file2')].map((f) => Object.assign(f, { type: 'blob', content: 'orginal content', @@ -42,7 +42,7 @@ describe('RepoCommitSection', () => { store.state.currentBranch = 'master'; store.state.changedFiles = []; store.state.stagedFiles = [{ ...files[0] }, { ...files[1] }]; - store.state.stagedFiles.forEach(f => + store.state.stagedFiles.forEach((f) => Object.assign(f, { changed: true, staged: true, @@ -50,7 +50,7 @@ describe('RepoCommitSection', () => { }), ); - files.forEach(f => { + files.forEach((f) => { store.state.entries[f.path] = f; }); } @@ -105,9 +105,9 @@ describe('RepoCommitSection', () => { const allFiles = store.state.changedFiles.concat(store.state.stagedFiles); const changedFileNames = wrapper .findAll('.multi-file-commit-list > li') - .wrappers.map(x => x.text().trim()); + .wrappers.map((x) => x.text().trim()); - expect(changedFileNames).toEqual(allFiles.map(x => x.path)); + expect(changedFileNames).toEqual(allFiles.map((x) => x.path)); }); it('does not show empty state', () => { @@ -141,7 +141,7 @@ describe('RepoCommitSection', () => { beforeEach(() => { setupDefaultState(); - store.state.changedFiles = store.state.stagedFiles.map(x => + store.state.changedFiles = store.state.stagedFiles.map((x) => Object.assign(x, { staged: false }), ); store.state.stagedFiles = []; diff --git a/spec/frontend/ide/components/repo_editor_spec.js b/spec/frontend/ide/components/repo_editor_spec.js index 7f80fb56ee0..0eea047d8d6 100644 --- a/spec/frontend/ide/components/repo_editor_spec.js +++ b/spec/frontend/ide/components/repo_editor_spec.js @@ -25,7 +25,7 @@ describe('RepoEditor', () => { let store; const waitForEditorSetup = () => - new Promise(resolve => { + new Promise((resolve) => { vm.$once('editorSetup', resolve); }); @@ -43,7 +43,7 @@ describe('RepoEditor', () => { vm.$mount(); }; - const createOpenFile = path => { + const createOpenFile = (path) => { const origFile = store.state.openFiles[0]; const newFile = { ...origFile, path, key: path, name: 'myfile.txt', content: 'hello world' }; @@ -91,7 +91,7 @@ describe('RepoEditor', () => { }); const findEditor = () => vm.$el.querySelector('.multi-file-editor-holder'); - const changeViewMode = viewMode => + const changeViewMode = (viewMode) => store.dispatch('editor/updateFileEditor', { path: vm.file.path, data: { viewMode } }); describe('default', () => { @@ -119,7 +119,7 @@ describe('RepoEditor', () => { expect(findEditor()).not.toHaveCss({ display: 'none' }); }); - it('renders only an edit tab', done => { + it('renders only an edit tab', (done) => { Vue.nextTick(() => { const tabs = vm.$el.querySelectorAll('.ide-mode-tabs .nav-links li'); @@ -157,7 +157,7 @@ describe('RepoEditor', () => { mock.restore(); }); - it('renders an Edit and a Preview Tab', done => { + it('renders an Edit and a Preview Tab', (done) => { Vue.nextTick(() => { const tabs = vm.$el.querySelectorAll('.ide-mode-tabs .nav-links li'); @@ -169,7 +169,7 @@ describe('RepoEditor', () => { }); }); - it('renders markdown for tempFile', done => { + it('renders markdown for tempFile', (done) => { vm.file.tempFile = true; vm.$nextTick() @@ -202,7 +202,7 @@ describe('RepoEditor', () => { }); describe('when open file is binary and not raw', () => { - beforeEach(done => { + beforeEach((done) => { vm.file.name = 'file.dat'; vm.file.content = '🐱'; // non-ascii binary content jest.spyOn(vm.editor, 'createInstance').mockImplementation(); @@ -227,7 +227,7 @@ describe('RepoEditor', () => { }); describe('createEditorInstance', () => { - it('calls createInstance when viewer is editor', done => { + it('calls createInstance when viewer is editor', (done) => { jest.spyOn(vm.editor, 'createInstance').mockImplementation(); vm.createEditorInstance(); @@ -239,7 +239,7 @@ describe('RepoEditor', () => { }); }); - it('calls createDiffInstance when viewer is diff', done => { + it('calls createDiffInstance when viewer is diff', (done) => { vm.$store.state.viewer = 'diff'; jest.spyOn(vm.editor, 'createDiffInstance').mockImplementation(); @@ -253,7 +253,7 @@ describe('RepoEditor', () => { }); }); - it('calls createDiffInstance when viewer is a merge request diff', done => { + it('calls createDiffInstance when viewer is a merge request diff', (done) => { vm.$store.state.viewer = 'mrdiff'; jest.spyOn(vm.editor, 'createDiffInstance').mockImplementation(); @@ -354,7 +354,7 @@ describe('RepoEditor', () => { jest.spyOn(vm.editor, 'updateDiffView').mockImplementation(); }); - it('calls updateDimensions when panelResizing is false', done => { + it('calls updateDimensions when panelResizing is false', (done) => { vm.$store.state.panelResizing = true; vm.$nextTick() @@ -370,7 +370,7 @@ describe('RepoEditor', () => { .catch(done.fail); }); - it('does not call updateDimensions when panelResizing is true', done => { + it('does not call updateDimensions when panelResizing is true', (done) => { vm.$store.state.panelResizing = true; vm.$nextTick(() => { @@ -381,7 +381,7 @@ describe('RepoEditor', () => { }); }); - it('calls updateDimensions when rightPane is opened', done => { + it('calls updateDimensions when rightPane is opened', (done) => { vm.$store.state.rightPane.isOpen = true; vm.$nextTick(() => { @@ -398,7 +398,7 @@ describe('RepoEditor', () => { expect(vm.$el.querySelector('.nav-links')).not.toBe(null); }); - it('hides tabs in review mode', done => { + it('hides tabs in review mode', (done) => { vm.$store.state.currentActivityView = leftSidebarViews.review.name; vm.$nextTick(() => { @@ -408,7 +408,7 @@ describe('RepoEditor', () => { }); }); - it('hides tabs in commit mode', done => { + it('hides tabs in commit mode', (done) => { vm.$store.state.currentActivityView = leftSidebarViews.commit.name; vm.$nextTick(() => { @@ -420,7 +420,7 @@ describe('RepoEditor', () => { }); describe('when files view mode is preview', () => { - beforeEach(done => { + beforeEach((done) => { jest.spyOn(vm.editor, 'updateDimensions').mockImplementation(); changeViewMode(FILE_VIEW_MODE_PREVIEW); vm.file.name = 'myfile.md'; @@ -452,7 +452,7 @@ describe('RepoEditor', () => { jest.spyOn(vm, 'shouldHideEditor', 'get').mockReturnValue(true); }); - it('does not fetch file information for temp entries', done => { + it('does not fetch file information for temp entries', (done) => { vm.file.tempFile = true; vm.initEditor(); @@ -464,7 +464,7 @@ describe('RepoEditor', () => { .catch(done.fail); }); - it('is being initialised for files without content even if shouldHideEditor is `true`', done => { + it('is being initialised for files without content even if shouldHideEditor is `true`', (done) => { vm.file.content = ''; vm.file.raw = ''; @@ -479,7 +479,7 @@ describe('RepoEditor', () => { .catch(done.fail); }); - it('does not initialize editor for files already with content', done => { + it('does not initialize editor for files already with content', (done) => { vm.file.content = 'foo'; vm.initEditor(); @@ -499,7 +499,7 @@ describe('RepoEditor', () => { jest.spyOn(vm, 'initEditor').mockImplementation(); }); - it('calls removePendingTab when old file is pending', done => { + it('calls removePendingTab when old file is pending', (done) => { jest.spyOn(vm, 'shouldHideEditor', 'get').mockReturnValue(true); jest.spyOn(vm, 'removePendingTab').mockImplementation(); @@ -519,7 +519,7 @@ describe('RepoEditor', () => { .catch(done.fail); }); - it('does not call initEditor if the file did not change', done => { + it('does not call initEditor if the file did not change', (done) => { Vue.set(vm, 'file', vm.file); vm.$nextTick() @@ -530,7 +530,7 @@ describe('RepoEditor', () => { .catch(done.fail); }); - it('calls initEditor when file key is changed', done => { + it('calls initEditor when file key is changed', (done) => { expect(vm.initEditor).not.toHaveBeenCalled(); Vue.set(vm, 'file', { @@ -552,7 +552,7 @@ describe('RepoEditor', () => { vm.getRawFileData.mockRestore(); }); - const createRemoteFile = name => ({ + const createRemoteFile = (name) => ({ ...file(name), tmpFile: false, }); @@ -605,7 +605,7 @@ describe('RepoEditor', () => { }); describe('onPaste', () => { - const setFileName = name => { + const setFileName = (name) => { Vue.set(vm, 'file', { ...vm.file, content: 'hello world\n', @@ -627,8 +627,8 @@ describe('RepoEditor', () => { ); }; - const watchState = watched => - new Promise(resolve => { + const watchState = (watched) => + new Promise((resolve) => { const unwatch = vm.$store.watch(watched, () => { unwatch(); resolve(); @@ -638,7 +638,7 @@ describe('RepoEditor', () => { // Pasting an image does a lot of things like using the FileReader API, // so, waitForPromises isn't very reliable (and causes a flaky spec) // Read more about state.watch: https://vuex.vuejs.org/api/#watch - const waitForFileContentChange = () => watchState(s => s.entries['foo/bar.md'].content); + const waitForFileContentChange = () => watchState((s) => s.entries['foo/bar.md'].content); beforeEach(() => { setFileName('bar.md'); diff --git a/spec/frontend/ide/components/repo_tabs_spec.js b/spec/frontend/ide/components/repo_tabs_spec.js index b251f207853..45a17c37667 100644 --- a/spec/frontend/ide/components/repo_tabs_spec.js +++ b/spec/frontend/ide/components/repo_tabs_spec.js @@ -30,7 +30,7 @@ describe('RepoTabs', () => { wrapper.destroy(); }); - it('renders a list of tabs', done => { + it('renders a list of tabs', (done) => { store.state.openFiles[0].active = true; wrapper.vm.$nextTick(() => { diff --git a/spec/frontend/ide/components/resizable_panel_spec.js b/spec/frontend/ide/components/resizable_panel_spec.js index 7368de0cee7..b1a1212371e 100644 --- a/spec/frontend/ide/components/resizable_panel_spec.js +++ b/spec/frontend/ide/components/resizable_panel_spec.js @@ -38,7 +38,7 @@ describe('~/ide/components/resizable_panel', () => { }; const findResizer = () => wrapper.find(PanelResizer); const findInlineStyle = () => wrapper.element.style.cssText; - const createInlineStyle = width => `width: ${width}px;`; + const createInlineStyle = (width) => `width: ${width}px;`; describe.each` props | showResizer | resizerSide | expectedStyle diff --git a/spec/frontend/ide/components/shared/tokened_input_spec.js b/spec/frontend/ide/components/shared/tokened_input_spec.js index e687216bd06..837bfe6b574 100644 --- a/spec/frontend/ide/components/shared/tokened_input_spec.js +++ b/spec/frontend/ide/components/shared/tokened_input_spec.js @@ -44,9 +44,9 @@ describe('IDE shared/TokenedInput', () => { }); it('renders tokens', () => { - const renderedTokens = getTokenElements(vm).map(x => x.textContent.trim()); + const renderedTokens = getTokenElements(vm).map((x) => x.textContent.trim()); - expect(renderedTokens).toEqual(TEST_TOKENS.map(x => x.label)); + expect(renderedTokens).toEqual(TEST_TOKENS.map((x) => x.label)); }); it('renders input', () => { @@ -54,7 +54,7 @@ describe('IDE shared/TokenedInput', () => { expect(vm.$refs.input).toHaveValue(TEST_VALUE); }); - it('renders placeholder, when tokens are empty', done => { + it('renders placeholder, when tokens are empty', (done) => { vm.tokens = []; vm.$nextTick() diff --git a/spec/frontend/ide/components/terminal/session_spec.js b/spec/frontend/ide/components/terminal/session_spec.js index 3ca37166ac4..5653c8bf14d 100644 --- a/spec/frontend/ide/components/terminal/session_spec.js +++ b/spec/frontend/ide/components/terminal/session_spec.js @@ -67,7 +67,7 @@ describe('IDE TerminalSession', () => { }); }); - [STARTING, PENDING, RUNNING].forEach(status => { + [STARTING, PENDING, RUNNING].forEach((status) => { it(`show stop button when status is ${status}`, () => { state.session = { status }; factory(); @@ -82,7 +82,7 @@ describe('IDE TerminalSession', () => { }); }); - [STOPPING, STOPPED].forEach(status => { + [STOPPING, STOPPED].forEach((status) => { it(`show stop button when status is ${status}`, () => { state.session = { status }; factory(); diff --git a/spec/frontend/ide/components/terminal/terminal_controls_spec.js b/spec/frontend/ide/components/terminal/terminal_controls_spec.js index c22063e1d72..99182710218 100644 --- a/spec/frontend/ide/components/terminal/terminal_controls_spec.js +++ b/spec/frontend/ide/components/terminal/terminal_controls_spec.js @@ -17,7 +17,7 @@ describe('IDE TerminalControls', () => { it('shows an up and down scroll button', () => { factory(); - expect(buttons.wrappers.map(x => x.props())).toEqual([ + expect(buttons.wrappers.map((x) => x.props())).toEqual([ expect.objectContaining({ direction: 'up', disabled: true }), expect.objectContaining({ direction: 'down', disabled: true }), ]); diff --git a/spec/frontend/ide/components/terminal/terminal_spec.js b/spec/frontend/ide/components/terminal/terminal_spec.js index 3095288bb28..064bfbf1dcc 100644 --- a/spec/frontend/ide/components/terminal/terminal_spec.js +++ b/spec/frontend/ide/components/terminal/terminal_spec.js @@ -31,7 +31,7 @@ describe('IDE Terminal', () => { let wrapper; let state; - const factory = propsData => { + const factory = (propsData) => { const store = new Vuex.Store({ state, mutations: { @@ -63,7 +63,7 @@ describe('IDE Terminal', () => { }); describe('loading text', () => { - [STARTING, PENDING].forEach(status => { + [STARTING, PENDING].forEach((status) => { it(`shows when starting (${status})`, () => { factory({ status }); @@ -79,7 +79,7 @@ describe('IDE Terminal', () => { expect(wrapper.find('.top-bar').text()).toBe('Stopping...'); }); - [RUNNING, STOPPED].forEach(status => { + [RUNNING, STOPPED].forEach((status) => { it('hides when not loading', () => { factory({ status }); diff --git a/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js b/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js index 9adf5848f9d..d15583f81e4 100644 --- a/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js +++ b/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js @@ -26,7 +26,7 @@ describe('ide/components/terminal_sync/terminal_sync_status', () => { namespaced: true, state: moduleState, mutations: { - [START_LOADING]: state => { + [START_LOADING]: (state) => { state.isLoading = true; }, }, diff --git a/spec/frontend/ide/file_helpers.js b/spec/frontend/ide/file_helpers.js index 326f8b9716d..19604b9d570 100644 --- a/spec/frontend/ide/file_helpers.js +++ b/spec/frontend/ide/file_helpers.js @@ -26,7 +26,7 @@ export const createMovedFile = (path, prevPath, content) => prevPath, }); -export const createEntries = path => +export const createEntries = (path) => path.split('/').reduce((acc, part, idx, parts) => { const parentPath = parts.slice(0, idx).join('/'); const fullPath = parentPath ? `${parentPath}/${part}` : part; diff --git a/spec/frontend/ide/helpers.js b/spec/frontend/ide/helpers.js index 6b65dd96ef4..f9f11d9641c 100644 --- a/spec/frontend/ide/helpers.js +++ b/spec/frontend/ide/helpers.js @@ -12,9 +12,9 @@ export const file = (name = 'name', id = name, type = '', parent = null) => parentPath: parent ? parent.path : '', }); -export const createEntriesFromPaths = paths => +export const createEntriesFromPaths = (paths) => paths - .map(path => ({ + .map((path) => ({ name: pathUtils.basename(path), dir: pathUtils.dirname(path), ext: pathUtils.extname(path), @@ -30,7 +30,7 @@ export const createEntriesFromPaths = paths => }; }, {}); -export const createTriggerChangeAction = payload => ({ +export const createTriggerChangeAction = (payload) => ({ type: 'triggerFilesChange', ...(payload ? { payload } : {}), }); diff --git a/spec/frontend/ide/ide_router_extension_spec.js b/spec/frontend/ide/ide_router_extension_spec.js index 3e29ecc4a90..976b127ac83 100644 --- a/spec/frontend/ide/ide_router_extension_spec.js +++ b/spec/frontend/ide/ide_router_extension_spec.js @@ -4,7 +4,7 @@ import IdeRouter from '~/ide/ide_router_extension'; jest.mock('vue-router'); describe('IDE overrides of VueRouter', () => { - const paths = branch => [ + const paths = (branch) => [ `${branch}`, `/${branch}`, `/${branch}/-/`, @@ -35,7 +35,7 @@ describe('IDE overrides of VueRouter', () => { ${'test-#-hash'} | ${'test-%23-hash'} ${'test/hash#123'} | ${'test/hash%23123'} `('finds project path when route is $path', ({ path, expected }) => { - paths(path).forEach(route => { + paths(path).forEach((route) => { const expectedPath = route.replace(path, expected); router.push(route); diff --git a/spec/frontend/ide/ide_router_spec.js b/spec/frontend/ide/ide_router_spec.js index a4fe00883cf..acab2c6aeef 100644 --- a/spec/frontend/ide/ide_router_spec.js +++ b/spec/frontend/ide/ide_router_spec.js @@ -32,7 +32,7 @@ describe('IDE router', () => { `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/blob`, `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/edit`, `/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}`, - ].forEach(route => { + ].forEach((route) => { it(`finds project path when route is "${route}"`, () => { router.push(route); diff --git a/spec/frontend/ide/lib/common/model_spec.js b/spec/frontend/ide/lib/common/model_spec.js index df46b7774b0..51df1e2e42f 100644 --- a/spec/frontend/ide/lib/common/model_spec.js +++ b/spec/frontend/ide/lib/common/model_spec.js @@ -81,7 +81,7 @@ describe('Multi-file editor library model', () => { }); describe('onChange', () => { - it('calls callback on change', done => { + it('calls callback on change', (done) => { const spy = jest.fn(); model.onChange(spy); diff --git a/spec/frontend/ide/lib/create_diff_spec.js b/spec/frontend/ide/lib/create_diff_spec.js index 273f9ee27bd..76494f9af1b 100644 --- a/spec/frontend/ide/lib/create_diff_spec.js +++ b/spec/frontend/ide/lib/create_diff_spec.js @@ -145,12 +145,12 @@ new file mode 100644 --- /dev/null +++ b/${PATH_LOREM} @@ -0,0 +1,${LINES.length} @@ -${LINES.map(line => `+${line}`).join('\n')} +${LINES.map((line) => `+${line}`).join('\n')} diff --git "a/${PATH_IPSUM}" "b/${PATH_IPSUM}" --- a/${PATH_IPSUM} +++ b/${PATH_IPSUM} @@ -1,${LINES.length} +1,1 @@ -${LINES.map(line => `-${line}`).join('\n')} +${LINES.map((line) => `-${line}`).join('\n')} +That's all folks! \\ No newline at end of file `; @@ -167,10 +167,10 @@ ${LINES.map(line => `-${line}`).join('\n')} const deletedFiles = ['foo/bar/zed/test.md', 'foo/bar/zed/test2.md']; const entries = deletedFiles.reduce((acc, path) => Object.assign(acc, createEntries(path)), {}); const allDeleted = [...deletedFiles, 'foo/bar/zed', 'foo/bar']; - allDeleted.forEach(path => { + allDeleted.forEach((path) => { entries[path].deleted = true; }); - const changedFiles = deletedFiles.map(x => entries[x]); + const changedFiles = deletedFiles.map((x) => entries[x]); const result = createDiff({ changedFiles, entries }); diff --git a/spec/frontend/ide/lib/create_file_diff_spec.js b/spec/frontend/ide/lib/create_file_diff_spec.js index 0e1f8a8c541..294f0a926aa 100644 --- a/spec/frontend/ide/lib/create_file_diff_spec.js +++ b/spec/frontend/ide/lib/create_file_diff_spec.js @@ -51,7 +51,7 @@ describe('IDE lib/create_file_diff', () => { const expectedHead = `diff --git "a/${PATH}" "b/${PATH}" new file mode 100644`; - const expectedChunkHead = lineCount => `--- /dev/null + const expectedChunkHead = (lineCount) => `--- /dev/null +++ b/${PATH} @@ -0,0 +1,${lineCount} @@`; @@ -86,7 +86,7 @@ ${expectedChunkHead(1)} expect(result).toBe(`${expectedHead} ${expectedChunkHead(TEXT_LINE_COUNT)} -${mapLines(TEXT, line => `+${line}`)} +${mapLines(TEXT, (line) => `+${line}`)} `); }); }); @@ -95,7 +95,7 @@ ${mapLines(TEXT, line => `+${line}`)} const expectedHead = `diff --git "a/${PATH}" "b/${PATH}" deleted file mode 100644`; - const expectedChunkHead = lineCount => `--- a/${PATH} + const expectedChunkHead = (lineCount) => `--- a/${PATH} +++ /dev/null @@ -1,${lineCount} +0,0 @@`; @@ -111,7 +111,7 @@ deleted file mode 100644`; expect(result).toBe(`${expectedHead} ${expectedChunkHead(TEXT_LINE_COUNT)} -${mapLines(TEXT, line => `-${line}`)} +${mapLines(TEXT, (line) => `-${line}`)} `); }); }); diff --git a/spec/frontend/ide/lib/diff/controller_spec.js b/spec/frontend/ide/lib/diff/controller_spec.js index 8ee6388a760..57c134620c0 100644 --- a/spec/frontend/ide/lib/diff/controller_spec.js +++ b/spec/frontend/ide/lib/diff/controller_spec.js @@ -37,7 +37,7 @@ describe('Multi-file editor library dirty diff controller', () => { }); describe('getDiffChangeType', () => { - ['added', 'removed', 'modified'].forEach(type => { + ['added', 'removed', 'modified'].forEach((type) => { it(`returns ${type}`, () => { const change = { [type]: true, @@ -49,7 +49,7 @@ describe('Multi-file editor library dirty diff controller', () => { }); describe('getDecorator', () => { - ['added', 'removed', 'modified'].forEach(type => { + ['added', 'removed', 'modified'].forEach((type) => { it(`returns with linesDecorationsClassName for ${type}`, () => { const change = { [type]: true, diff --git a/spec/frontend/ide/lib/editor_spec.js b/spec/frontend/ide/lib/editor_spec.js index 01c2eab33a5..12779c61dc3 100644 --- a/spec/frontend/ide/lib/editor_spec.js +++ b/spec/frontend/ide/lib/editor_spec.js @@ -15,7 +15,7 @@ describe('Multi-file editor library', () => { let holder; let store; - const setNodeOffsetWidth = val => { + const setNodeOffsetWidth = (val) => { Object.defineProperty(instance.instance.getDomNode(), 'offsetWidth', { get() { return val; diff --git a/spec/frontend/ide/lib/editorconfig/parser_spec.js b/spec/frontend/ide/lib/editorconfig/parser_spec.js index f99410236e1..c2b4a8e6c49 100644 --- a/spec/frontend/ide/lib/editorconfig/parser_spec.js +++ b/spec/frontend/ide/lib/editorconfig/parser_spec.js @@ -2,14 +2,14 @@ import { getRulesWithTraversal } from '~/ide/lib/editorconfig/parser'; import { exampleConfigs, exampleFiles } from './mock_data'; describe('~/ide/lib/editorconfig/parser', () => { - const getExampleConfigContent = path => - Promise.resolve(exampleConfigs.find(x => x.path === path)?.content); + const getExampleConfigContent = (path) => + Promise.resolve(exampleConfigs.find((x) => x.path === path)?.content); describe('getRulesWithTraversal', () => { it.each(exampleFiles)( 'traverses through all editorconfig files in parent directories (until root=true is hit) and finds rules for this file (case %#)', ({ path, rules }) => { - return getRulesWithTraversal(path, getExampleConfigContent).then(result => { + return getRulesWithTraversal(path, getExampleConfigContent).then((result) => { expect(result).toEqual(rules); }); }, diff --git a/spec/frontend/ide/lib/errors_spec.js b/spec/frontend/ide/lib/errors_spec.js index 733d5a5da3c..2e4acdb8a63 100644 --- a/spec/frontend/ide/lib/errors_spec.js +++ b/spec/frontend/ide/lib/errors_spec.js @@ -14,7 +14,7 @@ const CODEOWNERS_MESSAGE = const CHANGED_MESSAGE = 'Things changed since you started editing'; describe('~/ide/lib/errors', () => { - const createResponseError = message => ({ + const createResponseError = (message) => ({ response: { data: { message, diff --git a/spec/frontend/ide/lib/files_spec.js b/spec/frontend/ide/lib/files_spec.js index 728b450fb10..50738af0e33 100644 --- a/spec/frontend/ide/lib/files_spec.js +++ b/spec/frontend/ide/lib/files_spec.js @@ -3,7 +3,7 @@ import { decorateData } from '~/ide/stores/utils'; const TEST_BLOB_DATA = { mimeType: 'test/mime' }; -const createEntries = paths => { +const createEntries = (paths) => { const createEntry = (acc, { path, type, children }) => { const { name, parent } = splitParent(path); @@ -15,7 +15,7 @@ const createEntries = paths => { type, parentPath: parent, }), - tree: children.map(childName => expect.objectContaining({ name: childName })), + tree: children.map((childName) => expect.objectContaining({ name: childName })), ...(type === 'blob' ? TEST_BLOB_DATA : {}), }; @@ -53,7 +53,7 @@ describe('IDE lib decorate files', () => { const entryKeys = Object.keys(entries); expect(entryKeys).toEqual(Object.keys(expectedEntries)); - entryKeys.forEach(key => { + entryKeys.forEach((key) => { expect(entries[key]).toEqual(expectedEntries[key]); }); diff --git a/spec/frontend/ide/lib/mirror_spec.js b/spec/frontend/ide/lib/mirror_spec.js index 21bed5948f3..8f417ea54dc 100644 --- a/spec/frontend/ide/lib/mirror_spec.js +++ b/spec/frontend/ide/lib/mirror_spec.js @@ -72,7 +72,7 @@ describe('ide/lib/mirror', () => { }); const waitForConnection = (delay = SERVICE_DELAY) => { - const wait = new Promise(resolve => { + const wait = new Promise((resolve) => { setTimeout(resolve, 10); }); @@ -82,7 +82,7 @@ describe('ide/lib/mirror', () => { }; const connectPass = () => waitForConnection().then(() => mockWebSocket.onopen()); const connectFail = () => waitForConnection().then(() => mockWebSocket.onerror()); - const sendResponse = msg => { + const sendResponse = (msg) => { mockWebSocket.onmessage(msg); }; diff --git a/spec/frontend/ide/services/index_spec.js b/spec/frontend/ide/services/index_spec.js index e9bdb9197bb..c3d6182bd78 100644 --- a/spec/frontend/ide/services/index_spec.js +++ b/spec/frontend/ide/services/index_spec.js @@ -51,7 +51,7 @@ describe('IDE services', () => { raw: 'raw content', }; - return services.getRawFileData(file).then(raw => { + return services.getRawFileData(file).then((raw) => { expect(raw).toBe('content'); }); }); @@ -65,7 +65,7 @@ describe('IDE services', () => { raw: 'raw content', }; - return services.getRawFileData(file).then(raw => { + return services.getRawFileData(file).then((raw) => { expect(raw).toBe('raw content'); }); }); @@ -77,7 +77,7 @@ describe('IDE services', () => { raw: 'raw content', }; - return services.getRawFileData(file).then(raw => { + return services.getRawFileData(file).then((raw) => { expect(raw).toBe('raw content'); }); }); @@ -89,7 +89,7 @@ describe('IDE services', () => { raw: '', }; - return services.getRawFileData(file).then(raw => { + return services.getRawFileData(file).then((raw) => { expect(raw).toBe(''); }); }); @@ -116,7 +116,7 @@ describe('IDE services', () => { }); it('sends a request to file.rawPath', () => { - return services.getRawFileData(file).then(raw => { + return services.getRawFileData(file).then((raw) => { expect(axios.get).toHaveBeenCalledWith(file.rawPath, { transformResponse: [expect.any(Function)], }); @@ -127,7 +127,7 @@ describe('IDE services', () => { it('returns arraybuffer for binary files', () => { file.binary = true; - return services.getRawFileData(file).then(raw => { + return services.getRawFileData(file).then((raw) => { expect(axios.get).toHaveBeenCalledWith(file.rawPath, { transformResponse: [expect.any(Function)], responseType: 'arraybuffer', @@ -161,7 +161,7 @@ describe('IDE services', () => { it('gives back file.baseRaw for files with that property present', () => { file.baseRaw = TEST_FILE_CONTENTS; - return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => { + return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => { expect(content).toEqual(TEST_FILE_CONTENTS); }); }); @@ -170,7 +170,7 @@ describe('IDE services', () => { file.tempFile = true; file.baseRaw = TEST_FILE_CONTENTS; - return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => { + return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => { expect(content).toEqual(TEST_FILE_CONTENTS); }); }); @@ -207,7 +207,7 @@ describe('IDE services', () => { }); it('fetches file content', () => - services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => { + services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => { expect(content).toEqual(TEST_FILE_CONTENTS); })); }, @@ -224,7 +224,7 @@ describe('IDE services', () => { Api.project.mockReturnValue(Promise.resolve({ data: { ...projectData } })); query.mockReturnValue(Promise.resolve({ data: { project: gqlProjectData } })); - return services.getProjectData(TEST_NAMESPACE, TEST_PROJECT).then(response => { + return services.getProjectData(TEST_NAMESPACE, TEST_PROJECT).then((response) => { expect(response).toEqual({ data: { ...projectData, ...gqlProjectData } }); expect(Api.project).toHaveBeenCalledWith(TEST_PROJECT_ID); expect(query).toHaveBeenCalledWith({ diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js index 744ac086b5f..a9d0c9b3efa 100644 --- a/spec/frontend/ide/stores/actions/file_spec.js +++ b/spec/frontend/ide/stores/actions/file_spec.js @@ -189,7 +189,7 @@ describe('IDE store file actions', () => { }); describe('call to service', () => { - const callExpectation = serviceCalled => { + const callExpectation = (serviceCalled) => { store.dispatch('getFileData', { path: localFile.path }); if (serviceCalled) { @@ -422,11 +422,11 @@ describe('IDE store file actions', () => { loadingWhenGettingRawData = undefined; loadingWhenGettingBaseRawData = undefined; - jest.spyOn(service, 'getRawFileData').mockImplementation(f => { + jest.spyOn(service, 'getRawFileData').mockImplementation((f) => { loadingWhenGettingRawData = f.loading; return Promise.resolve('raw'); }); - jest.spyOn(service, 'getBaseRawFileData').mockImplementation(f => { + jest.spyOn(service, 'getBaseRawFileData').mockImplementation((f) => { loadingWhenGettingBaseRawData = f.loading; return Promise.resolve('rawBase'); }); @@ -743,7 +743,7 @@ describe('IDE store file actions', () => { }); it('returns true when opened', () => { - return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then(added => { + return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then((added) => { expect(added).toBe(true); }); }); @@ -755,7 +755,7 @@ describe('IDE store file actions', () => { key: `pending-${f.key}`, }); - return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then(added => { + return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then((added) => { expect(added).toBe(false); }); }); diff --git a/spec/frontend/ide/stores/actions/merge_request_spec.js b/spec/frontend/ide/stores/actions/merge_request_spec.js index f7dd6fd47eb..9b17d95ea35 100644 --- a/spec/frontend/ide/stores/actions/merge_request_spec.js +++ b/spec/frontend/ide/stores/actions/merge_request_spec.js @@ -49,7 +49,7 @@ describe('IDE store merge request actions', () => { mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).reply(200, mockData); }); - it('calls getProjectMergeRequests service method', done => { + it('calls getProjectMergeRequests service method', (done) => { store .dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' }) .then(() => { @@ -66,7 +66,7 @@ describe('IDE store merge request actions', () => { .catch(done.fail); }); - it('sets the "Merge Request" Object', done => { + it('sets the "Merge Request" Object', (done) => { store .dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' }) .then(() => { @@ -78,7 +78,7 @@ describe('IDE store merge request actions', () => { .catch(done.fail); }); - it('sets "Current Merge Request" object to the most recent MR', done => { + it('sets "Current Merge Request" object to the most recent MR', (done) => { store .dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' }) .then(() => { @@ -88,7 +88,7 @@ describe('IDE store merge request actions', () => { .catch(done.fail); }); - it('does nothing if user cannot read MRs', done => { + it('does nothing if user cannot read MRs', (done) => { store.state.projects[TEST_PROJECT].userPermissions[PERMISSION_READ_MR] = false; store @@ -108,7 +108,7 @@ describe('IDE store merge request actions', () => { mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).reply(200, []); }); - it('does not fail if there are no merge requests for current branch', done => { + it('does not fail if there are no merge requests for current branch', (done) => { store .dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'foo' }) .then(() => { @@ -126,7 +126,7 @@ describe('IDE store merge request actions', () => { mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).networkError(); }); - it('flashes message, if error', done => { + it('flashes message, if error', (done) => { store .dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' }) .catch(() => { @@ -149,7 +149,7 @@ describe('IDE store merge request actions', () => { .reply(200, { title: 'mergerequest' }); }); - it('calls getProjectMergeRequestData service method', done => { + it('calls getProjectMergeRequestData service method', (done) => { store .dispatch('getMergeRequestData', { projectId: TEST_PROJECT, mergeRequestId: 1 }) .then(() => { @@ -160,7 +160,7 @@ describe('IDE store merge request actions', () => { .catch(done.fail); }); - it('sets the Merge Request Object', done => { + it('sets the Merge Request Object', (done) => { store .dispatch('getMergeRequestData', { projectId: TEST_PROJECT, mergeRequestId: 1 }) .then(() => { @@ -180,7 +180,7 @@ describe('IDE store merge request actions', () => { mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1/).networkError(); }); - it('dispatches error action', done => { + it('dispatches error action', (done) => { const dispatch = jest.fn(); getMergeRequestData( @@ -224,7 +224,7 @@ describe('IDE store merge request actions', () => { .reply(200, { title: 'mergerequest' }); }); - it('calls getProjectMergeRequestChanges service method', done => { + it('calls getProjectMergeRequestChanges service method', (done) => { store .dispatch('getMergeRequestChanges', { projectId: TEST_PROJECT, mergeRequestId: 1 }) .then(() => { @@ -235,7 +235,7 @@ describe('IDE store merge request actions', () => { .catch(done.fail); }); - it('sets the Merge Request Changes Object', done => { + it('sets the Merge Request Changes Object', (done) => { store .dispatch('getMergeRequestChanges', { projectId: TEST_PROJECT, mergeRequestId: 1 }) .then(() => { @@ -253,7 +253,7 @@ describe('IDE store merge request actions', () => { mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1\/changes/).networkError(); }); - it('dispatches error action', done => { + it('dispatches error action', (done) => { const dispatch = jest.fn(); getMergeRequestChanges( @@ -296,7 +296,7 @@ describe('IDE store merge request actions', () => { jest.spyOn(service, 'getProjectMergeRequestVersions'); }); - it('calls getProjectMergeRequestVersions service method', done => { + it('calls getProjectMergeRequestVersions service method', (done) => { store .dispatch('getMergeRequestVersions', { projectId: TEST_PROJECT, mergeRequestId: 1 }) .then(() => { @@ -307,7 +307,7 @@ describe('IDE store merge request actions', () => { .catch(done.fail); }); - it('sets the Merge Request Versions Object', done => { + it('sets the Merge Request Versions Object', (done) => { store .dispatch('getMergeRequestVersions', { projectId: TEST_PROJECT, mergeRequestId: 1 }) .then(() => { @@ -323,7 +323,7 @@ describe('IDE store merge request actions', () => { mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1\/versions/).networkError(); }); - it('dispatches error action', done => { + it('dispatches error action', (done) => { const dispatch = jest.fn(); getMergeRequestVersions( @@ -422,7 +422,7 @@ describe('IDE store merge request actions', () => { ); }); - it('dispatches actions for merge request data', done => { + it('dispatches actions for merge request data', (done) => { openMergeRequest({ state: store.state, dispatch: store.dispatch, getters: mockGetters }, mr) .then(() => { expect(store.dispatch.mock.calls).toEqual([ @@ -451,7 +451,7 @@ describe('IDE store merge request actions', () => { .catch(done.fail); }); - it('updates activity bar view and gets file data, if changes are found', done => { + it('updates activity bar view and gets file data, if changes are found', (done) => { store.state.entries.foo = { type: 'blob', }; @@ -490,7 +490,7 @@ describe('IDE store merge request actions', () => { .catch(done.fail); }); - it('flashes message, if error', done => { + it('flashes message, if error', (done) => { store.dispatch.mockRejectedValue(); openMergeRequest(store, mr) diff --git a/spec/frontend/ide/stores/actions/project_spec.js b/spec/frontend/ide/stores/actions/project_spec.js index ca3687307a9..1244c8af91a 100644 --- a/spec/frontend/ide/stores/actions/project_spec.js +++ b/spec/frontend/ide/stores/actions/project_spec.js @@ -53,7 +53,7 @@ describe('IDE store project actions', () => { }); }); - it('calls the service', done => { + it('calls the service', (done) => { store .dispatch('refreshLastCommitData', { projectId: store.state.currentProjectId, @@ -67,7 +67,7 @@ describe('IDE store project actions', () => { .catch(done.fail); }); - it('commits getBranchData', done => { + it('commits getBranchData', (done) => { testAction( refreshLastCommitData, { @@ -94,7 +94,7 @@ describe('IDE store project actions', () => { }); describe('showBranchNotFoundError', () => { - it('dispatches setErrorMessage', done => { + it('dispatches setErrorMessage', (done) => { testAction( showBranchNotFoundError, 'master', @@ -123,7 +123,7 @@ describe('IDE store project actions', () => { jest.spyOn(api, 'createBranch').mockResolvedValue(); }); - it('calls API', done => { + it('calls API', (done) => { createNewBranchFromDefault( { state: { @@ -148,7 +148,7 @@ describe('IDE store project actions', () => { .catch(done.fail); }); - it('clears error message', done => { + it('clears error message', (done) => { const dispatchSpy = jest.fn().mockName('dispatch'); createNewBranchFromDefault( @@ -172,7 +172,7 @@ describe('IDE store project actions', () => { .catch(done.fail); }); - it('reloads window', done => { + it('reloads window', (done) => { createNewBranchFromDefault( { state: { @@ -196,7 +196,7 @@ describe('IDE store project actions', () => { }); describe('loadEmptyBranch', () => { - it('creates a blank tree and sets loading state to false', done => { + it('creates a blank tree and sets loading state to false', (done) => { testAction( loadEmptyBranch, { projectId: TEST_PROJECT_ID, branchId: 'master' }, @@ -213,7 +213,7 @@ describe('IDE store project actions', () => { ); }); - it('does nothing, if tree already exists', done => { + it('does nothing, if tree already exists', (done) => { const trees = { [`${TEST_PROJECT_ID}/master`]: [] }; testAction( @@ -279,7 +279,7 @@ describe('IDE store project actions', () => { const branchId = '123-lorem'; const ref = 'abcd2322'; - it('when empty repo, loads empty branch', done => { + it('when empty repo, loads empty branch', (done) => { const mockGetters = { emptyRepo: true }; testAction( @@ -292,13 +292,13 @@ describe('IDE store project actions', () => { ); }); - it('when branch already exists, does nothing', done => { + it('when branch already exists, does nothing', (done) => { store.state.projects[projectId].branches[branchId] = {}; testAction(loadBranch, { projectId, branchId }, store.state, [], [], done); }); - it('fetches branch data', done => { + it('fetches branch data', (done) => { const mockGetters = { findBranch: () => ({ commit: { id: ref } }) }; jest.spyOn(store, 'dispatch').mockResolvedValue(); @@ -317,7 +317,7 @@ describe('IDE store project actions', () => { .catch(done.fail); }); - it('shows an error if branch can not be fetched', done => { + it('shows an error if branch can not be fetched', (done) => { jest.spyOn(store, 'dispatch').mockReturnValue(Promise.reject()); loadBranch(store, { projectId, branchId }) @@ -356,7 +356,7 @@ describe('IDE store project actions', () => { jest.spyOn(store, 'dispatch').mockResolvedValue(); }); - it('dispatches branch actions', done => { + it('dispatches branch actions', (done) => { openBranch(store, branch) .then(() => { expect(store.dispatch.mock.calls).toEqual([ @@ -375,9 +375,9 @@ describe('IDE store project actions', () => { jest.spyOn(store, 'dispatch').mockReturnValue(Promise.reject()); }); - it('dispatches correct branch actions', done => { + it('dispatches correct branch actions', (done) => { openBranch(store, branch) - .then(val => { + .then((val) => { expect(store.dispatch.mock.calls).toEqual([ ['setCurrentBranchId', branchId], ['loadBranch', { projectId, branchId }], diff --git a/spec/frontend/ide/stores/actions/tree_spec.js b/spec/frontend/ide/stores/actions/tree_spec.js index 0eabd982d57..ece10d2a602 100644 --- a/spec/frontend/ide/stores/actions/tree_spec.js +++ b/spec/frontend/ide/stores/actions/tree_spec.js @@ -68,7 +68,7 @@ describe('Multi-file store tree actions', () => { ); }); - it('adds data into tree', done => { + it('adds data into tree', (done) => { store .dispatch('getFiles', basicCallParameters) .then(() => { @@ -93,7 +93,7 @@ describe('Multi-file store tree actions', () => { }); describe('error', () => { - it('dispatches error action', done => { + it('dispatches error action', (done) => { const dispatch = jest.fn(); store.state.projects = { @@ -148,7 +148,7 @@ describe('Multi-file store tree actions', () => { store.state.entries[tree.path] = tree; }); - it('toggles the tree open', done => { + it('toggles the tree open', (done) => { store .dispatch('toggleTreeOpen', tree.path) .then(() => { @@ -174,7 +174,7 @@ describe('Multi-file store tree actions', () => { Object.assign(store.state.entries, createEntriesFromPaths(paths)); }); - it('opens the parents', done => { + it('opens the parents', (done) => { testAction( showTreeEntry, 'grandparent/parent/child.txt', @@ -187,7 +187,7 @@ describe('Multi-file store tree actions', () => { }); describe('setDirectoryData', () => { - it('sets tree correctly if there are no opened files yet', done => { + it('sets tree correctly if there are no opened files yet', (done) => { const treeFile = file({ name: 'README.md' }); store.state.trees['abcproject/master'] = {}; diff --git a/spec/frontend/ide/stores/actions_spec.js b/spec/frontend/ide/stores/actions_spec.js index aa7c51665ac..d288f8c1be3 100644 --- a/spec/frontend/ide/stores/actions_spec.js +++ b/spec/frontend/ide/stores/actions_spec.js @@ -42,7 +42,7 @@ describe('Multi-file store actions', () => { }); describe('redirectToUrl', () => { - it('calls visitUrl', done => { + it('calls visitUrl', (done) => { store .dispatch('redirectToUrl', 'test') .then(() => { @@ -55,7 +55,7 @@ describe('Multi-file store actions', () => { }); describe('setInitialData', () => { - it('commits initial data', done => { + it('commits initial data', (done) => { store .dispatch('setInitialData', { canCommit: true }) .then(() => { @@ -70,7 +70,7 @@ describe('Multi-file store actions', () => { const paths = ['to_discard', 'another_one_to_discard']; beforeEach(() => { - paths.forEach(path => { + paths.forEach((path) => { const f = file(path); f.changed = true; @@ -81,14 +81,14 @@ describe('Multi-file store actions', () => { }); it('discards all changes in file', () => { - const expectedCalls = paths.map(path => ['restoreOriginalFile', path]); + const expectedCalls = paths.map((path) => ['restoreOriginalFile', path]); discardAllChanges(store); expect(store.dispatch.mock.calls).toEqual(expect.arrayContaining(expectedCalls)); }); - it('removes all files from changedFiles state', done => { + it('removes all files from changedFiles state', (done) => { store .dispatch('discardAllChanges') .then(() => { @@ -120,7 +120,7 @@ describe('Multi-file store actions', () => { }); describe('tree', () => { - it('creates temp tree', done => { + it('creates temp tree', (done) => { store .dispatch('createTempEntry', { name: 'test', @@ -137,7 +137,7 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - it('creates new folder inside another tree', done => { + it('creates new folder inside another tree', (done) => { const tree = { type: 'tree', name: 'testing', @@ -162,7 +162,7 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - it('does not create new tree if already exists', done => { + it('does not create new tree if already exists', (done) => { const tree = { type: 'tree', path: 'testing', @@ -188,7 +188,7 @@ describe('Multi-file store actions', () => { }); describe('blob', () => { - it('creates temp file', done => { + it('creates temp file', (done) => { const name = 'test'; store @@ -209,7 +209,7 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - it('adds tmp file to open files', done => { + it('adds tmp file to open files', (done) => { const name = 'test'; store @@ -228,7 +228,7 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - it('adds tmp file to staged files', done => { + it('adds tmp file to staged files', (done) => { const name = 'test'; store @@ -250,7 +250,7 @@ describe('Multi-file store actions', () => { expect(store.dispatch).toHaveBeenCalledWith('setFileActive', 'test'); }); - it('creates flash message if file already exists', done => { + it('creates flash message if file already exists', (done) => { const f = file('test', '1', 'blob'); store.state.trees['abcproject/mybranch'].tree = [f]; store.state.entries[f.path] = f; @@ -273,7 +273,7 @@ describe('Multi-file store actions', () => { }); describe('scrollToTab', () => { - it('focuses the current active element', done => { + it('focuses the current active element', (done) => { document.body.innerHTML += '<div id="tabs"><div class="active"><div class="repo-tab"></div></div></div>'; const el = document.querySelector('.repo-tab'); @@ -378,7 +378,7 @@ describe('Multi-file store actions', () => { }); describe('updateViewer', () => { - it('updates viewer state', done => { + it('updates viewer state', (done) => { store .dispatch('updateViewer', 'diff') .then(() => { @@ -390,7 +390,7 @@ describe('Multi-file store actions', () => { }); describe('updateActivityBarView', () => { - it('commits UPDATE_ACTIVITY_BAR_VIEW', done => { + it('commits UPDATE_ACTIVITY_BAR_VIEW', (done) => { testAction( updateActivityBarView, 'test', @@ -403,7 +403,7 @@ describe('Multi-file store actions', () => { }); describe('setEmptyStateSvgs', () => { - it('commits setEmptyStateSvgs', done => { + it('commits setEmptyStateSvgs', (done) => { testAction( setEmptyStateSvgs, 'svg', @@ -416,7 +416,7 @@ describe('Multi-file store actions', () => { }); describe('updateTempFlagForEntry', () => { - it('commits UPDATE_TEMP_FLAG', done => { + it('commits UPDATE_TEMP_FLAG', (done) => { const f = { ...file(), path: 'test', @@ -434,7 +434,7 @@ describe('Multi-file store actions', () => { ); }); - it('commits UPDATE_TEMP_FLAG and dispatches for parent', done => { + it('commits UPDATE_TEMP_FLAG and dispatches for parent', (done) => { const parent = { ...file(), path: 'testing', @@ -457,7 +457,7 @@ describe('Multi-file store actions', () => { ); }); - it('does not dispatch for parent, if parent does not exist', done => { + it('does not dispatch for parent, if parent does not exist', (done) => { const f = { ...file(), path: 'test', @@ -477,7 +477,7 @@ describe('Multi-file store actions', () => { }); describe('setCurrentBranchId', () => { - it('commits setCurrentBranchId', done => { + it('commits setCurrentBranchId', (done) => { testAction( setCurrentBranchId, 'branchId', @@ -490,7 +490,7 @@ describe('Multi-file store actions', () => { }); describe('toggleFileFinder', () => { - it('commits TOGGLE_FILE_FINDER', done => { + it('commits TOGGLE_FILE_FINDER', (done) => { testAction( toggleFileFinder, true, @@ -503,7 +503,7 @@ describe('Multi-file store actions', () => { }); describe('setErrorMessage', () => { - it('commis error messsage', done => { + it('commis error messsage', (done) => { testAction( setErrorMessage, 'error', @@ -516,7 +516,7 @@ describe('Multi-file store actions', () => { }); describe('deleteEntry', () => { - it('commits entry deletion', done => { + it('commits entry deletion', (done) => { store.state.entries.path = 'testing'; testAction( @@ -529,7 +529,7 @@ describe('Multi-file store actions', () => { ); }); - it('does not delete a folder after it is emptied', done => { + it('does not delete a folder after it is emptied', (done) => { const testFolder = { type: 'tree', tree: [], @@ -575,7 +575,7 @@ describe('Multi-file store actions', () => { }); describe('and previous does not exist', () => { - it('reverts the rename before deleting', done => { + it('reverts the rename before deleting', (done) => { testAction( deleteEntry, testEntry.path, @@ -610,7 +610,7 @@ describe('Multi-file store actions', () => { store.state.entries[oldEntry.path] = oldEntry; }); - it('does not revert rename before deleting', done => { + it('does not revert rename before deleting', (done) => { testAction( deleteEntry, testEntry.path, @@ -621,7 +621,7 @@ describe('Multi-file store actions', () => { ); }); - it('when previous is deleted, it reverts rename before deleting', done => { + it('when previous is deleted, it reverts rename before deleting', (done) => { store.state.entries[testEntry.prevPath].deleted = true; testAction( @@ -656,7 +656,7 @@ describe('Multi-file store actions', () => { jest.spyOn(eventHub, '$emit').mockImplementation(); }); - it('does not purge model cache for temporary entries that got renamed', done => { + it('does not purge model cache for temporary entries that got renamed', (done) => { Object.assign(store.state.entries, { test: { ...file('test'), @@ -678,7 +678,7 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - it('purges model cache for renamed entry', done => { + it('purges model cache for renamed entry', (done) => { Object.assign(store.state.entries, { test: { ...file('test'), @@ -737,7 +737,7 @@ describe('Multi-file store actions', () => { ]); }); - it('if not changed, completely unstages and discards entry if renamed to original', done => { + it('if not changed, completely unstages and discards entry if renamed to original', (done) => { testAction( renameEntry, { path: 'renamed', name: 'orig' }, @@ -761,7 +761,7 @@ describe('Multi-file store actions', () => { ); }); - it('if already in changed, does not add to change', done => { + it('if already in changed, does not add to change', (done) => { store.state.changedFiles.push(renamedEntry); testAction( @@ -774,7 +774,7 @@ describe('Multi-file store actions', () => { ); }); - it('routes to the renamed file if the original file has been opened', done => { + it('routes to the renamed file if the original file has been opened', (done) => { store.state.currentProjectId = 'test/test'; store.state.currentBranchId = 'master'; @@ -815,7 +815,7 @@ describe('Multi-file store actions', () => { }); }); - it('updates entries in a folder correctly, when folder is renamed', done => { + it('updates entries in a folder correctly, when folder is renamed', (done) => { store .dispatch('renameEntry', { path: 'folder', @@ -833,7 +833,7 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - it('discards renaming of an entry if the root folder is renamed back to a previous name', done => { + it('discards renaming of an entry if the root folder is renamed back to a previous name', (done) => { const rootFolder = file('old-folder', 'old-folder', 'tree'); const testEntry = file('test', 'test', 'blob', rootFolder); @@ -925,7 +925,7 @@ describe('Multi-file store actions', () => { }); }); - it('creates new directory', done => { + it('creates new directory', (done) => { expect(store.state.entries[newParentPath]).toBeUndefined(); store @@ -955,7 +955,7 @@ describe('Multi-file store actions', () => { rootDir.tree.push(newDir); }); - it('inserts in new directory', done => { + it('inserts in new directory', (done) => { expect(newDir.tree).toEqual([]); store @@ -971,11 +971,11 @@ describe('Multi-file store actions', () => { .catch(done.fail); }); - it('when new directory is deleted, it undeletes it', done => { + it('when new directory is deleted, it undeletes it', (done) => { store.dispatch('deleteEntry', newParentPath); expect(store.state.entries[newParentPath].deleted).toBe(true); - expect(rootDir.tree.some(x => x.path === newParentPath)).toBe(false); + expect(rootDir.tree.some((x) => x.path === newParentPath)).toBe(false); store .dispatch('renameEntry', { @@ -985,7 +985,7 @@ describe('Multi-file store actions', () => { }) .then(() => { expect(store.state.entries[newParentPath].deleted).toBe(false); - expect(rootDir.tree.some(x => x.path === newParentPath)).toBe(true); + expect(rootDir.tree.some((x) => x.path === newParentPath)).toBe(true); }) .then(done) .catch(done.fail); @@ -1029,12 +1029,12 @@ describe('Multi-file store actions', () => { document.querySelector('.flash-container').remove(); }); - it('passes the error further unchanged without dispatching any action when response is 404', done => { + it('passes the error further unchanged without dispatching any action when response is 404', (done) => { mock.onGet(/(.*)/).replyOnce(404); getBranchData(...callParams) .then(done.fail) - .catch(e => { + .catch((e) => { expect(dispatch.mock.calls).toHaveLength(0); expect(e.response.status).toEqual(404); expect(document.querySelector('.flash-alert')).toBeNull(); @@ -1042,12 +1042,12 @@ describe('Multi-file store actions', () => { }); }); - it('does not pass the error further and flashes an alert if error is not 404', done => { + it('does not pass the error further and flashes an alert if error is not 404', (done) => { mock.onGet(/(.*)/).replyOnce(418); getBranchData(...callParams) .then(done.fail) - .catch(e => { + .catch((e) => { expect(dispatch.mock.calls).toHaveLength(0); expect(e.response).toBeUndefined(); expect(document.querySelector('.flash-alert')).not.toBeNull(); diff --git a/spec/frontend/ide/stores/extend_spec.js b/spec/frontend/ide/stores/extend_spec.js index b0f1063153e..ffb00f9ef5b 100644 --- a/spec/frontend/ide/stores/extend_spec.js +++ b/spec/frontend/ide/stores/extend_spec.js @@ -15,7 +15,7 @@ describe('ide/stores/extend', () => { store = {}; el = {}; - [terminalPlugin, terminalSyncPlugin].forEach(x => { + [terminalPlugin, terminalSyncPlugin].forEach((x) => { const plugin = jest.fn(); x.mockImplementation(() => plugin); @@ -28,7 +28,7 @@ describe('ide/stores/extend', () => { terminalSyncPlugin.mockClear(); }); - const withGonFeatures = features => { + const withGonFeatures = (features) => { global.gon = { ...global.gon, features }; }; diff --git a/spec/frontend/ide/stores/getters_spec.js b/spec/frontend/ide/stores/getters_spec.js index 5ae87f5f9cd..1787f9e9361 100644 --- a/spec/frontend/ide/stores/getters_spec.js +++ b/spec/frontend/ide/stores/getters_spec.js @@ -407,7 +407,7 @@ describe('IDE store getters', () => { ${'canCreateMergeRequests'} | ${'createMergeRequestIn'} ${'canPushCode'} | ${'pushCode'} `('$getterName', ({ getterName, permissionKey }) => { - it.each([true, false])('finds permission for current project (%s)', val => { + it.each([true, false])('finds permission for current project (%s)', (val) => { localState.projects[TEST_PROJECT_ID] = { userPermissions: { [permissionKey]: val, diff --git a/spec/frontend/ide/stores/integration_spec.js b/spec/frontend/ide/stores/integration_spec.js index b6a7c7fd02d..388bd3b99d2 100644 --- a/spec/frontend/ide/stores/integration_spec.js +++ b/spec/frontend/ide/stores/integration_spec.js @@ -84,7 +84,7 @@ describe('IDE store integration', () => { store.dispatch('commit/updateFilesAfterCommit', { data: {} }); expect(store.state.entries[TEST_PATH]).toEqual(expected); - expect(store.state.entries[TEST_PATH_DIR].tree.find(x => x.path === TEST_PATH)).toEqual( + expect(store.state.entries[TEST_PATH_DIR].tree.find((x) => x.path === TEST_PATH)).toEqual( expected, ); }); diff --git a/spec/frontend/ide/stores/modules/branches/actions_spec.js b/spec/frontend/ide/stores/modules/branches/actions_spec.js index 2ab4126cccf..b1c077c4082 100644 --- a/spec/frontend/ide/stores/modules/branches/actions_spec.js +++ b/spec/frontend/ide/stores/modules/branches/actions_spec.js @@ -42,7 +42,7 @@ describe('IDE branches actions', () => { }); describe('requestBranches', () => { - it('should commit request', done => { + it('should commit request', (done) => { testAction( requestBranches, null, @@ -55,7 +55,7 @@ describe('IDE branches actions', () => { }); describe('receiveBranchesError', () => { - it('should commit error', done => { + it('should commit error', (done) => { testAction( receiveBranchesError, { search: TEST_SEARCH }, @@ -78,7 +78,7 @@ describe('IDE branches actions', () => { }); describe('receiveBranchesSuccess', () => { - it('should commit received data', done => { + it('should commit received data', (done) => { testAction( receiveBranchesSuccess, branches, @@ -110,7 +110,7 @@ describe('IDE branches actions', () => { }); }); - it('dispatches success with received data', done => { + it('dispatches success with received data', (done) => { testAction( fetchBranches, { search: TEST_SEARCH }, @@ -131,7 +131,7 @@ describe('IDE branches actions', () => { mock.onGet(/\/api\/v4\/projects\/\d+\/repository\/branches(.*)$/).replyOnce(500); }); - it('dispatches error', done => { + it('dispatches error', (done) => { testAction( fetchBranches, { search: TEST_SEARCH }, @@ -148,7 +148,7 @@ describe('IDE branches actions', () => { }); describe('resetBranches', () => { - it('commits reset', done => { + it('commits reset', (done) => { testAction( resetBranches, null, diff --git a/spec/frontend/ide/stores/modules/branches/mutations_spec.js b/spec/frontend/ide/stores/modules/branches/mutations_spec.js index ed8e05bf299..ddf55479be9 100644 --- a/spec/frontend/ide/stores/modules/branches/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/branches/mutations_spec.js @@ -28,7 +28,7 @@ describe('IDE branches mutations', () => { describe('RECEIVE_BRANCHES_SUCCESS', () => { it('sets branches', () => { - const expectedBranches = branches.map(branch => ({ + const expectedBranches = branches.map((branch) => ({ name: branch.name, committedDate: branch.commit.committed_date, })); diff --git a/spec/frontend/ide/stores/modules/clientside/actions_spec.js b/spec/frontend/ide/stores/modules/clientside/actions_spec.js index a47bc0bd711..05627f8ed0e 100644 --- a/spec/frontend/ide/stores/modules/clientside/actions_spec.js +++ b/spec/frontend/ide/stores/modules/clientside/actions_spec.js @@ -25,7 +25,7 @@ describe('IDE store module clientside actions', () => { }); describe('pingUsage', () => { - it('posts to usage endpoint', done => { + it('posts to usage endpoint', (done) => { const usageSpy = jest.fn(() => [200]); mock.onPost(TEST_USAGE_URL).reply(() => usageSpy()); diff --git a/spec/frontend/ide/stores/modules/commit/actions_spec.js b/spec/frontend/ide/stores/modules/commit/actions_spec.js index 899b8f2c7e8..020bcac8c70 100644 --- a/spec/frontend/ide/stores/modules/commit/actions_spec.js +++ b/spec/frontend/ide/stores/modules/commit/actions_spec.js @@ -41,7 +41,7 @@ describe('IDE commit module actions', () => { }); describe('updateCommitMessage', () => { - it('updates store with new commit message', done => { + it('updates store with new commit message', (done) => { store .dispatch('commit/updateCommitMessage', 'testing') .then(() => { @@ -53,7 +53,7 @@ describe('IDE commit module actions', () => { }); describe('discardDraft', () => { - it('resets commit message to blank', done => { + it('resets commit message to blank', (done) => { store.state.commit.commitMessage = 'testing'; store @@ -67,7 +67,7 @@ describe('IDE commit module actions', () => { }); describe('updateCommitAction', () => { - it('updates store with new commit action', done => { + it('updates store with new commit action', (done) => { store .dispatch('commit/updateCommitAction', '1') .then(() => { @@ -123,7 +123,7 @@ describe('IDE commit module actions', () => { }); }); - it('updates commit message with short_id', done => { + it('updates commit message with short_id', (done) => { store .dispatch('commit/setLastCommitMessage', { short_id: '123' }) .then(() => { @@ -135,7 +135,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('updates commit message with stats', done => { + it('updates commit message with stats', (done) => { store .dispatch('commit/setLastCommitMessage', { short_id: '123', @@ -200,12 +200,12 @@ describe('IDE commit module actions', () => { }); store.state.openFiles = store.state.stagedFiles; - store.state.stagedFiles.forEach(stagedFile => { + store.state.stagedFiles.forEach((stagedFile) => { store.state.entries[stagedFile.path] = stagedFile; }); }); - it('updates stores working reference', done => { + it('updates stores working reference', (done) => { store .dispatch('commit/updateFilesAfterCommit', { data, @@ -218,14 +218,14 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('resets all files changed status', done => { + it('resets all files changed status', (done) => { store .dispatch('commit/updateFilesAfterCommit', { data, branch, }) .then(() => { - store.state.openFiles.forEach(entry => { + store.state.openFiles.forEach((entry) => { expect(entry.changed).toBeFalsy(); }); }) @@ -233,7 +233,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('sets files commit data', done => { + it('sets files commit data', (done) => { store .dispatch('commit/updateFilesAfterCommit', { data, @@ -246,7 +246,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('updates raw content for changed file', done => { + it('updates raw content for changed file', (done) => { store .dispatch('commit/updateFilesAfterCommit', { data, @@ -259,7 +259,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('emits changed event for file', done => { + it('emits changed event for file', (done) => { store .dispatch('commit/updateFilesAfterCommit', { data, @@ -319,7 +319,7 @@ describe('IDE commit module actions', () => { store.state.commit.commitAction = '2'; store.state.commit.commitMessage = 'testing 123'; - store.state.openFiles.forEach(localF => { + store.state.openFiles.forEach((localF) => { store.state.entries[localF.path] = localF; }); }); @@ -345,7 +345,7 @@ describe('IDE commit module actions', () => { jest.spyOn(service, 'commit').mockResolvedValue({ data: COMMIT_RESPONSE }); }); - it('calls service', done => { + it('calls service', (done) => { store .dispatch('commit/commitChanges') .then(() => { @@ -370,7 +370,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('sends lastCommit ID when not creating new branch', done => { + it('sends lastCommit ID when not creating new branch', (done) => { store.state.commit.commitAction = '1'; store @@ -397,7 +397,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('sets last Commit Msg', done => { + it('sets last Commit Msg', (done) => { store .dispatch('commit/commitChanges') .then(() => { @@ -410,7 +410,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('adds commit data to files', done => { + it('adds commit data to files', (done) => { store .dispatch('commit/commitChanges') .then(() => { @@ -423,7 +423,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('resets stores commit actions', done => { + it('resets stores commit actions', (done) => { store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH; store @@ -435,7 +435,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('removes all staged files', done => { + it('removes all staged files', (done) => { store .dispatch('commit/commitChanges') .then(() => { @@ -446,7 +446,7 @@ describe('IDE commit module actions', () => { }); describe('merge request', () => { - it('redirects to new merge request page', done => { + it('redirects to new merge request page', (done) => { jest.spyOn(eventHub, '$on').mockImplementation(); store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH; @@ -464,7 +464,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('does not redirect to new merge request page when shouldCreateMR is not checked', done => { + it('does not redirect to new merge request page when shouldCreateMR is not checked', (done) => { jest.spyOn(eventHub, '$on').mockImplementation(); store.state.commit.commitAction = consts.COMMIT_TO_NEW_BRANCH; @@ -510,7 +510,7 @@ describe('IDE commit module actions', () => { }); }); - it('shows failed message', done => { + it('shows failed message', (done) => { store .dispatch('commit/commitChanges') .then(() => { @@ -556,7 +556,7 @@ describe('IDE commit module actions', () => { }, }; - it('commits TOGGLE_EMPTY_STATE mutation on empty repo', done => { + it('commits TOGGLE_EMPTY_STATE mutation on empty repo', (done) => { jest.spyOn(service, 'commit').mockResolvedValue({ data: COMMIT_RESPONSE }); jest.spyOn(store, 'commit'); @@ -573,7 +573,7 @@ describe('IDE commit module actions', () => { .catch(done.fail); }); - it('does not commmit TOGGLE_EMPTY_STATE mutation on existing project', done => { + it('does not commmit TOGGLE_EMPTY_STATE mutation on existing project', (done) => { COMMIT_RESPONSE.parent_ids.push('1234'); jest.spyOn(service, 'commit').mockResolvedValue({ data: COMMIT_RESPONSE }); jest.spyOn(store, 'commit'); @@ -594,7 +594,7 @@ describe('IDE commit module actions', () => { }); describe('toggleShouldCreateMR', () => { - it('commits both toggle and interacting with MR checkbox actions', done => { + it('commits both toggle and interacting with MR checkbox actions', (done) => { testAction( actions.toggleShouldCreateMR, {}, diff --git a/spec/frontend/ide/stores/modules/commit/getters_spec.js b/spec/frontend/ide/stores/modules/commit/getters_spec.js index adbfd7c6835..66ed51dbd13 100644 --- a/spec/frontend/ide/stores/modules/commit/getters_spec.js +++ b/spec/frontend/ide/stores/modules/commit/getters_spec.js @@ -103,7 +103,7 @@ describe('IDE commit module getters', () => { expect(getters.preBuiltCommitMessage(state, null, rootState)).toBe('test commit message'); }); - ['changedFiles', 'stagedFiles'].forEach(key => { + ['changedFiles', 'stagedFiles'].forEach((key) => { it('returns commitMessage with updated file', () => { rootState[key].push({ path: 'test-file', diff --git a/spec/frontend/ide/stores/modules/file_templates/actions_spec.js b/spec/frontend/ide/stores/modules/file_templates/actions_spec.js index 6c1fa163a91..76898e83c7a 100644 --- a/spec/frontend/ide/stores/modules/file_templates/actions_spec.js +++ b/spec/frontend/ide/stores/modules/file_templates/actions_spec.js @@ -20,7 +20,7 @@ describe('IDE file templates actions', () => { }); describe('requestTemplateTypes', () => { - it('commits REQUEST_TEMPLATE_TYPES', done => { + it('commits REQUEST_TEMPLATE_TYPES', (done) => { testAction( actions.requestTemplateTypes, null, @@ -33,7 +33,7 @@ describe('IDE file templates actions', () => { }); describe('receiveTemplateTypesError', () => { - it('commits RECEIVE_TEMPLATE_TYPES_ERROR and dispatches setErrorMessage', done => { + it('commits RECEIVE_TEMPLATE_TYPES_ERROR and dispatches setErrorMessage', (done) => { testAction( actions.receiveTemplateTypesError, null, @@ -55,7 +55,7 @@ describe('IDE file templates actions', () => { }); describe('receiveTemplateTypesSuccess', () => { - it('commits RECEIVE_TEMPLATE_TYPES_SUCCESS', done => { + it('commits RECEIVE_TEMPLATE_TYPES_SUCCESS', (done) => { testAction( actions.receiveTemplateTypesSuccess, 'test', @@ -81,7 +81,7 @@ describe('IDE file templates actions', () => { }); }); - it('rejects if selectedTemplateType is empty', done => { + it('rejects if selectedTemplateType is empty', (done) => { const dispatch = jest.fn().mockName('dispatch'); actions @@ -94,7 +94,7 @@ describe('IDE file templates actions', () => { }); }); - it('dispatches actions', done => { + it('dispatches actions', (done) => { state.selectedTemplateType = { key: 'licenses' }; testAction( @@ -121,7 +121,7 @@ describe('IDE file templates actions', () => { mock.onGet(/api\/(.*)\/templates\/licenses/).replyOnce(500); }); - it('dispatches actions', done => { + it('dispatches actions', (done) => { state.selectedTemplateType = { key: 'licenses' }; testAction( @@ -184,7 +184,7 @@ describe('IDE file templates actions', () => { }); describe('receiveTemplateError', () => { - it('dispatches setErrorMessage', done => { + it('dispatches setErrorMessage', (done) => { testAction( actions.receiveTemplateError, 'test', @@ -217,7 +217,7 @@ describe('IDE file templates actions', () => { .replyOnce(200, { content: 'testing content' }); }); - it('dispatches setFileTemplate if template already has content', done => { + it('dispatches setFileTemplate if template already has content', (done) => { const template = { content: 'already has content' }; testAction( @@ -230,7 +230,7 @@ describe('IDE file templates actions', () => { ); }); - it('dispatches success', done => { + it('dispatches success', (done) => { const template = { key: 'mit' }; state.selectedTemplateType = { key: 'licenses' }; @@ -245,7 +245,7 @@ describe('IDE file templates actions', () => { ); }); - it('dispatches success and uses name key for API call', done => { + it('dispatches success and uses name key for API call', (done) => { const template = { name: 'testing' }; state.selectedTemplateType = { key: 'licenses' }; @@ -266,7 +266,7 @@ describe('IDE file templates actions', () => { mock.onGet(/api\/(.*)\/templates\/licenses\/mit/).replyOnce(500); }); - it('dispatches error', done => { + it('dispatches error', (done) => { const template = { name: 'testing' }; state.selectedTemplateType = { key: 'licenses' }; diff --git a/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js b/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js index ec472ab418f..1f27cb46451 100644 --- a/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js +++ b/spec/frontend/ide/stores/modules/merge_requests/actions_spec.js @@ -28,7 +28,7 @@ describe('IDE merge requests actions', () => { }); describe('requestMergeRequests', () => { - it('should commit request', done => { + it('should commit request', (done) => { testAction( requestMergeRequests, null, @@ -41,7 +41,7 @@ describe('IDE merge requests actions', () => { }); describe('receiveMergeRequestsError', () => { - it('should commit error', done => { + it('should commit error', (done) => { testAction( receiveMergeRequestsError, { type: 'created', search: '' }, @@ -64,7 +64,7 @@ describe('IDE merge requests actions', () => { }); describe('receiveMergeRequestsSuccess', () => { - it('should commit received data', done => { + it('should commit received data', (done) => { testAction( receiveMergeRequestsSuccess, mergeRequests, @@ -118,7 +118,7 @@ describe('IDE merge requests actions', () => { }); }); - it('dispatches success with received data', done => { + it('dispatches success with received data', (done) => { testAction( fetchMergeRequests, { type: 'created' }, @@ -156,7 +156,7 @@ describe('IDE merge requests actions', () => { ); }); - it('dispatches success with received data', done => { + it('dispatches success with received data', (done) => { testAction( fetchMergeRequests, { type: null }, @@ -177,7 +177,7 @@ describe('IDE merge requests actions', () => { mock.onGet(/\/api\/v4\/merge_requests(.*)$/).replyOnce(500); }); - it('dispatches error', done => { + it('dispatches error', (done) => { testAction( fetchMergeRequests, { type: 'created', search: '' }, @@ -195,7 +195,7 @@ describe('IDE merge requests actions', () => { }); describe('resetMergeRequests', () => { - it('commits reset', done => { + it('commits reset', (done) => { testAction( resetMergeRequests, null, diff --git a/spec/frontend/ide/stores/modules/pane/actions_spec.js b/spec/frontend/ide/stores/modules/pane/actions_spec.js index 8c56714e0ed..42fe8b400b8 100644 --- a/spec/frontend/ide/stores/modules/pane/actions_spec.js +++ b/spec/frontend/ide/stores/modules/pane/actions_spec.js @@ -7,18 +7,18 @@ describe('IDE pane module actions', () => { const TEST_VIEW_KEEP_ALIVE = { name: 'test-keep-alive', keepAlive: true }; describe('toggleOpen', () => { - it('dispatches open if closed', done => { + it('dispatches open if closed', (done) => { testAction(actions.toggleOpen, TEST_VIEW, { isOpen: false }, [], [{ type: 'open' }], done); }); - it('dispatches close if opened', done => { + it('dispatches close if opened', (done) => { testAction(actions.toggleOpen, TEST_VIEW, { isOpen: true }, [], [{ type: 'close' }], done); }); }); describe('open', () => { describe('with a view specified', () => { - it('commits SET_OPEN and SET_CURRENT_VIEW', done => { + it('commits SET_OPEN and SET_CURRENT_VIEW', (done) => { testAction( actions.open, TEST_VIEW, @@ -32,7 +32,7 @@ describe('IDE pane module actions', () => { ); }); - it('commits KEEP_ALIVE_VIEW if keepAlive is true', done => { + it('commits KEEP_ALIVE_VIEW if keepAlive is true', (done) => { testAction( actions.open, TEST_VIEW_KEEP_ALIVE, @@ -49,7 +49,7 @@ describe('IDE pane module actions', () => { }); describe('without a view specified', () => { - it('commits SET_OPEN', done => { + it('commits SET_OPEN', (done) => { testAction( actions.open, undefined, @@ -63,7 +63,7 @@ describe('IDE pane module actions', () => { }); describe('close', () => { - it('commits SET_OPEN', done => { + it('commits SET_OPEN', (done) => { testAction(actions.close, null, {}, [{ type: types.SET_OPEN, payload: false }], [], done); }); }); diff --git a/spec/frontend/ide/stores/modules/pipelines/actions_spec.js b/spec/frontend/ide/stores/modules/pipelines/actions_spec.js index 8511843cc92..f6ccb61a360 100644 --- a/spec/frontend/ide/stores/modules/pipelines/actions_spec.js +++ b/spec/frontend/ide/stores/modules/pipelines/actions_spec.js @@ -44,7 +44,7 @@ describe('IDE pipelines actions', () => { }); describe('requestLatestPipeline', () => { - it('commits request', done => { + it('commits request', (done) => { testAction( requestLatestPipeline, null, @@ -57,7 +57,7 @@ describe('IDE pipelines actions', () => { }); describe('receiveLatestPipelineError', () => { - it('commits error', done => { + it('commits error', (done) => { testAction( receiveLatestPipelineError, { status: 404 }, @@ -68,7 +68,7 @@ describe('IDE pipelines actions', () => { ); }); - it('dispatches setErrorMessage is not 404', done => { + it('dispatches setErrorMessage is not 404', (done) => { testAction( receiveLatestPipelineError, { status: 500 }, @@ -123,7 +123,7 @@ describe('IDE pipelines actions', () => { .reply(200, { data: { foo: 'bar' } }, { 'poll-interval': '10000' }); }); - it('dispatches request', done => { + it('dispatches request', (done) => { jest.spyOn(axios, 'get'); jest.spyOn(Visibility, 'hidden').mockReturnValue(false); @@ -139,7 +139,7 @@ describe('IDE pipelines actions', () => { jest.advanceTimersByTime(1000); - new Promise(resolve => requestAnimationFrame(resolve)) + new Promise((resolve) => requestAnimationFrame(resolve)) .then(() => { expect(axios.get).toHaveBeenCalled(); expect(axios.get).toHaveBeenCalledTimes(1); @@ -150,7 +150,7 @@ describe('IDE pipelines actions', () => { jest.advanceTimersByTime(10000); }) - .then(() => new Promise(resolve => requestAnimationFrame(resolve))) + .then(() => new Promise((resolve) => requestAnimationFrame(resolve))) .then(() => { expect(axios.get).toHaveBeenCalled(); expect(axios.get).toHaveBeenCalledTimes(2); @@ -169,7 +169,7 @@ describe('IDE pipelines actions', () => { mock.onGet('/abc/def/commit/abc123def456ghi789jkl/pipelines').reply(500); }); - it('dispatches error', done => { + it('dispatches error', (done) => { const dispatch = jest.fn().mockName('dispatch'); const rootGetters = { lastCommit: { id: 'abc123def456ghi789jkl' }, @@ -180,7 +180,7 @@ describe('IDE pipelines actions', () => { jest.advanceTimersByTime(1500); - new Promise(resolve => requestAnimationFrame(resolve)) + new Promise((resolve) => requestAnimationFrame(resolve)) .then(() => { expect(dispatch).toHaveBeenCalledWith('receiveLatestPipelineError', expect.anything()); }) @@ -191,13 +191,13 @@ describe('IDE pipelines actions', () => { }); describe('requestJobs', () => { - it('commits request', done => { + it('commits request', (done) => { testAction(requestJobs, 1, mockedState, [{ type: types.REQUEST_JOBS, payload: 1 }], [], done); }); }); describe('receiveJobsError', () => { - it('commits error', done => { + it('commits error', (done) => { testAction( receiveJobsError, { id: 1 }, @@ -220,7 +220,7 @@ describe('IDE pipelines actions', () => { }); describe('receiveJobsSuccess', () => { - it('commits data', done => { + it('commits data', (done) => { testAction( receiveJobsSuccess, { id: 1, data: jobs }, @@ -240,7 +240,7 @@ describe('IDE pipelines actions', () => { mock.onGet(stage.dropdownPath).replyOnce(200, jobs); }); - it('dispatches request', done => { + it('dispatches request', (done) => { testAction( fetchJobs, stage, @@ -260,7 +260,7 @@ describe('IDE pipelines actions', () => { mock.onGet(stage.dropdownPath).replyOnce(500); }); - it('dispatches error', done => { + it('dispatches error', (done) => { testAction( fetchJobs, stage, @@ -277,7 +277,7 @@ describe('IDE pipelines actions', () => { }); describe('toggleStageCollapsed', () => { - it('commits collapse', done => { + it('commits collapse', (done) => { testAction( toggleStageCollapsed, 1, @@ -290,7 +290,7 @@ describe('IDE pipelines actions', () => { }); describe('setDetailJob', () => { - it('commits job', done => { + it('commits job', (done) => { testAction( setDetailJob, 'job', @@ -301,7 +301,7 @@ describe('IDE pipelines actions', () => { ); }); - it('dispatches rightPane/open as pipeline when job is null', done => { + it('dispatches rightPane/open as pipeline when job is null', (done) => { testAction( setDetailJob, null, @@ -312,7 +312,7 @@ describe('IDE pipelines actions', () => { ); }); - it('dispatches rightPane/open as job', done => { + it('dispatches rightPane/open as job', (done) => { testAction( setDetailJob, 'job', @@ -325,13 +325,13 @@ describe('IDE pipelines actions', () => { }); describe('requestJobLogs', () => { - it('commits request', done => { + it('commits request', (done) => { testAction(requestJobLogs, null, mockedState, [{ type: types.REQUEST_JOB_LOGS }], [], done); }); }); describe('receiveJobLogsError', () => { - it('commits error', done => { + it('commits error', (done) => { testAction( receiveJobLogsError, null, @@ -354,7 +354,7 @@ describe('IDE pipelines actions', () => { }); describe('receiveJobLogsSuccess', () => { - it('commits data', done => { + it('commits data', (done) => { testAction( receiveJobLogsSuccess, 'data', @@ -377,7 +377,7 @@ describe('IDE pipelines actions', () => { mock.onGet(`${TEST_HOST}/project/builds/trace`).replyOnce(200, { html: 'html' }); }); - it('dispatches request', done => { + it('dispatches request', (done) => { testAction( fetchJobLogs, null, @@ -408,7 +408,7 @@ describe('IDE pipelines actions', () => { mock.onGet(`${TEST_HOST}/project/builds/trace`).replyOnce(500); }); - it('dispatches error', done => { + it('dispatches error', (done) => { testAction( fetchJobLogs, null, @@ -422,7 +422,7 @@ describe('IDE pipelines actions', () => { }); describe('resetLatestPipeline', () => { - it('commits reset mutations', done => { + it('commits reset mutations', (done) => { testAction( resetLatestPipeline, null, diff --git a/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js b/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js index 7d2f5d5d710..d820bf0291e 100644 --- a/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js +++ b/spec/frontend/ide/stores/modules/pipelines/mutations_spec.js @@ -137,7 +137,7 @@ describe('IDE pipelines mutations', () => { mutations[types.RECEIVE_JOBS_SUCCESS](mockedState, { id: mockedState.stages[0].id, data }); expect(mockedState.stages[0].jobs.length).toBe(jobs.length); expect(mockedState.stages[0].jobs).toEqual( - jobs.map(job => ({ + jobs.map((job) => ({ id: job.id, name: job.name, status: job.status, diff --git a/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js index 242b1579be7..05935f1db38 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js @@ -102,7 +102,7 @@ describe('IDE store terminal check actions', () => { ); }); - [httpStatus.FORBIDDEN, httpStatus.NOT_FOUND].forEach(status => { + [httpStatus.FORBIDDEN, httpStatus.NOT_FOUND].forEach((status) => { it(`hides tab, when status is ${status}`, () => { const payload = { response: { status } }; diff --git a/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js index d0ac2af3ffd..dd51786745f 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js @@ -281,7 +281,7 @@ describe('IDE store terminal session controls actions', () => { ); }); - [httpStatus.NOT_FOUND, httpStatus.UNPROCESSABLE_ENTITY].forEach(status => { + [httpStatus.NOT_FOUND, httpStatus.UNPROCESSABLE_ENTITY].forEach((status) => { it(`dispatches request and startSession on ${status}`, () => { mock .onPost(state.session.retryPath, { branch: rootState.currentBranchId, format: 'json' }) diff --git a/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js b/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js index e25746e1dd1..0e123dce798 100644 --- a/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js +++ b/spec/frontend/ide/stores/modules/terminal/actions/session_status_spec.js @@ -98,7 +98,7 @@ describe('IDE store terminal session controls actions', () => { ); }); - [STOPPING, STOPPED, 'unexpected'].forEach(status => { + [STOPPING, STOPPED, 'unexpected'].forEach((status) => { it(`kills session if status is ${status}`, () => { return testAction( actions.receiveSessionStatusSuccess, diff --git a/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js b/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js index 3fa57bde415..2ae7e8a8727 100644 --- a/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js +++ b/spec/frontend/ide/stores/modules/terminal_sync/actions_spec.js @@ -22,7 +22,7 @@ describe('ide/stores/modules/terminal_sync/actions', () => { }); describe('upload', () => { - it('uploads to mirror and sets success', done => { + it('uploads to mirror and sets success', (done) => { mirror.upload.mockReturnValue(Promise.resolve()); testAction( @@ -38,7 +38,7 @@ describe('ide/stores/modules/terminal_sync/actions', () => { ); }); - it('sets error when failed', done => { + it('sets error when failed', (done) => { const err = { message: 'it failed!' }; mirror.upload.mockReturnValue(Promise.reject(err)); @@ -54,7 +54,7 @@ describe('ide/stores/modules/terminal_sync/actions', () => { }); describe('stop', () => { - it('disconnects from mirror', done => { + it('disconnects from mirror', (done) => { testAction(actions.stop, null, rootState, [{ type: types.STOP }], [], () => { expect(mirror.disconnect).toHaveBeenCalled(); done(); @@ -83,7 +83,7 @@ describe('ide/stores/modules/terminal_sync/actions', () => { }; }); - it('connects to mirror and sets success', done => { + it('connects to mirror and sets success', (done) => { mirror.connect.mockReturnValue(Promise.resolve()); testAction( diff --git a/spec/frontend/ide/stores/mutations/file_spec.js b/spec/frontend/ide/stores/mutations/file_spec.js index fd39cf21635..9bbdac0ae25 100644 --- a/spec/frontend/ide/stores/mutations/file_spec.js +++ b/spec/frontend/ide/stores/mutations/file_spec.js @@ -128,7 +128,7 @@ describe('IDE store file mutations', () => { localState.changedFiles[0], localState.openFiles[0], localFile, - ].forEach(f => { + ].forEach((f) => { expect(f).toEqual( expect.objectContaining({ path, @@ -142,7 +142,7 @@ describe('IDE store file mutations', () => { }); describe('SET_FILE_RAW_DATA', () => { - const callMutationForFile = f => { + const callMutationForFile = (f) => { mutations.SET_FILE_RAW_DATA(localState, { file: f, raw: 'testing', diff --git a/spec/frontend/ide/sync_router_and_store_spec.js b/spec/frontend/ide/sync_router_and_store_spec.js index 20fd77c4dfb..ac0f6aefb69 100644 --- a/spec/frontend/ide/sync_router_and_store_spec.js +++ b/spec/frontend/ide/sync_router_and_store_spec.js @@ -17,7 +17,7 @@ describe('~/ide/sync_router_and_store', () => { const getRouterCurrentPath = () => router.currentRoute.fullPath; const getStoreCurrentPath = () => store.state.router.fullPath; - const updateRouter = async path => { + const updateRouter = async (path) => { if (getRouterCurrentPath() === path) { return; } @@ -25,7 +25,7 @@ describe('~/ide/sync_router_and_store', () => { router.push(path); await waitForPromises(); }; - const updateStore = path => { + const updateStore = (path) => { store.dispatch('router/push', path); return waitForPromises(); }; diff --git a/spec/frontend/ide/utils_spec.js b/spec/frontend/ide/utils_spec.js index 3b772c0b259..f467d174eeb 100644 --- a/spec/frontend/ide/utils_spec.js +++ b/spec/frontend/ide/utils_spec.js @@ -263,7 +263,7 @@ describe('WebIDE utils', () => { it('reads a file and returns its output as a data url', () => { const file = new File(['foo'], 'foo.png', { type: 'image/png' }); - return readFileAsDataURL(file).then(contents => { + return readFileAsDataURL(file).then((contents) => { expect(contents).toBe('data:image/png;base64,Zm9v'); }); }); diff --git a/spec/frontend/image_diff/init_discussion_tab_spec.js b/spec/frontend/image_diff/init_discussion_tab_spec.js index f459fdf5a08..f96d00230ee 100644 --- a/spec/frontend/image_diff/init_discussion_tab_spec.js +++ b/spec/frontend/image_diff/init_discussion_tab_spec.js @@ -11,7 +11,7 @@ describe('initDiscussionTab', () => { `); }); - it('should pass canCreateNote as false to initImageDiff', done => { + it('should pass canCreateNote as false to initImageDiff', (done) => { jest .spyOn(initImageDiffHelper, 'initImageDiff') .mockImplementation((diffFileEl, canCreateNote) => { @@ -22,7 +22,7 @@ describe('initDiscussionTab', () => { initDiscussionTab(); }); - it('should pass renderCommentBadge as true to initImageDiff', done => { + it('should pass renderCommentBadge as true to initImageDiff', (done) => { jest .spyOn(initImageDiffHelper, 'initImageDiff') .mockImplementation((diffFileEl, canCreateNote, renderCommentBadge) => { diff --git a/spec/frontend/image_diff/replaced_image_diff_spec.js b/spec/frontend/image_diff/replaced_image_diff_spec.js index 10827d76e55..3f4b828b43d 100644 --- a/spec/frontend/image_diff/replaced_image_diff_spec.js +++ b/spec/frontend/image_diff/replaced_image_diff_spec.js @@ -176,8 +176,8 @@ describe('ReplacedImageDiff', () => { expect(ImageDiff.prototype.bindEvents).toHaveBeenCalled(); }); - it('should register click eventlistener to 2-up view mode', done => { - jest.spyOn(ReplacedImageDiff.prototype, 'changeView').mockImplementation(viewMode => { + it('should register click eventlistener to 2-up view mode', (done) => { + jest.spyOn(ReplacedImageDiff.prototype, 'changeView').mockImplementation((viewMode) => { expect(viewMode).toEqual(viewTypes.TWO_UP); done(); }); @@ -186,8 +186,8 @@ describe('ReplacedImageDiff', () => { replacedImageDiff.viewModesEls[viewTypes.TWO_UP].click(); }); - it('should register click eventlistener to swipe view mode', done => { - jest.spyOn(ReplacedImageDiff.prototype, 'changeView').mockImplementation(viewMode => { + it('should register click eventlistener to swipe view mode', (done) => { + jest.spyOn(ReplacedImageDiff.prototype, 'changeView').mockImplementation((viewMode) => { expect(viewMode).toEqual(viewTypes.SWIPE); done(); }); @@ -196,8 +196,8 @@ describe('ReplacedImageDiff', () => { replacedImageDiff.viewModesEls[viewTypes.SWIPE].click(); }); - it('should register click eventlistener to onion skin view mode', done => { - jest.spyOn(ReplacedImageDiff.prototype, 'changeView').mockImplementation(viewMode => { + it('should register click eventlistener to onion skin view mode', (done) => { + jest.spyOn(ReplacedImageDiff.prototype, 'changeView').mockImplementation((viewMode) => { expect(viewMode).toEqual(viewTypes.SWIPE); done(); }); @@ -325,7 +325,7 @@ describe('ReplacedImageDiff', () => { setupImageFrameEls(); }); - it('should pass showCommentIndicator normalized indicator values', done => { + it('should pass showCommentIndicator normalized indicator values', (done) => { jest.spyOn(imageDiffHelper, 'showCommentIndicator').mockImplementation(() => {}); jest .spyOn(imageDiffHelper, 'resizeCoordinatesToImageElement') @@ -339,7 +339,7 @@ describe('ReplacedImageDiff', () => { replacedImageDiff.renderNewView(indicator); }); - it('should call showCommentIndicator', done => { + it('should call showCommentIndicator', (done) => { const normalized = { normalized: true, }; diff --git a/spec/frontend/import_entities/import_groups/components/import_table_row_spec.js b/spec/frontend/import_entities/import_groups/components/import_table_row_spec.js index d88a31a0e47..ac8b73aeb49 100644 --- a/spec/frontend/import_entities/import_groups/components/import_table_row_spec.js +++ b/spec/frontend/import_entities/import_groups/components/import_table_row_spec.js @@ -5,7 +5,7 @@ import ImportTableRow from '~/import_entities/import_groups/components/import_ta import { STATUSES } from '~/import_entities/constants'; import { availableNamespacesFixture } from '../graphql/fixtures'; -const getFakeGroup = status => ({ +const getFakeGroup = (status) => ({ web_url: 'https://fake.host/', full_path: 'fake_group_1', full_name: 'fake_name_1', @@ -22,13 +22,13 @@ describe('import table row', () => { let group; const findByText = (cmp, text) => { - return wrapper.findAll(cmp).wrappers.find(node => node.text().indexOf(text) === 0); + return wrapper.findAll(cmp).wrappers.find((node) => node.text().indexOf(text) === 0); }; const findImportButton = () => findByText(GlButton, 'Import'); const findNameInput = () => wrapper.find(GlFormInput); const findNamespaceDropdown = () => wrapper.find(Select2Select); - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(ImportTableRow, { propsData: { availableNamespaces: availableNamespacesFixture, diff --git a/spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js b/spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js index cacbe358a62..514ed411138 100644 --- a/spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js +++ b/spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js @@ -63,7 +63,7 @@ describe('Bulk import resolvers', () => { }); it('mirrors REST endpoint response fields', () => { - const extractRelevantFields = obj => ({ id: obj.id, full_path: obj.full_path }); + const extractRelevantFields = (obj) => ({ id: obj.id, full_path: obj.full_path }); expect(results.map(extractRelevantFields)).toStrictEqual( availableNamespacesFixture.map(extractRelevantFields), @@ -89,20 +89,20 @@ describe('Bulk import resolvers', () => { expect( results.every((r, idx) => MIRRORED_FIELDS.every( - field => r[field] === statusEndpointFixture.importable_data[idx][field], + (field) => r[field] === statusEndpointFixture.importable_data[idx][field], ), ), ).toBe(true); }); it('populates each result instance with status field default to none', () => { - expect(results.every(r => r.status === STATUSES.NONE)).toBe(true); + expect(results.every((r) => r.status === STATUSES.NONE)).toBe(true); }); it('populates each result instance with import_target defaulted to first available namespace', () => { expect( results.every( - r => r.import_target.target_namespace === availableNamespacesFixture[0].full_path, + (r) => r.import_target.target_namespace === availableNamespacesFixture[0].full_path, ), ).toBe(true); }); diff --git a/spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js b/spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js index b4ac11b4404..2c601bcf99d 100644 --- a/spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js +++ b/spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js @@ -27,7 +27,7 @@ describe('ImportProjectsTable', () => { const findImportAllButton = () => wrapper .findAll(GlButton) - .filter(w => w.props().variant === 'success') + .filter((w) => w.props().variant === 'success') .at(0); const findImportAllModal = () => wrapper.find({ ref: 'importAllModal' }); @@ -112,7 +112,7 @@ describe('ImportProjectsTable', () => { expect( wrapper .findAll('th') - .filter(w => w.text() === `From ${providerTitle}`) + .filter((w) => w.text() === `From ${providerTitle}`) .exists(), ).toBe(true); diff --git a/spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js b/spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js index aa003226050..2ed11ae277e 100644 --- a/spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js +++ b/spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js @@ -34,7 +34,7 @@ describe('ProviderRepoTableRow', () => { } const findImportButton = () => { - const buttons = wrapper.findAll('button').filter(node => node.text() === 'Import'); + const buttons = wrapper.findAll('button').filter((node) => node.text() === 'Import'); return buttons.length ? buttons.at(0) : buttons; }; diff --git a/spec/frontend/import_entities/import_projects/store/actions_spec.js b/spec/frontend/import_entities/import_projects/store/actions_spec.js index 5d4e73a17a3..bd731dc3929 100644 --- a/spec/frontend/import_entities/import_projects/store/actions_spec.js +++ b/spec/frontend/import_entities/import_projects/store/actions_spec.js @@ -123,7 +123,7 @@ describe('import_projects store actions', () => { it('includes page in url query params', async () => { let requestedUrl; - mock.onGet().reply(config => { + mock.onGet().reply((config) => { requestedUrl = config.url; return [200, payload]; }); diff --git a/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js b/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js index e94645c4e1d..c80d9ad2e5b 100644 --- a/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js +++ b/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js @@ -39,7 +39,7 @@ describe('IncidentsSettingTabs', () => { }); it('should render the tab for each active integration', () => { - const activeTabs = wrapper.vm.$options.tabs.filter(tab => tab.active); + const activeTabs = wrapper.vm.$options.tabs.filter((tab) => tab.active); expect(findIntegrationTabs().length).toBe(activeTabs.length); activeTabs.forEach((tab, index) => { expect(findIntegrationTabs().at(index).attributes('title')).toBe(tab.title); diff --git a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js index a727bb9c734..eaeed2703d1 100644 --- a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js +++ b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js @@ -12,7 +12,7 @@ describe('JiraIssuesFields', () => { editProjectPath: '/edit', }; - const createComponent = props => { + const createComponent = (props) => { wrapper = mount(JiraIssuesFields, { propsData: { ...defaultProps, ...props }, }); diff --git a/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js b/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js index f3827d6f55a..a69e8d6e163 100644 --- a/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js +++ b/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js @@ -104,11 +104,11 @@ describe('JiraTriggerFields', () => { true, ); - wrapper.findAll('[type=checkbox]').wrappers.forEach(checkbox => { + wrapper.findAll('[type=checkbox]').wrappers.forEach((checkbox) => { expect(checkbox.attributes('disabled')).toBe('disabled'); }); - wrapper.findAll('[type=radio]').wrappers.forEach(radio => { + wrapper.findAll('[type=radio]').wrappers.forEach((radio) => { expect(radio.attributes('disabled')).toBe('disabled'); }); }); diff --git a/spec/frontend/integrations/edit/components/trigger_fields_spec.js b/spec/frontend/integrations/edit/components/trigger_fields_spec.js index df12c70f9f5..3fa1e5b5f5a 100644 --- a/spec/frontend/integrations/edit/components/trigger_fields_spec.js +++ b/spec/frontend/integrations/edit/components/trigger_fields_spec.js @@ -29,7 +29,7 @@ describe('TriggerFields', () => { const findAllGlFormCheckboxes = () => wrapper.findAll(GlFormCheckbox); const findAllGlFormInputs = () => wrapper.findAll(GlFormInput); - describe.each([true, false])('template, isInheriting = `%p`', isInheriting => { + describe.each([true, false])('template, isInheriting = `%p`', (isInheriting) => { it('renders a label with text "Trigger"', () => { createComponent(); diff --git a/spec/frontend/issuable/related_issues/components/related_issues_block_spec.js b/spec/frontend/issuable/related_issues/components/related_issues_block_spec.js index 1864888ef49..c0889b09adc 100644 --- a/spec/frontend/issuable/related_issues/components/related_issues_block_spec.js +++ b/spec/frontend/issuable/related_issues/components/related_issues_block_spec.js @@ -130,8 +130,8 @@ describe('RelatedIssuesBlock', () => { describe('showCategorizedIssues prop', () => { const issueList = () => wrapper.findAll('.js-related-issues-token-list-item'); const categorizedHeadings = () => wrapper.findAll('h4'); - const headingTextAt = index => categorizedHeadings().at(index).text(); - const mountComponent = showCategorizedIssues => { + const headingTextAt = (index) => categorizedHeadings().at(index).text(); + const mountComponent = (showCategorizedIssues) => { wrapper = mount(RelatedIssuesBlock, { propsData: { pathIdSeparator: PathIdSeparator.Issue, diff --git a/spec/frontend/issuable_show/components/issuable_body_spec.js b/spec/frontend/issuable_show/components/issuable_body_spec.js index 65bace1ce3f..4ffbbad4f37 100644 --- a/spec/frontend/issuable_show/components/issuable_body_spec.js +++ b/spec/frontend/issuable_show/components/issuable_body_spec.js @@ -135,7 +135,7 @@ describe('IssuableBody', () => { it.each(['keydown-title', 'keydown-description'])( 'component emits `%s` event with event object and issuableMeta params via issuable-edit-form', - async eventName => { + async (eventName) => { const eventObj = { preventDefault: jest.fn(), stopPropagation: jest.fn(), diff --git a/spec/frontend/issuable_show/components/issuable_edit_form_spec.js b/spec/frontend/issuable_show/components/issuable_edit_form_spec.js index a865bdb5608..522374f2e9c 100644 --- a/spec/frontend/issuable_show/components/issuable_edit_form_spec.js +++ b/spec/frontend/issuable_show/components/issuable_edit_form_spec.js @@ -28,7 +28,7 @@ const createComponent = ({ propsData = issuableEditFormProps } = {}) => describe('IssuableEditForm', () => { let wrapper; - const assertEvent = eventSpy => { + const assertEvent = (eventSpy) => { expect(eventSpy).toHaveBeenNthCalledWith(1, 'update.issuable', expect.any(Function)); expect(eventSpy).toHaveBeenNthCalledWith(2, 'close.form', expect.any(Function)); }; diff --git a/spec/frontend/issuable_show/components/issuable_header_spec.js b/spec/frontend/issuable_show/components/issuable_header_spec.js index fad8ec8a891..f9c20ab04b8 100644 --- a/spec/frontend/issuable_show/components/issuable_header_spec.js +++ b/spec/frontend/issuable_show/components/issuable_header_spec.js @@ -24,7 +24,7 @@ const createComponent = (propsData = issuableHeaderProps) => describe('IssuableHeader', () => { let wrapper; - const findByTestId = testId => wrapper.find(`[data-testid="${testId}"]`); + const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`); beforeEach(() => { wrapper = createComponent(); diff --git a/spec/frontend/issuable_show/components/issuable_show_root_spec.js b/spec/frontend/issuable_show/components/issuable_show_root_spec.js index ca0aefc1083..6cebfc150f9 100644 --- a/spec/frontend/issuable_show/components/issuable_show_root_spec.js +++ b/spec/frontend/issuable_show/components/issuable_show_root_spec.js @@ -121,7 +121,7 @@ describe('IssuableShowRoot', () => { it.each(['keydown-title', 'keydown-description'])( 'component emits `%s` event with event object and issuableMeta params via issuable-body', - eventName => { + (eventName) => { const eventObj = { preventDefault: jest.fn(), stopPropagation: jest.fn(), diff --git a/spec/frontend/issuable_spec.js b/spec/frontend/issuable_spec.js index 63c1fda2fb4..6712b8bfd34 100644 --- a/spec/frontend/issuable_spec.js +++ b/spec/frontend/issuable_spec.js @@ -49,7 +49,7 @@ describe('Issuable', () => { mock.restore(); }); - it('should send request to reset email token', done => { + it('should send request to reset email token', (done) => { jest.spyOn(axios, 'put'); document.querySelector('.incoming-email-token-reset').click(); diff --git a/spec/frontend/issue_show/components/app_spec.js b/spec/frontend/issue_show/components/app_spec.js index d50b67970d8..07ab60841ca 100644 --- a/spec/frontend/issue_show/components/app_spec.js +++ b/spec/frontend/issue_show/components/app_spec.js @@ -398,8 +398,8 @@ describe('Issuable output', () => { wrapper.vm.poll.makeRequest(); - return new Promise(resolve => { - wrapper.vm.$watch('formState.lockedWarningVisible', value => { + return new Promise((resolve) => { + wrapper.vm.$watch('formState.lockedWarningVisible', (value) => { if (value) { resolve(); } diff --git a/spec/frontend/issue_show/components/description_spec.js b/spec/frontend/issue_show/components/description_spec.js index bc7511225a0..de53d98e6be 100644 --- a/spec/frontend/issue_show/components/description_spec.js +++ b/spec/frontend/issue_show/components/description_spec.js @@ -74,7 +74,7 @@ describe('Description component', () => { let modal; const recaptchaChild = vm.$children.find( // eslint-disable-next-line no-underscore-dangle - child => child.$options._componentTag === 'recaptcha-modal', + (child) => child.$options._componentTag === 'recaptcha-modal', ); recaptchaChild.scriptSrc = '//scriptsrc'; diff --git a/spec/frontend/issue_show/components/edit_actions_spec.js b/spec/frontend/issue_show/components/edit_actions_spec.js index 79a2bcd5eab..6a00eec4b1f 100644 --- a/spec/frontend/issue_show/components/edit_actions_spec.js +++ b/spec/frontend/issue_show/components/edit_actions_spec.js @@ -6,7 +6,7 @@ import Store from '~/issue_show/stores'; describe('Edit Actions components', () => { let vm; - beforeEach(done => { + beforeEach((done) => { const Component = Vue.extend(editActions); const store = new Store({ titleHtml: '', @@ -34,7 +34,7 @@ describe('Edit Actions components', () => { expect(vm.$el.querySelectorAll('[disabled]').length).toBe(0); }); - it('does not render delete button if canUpdate is false', done => { + it('does not render delete button if canUpdate is false', (done) => { vm.canDestroy = false; Vue.nextTick(() => { @@ -44,7 +44,7 @@ describe('Edit Actions components', () => { }); }); - it('disables submit button when title is blank', done => { + it('disables submit button when title is blank', (done) => { vm.formState.title = ''; Vue.nextTick(() => { @@ -54,7 +54,7 @@ describe('Edit Actions components', () => { }); }); - it('should not show delete button if showDeleteButton is false', done => { + it('should not show delete button if showDeleteButton is false', (done) => { vm.showDeleteButton = false; Vue.nextTick(() => { @@ -70,7 +70,7 @@ describe('Edit Actions components', () => { expect(eventHub.$emit).toHaveBeenCalledWith('update.issuable'); }); - it('disabled button after clicking save button', done => { + it('disabled button after clicking save button', (done) => { vm.$el.querySelector('.btn-success').click(); Vue.nextTick(() => { @@ -97,7 +97,7 @@ describe('Edit Actions components', () => { expect(eventHub.$emit).toHaveBeenCalledWith('delete.issuable', { destroy_confirm: true }); }); - it('does no actions when confirm is false', done => { + it('does no actions when confirm is false', (done) => { jest.spyOn(window, 'confirm').mockReturnValue(false); vm.$el.querySelector('.btn-danger').click(); diff --git a/spec/frontend/issue_show/components/fields/description_spec.js b/spec/frontend/issue_show/components/fields/description_spec.js index 8ea326ad1ee..96c81c419d0 100644 --- a/spec/frontend/issue_show/components/fields/description_spec.js +++ b/spec/frontend/issue_show/components/fields/description_spec.js @@ -8,7 +8,7 @@ describe('Description field component', () => { let vm; let store; - beforeEach(done => { + beforeEach((done) => { const Component = Vue.extend(descriptionField); const el = document.createElement('div'); store = new Store({ @@ -38,7 +38,7 @@ describe('Description field component', () => { expect(vm.$el.querySelector('.md-area textarea').value).toBe('test'); }); - it('renders markdown field with a markdown description', done => { + it('renders markdown field with a markdown description', (done) => { store.formState.description = '**test**'; Vue.nextTick(() => { diff --git a/spec/frontend/issue_show/components/form_spec.js b/spec/frontend/issue_show/components/form_spec.js index b06a3a89d3b..4e123f606f6 100644 --- a/spec/frontend/issue_show/components/form_spec.js +++ b/spec/frontend/issue_show/components/form_spec.js @@ -26,7 +26,7 @@ describe('Inline edit form component', () => { vm.$destroy(); }); - const createComponent = props => { + const createComponent = (props) => { const Component = Vue.extend(formComponent); vm = mountComponent(Component, { diff --git a/spec/frontend/issue_show/components/header_actions_spec.js b/spec/frontend/issue_show/components/header_actions_spec.js index 8af99cd5a31..4df62ec8717 100644 --- a/spec/frontend/issue_show/components/header_actions_spec.js +++ b/spec/frontend/issue_show/components/header_actions_spec.js @@ -62,7 +62,7 @@ describe('HeaderActions component', () => { const findToggleIssueStateButton = () => wrapper.find(GlButton); - const findDropdownAt = index => wrapper.findAll(GlDropdown).at(index); + const findDropdownAt = (index) => wrapper.findAll(GlDropdown).at(index); const findMobileDropdownItems = () => findDropdownAt(0).findAll(GlDropdownItem); @@ -70,7 +70,7 @@ describe('HeaderActions component', () => { const findModal = () => wrapper.find(GlModal); - const findModalLinkAt = index => findModal().findAll(GlLink).at(index); + const findModalLinkAt = (index) => findModal().findAll(GlLink).at(index); const mountComponent = ({ props = {}, @@ -205,7 +205,7 @@ describe('HeaderActions component', () => { it(`${isItemVisible ? 'shows' : 'hides'} "${itemText}" item`, () => { expect( findDropdownItems() - .filter(item => item.text() === itemText) + .filter((item) => item.text() === itemText) .exists(), ).toBe(isItemVisible); }); diff --git a/spec/frontend/issue_show/components/incidents/highlight_bar_spec.js b/spec/frontend/issue_show/components/incidents/highlight_bar_spec.js index c1ab4433761..112cb4d4c3a 100644 --- a/spec/frontend/issue_show/components/incidents/highlight_bar_spec.js +++ b/spec/frontend/issue_show/components/incidents/highlight_bar_spec.js @@ -17,7 +17,7 @@ describe('Highlight Bar', () => { title: 'Alert 1', }; - const mountComponent = options => { + const mountComponent = (options) => { wrapper = shallowMount( HighlightBar, merge( diff --git a/spec/frontend/issue_show/components/pinned_links_spec.js b/spec/frontend/issue_show/components/pinned_links_spec.js index 74a0b39a852..2d140fd068a 100644 --- a/spec/frontend/issue_show/components/pinned_links_spec.js +++ b/spec/frontend/issue_show/components/pinned_links_spec.js @@ -11,7 +11,7 @@ describe('PinnedLinks', () => { const findButtons = () => wrapper.findAll(GlButton); - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(PinnedLinks, { propsData: { zoomMeetingUrl: '', diff --git a/spec/frontend/issue_show/issue_spec.js b/spec/frontend/issue_show/issue_spec.js index cee9969d26a..818f501882b 100644 --- a/spec/frontend/issue_show/issue_spec.js +++ b/spec/frontend/issue_show/issue_spec.js @@ -14,7 +14,7 @@ useMockIntersectionObserver(); jest.mock('~/lib/utils/poll'); -const setupHTML = initialData => { +const setupHTML = (initialData) => { document.body.innerHTML = `<div id="js-issuable-app"></div>`; document.getElementById('js-issuable-app').dataset.initial = JSON.stringify(initialData); }; diff --git a/spec/frontend/issue_spec.js b/spec/frontend/issue_spec.js index 00595736821..303267e784f 100644 --- a/spec/frontend/issue_spec.js +++ b/spec/frontend/issue_spec.js @@ -41,7 +41,7 @@ describe('Issue', () => { expect($boxOpen).toHaveText('Open'); } - [true, false].forEach(isIssueInitiallyOpen => { + [true, false].forEach((isIssueInitiallyOpen) => { describe(`with ${isIssueInitiallyOpen ? 'open' : 'closed'} issue`, () => { const action = isIssueInitiallyOpen ? 'close' : 'reopen'; let mock; diff --git a/spec/frontend/issues_list/components/issuable_spec.js b/spec/frontend/issues_list/components/issuable_spec.js index 6e584152551..b47a84ad7f6 100644 --- a/spec/frontend/issues_list/components/issuable_spec.js +++ b/spec/frontend/issues_list/components/issuable_spec.js @@ -72,9 +72,9 @@ describe('Issuable component', () => { window.Date = DateOrig; }); - const checkExists = findFn => () => findFn().exists(); + const checkExists = (findFn) => () => findFn().exists(); const hasIcon = (iconName, iconWrapper = wrapper) => - iconWrapper.findAll(GlIcon).wrappers.some(icon => icon.props('name') === iconName); + iconWrapper.findAll(GlIcon).wrappers.some((icon) => icon.props('name') === iconName); const hasConfidentialIcon = () => hasIcon('eye-slash'); const findTaskStatus = () => wrapper.find('.task-status'); const findOpenedAgoContainer = () => wrapper.find('[data-testid="openedByMessage"]'); @@ -91,8 +91,8 @@ describe('Issuable component', () => { const findDownvotes = () => wrapper.find('[data-testid="downvotes"]'); const findNotes = () => wrapper.find('[data-testid="notes-count"]'); const findBulkCheckbox = () => wrapper.find('input.selected-issuable'); - const findScopedLabels = () => findLabels().filter(w => isScopedLabel({ title: w.text() })); - const findUnscopedLabels = () => findLabels().filter(w => !isScopedLabel({ title: w.text() })); + const findScopedLabels = () => findLabels().filter((w) => isScopedLabel({ title: w.text() })); + const findUnscopedLabels = () => findLabels().filter((w) => !isScopedLabel({ title: w.text() })); const findIssuableTitle = () => wrapper.find('[data-testid="issuable-title"]'); const findIssuableStatus = () => wrapper.find('[data-testid="issuable-status"]'); const containsJiraLogo = () => wrapper.find('[data-testid="jira-logo"]').exists(); @@ -336,13 +336,13 @@ describe('Issuable component', () => { it('renders labels', () => { factory({ issuable }); - const labels = findLabels().wrappers.map(label => ({ + const labels = findLabels().wrappers.map((label) => ({ href: label.props('target'), text: label.text(), tooltip: label.attributes('description'), })); - const expected = testLabels.map(label => ({ + const expected = testLabels.map((label) => ({ href: mergeUrlParams({ 'label_name[]': label.name }, TEST_BASE_URL), text: label.name, tooltip: label.description, @@ -363,13 +363,13 @@ describe('Issuable component', () => { it('renders labels', () => { factory({ issuable }); - const labels = findLabels().wrappers.map(label => ({ + const labels = findLabels().wrappers.map((label) => ({ href: label.props('target'), text: label.text(), tooltip: label.attributes('description'), })); - const expected = testLabels.map(label => ({ + const expected = testLabels.map((label) => ({ href: mergeUrlParams({ 'labels[]': label.name }, TEST_BASE_URL), text: label.name, tooltip: label.description, diff --git a/spec/frontend/issues_list/components/issuables_list_app_spec.js b/spec/frontend/issues_list/components/issuables_list_app_spec.js index c14d78322e8..9d603099ff7 100644 --- a/spec/frontend/issues_list/components/issuables_list_app_spec.js +++ b/spec/frontend/issues_list/components/issuables_list_app_spec.js @@ -27,7 +27,7 @@ const TEST_ENDPOINT = '/issues'; const TEST_CREATE_ISSUES_PATH = '/createIssue'; const TEST_SVG_PATH = '/emptySvg'; -const setUrl = query => { +const setUrl = (query) => { window.location.href = `${TEST_LOCATION}${query}`; window.location.search = query; }; @@ -45,10 +45,10 @@ describe('Issuables list component', () => { let wrapper; let apiSpy; - const setupApiMock = cb => { + const setupApiMock = (cb) => { apiSpy = jest.fn(cb); - mockAxios.onGet(TEST_ENDPOINT).reply(cfg => apiSpy(cfg)); + mockAxios.onGet(TEST_ENDPOINT).reply((cfg) => apiSpy(cfg)); }; const factory = (props = { sortKey: 'priority' }) => { diff --git a/spec/frontend/jira_import/components/jira_import_form_spec.js b/spec/frontend/jira_import/components/jira_import_form_spec.js index d184c054b8a..00fb8f5435e 100644 --- a/spec/frontend/jira_import/components/jira_import_form_spec.js +++ b/spec/frontend/jira_import/components/jira_import_form_spec.js @@ -37,7 +37,7 @@ describe('JiraImportForm', () => { const getUserDropdown = () => getTable().find(GlDropdown); - const getHeader = name => getByRole(wrapper.element, 'columnheader', { name }); + const getHeader = (name) => getByRole(wrapper.element, 'columnheader', { name }); const findLoadMoreUsersButton = () => wrapper.find('[data-testid="load-more-users-button"]'); diff --git a/spec/frontend/jira_import/components/jira_import_progress_spec.js b/spec/frontend/jira_import/components/jira_import_progress_spec.js index ed7e1824fa3..b56230e94fc 100644 --- a/spec/frontend/jira_import/components/jira_import_progress_spec.js +++ b/spec/frontend/jira_import/components/jira_import_progress_spec.js @@ -8,7 +8,7 @@ describe('JiraImportProgress', () => { const importProject = 'JIRAPROJECT'; - const getGlEmptyStateProp = attribute => wrapper.find(GlEmptyState).props(attribute); + const getGlEmptyStateProp = (attribute) => wrapper.find(GlEmptyState).props(attribute); const getParagraphText = () => wrapper.find('p').text(); diff --git a/spec/frontend/jira_import/components/jira_import_setup_spec.js b/spec/frontend/jira_import/components/jira_import_setup_spec.js index 7c84d4a166a..320e270b493 100644 --- a/spec/frontend/jira_import/components/jira_import_setup_spec.js +++ b/spec/frontend/jira_import/components/jira_import_setup_spec.js @@ -6,7 +6,7 @@ import { illustration, jiraIntegrationPath } from '../mock_data'; describe('JiraImportSetup', () => { let wrapper; - const getGlEmptyStateProp = attribute => wrapper.find(GlEmptyState).props(attribute); + const getGlEmptyStateProp = (attribute) => wrapper.find(GlEmptyState).props(attribute); beforeEach(() => { wrapper = shallowMount(JiraImportSetup, { diff --git a/spec/frontend/jobs/components/artifacts_block_spec.js b/spec/frontend/jobs/components/artifacts_block_spec.js index a709a59cadd..8f981087550 100644 --- a/spec/frontend/jobs/components/artifacts_block_spec.js +++ b/spec/frontend/jobs/components/artifacts_block_spec.js @@ -6,7 +6,7 @@ import { trimText } from '../../helpers/text_helper'; describe('Artifacts block', () => { let wrapper; - const createWrapper = propsData => + const createWrapper = (propsData) => mount(ArtifactsBlock, { propsData: { helpUrl: 'help-url', diff --git a/spec/frontend/jobs/components/empty_state_spec.js b/spec/frontend/jobs/components/empty_state_spec.js index f9a6afe0770..c9de110ce06 100644 --- a/spec/frontend/jobs/components/empty_state_spec.js +++ b/spec/frontend/jobs/components/empty_state_spec.js @@ -12,7 +12,7 @@ describe('Empty State', () => { variablesSettingsUrl: '', }; - const createWrapper = props => { + const createWrapper = (props) => { wrapper = mount(EmptyState, { propsData: { ...defaultProps, diff --git a/spec/frontend/jobs/components/erased_block_spec.js b/spec/frontend/jobs/components/erased_block_spec.js index d66ee71df6a..b3e1d28eb16 100644 --- a/spec/frontend/jobs/components/erased_block_spec.js +++ b/spec/frontend/jobs/components/erased_block_spec.js @@ -10,7 +10,7 @@ describe('Erased block', () => { const timeago = getTimeago(); const formattedDate = timeago.format(erasedAt); - const createComponent = props => { + const createComponent = (props) => { wrapper = mount(ErasedBlock, { propsData: props, }); diff --git a/spec/frontend/jobs/components/job_app_spec.js b/spec/frontend/jobs/components/job_app_spec.js index d5fa158806f..e8861108497 100644 --- a/spec/frontend/jobs/components/job_app_spec.js +++ b/spec/frontend/jobs/components/job_app_spec.js @@ -375,7 +375,7 @@ describe('Job App', () => { }); describe('sidebar', () => { - it('has no blank blocks', done => { + it('has no blank blocks', (done) => { setupAndMount({ jobData: { duration: null, @@ -392,7 +392,7 @@ describe('Job App', () => { const blocks = wrapper.findAll('.blocks-container > *').wrappers; expect(blocks.length).toBeGreaterThan(0); - blocks.forEach(block => { + blocks.forEach((block) => { expect(block.text().trim()).not.toBe(''); }); }) diff --git a/spec/frontend/jobs/components/job_container_item_spec.js b/spec/frontend/jobs/components/job_container_item_spec.js index 41b399fa32b..af7ce100d83 100644 --- a/spec/frontend/jobs/components/job_container_item_spec.js +++ b/spec/frontend/jobs/components/job_container_item_spec.js @@ -82,7 +82,7 @@ describe('JobContainerItem', () => { ); }); - it('displays remaining time in tooltip', done => { + it('displays remaining time in tooltip', (done) => { vm = mountComponent(Component, { job: delayedJobFixture, isActive: false, diff --git a/spec/frontend/jobs/components/job_log_controllers_spec.js b/spec/frontend/jobs/components/job_log_controllers_spec.js index 233cef05622..97b0333cb32 100644 --- a/spec/frontend/jobs/components/job_log_controllers_spec.js +++ b/spec/frontend/jobs/components/job_log_controllers_spec.js @@ -21,7 +21,7 @@ describe('Job log controllers', () => { isTraceSizeVisible: true, }; - const createWrapper = props => { + const createWrapper = (props) => { wrapper = mount(JobLogControllers, { propsData: { ...defaultProps, diff --git a/spec/frontend/jobs/components/log/line_spec.js b/spec/frontend/jobs/components/log/line_spec.js index a127ee98c2a..367154e7f82 100644 --- a/spec/frontend/jobs/components/log/line_spec.js +++ b/spec/frontend/jobs/components/log/line_spec.js @@ -34,7 +34,7 @@ describe('Job Log Line', () => { const findLine = () => wrapper.find('span'); const findLink = () => findLine().find('a'); const findLinks = () => findLine().findAll('a'); - const findLinkAttributeByIndex = i => findLinks().at(i).attributes(); + const findLinkAttributeByIndex = (i) => findLinks().at(i).attributes(); beforeEach(() => { data = mockProps(); diff --git a/spec/frontend/jobs/components/manual_variables_form_spec.js b/spec/frontend/jobs/components/manual_variables_form_spec.js index 547f146cf88..f6c37407e2b 100644 --- a/spec/frontend/jobs/components/manual_variables_form_spec.js +++ b/spec/frontend/jobs/components/manual_variables_form_spec.js @@ -27,7 +27,7 @@ describe('Manual Variables Form', () => { factory(requiredProps); }); - afterEach(done => { + afterEach((done) => { // The component has a `nextTick` callback after some events so we need // to wait for those to finish before destroying. setImmediate(() => { @@ -54,7 +54,7 @@ describe('Manual Variables Form', () => { }); describe('when adding a new variable', () => { - it('creates a new variable when user types a new key and resets the form', done => { + it('creates a new variable when user types a new key and resets the form', (done) => { wrapper.vm .$nextTick() .then(() => wrapper.find({ ref: 'inputKey' }).setValue('new key')) @@ -67,7 +67,7 @@ describe('Manual Variables Form', () => { .catch(done.fail); }); - it('creates a new variable when user types a new value and resets the form', done => { + it('creates a new variable when user types a new value and resets the form', (done) => { wrapper.vm .$nextTick() .then(() => wrapper.find({ ref: 'inputSecretValue' }).setValue('new value')) @@ -82,7 +82,7 @@ describe('Manual Variables Form', () => { }); describe('when deleting a variable', () => { - beforeEach(done => { + beforeEach((done) => { wrapper.vm.variables = [ { key: 'new key', diff --git a/spec/frontend/jobs/components/stuck_block_spec.js b/spec/frontend/jobs/components/stuck_block_spec.js index 926286bf75a..4db73eaaaec 100644 --- a/spec/frontend/jobs/components/stuck_block_spec.js +++ b/spec/frontend/jobs/components/stuck_block_spec.js @@ -12,7 +12,7 @@ describe('Stuck Block Job component', () => { } }); - const createWrapper = props => { + const createWrapper = (props) => { wrapper = shallowMount(StuckBlock, { propsData: { ...props, diff --git a/spec/frontend/jobs/components/trigger_block_spec.js b/spec/frontend/jobs/components/trigger_block_spec.js index 448197b82c0..a4bdd904d6c 100644 --- a/spec/frontend/jobs/components/trigger_block_spec.js +++ b/spec/frontend/jobs/components/trigger_block_spec.js @@ -32,7 +32,7 @@ describe('Trigger block', () => { describe('with variables', () => { describe('hide/reveal variables', () => { - it('should toggle variables on click', done => { + it('should toggle variables on click', (done) => { vm = mountComponent(Component, { trigger: { short_token: 'bd7e', diff --git a/spec/frontend/jobs/store/actions_spec.js b/spec/frontend/jobs/store/actions_spec.js index 26547d12ac7..ade755045a5 100644 --- a/spec/frontend/jobs/store/actions_spec.js +++ b/spec/frontend/jobs/store/actions_spec.js @@ -40,7 +40,7 @@ describe('Job State actions', () => { }); describe('setJobEndpoint', () => { - it('should commit SET_JOB_ENDPOINT mutation', done => { + it('should commit SET_JOB_ENDPOINT mutation', (done) => { testAction( setJobEndpoint, 'job/872324.json', @@ -53,7 +53,7 @@ describe('Job State actions', () => { }); describe('setTraceOptions', () => { - it('should commit SET_TRACE_OPTIONS mutation', done => { + it('should commit SET_TRACE_OPTIONS mutation', (done) => { testAction( setTraceOptions, { pagePath: 'job/872324/trace.json' }, @@ -66,26 +66,26 @@ describe('Job State actions', () => { }); describe('hideSidebar', () => { - it('should commit HIDE_SIDEBAR mutation', done => { + it('should commit HIDE_SIDEBAR mutation', (done) => { testAction(hideSidebar, null, mockedState, [{ type: types.HIDE_SIDEBAR }], [], done); }); }); describe('showSidebar', () => { - it('should commit HIDE_SIDEBAR mutation', done => { + it('should commit HIDE_SIDEBAR mutation', (done) => { testAction(showSidebar, null, mockedState, [{ type: types.SHOW_SIDEBAR }], [], done); }); }); describe('toggleSidebar', () => { describe('when isSidebarOpen is true', () => { - it('should dispatch hideSidebar', done => { + it('should dispatch hideSidebar', (done) => { testAction(toggleSidebar, null, mockedState, [], [{ type: 'hideSidebar' }], done); }); }); describe('when isSidebarOpen is false', () => { - it('should dispatch showSidebar', done => { + it('should dispatch showSidebar', (done) => { mockedState.isSidebarOpen = false; testAction(toggleSidebar, null, mockedState, [], [{ type: 'showSidebar' }], done); @@ -94,7 +94,7 @@ describe('Job State actions', () => { }); describe('requestJob', () => { - it('should commit REQUEST_JOB mutation', done => { + it('should commit REQUEST_JOB mutation', (done) => { testAction(requestJob, null, mockedState, [{ type: types.REQUEST_JOB }], [], done); }); }); @@ -114,7 +114,7 @@ describe('Job State actions', () => { }); describe('success', () => { - it('dispatches requestJob and receiveJobSuccess ', done => { + it('dispatches requestJob and receiveJobSuccess ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, { id: 121212, name: 'karma' }); testAction( @@ -141,7 +141,7 @@ describe('Job State actions', () => { mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500); }); - it('dispatches requestJob and receiveJobError ', done => { + it('dispatches requestJob and receiveJobError ', (done) => { testAction( fetchJob, null, @@ -160,7 +160,7 @@ describe('Job State actions', () => { }); }); - it('fetchTrace is called only if the job has started or has a trace', done => { + it('fetchTrace is called only if the job has started or has a trace', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, { id: 121212, name: 'karma' }); mockedState.job.started = true; @@ -188,7 +188,7 @@ describe('Job State actions', () => { }); describe('receiveJobSuccess', () => { - it('should commit RECEIVE_JOB_SUCCESS mutation', done => { + it('should commit RECEIVE_JOB_SUCCESS mutation', (done) => { testAction( receiveJobSuccess, { id: 121232132 }, @@ -201,25 +201,25 @@ describe('Job State actions', () => { }); describe('receiveJobError', () => { - it('should commit RECEIVE_JOB_ERROR mutation', done => { + it('should commit RECEIVE_JOB_ERROR mutation', (done) => { testAction(receiveJobError, null, mockedState, [{ type: types.RECEIVE_JOB_ERROR }], [], done); }); }); describe('scrollTop', () => { - it('should dispatch toggleScrollButtons action', done => { + it('should dispatch toggleScrollButtons action', (done) => { testAction(scrollTop, null, mockedState, [], [{ type: 'toggleScrollButtons' }], done); }); }); describe('scrollBottom', () => { - it('should dispatch toggleScrollButtons action', done => { + it('should dispatch toggleScrollButtons action', (done) => { testAction(scrollBottom, null, mockedState, [], [{ type: 'toggleScrollButtons' }], done); }); }); describe('requestTrace', () => { - it('should commit REQUEST_TRACE mutation', done => { + it('should commit REQUEST_TRACE mutation', (done) => { testAction(requestTrace, null, mockedState, [{ type: types.REQUEST_TRACE }], [], done); }); }); @@ -239,7 +239,7 @@ describe('Job State actions', () => { }); describe('success', () => { - it('dispatches requestTrace, receiveTraceSuccess and stopPollingTrace when job is complete', done => { + it('dispatches requestTrace, receiveTraceSuccess and stopPollingTrace when job is complete', (done) => { mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(200, { html: 'I, [2018-08-17T22:57:45.707325 #1841] INFO -- :', complete: true, @@ -282,7 +282,7 @@ describe('Job State actions', () => { mock.onGet(`${TEST_HOST}/endpoint/trace.json`).replyOnce(200, tracePayload); }); - it('dispatches startPollingTrace', done => { + it('dispatches startPollingTrace', (done) => { testAction( fetchTrace, null, @@ -297,7 +297,7 @@ describe('Job State actions', () => { ); }); - it('does not dispatch startPollingTrace when timeout is non-empty', done => { + it('does not dispatch startPollingTrace when timeout is non-empty', (done) => { mockedState.traceTimeout = 1; testAction( @@ -320,7 +320,7 @@ describe('Job State actions', () => { mock.onGet(`${TEST_HOST}/endpoint/trace.json`).reply(500); }); - it('dispatches requestTrace and receiveTraceError ', done => { + it('dispatches requestTrace and receiveTraceError ', (done) => { testAction( fetchTrace, null, @@ -385,7 +385,7 @@ describe('Job State actions', () => { window.clearTimeout = origTimeout; }); - it('should commit STOP_POLLING_TRACE mutation ', done => { + it('should commit STOP_POLLING_TRACE mutation ', (done) => { const traceTimeout = 7; testAction( @@ -404,7 +404,7 @@ describe('Job State actions', () => { }); describe('receiveTraceSuccess', () => { - it('should commit RECEIVE_TRACE_SUCCESS mutation ', done => { + it('should commit RECEIVE_TRACE_SUCCESS mutation ', (done) => { testAction( receiveTraceSuccess, 'hello world', @@ -417,13 +417,13 @@ describe('Job State actions', () => { }); describe('receiveTraceError', () => { - it('should commit stop polling trace', done => { + it('should commit stop polling trace', (done) => { testAction(receiveTraceError, null, mockedState, [], [{ type: 'stopPollingTrace' }], done); }); }); describe('toggleCollapsibleLine', () => { - it('should commit TOGGLE_COLLAPSIBLE_LINE mutation ', done => { + it('should commit TOGGLE_COLLAPSIBLE_LINE mutation ', (done) => { testAction( toggleCollapsibleLine, { isClosed: true }, @@ -436,7 +436,7 @@ describe('Job State actions', () => { }); describe('requestJobsForStage', () => { - it('should commit REQUEST_JOBS_FOR_STAGE mutation ', done => { + it('should commit REQUEST_JOBS_FOR_STAGE mutation ', (done) => { testAction( requestJobsForStage, { name: 'deploy' }, @@ -460,7 +460,7 @@ describe('Job State actions', () => { }); describe('success', () => { - it('dispatches requestJobsForStage and receiveJobsForStageSuccess ', done => { + it('dispatches requestJobsForStage and receiveJobsForStageSuccess ', (done) => { mock .onGet(`${TEST_HOST}/jobs.json`) .replyOnce(200, { latest_statuses: [{ id: 121212, name: 'build' }], retried: [] }); @@ -490,7 +490,7 @@ describe('Job State actions', () => { mock.onGet(`${TEST_HOST}/jobs.json`).reply(500); }); - it('dispatches requestJobsForStage and receiveJobsForStageError', done => { + it('dispatches requestJobsForStage and receiveJobsForStageError', (done) => { testAction( fetchJobsForStage, { dropdown_path: `${TEST_HOST}/jobs.json` }, @@ -512,7 +512,7 @@ describe('Job State actions', () => { }); describe('receiveJobsForStageSuccess', () => { - it('should commit RECEIVE_JOBS_FOR_STAGE_SUCCESS mutation ', done => { + it('should commit RECEIVE_JOBS_FOR_STAGE_SUCCESS mutation ', (done) => { testAction( receiveJobsForStageSuccess, [{ id: 121212, name: 'karma' }], @@ -525,7 +525,7 @@ describe('Job State actions', () => { }); describe('receiveJobsForStageError', () => { - it('should commit RECEIVE_JOBS_FOR_STAGE_ERROR mutation ', done => { + it('should commit RECEIVE_JOBS_FOR_STAGE_ERROR mutation ', (done) => { testAction( receiveJobsForStageError, null, @@ -548,7 +548,7 @@ describe('Job State actions', () => { mock.restore(); }); - it('should dispatch fetchTrace', done => { + it('should dispatch fetchTrace', (done) => { const playManualJobEndpoint = `${TEST_HOST}/manual-job/jobs/1000/play`; mock.onPost(playManualJobEndpoint).reply(200); diff --git a/spec/frontend/jobs/store/helpers.js b/spec/frontend/jobs/store/helpers.js index 78e33394b63..402ae58971a 100644 --- a/spec/frontend/jobs/store/helpers.js +++ b/spec/frontend/jobs/store/helpers.js @@ -1,5 +1,5 @@ import state from '~/jobs/store/state'; -export const resetStore = store => { +export const resetStore = (store) => { store.replaceState(state()); }; diff --git a/spec/frontend/lazy_loader_spec.js b/spec/frontend/lazy_loader_spec.js index 5eb09bc2359..1d947170709 100644 --- a/spec/frontend/lazy_loader_spec.js +++ b/spec/frontend/lazy_loader_spec.js @@ -4,7 +4,7 @@ import { useMockMutationObserver, useMockIntersectionObserver } from 'helpers/mo import LazyLoader from '~/lazy_loader'; import waitForPromises from './helpers/wait_for_promises'; -const execImmediately = callback => { +const execImmediately = (callback) => { callback(); }; @@ -20,7 +20,7 @@ describe('LazyLoader', () => { triggerMutation(document.body, { options: { childList: true, subtree: true } }); }; - const triggerIntersectionWithRatio = img => { + const triggerIntersectionWithRatio = (img) => { triggerIntersection(img, { entry: { intersectionRatio: 0.1 } }); }; diff --git a/spec/frontend/lib/dompurify_spec.js b/spec/frontend/lib/dompurify_spec.js index ee1971a4931..a01f86678e9 100644 --- a/spec/frontend/lib/dompurify_spec.js +++ b/spec/frontend/lib/dompurify_spec.js @@ -15,8 +15,8 @@ const absoluteGon = { const expectedSanitized = '<svg><use></use></svg>'; const safeUrls = { - root: Object.values(rootGon).map(url => `${url}#ellipsis_h`), - absolute: Object.values(absoluteGon).map(url => `${url}#ellipsis_h`), + root: Object.values(rootGon).map((url) => `${url}#ellipsis_h`), + absolute: Object.values(absoluteGon).map((url) => `${url}#ellipsis_h`), }; const unsafeUrls = [ @@ -60,7 +60,7 @@ describe('~/lib/dompurify', () => { expect(sanitize(htmlHref)).toBe(htmlHref); }); - it.each(safeUrls[type])('allows safe URL %s', url => { + it.each(safeUrls[type])('allows safe URL %s', (url) => { const htmlHref = `<svg><use href="${url}"></use></svg>`; expect(sanitize(htmlHref)).toBe(htmlHref); @@ -68,7 +68,7 @@ describe('~/lib/dompurify', () => { expect(sanitize(htmlXlink)).toBe(htmlXlink); }); - it.each(unsafeUrls)('sanitizes unsafe URL %s', url => { + it.each(unsafeUrls)('sanitizes unsafe URL %s', (url) => { const htmlHref = `<svg><use href="${url}"></use></svg>`; const htmlXlink = `<svg><use xlink:href="${url}"></use></svg>`; @@ -87,7 +87,7 @@ describe('~/lib/dompurify', () => { window.gon = originalGon; }); - it.each([...safeUrls.root, ...safeUrls.absolute, ...unsafeUrls])('sanitizes URL %s', url => { + it.each([...safeUrls.root, ...safeUrls.absolute, ...unsafeUrls])('sanitizes URL %s', (url) => { const htmlHref = `<svg><use href="${url}"></use></svg>`; const htmlXlink = `<svg><use xlink:href="${url}"></use></svg>`; diff --git a/spec/frontend/lib/utils/ajax_cache_spec.js b/spec/frontend/lib/utils/ajax_cache_spec.js index e2ee70b9d69..641dd3684fa 100644 --- a/spec/frontend/lib/utils/ajax_cache_spec.js +++ b/spec/frontend/lib/utils/ajax_cache_spec.js @@ -104,7 +104,7 @@ describe('AjaxCache', () => { it('stores and returns data from Ajax call if cache is empty', () => { mock.onGet(dummyEndpoint).reply(200, dummyResponse); - return AjaxCache.retrieve(dummyEndpoint).then(data => { + return AjaxCache.retrieve(dummyEndpoint).then((data) => { expect(data).toEqual(dummyResponse); expect(AjaxCache.internalStorage[dummyEndpoint]).toEqual(dummyResponse); }); @@ -126,7 +126,7 @@ describe('AjaxCache', () => { mock.onGet(dummyEndpoint).networkError(); expect.assertions(2); - return AjaxCache.retrieve(dummyEndpoint).catch(error => { + return AjaxCache.retrieve(dummyEndpoint).catch((error) => { expect(error.message).toBe(`${dummyEndpoint}: ${errorMessage}`); expect(error.textStatus).toBe(errorMessage); }); @@ -135,7 +135,7 @@ describe('AjaxCache', () => { it('makes no Ajax call if matching data exists', () => { AjaxCache.internalStorage[dummyEndpoint] = dummyResponse; - return AjaxCache.retrieve(dummyEndpoint).then(data => { + return AjaxCache.retrieve(dummyEndpoint).then((data) => { expect(data).toBe(dummyResponse); expect(axios.get).not.toHaveBeenCalled(); }); @@ -153,7 +153,7 @@ describe('AjaxCache', () => { return Promise.all([ AjaxCache.retrieve(dummyEndpoint), AjaxCache.retrieve(dummyEndpoint, true), - ]).then(data => { + ]).then((data) => { expect(data).toEqual([oldDummyResponse, dummyResponse]); }); }); diff --git a/spec/frontend/lib/utils/apollo_startup_js_link_spec.js b/spec/frontend/lib/utils/apollo_startup_js_link_spec.js index faead3ff8fe..c0e5b06651f 100644 --- a/spec/frontend/lib/utils/apollo_startup_js_link_spec.js +++ b/spec/frontend/lib/utils/apollo_startup_js_link_spec.js @@ -58,9 +58,9 @@ describe('StartupJSLink', () => { link = ApolloLink.from([startupLink, new ApolloLink(() => Observable.of(FORWARDED_RESPONSE))]); }; - it('forwards requests if no calls are set up', done => { + it('forwards requests if no calls are set up', (done) => { setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls).toBe(null); expect(startupLink.request).toEqual(StartupJSLink.noopRequest); @@ -68,7 +68,7 @@ describe('StartupJSLink', () => { }); }); - it('forwards requests if the operation is not pre-loaded', done => { + it('forwards requests if the operation is not pre-loaded', (done) => { window.gl = { startup_graphql_calls: [ { @@ -79,7 +79,7 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation({ operationName: 'notLoaded' })).subscribe(result => { + link.request(mockOperation({ operationName: 'notLoaded' })).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(1); done(); @@ -87,7 +87,7 @@ describe('StartupJSLink', () => { }); describe('variable match errors: ', () => { - it('forwards requests if the variables are not matching', done => { + it('forwards requests if the variables are not matching', (done) => { window.gl = { startup_graphql_calls: [ { @@ -98,14 +98,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('forwards requests if more variables are set in the operation', done => { + it('forwards requests if more variables are set in the operation', (done) => { window.gl = { startup_graphql_calls: [ { @@ -115,14 +115,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('forwards requests if less variables are set in the operation', done => { + it('forwards requests if less variables are set in the operation', (done) => { window.gl = { startup_graphql_calls: [ { @@ -133,14 +133,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation({ variables: { id: 3 } })).subscribe(result => { + link.request(mockOperation({ variables: { id: 3 } })).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('forwards requests if different variables are set', done => { + it('forwards requests if different variables are set', (done) => { window.gl = { startup_graphql_calls: [ { @@ -151,14 +151,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation({ variables: { id: 3 } })).subscribe(result => { + link.request(mockOperation({ variables: { id: 3 } })).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('forwards requests if array variables have a different order', done => { + it('forwards requests if array variables have a different order', (done) => { window.gl = { startup_graphql_calls: [ { @@ -169,7 +169,7 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation({ variables: { id: [4, 3] } })).subscribe(result => { + link.request(mockOperation({ variables: { id: [4, 3] } })).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); @@ -178,7 +178,7 @@ describe('StartupJSLink', () => { }); describe('error handling', () => { - it('forwards the call if the fetchCall is failing with a HTTP Error', done => { + it('forwards the call if the fetchCall is failing with a HTTP Error', (done) => { window.gl = { startup_graphql_calls: [ { @@ -189,14 +189,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('forwards the call if it errors (e.g. failing JSON)', done => { + it('forwards the call if it errors (e.g. failing JSON)', (done) => { window.gl = { startup_graphql_calls: [ { @@ -207,14 +207,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('forwards the call if the response contains an error', done => { + it('forwards the call if the response contains an error', (done) => { window.gl = { startup_graphql_calls: [ { @@ -225,14 +225,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it("forwards the call if the response doesn't contain a data object", done => { + it("forwards the call if the response doesn't contain a data object", (done) => { window.gl = { startup_graphql_calls: [ { @@ -243,7 +243,7 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); @@ -251,7 +251,7 @@ describe('StartupJSLink', () => { }); }); - it('resolves the request if the operation is matching', done => { + it('resolves the request if the operation is matching', (done) => { window.gl = { startup_graphql_calls: [ { @@ -262,14 +262,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('resolves the request exactly once', done => { + it('resolves the request exactly once', (done) => { window.gl = { startup_graphql_calls: [ { @@ -280,17 +280,17 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation()).subscribe(result => { + link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - link.request(mockOperation()).subscribe(result2 => { + link.request(mockOperation()).subscribe((result2) => { expect(result2).toEqual(FORWARDED_RESPONSE); done(); }); }); }); - it('resolves the request if the variables have a different order', done => { + it('resolves the request if the variables have a different order', (done) => { window.gl = { startup_graphql_calls: [ { @@ -301,14 +301,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation({ variables: { name: 'foo', id: 3 } })).subscribe(result => { + link.request(mockOperation({ variables: { name: 'foo', id: 3 } })).subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('resolves the request if the variables have undefined values', done => { + it('resolves the request if the variables have undefined values', (done) => { window.gl = { startup_graphql_calls: [ { @@ -321,14 +321,14 @@ describe('StartupJSLink', () => { setupLink(); link .request(mockOperation({ variables: { name: 'foo', undef: undefined } })) - .subscribe(result => { + .subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('resolves the request if the variables are of an array format', done => { + it('resolves the request if the variables are of an array format', (done) => { window.gl = { startup_graphql_calls: [ { @@ -339,14 +339,14 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation({ variables: { id: [3, 4] } })).subscribe(result => { + link.request(mockOperation({ variables: { id: [3, 4] } })).subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); }); }); - it('resolves multiple requests correctly', done => { + it('resolves multiple requests correctly', (done) => { window.gl = { startup_graphql_calls: [ { @@ -362,10 +362,10 @@ describe('StartupJSLink', () => { ], }; setupLink(); - link.request(mockOperation({ operationName: OPERATION_NAME_TWO })).subscribe(result => { + link.request(mockOperation({ operationName: OPERATION_NAME_TWO })).subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE_TWO); expect(startupLink.startupCalls.size).toBe(1); - link.request(mockOperation({ operationName: OPERATION_NAME })).subscribe(result2 => { + link.request(mockOperation({ operationName: OPERATION_NAME })).subscribe((result2) => { expect(result2).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); done(); diff --git a/spec/frontend/lib/utils/common_utils_spec.js b/spec/frontend/lib/utils/common_utils_spec.js index 433fb368f55..ddb0495fd1f 100644 --- a/spec/frontend/lib/utils/common_utils_spec.js +++ b/spec/frontend/lib/utils/common_utils_spec.js @@ -267,7 +267,7 @@ describe('common_utils', () => { }); describe('debounceByAnimationFrame', () => { - it('debounces a function to allow a maximum of one call per animation frame', done => { + it('debounces a function to allow a maximum of one call per animation frame', (done) => { const spy = jest.fn(); const debouncedSpy = commonUtils.debounceByAnimationFrame(spy); window.requestAnimationFrame(() => { @@ -404,54 +404,54 @@ describe('common_utils', () => { describe('backOff', () => { beforeEach(() => { // shortcut our timeouts otherwise these tests will take a long time to finish - jest.spyOn(window, 'setTimeout').mockImplementation(cb => setImmediate(cb, 0)); + jest.spyOn(window, 'setTimeout').mockImplementation((cb) => setImmediate(cb, 0)); }); - it('solves the promise from the callback', done => { + it('solves the promise from the callback', (done) => { const expectedResponseValue = 'Success!'; commonUtils .backOff((next, stop) => - new Promise(resolve => { + new Promise((resolve) => { resolve(expectedResponseValue); }) - .then(resp => { + .then((resp) => { stop(resp); }) .catch(done.fail), ) - .then(respBackoff => { + .then((respBackoff) => { expect(respBackoff).toBe(expectedResponseValue); done(); }) .catch(done.fail); }); - it('catches the rejected promise from the callback ', done => { + it('catches the rejected promise from the callback ', (done) => { const errorMessage = 'Mistakes were made!'; commonUtils .backOff((next, stop) => { new Promise((resolve, reject) => { reject(new Error(errorMessage)); }) - .then(resp => { + .then((resp) => { stop(resp); }) - .catch(err => stop(err)); + .catch((err) => stop(err)); }) - .catch(errBackoffResp => { + .catch((errBackoffResp) => { expect(errBackoffResp instanceof Error).toBe(true); expect(errBackoffResp.message).toBe(errorMessage); done(); }); }); - it('solves the promise correctly after retrying a third time', done => { + it('solves the promise correctly after retrying a third time', (done) => { let numberOfCalls = 1; const expectedResponseValue = 'Success!'; commonUtils .backOff((next, stop) => Promise.resolve(expectedResponseValue) - .then(resp => { + .then((resp) => { if (numberOfCalls < 3) { numberOfCalls += 1; next(); @@ -461,7 +461,7 @@ describe('common_utils', () => { }) .catch(done.fail), ) - .then(respBackoff => { + .then((respBackoff) => { const timeouts = window.setTimeout.mock.calls.map(([, timeout]) => timeout); expect(timeouts).toEqual([2000, 4000]); @@ -471,10 +471,10 @@ describe('common_utils', () => { .catch(done.fail); }); - it('rejects the backOff promise after timing out', done => { + it('rejects the backOff promise after timing out', (done) => { commonUtils - .backOff(next => next(), 64000) - .catch(errBackoffResp => { + .backOff((next) => next(), 64000) + .catch((errBackoffResp) => { const timeouts = window.setTimeout.mock.calls.map(([, timeout]) => timeout); expect(timeouts).toEqual([2000, 4000, 8000, 16000, 32000, 32000]); @@ -533,8 +533,8 @@ describe('common_utils', () => { }); describe('convertObjectProps*', () => { - const mockConversionFunction = prop => `${prop}_converted`; - const isEmptyObject = obj => + const mockConversionFunction = (prop) => `${prop}_converted`; + const isEmptyObject = (obj) => typeof obj === 'object' && obj !== null && Object.keys(obj).length === 0; const mockObjects = { diff --git a/spec/frontend/lib/utils/datetime_range_spec.js b/spec/frontend/lib/utils/datetime_range_spec.js index 8b1f284615d..996a8e2e47b 100644 --- a/spec/frontend/lib/utils/datetime_range_spec.js +++ b/spec/frontend/lib/utils/datetime_range_spec.js @@ -64,7 +64,7 @@ describe('Date time range utils', () => { }; Object.entries(rangeTypes).forEach(([type, examples]) => { - examples.forEach(example => expect(getRangeType(example)).toEqual(type)); + examples.forEach((example) => expect(getRangeType(example)).toEqual(type)); }); }); }); diff --git a/spec/frontend/lib/utils/datetime_utility_spec.js b/spec/frontend/lib/utils/datetime_utility_spec.js index 6092b44720f..698d6cd277f 100644 --- a/spec/frontend/lib/utils/datetime_utility_spec.js +++ b/spec/frontend/lib/utils/datetime_utility_spec.js @@ -566,7 +566,7 @@ describe('getDatesInRange', () => { it('applies mapper function if provided fro each item in range', () => { const d1 = new Date('2019-01-01'); const d2 = new Date('2019-01-31'); - const formatter = date => date.getDate(); + const formatter = (date) => date.getDate(); const range = datetimeUtility.getDatesInRange(d1, d2, formatter); diff --git a/spec/frontend/lib/utils/dom_utils_spec.js b/spec/frontend/lib/utils/dom_utils_spec.js index f5c2a797df5..7c4c20e651f 100644 --- a/spec/frontend/lib/utils/dom_utils_spec.js +++ b/spec/frontend/lib/utils/dom_utils_spec.js @@ -45,7 +45,7 @@ describe('DOM Utils', () => { }); describe('canScrollUp', () => { - [1, 100].forEach(scrollTop => { + [1, 100].forEach((scrollTop) => { it(`is true if scrollTop is > 0 (${scrollTop})`, () => { expect( canScrollUp({ @@ -55,7 +55,7 @@ describe('DOM Utils', () => { }); }); - [0, -10].forEach(scrollTop => { + [0, -10].forEach((scrollTop) => { it(`is false if scrollTop is <= 0 (${scrollTop})`, () => { expect( canScrollUp({ diff --git a/spec/frontend/lib/utils/forms_spec.js b/spec/frontend/lib/utils/forms_spec.js index a69be99ab98..f65bd8ffe0c 100644 --- a/spec/frontend/lib/utils/forms_spec.js +++ b/spec/frontend/lib/utils/forms_spec.js @@ -1,7 +1,7 @@ import { serializeForm, serializeFormObject, isEmptyValue } from '~/lib/utils/forms'; describe('lib/utils/forms', () => { - const createDummyForm = inputs => { + const createDummyForm = (inputs) => { const form = document.createElement('form'); form.innerHTML = inputs @@ -9,7 +9,7 @@ describe('lib/utils/forms', () => { let str = ``; if (type === 'select') { str = `<select name="${name}">`; - value.forEach(v => { + value.forEach((v) => { if (v.length > 0) { str += `<option value="${v}"></option> `; } @@ -81,8 +81,8 @@ describe('lib/utils/forms', () => { jest .spyOn(FormData.prototype, 'getAll') - .mockImplementation(name => - formData.map(elem => (elem.name === name ? elem.value : undefined)), + .mockImplementation((name) => + formData.map((elem) => (elem.name === name ? elem.value : undefined)), ); const data = serializeForm(form); diff --git a/spec/frontend/lib/utils/highlight_spec.js b/spec/frontend/lib/utils/highlight_spec.js index 638bbf65ae9..f34e203f9a4 100644 --- a/spec/frontend/lib/utils/highlight_spec.js +++ b/spec/frontend/lib/utils/highlight_spec.js @@ -8,13 +8,13 @@ describe('highlight', () => { }); it(`should return an empty string in the case of invalid inputs`, () => { - [null, undefined].forEach(input => { + [null, undefined].forEach((input) => { expect(highlight(input, 'match')).toBe(''); }); }); it(`should return the original value if match is null, undefined, or ''`, () => { - [null, undefined].forEach(match => { + [null, undefined].forEach((match) => { expect(highlight('gitlab', match)).toBe('gitlab'); }); }); diff --git a/spec/frontend/lib/utils/icon_utils_spec.js b/spec/frontend/lib/utils/icon_utils_spec.js index f798dc6744d..db1f174703b 100644 --- a/spec/frontend/lib/utils/icon_utils_spec.js +++ b/spec/frontend/lib/utils/icon_utils_spec.js @@ -34,13 +34,13 @@ describe('Icon utils', () => { }); it('extracts svg icon path content from sprite icons', () => { - return getSvgIconPathContent(mockName).then(path => { + return getSvgIconPathContent(mockName).then((path) => { expect(path).toBe(mockPath); }); }); it('returns null if icon path content does not exist', () => { - return getSvgIconPathContent('missing-icon').then(path => { + return getSvgIconPathContent('missing-icon').then((path) => { expect(path).toBe(null); }); }); @@ -58,22 +58,22 @@ describe('Icon utils', () => { }); it('returns null', () => { - return getSvgIconPathContent(mockName).then(path => { + return getSvgIconPathContent(mockName).then((path) => { expect(path).toBe(null); }); }); it('extracts svg icon path content, after 2 attempts', () => { return getSvgIconPathContent(mockName) - .then(path1 => { + .then((path1) => { expect(path1).toBe(null); return getSvgIconPathContent(mockName); }) - .then(path2 => { + .then((path2) => { expect(path2).toBe(null); return getSvgIconPathContent(mockName); }) - .then(path3 => { + .then((path3) => { expect(path3).toBe(mockPath); }); }); diff --git a/spec/frontend/lib/utils/poll_spec.js b/spec/frontend/lib/utils/poll_spec.js index 135c752b5cb..f2ca5df3672 100644 --- a/spec/frontend/lib/utils/poll_spec.js +++ b/spec/frontend/lib/utils/poll_spec.js @@ -50,7 +50,7 @@ describe('Poll', () => { }; }); - it('calls the success callback when no header for interval is provided', done => { + it('calls the success callback when no header for interval is provided', (done) => { mockServiceCall({ status: 200 }); setup(); @@ -62,7 +62,7 @@ describe('Poll', () => { }); }); - it('calls the error callback when the http request returns an error', done => { + it('calls the error callback when the http request returns an error', (done) => { mockServiceCall({ status: 500 }, true); setup(); @@ -74,7 +74,7 @@ describe('Poll', () => { }); }); - it('skips the error callback when request is aborted', done => { + it('skips the error callback when request is aborted', (done) => { mockServiceCall({ status: 0 }, true); setup(); @@ -87,7 +87,7 @@ describe('Poll', () => { }); }); - it('should call the success callback when the interval header is -1', done => { + it('should call the success callback when the interval header is -1', (done) => { mockServiceCall({ status: 200, headers: { 'poll-interval': -1 } }); setup() .then(() => { @@ -100,8 +100,8 @@ describe('Poll', () => { }); describe('for 2xx status code', () => { - successCodes.forEach(httpCode => { - it(`starts polling when http status is ${httpCode} and interval header is provided`, done => { + successCodes.forEach((httpCode) => { + it(`starts polling when http status is ${httpCode} and interval header is provided`, (done) => { mockServiceCall({ status: httpCode, headers: { 'poll-interval': 1 } }); const Polling = new Poll({ @@ -129,7 +129,7 @@ describe('Poll', () => { }); describe('with delayed initial request', () => { - it('delays the first request', async done => { + it('delays the first request', async (done) => { mockServiceCall({ status: 200, headers: { 'poll-interval': 1 } }); const Polling = new Poll({ @@ -158,7 +158,7 @@ describe('Poll', () => { }); describe('stop', () => { - it('stops polling when method is called', done => { + it('stops polling when method is called', (done) => { mockServiceCall({ status: 200, headers: { 'poll-interval': 1 } }); const Polling = new Poll({ @@ -186,7 +186,7 @@ describe('Poll', () => { }); describe('enable', () => { - it('should enable polling upon a response', done => { + it('should enable polling upon a response', (done) => { mockServiceCall({ status: 200 }); const Polling = new Poll({ resource: service, @@ -212,7 +212,7 @@ describe('Poll', () => { }); describe('restart', () => { - it('should restart polling when its called', done => { + it('should restart polling when its called', (done) => { mockServiceCall({ status: 200, headers: { 'poll-interval': 1 } }); const Polling = new Poll({ diff --git a/spec/frontend/lib/utils/poll_until_complete_spec.js b/spec/frontend/lib/utils/poll_until_complete_spec.js index c1df30756fd..38203c460e3 100644 --- a/spec/frontend/lib/utils/poll_until_complete_spec.js +++ b/spec/frontend/lib/utils/poll_until_complete_spec.js @@ -70,7 +70,7 @@ describe('pollUntilComplete', () => { }); it('rejects with the error response', () => - pollUntilComplete(endpoint).catch(error => { + pollUntilComplete(endpoint).catch((error) => { expect(error.response.data).toBe(errorMessage); })); }); diff --git a/spec/frontend/lib/utils/text_utility_spec.js b/spec/frontend/lib/utils/text_utility_spec.js index 9c50bf577dc..1f3659b5c76 100644 --- a/spec/frontend/lib/utils/text_utility_spec.js +++ b/spec/frontend/lib/utils/text_utility_spec.js @@ -300,13 +300,13 @@ describe('text_utility', () => { }); it(`should return an empty string for invalid inputs`, () => { - [undefined, null, 4, {}, true, new Date()].forEach(input => { + [undefined, null, 4, {}, true, new Date()].forEach((input) => { expect(textUtils.truncateNamespace(input)).toBe(''); }); }); it(`should not alter strings that aren't formatted as namespaces`, () => { - ['', ' ', '\t', 'a', 'a \\ b'].forEach(input => { + ['', ' ', '\t', 'a', 'a \\ b'].forEach((input) => { expect(textUtils.truncateNamespace(input)).toBe(input); }); }); diff --git a/spec/frontend/lib/utils/url_utility_spec.js b/spec/frontend/lib/utils/url_utility_spec.js index 0f9290e36b5..5846acbdb79 100644 --- a/spec/frontend/lib/utils/url_utility_spec.js +++ b/spec/frontend/lib/utils/url_utility_spec.js @@ -15,7 +15,7 @@ const shas = { ], }; -const setWindowLocation = value => { +const setWindowLocation = (value) => { Object.defineProperty(window, 'location', { writable: true, value, @@ -337,7 +337,7 @@ describe('URL utility', () => { describe('urlContainsSha', () => { it('returns true when there is a valid 40-character SHA1 hash in the URL', () => { - shas.valid.forEach(sha => { + shas.valid.forEach((sha) => { expect( urlUtils.urlContainsSha({ url: `http://urlstuff/${sha}/moreurlstuff` }), ).toBeTruthy(); @@ -345,7 +345,7 @@ describe('URL utility', () => { }); it('returns false when there is not a valid 40-character SHA1 hash in the URL', () => { - shas.invalid.forEach(str => { + shas.invalid.forEach((str) => { expect(urlUtils.urlContainsSha({ url: `http://urlstuff/${str}/moreurlstuff` })).toBeFalsy(); }); }); @@ -356,8 +356,8 @@ describe('URL utility', () => { let invalidUrls = []; beforeAll(() => { - validUrls = shas.valid.map(sha => `http://urlstuff/${sha}/moreurlstuff`); - invalidUrls = shas.invalid.map(str => `http://urlstuff/${str}/moreurlstuff`); + validUrls = shas.valid.map((sha) => `http://urlstuff/${sha}/moreurlstuff`); + invalidUrls = shas.invalid.map((str) => `http://urlstuff/${str}/moreurlstuff`); }); it('returns the valid 40-character SHA1 hash from the URL', () => { @@ -367,7 +367,7 @@ describe('URL utility', () => { }); it('returns null from a URL with no valid 40-character SHA1 hash', () => { - invalidUrls.forEach(url => { + invalidUrls.forEach((url) => { expect(urlUtils.getShaFromUrl({ url })).toBeNull(); }); }); @@ -589,11 +589,11 @@ describe('URL utility', () => { ]; describe('with URL constructor support', () => { - it.each(safeUrls)('returns true for %s', url => { + it.each(safeUrls)('returns true for %s', (url) => { expect(urlUtils.isSafeURL(url)).toBe(true); }); - it.each(unsafeUrls)('returns false for %s', url => { + it.each(unsafeUrls)('returns false for %s', (url) => { expect(urlUtils.isSafeURL(url)).toBe(false); }); }); @@ -807,7 +807,7 @@ describe('URL utility', () => { it.each([[httpProtocol], [httpsProtocol]])( 'when no url passed, returns correct protocol for %i from window location', - protocol => { + (protocol) => { setWindowLocation({ protocol, }); diff --git a/spec/frontend/lib/utils/users_cache_spec.js b/spec/frontend/lib/utils/users_cache_spec.js index 7ed87123482..bc00a5d5409 100644 --- a/spec/frontend/lib/utils/users_cache_spec.js +++ b/spec/frontend/lib/utils/users_cache_spec.js @@ -91,7 +91,7 @@ describe('UsersCache', () => { jest.spyOn(Api, 'users').mockImplementation((query, options) => apiSpy(query, options)); }); - it('stores and returns data from API call if cache is empty', done => { + it('stores and returns data from API call if cache is empty', (done) => { apiSpy = (query, options) => { expect(query).toBe(''); expect(options).toEqual({ @@ -104,7 +104,7 @@ describe('UsersCache', () => { }; UsersCache.retrieve(dummyUsername) - .then(user => { + .then((user) => { expect(user).toBe(dummyUser); expect(UsersCache.internalStorage[dummyUsername]).toBe(dummyUser); }) @@ -112,7 +112,7 @@ describe('UsersCache', () => { .catch(done.fail); }); - it('returns undefined if Ajax call fails and cache is empty', done => { + it('returns undefined if Ajax call fails and cache is empty', (done) => { const dummyError = new Error('server exploded'); apiSpy = (query, options) => { @@ -125,21 +125,21 @@ describe('UsersCache', () => { }; UsersCache.retrieve(dummyUsername) - .then(user => done.fail(`Received unexpected user: ${JSON.stringify(user)}`)) - .catch(error => { + .then((user) => done.fail(`Received unexpected user: ${JSON.stringify(user)}`)) + .catch((error) => { expect(error).toBe(dummyError); }) .then(done) .catch(done.fail); }); - it('makes no Ajax call if matching data exists', done => { + it('makes no Ajax call if matching data exists', (done) => { UsersCache.internalStorage[dummyUsername] = dummyUser; apiSpy = () => done.fail(new Error('expected no Ajax call!')); UsersCache.retrieve(dummyUsername) - .then(user => { + .then((user) => { expect(user).toBe(dummyUser); }) .then(done) @@ -151,11 +151,11 @@ describe('UsersCache', () => { let apiSpy; beforeEach(() => { - jest.spyOn(Api, 'user').mockImplementation(id => apiSpy(id)); + jest.spyOn(Api, 'user').mockImplementation((id) => apiSpy(id)); }); - it('stores and returns data from API call if cache is empty', done => { - apiSpy = id => { + it('stores and returns data from API call if cache is empty', (done) => { + apiSpy = (id) => { expect(id).toBe(dummyUserId); return Promise.resolve({ @@ -164,7 +164,7 @@ describe('UsersCache', () => { }; UsersCache.retrieveById(dummyUserId) - .then(user => { + .then((user) => { expect(user).toBe(dummyUser); expect(UsersCache.internalStorage[dummyUserId]).toBe(dummyUser); }) @@ -172,31 +172,31 @@ describe('UsersCache', () => { .catch(done.fail); }); - it('returns undefined if Ajax call fails and cache is empty', done => { + it('returns undefined if Ajax call fails and cache is empty', (done) => { const dummyError = new Error('server exploded'); - apiSpy = id => { + apiSpy = (id) => { expect(id).toBe(dummyUserId); return Promise.reject(dummyError); }; UsersCache.retrieveById(dummyUserId) - .then(user => done.fail(`Received unexpected user: ${JSON.stringify(user)}`)) - .catch(error => { + .then((user) => done.fail(`Received unexpected user: ${JSON.stringify(user)}`)) + .catch((error) => { expect(error).toBe(dummyError); }) .then(done) .catch(done.fail); }); - it('makes no Ajax call if matching data exists', done => { + it('makes no Ajax call if matching data exists', (done) => { UsersCache.internalStorage[dummyUserId] = dummyUser; apiSpy = () => done.fail(new Error('expected no Ajax call!')); UsersCache.retrieveById(dummyUserId) - .then(user => { + .then((user) => { expect(user).toBe(dummyUser); }) .then(done) @@ -208,11 +208,11 @@ describe('UsersCache', () => { let apiSpy; beforeEach(() => { - jest.spyOn(Api, 'userStatus').mockImplementation(id => apiSpy(id)); + jest.spyOn(Api, 'userStatus').mockImplementation((id) => apiSpy(id)); }); - it('stores and returns data from API call if cache is empty', done => { - apiSpy = id => { + it('stores and returns data from API call if cache is empty', (done) => { + apiSpy = (id) => { expect(id).toBe(dummyUserId); return Promise.resolve({ @@ -221,7 +221,7 @@ describe('UsersCache', () => { }; UsersCache.retrieveStatusById(dummyUserId) - .then(userStatus => { + .then((userStatus) => { expect(userStatus).toBe(dummyUserStatus); expect(UsersCache.internalStorage[dummyUserId].status).toBe(dummyUserStatus); }) @@ -229,25 +229,25 @@ describe('UsersCache', () => { .catch(done.fail); }); - it('returns undefined if Ajax call fails and cache is empty', done => { + it('returns undefined if Ajax call fails and cache is empty', (done) => { const dummyError = new Error('server exploded'); - apiSpy = id => { + apiSpy = (id) => { expect(id).toBe(dummyUserId); return Promise.reject(dummyError); }; UsersCache.retrieveStatusById(dummyUserId) - .then(userStatus => done.fail(`Received unexpected user: ${JSON.stringify(userStatus)}`)) - .catch(error => { + .then((userStatus) => done.fail(`Received unexpected user: ${JSON.stringify(userStatus)}`)) + .catch((error) => { expect(error).toBe(dummyError); }) .then(done) .catch(done.fail); }); - it('makes no Ajax call if matching data exists', done => { + it('makes no Ajax call if matching data exists', (done) => { UsersCache.internalStorage[dummyUserId] = { status: dummyUserStatus, }; @@ -255,7 +255,7 @@ describe('UsersCache', () => { apiSpy = () => done.fail(new Error('expected no Ajax call!')); UsersCache.retrieveStatusById(dummyUserId) - .then(userStatus => { + .then((userStatus) => { expect(userStatus).toBe(dummyUserStatus); }) .then(done) diff --git a/spec/frontend/logs/components/environment_logs_spec.js b/spec/frontend/logs/components/environment_logs_spec.js index 74e924a8f6e..351ff317feb 100644 --- a/spec/frontend/logs/components/environment_logs_spec.js +++ b/spec/frontend/logs/components/environment_logs_spec.js @@ -20,7 +20,7 @@ jest.mock('~/lib/utils/scroll_utils'); const module = 'environmentLogs'; jest.mock('lodash/throttle', () => - jest.fn(func => { + jest.fn((func) => { return func; }), ); @@ -59,7 +59,7 @@ describe('EnvironmentLogs', () => { const findInfiniteScroll = () => wrapper.find({ ref: 'infiniteScroll' }); const findLogTrace = () => wrapper.find({ ref: 'logTrace' }); const findLogFooter = () => wrapper.find({ ref: 'logFooter' }); - const getInfiniteScrollAttr = attr => parseInt(findInfiniteScroll().attributes(attr), 10); + const getInfiniteScrollAttr = (attr) => parseInt(findInfiniteScroll().attributes(attr), 10); const mockSetInitData = () => { state.pods.options = mockPods; @@ -213,7 +213,7 @@ describe('EnvironmentLogs', () => { describe('state with data', () => { beforeEach(() => { - dispatch.mockImplementation(actionName => { + dispatch.mockImplementation((actionName) => { if (actionName === `${module}/setInitData`) { mockSetInitData(); } else if (actionName === `${module}/showPodLogs`) { diff --git a/spec/frontend/logs/components/log_advanced_filters_spec.js b/spec/frontend/logs/components/log_advanced_filters_spec.js index c865629ce7e..dfa8913a301 100644 --- a/spec/frontend/logs/components/log_advanced_filters_spec.js +++ b/spec/frontend/logs/components/log_advanced_filters_spec.js @@ -18,10 +18,10 @@ describe('LogAdvancedFilters', () => { const findFilteredSearch = () => wrapper.find(GlFilteredSearch); const findTimeRangePicker = () => wrapper.find({ ref: 'dateTimePicker' }); - const getSearchToken = type => + const getSearchToken = (type) => findFilteredSearch() .props('availableTokens') - .filter(token => token.type === type)[0]; + .filter((token) => token.type === type)[0]; const mockStateLoading = () => { state.timeRange.selected = defaultTimeRange; diff --git a/spec/frontend/logs/components/log_control_buttons_spec.js b/spec/frontend/logs/components/log_control_buttons_spec.js index dff38ecb15e..55b28445786 100644 --- a/spec/frontend/logs/components/log_control_buttons_spec.js +++ b/spec/frontend/logs/components/log_control_buttons_spec.js @@ -9,7 +9,7 @@ describe('LogControlButtons', () => { const findScrollToBottom = () => wrapper.find('.js-scroll-to-bottom'); const findRefreshBtn = () => wrapper.find('.js-refresh-log'); - const initWrapper = opts => { + const initWrapper = (opts) => { wrapper = shallowMount(LogControlButtons, { listeners: { scrollUp: () => {}, diff --git a/spec/frontend/logs/components/log_simple_filters_spec.js b/spec/frontend/logs/components/log_simple_filters_spec.js index b819f0d25a8..5bd42fd7dbc 100644 --- a/spec/frontend/logs/components/log_simple_filters_spec.js +++ b/spec/frontend/logs/components/log_simple_filters_spec.js @@ -18,7 +18,7 @@ describe('LogSimpleFilters', () => { const findPodsDropdownItems = () => findPodsDropdown() .findAll(GlDropdownItem) - .filter(item => !('disabled' in item.attributes())); + .filter((item) => !('disabled' in item.attributes())); const mockPodsLoading = () => { state.pods.options = []; diff --git a/spec/frontend/logs/stores/actions_spec.js b/spec/frontend/logs/stores/actions_spec.js index e4501abdc76..bc58f1e677f 100644 --- a/spec/frontend/logs/stores/actions_spec.js +++ b/spec/frontend/logs/stores/actions_spec.js @@ -62,7 +62,7 @@ describe('Logs Store actions', () => { const latestGetParams = () => mock.history.get[mock.history.get.length - 1].params; - convertToFixedRange.mockImplementation(range => { + convertToFixedRange.mockImplementation((range) => { if (range === defaultTimeRange) { return { ...mockDefaultRange }; } diff --git a/spec/frontend/logs/stores/mutations_spec.js b/spec/frontend/logs/stores/mutations_spec.js index 4a095e0f26e..51f6494b011 100644 --- a/spec/frontend/logs/stores/mutations_spec.js +++ b/spec/frontend/logs/stores/mutations_spec.js @@ -23,7 +23,7 @@ describe('Logs Store Mutations', () => { }); it('ensures mutation types are correctly named', () => { - Object.keys(types).forEach(k => { + Object.keys(types).forEach((k) => { expect(k).toEqual(types[k]); }); }); diff --git a/spec/frontend/matchers.js b/spec/frontend/matchers.js index 3db5aba2758..945abdafe9a 100644 --- a/spec/frontend/matchers.js +++ b/spec/frontend/matchers.js @@ -10,7 +10,7 @@ export default { const iconReferences = [].slice.apply(element.querySelectorAll('svg use')); const matchingIcon = iconReferences.find( - reference => reference.parentNode.getAttribute('data-testid') === `${iconName}-icon`, + (reference) => reference.parentNode.getAttribute('data-testid') === `${iconName}-icon`, ); const pass = Boolean(matchingIcon); @@ -21,7 +21,7 @@ export default { } else { message = `${element.outerHTML} does not contain the sprite icon "${iconName}"!`; - const existingIcons = iconReferences.map(reference => { + const existingIcons = iconReferences.map((reference) => { const iconUrl = reference.getAttribute('href'); return `"${iconUrl.replace(/^.+#/, '')}"`; }); diff --git a/spec/frontend/matchers_spec.js b/spec/frontend/matchers_spec.js index 0a2478f978a..dfd6f754c72 100644 --- a/spec/frontend/matchers_spec.js +++ b/spec/frontend/matchers_spec.js @@ -3,7 +3,7 @@ describe('Custom jest matchers', () => { describe('malformed input', () => { it.each([null, 1, Symbol, Array, Object])( 'fails graciously if the expected value is %s', - expected => { + (expected) => { expect(expected).not.toMatchInterpolatedText('null'); }, ); @@ -11,7 +11,7 @@ describe('Custom jest matchers', () => { describe('malformed matcher', () => { it.each([null, 1, Symbol, Array, Object])( 'fails graciously if the matcher is %s', - matcher => { + (matcher) => { expect('null').not.toMatchInterpolatedText(matcher); }, ); diff --git a/spec/frontend/members/components/avatars/user_avatar_spec.js b/spec/frontend/members/components/avatars/user_avatar_spec.js index 7d6a9065975..411ec1a54de 100644 --- a/spec/frontend/members/components/avatars/user_avatar_spec.js +++ b/spec/frontend/members/components/avatars/user_avatar_spec.js @@ -22,7 +22,7 @@ describe('UserAvatar', () => { const getByText = (text, options) => createWrapper(within(wrapper.element).findByText(text, options)); - const findStatusEmoji = emoji => wrapper.find(`gl-emoji[data-name="${emoji}"]`); + const findStatusEmoji = (emoji) => wrapper.find(`gl-emoji[data-name="${emoji}"]`); afterEach(() => { wrapper.destroy(); diff --git a/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js b/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js index 91277ae6d03..0d9f9acbbeb 100644 --- a/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js +++ b/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js @@ -10,7 +10,7 @@ localVue.use(Vuex); describe('FilterSortContainer', () => { let wrapper; - const createComponent = state => { + const createComponent = (state) => { const store = new Vuex.Store({ state: { filteredSearchBar: { diff --git a/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js b/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js index 37f5333343a..2bed1e803ca 100644 --- a/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js +++ b/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js @@ -10,7 +10,7 @@ localVue.use(Vuex); describe('MembersFilteredSearchBar', () => { let wrapper; - const createComponent = state => { + const createComponent = (state) => { const store = new Vuex.Store({ state: { sourceId: 1, diff --git a/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js b/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js index 6fe67aded3d..d98c9116512 100644 --- a/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js +++ b/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js @@ -12,7 +12,7 @@ describe('SortDropdown', () => { const URL_HOST = 'https://localhost/'; - const createComponent = state => { + const createComponent = (state) => { const store = new Vuex.Store({ state: { sourceId: 1, @@ -38,10 +38,10 @@ describe('SortDropdown', () => { const findSortDirectionToggle = () => findSortingComponent().find('button[title="Sort direction"]'); const findDropdownToggle = () => wrapper.find('button[aria-haspopup="true"]'); - const findDropdownItemByText = text => + const findDropdownItemByText = (text) => wrapper .findAll(GlSortingItem) - .wrappers.find(dropdownItemWrapper => dropdownItemWrapper.text() === text); + .wrappers.find((dropdownItemWrapper) => dropdownItemWrapper.text() === text); describe('dropdown options', () => { beforeEach(() => { @@ -76,7 +76,7 @@ describe('SortDropdown', () => { createComponent(); - expectedDropdownItems.forEach(expectedDropdownItem => { + expectedDropdownItems.forEach((expectedDropdownItem) => { const dropdownItem = findDropdownItemByText(expectedDropdownItem.label); expect(dropdownItem).not.toBe(null); diff --git a/spec/frontend/members/components/modals/remove_group_link_modal_spec.js b/spec/frontend/members/components/modals/remove_group_link_modal_spec.js index 593dbcd28ba..234857419b6 100644 --- a/spec/frontend/members/components/modals/remove_group_link_modal_spec.js +++ b/spec/frontend/members/components/modals/remove_group_link_modal_spec.js @@ -31,7 +31,7 @@ describe('RemoveGroupLinkModal', () => { }); }; - const createComponent = state => { + const createComponent = (state) => { wrapper = mount(RemoveGroupLinkModal, { localVue, store: createStore(state), diff --git a/spec/frontend/members/components/table/created_at_spec.js b/spec/frontend/members/components/table/created_at_spec.js index a9f809cd805..dc1f62722ab 100644 --- a/spec/frontend/members/components/table/created_at_spec.js +++ b/spec/frontend/members/components/table/created_at_spec.js @@ -13,7 +13,7 @@ describe('CreatedAt', () => { let wrapper; - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = mount(CreatedAt, { propsData: { date, diff --git a/spec/frontend/members/components/table/expiration_datepicker_spec.js b/spec/frontend/members/components/table/expiration_datepicker_spec.js index 7319989e1d9..0caaafb8d7b 100644 --- a/spec/frontend/members/components/table/expiration_datepicker_spec.js +++ b/spec/frontend/members/components/table/expiration_datepicker_spec.js @@ -25,7 +25,7 @@ describe('ExpirationDatepicker', () => { actions = { updateMemberExpiration: jest.fn( () => - new Promise(resolve => { + new Promise((resolve) => { resolveUpdateMemberExpiration = resolve; }), ), diff --git a/spec/frontend/members/components/table/expires_at_spec.js b/spec/frontend/members/components/table/expires_at_spec.js index cf0fc78656e..321008727cd 100644 --- a/spec/frontend/members/components/table/expires_at_spec.js +++ b/spec/frontend/members/components/table/expires_at_spec.js @@ -10,7 +10,7 @@ describe('ExpiresAt', () => { let wrapper; - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = mount(ExpiresAt, { propsData, directives: { @@ -22,7 +22,7 @@ describe('ExpiresAt', () => { const getByText = (text, options) => createWrapper(within(wrapper.element).getByText(text, options)); - const getTooltipDirective = elementWrapper => getBinding(elementWrapper.element, 'gl-tooltip'); + const getTooltipDirective = (elementWrapper) => getBinding(elementWrapper.element, 'gl-tooltip'); afterEach(() => { wrapper.destroy(); diff --git a/spec/frontend/members/components/table/member_avatar_spec.js b/spec/frontend/members/components/table/member_avatar_spec.js index 98177893c18..4341dfbbaf9 100644 --- a/spec/frontend/members/components/table/member_avatar_spec.js +++ b/spec/frontend/members/components/table/member_avatar_spec.js @@ -9,7 +9,7 @@ import InviteAvatar from '~/members/components/avatars/invite_avatar.vue'; describe('MemberList', () => { let wrapper; - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = shallowMount(MemberAvatar, { propsData: { isCurrentUser: false, diff --git a/spec/frontend/members/components/table/member_source_spec.js b/spec/frontend/members/components/table/member_source_spec.js index 48ac06f32f6..2580f36cd64 100644 --- a/spec/frontend/members/components/table/member_source_spec.js +++ b/spec/frontend/members/components/table/member_source_spec.js @@ -6,7 +6,7 @@ import MemberSource from '~/members/components/table/member_source.vue'; describe('MemberSource', () => { let wrapper; - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = mount(MemberSource, { propsData: { memberSource: { @@ -25,7 +25,7 @@ describe('MemberSource', () => { const getByText = (text, options) => createWrapper(getByTextHelper(wrapper.element, text, options)); - const getTooltipDirective = elementWrapper => getBinding(elementWrapper.element, 'gl-tooltip'); + const getTooltipDirective = (elementWrapper) => getBinding(elementWrapper.element, 'gl-tooltip'); afterEach(() => { wrapper.destroy(); diff --git a/spec/frontend/members/components/table/members_table_spec.js b/spec/frontend/members/components/table/members_table_spec.js index 728853b585b..735889c3b46 100644 --- a/spec/frontend/members/components/table/members_table_spec.js +++ b/spec/frontend/members/components/table/members_table_spec.js @@ -39,7 +39,7 @@ describe('MembersTable', () => { }); }; - const createComponent = state => { + const createComponent = (state) => { wrapper = mount(MembersTable, { localVue, store: createStore(state), diff --git a/spec/frontend/members/components/table/role_dropdown_spec.js b/spec/frontend/members/components/table/role_dropdown_spec.js index 6c6abf35bd7..96a388614f3 100644 --- a/spec/frontend/members/components/table/role_dropdown_spec.js +++ b/spec/frontend/members/components/table/role_dropdown_spec.js @@ -44,7 +44,7 @@ describe('RoleDropdown', () => { const getDropdownMenu = () => within(wrapper.element).getByRole('menu'); const getByTextInDropdownMenu = (text, options = {}) => createWrapper(within(getDropdownMenu()).getByText(text, options)); - const getDropdownItemByText = text => + const getDropdownItemByText = (text) => createWrapper( within(getDropdownMenu()) .getByText(text, { selector: '[role="menuitem"] p' }) @@ -53,7 +53,7 @@ describe('RoleDropdown', () => { const getCheckedDropdownItem = () => wrapper .findAll(GlDropdownItem) - .wrappers.find(dropdownItemWrapper => dropdownItemWrapper.props('isChecked')); + .wrappers.find((dropdownItemWrapper) => dropdownItemWrapper.props('isChecked')); const findDropdownToggle = () => wrapper.find('button[aria-haspopup="true"]'); const findDropdown = () => wrapper.find(GlDropdown); @@ -63,7 +63,7 @@ describe('RoleDropdown', () => { }); describe('when dropdown is open', () => { - beforeEach(done => { + beforeEach((done) => { createComponent(); findDropdownToggle().trigger('click'); @@ -73,7 +73,7 @@ describe('RoleDropdown', () => { }); it('renders all valid roles', () => { - Object.keys(member.validRoles).forEach(role => { + Object.keys(member.validRoles).forEach((role) => { expect(getDropdownItemByText(role).exists()).toBe(true); }); }); diff --git a/spec/frontend/members/utils_spec.js b/spec/frontend/members/utils_spec.js index 7bbfddf8fc6..7cd4e735b55 100644 --- a/spec/frontend/members/utils_spec.js +++ b/spec/frontend/members/utils_spec.js @@ -24,7 +24,7 @@ describe('Members Utils', () => { it('has correct properties for each badge', () => { const badges = generateBadges(memberMock, true); - badges.forEach(badge => { + badges.forEach((badge) => { expect(badge).toEqual( expect.objectContaining({ show: expect.any(Boolean), diff --git a/spec/frontend/merge_request_spec.js b/spec/frontend/merge_request_spec.js index 4f9e063a0e1..5624043260a 100644 --- a/spec/frontend/merge_request_spec.js +++ b/spec/frontend/merge_request_spec.js @@ -28,7 +28,7 @@ describe('MergeRequest', () => { mock.restore(); }); - it('modifies the Markdown field', done => { + it('modifies the Markdown field', (done) => { jest.spyOn($, 'ajax').mockImplementation(); const changeEvent = document.createEvent('HTMLEvents'); changeEvent.initEvent('change', true, true); @@ -41,7 +41,7 @@ describe('MergeRequest', () => { }); }); - it('ensure that task with only spaces does not get checked incorrectly', done => { + it('ensure that task with only spaces does not get checked incorrectly', (done) => { // fixed in 'deckar01-task_list', '2.2.1' gem jest.spyOn($, 'ajax').mockImplementation(); const changeEvent = document.createEvent('HTMLEvents'); @@ -61,7 +61,7 @@ describe('MergeRequest', () => { const index = 3; const checked = true; - it('submits an ajax request on tasklist:changed', done => { + it('submits an ajax request on tasklist:changed', (done) => { $('.js-task-list-field').trigger({ type: 'tasklist:changed', detail: { lineNumber, lineSource, index, checked }, @@ -83,7 +83,7 @@ describe('MergeRequest', () => { }); }); - it('shows an error notification when tasklist update failed', done => { + it('shows an error notification when tasklist update failed', (done) => { mock .onPatch(`${TEST_HOST}/frontend-fixtures/merge-requests-project/-/merge_requests/1.json`) .reply(409, {}); diff --git a/spec/frontend/merge_request_tabs_spec.js b/spec/frontend/merge_request_tabs_spec.js index 85a4ee8974e..665e92cf2db 100644 --- a/spec/frontend/merge_request_tabs_spec.js +++ b/spec/frontend/merge_request_tabs_spec.js @@ -14,7 +14,7 @@ jest.mock('~/lib/utils/webpack', () => ({ describe('MergeRequestTabs', () => { const testContext = {}; const stubLocation = {}; - const setLocation = stubs => { + const setLocation = (stubs) => { const defaults = { pathname: '', search: '', @@ -265,7 +265,7 @@ describe('MergeRequestTabs', () => { beforeEach(() => { jest.spyOn(mainContent, 'getBoundingClientRect').mockReturnValue({ top: 10 }); jest.spyOn(tabContent, 'getBoundingClientRect').mockReturnValue({ top: 100 }); - jest.spyOn(document, 'querySelector').mockImplementation(selector => { + jest.spyOn(document, 'querySelector').mockImplementation((selector) => { return selector === '.content-wrapper' ? mainContent : tabContent; }); testContext.class.currentAction = 'commits'; diff --git a/spec/frontend/milestones/milestone_combobox_spec.js b/spec/frontend/milestones/milestone_combobox_spec.js index c7a123f7d99..46cd0cc1aa9 100644 --- a/spec/frontend/milestones/milestone_combobox_spec.js +++ b/spec/frontend/milestones/milestone_combobox_spec.js @@ -41,7 +41,7 @@ describe('Milestone combobox component', () => { attrs, listeners: { // simulate a parent component v-model binding - input: selectedMilestone => { + input: (selectedMilestone) => { wrapper.setProps({ value: selectedMilestone }); }, }, @@ -71,13 +71,13 @@ describe('Milestone combobox component', () => { mock .onGet(`/api/v4/projects/${projectId}/milestones`) - .reply(config => projectMilestonesApiCallSpy(config)); + .reply((config) => projectMilestonesApiCallSpy(config)); mock .onGet(`/api/v4/groups/${groupId}/milestones`) - .reply(config => groupMilestonesApiCallSpy(config)); + .reply((config) => groupMilestonesApiCallSpy(config)); - mock.onGet(`/api/v4/projects/${projectId}/search`).reply(config => searchApiCallSpy(config)); + mock.onGet(`/api/v4/projects/${projectId}/search`).reply((config) => searchApiCallSpy(config)); }); afterEach(() => { @@ -129,7 +129,7 @@ describe('Milestone combobox component', () => { // // Convenience methods // - const updateQuery = newQuery => { + const updateQuery = (newQuery) => { findSearchBox().vm.$emit('input', newQuery); }; diff --git a/spec/frontend/mini_pipeline_graph_dropdown_spec.js b/spec/frontend/mini_pipeline_graph_dropdown_spec.js index 1ecf01894af..6e384074875 100644 --- a/spec/frontend/mini_pipeline_graph_dropdown_spec.js +++ b/spec/frontend/mini_pipeline_graph_dropdown_spec.js @@ -64,7 +64,7 @@ describe('Mini Pipeline Graph Dropdown', () => { expect(ajaxSpy.mock.calls[0][0]).toEqual('foobar'); }); - it('should not close when user uses cmd/ctrl + click', done => { + it('should not close when user uses cmd/ctrl + click', (done) => { mock.onGet('foobar').reply(200, { html: `<li> <a class="mini-pipeline-graph-dropdown-item" href="#"> @@ -90,7 +90,7 @@ describe('Mini Pipeline Graph Dropdown', () => { .catch(done.fail); }); - it('should close the dropdown when request returns an error', done => { + it('should close the dropdown when request returns an error', (done) => { mock.onGet('foobar').networkError(); new MiniPipelineGraph({ container: '.js-builds-dropdown-tests' }).bindEvents(); diff --git a/spec/frontend/mocks/ce/lib/utils/axios_utils.js b/spec/frontend/mocks/ce/lib/utils/axios_utils.js index 85fad231d28..674563b9f28 100644 --- a/spec/frontend/mocks/ce/lib/utils/axios_utils.js +++ b/spec/frontend/mocks/ce/lib/utils/axios_utils.js @@ -5,7 +5,7 @@ const axios = jest.requireActual('~/lib/utils/axios_utils').default; axios.isMock = true; // Fail tests for unmocked requests -axios.defaults.adapter = config => { +axios.defaults.adapter = (config) => { const message = `Unexpected unmocked request: ${JSON.stringify(config, null, 2)}\n` + 'Consider using the `axios-mock-adapter` module in tests.'; @@ -23,7 +23,7 @@ const onRequest = () => { }; // Use setImmediate to alloow the response interceptor to finish -const onResponse = config => { +const onResponse = (config) => { activeRequests -= 1; setImmediate(() => { events.emit('response', config); @@ -31,7 +31,7 @@ const onResponse = config => { }; const subscribeToResponse = (predicate = () => true) => - new Promise(resolve => { + new Promise((resolve) => { const listener = (config = {}) => { if (predicate(config)) { events.off('response', listener); @@ -49,7 +49,7 @@ const subscribeToResponse = (predicate = () => true) => /** * Registers a callback function to be run after a request to the given URL finishes. */ -axios.waitFor = url => subscribeToResponse(({ url: configUrl }) => configUrl === url); +axios.waitFor = (url) => subscribeToResponse(({ url: configUrl }) => configUrl === url); /** * Registers a callback function to be run after all requests have finished. If there are no requests waiting, the callback is executed immediately. @@ -58,18 +58,18 @@ axios.waitForAll = () => subscribeToResponse(() => activeRequests === 0); axios.countActiveRequests = () => activeRequests; -axios.interceptors.request.use(config => { +axios.interceptors.request.use((config) => { onRequest(); return config; }); // Remove the global counter axios.interceptors.response.use( - response => { + (response) => { onResponse(response.config); return response; }, - err => { + (err) => { onResponse(err.config); return Promise.reject(err); }, diff --git a/spec/frontend/mocks/mocks_helper.js b/spec/frontend/mocks/mocks_helper.js index 0aa80331434..295483cd64c 100644 --- a/spec/frontend/mocks/mocks_helper.js +++ b/spec/frontend/mocks/mocks_helper.js @@ -19,9 +19,9 @@ const prefixMap = [ // { mocksRoot: 'virtual', requirePrefix: '' }, // We'll deal with virtual mocks later ]; -const mockFileFilter = stats => stats.isFile() && stats.path.endsWith('.js'); +const mockFileFilter = (stats) => stats.isFile() && stats.path.endsWith('.js'); -const getMockFiles = root => readdir.sync(root, { deep: MAX_DEPTH, filter: mockFileFilter }); +const getMockFiles = (root) => readdir.sync(root, { deep: MAX_DEPTH, filter: mockFileFilter }); // Function that performs setting a mock. This has to be overridden by the unit test, because // jest.setMock can't be overwritten across files. @@ -36,7 +36,7 @@ export const setupManualMocks = function setupManualMocks(setMock = defaultSetMo return; } - getMockFiles(path.join(__dirname, mocksRoot)).forEach(mockPath => { + getMockFiles(path.join(__dirname, mocksRoot)).forEach((mockPath) => { const mockPathNoExt = mockPath.substring(0, mockPath.length - path.extname(mockPath).length); const sourcePath = path.join(requirePrefix, mockPathNoExt); const mockPathRelative = `./${path.join(mocksRoot, mockPathNoExt)}`; diff --git a/spec/frontend/mocks/mocks_helper_spec.js b/spec/frontend/mocks/mocks_helper_spec.js index a91e8ecfa4a..0abe5c6b949 100644 --- a/spec/frontend/mocks/mocks_helper_spec.js +++ b/spec/frontend/mocks/mocks_helper_spec.js @@ -47,13 +47,13 @@ describe('mocks_helper.js', () => { const readdirSpy = readdir.sync; expect(readdirSpy).toHaveBeenCalled(); - readdirSpy.mock.calls.forEach(call => { + readdirSpy.mock.calls.forEach((call) => { expect(call[1].deep).toBeLessThan(100); }); }); it('sets up mocks for CE (the ~/ prefix)', () => { - fs.existsSync.mockImplementation(root => root.endsWith('ce')); + fs.existsSync.mockImplementation((root) => root.endsWith('ce')); readdir.sync.mockReturnValue(['root.js', 'lib/utils/util.js']); setupManualMocks(); @@ -72,7 +72,7 @@ describe('mocks_helper.js', () => { }; fs.existsSync.mockReturnValue(true); - readdir.sync.mockImplementation(root => files[root]); + readdir.sync.mockImplementation((root) => files[root]); setupManualMocks(); expect(readdir.sync).toHaveBeenCalledTimes(1); @@ -84,7 +84,7 @@ describe('mocks_helper.js', () => { }); it('fails when given a virtual mock', () => { - fs.existsSync.mockImplementation(p => p.endsWith('ce')); + fs.existsSync.mockImplementation((p) => p.endsWith('ce')); readdir.sync.mockReturnValue(['virtual', 'shouldntBeImported']); setMock.mockImplementation(() => { throw new Error('Could not locate module'); @@ -106,7 +106,7 @@ describe('mocks_helper.js', () => { }); }); - it('survives jest.isolateModules()', done => { + it('survives jest.isolateModules()', (done) => { jest.isolateModules(() => { const axios2 = require('~/lib/utils/axios_utils').default; expect(axios2.isMock).toBe(true); diff --git a/spec/frontend/monitoring/alert_widget_spec.js b/spec/frontend/monitoring/alert_widget_spec.js index e66c389a4ab..fd9fb374274 100644 --- a/spec/frontend/monitoring/alert_widget_spec.js +++ b/spec/frontend/monitoring/alert_widget_spec.js @@ -83,7 +83,7 @@ describe('AlertWidget', () => { }, }; - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = shallowMount(AlertWidget, { stubs: { GlTooltip, GlSprintf }, propsData: { @@ -108,7 +108,7 @@ describe('AlertWidget', () => { it('displays a loading spinner and disables form when fetching alerts', () => { let resolveReadAlert; mockReadAlert.mockReturnValue( - new Promise(resolve => { + new Promise((resolve) => { resolveReadAlert = resolve; }), ); @@ -131,7 +131,7 @@ describe('AlertWidget', () => { it('does not render loading spinner if showLoadingState is false', () => { let resolveReadAlert; mockReadAlert.mockReturnValue( - new Promise(resolve => { + new Promise((resolve) => { resolveReadAlert = resolve; }), ); diff --git a/spec/frontend/monitoring/components/charts/annotations_spec.js b/spec/frontend/monitoring/components/charts/annotations_spec.js index fc90175d307..1eac0935fe4 100644 --- a/spec/frontend/monitoring/components/charts/annotations_spec.js +++ b/spec/frontend/monitoring/components/charts/annotations_spec.js @@ -36,7 +36,7 @@ describe('annotations spec', () => { }), ); - annotations.data.forEach(annotation => { + annotations.data.forEach((annotation) => { expect(annotation).toEqual(expect.any(Object)); }); @@ -58,7 +58,7 @@ describe('annotations spec', () => { }), ); - annotations.markLine.data.forEach(annotation => { + annotations.markLine.data.forEach((annotation) => { expect(annotation).toEqual(expect.any(Object)); }); @@ -83,7 +83,7 @@ describe('annotations spec', () => { }), ); - annotations.markLine.data.forEach(annotation => { + annotations.markLine.data.forEach((annotation) => { expect(annotation).toEqual(expect.any(Object)); }); diff --git a/spec/frontend/monitoring/components/charts/anomaly_spec.js b/spec/frontend/monitoring/components/charts/anomaly_spec.js index ebb49a2a0aa..dad3003d536 100644 --- a/spec/frontend/monitoring/components/charts/anomaly_spec.js +++ b/spec/frontend/monitoring/components/charts/anomaly_spec.js @@ -15,7 +15,7 @@ const TEST_LOWER = 9; describe('Anomaly chart component', () => { let wrapper; - const setupAnomalyChart = props => { + const setupAnomalyChart = (props) => { wrapper = shallowMount(Anomaly, { propsData: { ...props }, }); @@ -91,7 +91,7 @@ describe('Anomaly chart component', () => { expect(series.length).toEqual(2); // 1 upper + 1 lower boundaries expect(series[0].stack).toEqual(series[1].stack); - series.forEach(s => { + series.forEach((s) => { expect(s.type).toBe('line'); expect(s.lineStyle.width).toBe(0); expect(s.lineStyle.color).toMatch(/rgba\(.+\)/); diff --git a/spec/frontend/monitoring/components/charts/bar_spec.js b/spec/frontend/monitoring/components/charts/bar_spec.js index a363fafdc31..40edde5f666 100644 --- a/spec/frontend/monitoring/components/charts/bar_spec.js +++ b/spec/frontend/monitoring/components/charts/bar_spec.js @@ -44,7 +44,7 @@ describe('Bar component', () => { it('should return chartData as array of arrays', () => { expect(chartData).toBeInstanceOf(Array); - chartData.forEach(item => { + chartData.forEach((item) => { expect(item).toBeInstanceOf(Array); }); }); diff --git a/spec/frontend/monitoring/components/charts/column_spec.js b/spec/frontend/monitoring/components/charts/column_spec.js index fbcff33d692..0c4b6e8990d 100644 --- a/spec/frontend/monitoring/components/charts/column_spec.js +++ b/spec/frontend/monitoring/components/charts/column_spec.js @@ -45,7 +45,7 @@ describe('Column component', () => { }); }; const findChart = () => wrapper.find(GlColumnChart); - const chartProps = prop => findChart().props(prop); + const chartProps = (prop) => findChart().props(prop); beforeEach(() => { createWrapper(); @@ -58,7 +58,7 @@ describe('Column component', () => { describe('xAxisLabel', () => { const mockDate = Date.UTC(2020, 4, 26, 20); // 8:00 PM in GMT - const useXAxisFormatter = date => { + const useXAxisFormatter = (date) => { const { xAxis } = chartProps('option'); const { formatter } = xAxis.axisLabel; return formatter(date); diff --git a/spec/frontend/monitoring/components/charts/gauge_spec.js b/spec/frontend/monitoring/components/charts/gauge_spec.js index 850e2ca87db..9215f2e411f 100644 --- a/spec/frontend/monitoring/components/charts/gauge_spec.js +++ b/spec/frontend/monitoring/components/charts/gauge_spec.js @@ -49,7 +49,7 @@ describe('Gauge Chart component', () => { it.each(invalidCases)( 'if min has invalid value, defaults are used for both min and max', - invalidValue => { + (invalidValue) => { createWrapper({ minValue: invalidValue }); expect(findGaugeChart().props('min')).toBe(MIN_DEFAULT); @@ -59,7 +59,7 @@ describe('Gauge Chart component', () => { it.each(invalidCases)( 'if max has invalid value, defaults are used for both min and max', - invalidValue => { + (invalidValue) => { createWrapper({ minValue: invalidValue }); expect(findGaugeChart().props('min')).toBe(MIN_DEFAULT); diff --git a/spec/frontend/monitoring/components/charts/options_spec.js b/spec/frontend/monitoring/components/charts/options_spec.js index 3372d27e4f9..064ce6f204c 100644 --- a/spec/frontend/monitoring/components/charts/options_spec.js +++ b/spec/frontend/monitoring/components/charts/options_spec.js @@ -145,7 +145,7 @@ describe('options spec', () => { expect(thresholds).toEqual([]); }); - it.each(invalidCases)('invalid values for thresholds are filtered out', invalidValue => { + it.each(invalidCases)('invalid values for thresholds are filtered out', (invalidValue) => { thresholds = getValidThresholds({ mode: 'absolute', range: { min: 0, max: 100 }, @@ -197,7 +197,7 @@ describe('options spec', () => { it.each(invalidCases)( 'when min has invalid value, empty result is returned', - invalidValue => { + (invalidValue) => { thresholds = getValidThresholds({ mode: 'absolute', range: { min: invalidValue, max: 100 }, @@ -210,7 +210,7 @@ describe('options spec', () => { it.each(invalidCases)( 'when max has invalid value, empty result is returned', - invalidValue => { + (invalidValue) => { thresholds = getValidThresholds({ mode: 'absolute', range: { min: 0, max: invalidValue }, @@ -244,7 +244,7 @@ describe('options spec', () => { it.each(invalidCases)( 'if invalid values are passed, empty result is returned', - invalidValue => { + (invalidValue) => { thresholds = getValidThresholds({ mode: 'absolute', range: { min: 0, max: 100 }, @@ -259,7 +259,7 @@ describe('options spec', () => { describe('mode', () => { it.each(invalidCases)( 'if invalid values are passed, empty result is returned', - invalidValue => { + (invalidValue) => { thresholds = getValidThresholds({ mode: invalidValue, range: { min: 0, max: 100 }, @@ -305,7 +305,7 @@ describe('options spec', () => { const outOfPercentBoundsValues = [-1, 0, 100, 101]; it.each(outOfPercentBoundsValues)( 'when values out of 0-100 range are passed, empty result is returned', - invalidValue => { + (invalidValue) => { thresholds = getValidThresholds({ mode: 'percentage', range: { min: 0, max: 1000 }, diff --git a/spec/frontend/monitoring/components/charts/stacked_column_spec.js b/spec/frontend/monitoring/components/charts/stacked_column_spec.js index 2032258730a..ceac1d07dfb 100644 --- a/spec/frontend/monitoring/components/charts/stacked_column_spec.js +++ b/spec/frontend/monitoring/components/charts/stacked_column_spec.js @@ -6,7 +6,7 @@ import StackedColumnChart from '~/monitoring/components/charts/stacked_column.vu import { stackedColumnGraphData } from '../../graph_data'; jest.mock('~/lib/utils/icon_utils', () => ({ - getSvgIconPathContent: jest.fn().mockImplementation(icon => Promise.resolve(`${icon}-content`)), + getSvgIconPathContent: jest.fn().mockImplementation((icon) => Promise.resolve(`${icon}-content`)), })); describe('Stacked column chart component', () => { @@ -48,7 +48,7 @@ describe('Stacked column chart component', () => { data.forEach((series, index) => { const { values } = stackedColumnMockedData.metrics[index].result[0]; - expect(series.data).toEqual(values.map(value => value[1])); + expect(series.data).toEqual(values.map((value) => value[1])); }); }); diff --git a/spec/frontend/monitoring/components/charts/time_series_spec.js b/spec/frontend/monitoring/components/charts/time_series_spec.js index 8fcee80a2d8..c226dc9e44c 100644 --- a/spec/frontend/monitoring/components/charts/time_series_spec.js +++ b/spec/frontend/monitoring/components/charts/time_series_spec.js @@ -23,14 +23,14 @@ import { timeSeriesGraphData } from '../../graph_data'; jest.mock('lodash/throttle', () => // this throttle mock executes immediately - jest.fn(func => { + jest.fn((func) => { // eslint-disable-next-line no-param-reassign func.cancel = jest.fn(); return func; }), ); jest.mock('~/lib/utils/icon_utils', () => ({ - getSvgIconPathContent: jest.fn().mockImplementation(icon => Promise.resolve(`${icon}-content`)), + getSvgIconPathContent: jest.fn().mockImplementation((icon) => Promise.resolve(`${icon}-content`)), })); describe('Time series component', () => { @@ -122,7 +122,7 @@ describe('Time series component', () => { }, ], }), - off: jest.fn(eChartEvent => { + off: jest.fn((eChartEvent) => { delete eChartMock.handlers[eChartEvent]; }), on: jest.fn((eChartEvent, fn) => { @@ -193,7 +193,7 @@ describe('Time series component', () => { it('does not throw error if data point is outside the zoom range', () => { const seriesDataWithoutValue = { ...mockLineSeriesData(), - seriesData: mockLineSeriesData().seriesData.map(data => ({ + seriesData: mockLineSeriesData().seriesData.map((data) => ({ ...data, value: undefined, })), @@ -270,7 +270,7 @@ describe('Time series component', () => { beforeEach(() => { wrapper.vm.formatTooltipText({ ...mockAnnotationsSeriesData, - seriesData: mockAnnotationsSeriesData.seriesData.map(data => ({ + seriesData: mockAnnotationsSeriesData.seriesData.map((data) => ({ ...data, data: annotationsMetadata, })), @@ -546,7 +546,7 @@ describe('Time series component', () => { describe('xAxisLabel', () => { const mockDate = Date.UTC(2020, 4, 26, 20); // 8:00 PM in GMT - const useXAxisFormatter = date => { + const useXAxisFormatter = (date) => { const { xAxis } = getChartOptions(); const { formatter } = xAxis.axisLabel; return formatter(date); @@ -620,7 +620,7 @@ describe('Time series component', () => { }, ]; - glChartComponents.forEach(dynamicComponent => { + glChartComponents.forEach((dynamicComponent) => { describe(`GitLab UI: ${dynamicComponent.chartType}`, () => { const findChartComponent = () => wrapper.find(dynamicComponent.component); @@ -705,7 +705,7 @@ describe('Time series component', () => { let lineColors; beforeEach(() => { - lineColors = wrapper.find(GlAreaChart).vm.series.map(item => item.lineStyle.color); + lineColors = wrapper.find(GlAreaChart).vm.series.map((item) => item.lineStyle.color); }); it('should contain different colors for contiguous time series', () => { @@ -727,7 +727,7 @@ describe('Time series component', () => { const legendColors = wrapper .find(GlChartLegend) .props('seriesInfo') - .map(item => item.color); + .map((item) => item.color); lineColors.forEach((color, index) => { expect(color).toBe(legendColors[index]); diff --git a/spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js b/spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js index 1cde19510a2..c2efc71c159 100644 --- a/spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js +++ b/spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js @@ -172,25 +172,31 @@ describe('tags list row', () => { }); it('contains the totalSize and layers', () => { - mountComponent({ ...defaultProps, tag: { ...tag, totalSize: 1024, layers: 10 } }); + mountComponent({ ...defaultProps, tag: { ...tag, totalSize: '1024', layers: 10 } }); expect(findSize().text()).toMatchInterpolatedText('1.00 KiB · 10 layers'); }); + it('when totalSize is giantic', () => { + mountComponent({ ...defaultProps, tag: { ...tag, totalSize: '1099511627776', layers: 2 } }); + + expect(findSize().text()).toMatchInterpolatedText('1024.00 GiB · 2 layers'); + }); + it('when totalSize is missing', () => { - mountComponent({ ...defaultProps, tag: { ...tag, totalSize: 0, layers: 10 } }); + mountComponent({ ...defaultProps, tag: { ...tag, totalSize: '0', layers: 10 } }); expect(findSize().text()).toMatchInterpolatedText(`${NOT_AVAILABLE_SIZE} · 10 layers`); }); it('when layers are missing', () => { - mountComponent({ ...defaultProps, tag: { ...tag, totalSize: 1024 } }); + mountComponent({ ...defaultProps, tag: { ...tag, totalSize: '1024' } }); expect(findSize().text()).toMatchInterpolatedText('1.00 KiB'); }); it('when there is 1 layer', () => { - mountComponent({ ...defaultProps, tag: { ...tag, totalSize: 0, layers: 1 } }); + mountComponent({ ...defaultProps, tag: { ...tag, totalSize: '0', layers: 1 } }); expect(findSize().text()).toMatchInterpolatedText(`${NOT_AVAILABLE_SIZE} · 1 layer`); }); diff --git a/spec/frontend/registry/explorer/mock_data.js b/spec/frontend/registry/explorer/mock_data.js index 992d880581a..72a9bff8a47 100644 --- a/spec/frontend/registry/explorer/mock_data.js +++ b/spec/frontend/registry/explorer/mock_data.js @@ -140,7 +140,7 @@ export const tagsMock = [ revision: 'c2613843ab33aabf847965442b13a8b55a56ae28837ce182627c0716eb08c02b', shortRevision: 'c2613843a', createdAt: '2020-11-03T13:29:38+00:00', - totalSize: 105, + totalSize: '1099511627776', canDelete: true, __typename: 'ContainerRepositoryTag', }, @@ -152,7 +152,7 @@ export const tagsMock = [ revision: 'df44e7228f0f255c73e35b6f0699624a615f42746e3e8e2e4b3804a6d6fc3292', shortRevision: 'df44e7228', createdAt: '2020-11-03T13:29:32+00:00', - totalSize: 104, + totalSize: '536870912000', canDelete: true, __typename: 'ContainerRepositoryTag', }, diff --git a/spec/frontend/sidebar/components/assignees/collapsed_assignee_list_spec.js b/spec/frontend/sidebar/components/assignees/collapsed_assignee_list_spec.js index 907d6144415..8e158c99971 100644 --- a/spec/frontend/sidebar/components/assignees/collapsed_assignee_list_spec.js +++ b/spec/frontend/sidebar/components/assignees/collapsed_assignee_list_spec.js @@ -101,7 +101,7 @@ describe('CollapsedAssigneeList component', () => { beforeEach(() => { users = UsersMockHelper.createNumberRandomUsers(3); - userNames = users.map(x => x.name).join(', '); + userNames = users.map((x) => x.name).join(', '); }); describe('default', () => { diff --git a/spec/frontend/sidebar/components/severity/severity_spec.js b/spec/frontend/sidebar/components/severity/severity_spec.js index b6690f11d6b..ba7cea0919c 100644 --- a/spec/frontend/sidebar/components/severity/severity_spec.js +++ b/spec/frontend/sidebar/components/severity/severity_spec.js @@ -24,7 +24,7 @@ describe('SeverityToken', () => { const findIcon = () => wrapper.find(GlIcon); it('renders severity token for each severity type', () => { - Object.values(INCIDENT_SEVERITY).forEach(severity => { + Object.values(INCIDENT_SEVERITY).forEach((severity) => { createComponent({ severity }); expect(findIcon().classes()).toContain(`icon-${severity.icon}`); expect(findIcon().attributes('name')).toBe(`severity-${severity.icon}`); diff --git a/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js b/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js index 3366d70f0fe..fa40d75d4e9 100644 --- a/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js +++ b/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js @@ -94,7 +94,7 @@ describe('SidebarSeverity', () => { let resolvePromise; wrapper.vm.$apollo.mutate = jest.fn( () => - new Promise(resolve => { + new Promise((resolve) => { resolvePromise = resolve; }), ); diff --git a/spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js b/spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js index 28c268e87c8..0b6a2e6ceb9 100644 --- a/spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js +++ b/spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js @@ -6,7 +6,7 @@ import TimeTracker from '~/sidebar/components/time_tracking/time_tracker.vue'; describe('Issuable Time Tracker', () => { let wrapper; - const findByTestId = testId => wrapper.find(`[data-testid=${testId}]`); + const findByTestId = (testId) => wrapper.find(`[data-testid=${testId}]`); const findComparisonMeter = () => findByTestId('compareMeter').attributes('title'); const findCollapsedState = () => findByTestId('collapsedState'); const findTimeRemainingProgress = () => findByTestId('timeRemainingProgress'); diff --git a/spec/frontend/sidebar/confidential/edit_form_spec.js b/spec/frontend/sidebar/confidential/edit_form_spec.js index 56f163eecd1..6b571df10ae 100644 --- a/spec/frontend/sidebar/confidential/edit_form_spec.js +++ b/spec/frontend/sidebar/confidential/edit_form_spec.js @@ -6,7 +6,7 @@ describe('Edit Form Dropdown', () => { const toggleForm = () => {}; const updateConfidentialAttribute = () => {}; - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(EditForm, { propsData: { ...props, diff --git a/spec/frontend/sidebar/lock/edit_form_buttons_spec.js b/spec/frontend/sidebar/lock/edit_form_buttons_spec.js index 913646c8f8d..a14ca711204 100644 --- a/spec/frontend/sidebar/lock/edit_form_buttons_spec.js +++ b/spec/frontend/sidebar/lock/edit_form_buttons_spec.js @@ -15,7 +15,7 @@ describe('EditFormButtons', () => { let issuableType; let issuableDisplayName; - const setIssuableType = pageType => { + const setIssuableType = (pageType) => { issuableType = pageType; issuableDisplayName = issuableType.replace(/_/g, ' '); }; diff --git a/spec/frontend/sidebar/lock/edit_form_spec.js b/spec/frontend/sidebar/lock/edit_form_spec.js index b1c3bfe3ef5..4ae9025ee39 100644 --- a/spec/frontend/sidebar/lock/edit_form_spec.js +++ b/spec/frontend/sidebar/lock/edit_form_spec.js @@ -7,7 +7,7 @@ describe('Edit Form Dropdown', () => { let issuableType; // Either ISSUABLE_TYPE_ISSUE or ISSUABLE_TYPE_MR let issuableDisplayName; - const setIssuableType = pageType => { + const setIssuableType = (pageType) => { issuableType = pageType; issuableDisplayName = issuableType.replace(/_/g, ' '); }; diff --git a/spec/frontend/sidebar/lock/issuable_lock_form_spec.js b/spec/frontend/sidebar/lock/issuable_lock_form_spec.js index e8091dcb51d..92cdba4f1f2 100644 --- a/spec/frontend/sidebar/lock/issuable_lock_form_spec.js +++ b/spec/frontend/sidebar/lock/issuable_lock_form_spec.js @@ -12,7 +12,7 @@ describe('IssuableLockForm', () => { let store; let issuableType; // Either ISSUABLE_TYPE_ISSUE or ISSUABLE_TYPE_MR - const setIssuableType = pageType => { + const setIssuableType = (pageType) => { issuableType = pageType; }; @@ -23,7 +23,7 @@ describe('IssuableLockForm', () => { const findSidebarLockStatusTooltip = () => getBinding(findSidebarCollapseIcon().element, 'gl-tooltip'); - const initStore = isLocked => { + const initStore = (isLocked) => { if (issuableType === ISSUABLE_TYPE_ISSUE) { store = createStore(); store.getters.getNoteableData.targetType = 'issue'; diff --git a/spec/frontend/sidebar/participants_spec.js b/spec/frontend/sidebar/participants_spec.js index 93c9b3b84c3..1210f7c9531 100644 --- a/spec/frontend/sidebar/participants_spec.js +++ b/spec/frontend/sidebar/participants_spec.js @@ -21,7 +21,7 @@ describe('Participants', () => { const getCollapsedParticipantsCount = () => wrapper.find('[data-testid="collapsed-count"]'); - const mountComponent = propsData => + const mountComponent = (propsData) => shallowMount(Participants, { propsData, }); diff --git a/spec/frontend/sidebar/reviewer_title_spec.js b/spec/frontend/sidebar/reviewer_title_spec.js index eae266688d5..b55cab68d0b 100644 --- a/spec/frontend/sidebar/reviewer_title_spec.js +++ b/spec/frontend/sidebar/reviewer_title_spec.js @@ -6,7 +6,7 @@ import Component from '~/sidebar/components/reviewers/reviewer_title.vue'; describe('ReviewerTitle component', () => { let wrapper; - const createComponent = props => { + const createComponent = (props) => { return shallowMount(Component, { propsData: { numberOfReviewers: 0, diff --git a/spec/frontend/sidebar/sidebar_mediator_spec.js b/spec/frontend/sidebar/sidebar_mediator_spec.js index 0892d452966..019ded87093 100644 --- a/spec/frontend/sidebar/sidebar_mediator_spec.js +++ b/spec/frontend/sidebar/sidebar_mediator_spec.js @@ -33,7 +33,7 @@ describe('Sidebar mediator', () => { it('saves assignees', () => { mock.onPut(mediatorMockData.endpoint).reply(200, {}); - return mediator.saveAssignees('issue[assignee_ids]').then(resp => { + return mediator.saveAssignees('issue[assignee_ids]').then((resp) => { expect(resp.status).toEqual(200); }); }); diff --git a/spec/frontend/sidebar/sidebar_move_issue_spec.js b/spec/frontend/sidebar/sidebar_move_issue_spec.js index ba14c61400f..24bb5a8e916 100644 --- a/spec/frontend/sidebar/sidebar_move_issue_spec.js +++ b/spec/frontend/sidebar/sidebar_move_issue_spec.js @@ -74,7 +74,7 @@ describe('SidebarMoveIssue', () => { expect(test.sidebarMoveIssue.$dropdownToggle.data('deprecatedJQueryDropdown')).toBeTruthy(); }); - it('escapes html from project name', done => { + it('escapes html from project name', (done) => { test.$toggleButton.dropdown('toggle'); setImmediate(() => { @@ -98,7 +98,7 @@ describe('SidebarMoveIssue', () => { expect(test.$confirmButton.hasClass('is-loading')).toBe(true); }); - it('should remove loading state from confirm button on failure', done => { + it('should remove loading state from confirm button on failure', (done) => { jest.spyOn(window, 'Flash').mockImplementation(() => {}); jest.spyOn(test.mediator, 'moveIssue').mockReturnValue(Promise.reject()); test.mediator.setMoveToProjectId(7); @@ -125,7 +125,7 @@ describe('SidebarMoveIssue', () => { }); }); - it('should set moveToProjectId on dropdown item "No project" click', done => { + it('should set moveToProjectId on dropdown item "No project" click', (done) => { jest.spyOn(test.mediator, 'setMoveToProjectId').mockImplementation(() => {}); // Open the dropdown @@ -141,7 +141,7 @@ describe('SidebarMoveIssue', () => { }); }); - it('should set moveToProjectId on dropdown item click', done => { + it('should set moveToProjectId on dropdown item click', (done) => { jest.spyOn(test.mediator, 'setMoveToProjectId').mockImplementation(() => {}); // Open the dropdown diff --git a/spec/frontend/sidebar/subscriptions_spec.js b/spec/frontend/sidebar/subscriptions_spec.js index 428441656b3..043ffd972da 100644 --- a/spec/frontend/sidebar/subscriptions_spec.js +++ b/spec/frontend/sidebar/subscriptions_spec.js @@ -8,7 +8,7 @@ describe('Subscriptions', () => { const findToggleButton = () => wrapper.find(ToggleButton); - const mountComponent = propsData => + const mountComponent = (propsData) => shallowMount(Subscriptions, { propsData, }); diff --git a/spec/frontend/snippet/collapsible_input_spec.js b/spec/frontend/snippet/collapsible_input_spec.js index aa017964437..3f14a9cd1a1 100644 --- a/spec/frontend/snippet/collapsible_input_spec.js +++ b/spec/frontend/snippet/collapsible_input_spec.js @@ -38,12 +38,12 @@ describe('~/snippet/collapsible_input', () => { setupCollapsibleInputs(); }); - const findInput = el => el.querySelector('textarea,input'); - const findCollapsed = el => el.querySelector('.js-collapsed'); - const findExpanded = el => el.querySelector('.js-expanded'); - const findCollapsedInput = el => findInput(findCollapsed(el)); - const findExpandedInput = el => findInput(findExpanded(el)); - const focusIn = target => target.dispatchEvent(new Event('focusin', { bubbles: true })); + const findInput = (el) => el.querySelector('textarea,input'); + const findCollapsed = (el) => el.querySelector('.js-collapsed'); + const findExpanded = (el) => el.querySelector('.js-expanded'); + const findCollapsedInput = (el) => findInput(findCollapsed(el)); + const findExpandedInput = (el) => findInput(findExpanded(el)); + const focusIn = (target) => target.dispatchEvent(new Event('focusin', { bubbles: true })); const expectIsCollapsed = (el, isCollapsed) => { expect(findCollapsed(el).classList.contains('d-none')).toEqual(!isCollapsed); expect(findExpanded(el).classList.contains('d-none')).toEqual(isCollapsed); diff --git a/spec/frontend/snippets/components/embed_dropdown_spec.js b/spec/frontend/snippets/components/embed_dropdown_spec.js index 8eb44965692..f1eb7d43409 100644 --- a/spec/frontend/snippets/components/embed_dropdown_spec.js +++ b/spec/frontend/snippets/components/embed_dropdown_spec.js @@ -26,7 +26,7 @@ describe('snippets/components/embed_dropdown', () => { const sections = []; let current = {}; - wrapper.findAll('[data-testid="header"],[data-testid="input"]').wrappers.forEach(x => { + wrapper.findAll('[data-testid="header"],[data-testid="input"]').wrappers.forEach((x) => { const type = x.attributes('data-testid'); if (type === 'header') { diff --git a/spec/frontend/snippets/components/snippet_blob_actions_edit_spec.js b/spec/frontend/snippets/components/snippet_blob_actions_edit_spec.js index ddfbeb9a58f..08056e788de 100644 --- a/spec/frontend/snippets/components/snippet_blob_actions_edit_spec.js +++ b/spec/frontend/snippets/components/snippet_blob_actions_edit_spec.js @@ -14,7 +14,7 @@ const TEST_BLOBS = [ createBlobFromTestEntry(testEntries.deleted), ]; -const TEST_BLOBS_UNLOADED = TEST_BLOBS.map(blob => ({ ...blob, content: '', isLoaded: false })); +const TEST_BLOBS_UNLOADED = TEST_BLOBS.map((blob) => ({ ...blob, content: '', isLoaded: false })); describe('snippets/components/snippet_blob_actions_edit', () => { let wrapper; @@ -31,7 +31,7 @@ describe('snippets/components/snippet_blob_actions_edit', () => { const findLabel = () => wrapper.find('label'); const findBlobEdits = () => wrapper.findAll(SnippetBlobEdit); const findBlobsData = () => - findBlobEdits().wrappers.map(x => ({ + findBlobEdits().wrappers.map((x) => ({ blob: x.props('blob'), classes: x.classes(), })); @@ -42,7 +42,7 @@ describe('snippets/components/snippet_blob_actions_edit', () => { return events[events.length - 1]?.[0]; }; - const buildBlobsDataExpectation = blobs => + const buildBlobsDataExpectation = (blobs) => blobs.map((blob, index) => ({ blob: { ...blob, @@ -50,7 +50,7 @@ describe('snippets/components/snippet_blob_actions_edit', () => { }, classes: index > 0 ? ['gl-mt-3'] : [], })); - const triggerBlobDelete = idx => findBlobEdits().at(idx).vm.$emit('delete'); + const triggerBlobDelete = (idx) => findBlobEdits().at(idx).vm.$emit('delete'); const triggerBlobUpdate = (idx, props) => findBlobEdits().at(idx).vm.$emit('blob-updated', props); afterEach(() => { diff --git a/spec/frontend/snippets/components/snippet_visibility_edit_spec.js b/spec/frontend/snippets/components/snippet_visibility_edit_spec.js index 3151090f388..62d1ac9b476 100644 --- a/spec/frontend/snippets/components/snippet_visibility_edit_spec.js +++ b/spec/frontend/snippets/components/snippet_visibility_edit_spec.js @@ -40,7 +40,7 @@ describe('Snippet Visibility Edit component', () => { const findLink = () => wrapper.find('label').find(GlLink); const findRadios = () => wrapper.find(GlFormRadioGroup).findAll(GlFormRadio); const findRadiosData = () => - findRadios().wrappers.map(x => { + findRadios().wrappers.map((x) => { return { value: x.find('input').attributes('value'), icon: x.find(GlIcon).props('name'), diff --git a/spec/frontend/snippets/utils/blob_spec.js b/spec/frontend/snippets/utils/blob_spec.js index c20cf2e6102..4c6cee32614 100644 --- a/spec/frontend/snippets/utils/blob_spec.js +++ b/spec/frontend/snippets/utils/blob_spec.js @@ -2,7 +2,7 @@ import { cloneDeep } from 'lodash'; import { decorateBlob, createBlob, diffAll } from '~/snippets/utils/blob'; import { testEntries, createBlobsFromTestEntries } from '../test_utils'; -jest.mock('lodash/uniqueId', () => arg => `${arg}fakeUniqueId`); +jest.mock('lodash/uniqueId', () => (arg) => `${arg}fakeUniqueId`); const TEST_RAW_BLOB = { rawPath: '/test/blob/7/raw', diff --git a/spec/frontend/static_site_editor/components/edit_area_spec.js b/spec/frontend/static_site_editor/components/edit_area_spec.js index ed33f93ec51..e3656fc40f8 100644 --- a/spec/frontend/static_site_editor/components/edit_area_spec.js +++ b/spec/frontend/static_site_editor/components/edit_area_spec.js @@ -22,7 +22,7 @@ import { imageRoot, } from '../mock_data'; -jest.mock('~/static_site_editor/services/formatter', () => jest.fn(str => `${str} format-pass`)); +jest.mock('~/static_site_editor/services/formatter', () => jest.fn((str) => `${str} format-pass`)); describe('~/static_site_editor/components/edit_area.vue', () => { let wrapper; @@ -126,7 +126,7 @@ describe('~/static_site_editor/components/edit_area.vue', () => { describe('when the mode changes', () => { let resetInitialValue; - const setInitialMode = mode => { + const setInitialMode = (mode) => { wrapper.setData({ editorMode: mode }); }; diff --git a/spec/frontend/static_site_editor/components/edit_meta_controls_spec.js b/spec/frontend/static_site_editor/components/edit_meta_controls_spec.js index b887570e947..cf82efc3d0b 100644 --- a/spec/frontend/static_site_editor/components/edit_meta_controls_spec.js +++ b/spec/frontend/static_site_editor/components/edit_meta_controls_spec.js @@ -35,7 +35,7 @@ describe('~/static_site_editor/components/edit_meta_controls.vue', () => { const findGlFormInputTitle = () => wrapper.find(GlFormInput); const findGlDropdownDescriptionTemplate = () => wrapper.find(GlDropdown); const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem); - const findDropdownItemByIndex = index => findAllDropdownItems().at(index); + const findDropdownItemByIndex = (index) => findAllDropdownItems().at(index); const findGlFormTextAreaDescription = () => wrapper.find(GlFormTextarea); diff --git a/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js b/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js index 24651543650..83ad23f7dcf 100644 --- a/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js +++ b/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js @@ -14,7 +14,7 @@ describe('static_site_editor/graphql/resolvers/file', () => { it('returns file content and title when fetching file successfully', () => { loadSourceContent.mockResolvedValueOnce({ title, content }); - return fileResolver({ fullPath: projectId }, { path: sourcePath }).then(file => { + return fileResolver({ fullPath: projectId }, { path: sourcePath }).then((file) => { expect(file).toEqual({ __typename: 'File', title, diff --git a/spec/frontend/static_site_editor/services/load_source_content_spec.js b/spec/frontend/static_site_editor/services/load_source_content_spec.js index 54061b7a503..98d437698c4 100644 --- a/spec/frontend/static_site_editor/services/load_source_content_spec.js +++ b/spec/frontend/static_site_editor/services/load_source_content_spec.js @@ -16,7 +16,7 @@ describe('loadSourceContent', () => { beforeEach(() => { jest.spyOn(Api, 'getRawFile').mockResolvedValue({ data: sourceContent }); - return loadSourceContent({ projectId, sourcePath }).then(_result => { + return loadSourceContent({ projectId, sourcePath }).then((_result) => { result = _result; }); }); diff --git a/spec/frontend/static_site_editor/services/submit_content_changes_spec.js b/spec/frontend/static_site_editor/services/submit_content_changes_spec.js index 6c2bff6740a..d4cbc5d235e 100644 --- a/spec/frontend/static_site_editor/services/submit_content_changes_spec.js +++ b/spec/frontend/static_site_editor/services/submit_content_changes_spec.js @@ -188,7 +188,7 @@ describe('submitContentChanges', () => { let result; beforeEach(() => { - return submitContentChanges(buildPayload()).then(_result => { + return submitContentChanges(buildPayload()).then((_result) => { result = _result; }); }); diff --git a/spec/frontend/syntax_highlight_spec.js b/spec/frontend/syntax_highlight_spec.js index d2fb5983f7b..418679e7d18 100644 --- a/spec/frontend/syntax_highlight_spec.js +++ b/spec/frontend/syntax_highlight_spec.js @@ -4,7 +4,7 @@ import $ from 'jquery'; import syntaxHighlight from '~/syntax_highlight'; describe('Syntax Highlighter', () => { - const stubUserColorScheme = value => { + const stubUserColorScheme = (value) => { if (window.gon == null) { window.gon = {}; } diff --git a/spec/frontend/task_list_spec.js b/spec/frontend/task_list_spec.js index 1261833e3ec..a8bdc506102 100644 --- a/spec/frontend/task_list_spec.js +++ b/spec/frontend/task_list_spec.js @@ -93,7 +93,7 @@ describe('TaskList', () => { }); describe('update', () => { - it('should disable task list items and make a patch request then enable them again', done => { + it('should disable task list items and make a patch request then enable them again', (done) => { const response = { data: { lock_version: 3 } }; jest.spyOn(taskList, 'enableTaskListItems').mockImplementation(() => {}); jest.spyOn(taskList, 'disableTaskListItems').mockImplementation(() => {}); @@ -137,7 +137,7 @@ describe('TaskList', () => { }); }); - it('should handle request error and enable task list items', done => { + it('should handle request error and enable task list items', (done) => { const response = { data: { error: 1 } }; jest.spyOn(taskList, 'enableTaskListItems').mockImplementation(() => {}); jest.spyOn(taskList, 'onError').mockImplementation(() => {}); diff --git a/spec/frontend/tooltips/components/tooltips_spec.js b/spec/frontend/tooltips/components/tooltips_spec.js index 0b8c76db11d..3a894427643 100644 --- a/spec/frontend/tooltips/components/tooltips_spec.js +++ b/spec/frontend/tooltips/components/tooltips_spec.js @@ -18,7 +18,7 @@ describe('tooltips/components/tooltips.vue', () => { ...attributes, }; - Object.keys(defaults).forEach(name => { + Object.keys(defaults).forEach((name) => { target.setAttribute(name, defaults[name]); }); diff --git a/spec/frontend/tooltips/index_spec.js b/spec/frontend/tooltips/index_spec.js index 86da1caab3e..bff9ee0c7f2 100644 --- a/spec/frontend/tooltips/index_spec.js +++ b/spec/frontend/tooltips/index_spec.js @@ -20,7 +20,7 @@ describe('tooltips/index.js', () => { title: 'default title', }; - Object.keys(attributes).forEach(name => { + Object.keys(attributes).forEach((name) => { target.setAttribute(name, attributes[name]); }); @@ -46,7 +46,7 @@ describe('tooltips/index.js', () => { }); afterEach(() => { - document.body.childNodes.forEach(node => node.remove()); + document.body.childNodes.forEach((node) => node.remove()); destroy(); }); diff --git a/spec/frontend/user_lists/components/add_user_modal_spec.js b/spec/frontend/user_lists/components/add_user_modal_spec.js index 82ce195d7cd..c9ad40ed228 100644 --- a/spec/frontend/user_lists/components/add_user_modal_spec.js +++ b/spec/frontend/user_lists/components/add_user_modal_spec.js @@ -4,7 +4,7 @@ import AddUserModal from '~/user_lists/components/add_user_modal.vue'; describe('Add User Modal', () => { let wrapper; - const click = testId => wrapper.find(`[data-testid="${testId}"]`).trigger('click'); + const click = (testId) => wrapper.find(`[data-testid="${testId}"]`).trigger('click'); beforeEach(() => { wrapper = mount(AddUserModal, { diff --git a/spec/frontend/user_lists/components/edit_user_list_spec.js b/spec/frontend/user_lists/components/edit_user_list_spec.js index 51a38e12916..958e86ac050 100644 --- a/spec/frontend/user_lists/components/edit_user_list_spec.js +++ b/spec/frontend/user_lists/components/edit_user_list_spec.js @@ -19,9 +19,9 @@ localVue.use(Vuex); describe('user_lists/components/edit_user_list', () => { let wrapper; - const setInputValue = value => wrapper.find('[data-testid="user-list-name"]').setValue(value); + const setInputValue = (value) => wrapper.find('[data-testid="user-list-name"]').setValue(value); - const click = button => wrapper.find(`[data-testid="${button}"]`).trigger('click'); + const click = (button) => wrapper.find(`[data-testid="${button}"]`).trigger('click'); const clickSave = () => click('save-user-list'); const destroy = () => wrapper?.destroy(); diff --git a/spec/frontend/user_lists/components/new_user_list_spec.js b/spec/frontend/user_lists/components/new_user_list_spec.js index 62fb0ca0859..421b49f40e9 100644 --- a/spec/frontend/user_lists/components/new_user_list_spec.js +++ b/spec/frontend/user_lists/components/new_user_list_spec.js @@ -18,9 +18,9 @@ localVue.use(Vuex); describe('user_lists/components/new_user_list', () => { let wrapper; - const setInputValue = value => wrapper.find('[data-testid="user-list-name"]').setValue(value); + const setInputValue = (value) => wrapper.find('[data-testid="user-list-name"]').setValue(value); - const click = button => wrapper.find(`[data-testid="${button}"]`).trigger('click'); + const click = (button) => wrapper.find(`[data-testid="${button}"]`).trigger('click'); beforeEach(() => { wrapper = mount(NewUserList, { diff --git a/spec/frontend/user_lists/components/user_list_spec.js b/spec/frontend/user_lists/components/user_list_spec.js index 5f9b7967846..cd00c421154 100644 --- a/spec/frontend/user_lists/components/user_list_spec.js +++ b/spec/frontend/user_lists/components/user_list_spec.js @@ -16,7 +16,7 @@ Vue.use(Vuex); describe('User List', () => { let wrapper; - const click = testId => wrapper.find(`[data-testid="${testId}"]`).trigger('click'); + const click = (testId) => wrapper.find(`[data-testid="${testId}"]`).trigger('click'); const findUserIds = () => wrapper.findAll('[data-testid="user-id"]'); @@ -38,7 +38,7 @@ describe('User List', () => { beforeEach(() => { Api.fetchFeatureFlagUserList.mockReturnValue( - new Promise(resolve => { + new Promise((resolve) => { resolveFn = resolve; }), ); @@ -110,15 +110,15 @@ describe('User List', () => { }); it('should add user IDs to the user list', () => { - newIds.forEach(id => expect(receivedUserIds).toContain(id)); + newIds.forEach((id) => expect(receivedUserIds).toContain(id)); }); it('should not remove existing user ids', () => { - userIds.forEach(id => expect(receivedUserIds).toContain(id)); + userIds.forEach((id) => expect(receivedUserIds).toContain(id)); }); it('should not submit empty IDs', () => { - parsedReceivedUserIds.forEach(id => expect(id).not.toBe('')); + parsedReceivedUserIds.forEach((id) => expect(id).not.toBe('')); }); it('should not create duplicate entries', () => { @@ -127,8 +127,8 @@ describe('User List', () => { it('should display the new IDs', () => { const userIdWrappers = findUserIds(); - newIds.forEach(id => { - const userIdWrapper = userIdWrappers.wrappers.find(w => w.text() === id); + newIds.forEach((id) => { + const userIdWrapper = userIdWrappers.wrappers.find((w) => w.text() === id); expect(userIdWrapper.exists()).toBe(true); }); }); @@ -150,7 +150,7 @@ describe('User List', () => { it('should not display the deleted user', () => { const userIdWrappers = findUserIds(); - const userIdWrapper = userIdWrappers.wrappers.find(w => w.text() === userIds[0]); + const userIdWrapper = userIdWrappers.wrappers.find((w) => w.text() === userIds[0]); expect(userIdWrapper).toBeUndefined(); }); }); diff --git a/spec/frontend/user_popovers_spec.js b/spec/frontend/user_popovers_spec.js index 0367b9cc924..1e0c4dd29ee 100644 --- a/spec/frontend/user_popovers_spec.js +++ b/spec/frontend/user_popovers_spec.js @@ -26,12 +26,12 @@ describe('User Popovers', () => { loadFixtures(fixtureTemplate); const usersCacheSpy = () => Promise.resolve(dummyUser); - jest.spyOn(UsersCache, 'retrieveById').mockImplementation(userId => usersCacheSpy(userId)); + jest.spyOn(UsersCache, 'retrieveById').mockImplementation((userId) => usersCacheSpy(userId)); const userStatusCacheSpy = () => Promise.resolve(dummyUserStatus); jest .spyOn(UsersCache, 'retrieveStatusById') - .mockImplementation(userId => userStatusCacheSpy(userId)); + .mockImplementation((userId) => userStatusCacheSpy(userId)); popovers = initUserPopovers(document.querySelectorAll(selector)); }); diff --git a/spec/frontend/vue_alerts_spec.js b/spec/frontend/vue_alerts_spec.js index b52737e6106..16eb2d44e4d 100644 --- a/spec/frontend/vue_alerts_spec.js +++ b/spec/frontend/vue_alerts_spec.js @@ -27,7 +27,7 @@ describe('VueAlerts', () => { setHTMLFixture( alerts .map( - x => ` + (x) => ` <div class="js-vue-alert" data-dismissible="${x.dismissible}" data-title="${x.title}" @@ -42,15 +42,15 @@ describe('VueAlerts', () => { const findJsHooks = () => document.querySelectorAll('.js-vue-alert'); const findAlerts = () => document.querySelectorAll('.gl-alert'); - const findAlertDismiss = alert => alert.querySelector('.gl-alert-dismiss'); + const findAlertDismiss = (alert) => alert.querySelector('.gl-alert-dismiss'); - const serializeAlert = alert => ({ + const serializeAlert = (alert) => ({ title: alert.querySelector('.gl-alert-title').textContent.trim(), html: alert.querySelector('.gl-alert-body div').innerHTML, dismissible: Boolean(alert.querySelector('.gl-alert-dismiss')), primaryButtonText: alert.querySelector('.gl-alert-action').textContent.trim(), primaryButtonLink: alert.querySelector('.gl-alert-action').href, - variant: [...alert.classList].find(x => x.match('gl-alert-')).replace('gl-alert-', ''), + variant: [...alert.classList].find((x) => x.match('gl-alert-')).replace('gl-alert-', ''), }); it('starts with only JsHooks', () => { diff --git a/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js b/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js index 62086de9465..fd8b0dddc61 100644 --- a/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js +++ b/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js @@ -15,10 +15,10 @@ import eventHub from '~/vue_merge_request_widget/event_hub'; jest.mock('~/flash'); const TEST_HELP_PATH = 'help/path'; -const testApprovedBy = () => [1, 7, 10].map(id => ({ id })); +const testApprovedBy = () => [1, 7, 10].map((id) => ({ id })); const testApprovals = () => ({ approved: false, - approved_by: testApprovedBy().map(user => ({ user })), + approved_by: testApprovedBy().map((user) => ({ user })), approval_rules_left: [], approvals_left: 4, suggested_approvers: [], @@ -31,7 +31,7 @@ const testApprovalRulesResponse = () => ({ rules: [{ id: 2 }] }); // For some reason, the `Promise.resolve()` needs to be deferred // or the timing doesn't work. const tick = () => Promise.resolve(); -const waitForTick = done => tick().then(done).catch(done.fail); +const waitForTick = (done) => tick().then(done).catch(done.fail); describe('MRWidget approvals', () => { let wrapper; @@ -114,7 +114,7 @@ describe('MRWidget approvals', () => { }); describe('when fetch approvals error', () => { - beforeEach(done => { + beforeEach((done) => { jest.spyOn(service, 'fetchApprovals').mockReturnValue(Promise.reject()); createComponent(); waitForTick(done); @@ -131,7 +131,7 @@ describe('MRWidget approvals', () => { describe('action button', () => { describe('when mr is closed', () => { - beforeEach(done => { + beforeEach((done) => { mr.isOpen = false; mr.approvals.user_has_approved = false; mr.approvals.user_can_approve = true; @@ -146,7 +146,7 @@ describe('MRWidget approvals', () => { }); describe('when user cannot approve', () => { - beforeEach(done => { + beforeEach((done) => { mr.approvals.user_has_approved = false; mr.approvals.user_can_approve = false; @@ -166,7 +166,7 @@ describe('MRWidget approvals', () => { }); describe('and MR is unapproved', () => { - beforeEach(done => { + beforeEach((done) => { createComponent(); waitForTick(done); }); @@ -186,7 +186,7 @@ describe('MRWidget approvals', () => { }); describe('with no approvers', () => { - beforeEach(done => { + beforeEach((done) => { mr.approvals.approved_by = []; createComponent(); waitForTick(done); @@ -202,7 +202,7 @@ describe('MRWidget approvals', () => { }); describe('with approvers', () => { - beforeEach(done => { + beforeEach((done) => { mr.approvals.approved_by = [{ user: { id: 7 } }]; createComponent(); waitForTick(done); @@ -219,7 +219,7 @@ describe('MRWidget approvals', () => { }); describe('when approve action is clicked', () => { - beforeEach(done => { + beforeEach((done) => { createComponent(); waitForTick(done); }); @@ -238,7 +238,7 @@ describe('MRWidget approvals', () => { }); describe('and after loading', () => { - beforeEach(done => { + beforeEach((done) => { findAction().vm.$emit('click'); waitForTick(done); }); @@ -257,7 +257,7 @@ describe('MRWidget approvals', () => { }); describe('and error', () => { - beforeEach(done => { + beforeEach((done) => { jest.spyOn(service, 'approveMergeRequest').mockReturnValue(Promise.reject()); findAction().vm.$emit('click'); waitForTick(done); @@ -271,7 +271,7 @@ describe('MRWidget approvals', () => { }); describe('when user has approved', () => { - beforeEach(done => { + beforeEach((done) => { mr.approvals.user_has_approved = true; mr.approvals.user_can_approve = false; @@ -289,7 +289,7 @@ describe('MRWidget approvals', () => { describe('when revoke action is clicked', () => { describe('and successful', () => { - beforeEach(done => { + beforeEach((done) => { findAction().vm.$emit('click'); waitForTick(done); }); @@ -308,7 +308,7 @@ describe('MRWidget approvals', () => { }); describe('and error', () => { - beforeEach(done => { + beforeEach((done) => { jest.spyOn(service, 'unapproveMergeRequest').mockReturnValue(Promise.reject()); findAction().vm.$emit('click'); waitForTick(done); @@ -331,7 +331,7 @@ describe('MRWidget approvals', () => { }); describe('and can approve', () => { - beforeEach(done => { + beforeEach((done) => { mr.approvals.user_can_approve = true; createComponent(); @@ -348,7 +348,7 @@ describe('MRWidget approvals', () => { }); describe('and cannot approve', () => { - beforeEach(done => { + beforeEach((done) => { mr.approvals.user_can_approve = false; createComponent(); @@ -367,7 +367,7 @@ describe('MRWidget approvals', () => { }); describe('approvals summary', () => { - beforeEach(done => { + beforeEach((done) => { createComponent(); waitForTick(done); }); diff --git a/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js b/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js index 822d075f28f..b8ba619fbb1 100644 --- a/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js +++ b/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js @@ -4,7 +4,7 @@ import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/ap import { toNounSeriesText } from '~/lib/utils/grammar'; import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue'; -const testApprovers = () => Array.from({ length: 5 }, (_, i) => i).map(id => ({ id })); +const testApprovers = () => Array.from({ length: 5 }, (_, i) => i).map((id) => ({ id })); const testRulesLeft = () => ['Lorem', 'Ipsum', 'dolar & sit']; const TEST_APPROVALS_LEFT = 3; diff --git a/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js b/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js index 1097f1f8b8d..07b569ea07a 100644 --- a/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js +++ b/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js @@ -10,7 +10,7 @@ describe('Artifacts List', () => { artifacts: artifactsList, }; - const mountComponent = props => { + const mountComponent = (props) => { wrapper = shallowMount(ArtifactsList, { propsData: { ...props, diff --git a/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js b/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js index d872ba9ffac..ba2a8ee0a41 100644 --- a/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js @@ -8,7 +8,7 @@ describe('Merge Request Collapsible Extension', () => { title: 'View artifacts', }; - const mountComponent = props => { + const mountComponent = (props) => { wrapper = mount(MrCollapsibleSection, { propsData: { ...props, diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js index f78fcfb52b4..720ce613b85 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js @@ -19,7 +19,7 @@ describe('MrWidgetAlertMessage', () => { }); describe('when type is not provided', () => { - it('should render a red message', done => { + it('should render a red message', (done) => { wrapper.vm.$nextTick(() => { expect(wrapper.classes()).toContain('danger_message'); expect(wrapper.classes()).not.toContain('warning_message'); @@ -29,7 +29,7 @@ describe('MrWidgetAlertMessage', () => { }); describe('when type === "danger"', () => { - it('should render a red message', done => { + it('should render a red message', (done) => { wrapper.setProps({ type: 'danger' }); wrapper.vm.$nextTick(() => { expect(wrapper.classes()).toContain('danger_message'); @@ -40,7 +40,7 @@ describe('MrWidgetAlertMessage', () => { }); describe('when type === "warning"', () => { - it('should render a red message', done => { + it('should render a red message', (done) => { wrapper.setProps({ type: 'warning' }); wrapper.vm.$nextTick(() => { expect(wrapper.classes()).toContain('warning_message'); @@ -51,7 +51,7 @@ describe('MrWidgetAlertMessage', () => { }); describe('when helpPath is not provided', () => { - it('should not render a help icon/link', done => { + it('should not render a help icon/link', (done) => { wrapper.vm.$nextTick(() => { const link = wrapper.find(GlLink); @@ -62,7 +62,7 @@ describe('MrWidgetAlertMessage', () => { }); describe('when helpPath is provided', () => { - it('should render a help icon/link', done => { + it('should render a help icon/link', (done) => { wrapper.setProps({ helpPath: '/path/to/help/docs' }); wrapper.vm.$nextTick(() => { const link = wrapper.find(GlLink); diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js index f9b6ac721d2..db884dfe015 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js @@ -187,7 +187,7 @@ describe('MRWidgetHeader', () => { expect(link.getAttribute('href')).toBeNull(); }); - it('renders web ide button with blank query string if target & source project branch', done => { + it('renders web ide button with blank query string if target & source project branch', (done) => { vm.mr.targetProjectFullPath = 'root/gitlab-ce'; vm.$nextTick(() => { @@ -202,7 +202,7 @@ describe('MRWidgetHeader', () => { }); }); - it('renders web ide button with relative URL', done => { + it('renders web ide button with relative URL', (done) => { gon.relative_url_root = '/gitlab'; vm.mr.iid = 2; diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js index 7a932feb3a7..79a0dd1e760 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js @@ -153,13 +153,13 @@ describe('MemoryUsage', () => { describe('loadMetrics', () => { const returnServicePromise = () => - new Promise(resolve => { + new Promise((resolve) => { resolve({ data: metricsMockData, }); }); - it('should load metrics data using MRWidgetService', done => { + it('should load metrics data using MRWidgetService', (done) => { jest.spyOn(MRWidgetService, 'fetchMetrics').mockReturnValue(returnServicePromise(true)); jest.spyOn(vm, 'computeGraphData').mockImplementation(() => {}); @@ -179,7 +179,7 @@ describe('MemoryUsage', () => { expect(el.querySelector('.js-usage-info')).toBeDefined(); }); - it('should show loading metrics message while metrics are being loaded', done => { + it('should show loading metrics message while metrics are being loaded', (done) => { vm.loadingMetrics = true; vm.hasMetrics = false; vm.loadFailed = false; @@ -194,7 +194,7 @@ describe('MemoryUsage', () => { }); }); - it('should show deployment memory usage when metrics are loaded', done => { + it('should show deployment memory usage when metrics are loaded', (done) => { // ignore BoostrapVue warnings jest.spyOn(console, 'warn').mockImplementation(); @@ -210,7 +210,7 @@ describe('MemoryUsage', () => { }); }); - it('should show failure message when metrics loading failed', done => { + it('should show failure message when metrics loading failed', (done) => { vm.loadingMetrics = false; vm.hasMetrics = false; vm.loadFailed = true; @@ -223,7 +223,7 @@ describe('MemoryUsage', () => { }); }); - it('should show metrics unavailable message when metrics loading failed', done => { + it('should show metrics unavailable message when metrics loading failed', (done) => { vm.loadingMetrics = false; vm.hasMetrics = false; vm.loadFailed = false; diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js index 354adb8e776..85468c5b0db 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js @@ -46,7 +46,7 @@ describe('MrWidgetPipelineContainer', () => { }); it('renders deployments', () => { - const expectedProps = mockStore.deployments.map(dep => + const expectedProps = mockStore.deployments.map((dep) => expect.objectContaining({ deployment: dep, showMetrics: false, @@ -55,7 +55,7 @@ describe('MrWidgetPipelineContainer', () => { const deployments = wrapper.findAll('.mr-widget-extension .js-pre-deployment'); - expect(deployments.wrappers.map(x => x.props())).toEqual(expectedProps); + expect(deployments.wrappers.map((x) => x.props())).toEqual(expectedProps); }); }); @@ -79,7 +79,7 @@ describe('MrWidgetPipelineContainer', () => { }); it('renders deployments', () => { - const expectedProps = mockStore.postMergeDeployments.map(dep => + const expectedProps = mockStore.postMergeDeployments.map((dep) => expect.objectContaining({ deployment: dep, showMetrics: true, @@ -88,7 +88,7 @@ describe('MrWidgetPipelineContainer', () => { const deployments = wrapper.findAll('.mr-widget-extension .js-post-deployment'); - expect(deployments.wrappers.map(x => x.props())).toEqual(expectedProps); + expect(deployments.wrappers.map((x) => x.props())).toEqual(expectedProps); }); }); diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js index 7364e0ef15e..3e5ab5cd32d 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js @@ -122,7 +122,7 @@ describe('MRWidgetPipeline', () => { it.each(mockData.buildsWithCoverage)( 'should have name and coverage for build %s listed in tooltip', - build => { + (build) => { const tooltipText = findPipelineCoverageTooltipText(); expect(tooltipText).toContain(`${build.name} (${build.coverage}%)`); diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js index 9923434a7dd..b60a2a166e9 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js @@ -49,7 +49,7 @@ describe('Merge request widget rebase component', () => { ); }); - it('it should render error message when it fails', done => { + it('it should render error message when it fails', (done) => { vm.rebasingError = 'Something went wrong!'; Vue.nextTick(() => { @@ -98,7 +98,7 @@ describe('Merge request widget rebase component', () => { }); describe('methods', () => { - it('checkRebaseStatus', done => { + it('checkRebaseStatus', (done) => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); vm = mountComponent(Component, { mr: {}, diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js index 0c4ec7ed99b..a33401c5ba9 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js @@ -5,7 +5,7 @@ import relatedLinksComponent from '~/vue_merge_request_widget/components/mr_widg describe('MRWidgetRelatedLinks', () => { let vm; - const createComponent = data => { + const createComponent = (data) => { const Component = Vue.extend(relatedLinksComponent); return mountComponent(Component, data); diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js index ae0f605c419..608c6363799 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js @@ -108,12 +108,12 @@ describe('MRWidgetAutoMergeEnabled', () => { describe('methods', () => { describe('cancelAutomaticMerge', () => { - it('should set flag and call service then tell main component to update the widget with data', done => { + it('should set flag and call service then tell main component to update the widget with data', (done) => { const mrObj = { is_new_mr_data: true, }; jest.spyOn(vm.service, 'cancelAutomaticMerge').mockReturnValue( - new Promise(resolve => { + new Promise((resolve) => { resolve({ data: mrObj, }); @@ -130,7 +130,7 @@ describe('MRWidgetAutoMergeEnabled', () => { }); describe('removeSourceBranch', () => { - it('should set flag and call service then request main component to update the widget', done => { + it('should set flag and call service then request main component to update the widget', (done) => { jest.spyOn(vm.service, 'merge').mockReturnValue( Promise.resolve({ data: { @@ -173,7 +173,7 @@ describe('MRWidgetAutoMergeEnabled', () => { expect(vm.$el.querySelector('.js-remove-source-branch').getAttribute('disabled')).toBeFalsy(); }); - it('should disable cancel auto merge button when the action is in progress', done => { + it('should disable cancel auto merge button when the action is in progress', (done) => { vm.isCancellingAutoMerge = true; Vue.nextTick(() => { @@ -182,7 +182,7 @@ describe('MRWidgetAutoMergeEnabled', () => { }); }); - it('should show source branch will be deleted text when it source branch set to remove', done => { + it('should show source branch will be deleted text when it source branch set to remove', (done) => { vm.mr.shouldRemoveSourceBranch = true; Vue.nextTick(() => { @@ -194,7 +194,7 @@ describe('MRWidgetAutoMergeEnabled', () => { }); }); - it('should not show delete source branch button when user not able to delete source branch', done => { + it('should not show delete source branch button when user not able to delete source branch', (done) => { vm.mr.currentUserId = 4; Vue.nextTick(() => { @@ -203,7 +203,7 @@ describe('MRWidgetAutoMergeEnabled', () => { }); }); - it('should disable delete source branch button when the action is in progress', done => { + it('should disable delete source branch button when the action is in progress', (done) => { vm.isRemovingSourceBranch = true; Vue.nextTick(() => { @@ -214,7 +214,7 @@ describe('MRWidgetAutoMergeEnabled', () => { }); }); - it('should render the status text as "...to merged automatically" if MWPS is selected', done => { + it('should render the status text as "...to merged automatically" if MWPS is selected', (done) => { Vue.set(vm.mr, 'autoMergeStrategy', MWPS_MERGE_STRATEGY); Vue.nextTick(() => { @@ -225,7 +225,7 @@ describe('MRWidgetAutoMergeEnabled', () => { }); }); - it('should render the cancel button as "Cancel automatic merge" if MWPS is selected', done => { + it('should render the cancel button as "Cancel automatic merge" if MWPS is selected', (done) => { Vue.set(vm.mr, 'autoMergeStrategy', MWPS_MERGE_STRATEGY); Vue.nextTick(() => { diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js index 764d23e9066..e4123b2ca83 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js @@ -4,7 +4,7 @@ import CommitsHeader from '~/vue_merge_request_widget/components/states/commits_ describe('Commits header component', () => { let wrapper; - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(CommitsHeader, { propsData: { isSquashEnabled: false, @@ -110,21 +110,21 @@ describe('Commits header component', () => { wrapper.setData({ expanded: true }); }); - it('toggle has aria-label equal to collapse', done => { + it('toggle has aria-label equal to collapse', (done) => { wrapper.vm.$nextTick(() => { expect(findCommitToggle().attributes('aria-label')).toBe('Collapse'); done(); }); }); - it('has a chevron-down icon', done => { + it('has a chevron-down icon', (done) => { wrapper.vm.$nextTick(() => { expect(findCommitToggle().props('icon')).toBe('chevron-down'); done(); }); }); - it('has a collapse text', done => { + it('has a collapse text', (done) => { wrapper.vm.$nextTick(() => { expect(findHeaderWrapper().text()).toBe('Collapse'); done(); diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js index ee67b6aae55..f5a059698b6 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js @@ -54,7 +54,7 @@ describe('MRWidgetConflicts', () => { vm.destroy(); }); - [false, true].forEach(featureEnabled => { + [false, true].forEach((featureEnabled) => { describe(`with GraphQL feature flag ${featureEnabled ? 'enabled' : 'disabled'}`, () => { beforeEach(() => { mergeRequestWidgetGraphql = featureEnabled; diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js index 6778a8f4a1f..48c1a9eedf9 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js @@ -49,7 +49,7 @@ describe('MRWidgetFailedToMerge', () => { }); describe('mergeError', () => { - it('removes forced line breaks', done => { + it('removes forced line breaks', (done) => { mr.mergeError = 'contains<br />line breaks<br />'; Vue.nextTick() @@ -98,7 +98,7 @@ describe('MRWidgetFailedToMerge', () => { }); describe('while it is refreshing', () => { - it('renders Refresing now', done => { + it('renders Refresing now', (done) => { vm.isRefreshing = true; Vue.nextTick(() => { @@ -139,7 +139,7 @@ describe('MRWidgetFailedToMerge', () => { }); }); - it('should just generic merge failed message if merge_error is not available', done => { + it('should just generic merge failed message if merge_error is not available', (done) => { vm.mr.mergeError = null; Vue.nextTick(() => { @@ -149,7 +149,7 @@ describe('MRWidgetFailedToMerge', () => { }); }); - it('should show refresh label when refresh requested', done => { + it('should show refresh label when refresh requested', (done) => { vm.refresh(); Vue.nextTick(() => { expect(vm.$el.innerText).not.toContain('Merge failed. Refreshing'); diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js index 9b51e8583ba..36c4174c03d 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js @@ -123,9 +123,9 @@ describe('MRWidgetMerged', () => { describe('methods', () => { describe('removeSourceBranch', () => { - it('should set flag and call service then request main component to update the widget', done => { + it('should set flag and call service then request main component to update the widget', (done) => { jest.spyOn(vm.service, 'removeSourceBranch').mockReturnValue( - new Promise(resolve => { + new Promise((resolve) => { resolve({ data: { message: 'Branch was deleted', @@ -173,7 +173,7 @@ describe('MRWidgetMerged', () => { ); }); - it('hides button to copy commit SHA if SHA does not exist', done => { + it('hides button to copy commit SHA if SHA does not exist', (done) => { vm.mr.mergeCommitSha = null; Vue.nextTick(() => { @@ -189,7 +189,7 @@ describe('MRWidgetMerged', () => { expect(selectors.mergeCommitShaLink.href).toBe(vm.mr.mergeCommitPath); }); - it('should not show source branch deleted text', done => { + it('should not show source branch deleted text', (done) => { vm.mr.sourceBranchRemoved = false; Vue.nextTick(() => { @@ -199,7 +199,7 @@ describe('MRWidgetMerged', () => { }); }); - it('should show source branch deleting text', done => { + it('should show source branch deleting text', (done) => { vm.mr.isRemovingSourceBranch = true; vm.mr.sourceBranchRemoved = false; diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js index f45368bf443..848677bf4d2 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js @@ -25,7 +25,7 @@ describe('MRWidgetMissingBranch', () => { wrapper.destroy(); }); - [true, false].forEach(mergeRequestWidgetGraphql => { + [true, false].forEach((mergeRequestWidgetGraphql) => { describe(`widget GraphQL feature flag is ${ mergeRequestWidgetGraphql ? 'enabled' : 'disabled' }`, () => { diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js index 003415961af..8eddf59820c 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js @@ -20,7 +20,7 @@ jest.mock('~/commons/nav/user_merge_requests', () => ({ const commitMessage = 'This is the commit message'; const squashCommitMessage = 'This is the squash commit message'; const commitMessageWithDescription = 'This is the commit message description'; -const createTestMr = customConfig => { +const createTestMr = (customConfig) => { const mr = { isPipelineActive: false, pipeline: null, @@ -346,8 +346,8 @@ describe('ReadyToMerge', () => { }); describe('handleMergeButtonClick', () => { - const returnPromise = status => - new Promise(resolve => { + const returnPromise = (status) => + new Promise((resolve) => { resolve({ data: { status, @@ -355,7 +355,7 @@ describe('ReadyToMerge', () => { }); }); - it('should handle merge when pipeline succeeds', done => { + it('should handle merge when pipeline succeeds', (done) => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest .spyOn(vm.service, 'merge') @@ -381,7 +381,7 @@ describe('ReadyToMerge', () => { }); }); - it('should handle merge failed', done => { + it('should handle merge failed', (done) => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(vm.service, 'merge').mockReturnValue(returnPromise('failed')); vm.handleMergeButtonClick(false, true); @@ -398,7 +398,7 @@ describe('ReadyToMerge', () => { }); }); - it('should handle merge action accepted case', done => { + it('should handle merge action accepted case', (done) => { jest.spyOn(vm.service, 'merge').mockReturnValue(returnPromise('success')); jest.spyOn(vm, 'initiateMergePolling').mockImplementation(() => {}); vm.handleMergeButtonClick(); @@ -433,8 +433,8 @@ describe('ReadyToMerge', () => { }); describe('handleMergePolling', () => { - const returnPromise = state => - new Promise(resolve => { + const returnPromise = (state) => + new Promise((resolve) => { resolve({ data: { state, @@ -447,7 +447,7 @@ describe('ReadyToMerge', () => { loadFixtures('merge_requests/merge_request_of_current_user.html'); }); - it('should call start and stop polling when MR merged', done => { + it('should call start and stop polling when MR merged', (done) => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged')); jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {}); @@ -476,7 +476,7 @@ describe('ReadyToMerge', () => { }); }); - it('updates status box', done => { + it('updates status box', (done) => { jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged')); jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {}); @@ -495,7 +495,7 @@ describe('ReadyToMerge', () => { }); }); - it('updates merge request count badge', done => { + it('updates merge request count badge', (done) => { jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged')); jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {}); @@ -511,7 +511,7 @@ describe('ReadyToMerge', () => { }); }); - it('should continue polling until MR is merged', done => { + it('should continue polling until MR is merged', (done) => { jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('some_other_state')); jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {}); @@ -547,8 +547,8 @@ describe('ReadyToMerge', () => { }); describe('handleRemoveBranchPolling', () => { - const returnPromise = state => - new Promise(resolve => { + const returnPromise = (state) => + new Promise((resolve) => { resolve({ data: { source_branch_exists: state, @@ -556,7 +556,7 @@ describe('ReadyToMerge', () => { }); }); - it('should call start and stop polling when MR merged', done => { + it('should call start and stop polling when MR merged', (done) => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise(false)); @@ -589,7 +589,7 @@ describe('ReadyToMerge', () => { }); }); - it('should continue polling until MR is merged', done => { + it('should continue polling until MR is merged', (done) => { jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise(true)); let cpc = false; // continuePollingCalled diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js index f9490ac77ff..cc160f6182d 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js @@ -8,7 +8,7 @@ const localVue = createLocalVue(); describe('Squash before merge component', () => { let wrapper; - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(localVue.extend(SquashBeforeMerge), { localVue, propsData: { diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js index 907906ebe98..6d63d4b1be3 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js @@ -47,12 +47,12 @@ describe('Wip', () => { }; describe('handleRemoveWIP', () => { - it('should make a request to service and handle response', done => { + it('should make a request to service and handle response', (done) => { const vm = createComponent(); jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(vm.service, 'removeWIP').mockReturnValue( - new Promise(resolve => { + new Promise((resolve) => { resolve({ data: mrObj, }); @@ -92,7 +92,7 @@ describe('Wip', () => { ); }); - it('should not show removeWIP button is user cannot update MR', done => { + it('should not show removeWIP button is user cannot update MR', (done) => { vm.mr.removeWIPPath = ''; Vue.nextTick(() => { diff --git a/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js b/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js index 7fe6b44ecc7..8da0d0f16d6 100644 --- a/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js +++ b/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js @@ -15,7 +15,7 @@ describe('MrWidgetTerraformConainer', () => { const propsData = { endpoint: '/path/to/terraform/report.json' }; const findHeader = () => wrapper.find('[data-testid="terraform-header-text"]'); - const findPlans = () => wrapper.findAll(TerraformPlan).wrappers.map(x => x.props('plan')); + const findPlans = () => wrapper.findAll(TerraformPlan).wrappers.map((x) => x.props('plan')); const mockPollingApi = (response, body, header) => { mock.onGet(propsData.endpoint).reply(response, body, header); diff --git a/spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js b/spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js index cc68ba0d9df..ea4eb44ebfe 100644 --- a/spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js +++ b/spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js @@ -14,7 +14,7 @@ describe('TerraformPlan', () => { const findIcon = () => wrapper.find('[data-testid="change-type-icon"]'); const findLogButton = () => wrapper.find('[data-testid="terraform-report-link"]'); - const mountWrapper = propsData => { + const mountWrapper = (propsData) => { wrapper = shallowMount(TerraformPlan, { stubs: { GlLink, GlSprintf }, propsData }); }; diff --git a/spec/frontend/vue_mr_widget/deployment/deployment_spec.js b/spec/frontend/vue_mr_widget/deployment/deployment_spec.js index 19a5566c3b1..87bf32351bd 100644 --- a/spec/frontend/vue_mr_widget/deployment/deployment_spec.js +++ b/spec/frontend/vue_mr_widget/deployment/deployment_spec.js @@ -116,7 +116,7 @@ describe('Deployment component', () => { if (actionButtons.length > 0) { describe('renders the expected button group', () => { - actionButtons.forEach(button => { + actionButtons.forEach((button) => { it(`renders ${button}`, () => { expect(wrapper.find(button).exists()).toBe(true); }); @@ -126,7 +126,7 @@ describe('Deployment component', () => { if (actionButtons.length === 0) { describe('does not render the button group', () => { - defaultGroup.forEach(button => { + defaultGroup.forEach((button) => { it(`does not render ${button}`, () => { expect(wrapper.find(button).exists()).toBe(false); }); diff --git a/spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js b/spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js index a12757d4cce..a5d91468ef2 100644 --- a/spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js +++ b/spec/frontend/vue_mr_widget/deployment/deployment_view_button_spec.js @@ -90,7 +90,7 @@ describe('Deployment View App button', () => { it('renders all the links to the review apps', () => { const allUrls = wrapper.findAll('.js-deploy-url-menu-item').wrappers; - const expectedUrls = deploymentMockData.changes.map(change => change.external_url); + const expectedUrls = deploymentMockData.changes.map((change) => change.external_url); expectedUrls.forEach((expectedUrl, idx) => { const deployUrl = allUrls[idx]; diff --git a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js index a20cd5b4400..b4083385117 100644 --- a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js @@ -14,8 +14,8 @@ import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/consta jest.mock('~/smart_interval'); -const returnPromise = data => - new Promise(resolve => { +const returnPromise = (data) => + new Promise((resolve) => { resolve({ data, }); @@ -180,7 +180,7 @@ describe('mrWidgetOptions', () => { }); describe('when merge request is opened', () => { - beforeEach(done => { + beforeEach((done) => { vm.mr.isOpen = true; vm.$nextTick(done); }); @@ -191,7 +191,7 @@ describe('mrWidgetOptions', () => { }); describe('when merge request is not opened', () => { - beforeEach(done => { + beforeEach((done) => { vm.mr.isOpen = false; vm.$nextTick(done); }); @@ -208,7 +208,7 @@ describe('mrWidgetOptions', () => { }); describe('when merge request is opened', () => { - beforeEach(done => { + beforeEach((done) => { vm.mr.isOpen = true; vm.$nextTick(done); }); @@ -222,7 +222,7 @@ describe('mrWidgetOptions', () => { describe('showMergePipelineForkWarning', () => { describe('when the source project and target project are the same', () => { - beforeEach(done => { + beforeEach((done) => { Vue.set(vm.mr, 'mergePipelinesEnabled', true); Vue.set(vm.mr, 'sourceProjectId', 1); Vue.set(vm.mr, 'targetProjectId', 1); @@ -235,7 +235,7 @@ describe('mrWidgetOptions', () => { }); describe('when merge pipelines are not enabled', () => { - beforeEach(done => { + beforeEach((done) => { Vue.set(vm.mr, 'mergePipelinesEnabled', false); Vue.set(vm.mr, 'sourceProjectId', 1); Vue.set(vm.mr, 'targetProjectId', 2); @@ -248,7 +248,7 @@ describe('mrWidgetOptions', () => { }); describe('when merge pipelines are enabled _and_ the source project and target project are different', () => { - beforeEach(done => { + beforeEach((done) => { Vue.set(vm.mr, 'mergePipelinesEnabled', true); Vue.set(vm.mr, 'sourceProjectId', 1); Vue.set(vm.mr, 'targetProjectId', 2); @@ -362,8 +362,8 @@ describe('mrWidgetOptions', () => { describe('bindEventHubListeners', () => { it.each` event | method | methodArgs - ${'MRWidgetUpdateRequested'} | ${'checkStatus'} | ${x => [x]} - ${'MRWidgetRebaseSuccess'} | ${'checkStatus'} | ${x => [x, true]} + ${'MRWidgetUpdateRequested'} | ${'checkStatus'} | ${(x) => [x]} + ${'MRWidgetRebaseSuccess'} | ${'checkStatus'} | ${(x) => [x, true]} ${'FetchActionsContent'} | ${'fetchActionsContent'} | ${() => []} ${'EnablePolling'} | ${'resumePolling'} | ${() => []} ${'DisablePolling'} | ${'stopPolling'} | ${() => []} @@ -421,7 +421,7 @@ describe('mrWidgetOptions', () => { document.body.removeChild(document.getElementById('favicon')); }); - it('should call setFavicon method', done => { + it('should call setFavicon method', (done) => { vm.mr.ciStatusFaviconPath = overlayDataUrl; vm.setFaviconHelper() .then(() => { @@ -438,7 +438,7 @@ describe('mrWidgetOptions', () => { .catch(done.fail); }); - it('should not call setFavicon when there is no ciStatusFaviconPath', done => { + it('should not call setFavicon when there is no ciStatusFaviconPath', (done) => { vm.mr.ciStatusFaviconPath = null; vm.setFaviconHelper() .then(() => { @@ -513,7 +513,7 @@ describe('mrWidgetOptions', () => { }); describe('rendering relatedLinks', () => { - beforeEach(done => { + beforeEach((done) => { vm.mr.relatedLinks = { assignToMe: null, closing: ` @@ -530,7 +530,7 @@ describe('mrWidgetOptions', () => { expect(vm.$el.querySelector('.close-related-link')).toBeDefined(); }); - it('does not render if state is nothingToMerge', done => { + it('does not render if state is nothingToMerge', (done) => { vm.mr.state = stateKey.nothingToMerge; Vue.nextTick(() => { expect(vm.$el.querySelector('.close-related-link')).toBeNull(); @@ -540,7 +540,7 @@ describe('mrWidgetOptions', () => { }); describe('rendering source branch removal status', () => { - it('renders when user cannot remove branch and branch should be removed', done => { + it('renders when user cannot remove branch and branch should be removed', (done) => { vm.mr.canRemoveSourceBranch = false; vm.mr.shouldRemoveSourceBranch = true; vm.mr.state = 'readyToMerge'; @@ -557,7 +557,7 @@ describe('mrWidgetOptions', () => { }); }); - it('does not render in merged state', done => { + it('does not render in merged state', (done) => { vm.mr.canRemoveSourceBranch = false; vm.mr.shouldRemoveSourceBranch = true; vm.mr.state = 'merged'; @@ -601,7 +601,7 @@ describe('mrWidgetOptions', () => { status: SUCCESS, }; - beforeEach(done => { + beforeEach((done) => { vm.mr.deployments.push( { ...deploymentMockData, @@ -636,7 +636,7 @@ describe('mrWidgetOptions', () => { describe('pipeline for target branch after merge', () => { describe('with information for target branch pipeline', () => { - beforeEach(done => { + beforeEach((done) => { vm.mr.state = 'merged'; vm.mr.mergePipeline = { id: 127, @@ -752,7 +752,7 @@ describe('mrWidgetOptions', () => { }); describe('with post merge deployments', () => { - beforeEach(done => { + beforeEach((done) => { vm.mr.postMergeDeployments = [ { id: 15, @@ -795,7 +795,7 @@ describe('mrWidgetOptions', () => { }); describe('without information for target branch pipeline', () => { - beforeEach(done => { + beforeEach((done) => { vm.mr.state = 'merged'; vm.$nextTick(done); @@ -807,7 +807,7 @@ describe('mrWidgetOptions', () => { }); describe('when state is not merged', () => { - beforeEach(done => { + beforeEach((done) => { vm.mr.state = 'archived'; vm.$nextTick(done); @@ -887,7 +887,7 @@ describe('mrWidgetOptions', () => { { isDismissedSuggestPipeline: true }, { mergeRequestAddCiConfigPath: null }, { hasCI: true }, - ])('with %s, should not suggest pipeline', async obj => { + ])('with %s, should not suggest pipeline', async (obj) => { Object.assign(vm.mr, obj); await vm.$nextTick(); diff --git a/spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js b/spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js index 026ea0e4d0a..1dfa7564535 100644 --- a/spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js +++ b/spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js @@ -22,7 +22,7 @@ describe('Artifacts App Store Actions', () => { }); describe('setEndpoint', () => { - it('should commit SET_ENDPOINT mutation', done => { + it('should commit SET_ENDPOINT mutation', (done) => { testAction( setEndpoint, 'endpoint.json', @@ -35,7 +35,7 @@ describe('Artifacts App Store Actions', () => { }); describe('requestArtifacts', () => { - it('should commit REQUEST_ARTIFACTS mutation', done => { + it('should commit REQUEST_ARTIFACTS mutation', (done) => { testAction( requestArtifacts, null, @@ -62,7 +62,7 @@ describe('Artifacts App Store Actions', () => { }); describe('success', () => { - it('dispatches requestArtifacts and receiveArtifactsSuccess ', done => { + it('dispatches requestArtifacts and receiveArtifactsSuccess ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, [ { text: 'result.txt', @@ -106,7 +106,7 @@ describe('Artifacts App Store Actions', () => { mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500); }); - it('dispatches requestArtifacts and receiveArtifactsError ', done => { + it('dispatches requestArtifacts and receiveArtifactsError ', (done) => { testAction( fetchArtifacts, null, @@ -127,7 +127,7 @@ describe('Artifacts App Store Actions', () => { }); describe('receiveArtifactsSuccess', () => { - it('should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200', done => { + it('should commit RECEIVE_ARTIFACTS_SUCCESS mutation with 200', (done) => { testAction( receiveArtifactsSuccess, { data: { summary: {} }, status: 200 }, @@ -138,7 +138,7 @@ describe('Artifacts App Store Actions', () => { ); }); - it('should not commit RECEIVE_ARTIFACTS_SUCCESS mutation with 204', done => { + it('should not commit RECEIVE_ARTIFACTS_SUCCESS mutation with 204', (done) => { testAction( receiveArtifactsSuccess, { data: { summary: {} }, status: 204 }, @@ -151,7 +151,7 @@ describe('Artifacts App Store Actions', () => { }); describe('receiveArtifactsError', () => { - it('should commit RECEIVE_ARTIFACTS_ERROR mutation', done => { + it('should commit RECEIVE_ARTIFACTS_ERROR mutation', (done) => { testAction( receiveArtifactsError, null, diff --git a/spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js b/spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js index 8b2c10ec50a..cfc846075ea 100644 --- a/spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js +++ b/spec/frontend/vue_mr_widget/stores/mr_widget_store_spec.js @@ -156,7 +156,7 @@ describe('MergeRequestStore', () => { it.each(['sast_comparison_path', 'secret_scanning_comparison_path'])( 'should set %s path', - property => { + (property) => { // Ensure something is set in the mock data expect(property in mockData).toBe(true); const expectedValue = mockData[property]; diff --git a/spec/frontend/vue_shared/components/actions_button_spec.js b/spec/frontend/vue_shared/components/actions_button_spec.js index 6e7ed9d612b..92c2d8bef0e 100644 --- a/spec/frontend/vue_shared/components/actions_button_spec.js +++ b/spec/frontend/vue_shared/components/actions_button_spec.js @@ -40,7 +40,7 @@ describe('Actions button component', () => { wrapper.destroy(); }); - const getTooltip = child => { + const getTooltip = (child) => { const directiveBinding = getBinding(child.element, 'gl-tooltip'); return directiveBinding.value; @@ -52,7 +52,7 @@ describe('Actions button component', () => { const parseDropdownItems = () => findDropdown() .findAll('gl-dropdown-item-stub,gl-dropdown-divider-stub') - .wrappers.map(x => { + .wrappers.map((x) => { if (x.is('gl-dropdown-divider-stub')) { return { type: 'divider' }; } diff --git a/spec/frontend/vue_shared/components/alert_details_table_spec.js b/spec/frontend/vue_shared/components/alert_details_table_spec.js index ef7815f9e9e..49b82cb4d4e 100644 --- a/spec/frontend/vue_shared/components/alert_details_table_spec.js +++ b/spec/frontend/vue_shared/components/alert_details_table_spec.js @@ -45,13 +45,13 @@ describe('AlertDetails', () => { const findTableComponent = () => wrapper.find(GlTable); const findTableKeys = () => findTableComponent().findAll('tbody td:first-child'); - const findTableFieldValueByKey = fieldKey => + const findTableFieldValueByKey = (fieldKey) => findTableComponent() .findAll('tbody tr') - .filter(row => row.text().includes(fieldKey)) + .filter((row) => row.text().includes(fieldKey)) .at(0) .find('td:nth-child(2)'); - const findTableField = (fields, fieldName) => fields.filter(row => row.text() === fieldName); + const findTableField = (fields, fieldName) => fields.filter((row) => row.text() === fieldName); describe('Alert details', () => { describe('empty state', () => { diff --git a/spec/frontend/vue_shared/components/awards_list_spec.js b/spec/frontend/vue_shared/components/awards_list_spec.js index 0fcb7a41f17..550ac4a9d38 100644 --- a/spec/frontend/vue_shared/components/awards_list_spec.js +++ b/spec/frontend/vue_shared/components/awards_list_spec.js @@ -58,10 +58,10 @@ describe('vue_shared/components/awards_list', () => { wrapper = mount(AwardsList, { propsData: props }); }; - const matchingEmojiTag = name => expect.stringMatching(`gl-emoji data-name="${name}"`); + const matchingEmojiTag = (name) => expect.stringMatching(`gl-emoji data-name="${name}"`); const findAwardButtons = () => wrapper.findAll('[data-testid="award-button"]'); const findAwardsData = () => - findAwardButtons().wrappers.map(x => { + findAwardButtons().wrappers.map((x) => { return { classes: x.classes(), title: x.attributes('title'), @@ -205,7 +205,7 @@ describe('vue_shared/components/awards_list', () => { const buttons = findAwardButtons(); expect(buttons.length).toBe(7); - expect(buttons.wrappers.every(x => x.classes('disabled'))).toBe(true); + expect(buttons.wrappers.every((x) => x.classes('disabled'))).toBe(true); }); }); diff --git a/spec/frontend/vue_shared/components/ci_badge_link_spec.js b/spec/frontend/vue_shared/components/ci_badge_link_spec.js index f656bb0b60d..a633ef65aa4 100644 --- a/spec/frontend/vue_shared/components/ci_badge_link_spec.js +++ b/spec/frontend/vue_shared/components/ci_badge_link_spec.js @@ -81,7 +81,7 @@ describe('CI Badge Link Component', () => { }); it('should render each status badge', () => { - Object.keys(statuses).map(status => { + Object.keys(statuses).map((status) => { vm = mountComponent(CIBadge, { status: statuses[status] }); expect(vm.$el.getAttribute('href')).toEqual(statuses[status].details_path); diff --git a/spec/frontend/vue_shared/components/commit_spec.js b/spec/frontend/vue_shared/components/commit_spec.js index b420e220081..6f3c97f7194 100644 --- a/spec/frontend/vue_shared/components/commit_spec.js +++ b/spec/frontend/vue_shared/components/commit_spec.js @@ -7,14 +7,14 @@ describe('Commit component', () => { let props; let wrapper; - const findIcon = name => { - const icons = wrapper.findAll(GlIcon).filter(c => c.attributes('name') === name); + const findIcon = (name) => { + const icons = wrapper.findAll(GlIcon).filter((c) => c.attributes('name') === name); return icons.length ? icons.at(0) : icons; }; const findUserAvatar = () => wrapper.find(UserAvatarLink); - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = shallowMount(CommitComponent, { propsData, }); diff --git a/spec/frontend/vue_shared/components/confirm_modal_spec.js b/spec/frontend/vue_shared/components/confirm_modal_spec.js index 96ccf56cbc6..db8d0674121 100644 --- a/spec/frontend/vue_shared/components/confirm_modal_spec.js +++ b/spec/frontend/vue_shared/components/confirm_modal_spec.js @@ -53,7 +53,7 @@ describe('vue_shared/components/confirm_modal', () => { const findFormData = () => findForm() .findAll('input') - .wrappers.map(x => ({ name: x.attributes('name'), value: x.attributes('value') })); + .wrappers.map((x) => ({ name: x.attributes('name'), value: x.attributes('value') })); describe('template', () => { describe('when modal data is set', () => { diff --git a/spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js b/spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js index c75891c9ed3..22ee6acfed8 100644 --- a/spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js +++ b/spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js @@ -9,7 +9,7 @@ describe('MarkdownViewer', () => { let wrapper; let mock; - const createComponent = props => { + const createComponent = (props) => { wrapper = mount(MarkdownViewer, { propsData: { ...props, diff --git a/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js b/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js index e46c63a1a32..10eacff630d 100644 --- a/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js +++ b/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js @@ -71,7 +71,7 @@ describe('date time picker lib', () => { '2019-19-23', '2019-09-23 x', '2019-09-29 24:24:24', - ].forEach(input => { + ].forEach((input) => { it(`throws error for invalid input like ${input}`, () => { expect(() => inputStringToIsoDate(input)).toThrow(); }); diff --git a/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js b/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js index afd1f1a3123..33667a1bb71 100644 --- a/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js +++ b/spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js @@ -17,7 +17,7 @@ describe('DateTimePicker', () => { const applyButtonElement = () => wrapper.find('button.btn-success').element; const findQuickRangeItems = () => wrapper.findAll('.dropdown-item'); - const createComponent = props => { + const createComponent = (props) => { wrapper = mount(DateTimePicker, { propsData: { ...props, @@ -235,7 +235,7 @@ describe('DateTimePicker', () => { it('unchecks quick range when text is input is clicked', () => { const findActiveItems = () => - findQuickRangeItems().filter(w => w.classes().includes('active')); + findQuickRangeItems().filter((w) => w.classes().includes('active')); expect(findActiveItems().length).toBe(1); diff --git a/spec/frontend/vue_shared/components/deprecated_modal_2_spec.js b/spec/frontend/vue_shared/components/deprecated_modal_2_spec.js index c37a44df6f8..6b569e876ed 100644 --- a/spec/frontend/vue_shared/components/deprecated_modal_2_spec.js +++ b/spec/frontend/vue_shared/components/deprecated_modal_2_spec.js @@ -156,12 +156,12 @@ describe('DeprecatedModal2', () => { describe('slots', () => { const slotContent = 'this should go into the slot'; - const modalWithSlot = slot => { + const modalWithSlot = (slot) => { return Vue.extend({ components: { DeprecatedModal2, }, - render: h => + render: (h) => h('deprecated-modal-2', [slot ? h('template', { slot }, slotContent) : slotContent]), }); }; diff --git a/spec/frontend/vue_shared/components/diff_viewer/diff_viewer_spec.js b/spec/frontend/vue_shared/components/diff_viewer/diff_viewer_spec.js index a6e4d812c3c..68e3ee11a0d 100644 --- a/spec/frontend/vue_shared/components/diff_viewer/diff_viewer_spec.js +++ b/spec/frontend/vue_shared/components/diff_viewer/diff_viewer_spec.js @@ -26,7 +26,7 @@ describe('DiffViewer', () => { vm.$destroy(); }); - it('renders image diff', done => { + it('renders image diff', (done) => { window.gon = { relative_url_root: '', }; @@ -46,7 +46,7 @@ describe('DiffViewer', () => { }); }); - it('renders fallback download diff display', done => { + it('renders fallback download diff display', (done) => { createComponent({ ...requiredProps, diffViewerMode: 'added', diff --git a/spec/frontend/vue_shared/components/diff_viewer/viewers/image_diff_viewer_spec.js b/spec/frontend/vue_shared/components/diff_viewer/viewers/image_diff_viewer_spec.js index f364f374887..b6bffbcc6f3 100644 --- a/spec/frontend/vue_shared/components/diff_viewer/viewers/image_diff_viewer_spec.js +++ b/spec/frontend/vue_shared/components/diff_viewer/viewers/image_diff_viewer_spec.js @@ -51,7 +51,7 @@ describe('ImageDiffViewer', () => { wrapper.destroy(); }); - it('renders image diff for replaced', done => { + it('renders image diff for replaced', (done) => { createComponent({ ...allProps }); vm.$nextTick(() => { @@ -78,7 +78,7 @@ describe('ImageDiffViewer', () => { }); }); - it('renders image diff for new', done => { + it('renders image diff for new', (done) => { createComponent({ ...allProps, diffMode: 'new', oldPath: '' }); setImmediate(() => { @@ -91,7 +91,7 @@ describe('ImageDiffViewer', () => { }); }); - it('renders image diff for deleted', done => { + it('renders image diff for deleted', (done) => { createComponent({ ...allProps, diffMode: 'deleted', newPath: '' }); setImmediate(() => { @@ -104,7 +104,7 @@ describe('ImageDiffViewer', () => { }); }); - it('renders image diff for renamed', done => { + it('renders image diff for renamed', (done) => { vm = new Vue({ components: { imageDiffViewer, @@ -139,7 +139,7 @@ describe('ImageDiffViewer', () => { }); describe('swipeMode', () => { - beforeEach(done => { + beforeEach((done) => { createComponent({ ...requiredProps }); setImmediate(() => { @@ -147,7 +147,7 @@ describe('ImageDiffViewer', () => { }); }); - it('switches to Swipe Mode', done => { + it('switches to Swipe Mode', (done) => { vm.$el.querySelector('.view-modes-menu li:nth-child(2)').click(); vm.$nextTick(() => { @@ -158,7 +158,7 @@ describe('ImageDiffViewer', () => { }); describe('onionSkin', () => { - beforeEach(done => { + beforeEach((done) => { createComponent({ ...requiredProps }); setImmediate(() => { @@ -166,7 +166,7 @@ describe('ImageDiffViewer', () => { }); }); - it('switches to Onion Skin Mode', done => { + it('switches to Onion Skin Mode', (done) => { vm.$el.querySelector('.view-modes-menu li:nth-child(3)').click(); vm.$nextTick(() => { @@ -177,7 +177,7 @@ describe('ImageDiffViewer', () => { }); }); - it('has working drag handler', done => { + it('has working drag handler', (done) => { vm.$el.querySelector('.view-modes-menu li:nth-child(3)').click(); vm.$nextTick(() => { diff --git a/spec/frontend/vue_shared/components/dismissible_container_spec.js b/spec/frontend/vue_shared/components/dismissible_container_spec.js index e49ca1e2285..2c0e363fa0e 100644 --- a/spec/frontend/vue_shared/components/dismissible_container_spec.js +++ b/spec/frontend/vue_shared/components/dismissible_container_spec.js @@ -43,7 +43,7 @@ describe('DismissibleContainer', () => { default: 'default slot', }; - it.each(Object.keys(slots))('renders the %s slot', slot => { + it.each(Object.keys(slots))('renders the %s slot', (slot) => { const slotContent = slots[slot]; wrapper = shallowMount(dismissibleContainer, { propsData, diff --git a/spec/frontend/vue_shared/components/editor_lite_spec.js b/spec/frontend/vue_shared/components/editor_lite_spec.js index cc11f76d01f..70fdd8e24a5 100644 --- a/spec/frontend/vue_shared/components/editor_lite_spec.js +++ b/spec/frontend/vue_shared/components/editor_lite_spec.js @@ -47,7 +47,7 @@ describe('Editor Lite component', () => { wrapper.destroy(); }); - const triggerChangeContent = val => { + const triggerChangeContent = (val) => { mockInstance.getValue.mockReturnValue(val); const [cb] = mockInstance.onDidChangeModelContent.mock.calls[0]; diff --git a/spec/frontend/vue_shared/components/expand_button_spec.js b/spec/frontend/vue_shared/components/expand_button_spec.js index 09566c6d959..724405a109f 100644 --- a/spec/frontend/vue_shared/components/expand_button_spec.js +++ b/spec/frontend/vue_shared/components/expand_button_spec.js @@ -66,7 +66,7 @@ describe('Expand button', () => { }); describe('on click', () => { - beforeEach(done => { + beforeEach((done) => { expanderPrependEl().trigger('click'); Vue.nextTick(done); }); @@ -85,7 +85,7 @@ describe('Expand button', () => { }); describe('when short text is provided', () => { - beforeEach(done => { + beforeEach((done) => { factory({ slots: { expanded: `<p>${text.expanded}</p>`, @@ -110,7 +110,7 @@ describe('Expand button', () => { }); describe('append button', () => { - beforeEach(done => { + beforeEach((done) => { expanderPrependEl().trigger('click'); Vue.nextTick(done); }); @@ -134,7 +134,7 @@ describe('Expand button', () => { }); describe('when short text is provided', () => { - beforeEach(done => { + beforeEach((done) => { factory({ slots: { expanded: `<p>${text.expanded}</p>`, diff --git a/spec/frontend/vue_shared/components/file_finder/index_spec.js b/spec/frontend/vue_shared/components/file_finder/index_spec.js index 40026021777..238a5440664 100644 --- a/spec/frontend/vue_shared/components/file_finder/index_spec.js +++ b/spec/frontend/vue_shared/components/file_finder/index_spec.js @@ -31,7 +31,7 @@ describe('File finder item spec', () => { }); describe('with entries', () => { - beforeEach(done => { + beforeEach((done) => { createComponent({ files: [ { @@ -57,7 +57,7 @@ describe('File finder item spec', () => { expect(vm.$el.textContent).not.toContain('folder'); }); - it('filters entries', done => { + it('filters entries', (done) => { vm.searchText = 'index'; setImmediate(() => { @@ -68,7 +68,7 @@ describe('File finder item spec', () => { }); }); - it('shows clear button when searchText is not empty', done => { + it('shows clear button when searchText is not empty', (done) => { vm.searchText = 'index'; setImmediate(() => { @@ -79,7 +79,7 @@ describe('File finder item spec', () => { }); }); - it('clear button resets searchText', done => { + it('clear button resets searchText', (done) => { vm.searchText = 'index'; waitForPromises() @@ -94,7 +94,7 @@ describe('File finder item spec', () => { .catch(done.fail); }); - it('clear button focuses search input', done => { + it('clear button focuses search input', (done) => { jest.spyOn(vm.$refs.searchInput, 'focus').mockImplementation(() => {}); vm.searchText = 'index'; @@ -111,7 +111,7 @@ describe('File finder item spec', () => { }); describe('listShowCount', () => { - it('returns 1 when no filtered entries exist', done => { + it('returns 1 when no filtered entries exist', (done) => { vm.searchText = 'testing 123'; setImmediate(() => { @@ -131,7 +131,7 @@ describe('File finder item spec', () => { expect(vm.listHeight).toBe(55); }); - it('returns 33 when entries dont exist', done => { + it('returns 33 when entries dont exist', (done) => { vm.searchText = 'testing 123'; setImmediate(() => { @@ -143,7 +143,7 @@ describe('File finder item spec', () => { }); describe('filteredBlobsLength', () => { - it('returns length of filtered blobs', done => { + it('returns length of filtered blobs', (done) => { vm.searchText = 'index'; setImmediate(() => { @@ -156,7 +156,7 @@ describe('File finder item spec', () => { describe('watches', () => { describe('searchText', () => { - it('resets focusedIndex when updated', done => { + it('resets focusedIndex when updated', (done) => { vm.focusedIndex = 1; vm.searchText = 'test'; @@ -169,7 +169,7 @@ describe('File finder item spec', () => { }); describe('visible', () => { - it('returns searchText when false', done => { + it('returns searchText when false', (done) => { vm.searchText = 'test'; vm.visible = true; @@ -206,7 +206,7 @@ describe('File finder item spec', () => { }); describe('onKeyup', () => { - it('opens file on enter key', done => { + it('opens file on enter key', (done) => { const event = new CustomEvent('keyup'); event.keyCode = ENTER_KEY_CODE; @@ -221,7 +221,7 @@ describe('File finder item spec', () => { }); }); - it('closes file finder on esc key', done => { + it('closes file finder on esc key', (done) => { const event = new CustomEvent('keyup'); event.keyCode = ESC_KEY_CODE; @@ -300,7 +300,7 @@ describe('File finder item spec', () => { }); describe('keyboard shortcuts', () => { - beforeEach(done => { + beforeEach((done) => { createComponent(); jest.spyOn(vm, 'toggle').mockImplementation(() => {}); @@ -308,7 +308,7 @@ describe('File finder item spec', () => { vm.$nextTick(done); }); - it('calls toggle on `t` key press', done => { + it('calls toggle on `t` key press', (done) => { Mousetrap.trigger('t'); vm.$nextTick() @@ -319,7 +319,7 @@ describe('File finder item spec', () => { .catch(done.fail); }); - it('calls toggle on `mod+p` key press', done => { + it('calls toggle on `mod+p` key press', (done) => { Mousetrap.trigger('mod+p'); vm.$nextTick() diff --git a/spec/frontend/vue_shared/components/file_finder/item_spec.js b/spec/frontend/vue_shared/components/file_finder/item_spec.js index 5a45a5dbba1..c60e6335389 100644 --- a/spec/frontend/vue_shared/components/file_finder/item_spec.js +++ b/spec/frontend/vue_shared/components/file_finder/item_spec.js @@ -37,7 +37,7 @@ describe('File finder item spec', () => { expect(vm.$el.classList).toContain('is-focused'); }); - it('does not have is-focused class when not focused', done => { + it('does not have is-focused class when not focused', (done) => { vm.focused = false; vm.$nextTick(() => { @@ -53,7 +53,7 @@ describe('File finder item spec', () => { expect(vm.$el.querySelector('.diff-changed-stats')).toBe(null); }); - it('renders when a changed file', done => { + it('renders when a changed file', (done) => { vm.file.changed = true; vm.$nextTick(() => { @@ -63,7 +63,7 @@ describe('File finder item spec', () => { }); }); - it('renders when a temp file', done => { + it('renders when a temp file', (done) => { vm.file.tempFile = true; vm.$nextTick(() => { @@ -85,7 +85,7 @@ describe('File finder item spec', () => { describe('path', () => { let el; - beforeEach(done => { + beforeEach((done) => { vm.searchText = 'file'; el = vm.$el.querySelector('.diff-changed-file-path'); @@ -97,7 +97,7 @@ describe('File finder item spec', () => { expect(el.querySelectorAll('.highlighted').length).toBe(4); }); - it('adds ellipsis to long text', done => { + it('adds ellipsis to long text', (done) => { vm.file.path = new Array(70) .fill() .map((_, i) => `${i}-`) @@ -113,7 +113,7 @@ describe('File finder item spec', () => { describe('name', () => { let el; - beforeEach(done => { + beforeEach((done) => { vm.searchText = 'file'; el = vm.$el.querySelector('.diff-changed-file-name'); @@ -125,7 +125,7 @@ describe('File finder item spec', () => { expect(el.querySelectorAll('.highlighted').length).toBe(4); }); - it('does not add ellipsis to long text', done => { + it('does not add ellipsis to long text', (done) => { vm.file.name = new Array(70) .fill() .map((_, i) => `${i}-`) diff --git a/spec/frontend/vue_shared/components/file_tree_spec.js b/spec/frontend/vue_shared/components/file_tree_spec.js index 38979d9d844..7a4982fd29b 100644 --- a/spec/frontend/vue_shared/components/file_tree_spec.js +++ b/spec/frontend/vue_shared/components/file_tree_spec.js @@ -28,7 +28,7 @@ describe('File Tree component', () => { const findFileRow = () => wrapper.find(MockFileRow); const findChildrenTrees = () => wrapper.findAll(FileTree).wrappers.slice(1); const findChildrenTreeProps = () => - findChildrenTrees().map(x => ({ + findChildrenTrees().map((x) => ({ ...x.props(), ...pick(x.attributes(), Object.keys(TEST_EXTA_ARGS)), })); @@ -61,7 +61,7 @@ describe('File Tree component', () => { describe('file tree', () => { const createChildren = () => [{ id: 1 }, { id: 2 }]; const createChildrenExpectation = (props = {}) => - createChildren().map(file => ({ + createChildren().map((file) => ({ fileRowComponent: MockFileRow, file, ...TEST_EXTA_ARGS, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js index 8cc5d6775a7..7c964be7825 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js @@ -28,7 +28,7 @@ import { } from './mock_data'; jest.mock('~/vue_shared/components/filtered_search_bar/filtered_search_utils', () => ({ - uniqueTokens: jest.fn().mockImplementation(tokens => tokens), + uniqueTokens: jest.fn().mockImplementation((tokens) => tokens), stripQuotes: jest.requireActual( '~/vue_shared/components/filtered_search_bar/filtered_search_utils', ).stripQuotes, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/store/modules/filters/test_helper.js b/spec/frontend/vue_shared/components/filtered_search_bar/store/modules/filters/test_helper.js index 1b7c80a5252..84297923df3 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/store/modules/filters/test_helper.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/store/modules/filters/test_helper.js @@ -1,11 +1,11 @@ export function getFilterParams(tokens, options = {}) { const { key = 'value', operator = '=', prop = 'title' } = options; - return tokens.map(token => { + return tokens.map((token) => { return { [key]: token[prop], operator }; }); } export function getFilterValues(tokens, options = {}) { const { prop = 'title' } = options; - return tokens.map(token => token[prop]); + return tokens.map((token) => token[prop]); } diff --git a/spec/frontend/vue_shared/components/gl_countdown_spec.js b/spec/frontend/vue_shared/components/gl_countdown_spec.js index 1c56b451776..fcc5c0cd310 100644 --- a/spec/frontend/vue_shared/components/gl_countdown_spec.js +++ b/spec/frontend/vue_shared/components/gl_countdown_spec.js @@ -17,7 +17,7 @@ describe('GlCountdown', () => { }); describe('when there is time remaining', () => { - beforeEach(done => { + beforeEach((done) => { vm = mountComponent(Component, { endDateString: '2000-01-01T01:02:03Z', }); @@ -29,7 +29,7 @@ describe('GlCountdown', () => { expect(vm.$el.textContent).toContain('01:02:03'); }); - it('updates remaining time', done => { + it('updates remaining time', (done) => { now = '2000-01-01T00:00:01Z'; jest.advanceTimersByTime(1000); @@ -43,7 +43,7 @@ describe('GlCountdown', () => { }); describe('when there is no time remaining', () => { - beforeEach(done => { + beforeEach((done) => { vm = mountComponent(Component, { endDateString: '1900-01-01T00:00:00Z', }); diff --git a/spec/frontend/vue_shared/components/gl_modal_vuex_spec.js b/spec/frontend/vue_shared/components/gl_modal_vuex_spec.js index 93f4db5df18..6802499ed52 100644 --- a/spec/frontend/vue_shared/components/gl_modal_vuex_spec.js +++ b/spec/frontend/vue_shared/components/gl_modal_vuex_spec.js @@ -118,7 +118,7 @@ describe('GlModalVuex', () => { expect(actions.hide).toHaveBeenCalledTimes(1); }); - it('calls bootstrap show when isVisible changes', done => { + it('calls bootstrap show when isVisible changes', (done) => { state.isVisible = false; factory(); @@ -135,7 +135,7 @@ describe('GlModalVuex', () => { .catch(done.fail); }); - it('calls bootstrap hide when isVisible changes', done => { + it('calls bootstrap hide when isVisible changes', (done) => { state.isVisible = true; factory(); @@ -154,7 +154,7 @@ describe('GlModalVuex', () => { it.each(['ok', 'cancel'])( 'passes an "%s" handler to the "modal-footer" slot scope', - handlerName => { + (handlerName) => { state.isVisible = true; const modalFooterSlotContent = jest.fn(); diff --git a/spec/frontend/vue_shared/components/issuable/issuable_header_warnings_spec.js b/spec/frontend/vue_shared/components/issuable/issuable_header_warnings_spec.js index 2f910a10bc6..a03a3915e1b 100644 --- a/spec/frontend/vue_shared/components/issuable/issuable_header_warnings_spec.js +++ b/spec/frontend/vue_shared/components/issuable/issuable_header_warnings_spec.js @@ -17,13 +17,13 @@ describe('IssuableHeaderWarnings', () => { const findConfidentialIcon = () => wrapper.find('[data-testid="confidential"]'); const findLockedIcon = () => wrapper.find('[data-testid="locked"]'); - const renderTestMessage = renders => (renders ? 'renders' : 'does not render'); + const renderTestMessage = (renders) => (renders ? 'renders' : 'does not render'); - const setLock = locked => { + const setLock = (locked) => { store.getters.getNoteableData.discussion_locked = locked; }; - const setConfidential = confidential => { + const setConfidential = (confidential) => { store.getters.getNoteableData.confidential = confidential; }; diff --git a/spec/frontend/vue_shared/components/issue/issue_assignees_spec.js b/spec/frontend/vue_shared/components/issue/issue_assignees_spec.js index 192e33d8b00..5f614bfc751 100644 --- a/spec/frontend/vue_shared/components/issue/issue_assignees_spec.js +++ b/spec/frontend/vue_shared/components/issue/issue_assignees_spec.js @@ -11,7 +11,7 @@ describe('IssueAssigneesComponent', () => { let wrapper; let vm; - const factory = props => { + const factory = (props) => { wrapper = shallowMount(IssueAssignees, { propsData: { assignees: mockAssigneesList, @@ -99,11 +99,11 @@ describe('IssueAssigneesComponent', () => { }); it('renders assignee', () => { - const data = findAvatars().wrappers.map(x => ({ + const data = findAvatars().wrappers.map((x) => ({ ...x.props(), })); - const expected = mockAssigneesList.slice(0, TEST_MAX_VISIBLE - 1).map(x => + const expected = mockAssigneesList.slice(0, TEST_MAX_VISIBLE - 1).map((x) => expect.objectContaining({ linkHref: x.web_url, imgAlt: `Avatar for ${x.name}`, diff --git a/spec/frontend/vue_shared/components/issue/issue_milestone_spec.js b/spec/frontend/vue_shared/components/issue/issue_milestone_spec.js index d1bfc180082..ffcb891c4fc 100644 --- a/spec/frontend/vue_shared/components/issue/issue_milestone_spec.js +++ b/spec/frontend/vue_shared/components/issue/issue_milestone_spec.js @@ -19,7 +19,7 @@ describe('IssueMilestoneComponent', () => { let wrapper; let vm; - beforeEach(done => { + beforeEach((done) => { wrapper = createComponent(); ({ vm } = wrapper); diff --git a/spec/frontend/vue_shared/components/local_storage_sync_spec.js b/spec/frontend/vue_shared/components/local_storage_sync_spec.js index 464fe3411dd..4c5a0c1e601 100644 --- a/spec/frontend/vue_shared/components/local_storage_sync_spec.js +++ b/spec/frontend/vue_shared/components/local_storage_sync_spec.js @@ -49,7 +49,7 @@ describe('Local Storage Sync', () => { it.each('foo', 3, true, ['foo', 'bar'], { foo: 'bar' })( 'saves updated value to localStorage', - newValue => { + (newValue) => { createComponent({ props: { storageKey, diff --git a/spec/frontend/vue_shared/components/markdown/apply_suggestion_spec.js b/spec/frontend/vue_shared/components/markdown/apply_suggestion_spec.js index 0598506891b..36bea798056 100644 --- a/spec/frontend/vue_shared/components/markdown/apply_suggestion_spec.js +++ b/spec/frontend/vue_shared/components/markdown/apply_suggestion_spec.js @@ -6,7 +6,7 @@ describe('Apply Suggestion component', () => { const propsData = { fileName: 'test.js', disabled: false }; let wrapper; - const createWrapper = props => { + const createWrapper = (props) => { wrapper = shallowMount(ApplySuggestionComponent, { propsData: { ...propsData, ...props } }); }; diff --git a/spec/frontend/vue_shared/components/markdown/header_spec.js b/spec/frontend/vue_shared/components/markdown/header_spec.js index 82bc9b9fe08..077c2174571 100644 --- a/spec/frontend/vue_shared/components/markdown/header_spec.js +++ b/spec/frontend/vue_shared/components/markdown/header_spec.js @@ -6,7 +6,7 @@ import ToolbarButton from '~/vue_shared/components/markdown/toolbar_button.vue'; describe('Markdown field header component', () => { let wrapper; - const createWrapper = props => { + const createWrapper = (props) => { wrapper = shallowMount(HeaderComponent, { propsData: { previewMarkdown: false, @@ -18,7 +18,7 @@ describe('Markdown field header component', () => { const findToolbarButtons = () => wrapper.findAll(ToolbarButton); const findToolbarButtonByProp = (prop, value) => findToolbarButtons() - .filter(button => button.props(prop) === value) + .filter((button) => button.props(prop) === value) .at(0); beforeEach(() => { diff --git a/spec/frontend/vue_shared/components/markdown/suggestions_spec.js b/spec/frontend/vue_shared/components/markdown/suggestions_spec.js index 34ccdf38b00..87bf5b97fb2 100644 --- a/spec/frontend/vue_shared/components/markdown/suggestions_spec.js +++ b/spec/frontend/vue_shared/components/markdown/suggestions_spec.js @@ -50,7 +50,7 @@ describe('Suggestion component', () => { let vm; let diffTable; - beforeEach(done => { + beforeEach((done) => { const Component = Vue.extend(SuggestionsComponent); vm = new Component({ @@ -86,7 +86,7 @@ describe('Suggestion component', () => { }); it('generates a diff table that contains contents the suggested lines', () => { - MOCK_DATA.suggestions[0].diff_lines.forEach(line => { + MOCK_DATA.suggestions[0].diff_lines.forEach((line) => { const text = line.text.substring(1); expect(diffTable.innerHTML.includes(text)).toBe(true); diff --git a/spec/frontend/vue_shared/components/markdown/toolbar_button_spec.js b/spec/frontend/vue_shared/components/markdown/toolbar_button_spec.js index 8a7946fd7b1..786dfabb990 100644 --- a/spec/frontend/vue_shared/components/markdown/toolbar_button_spec.js +++ b/spec/frontend/vue_shared/components/markdown/toolbar_button_spec.js @@ -10,7 +10,7 @@ describe('toolbar_button', () => { tag: 'test tag', }; - const createComponent = propUpdates => { + const createComponent = (propUpdates) => { wrapper = shallowMount(ToolbarButton, { propsData: { ...defaultProps, diff --git a/spec/frontend/vue_shared/components/notes/noteable_warning_spec.js b/spec/frontend/vue_shared/components/notes/noteable_warning_spec.js index 61660f79b71..cc9f05beb06 100644 --- a/spec/frontend/vue_shared/components/notes/noteable_warning_spec.js +++ b/spec/frontend/vue_shared/components/notes/noteable_warning_spec.js @@ -10,7 +10,7 @@ describe('Issue Warning Component', () => { const findConfidentialBlock = (w = wrapper) => w.find({ ref: 'confidential' }); const findLockedAndConfidentialBlock = (w = wrapper) => w.find({ ref: 'lockedAndConfidential' }); - const createComponent = props => + const createComponent = (props) => shallowMount(NoteableWarning, { propsData: { ...props, diff --git a/spec/frontend/vue_shared/components/ordered_layout_spec.js b/spec/frontend/vue_shared/components/ordered_layout_spec.js index eec153c3792..21588569d6a 100644 --- a/spec/frontend/vue_shared/components/ordered_layout_spec.js +++ b/spec/frontend/vue_shared/components/ordered_layout_spec.js @@ -29,7 +29,7 @@ describe('Ordered Layout', () => { const verifyOrder = () => wrapper .findAll('footer,header') - .wrappers.map(x => (x.element.tagName === 'FOOTER' ? 'footer' : 'header')); + .wrappers.map((x) => (x.element.tagName === 'FOOTER' ? 'footer' : 'header')); const createComponent = (props = {}) => { wrapper = mount(TestComponent, { diff --git a/spec/frontend/vue_shared/components/pagination_links_spec.js b/spec/frontend/vue_shared/components/pagination_links_spec.js index bf004c83c4f..ad82aee0098 100644 --- a/spec/frontend/vue_shared/components/pagination_links_spec.js +++ b/spec/frontend/vue_shared/components/pagination_links_spec.js @@ -49,7 +49,7 @@ describe('Pagination links component', () => { }); it('should provide translated text to GitLab UI pagination', () => { - Object.entries(translations).forEach(entry => { + Object.entries(translations).forEach((entry) => { expect(glPagination.vm[entry[0]]).toBe(entry[1]); }); }); diff --git a/spec/frontend/vue_shared/components/project_avatar/default_spec.js b/spec/frontend/vue_shared/components/project_avatar/default_spec.js index 090f8b69213..0daadeebc20 100644 --- a/spec/frontend/vue_shared/components/project_avatar/default_spec.js +++ b/spec/frontend/vue_shared/components/project_avatar/default_spec.js @@ -19,7 +19,7 @@ describe('ProjectAvatarDefault component', () => { vm.$destroy(); }); - it('renders identicon if project has no avatar_url', done => { + it('renders identicon if project has no avatar_url', (done) => { const expectedText = getFirstCharacterCapitalized(projectData.name); vm.project = { @@ -38,7 +38,7 @@ describe('ProjectAvatarDefault component', () => { .catch(done.fail); }); - it('renders avatar image if project has avatar_url', done => { + it('renders avatar image if project has avatar_url', (done) => { const avatarUrl = `${TEST_HOST}/images/home/nasa.svg`; vm.project = { diff --git a/spec/frontend/vue_shared/components/registry/details_row_spec.js b/spec/frontend/vue_shared/components/registry/details_row_spec.js index 16a55b84787..09dacfae363 100644 --- a/spec/frontend/vue_shared/components/registry/details_row_spec.js +++ b/spec/frontend/vue_shared/components/registry/details_row_spec.js @@ -8,7 +8,7 @@ describe('DetailsRow', () => { const findIcon = () => wrapper.find(GlIcon); const findDefaultSlot = () => wrapper.find('[data-testid="default-slot"]'); - const mountComponent = props => { + const mountComponent = (props) => { wrapper = shallowMount(component, { propsData: { icon: 'clock', diff --git a/spec/frontend/vue_shared/components/registry/list_item_spec.js b/spec/frontend/vue_shared/components/registry/list_item_spec.js index 2a48bf4f2d6..33c9c808dc3 100644 --- a/spec/frontend/vue_shared/components/registry/list_item_spec.js +++ b/spec/frontend/vue_shared/components/registry/list_item_spec.js @@ -11,7 +11,7 @@ describe('list item', () => { const findRightPrimarySlot = () => wrapper.find('[data-testid="right-primary"]'); const findRightSecondarySlot = () => wrapper.find('[data-testid="right-secondary"]'); const findRightActionSlot = () => wrapper.find('[data-testid="right-action"]'); - const findDetailsSlot = name => wrapper.find(`[data-testid="${name}"]`); + const findDetailsSlot = (name) => wrapper.find(`[data-testid="${name}"]`); const findToggleDetailsButton = () => wrapper.find(GlButton); const mountComponent = (propsData, slots) => { @@ -74,14 +74,14 @@ describe('list item', () => { findToggleDetailsButton().vm.$emit('click'); await wrapper.vm.$nextTick(); - slotNames.forEach(name => { + slotNames.forEach((name) => { expect(findDetailsSlot(name).exists()).toBe(true); }); }); it('are not visible when details are not shown', () => { mountComponent({}, slotMocks); - slotNames.forEach(name => { + slotNames.forEach((name) => { expect(findDetailsSlot(name).exists()).toBe(false); }); }); diff --git a/spec/frontend/vue_shared/components/registry/metadata_item_spec.js b/spec/frontend/vue_shared/components/registry/metadata_item_spec.js index ff968ff1831..955d6b85919 100644 --- a/spec/frontend/vue_shared/components/registry/metadata_item_spec.js +++ b/spec/frontend/vue_shared/components/registry/metadata_item_spec.js @@ -25,7 +25,7 @@ describe('Metadata Item', () => { const findText = () => wrapper.find('[data-testid="metadata-item-text"]'); const findTooltipOnTruncate = (w = wrapper) => w.find(TooltipOnTruncate); - describe.each(['xs', 's', 'm', 'l', 'xl'])('size class', size => { + describe.each(['xs', 's', 'm', 'l', 'xl'])('size class', (size) => { const className = `mw-${size}`; it(`${size} is assigned correctly to text`, () => { diff --git a/spec/frontend/vue_shared/components/registry/title_area_spec.js b/spec/frontend/vue_shared/components/registry/title_area_spec.js index e38e53d15b1..fb0009ebb8d 100644 --- a/spec/frontend/vue_shared/components/registry/title_area_spec.js +++ b/spec/frontend/vue_shared/components/registry/title_area_spec.js @@ -9,7 +9,7 @@ describe('title area', () => { const findSubHeaderSlot = () => wrapper.find('[data-testid="sub-header"]'); const findRightActionsSlot = () => wrapper.find('[data-testid="right-actions"]'); - const findMetadataSlot = name => wrapper.find(`[data-testid="${name}"]`); + const findMetadataSlot = (name) => wrapper.find(`[data-testid="${name}"]`); const findTitle = () => wrapper.find('[data-testid="title"]'); const findAvatar = () => wrapper.find(GlAvatar); const findInfoMessages = () => wrapper.findAll('[data-testid="info-message"]'); @@ -97,7 +97,7 @@ describe('title area', () => { mountComponent({ slots: slotMocks }); await wrapper.vm.$nextTick(); - slotNames.forEach(name => { + slotNames.forEach((name) => { expect(findMetadataSlot(name).exists()).toBe(true); }); }); @@ -106,7 +106,7 @@ describe('title area', () => { mountComponent({ slots: slotMocks, propsData: { title: 'foo', metadataLoading: true } }); await wrapper.vm.$nextTick(); - slotNames.forEach(name => { + slotNames.forEach((name) => { expect(findMetadataSlot(name).exists()).toBe(false); }); }); diff --git a/spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js b/spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js index d79df4d0557..51619cd9578 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js @@ -20,7 +20,7 @@ describe('Editor Service', () => { let mockInstance; let event; let handler; - const parseHtml = str => { + const parseHtml = (str) => { const wrapper = document.createElement('div'); wrapper.innerHTML = str; return wrapper.firstChild; diff --git a/spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js b/spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js index ded490b2568..81fd059ce4f 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js @@ -10,7 +10,7 @@ describe('Upload Image Tab', () => { afterEach(() => wrapper.destroy()); - const triggerInputEvent = size => { + const triggerInputEvent = (size) => { const file = { size, name: 'file-name.png' }; const mockEvent = new Event('input'); diff --git a/spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js b/spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js index be3a4030b1d..d59d4cc1de9 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js @@ -8,7 +8,7 @@ describe('Insert Video Modal', () => { const findModal = () => wrapper.find(GlModal); const findUrlInput = () => wrapper.find({ ref: 'urlInput' }); - const triggerInsertVideo = url => { + const triggerInsertVideo = (url) => { const preventDefault = jest.fn(); findUrlInput().vm.$emit('input', url); findModal().vm.$emit('primary', { preventDefault }); diff --git a/spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js b/spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js index 85516eae4cf..3caf03dabba 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js @@ -8,9 +8,9 @@ describe('rich_content_editor/services/html_to_markdown_renderer', () => { beforeEach(() => { baseRenderer = { - trim: jest.fn(input => `trimmed ${input}`), - getSpaceCollapsedText: jest.fn(input => `space collapsed ${input}`), - getSpaceControlled: jest.fn(input => `space controlled ${input}`), + trim: jest.fn((input) => `trimmed ${input}`), + getSpaceCollapsedText: jest.fn((input) => `space collapsed ${input}`), + getSpaceControlled: jest.fn((input) => `space controlled ${input}`), convert: jest.fn(), }; diff --git a/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js b/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js index 5cf3961819e..407072fb596 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js @@ -1,12 +1,12 @@ // Node spec helpers -export const buildMockTextNode = literal => ({ literal, type: 'text' }); +export const buildMockTextNode = (literal) => ({ literal, type: 'text' }); export const normalTextNode = buildMockTextNode('This is just normal text.'); // Token spec helpers -const buildMockUneditableOpenToken = type => { +const buildMockUneditableOpenToken = (type) => { return { type: 'openTag', tagName: type, @@ -17,7 +17,7 @@ const buildMockUneditableOpenToken = type => { }; }; -const buildMockTextToken = content => { +const buildMockTextToken = (content) => { return { type: 'text', tagName: null, @@ -25,7 +25,7 @@ const buildMockTextToken = content => { }; }; -const buildMockUneditableCloseToken = type => ({ type: 'closeTag', tagName: type }); +const buildMockUneditableCloseToken = (type) => ({ type: 'closeTag', tagName: type }); export const originToken = buildMockTextToken('{:.no_toc .hidden-md .hidden-lg}'); const uneditableOpenToken = buildMockUneditableOpenToken('div'); diff --git a/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js b/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js index 2897929f1bf..521885f5687 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js @@ -36,7 +36,7 @@ describe('Render Identifier Instance Text renderer', () => { `( 'should return inline editable, uneditable, and editable tokens in sequence', ({ start, middle, end }) => { - const buildMockTextToken = content => ({ type: 'text', tagName: null, content }); + const buildMockTextToken = (content) => ({ type: 'text', tagName: null, content }); const startToken = buildMockTextToken(start); const middleToken = buildMockTextToken(middle); diff --git a/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js b/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js index b3d9576f38b..470cf9bddaa 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js @@ -2,7 +2,7 @@ import renderer from '~/vue_shared/components/rich_content_editor/services/rende import { buildMockTextNode } from './mock_data'; -const buildMockParagraphNode = literal => { +const buildMockParagraphNode = (literal) => { return { firstChild: buildMockTextNode(literal), type: 'paragraph', diff --git a/spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js b/spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js index 2db15a71215..0e6f951bd53 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js @@ -9,7 +9,7 @@ describe('Toolbar Item', () => { const findIcon = () => wrapper.find(GlIcon); const findButton = () => wrapper.find('button'); - const buildWrapper = propsData => { + const buildWrapper = (propsData) => { wrapper = shallowMount(ToolbarItem, { propsData, directives: { diff --git a/spec/frontend/vue_shared/components/security_reports/help_icon_spec.js b/spec/frontend/vue_shared/components/security_reports/help_icon_spec.js index 60203493cbd..ae86106d86e 100644 --- a/spec/frontend/vue_shared/components/security_reports/help_icon_spec.js +++ b/spec/frontend/vue_shared/components/security_reports/help_icon_spec.js @@ -8,7 +8,7 @@ const discoverProjectSecurityPath = '/discoverProjectSecurityPath'; describe('HelpIcon component', () => { let wrapper; - const createWrapper = props => { + const createWrapper = (props) => { wrapper = shallowMount(HelpIcon, { propsData: { helpPath, diff --git a/spec/frontend/vue_shared/components/security_reports/security_summary_spec.js b/spec/frontend/vue_shared/components/security_reports/security_summary_spec.js index e57152c3cbf..f186eb848f2 100644 --- a/spec/frontend/vue_shared/components/security_reports/security_summary_spec.js +++ b/spec/frontend/vue_shared/components/security_reports/security_summary_spec.js @@ -6,7 +6,7 @@ import { groupedTextBuilder } from '~/vue_shared/security_reports/store/utils'; describe('SecuritySummary component', () => { let wrapper; - const createWrapper = message => { + const createWrapper = (message) => { wrapper = shallowMount(SecuritySummary, { propsData: { message }, stubs: { @@ -26,7 +26,7 @@ describe('SecuritySummary component', () => { groupedTextBuilder({ reportType: 'Security scanning', critical: 1, high: 0, total: 1 }), groupedTextBuilder({ reportType: 'Security scanning', critical: 0, high: 1, total: 1 }), groupedTextBuilder({ reportType: 'Security scanning', critical: 1, high: 2, total: 3 }), - ])('given the message %p', message => { + ])('given the message %p', (message) => { beforeEach(() => { createWrapper(message); }); diff --git a/spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js b/spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js index 08fc822577e..230442ec547 100644 --- a/spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js @@ -12,7 +12,7 @@ describe('collapsedGroupedDatePicker', () => { }); describe('toggleCollapse events', () => { - beforeEach(done => { + beforeEach((done) => { jest.spyOn(vm, 'toggleSidebar').mockImplementation(() => {}); vm.minDate = new Date('07/17/2016'); Vue.nextTick(done); @@ -26,7 +26,7 @@ describe('collapsedGroupedDatePicker', () => { }); describe('minDate and maxDate', () => { - beforeEach(done => { + beforeEach((done) => { vm.minDate = new Date('07/17/2016'); vm.maxDate = new Date('07/17/2017'); Vue.nextTick(done); @@ -42,7 +42,7 @@ describe('collapsedGroupedDatePicker', () => { }); describe('minDate', () => { - beforeEach(done => { + beforeEach((done) => { vm.minDate = new Date('07/17/2016'); Vue.nextTick(done); }); @@ -56,7 +56,7 @@ describe('collapsedGroupedDatePicker', () => { }); describe('maxDate', () => { - beforeEach(done => { + beforeEach((done) => { vm.maxDate = new Date('07/17/2017'); Vue.nextTick(done); }); diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js index 596cb22fca5..a55ad37c498 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js @@ -15,7 +15,7 @@ describe('BaseComponent', () => { let wrapper; let vm; - beforeEach(done => { + beforeEach((done) => { wrapper = createComponent(); ({ vm } = wrapper); diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js index c2091a681f2..4b4d265800b 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js @@ -5,7 +5,7 @@ import dropdownCreateLabelComponent from '~/vue_shared/components/sidebar/labels import { mockSuggestedColors } from './mock_data'; -const createComponent = headerTitle => { +const createComponent = (headerTitle) => { const Component = Vue.extend(dropdownCreateLabelComponent); return mountComponent(Component, { diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js index 71c040c6633..003f3d2b4e6 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js @@ -37,7 +37,7 @@ describe('DropdownValueCollapsedComponent', () => { const labels = mockLabels.concat(mockLabels); const vmMoreLabels = createComponent(labels); - const expectedText = labels.map(label => label.title).join(', '); + const expectedText = labels.map((label) => label.title).join(', '); expect(vmMoreLabels.labelsList).toBe(expectedText); vmMoreLabels.$destroy(); @@ -53,7 +53,7 @@ describe('DropdownValueCollapsedComponent', () => { const expectedText = `${mockMoreLabels .slice(0, 5) - .map(label => label.title) + .map((label) => label.title) .join(', ')}, and ${mockMoreLabels.length - 5} more`; expect(vmMoreLabels.labelsList).toBe(expectedText); @@ -61,7 +61,7 @@ describe('DropdownValueCollapsedComponent', () => { }); it('returns first label name when `labels` prop has only one item present', () => { - const text = mockLabels.map(label => label.title).join(', '); + const text = mockLabels.map((label) => label.title).join(', '); expect(vm.labelsList).toBe(text); }); diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js index 14273afc979..0f49fe4fc5b 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js @@ -24,7 +24,7 @@ const createComponent = (initialState = mockConfig) => { describe('DropdownContentsCreateView', () => { let wrapper; - const colors = Object.keys(mockSuggestedColors).map(color => ({ + const colors = Object.keys(mockSuggestedColors).map((color) => ({ [color]: mockSuggestedColors[color], })); diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js index c742220ba8a..4909c43bc96 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js @@ -19,7 +19,7 @@ describe('LabelsSelect Actions', () => { }); describe('setInitialState', () => { - it('sets initial store state', done => { + it('sets initial store state', (done) => { testAction( actions.setInitialState, mockInitialState, @@ -32,7 +32,7 @@ describe('LabelsSelect Actions', () => { }); describe('toggleDropdownButton', () => { - it('toggles dropdown button', done => { + it('toggles dropdown button', (done) => { testAction( actions.toggleDropdownButton, {}, @@ -45,7 +45,7 @@ describe('LabelsSelect Actions', () => { }); describe('toggleDropdownContents', () => { - it('toggles dropdown contents', done => { + it('toggles dropdown contents', (done) => { testAction( actions.toggleDropdownContents, {}, @@ -58,7 +58,7 @@ describe('LabelsSelect Actions', () => { }); describe('toggleDropdownContentsCreateView', () => { - it('toggles dropdown create view', done => { + it('toggles dropdown create view', (done) => { testAction( actions.toggleDropdownContentsCreateView, {}, @@ -71,13 +71,13 @@ describe('LabelsSelect Actions', () => { }); describe('requestLabels', () => { - it('sets value of `state.labelsFetchInProgress` to `true`', done => { + it('sets value of `state.labelsFetchInProgress` to `true`', (done) => { testAction(actions.requestLabels, {}, state, [{ type: types.REQUEST_LABELS }], [], done); }); }); describe('receiveLabelsSuccess', () => { - it('sets provided labels to `state.labels`', done => { + it('sets provided labels to `state.labels`', (done) => { const labels = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }]; testAction( @@ -96,7 +96,7 @@ describe('LabelsSelect Actions', () => { setFixtures('<div class="flash-container"></div>'); }); - it('sets value `state.labelsFetchInProgress` to `false`', done => { + it('sets value `state.labelsFetchInProgress` to `false`', (done) => { testAction( actions.receiveLabelsFailure, {}, @@ -129,7 +129,7 @@ describe('LabelsSelect Actions', () => { }); describe('on success', () => { - it('dispatches `requestLabels` & `receiveLabelsSuccess` actions', done => { + it('dispatches `requestLabels` & `receiveLabelsSuccess` actions', (done) => { const labels = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }]; mock.onGet(/labels.json/).replyOnce(200, labels); @@ -145,7 +145,7 @@ describe('LabelsSelect Actions', () => { }); describe('on failure', () => { - it('dispatches `requestLabels` & `receiveLabelsFailure` actions', done => { + it('dispatches `requestLabels` & `receiveLabelsFailure` actions', (done) => { mock.onGet(/labels.json/).replyOnce(500, {}); testAction( @@ -161,7 +161,7 @@ describe('LabelsSelect Actions', () => { }); describe('requestCreateLabel', () => { - it('sets value `state.labelCreateInProgress` to `true`', done => { + it('sets value `state.labelCreateInProgress` to `true`', (done) => { testAction( actions.requestCreateLabel, {}, @@ -174,7 +174,7 @@ describe('LabelsSelect Actions', () => { }); describe('receiveCreateLabelSuccess', () => { - it('sets value `state.labelCreateInProgress` to `false`', done => { + it('sets value `state.labelCreateInProgress` to `false`', (done) => { testAction( actions.receiveCreateLabelSuccess, {}, @@ -191,7 +191,7 @@ describe('LabelsSelect Actions', () => { setFixtures('<div class="flash-container"></div>'); }); - it('sets value `state.labelCreateInProgress` to `false`', done => { + it('sets value `state.labelCreateInProgress` to `false`', (done) => { testAction( actions.receiveCreateLabelFailure, {}, @@ -224,7 +224,7 @@ describe('LabelsSelect Actions', () => { }); describe('on success', () => { - it('dispatches `requestCreateLabel`, `receiveCreateLabelSuccess` & `toggleDropdownContentsCreateView` actions', done => { + it('dispatches `requestCreateLabel`, `receiveCreateLabelSuccess` & `toggleDropdownContentsCreateView` actions', (done) => { const label = { id: 1 }; mock.onPost(/labels.json/).replyOnce(200, label); @@ -244,7 +244,7 @@ describe('LabelsSelect Actions', () => { }); describe('on failure', () => { - it('dispatches `requestCreateLabel` & `receiveCreateLabelFailure` actions', done => { + it('dispatches `requestCreateLabel` & `receiveCreateLabelFailure` actions', (done) => { mock.onPost(/labels.json/).replyOnce(500, {}); testAction( @@ -260,7 +260,7 @@ describe('LabelsSelect Actions', () => { }); describe('updateSelectedLabels', () => { - it('updates `state.labels` based on provided `labels` param', done => { + it('updates `state.labels` based on provided `labels` param', (done) => { const labels = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }]; testAction( diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js index 8081806e314..208f2f2d42d 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js @@ -93,14 +93,14 @@ describe('LabelsSelect Mutations', () => { }); it('sets provided `labels` to `state.labels` along with `set` prop based on `state.selectedLabels`', () => { - const selectedLabelIds = selectedLabels.map(label => label.id); + const selectedLabelIds = selectedLabels.map((label) => label.id); const state = { selectedLabels, labelsFetchInProgress: true, }; mutations[types.RECEIVE_SET_LABELS_SUCCESS](state, labels); - state.labels.forEach(label => { + state.labels.forEach((label) => { if (selectedLabelIds.includes(label.id)) { expect(label.set).toBe(true); } @@ -162,7 +162,7 @@ describe('LabelsSelect Mutations', () => { }; mutations[types.UPDATE_SELECTED_LABELS](state, { labels: [{ id: 2 }] }); - state.labels.forEach(label => { + state.labels.forEach((label) => { if (updatedLabelIds.includes(label.id)) { expect(label.touched).toBe(true); expect(label.set).toBe(true); diff --git a/spec/frontend/vue_shared/components/slot_switch_spec.js b/spec/frontend/vue_shared/components/slot_switch_spec.js index 73307b5573f..f25b9877aba 100644 --- a/spec/frontend/vue_shared/components/slot_switch_spec.js +++ b/spec/frontend/vue_shared/components/slot_switch_spec.js @@ -10,14 +10,14 @@ describe('SlotSwitch', () => { let wrapper; - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = shallowMount(SlotSwitch, { propsData, slots, }); }; - const getChildrenHtml = () => wrapper.findAll('* *').wrappers.map(c => c.html()); + const getChildrenHtml = () => wrapper.findAll('* *').wrappers.map((c) => c.html()); afterEach(() => { if (wrapper) { diff --git a/spec/frontend/vue_shared/components/split_button_spec.js b/spec/frontend/vue_shared/components/split_button_spec.js index f1a427e1351..ad11e6519c4 100644 --- a/spec/frontend/vue_shared/components/split_button_spec.js +++ b/spec/frontend/vue_shared/components/split_button_spec.js @@ -19,7 +19,7 @@ const mockActionItems = [ describe('SplitButton', () => { let wrapper; - const createComponent = propsData => { + const createComponent = (propsData) => { wrapper = shallowMount(SplitButton, { propsData, }); @@ -27,7 +27,7 @@ describe('SplitButton', () => { const findDropdown = () => wrapper.find(GlDropdown); const findDropdownItem = (index = 0) => findDropdown().findAll(GlDropdownItem).at(index); - const selectItem = index => { + const selectItem = (index) => { findDropdownItem(index).vm.$emit('click'); return wrapper.vm.$nextTick(); @@ -84,7 +84,7 @@ describe('SplitButton', () => { const addChangeEventHandler = () => { changeEventHandler = jest.fn(); - wrapper.vm.$once('change', item => changeEventHandler(item)); + wrapper.vm.$once('change', (item) => changeEventHandler(item)); }; it('defaults to first actionItems event', () => { diff --git a/spec/frontend/vue_shared/components/table_pagination_spec.js b/spec/frontend/vue_shared/components/table_pagination_spec.js index 058dfcdbde2..12c47637358 100644 --- a/spec/frontend/vue_shared/components/table_pagination_spec.js +++ b/spec/frontend/vue_shared/components/table_pagination_spec.js @@ -6,7 +6,7 @@ describe('Pagination component', () => { let wrapper; let spy; - const mountComponent = props => { + const mountComponent = (props) => { wrapper = shallowMount(TablePagination, { propsData: props, }); diff --git a/spec/frontend/vue_shared/components/tabs/tab_spec.js b/spec/frontend/vue_shared/components/tabs/tab_spec.js index 8cf07a9177c..ee0c983c764 100644 --- a/spec/frontend/vue_shared/components/tabs/tab_spec.js +++ b/spec/frontend/vue_shared/components/tabs/tab_spec.js @@ -10,7 +10,7 @@ describe('Tab component', () => { vm = mountComponent(Component); }); - it('sets localActive to equal active', done => { + it('sets localActive to equal active', (done) => { vm.active = true; vm.$nextTick(() => { @@ -20,7 +20,7 @@ describe('Tab component', () => { }); }); - it('sets active class', done => { + it('sets active class', (done) => { vm.active = true; vm.$nextTick(() => { diff --git a/spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js b/spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js index 175abf5aae0..4544106fd43 100644 --- a/spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js +++ b/spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js @@ -139,7 +139,7 @@ describe('TooltipOnTruncate component', () => { createComponent({ propsData: { title: DUMMY_TEXT, - truncateTarget: el => el.childNodes[1], + truncateTarget: (el) => el.childNodes[1], }, slots: { default: [createChildElement(), createChildElement()], diff --git a/spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js b/spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js index 84e7a6a162e..4df8128adb0 100644 --- a/spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js +++ b/spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js @@ -20,7 +20,7 @@ describe('User Avatar Link Component', () => { username: 'username', }; - const createWrapper = props => { + const createWrapper = (props) => { wrapper = shallowMount(UserAvatarLink, { propsData: { ...defaultProps, diff --git a/spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js b/spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js index 6f66d1cafb9..e3cd2bb9aaa 100644 --- a/spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js +++ b/spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js @@ -9,13 +9,13 @@ const TEST_BREAKPOINT = 5; const TEST_EMPTY_MESSAGE = 'Lorem ipsum empty'; const DEFAULT_EMPTY_MESSAGE = 'None'; -const createUser = id => ({ +const createUser = (id) => ({ id, name: 'Lorem', web_url: `${TEST_HOST}/${id}`, avatar_url: `${TEST_HOST}/${id}/avatar`, }); -const createList = n => +const createList = (n) => Array(n) .fill(1) .map((x, id) => createUser(id)); @@ -79,10 +79,10 @@ describe('UserAvatarList', () => { factory({ propsData: { items } }); const links = wrapper.findAll(UserAvatarLink); - const linkProps = links.wrappers.map(x => x.props()); + const linkProps = links.wrappers.map((x) => x.props()); expect(linkProps).toEqual( - items.map(x => + items.map((x) => expect.objectContaining({ linkHref: x.web_url, imgSrc: x.avatar_url, diff --git a/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js b/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js index 46ffa9044fb..435c3a5406e 100644 --- a/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js +++ b/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js @@ -33,7 +33,7 @@ describe('User Popover Component', () => { wrapper.destroy(); }); - const findByTestId = testid => wrapper.find(`[data-testid="${testid}"]`); + const findByTestId = (testid) => wrapper.find(`[data-testid="${testid}"]`); const findUserStatus = () => wrapper.find('.js-user-status'); const findTarget = () => document.querySelector('.js-user-link'); const findAvailabilityStatus = () => wrapper.find(UserAvailabilityStatus); @@ -148,7 +148,7 @@ describe('User Popover Component', () => { createWrapper({ user }); expect( - wrapper.findAll(GlIcon).filter(icon => icon.props('name') === 'profile').length, + wrapper.findAll(GlIcon).filter((icon) => icon.props('name') === 'profile').length, ).toEqual(1); }); @@ -160,9 +160,9 @@ describe('User Popover Component', () => { createWrapper({ user }); - expect(wrapper.findAll(GlIcon).filter(icon => icon.props('name') === 'work').length).toEqual( - 1, - ); + expect( + wrapper.findAll(GlIcon).filter((icon) => icon.props('name') === 'work').length, + ).toEqual(1); }); }); diff --git a/spec/frontend/vue_shared/directives/validation_spec.js b/spec/frontend/vue_shared/directives/validation_spec.js index 814d6f43589..fc45b0172cd 100644 --- a/spec/frontend/vue_shared/directives/validation_spec.js +++ b/spec/frontend/vue_shared/directives/validation_spec.js @@ -50,7 +50,7 @@ describe('validation directive', () => { describe.each([true, false])( 'with fields untouched and "showValidation" set to "%s"', - showValidation => { + (showValidation) => { beforeEach(() => { createComponent({ showValidation }); }); @@ -78,7 +78,7 @@ describe('validation directive', () => { `( 'with input-attributes set to $inputAttributes', ({ inputAttributes, validValue, invalidValue }) => { - const setValueAndTriggerValidation = value => { + const setValueAndTriggerValidation = (value) => { const input = findInput(); input.setValue(value); input.trigger('blur'); diff --git a/spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js b/spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js index 7e70407655a..9138d2d3f4c 100644 --- a/spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js +++ b/spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js @@ -6,7 +6,7 @@ describe('SecurityReportDownloadDropdown component', () => { let wrapper; let artifacts; - const createComponent = props => { + const createComponent = (props) => { wrapper = shallowMount(SecurityReportDownloadDropdown, { propsData: { ...props }, }); diff --git a/spec/frontend/vue_shared/security_reports/security_reports_app_spec.js b/spec/frontend/vue_shared/security_reports/security_reports_app_spec.js index c440081a0c4..3681d966c4f 100644 --- a/spec/frontend/vue_shared/security_reports/security_reports_app_spec.js +++ b/spec/frontend/vue_shared/security_reports/security_reports_app_spec.js @@ -42,7 +42,7 @@ describe('Security reports app', () => { discoverProjectSecurityPath: '/discoverProjectSecurityPath', }; - const createComponent = options => { + const createComponent = (options) => { wrapper = mount( SecurityReportsApp, merge( @@ -61,7 +61,7 @@ describe('Security reports app', () => { const pendingHandler = () => new Promise(() => {}); const successHandler = () => Promise.resolve({ data: securityReportDownloadPathsQueryResponse }); const failureHandler = () => Promise.resolve({ errors: [{ message: 'some error' }] }); - const createMockApolloProvider = handler => { + const createMockApolloProvider = (handler) => { localVue.use(VueApollo); const requestHandlers = [[securityReportDownloadPathsQuery, handler]]; @@ -74,7 +74,7 @@ describe('Security reports app', () => { const findDownloadDropdown = () => wrapper.find(SecurityReportDownloadDropdown); const findPipelinesTabAnchor = () => wrapper.find('[data-testid="show-pipelines"]'); const findHelpIconComponent = () => wrapper.find(HelpIcon); - const setupMockJobArtifact = reportType => { + const setupMockJobArtifact = (reportType) => { jest .spyOn(Api, 'pipelineJobs') .mockResolvedValue({ data: [{ artifacts: [{ file_type: reportType }] }] }); @@ -93,8 +93,8 @@ describe('Security reports app', () => { describe.each([false, true])( 'given the coreSecurityMrWidgetCounts feature flag is %p', - coreSecurityMrWidgetCounts => { - const createComponentWithFlag = options => + (coreSecurityMrWidgetCounts) => { + const createComponentWithFlag = (options) => createComponent( merge( { @@ -108,7 +108,7 @@ describe('Security reports app', () => { ), ); - describe.each(SecurityReportsApp.reportTypes)('given a report type %p', reportType => { + describe.each(SecurityReportsApp.reportTypes)('given a report type %p', (reportType) => { beforeEach(() => { window.mrTabs = { tabShown: jest.fn() }; setupMockJobArtifact(reportType); @@ -245,7 +245,7 @@ describe('Security reports app', () => { describe('given the coreSecurityMrWidgetCounts feature flag is enabled', () => { let mock; - const createComponentWithFlagEnabled = options => + const createComponentWithFlagEnabled = (options) => createComponent( merge(options, { provide: { @@ -350,7 +350,7 @@ describe('Security reports app', () => { }); describe('given coreSecurityMrWidgetDownloads feature flag is enabled', () => { - const createComponentWithFlagEnabled = options => + const createComponentWithFlagEnabled = (options) => createComponent( merge(options, { provide: { diff --git a/spec/frontend/vue_shared/security_reports/store/getters_spec.js b/spec/frontend/vue_shared/security_reports/store/getters_spec.js index 8de704be455..b146a281d7b 100644 --- a/spec/frontend/vue_shared/security_reports/store/getters_spec.js +++ b/spec/frontend/vue_shared/security_reports/store/getters_spec.js @@ -13,7 +13,7 @@ import { } from '~/vue_shared/security_reports/store/getters'; import { CRITICAL, HIGH, LOW } from '~/vulnerabilities/constants'; -const generateVuln = severity => ({ severity }); +const generateVuln = (severity) => ({ severity }); describe('Security reports getters', () => { let state; diff --git a/spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js b/spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js index a11f4e05913..c9d1db8a504 100644 --- a/spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js +++ b/spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js @@ -26,7 +26,7 @@ describe('sast report actions', () => { }); describe('setDiffEndpoint', () => { - it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, done => { + it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, (done) => { testAction( actions.setDiffEndpoint, diffEndpoint, @@ -44,13 +44,13 @@ describe('sast report actions', () => { }); describe('requestDiff', () => { - it(`should commit ${types.REQUEST_DIFF}`, done => { + it(`should commit ${types.REQUEST_DIFF}`, (done) => { testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done); }); }); describe('receiveDiffSuccess', () => { - it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, done => { + it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, (done) => { testAction( actions.receiveDiffSuccess, reports, @@ -68,7 +68,7 @@ describe('sast report actions', () => { }); describe('receiveDiffError', () => { - it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, done => { + it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, (done) => { testAction( actions.receiveDiffError, error, @@ -107,7 +107,7 @@ describe('sast report actions', () => { .replyOnce(200, reports.enrichData); }); - it('should dispatch the `receiveDiffSuccess` action', done => { + it('should dispatch the `receiveDiffSuccess` action', (done) => { const { diff, enrichData } = reports; testAction( actions.fetchDiff, @@ -135,7 +135,7 @@ describe('sast report actions', () => { mock.onGet(diffEndpoint).replyOnce(200, reports.diff); }); - it('should dispatch the `receiveDiffSuccess` action with empty enrich data', done => { + it('should dispatch the `receiveDiffSuccess` action with empty enrich data', (done) => { const { diff } = reports; const enrichData = []; testAction( @@ -167,7 +167,7 @@ describe('sast report actions', () => { .replyOnce(404); }); - it('should dispatch the `receiveError` action', done => { + it('should dispatch the `receiveError` action', (done) => { testAction( actions.fetchDiff, {}, @@ -188,7 +188,7 @@ describe('sast report actions', () => { .replyOnce(200, reports.enrichData); }); - it('should dispatch the `receiveDiffError` action', done => { + it('should dispatch the `receiveDiffError` action', (done) => { testAction( actions.fetchDiff, {}, diff --git a/spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js b/spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js index bbcdfb5cd99..beda1a55438 100644 --- a/spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js +++ b/spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js @@ -26,7 +26,7 @@ describe('secret detection report actions', () => { }); describe('setDiffEndpoint', () => { - it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, done => { + it(`should commit ${types.SET_DIFF_ENDPOINT} with the correct path`, (done) => { testAction( actions.setDiffEndpoint, diffEndpoint, @@ -44,13 +44,13 @@ describe('secret detection report actions', () => { }); describe('requestDiff', () => { - it(`should commit ${types.REQUEST_DIFF}`, done => { + it(`should commit ${types.REQUEST_DIFF}`, (done) => { testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done); }); }); describe('receiveDiffSuccess', () => { - it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, done => { + it(`should commit ${types.RECEIVE_DIFF_SUCCESS} with the correct response`, (done) => { testAction( actions.receiveDiffSuccess, reports, @@ -68,7 +68,7 @@ describe('secret detection report actions', () => { }); describe('receiveDiffError', () => { - it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, done => { + it(`should commit ${types.RECEIVE_DIFF_ERROR} with the correct response`, (done) => { testAction( actions.receiveDiffError, error, @@ -107,7 +107,7 @@ describe('secret detection report actions', () => { .replyOnce(200, reports.enrichData); }); - it('should dispatch the `receiveDiffSuccess` action', done => { + it('should dispatch the `receiveDiffSuccess` action', (done) => { const { diff, enrichData } = reports; testAction( actions.fetchDiff, @@ -135,7 +135,7 @@ describe('secret detection report actions', () => { mock.onGet(diffEndpoint).replyOnce(200, reports.diff); }); - it('should dispatch the `receiveDiffSuccess` action with empty enrich data', done => { + it('should dispatch the `receiveDiffSuccess` action with empty enrich data', (done) => { const { diff } = reports; const enrichData = []; testAction( @@ -167,7 +167,7 @@ describe('secret detection report actions', () => { .replyOnce(404); }); - it('should dispatch the `receiveDiffError` action', done => { + it('should dispatch the `receiveDiffError` action', (done) => { testAction( actions.fetchDiff, {}, @@ -188,7 +188,7 @@ describe('secret detection report actions', () => { .replyOnce(200, reports.enrichData); }); - it('should dispatch the `receiveDiffError` action', done => { + it('should dispatch the `receiveDiffError` action', (done) => { testAction( actions.fetchDiff, {}, diff --git a/spec/frontend/vuex_shared/modules/modal/actions_spec.js b/spec/frontend/vuex_shared/modules/modal/actions_spec.js index 353dbcb522f..a8269194c0b 100644 --- a/spec/frontend/vuex_shared/modules/modal/actions_spec.js +++ b/spec/frontend/vuex_shared/modules/modal/actions_spec.js @@ -4,7 +4,7 @@ import * as actions from '~/vuex_shared/modules/modal/actions'; describe('Vuex ModalModule actions', () => { describe('open', () => { - it('works', done => { + it('works', (done) => { const data = { id: 7 }; testAction(actions.open, data, {}, [{ type: types.OPEN, payload: data }], [], done); @@ -12,19 +12,19 @@ describe('Vuex ModalModule actions', () => { }); describe('close', () => { - it('works', done => { + it('works', (done) => { testAction(actions.close, null, {}, [{ type: types.CLOSE }], [], done); }); }); describe('show', () => { - it('works', done => { + it('works', (done) => { testAction(actions.show, null, {}, [{ type: types.SHOW }], [], done); }); }); describe('hide', () => { - it('works', done => { + it('works', (done) => { testAction(actions.hide, null, {}, [{ type: types.HIDE }], [], done); }); }); diff --git a/spec/frontend/whats_new/components/app_spec.js b/spec/frontend/whats_new/components/app_spec.js index 7a9340da87a..13e6bec47ab 100644 --- a/spec/frontend/whats_new/components/app_spec.js +++ b/spec/frontend/whats_new/components/app_spec.js @@ -103,7 +103,7 @@ describe('App', () => { expect(actions.closeDrawer).toHaveBeenCalled(); }); - it.each([true, false])('passes open property', async openState => { + it.each([true, false])('passes open property', async (openState) => { wrapper.vm.$store.state.open = openState; await wrapper.vm.$nextTick(); @@ -183,7 +183,7 @@ describe('App', () => { const clickSecondTab = async () => { const secondTab = wrapper.findAll('.nav-link').at(1); await secondTab.trigger('click'); - await new Promise(resolve => requestAnimationFrame(resolve)); + await new Promise((resolve) => requestAnimationFrame(resolve)); }; beforeEach(() => { diff --git a/spec/frontend/wikis_spec.js b/spec/frontend/wikis_spec.js index cf1ea972697..0797d8ac16a 100644 --- a/spec/frontend/wikis_spec.js +++ b/spec/frontend/wikis_spec.js @@ -5,7 +5,7 @@ import { setHTMLFixture } from './helpers/fixtures'; describe('Wikis', () => { describe('setting the commit message when the title changes', () => { - const editFormHtmlFixture = args => `<form class="wiki-form ${ + const editFormHtmlFixture = (args) => `<form class="wiki-form ${ args.newPage ? 'js-new-wiki-page' : '' }"> <input type="text" id="wiki_title" value="My title" /> diff --git a/spec/frontend_integration/ide/ide_integration_spec.js b/spec/frontend_integration/ide/ide_integration_spec.js index dacc538d5ba..1d4dfd4a930 100644 --- a/spec/frontend_integration/ide/ide_integration_spec.js +++ b/spec/frontend_integration/ide/ide_integration_spec.js @@ -66,7 +66,7 @@ describe('WebIDE', () => { // Assert that +test is the only open tab const tabs = Array.from(document.querySelectorAll('.multi-file-tab')); - expect(tabs.map(x => x.textContent.trim())).toEqual(['+test']); + expect(tabs.map((x) => x.textContent.trim())).toEqual(['+test']); }); describe('editor info', () => { diff --git a/spec/frontend_integration/test_helpers/fixtures.js b/spec/frontend_integration/test_helpers/fixtures.js index 46946ed71f2..fde3fd8cb63 100644 --- a/spec/frontend_integration/test_helpers/fixtures.js +++ b/spec/frontend_integration/test_helpers/fixtures.js @@ -10,9 +10,9 @@ const createFactoryWithDefault = (fn, defaultValue) => () => { }; const factory = { - json: fn => createFactoryWithDefault(fn, { error: 'fixture not found' }), - text: fn => createFactoryWithDefault(fn, 'Hello world\nHow are you today?\n'), - binary: fn => createFactoryWithDefault(fn, ''), + json: (fn) => createFactoryWithDefault(fn, { error: 'fixture not found' }), + text: (fn) => createFactoryWithDefault(fn, 'Hello world\nHow are you today?\n'), + binary: (fn) => createFactoryWithDefault(fn, ''), }; export const getProject = factory.json(() => require('test_fixtures/api/projects/get.json')); diff --git a/spec/frontend_integration/test_helpers/mock_server/index.js b/spec/frontend_integration/test_helpers/mock_server/index.js index 6f090565635..2aebdefaafb 100644 --- a/spec/frontend_integration/test_helpers/mock_server/index.js +++ b/spec/frontend_integration/test_helpers/mock_server/index.js @@ -26,7 +26,7 @@ export const createMockServerOptions = () => ({ }, seeds(schema) { schema.db.loadData({ - files: getRepositoryFiles().map(path => ({ path })), + files: getRepositoryFiles().map((path) => ({ path })), projects: [getProject(), getEmptyProject()], branches: [getBranch()], mergeRequests: getMergeRequests(), diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/404.js b/spec/frontend_integration/test_helpers/mock_server/routes/404.js index 9e08016577b..bc8edba927e 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/404.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/404.js @@ -1,5 +1,5 @@ -export default server => { - ['get', 'post', 'put', 'delete', 'patch'].forEach(method => { +export default (server) => { + ['get', 'post', 'put', 'delete', 'patch'].forEach((method) => { server[method]('*', () => { return new Response(404); }); diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/ci.js b/spec/frontend_integration/test_helpers/mock_server/routes/ci.js index 83951f09c56..6f1593a2cf9 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/ci.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/ci.js @@ -1,6 +1,6 @@ import { getPipelinesEmptyResponse } from 'test_helpers/fixtures'; -export default server => { +export default (server) => { server.get('*/commit/:id/pipelines', () => { return getPipelinesEmptyResponse(); }); diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/graphql.js b/spec/frontend_integration/test_helpers/mock_server/routes/graphql.js index ebb5415ba97..a22763dcb45 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/graphql.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/graphql.js @@ -1,6 +1,6 @@ import { graphqlQuery } from '../graphql'; -export default server => { +export default (server) => { server.post('/api/graphql', (schema, request) => { const batches = JSON.parse(request.requestBody); diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/index.js b/spec/frontend_integration/test_helpers/mock_server/routes/index.js index eea196b5158..e30fecf2f06 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/index.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/index.js @@ -1,5 +1,5 @@ /* eslint-disable global-require */ -export default server => { +export default (server) => { [ require('./graphql'), require('./projects'), diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/projects.js b/spec/frontend_integration/test_helpers/mock_server/routes/projects.js index f4d8ce4b23d..de37aa98eee 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/projects.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/projects.js @@ -1,6 +1,6 @@ import { withKeys } from 'test_helpers/utils/obj'; -export default server => { +export default (server) => { server.get('/api/v4/projects/:id', (schema, request) => { const { id } = request.params; diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/repository.js b/spec/frontend_integration/test_helpers/mock_server/routes/repository.js index 166c0cc32db..bff9f20096a 100644 --- a/spec/frontend_integration/test_helpers/mock_server/routes/repository.js +++ b/spec/frontend_integration/test_helpers/mock_server/routes/repository.js @@ -1,9 +1,9 @@ import { createNewCommit, createCommitIdGenerator } from 'test_helpers/factories'; -export default server => { +export default (server) => { const commitIdGenerator = createCommitIdGenerator(); - server.get('/api/v4/projects/:id/repository/branches', schema => { + server.get('/api/v4/projects/:id/repository/branches', (schema) => { return schema.db.branches; }); @@ -15,7 +15,7 @@ export default server => { return branch.attrs; }); - server.get('*/-/files/:id', schema => { + server.get('*/-/files/:id', (schema) => { return schema.db.files.map(({ path }) => path); }); diff --git a/spec/frontend_integration/test_helpers/snapshot_serializer.js b/spec/frontend_integration/test_helpers/snapshot_serializer.js index 8c4f95a9156..aacd144217f 100644 --- a/spec/frontend_integration/test_helpers/snapshot_serializer.js +++ b/spec/frontend_integration/test_helpers/snapshot_serializer.js @@ -4,7 +4,7 @@ export default { }, print(element, serialize) { element.$_hit = true; - element.querySelectorAll('[style]').forEach(el => { + element.querySelectorAll('[style]').forEach((el) => { el.$_hit = true; if (el.style.display === 'none') { el.textContent = '(jest: contents hidden)'; diff --git a/spec/javascripts/fly_out_nav_browser_spec.js b/spec/javascripts/fly_out_nav_browser_spec.js index c7949640ce9..f92994594a9 100644 --- a/spec/javascripts/fly_out_nav_browser_spec.js +++ b/spec/javascripts/fly_out_nav_browser_spec.js @@ -157,7 +157,7 @@ describe('Fly out sidebar navigation', () => { '<div class="sidebar-sub-level-items" style="position: absolute; top: 0; left: 100px; height: 200px;"></div>'; }); - it('shows sub-items after 0ms if no menu is open', done => { + it('shows sub-items after 0ms if no menu is open', (done) => { mouseEnterTopItems(el); expect(getHideSubItemsInterval()).toBe(0); @@ -169,7 +169,7 @@ describe('Fly out sidebar navigation', () => { }); }); - it('shows sub-items after 300ms if a menu is currently open', done => { + it('shows sub-items after 300ms if a menu is currently open', (done) => { documentMouseMove({ clientX: el.getBoundingClientRect().left, clientY: el.getBoundingClientRect().top, diff --git a/spec/javascripts/lib/utils/browser_spec.js b/spec/javascripts/lib/utils/browser_spec.js index a537719f238..d219ccfacaa 100644 --- a/spec/javascripts/lib/utils/browser_spec.js +++ b/spec/javascripts/lib/utils/browser_spec.js @@ -21,8 +21,8 @@ const PIXEL_TOLERANCE = 0.2; * @param url * @returns {Promise} */ -const urlToImage = url => - new Promise(resolve => { +const urlToImage = (url) => + new Promise((resolve) => { const img = new Image(); img.onload = function () { resolve(img); @@ -64,10 +64,10 @@ describe('common_utils browser specific specs', () => { }); describe('createOverlayIcon', () => { - it('should return the favicon with the overlay', done => { + it('should return the favicon with the overlay', (done) => { commonUtils .createOverlayIcon(faviconDataUrl, overlayDataUrl) - .then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) + .then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) .then(([actual, expected]) => { expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE); done(); @@ -88,11 +88,11 @@ describe('common_utils browser specific specs', () => { document.body.removeChild(document.getElementById('favicon')); }); - it('should set page favicon to provided favicon overlay', done => { + it('should set page favicon to provided favicon overlay', (done) => { commonUtils .setFaviconOverlay(overlayDataUrl) .then(() => document.getElementById('favicon').getAttribute('href')) - .then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) + .then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) .then(([actual, expected]) => { expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE); done(); @@ -119,7 +119,7 @@ describe('common_utils browser specific specs', () => { document.body.removeChild(document.getElementById('favicon')); }); - it('should reset favicon in case of error', done => { + it('should reset favicon in case of error', (done) => { mock.onGet(BUILD_URL).replyOnce(500); commonUtils.setCiStatusFavicon(BUILD_URL).catch(() => { @@ -130,7 +130,7 @@ describe('common_utils browser specific specs', () => { }); }); - it('should set page favicon to CI status favicon based on provided status', done => { + it('should set page favicon to CI status favicon based on provided status', (done) => { mock.onGet(BUILD_URL).reply(200, { favicon: overlayDataUrl, }); @@ -138,7 +138,7 @@ describe('common_utils browser specific specs', () => { commonUtils .setCiStatusFavicon(BUILD_URL) .then(() => document.getElementById('favicon').getAttribute('href')) - .then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) + .then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) .then(([actual, expected]) => { expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE); done(); diff --git a/spec/javascripts/matchers.js b/spec/javascripts/matchers.js index b698f283eb4..ae005e152ed 100644 --- a/spec/javascripts/matchers.js +++ b/spec/javascripts/matchers.js @@ -2,7 +2,7 @@ import pixelmatch from 'pixelmatch'; export default { toImageDiffEqual: () => { - const getImageData = img => { + const getImageData = (img) => { const canvas = document.createElement('canvas'); canvas.width = img.width; canvas.height = img.height; diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js index 012b5059090..59136de0b0d 100644 --- a/spec/javascripts/test_bundle.js +++ b/spec/javascripts/test_bundle.js @@ -30,7 +30,7 @@ Vue.config.warnHandler = (msg, vm, trace) => { const currentStack = new Error().stack; const isInVueTestUtils = currentStack .split('\n') - .some(line => line.startsWith(' at VueWrapper.setProps (')); + .some((line) => line.startsWith(' at VueWrapper.setProps (')); if (isInVueTestUtils) { return; } @@ -75,7 +75,7 @@ gon.relative_url_root = ''; let hasUnhandledPromiseRejections = false; -window.addEventListener('unhandledrejection', event => { +window.addEventListener('unhandledrejection', (event) => { hasUnhandledPromiseRejections = true; console.error('Unhandled promise rejection:'); console.error(event.reason.stack || event.reason); @@ -87,11 +87,11 @@ window.addEventListener('unhandledrejection', event => { // enough for the socket to continue to communicate. // The downside is that it creates a minor performance penalty in the time it takes // to run our unit tests. -beforeEach(done => done()); +beforeEach((done) => done()); let longRunningTestTimeoutHandle; -beforeEach(done => { +beforeEach((done) => { longRunningTestTimeoutHandle = setTimeout(() => { done.fail('Test is running too long!'); }, 4000); @@ -111,8 +111,8 @@ if (process.env.IS_EE) { testContexts.push(require.context('ee_spec', true, /_spec$/)); } -testContexts.forEach(context => { - context.keys().forEach(path => { +testContexts.forEach((context) => { + context.keys().forEach((path) => { try { context(path); } catch (err) { @@ -128,7 +128,7 @@ testContexts.forEach(context => { }); describe('test errors', () => { - beforeAll(done => { + beforeAll((done) => { if (hasUnhandledPromiseRejections || hasVueWarnings || hasVueErrors) { setTimeout(done, 1000); } else { diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index ff6e5437559..a763dc08b73 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -992,7 +992,8 @@ RSpec.describe Gitlab::Database::MigrationHelpers do temp_undo_cleanup_column, type: :string, batch_column_name: :id, - type_cast_function: nil + type_cast_function: nil, + limit: nil ).and_return(true) expect(model).to receive(:rename_column) @@ -1007,7 +1008,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do model.undo_cleanup_concurrent_column_type_change(:users, :old, :string) end - it 'passes the type_cast_function and batch_column_name' do + it 'passes the type_cast_function, batch_column_name and limit' do expect(model).to receive(:column_exists?).with(:users, :other_batch_column).and_return(true) expect(model).to receive(:check_trigger_permissions!).with(:users) @@ -1017,7 +1018,8 @@ RSpec.describe Gitlab::Database::MigrationHelpers do temp_undo_cleanup_column, type: :string, batch_column_name: :other_batch_column, - type_cast_function: :custom_type_cast_function + type_cast_function: :custom_type_cast_function, + limit: 8 ).and_return(true) expect(model).to receive(:rename_column) @@ -1034,7 +1036,8 @@ RSpec.describe Gitlab::Database::MigrationHelpers do :old, :string, type_cast_function: :custom_type_cast_function, - batch_column_name: :other_batch_column + batch_column_name: :other_batch_column, + limit: 8 ) end diff --git a/spec/requests/api/graphql/container_repository/container_repository_details_spec.rb b/spec/requests/api/graphql/container_repository/container_repository_details_spec.rb index 85cb4217f66..44f924d8ae5 100644 --- a/spec/requests/api/graphql/container_repository/container_repository_details_spec.rb +++ b/spec/requests/api/graphql/container_repository/container_repository_details_spec.rb @@ -19,7 +19,7 @@ RSpec.describe 'container repository details' do let(:user) { project.owner } let(:variables) { {} } - let(:tags) { %w(latest tag1 tag2 tag3 tag4 tag5) } + let(:tags) { %w[latest tag1 tag2 tag3 tag4 tag5] } let(:container_repository_global_id) { container_repository.to_global_id.to_s } let(:container_repository_details_response) { graphql_data.dig('containerRepository') } @@ -77,6 +77,37 @@ RSpec.describe 'container repository details' do end end + context 'with a giant size tag' do + let(:tags) { %w[latest] } + let(:giant_size) { 1.terabyte } + let(:tag_sizes_response) { graphql_data_at('containerRepository', 'tags', 'nodes', 'totalSize') } + let(:fields) do + <<~GQL + tags { + nodes { + totalSize + } + } + GQL + end + + let(:query) do + graphql_query_for( + 'containerRepository', + { id: container_repository_global_id }, + fields + ) + end + + it 'returns the expected value as a string' do + stub_next_container_registry_tags_call(:total_size, giant_size) + + subject + + expect(tag_sizes_response.first).to eq(giant_size.to_s) + end + end + context 'limiting the number of tags' do let(:limit) { 2 } let(:tags_response) { container_repository_details_response.dig('tags', 'edges') } @@ -107,7 +138,7 @@ RSpec.describe 'container repository details' do end end - context 'with tags without a manifest' do + context 'with tags with a manifest containing nil fields' do let(:tags_response) { container_repository_details_response.dig('tags', 'nodes') } let(:errors) { container_repository_details_response.dig('errors') } |