diff options
429 files changed, 2151 insertions, 2911 deletions
diff --git a/.prettierrc b/.prettierrc index 5e2863a11f6..73988ef3f95 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,6 @@ { "printWidth": 100, "singleQuote": true, + "arrowParens": "avoid", "trailingComma": "all" } diff --git a/app/assets/javascripts/admin/cohorts/components/usage_ping_disabled.vue b/app/assets/javascripts/admin/cohorts/components/usage_ping_disabled.vue index bc2d96832fa..5da38495010 100644 --- a/app/assets/javascripts/admin/cohorts/components/usage_ping_disabled.vue +++ b/app/assets/javascripts/admin/cohorts/components/usage_ping_disabled.vue @@ -36,7 +36,7 @@ export default { ) " > - <template #docLink="{content}"> + <template #docLink="{ content }"> <gl-link :href="docsLink" target="_blank">{{ content }}</gl-link> </template> <template #strong="{ content }" diff --git a/app/assets/javascripts/admin/dev_ops_report/components/usage_ping_disabled.vue b/app/assets/javascripts/admin/dev_ops_report/components/usage_ping_disabled.vue index 316827e1b07..c0ad814172d 100644 --- a/app/assets/javascripts/admin/dev_ops_report/components/usage_ping_disabled.vue +++ b/app/assets/javascripts/admin/dev_ops_report/components/usage_ping_disabled.vue @@ -35,7 +35,7 @@ export default { ) " > - <template #docLink="{content}"> + <template #docLink="{ content }"> <gl-link :href="docsLink" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> diff --git a/app/assets/javascripts/admin/statistics_panel/index.js b/app/assets/javascripts/admin/statistics_panel/index.js index 39112e3ddc0..8c49fffe630 100644 --- a/app/assets/javascripts/admin/statistics_panel/index.js +++ b/app/assets/javascripts/admin/statistics_panel/index.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import StatisticsPanelApp from './components/app.vue'; import createStore from './store'; -export default function(el) { +export default function (el) { if (!el) { return false; } diff --git a/app/assets/javascripts/admin/users/index.js b/app/assets/javascripts/admin/users/index.js index 21780ee9984..6f8446221a3 100644 --- a/app/assets/javascripts/admin/users/index.js +++ b/app/assets/javascripts/admin/users/index.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import AdminUsersApp from './components/app.vue'; -export default function(el = document.querySelector('#js-admin-users-app')) { +export default function (el = document.querySelector('#js-admin-users-app')) { if (!el) { return false; } diff --git a/app/assets/javascripts/alert_management/components/alert_details.vue b/app/assets/javascripts/alert_management/components/alert_details.vue index 1f3fdd5eef2..ad29f5833e4 100644 --- a/app/assets/javascripts/alert_management/components/alert_details.vue +++ b/app/assets/javascripts/alert_management/components/alert_details.vue @@ -194,14 +194,20 @@ export default { projectPath: this.projectPath, }, }) - .then(({ data: { createAlertIssue: { errors, issue } } }) => { - if (errors?.length) { - [this.createIncidentError] = errors; - this.incidentCreationInProgress = false; - } else if (issue) { - visitUrl(this.incidentPath(issue.iid)); - } - }) + .then( + ({ + data: { + createAlertIssue: { errors, issue }, + }, + }) => { + if (errors?.length) { + [this.createIncidentError] = errors; + this.incidentCreationInProgress = false; + } else if (issue) { + visitUrl(this.incidentPath(issue.iid)); + } + }, + ) .catch(error => { this.createIncidentError = error; this.incidentCreationInProgress = false; 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 3af68d42ddf..3b9a730e5e1 100644 --- a/app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue +++ b/app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue @@ -192,7 +192,7 @@ export default { </script> <template> - <div class="block alert-assignees "> + <div class="block alert-assignees"> <div ref="assignees" class="sidebar-collapsed-icon" @click="$emit('toggle-sidebar')"> <gl-icon name="user" :size="14" /> <gl-loading-icon v-if="isUpdating" /> diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index d937060536a..6e13261accc 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -98,10 +98,7 @@ export class AwardsHandler { showEmojiMenu($addBtn) { if ($addBtn.hasClass('js-note-emoji')) { - $addBtn - .closest('.note') - .find('.js-awards-block') - .addClass('current'); + $addBtn.closest('.note').find('.js-awards-block').addClass('current'); } else { $addBtn.closest('.js-awards-block').addClass('current'); } @@ -531,9 +528,7 @@ export class AwardsHandler { const $search = $('.js-emoji-menu-search'); this.registerEventListener('on', $search, 'input', e => { - const term = $(e.target) - .val() - .trim(); + const term = $(e.target).val().trim(); this.searchEmojis(term); }); @@ -556,17 +551,11 @@ export class AwardsHandler { // Generate a search result block const h5 = $('<h5 class="emoji-search-title"/>').text('Search results'); const foundEmojis = this.findMatchingEmojiElements(term).show(); - const ul = $('<ul>') - .addClass('emoji-menu-list emoji-menu-search') - .append(foundEmojis); + const ul = $('<ul>').addClass('emoji-menu-list emoji-menu-search').append(foundEmojis); $('.emoji-menu-content ul, .emoji-menu-content h5').hide(); - $('.emoji-menu-content') - .append(h5) - .append(ul); + $('.emoji-menu-content').append(h5).append(ul); } else { - $('.emoji-menu-content') - .children() - .show(); + $('.emoji-menu-content').children().show(); } } diff --git a/app/assets/javascripts/batch_comments/components/preview_item.vue b/app/assets/javascripts/batch_comments/components/preview_item.vue index dca6d90fbcb..cae1157e57c 100644 --- a/app/assets/javascripts/batch_comments/components/preview_item.vue +++ b/app/assets/javascripts/batch_comments/components/preview_item.vue @@ -98,9 +98,7 @@ export default { {{ titleText }} </span> <template v-if="showLinePosition"> - <template v-if="!glFeatures.multilineComments" - >:{{ linePosition }}</template - > + <template v-if="!glFeatures.multilineComments">:{{ linePosition }}</template> <template v-else-if="startLineNumber === endLineNumber"> :<span :class="getLineClasses(startLineNumber)">{{ startLineNumber }}</span> </template> diff --git a/app/assets/javascripts/behaviors/preview_markdown.js b/app/assets/javascripts/behaviors/preview_markdown.js index 84bf22586a9..3a8ba7be667 100644 --- a/app/assets/javascripts/behaviors/preview_markdown.js +++ b/app/assets/javascripts/behaviors/preview_markdown.js @@ -23,7 +23,7 @@ MarkdownPreview.prototype.emptyMessage = __('Nothing to preview.'); MarkdownPreview.prototype.ajaxCache = {}; -MarkdownPreview.prototype.showPreview = function($form) { +MarkdownPreview.prototype.showPreview = function ($form) { const preview = $form.find('.js-md-preview'); const url = preview.data('url'); if (preview.hasClass('md-preview-loading')) { @@ -60,7 +60,7 @@ MarkdownPreview.prototype.showPreview = function($form) { } }; -MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) { +MarkdownPreview.prototype.fetchMarkdownPreview = function (text, url, success) { if (!url) { return; } @@ -82,11 +82,11 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) { .catch(() => flash(__('An error occurred while fetching markdown preview'))); }; -MarkdownPreview.prototype.hideReferencedUsers = function($form) { +MarkdownPreview.prototype.hideReferencedUsers = function ($form) { $form.find('.referenced-users').hide(); }; -MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) { +MarkdownPreview.prototype.renderReferencedUsers = function (users, $form) { const referencedUsers = $form.find('.referenced-users'); if (referencedUsers.length) { if (users.length >= this.referenceThreshold) { @@ -98,11 +98,11 @@ MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) { } }; -MarkdownPreview.prototype.hideReferencedCommands = function($form) { +MarkdownPreview.prototype.hideReferencedCommands = function ($form) { $form.find('.referenced-commands').hide(); }; -MarkdownPreview.prototype.renderReferencedCommands = function(commands, $form) { +MarkdownPreview.prototype.renderReferencedCommands = function (commands, $form) { const referencedCommands = $form.find('.referenced-commands'); if (commands.length > 0) { referencedCommands.html(commands); @@ -120,7 +120,7 @@ const writeButtonSelector = '.js-md-write-button'; lastTextareaPreviewed = null; const markdownToolbar = $('.md-header-toolbar'); -$.fn.setupMarkdownPreview = function() { +$.fn.setupMarkdownPreview = function () { const $form = $(this); $form.find('textarea.markdown-area').on('input', () => { markdownPreview.hideReferencedUsers($form); @@ -136,14 +136,8 @@ $(document).on('markdown-preview:show', (e, $form) => { lastTextareaHeight = lastTextareaPreviewed.height(); // toggle tabs - $form - .find(writeButtonSelector) - .parent() - .removeClass('active'); - $form - .find(previewButtonSelector) - .parent() - .addClass('active'); + $form.find(writeButtonSelector).parent().removeClass('active'); + $form.find(previewButtonSelector).parent().addClass('active'); // toggle content $form.find('.md-write-holder').hide(); @@ -163,14 +157,8 @@ $(document).on('markdown-preview:hide', (e, $form) => { } // toggle tabs - $form - .find(writeButtonSelector) - .parent() - .addClass('active'); - $form - .find(previewButtonSelector) - .parent() - .removeClass('active'); + $form.find(writeButtonSelector).parent().addClass('active'); + $form.find(previewButtonSelector).parent().removeClass('active'); // toggle content $form.find('.md-write-holder').show(); @@ -194,13 +182,13 @@ $(document).on('markdown-preview:toggle', (e, keyboardEvent) => { } }); -$(document).on('click', previewButtonSelector, function(e) { +$(document).on('click', previewButtonSelector, function (e) { e.preventDefault(); const $form = $(this).closest('form'); $(document).triggerHandler('markdown-preview:show', [$form]); }); -$(document).on('click', writeButtonSelector, function(e) { +$(document).on('click', writeButtonSelector, function (e) { e.preventDefault(); const $form = $(this).closest('form'); $(document).triggerHandler('markdown-preview:hide', [$form]); diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js index c0f67923191..766e99fd5a6 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js @@ -98,9 +98,7 @@ export default class Shortcuts { }); // eslint-disable-next-line @gitlab/no-global-event-off - $('.js-shortcuts-modal-trigger') - .off('click') - .on('click', this.onToggleHelp); + $('.js-shortcuts-modal-trigger').off('click').on('click', this.onToggleHelp); if (shouldDisableShortcuts()) { disableShortcuts(); diff --git a/app/assets/javascripts/blob/blob_file_dropzone.js b/app/assets/javascripts/blob/blob_file_dropzone.js index e8772b7240a..77565902ea3 100644 --- a/app/assets/javascripts/blob/blob_file_dropzone.js +++ b/app/assets/javascripts/blob/blob_file_dropzone.js @@ -43,16 +43,14 @@ export default class BlobFileDropzone { previewsContainer: '.dropzone-previews', headers: csrf.headers, init() { - this.on('processing', function() { + this.on('processing', function () { this.options.url = form.attr('action'); }); this.on('addedfile', () => { toggleLoading(submitButton, submitButtonLoadingIcon, false); dropzoneMessage.addClass(HIDDEN_CLASS); - $('.dropzone-alerts') - .html('') - .hide(); + $('.dropzone-alerts').html('').hide(); }); this.on('removedfile', () => { toggleLoading(submitButton, submitButtonLoadingIcon, false); @@ -62,7 +60,7 @@ export default class BlobFileDropzone { $('#modal-upload-blob').modal('hide'); visitUrl(response.filePath); }); - this.on('maxfilesexceeded', function(file) { + this.on('maxfilesexceeded', function (file) { dropzoneMessage.addClass(HIDDEN_CLASS); this.removeFile(file); }); @@ -74,9 +72,7 @@ export default class BlobFileDropzone { }, // Override behavior of adding error underneath preview error(file, errorMessage) { - const stripped = $('<div/>') - .html(errorMessage) - .text(); + const stripped = $('<div/>').html(errorMessage).text(); $('.dropzone-alerts') .html(sprintf(__('Error uploading file: %{stripped}'), { stripped })) .show(); diff --git a/app/assets/javascripts/blob/pipeline_tour_success_modal.vue b/app/assets/javascripts/blob/pipeline_tour_success_modal.vue index 02a522dda9d..fdaa4b082f7 100644 --- a/app/assets/javascripts/blob/pipeline_tour_success_modal.vue +++ b/app/assets/javascripts/blob/pipeline_tour_success_modal.vue @@ -98,7 +98,7 @@ export default { </template> <p> <gl-sprintf :message="$options.i18n.bodyMessage"> - <template #codeQualityLink="{content}"> + <template #codeQualityLink="{ content }"> <gl-link :href="codeQualityLink" target="_blank" class="font-size-inherit">{{ content }}</gl-link> @@ -106,12 +106,12 @@ export default { </gl-sprintf> </p> <gl-sprintf :message="$options.i18n.helpMessage"> - <template #beginnerLink="{content}"> + <template #beginnerLink="{ content }"> <gl-link :href="$options.beginnerLink" target="_blank"> {{ content }} </gl-link> </template> - <template #exampleLink="{content}"> + <template #exampleLink="{ content }"> <gl-link :href="exampleLink" target="_blank"> {{ content }} </gl-link> diff --git a/app/assets/javascripts/boards/components/board_sidebar.js b/app/assets/javascripts/boards/components/board_sidebar.js index d26f15c1723..a0dd7f4d898 100644 --- a/app/assets/javascripts/boards/components/board_sidebar.js +++ b/app/assets/javascripts/boards/components/board_sidebar.js @@ -82,9 +82,7 @@ export default Vue.extend({ }); $('.js-issue-board-sidebar', this.$el).each((i, el) => { - $(el) - .data('deprecatedJQueryDropdown') - .clearMenu(); + $(el).data('deprecatedJQueryDropdown').clearMenu(); }); } diff --git a/app/assets/javascripts/boards/components/modal/index.vue b/app/assets/javascripts/boards/components/modal/index.vue index 817b3bdddb0..67885993d86 100644 --- a/app/assets/javascripts/boards/components/modal/index.vue +++ b/app/assets/javascripts/boards/components/modal/index.vue @@ -65,9 +65,7 @@ export default { this.loading = false; }; - this.loadIssues() - .then(loadingDone) - .catch(loadingDone); + this.loadIssues().then(loadingDone).catch(loadingDone); } else if (!this.showAddIssuesModal) { this.issues = []; this.selectedIssues = []; @@ -83,9 +81,7 @@ export default { this.filterLoading = false; }; - this.loadIssues(true) - .then(loadingDone) - .catch(loadingDone); + this.loadIssues(true).then(loadingDone).catch(loadingDone); } }, deep: true, diff --git a/app/assets/javascripts/boards/components/new_list_dropdown.js b/app/assets/javascripts/boards/components/new_list_dropdown.js index d1011c24977..2bc54155163 100644 --- a/app/assets/javascripts/boards/components/new_list_dropdown.js +++ b/app/assets/javascripts/boards/components/new_list_dropdown.js @@ -40,7 +40,7 @@ $(document) }); export default function initNewListDropdown() { - $('.js-new-board-list').each(function() { + $('.js-new-board-list').each(function () { const $dropdownToggle = $(this); const $dropdown = $dropdownToggle.closest('.dropdown'); new CreateLabelDropdown( diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js index 4aa2869795f..1774f4d640f 100644 --- a/app/assets/javascripts/boards/stores/actions.js +++ b/app/assets/javascripts/boards/stores/actions.js @@ -212,11 +212,17 @@ export default { listId, }, }) - .then(({ data: { destroyBoardList: { errors } } }) => { - if (errors.length > 0) { - commit(types.REMOVE_LIST_FAILURE, listsBackup); - } - }) + .then( + ({ + data: { + destroyBoardList: { errors }, + }, + }) => { + if (errors.length > 0) { + commit(types.REMOVE_LIST_FAILURE, listsBackup); + } + }, + ) .catch(() => { commit(types.REMOVE_LIST_FAILURE, listsBackup); }); diff --git a/app/assets/javascripts/build_artifacts.js b/app/assets/javascripts/build_artifacts.js index 8324c649538..34731e749d2 100644 --- a/app/assets/javascripts/build_artifacts.js +++ b/app/assets/javascripts/build_artifacts.js @@ -24,7 +24,7 @@ export default class BuildArtifacts { // eslint-disable-next-line class-methods-use-this setupEntryClick() { - return $('.tree-holder').on('click', 'tr[data-link]', function() { + return $('.tree-holder').on('click', 'tr[data-link]', function () { visitUrl(this.dataset.link, parseBoolean(this.dataset.externalLink)); }); } diff --git a/app/assets/javascripts/ci_lint/components/ci_lint.vue b/app/assets/javascripts/ci_lint/components/ci_lint.vue index 731ed2ddd01..fc47fe8c333 100644 --- a/app/assets/javascripts/ci_lint/components/ci_lint.vue +++ b/app/assets/javascripts/ci_lint/components/ci_lint.vue @@ -111,7 +111,7 @@ export default { <gl-form-checkbox v-model="dryRun" >{{ __('Simulate a pipeline created for the default branch') }} <gl-link :href="pipelineSimulationHelpPagePath" target="_blank" - ><gl-icon class="gl-text-blue-600" name="question-o"/></gl-link + ><gl-icon class="gl-text-blue-600" name="question-o" /></gl-link ></gl-form-checkbox> </div> <gl-button data-testid="ci-lint-clear" @click="clear">{{ __('Clear') }}</gl-button> diff --git a/app/assets/javascripts/ci_settings_pipeline_triggers/components/triggers_list.vue b/app/assets/javascripts/ci_settings_pipeline_triggers/components/triggers_list.vue index ad07052a298..b84c188cd08 100644 --- a/app/assets/javascripts/ci_settings_pipeline_triggers/components/triggers_list.vue +++ b/app/assets/javascripts/ci_settings_pipeline_triggers/components/triggers_list.vue @@ -61,7 +61,7 @@ export default { class="triggers-list" responsive > - <template #cell(token)="{item}"> + <template #cell(token)="{ item }"> {{ item.token }} <clipboard-button v-if="item.hasTokenExposed" @@ -82,7 +82,7 @@ export default { </gl-badge> </div> </template> - <template #cell(description)="{item}"> + <template #cell(description)="{ item }"> <tooltip-on-truncate :title="item.description" truncate-target="child" @@ -92,7 +92,7 @@ export default { <div class="gl-flex-fill-1 gl-text-truncate">{{ item.description }}</div> </tooltip-on-truncate> </template> - <template #cell(owner)="{item}"> + <template #cell(owner)="{ item }"> <span class="trigger-owner sr-only">{{ item.owner.name }}</span> <user-avatar-link v-if="item.owner" @@ -102,11 +102,11 @@ export default { :img-alt="item.owner.name" /> </template> - <template #cell(lastUsed)="{item}"> + <template #cell(lastUsed)="{ item }"> <time-ago-tooltip v-if="item.lastUsed" :time="item.lastUsed" /> <span v-else>{{ __('Never') }}</span> </template> - <template #cell(actions)="{item}"> + <template #cell(actions)="{ item }"> <gl-button :title="s__('Pipelines|Edit')" icon="pencil" 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 cb1935c863d..53ef0f7098a 100644 --- a/app/assets/javascripts/ci_variable_list/ci_variable_list.js +++ b/app/assets/javascripts/ci_variable_list/ci_variable_list.js @@ -223,10 +223,7 @@ export default class VariableList { getAllData() { // Ignore the last empty row because we don't want to try persist // a blank variable and run into validation problems. - const validRows = this.$container - .find('.js-row') - .toArray() - .slice(0, -1); + const validRows = this.$container.find('.js-row').toArray().slice(0, -1); return validRows.map(rowEl => { const resultant = {}; diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue index fdffaa24d03..e096a29ce7f 100644 --- a/app/assets/javascripts/clusters/components/applications.vue +++ b/app/assets/javascripts/clusters/components/applications.vue @@ -461,7 +461,7 @@ export default { ) " > - <template #code="{content}"> + <template #code="{ content }"> <code>{{ content }}</code> </template> <template #link="{ content }"> diff --git a/app/assets/javascripts/clusters_list/components/clusters.vue b/app/assets/javascripts/clusters_list/components/clusters.vue index 08fd7db40a1..71564086a43 100644 --- a/app/assets/javascripts/clusters_list/components/clusters.vue +++ b/app/assets/javascripts/clusters_list/components/clusters.vue @@ -254,9 +254,7 @@ export default { <template #freeSpacePercentage>{{ totalCpuAndUsage(item.nodes).freeSpacePercentage }}</template> - <template #percentSymbol - >%</template - > + <template #percentSymbol>%</template> </gl-sprintf> </span> @@ -277,9 +275,7 @@ export default { <template #freeSpacePercentage>{{ totalMemoryAndUsage(item.nodes).freeSpacePercentage }}</template> - <template #percentSymbol - >%</template - > + <template #percentSymbol>%</template> </gl-sprintf> </span> @@ -293,7 +289,7 @@ export default { /> </template> - <template #cell(cluster_type)="{value}"> + <template #cell(cluster_type)="{ value }"> <gl-badge variant="muted"> {{ value }} </gl-badge> diff --git a/app/assets/javascripts/commit/image_file.js b/app/assets/javascripts/commit/image_file.js index b70f8d6e736..9ddf11533c2 100644 --- a/app/assets/javascripts/commit/image_file.js +++ b/app/assets/javascripts/commit/image_file.js @@ -56,15 +56,15 @@ export default class ImageFile { let dragging = false; const $body = $('body'); const $offsetEl = $el.parent(); - const dragStart = function() { + const dragStart = function () { dragging = true; $body.css('user-select', 'none'); }; - const dragStop = function() { + const dragStop = function () { dragging = false; $body.css('user-select', ''); }; - const dragMove = function(e) { + const dragMove = function (e) { const moveX = e.pageX || e.touches[0].pageX; const left = moveX - ($offsetEl.offset().left + padding); if (!dragging) return; @@ -73,11 +73,7 @@ export default class ImageFile { }; // eslint-disable-next-line @gitlab/no-global-event-off - $el - .off('mousedown') - .off('touchstart') - .on('mousedown', dragStart) - .on('touchstart', dragStart); + $el.off('mousedown').off('touchstart').on('mousedown', dragStart).on('touchstart', dragStart); // eslint-disable-next-line @gitlab/no-global-event-off $body @@ -109,9 +105,9 @@ export default class ImageFile { } views = { - 'two-up': function() { + 'two-up': function () { return $('.two-up.view .wrap', this.file).each((index, wrap) => { - $('img', wrap).each(function() { + $('img', wrap).each(function () { const currentWidth = $(this).width(); if (currentWidth > availWidth / 2) { return $(this).width(availWidth / 2); @@ -157,7 +153,7 @@ export default class ImageFile { }); }); }, - 'onion-skin': function() { + 'onion-skin': function () { let maxHeight, maxWidth; maxWidth = 0; maxHeight = 0; diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js index b18c109937d..f82bea134a3 100644 --- a/app/assets/javascripts/commits.js +++ b/app/assets/javascripts/commits.js @@ -85,10 +85,7 @@ export default class CommitsList { // Update commits count in the previous commits header. commitsCount += Number( - $(processedData) - .nextUntil('li.js-commit-header') - .first() - .find('li.commit').length, + $(processedData).nextUntil('li.js-commit-header').first().find('li.commit').length, ); $commitsHeadersLast diff --git a/app/assets/javascripts/commons/bootstrap.js b/app/assets/javascripts/commons/bootstrap.js index 2a1244149ff..f750c62103e 100644 --- a/app/assets/javascripts/commons/bootstrap.js +++ b/app/assets/javascripts/commons/bootstrap.js @@ -13,14 +13,10 @@ import 'bootstrap/js/dist/tab'; // custom jQuery functions $.fn.extend({ disable() { - return $(this) - .prop('disabled', true) - .addClass('disabled'); + return $(this).prop('disabled', true).addClass('disabled'); }, enable() { - return $(this) - .prop('disabled', false) - .removeClass('disabled'); + return $(this).prop('disabled', false).removeClass('disabled'); }, }); diff --git a/app/assets/javascripts/compare_autocomplete.js b/app/assets/javascripts/compare_autocomplete.js index 1c1f0664885..d0d4d9038ce 100644 --- a/app/assets/javascripts/compare_autocomplete.js +++ b/app/assets/javascripts/compare_autocomplete.js @@ -9,7 +9,7 @@ import { fixTitle } from '~/tooltips'; import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown'; export default function initCompareAutocomplete(limitTo = null, clickHandler = () => {}) { - $('.js-compare-dropdown').each(function() { + $('.js-compare-dropdown').each(function () { const $dropdown = $(this); const selected = $dropdown.data('selected'); const $dropdownContainer = $dropdown.closest('.dropdown'); @@ -51,9 +51,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( .text(ref) .attr('data-ref', ref); if (ref.header != null) { - return $('<li />') - .addClass('dropdown-header') - .text(ref.header); + return $('<li />').addClass('dropdown-header').text(ref.header); } return $('<li />').append(link); }, diff --git a/app/assets/javascripts/contextual_sidebar.js b/app/assets/javascripts/contextual_sidebar.js index 41988f321e5..f7d24c70864 100644 --- a/app/assets/javascripts/contextual_sidebar.js +++ b/app/assets/javascripts/contextual_sidebar.js @@ -43,7 +43,10 @@ export default class ContextualSidebar { $(document).trigger('content.resize'); }); - $(window).on('resize', debounce(() => this.render(), 100)); + $(window).on( + 'resize', + debounce(() => this.render(), 100), + ); } // See documentation: https://design.gitlab.com/regions/navigation#contextual-navigation diff --git a/app/assets/javascripts/create_cluster/gke_cluster/components/gke_machine_type_dropdown.vue b/app/assets/javascripts/create_cluster/gke_cluster/components/gke_machine_type_dropdown.vue index d6deda25752..6b18455bfcc 100644 --- a/app/assets/javascripts/create_cluster/gke_cluster/components/gke_machine_type_dropdown.vue +++ b/app/assets/javascripts/create_cluster/gke_cluster/components/gke_machine_type_dropdown.vue @@ -57,9 +57,7 @@ export default { if (this.hasZone) { this.isLoading = true; - this.fetchMachineTypes() - .then(this.fetchSuccessHandler) - .catch(this.fetchFailureHandler); + this.fetchMachineTypes().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler); } }, }, 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 522fef423af..8a3e6cf93fd 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 @@ -99,9 +99,7 @@ export default { created() { this.isLoading = true; - this.fetchProjects() - .then(this.fetchSuccessHandler) - .catch(this.fetchFailureHandler); + this.fetchProjects().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler); }, methods: { ...mapActions(['fetchProjects', 'setIsValidatingProjectBilling', 'validateProjectBilling']), @@ -175,9 +173,7 @@ export default { <gl-sprintf :message="helpText"> <template #linkToBilling="{ content }"> <gl-link - :href=" - 'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral' - " + :href="'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral'" target="_blank" >{{ content }} <gl-icon name="external-link" /></gl-link> diff --git a/app/assets/javascripts/create_cluster/gke_cluster/components/gke_zone_dropdown.vue b/app/assets/javascripts/create_cluster/gke_cluster/components/gke_zone_dropdown.vue index b60a5be2e63..daab42c7e60 100644 --- a/app/assets/javascripts/create_cluster/gke_cluster/components/gke_zone_dropdown.vue +++ b/app/assets/javascripts/create_cluster/gke_cluster/components/gke_zone_dropdown.vue @@ -46,9 +46,7 @@ export default { if (!isValidating && this.projectHasBillingEnabled) { this.isLoading = true; - this.fetchZones() - .then(this.fetchSuccessHandler) - .catch(this.fetchFailureHandler); + this.fetchZones().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler); } }, }, diff --git a/app/assets/javascripts/create_label.js b/app/assets/javascripts/create_label.js index 0d53efe8689..92060e19dec 100644 --- a/app/assets/javascripts/create_label.js +++ b/app/assets/javascripts/create_label.js @@ -46,7 +46,7 @@ export default class CreateLabelDropdown { addBinding() { const self = this; - this.$colorSuggestions.on('click', function(e) { + this.$colorSuggestions.on('click', function (e) { const $this = $(this); self.addColorValue(e, $this); }); @@ -72,10 +72,7 @@ export default class CreateLabelDropdown { e.stopPropagation(); this.$newColorField.val($this.data('color')).trigger('change'); - this.$colorPreview - .css('background-color', $this.data('color')) - .parent() - .addClass('is-active'); + this.$colorPreview.css('background-color', $this.data('color')).parent().addClass('is-active'); } enableLabelCreateButton() { @@ -94,10 +91,7 @@ export default class CreateLabelDropdown { this.$addList.prop('checked', this.addListDefault); - this.$colorPreview - .css('background-color', '') - .parent() - .removeClass('is-active'); + this.$colorPreview.css('background-color', '').parent().removeClass('is-active'); } saveLabel(e) { diff --git a/app/assets/javascripts/cycle_analytics/components/total_time_component.vue b/app/assets/javascripts/cycle_analytics/components/total_time_component.vue index b93a7d3c4f9..f52438ca2cb 100644 --- a/app/assets/javascripts/cycle_analytics/components/total_time_component.vue +++ b/app/assets/javascripts/cycle_analytics/components/total_time_component.vue @@ -30,8 +30,6 @@ export default { {{ time.seconds }} <span> {{ s__('Time|s') }} </span> </template> </template> - <template v-else> - -- - </template> + <template v-else> -- </template> </span> </template> diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js index fe57dd2dc8f..3d35ab2432f 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js @@ -123,10 +123,7 @@ export class GitLabDropdown { if ($(this.el).is('input')) { currentIndex = -1; } else { - $(selector, this.dropdown) - .first() - .find('a') - .addClass('is-focused'); + $(selector, this.dropdown).first().find('a').addClass('is-focused'); currentIndex = 0; } } @@ -493,10 +490,7 @@ export class GitLabDropdown { if (!this.options.multiSelect || el.hasClass('dropdown-clear-active')) { this.dropdown.find(`.${ACTIVE_CLASS}`).removeClass(ACTIVE_CLASS); if (!isInput) { - this.dropdown - .parent() - .find(`input[name='${fieldName}']`) - .remove(); + this.dropdown.parent().find(`input[name='${fieldName}']`).remove(); } } if (field && field.length && value == null) { @@ -536,10 +530,7 @@ export class GitLabDropdown { $(`input[name="${fieldName}"]`).remove(); } - const $input = $('<input>') - .attr('type', 'hidden') - .attr('name', fieldName) - .val(value); + const $input = $('<input>').attr('type', 'hidden').attr('name', fieldName).val(value); if (this.options.inputId != null) { $input.attr('id', this.options.inputId); } @@ -678,9 +669,7 @@ export class GitLabDropdown { toggleText = this.options.updateLabel; } - return $(this.el) - .find('.dropdown-toggle-text') - .text(toggleText); + return $(this.el).find('.dropdown-toggle-text').text(toggleText); } // eslint-disable-next-line class-methods-use-this 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 89ffb5f5f79..7b69a5f6308 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js @@ -22,10 +22,7 @@ export class GitLabDropdownFilter { // Clear click e.preventDefault(); e.stopPropagation(); - return this.input - .val('') - .trigger('input') - .focus(); + return this.input.val('').trigger('input').focus(); }); // Key events timeout = ''; @@ -113,7 +110,7 @@ export class GitLabDropdownFilter { const elements = this.options.elements(); if (searchText) { // eslint-disable-next-line func-names - elements.each(function() { + elements.each(function () { const $el = $(this); const matches = fuzzaldrinPlus.match($el.text().trim(), searchText); if (!$el.is('.dropdown-header')) { 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 d857071d05f..29185bb5a4d 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js @@ -9,10 +9,7 @@ export class GitLabDropdownInput { // Clear click e.preventDefault(); e.stopPropagation(); - return this.input - .val('') - .trigger('input') - .focus(); + return this.input.val('').trigger('input').focus(); }); this.input @@ -31,10 +28,7 @@ export class GitLabDropdownInput { .toLowerCase() // replace non alphanumeric .replace(/(-)\1+/g, '-'); // replace repeated dashes this.cb(this.options.fieldName, val, {}, true); - this.input - .closest('.dropdown') - .find('.dropdown-toggle-text') - .text(val); + this.input.closest('.dropdown').find('.dropdown-toggle-text').text(val); }); } diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/index.js b/app/assets/javascripts/deprecated_jquery_dropdown/index.js index 90e7f15b5b7..6a3d2026192 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/index.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/index.js @@ -3,7 +3,7 @@ import { GitLabDropdown } from './gl_dropdown'; export default function initDeprecatedJQueryDropdown($el, opts) { // eslint-disable-next-line func-names - return $el.each(function() { + return $el.each(function () { if (!$.data(this, 'deprecatedJQueryDropdown')) { $.data(this, 'deprecatedJQueryDropdown', new GitLabDropdown(this, opts)); } diff --git a/app/assets/javascripts/design_management/components/design_destroyer.vue b/app/assets/javascripts/design_management/components/design_destroyer.vue index 5d32bfd4a73..a231f6c5e3b 100644 --- a/app/assets/javascripts/design_management/components/design_destroyer.vue +++ b/app/assets/javascripts/design_management/components/design_destroyer.vue @@ -32,12 +32,7 @@ export default { }, }, methods: { - updateStoreAfterDelete( - store, - { - data: { designManagementDelete }, - }, - ) { + updateStoreAfterDelete(store, { data: { designManagementDelete } }) { updateStoreAfterDesignsDelete( store, designManagementDelete, 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 aff4f348d15..96c417561ac 100644 --- a/app/assets/javascripts/design_management/components/design_todo_button.vue +++ b/app/assets/javascripts/design_management/components/design_todo_button.vue @@ -116,12 +116,7 @@ export default { variables: { id, }, - update( - store, - { - data: { todoMarkDone }, - }, - ) { + update(store, { data: { todoMarkDone } }) { const todoMarkDoneFirstError = (todoMarkDone.errors || [])[0]; if (todoMarkDoneFirstError) { this.$emit('error', Error(todoMarkDoneFirstError)); diff --git a/app/assets/javascripts/design_management/pages/design/index.vue b/app/assets/javascripts/design_management/pages/design/index.vue index fb86568c304..fd1dca914ed 100644 --- a/app/assets/javascripts/design_management/pages/design/index.vue +++ b/app/assets/javascripts/design_management/pages/design/index.vue @@ -167,12 +167,7 @@ export default { next(); }, methods: { - addImageDiffNoteToStore( - store, - { - data: { createImageDiffNote }, - }, - ) { + addImageDiffNoteToStore(store, { data: { createImageDiffNote } }) { updateStoreAfterAddImageDiffNote( store, createImageDiffNote, @@ -180,12 +175,7 @@ export default { this.designVariables, ); }, - updateImageDiffNoteInStore( - store, - { - data: { repositionImageDiffNote }, - }, - ) { + updateImageDiffNoteInStore(store, { data: { repositionImageDiffNote } }) { return updateStoreAfterRepositionImageDiffNote( store, repositionImageDiffNote, diff --git a/app/assets/javascripts/design_management/pages/index.vue b/app/assets/javascripts/design_management/pages/index.vue index ea404692840..b151dbf8a96 100644 --- a/app/assets/javascripts/design_management/pages/index.vue +++ b/app/assets/javascripts/design_management/pages/index.vue @@ -187,12 +187,7 @@ export default { .then(res => this.onUploadDesignDone(res)) .catch(() => this.onUploadDesignError()); }, - afterUploadDesign( - store, - { - data: { designManagementUpload }, - }, - ) { + afterUploadDesign(store, { data: { designManagementUpload } }) { updateStoreAfterUploadDesign(store, designManagementUpload, this.projectQueryBody); }, onUploadDesignDone(res) { diff --git a/app/assets/javascripts/design_management/router/routes.js b/app/assets/javascripts/design_management/router/routes.js index d888b856611..1b07d8aeb76 100644 --- a/app/assets/javascripts/design_management/router/routes.js +++ b/app/assets/javascripts/design_management/router/routes.js @@ -13,13 +13,7 @@ export default [ name: DESIGN_ROUTE_NAME, path: '/designs/:id', component: DesignDetail, - beforeEnter( - { - params: { id }, - }, - _, - next, - ) { + beforeEnter({ params: { id } }, _, next) { if (typeof id === 'string') { next(); } diff --git a/app/assets/javascripts/diff.js b/app/assets/javascripts/diff.js index 9497ea7bb4f..34667d6fa31 100644 --- a/app/assets/javascripts/diff.js +++ b/app/assets/javascripts/diff.js @@ -24,9 +24,7 @@ export default class Diff { if (!tab || (tab && tab.dataset && tab.dataset.isLocked !== '')) FilesCommentButton.init($diffFile); - const firstFile = $('.files') - .first() - .get(0); + const firstFile = $('.files').first().get(0); const canCreateNote = firstFile && firstFile.hasAttribute('data-can-create-note'); $diffFile.each((index, file) => initImageDiffHelper.initImageDiff(file, canCreateNote)); diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 1825e118575..66540311014 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -281,12 +281,7 @@ export default { const id = window?.location?.hash; if (id && id.indexOf('#note') !== 0) { - this.setHighlightedRow( - id - .split('diff-content') - .pop() - .slice(1), - ); + this.setHighlightedRow(id.split('diff-content').pop().slice(1)); } }, beforeCreate() { @@ -404,10 +399,7 @@ export default { }, setDiscussions() { requestIdleCallback( - () => - this.assignDiscussionsToDiff() - .then(this.$nextTick) - .then(this.startTaskList), + () => this.assignDiscussionsToDiff().then(this.$nextTick).then(this.startTaskList), { timeout: 1000 }, ); }, diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 343cee7ad83..11940301819 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -139,7 +139,7 @@ export default { return !this.isCollapsed || this.automaticallyCollapsed; }, showWarning() { - return this.isCollapsed && (this.automaticallyCollapsed && !this.viewDiffsFileByFile); + return this.isCollapsed && this.automaticallyCollapsed && !this.viewDiffsFileByFile; }, showContent() { return !this.isCollapsed && !this.isFileTooLarge; diff --git a/app/assets/javascripts/diffs/components/inline_diff_view.vue b/app/assets/javascripts/diffs/components/inline_diff_view.vue index 05f5461054f..28485a2fdac 100644 --- a/app/assets/javascripts/diffs/components/inline_diff_view.vue +++ b/app/assets/javascripts/diffs/components/inline_diff_view.vue @@ -58,9 +58,9 @@ export default { class="code diff-wrap-lines js-syntax-highlight text-file js-diff-inline-view" > <colgroup> - <col style="width: 50px;" /> - <col style="width: 50px;" /> - <col style="width: 8px;" /> + <col style="width: 50px" /> + <col style="width: 50px" /> + <col style="width: 8px" /> <col /> </colgroup> <tbody> diff --git a/app/assets/javascripts/diffs/components/parallel_diff_view.vue b/app/assets/javascripts/diffs/components/parallel_diff_view.vue index 67b599fe163..21e0bf18dbf 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_view.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_view.vue @@ -57,11 +57,11 @@ export default { class="code diff-wrap-lines js-syntax-highlight text-file" > <colgroup> - <col style="width: 50px;" /> - <col style="width: 8px;" /> + <col style="width: 50px" /> + <col style="width: 8px" /> <col /> - <col style="width: 50px;" /> - <col style="width: 8px;" /> + <col style="width: 50px" /> + <col style="width: 8px" /> <col /> </colgroup> <tbody> diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index f2d9d86997d..9e331393ffa 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -307,7 +307,8 @@ export const startRenderDiffsQueue = ({ state, commit }) => { const nextFile = state.diffFiles.find( file => !file.renderIt && - (file.viewer && (!isCollapsed(file) || file.viewer.name !== diffViewerModes.text)), + file.viewer && + (!isCollapsed(file) || file.viewer.name !== diffViewerModes.text), ); if (nextFile) { diff --git a/app/assets/javascripts/diffs/store/getters.js b/app/assets/javascripts/diffs/store/getters.js index 6afc6f91fec..7b6db0ec706 100644 --- a/app/assets/javascripts/diffs/store/getters.js +++ b/app/assets/javascripts/diffs/store/getters.js @@ -138,7 +138,10 @@ export const fileLineCoverage = state => (file, line) => { * @returns {number} */ export const currentDiffIndex = state => - Math.max(0, state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId)); + Math.max( + 0, + state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId), + ); export const diffLines = state => (file, unifiedDiffComponents) => { if (!unifiedDiffComponents && state.diffViewType === INLINE_DIFF_VIEW_TYPE) { diff --git a/app/assets/javascripts/droplab/keyboard.js b/app/assets/javascripts/droplab/keyboard.js index 40837ffdf8f..fe1ea2fa6b0 100644 --- a/app/assets/javascripts/droplab/keyboard.js +++ b/app/assets/javascripts/droplab/keyboard.js @@ -2,7 +2,7 @@ import { ACTIVE_CLASS } from './constants'; -const Keyboard = function() { +const Keyboard = function () { var currentKey; var currentFocus; var isUpArrow = false; diff --git a/app/assets/javascripts/droplab/plugins/ajax.js b/app/assets/javascripts/droplab/plugins/ajax.js index 48b2a90c459..fce29649c7b 100644 --- a/app/assets/javascripts/droplab/plugins/ajax.js +++ b/app/assets/javascripts/droplab/plugins/ajax.js @@ -46,7 +46,7 @@ const Ajax = { .then(data => self._loadData(data, config, self)) .catch(config.onError); }, - destroy: function() { + destroy: function () { this.destroyed = true; }, }; diff --git a/app/assets/javascripts/droplab/plugins/ajax_filter.js b/app/assets/javascripts/droplab/plugins/ajax_filter.js index 66a52548417..94ccae1a442 100644 --- a/app/assets/javascripts/droplab/plugins/ajax_filter.js +++ b/app/assets/javascripts/droplab/plugins/ajax_filter.js @@ -2,7 +2,7 @@ import AjaxCache from '../../lib/utils/ajax_cache'; const AjaxFilter = { - init: function(hook) { + init: function (hook) { this.destroyed = false; this.hook = hook; this.notLoading(); @@ -93,9 +93,9 @@ const AjaxFilter = { list.currentIndex = 0; }, - buildParams: function(params) { + buildParams: function (params) { if (!params) return ''; - var paramsArray = Object.keys(params).map(function(param) { + var paramsArray = Object.keys(params).map(function (param) { return param + '=' + (params[param] || ''); }); return '?' + paramsArray.join('&'); diff --git a/app/assets/javascripts/droplab/plugins/filter.js b/app/assets/javascripts/droplab/plugins/filter.js index 6f1dc252d24..06391668928 100644 --- a/app/assets/javascripts/droplab/plugins/filter.js +++ b/app/assets/javascripts/droplab/plugins/filter.js @@ -1,7 +1,7 @@ /* eslint-disable */ const Filter = { - keydown: function(e) { + keydown: function (e) { if (this.destroyed) return; var hiddenCount = 0; @@ -21,22 +21,22 @@ const Filter = { if (config && config.filterFunction && typeof config.filterFunction === 'function') { filterFunction = config.filterFunction; } else { - filterFunction = function(o) { + filterFunction = function (o) { // cheap string search o.droplab_hidden = o[config.template].toLowerCase().indexOf(value) === -1; return o; }; } - dataHiddenCount = data.filter(function(o) { + dataHiddenCount = data.filter(function (o) { return !o.droplab_hidden; }).length; - matches = data.map(function(o) { + matches = data.map(function (o) { return filterFunction(o, value); }); - hiddenCount = matches.filter(function(o) { + hiddenCount = matches.filter(function (o) { return !o.droplab_hidden; }).length; diff --git a/app/assets/javascripts/droplab/utils.js b/app/assets/javascripts/droplab/utils.js index df3c5c2132a..d7f49bf19d8 100644 --- a/app/assets/javascripts/droplab/utils.js +++ b/app/assets/javascripts/droplab/utils.js @@ -5,12 +5,7 @@ import { DATA_TRIGGER, DATA_DROPDOWN, TEMPLATE_REGEX } from './constants'; const utils = { toCamelCase(attr) { - return this.camelize( - attr - .split('-') - .slice(1) - .join(' '), - ); + return this.camelize(attr.split('-').slice(1).join(' ')); }, template(templateString, data) { diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js index 69961d2e07a..49f54261983 100644 --- a/app/assets/javascripts/dropzone_input.js +++ b/app/assets/javascripts/dropzone_input.js @@ -219,12 +219,8 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { const caretStart = textarea.selectionStart; const caretEnd = textarea.selectionEnd; const textEnd = $(child).val().length; - const beforeSelection = $(child) - .val() - .substring(0, caretStart); - const afterSelection = $(child) - .val() - .substring(caretEnd, textEnd); + const beforeSelection = $(child).val().substring(0, caretStart); + const afterSelection = $(child).val().substring(caretEnd, textEnd); $(child).val(beforeSelection + formattedText + afterSelection); textarea.setSelectionRange(caretStart + formattedText.length, caretEnd + formattedText.length); textarea.style.height = `${textarea.scrollHeight}px`; @@ -289,10 +285,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { form.find('.markdown-selector').click(function onMarkdownClick(e) { e.preventDefault(); - $(this) - .closest('.gfm-form') - .find('.div-dropzone') - .click(); + $(this).closest('.gfm-form').find('.div-dropzone').click(); formTextarea.focus(); }); diff --git a/app/assets/javascripts/due_date_select.js b/app/assets/javascripts/due_date_select.js index ffb5232ca75..25520c7edde 100644 --- a/app/assets/javascripts/due_date_select.js +++ b/app/assets/javascripts/due_date_select.js @@ -197,9 +197,7 @@ export default class DueDateSelectors { $('.js-clear-due-date,.js-clear-start-date').on('click', e => { e.preventDefault(); - const calendar = $(e.target) - .siblings('.datepicker') - .data('pikaday'); + const calendar = $(e.target).siblings('.datepicker').data('pikaday'); calendar.setDate(null); }); } diff --git a/app/assets/javascripts/editor/editor_ci_schema_ext.js b/app/assets/javascripts/editor/editor_ci_schema_ext.js index 1946be997a7..36e2fe22718 100644 --- a/app/assets/javascripts/editor/editor_ci_schema_ext.js +++ b/app/assets/javascripts/editor/editor_ci_schema_ext.js @@ -22,9 +22,7 @@ export class CiSchemaExtension extends EditorLiteExtension { .replace(':project_path', projectPath) .replace(':ref', ref) .replace(':filename', EXTENSION_CI_SCHEMA_FILE_NAME_MATCH); - const modelFileName = this.getModel() - .uri.path.split('/') - .pop(); + const modelFileName = this.getModel().uri.path.split('/').pop(); registerSchema({ uri: ciSchemaUri, diff --git a/app/assets/javascripts/emoji/index.js b/app/assets/javascripts/emoji/index.js index 4a56843c0b5..b7ea972b643 100644 --- a/app/assets/javascripts/emoji/index.js +++ b/app/assets/javascripts/emoji/index.js @@ -242,8 +242,9 @@ export function getEmojiInfo(query) { export function emojiFallbackImageSrc(inputName) { const { name } = getEmojiInfo(inputName); - return `${gon.asset_host || ''}${gon.relative_url_root || - ''}/-/emojis/${EMOJI_VERSION}/${name}.png`; + return `${gon.asset_host || ''}${ + gon.relative_url_root || '' + }/-/emojis/${EMOJI_VERSION}/${name}.png`; } export function emojiImageTag(name, src) { diff --git a/app/assets/javascripts/error_tracking/components/stacktrace_entry.vue b/app/assets/javascripts/error_tracking/components/stacktrace_entry.vue index c3471346a63..dd320676e98 100644 --- a/app/assets/javascripts/error_tracking/components/stacktrace_entry.vue +++ b/app/assets/javascripts/error_tracking/components/stacktrace_entry.vue @@ -100,7 +100,7 @@ export default { /> <gl-sprintf v-if="errorFn" :message="__('%{spanStart}in%{spanEnd} %{errorFn}')"> - <template #span="{content}"> + <template #span="{ content }"> <span class="gl-text-gray-200">{{ content }} </span> </template> <template #errorFn> @@ -109,7 +109,7 @@ export default { </gl-sprintf> <gl-sprintf :message="__('%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}')"> - <template #span="{content}"> + <template #span="{ content }"> <span class="gl-text-gray-200">{{ content }} </span> </template> <template #errorLine> diff --git a/app/assets/javascripts/feature_flags/components/strategy_parameters.vue b/app/assets/javascripts/feature_flags/components/strategy_parameters.vue index b6e06880315..a22f081bb92 100644 --- a/app/assets/javascripts/feature_flags/components/strategy_parameters.vue +++ b/app/assets/javascripts/feature_flags/components/strategy_parameters.vue @@ -30,7 +30,7 @@ export default { }, computed: { strategyComponent() { - return STRATEGIES[(this.strategy?.name)]; + return STRATEGIES[this.strategy?.name]; }, }, methods: { diff --git a/app/assets/javascripts/feature_flags/store/index/mutations.js b/app/assets/javascripts/feature_flags/store/index/mutations.js index bdc23e66214..3daa204f560 100644 --- a/app/assets/javascripts/feature_flags/store/index/mutations.js +++ b/app/assets/javascripts/feature_flags/store/index/mutations.js @@ -74,12 +74,7 @@ export default { state.isRotating = true; state.hasRotateError = false; }, - [types.RECEIVE_ROTATE_INSTANCE_ID_SUCCESS]( - state, - { - data: { token }, - }, - ) { + [types.RECEIVE_ROTATE_INSTANCE_ID_SUCCESS](state, { data: { token } }) { state.isRotating = false; state.instanceId = token; state.hasRotateError = false; diff --git a/app/assets/javascripts/filtered_search/available_dropdown_mappings.js b/app/assets/javascripts/filtered_search/available_dropdown_mappings.js index 77491d1556b..f6930e811f5 100644 --- a/app/assets/javascripts/filtered_search/available_dropdown_mappings.js +++ b/app/assets/javascripts/filtered_search/available_dropdown_mappings.js @@ -200,8 +200,9 @@ export default class AvailableDropdownMappings { } getMergeRequestTargetBranchesEndpoint() { - const endpoint = `${gon.relative_url_root || - ''}/autocomplete/merge_request_target_branches.json`; + const endpoint = `${ + gon.relative_url_root || '' + }/autocomplete/merge_request_target_branches.json`; const params = { group_id: this.getGroupId(), 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 f0951f6b177..d797e6ecf1d 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js +++ b/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js @@ -193,7 +193,8 @@ export default class FilteredSearchVisualTokens { }); } else if ( !isLastVisualTokenValid && - (lastVisualToken && !lastVisualToken.querySelector('.operator')) + lastVisualToken && + !lastVisualToken.querySelector('.operator') ) { const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container'); tokensContainer.removeChild(lastVisualToken); diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index dcb27434a07..2e055f350a6 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -285,10 +285,7 @@ class GfmAutoComplete { ...this.getDefaultCallbacks(), beforeSave: membersBeforeSave, matcher(flag, subtext) { - const subtextNodes = subtext - .split(/\n+/g) - .pop() - .split(GfmAutoComplete.regexSubtext); + const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext); // Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands. command = subtextNodes.find(node => { @@ -465,10 +462,7 @@ class GfmAutoComplete { })); }, matcher(flag, subtext) { - const subtextNodes = subtext - .split(/\n+/g) - .pop() - .split(GfmAutoComplete.regexSubtext); + const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext); // Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands. command = subtextNodes.find(node => { diff --git a/app/assets/javascripts/gl_form.js b/app/assets/javascripts/gl_form.js index 4a3755f39cc..f056ce989f8 100644 --- a/app/assets/javascripts/gl_form.js +++ b/app/assets/javascripts/gl_form.js @@ -108,14 +108,10 @@ export default class GLForm { addEventListeners() { this.textarea.on('focus', function focusTextArea() { - $(this) - .closest('.md-area') - .addClass('is-focused'); + $(this).closest('.md-area').addClass('is-focused'); }); this.textarea.on('blur', function blurTextArea() { - $(this) - .closest('.md-area') - .removeClass('is-focused'); + $(this).closest('.md-area').removeClass('is-focused'); }); } diff --git a/app/assets/javascripts/groups/components/group_item.vue b/app/assets/javascripts/groups/components/group_item.vue index ef58b93c049..d65ad974c73 100644 --- a/app/assets/javascripts/groups/components/group_item.vue +++ b/app/assets/javascripts/groups/components/group_item.vue @@ -126,7 +126,7 @@ export default { /> <div :class="{ 'd-sm-flex': !group.isChildrenLoading }" - class="avatar-container rect-avatar s32 d-none flex-grow-0 flex-shrink-0 " + class="avatar-container rect-avatar s32 d-none flex-grow-0 flex-shrink-0" > <a :href="group.relativePath" class="no-expand"> <img diff --git a/app/assets/javascripts/groups/groups_filterable_list.js b/app/assets/javascripts/groups/groups_filterable_list.js index 693519729ac..c33ad8b6ecb 100644 --- a/app/assets/javascripts/groups/groups_filterable_list.js +++ b/app/assets/javascripts/groups/groups_filterable_list.js @@ -65,10 +65,7 @@ export default class GroupFilterableList extends FilterableList { setDefaultFilterOption() { const defaultOption = $.trim( - this.$dropdown - .find('.dropdown-menu li.js-filter-sort-order a') - .first() - .text(), + this.$dropdown.find('.dropdown-menu li.js-filter-sort-order a').first().text(), ); this.$dropdown.find('.dropdown-label').text(defaultOption); } diff --git a/app/assets/javascripts/ide/components/nav_dropdown.vue b/app/assets/javascripts/ide/components/nav_dropdown.vue index 8cea8655461..6ff77e556c0 100644 --- a/app/assets/javascripts/ide/components/nav_dropdown.vue +++ b/app/assets/javascripts/ide/components/nav_dropdown.vue @@ -31,9 +31,7 @@ export default { }, removeDropdownListeners() { // eslint-disable-next-line @gitlab/no-global-event-off - $(this.$refs.dropdown) - .off('show.bs.dropdown') - .off('hide.bs.dropdown'); + $(this.$refs.dropdown).off('show.bs.dropdown').off('hide.bs.dropdown'); }, showDropdown() { this.isVisibleDropdown = true; diff --git a/app/assets/javascripts/ide/lib/editorconfig/parser.js b/app/assets/javascripts/ide/lib/editorconfig/parser.js index 1597e4a8bfa..838302c327f 100644 --- a/app/assets/javascripts/ide/lib/editorconfig/parser.js +++ b/app/assets/javascripts/ide/lib/editorconfig/parser.js @@ -50,5 +50,10 @@ export function getRulesWithTraversal(filePath, getFileContent) { return Promise.all( editorconfigPaths.map(path => getFileContent(path).then(content => ({ path, content }))), - ).then(results => getRulesWithConfigs(filePath, results.filter(x => x.content))); + ).then(results => + getRulesWithConfigs( + filePath, + results.filter(x => x.content), + ), + ); } diff --git a/app/assets/javascripts/ide/lib/languages/hcl.js b/app/assets/javascripts/ide/lib/languages/hcl.js index 4539719b1f2..d7a6491297b 100644 --- a/app/assets/javascripts/ide/lib/languages/hcl.js +++ b/app/assets/javascripts/ide/lib/languages/hcl.js @@ -11,7 +11,11 @@ const conf = { lineComment: '//', blockComment: ['/*', '*/'], }, - brackets: [['{', '}'], ['[', ']'], ['(', ')']], + brackets: [ + ['{', '}'], + ['[', ']'], + ['(', ')'], + ], autoClosingPairs: [ { open: '{', close: '}' }, { open: '[', close: ']' }, @@ -161,7 +165,11 @@ const language = { [/\/\/.*$/, 'comment'], [/#.*$/, 'comment'], ], - comment: [[/[^\/*]+/, 'comment'], [/\*\//, 'comment', '@pop'], [/[\/*]/, 'comment']], + comment: [ + [/[^\/*]+/, 'comment'], + [/\*\//, 'comment', '@pop'], + [/[\/*]/, 'comment'], + ], string: [ [/\$\{/, { token: 'delimiter', next: '@stringExpression' }], [/[^\\"\$]+/, 'string'], diff --git a/app/assets/javascripts/ide/lib/languages/vue.js b/app/assets/javascripts/ide/lib/languages/vue.js index b9ff5c5d776..f2f81307981 100644 --- a/app/assets/javascripts/ide/lib/languages/vue.js +++ b/app/assets/javascripts/ide/lib/languages/vue.js @@ -37,7 +37,13 @@ const conf = { blockComment: ['{{!--', '--}}'], }, - brackets: [['<!--', '-->'], ['<', '>'], ['{{', '}}'], ['{', '}'], ['(', ')']], + brackets: [ + ['<!--', '-->'], + ['<', '>'], + ['{{', '}}'], + ['{', '}'], + ['(', ')'], + ], autoClosingPairs: [ { open: '{', close: '}' }, diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index c79ecd70e94..ef09f118431 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -254,12 +254,7 @@ export function extractMarkdownImagesFromEntries(mdFile, entries) { const imageContent = entries[imagePath]?.content || entries[imagePath]?.raw; if (!isAbsolute(path) && imageContent) { - const ext = path.includes('.') - ? path - .split('.') - .pop() - .trim() - : 'jpeg'; + const ext = path.includes('.') ? path.split('.').pop().trim() : 'jpeg'; const src = `data:image/${ext};base64,${imageContent}`; i += 1; const key = `{{${prefix}${i}}}`; diff --git a/app/assets/javascripts/ide/utils.js b/app/assets/javascripts/ide/utils.js index 43276f32322..2c966d9c27c 100644 --- a/app/assets/javascripts/ide/utils.js +++ b/app/assets/javascripts/ide/utils.js @@ -154,12 +154,7 @@ export function getFileEOL(content = '') { */ export function addNumericSuffix(filename, randomize = false) { return filename.replace(/([ _-]?)(\d*)(\..+?$|$)/, (_, before, number, after) => { - const n = randomize - ? Math.random() - .toString() - .substring(2, 7) - .slice(-5) - : Number(number) + 1; + const n = randomize ? Math.random().toString().substring(2, 7).slice(-5) : Number(number) + 1; return `${before || '-'}${n}${after}`; }); } diff --git a/app/assets/javascripts/incidents/components/incidents_list.vue b/app/assets/javascripts/incidents/components/incidents_list.vue index 0e3839deaf5..7d44a28b4bb 100644 --- a/app/assets/javascripts/incidents/components/incidents_list.vue +++ b/app/assets/javascripts/incidents/components/incidents_list.vue @@ -265,9 +265,7 @@ export default { if (field?.sortKey) { sortKey = field.sortKey; } else { - sortKey = convertToSnakeCase(sortBy) - .replace(/_.*/, '') - .toUpperCase(); + sortKey = convertToSnakeCase(sortBy).replace(/_.*/, '').toUpperCase(); } this.pagination = initialPaginationState; diff --git a/app/assets/javascripts/invite_members/components/invite_members_modal.vue b/app/assets/javascripts/invite_members/components/invite_members_modal.vue index b55ef77ae5d..7dbbe072ba6 100644 --- a/app/assets/javascripts/invite_members/components/invite_members_modal.vue +++ b/app/assets/javascripts/invite_members/components/invite_members_modal.vue @@ -195,7 +195,7 @@ export default { <div class="gl-mt-2"> <gl-sprintf :message="$options.labels.readMoreText"> - <template #link="{content}"> + <template #link="{ content }"> <gl-link :href="helpLink" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> diff --git a/app/assets/javascripts/issuable/auto_width_dropdown_select.js b/app/assets/javascripts/issuable/auto_width_dropdown_select.js index 12f03873958..243d82f55aa 100644 --- a/app/assets/javascripts/issuable/auto_width_dropdown_select.js +++ b/app/assets/javascripts/issuable/auto_width_dropdown_select.js @@ -37,10 +37,7 @@ class AutoWidthDropdownSelect { // We have to look at the parent because // `offsetParent` on a `display: none;` is `null` - const offsetParentWidth = $(this) - .parent() - .offsetParent() - .width(); + const offsetParentWidth = $(this).parent().offsetParent().width(); // Reset any width to let it naturally flow $dropdown.css('width', 'auto'); if ($dropdown.outerWidth(false) > offsetParentWidth) { diff --git a/app/assets/javascripts/issuable_form.js b/app/assets/javascripts/issuable_form.js index 791b5fef699..5ebd2caf130 100644 --- a/app/assets/javascripts/issuable_form.js +++ b/app/assets/javascripts/issuable_form.js @@ -52,12 +52,12 @@ export default class IssuableForm { /* eslint-disable @gitlab/require-i18n-strings */ this.wipRegex = new RegExp( '^\\s*(' + // Line start, then any amount of leading whitespace - 'draft\\s-\\s' + // Draft_-_ where "_" are *exactly* one whitespace - '|\\[(draft|wip)\\]\\s*' + // [Draft] or [WIP] and any following whitespace - '|(draft|wip):\\s*' + // Draft: or WIP: and any following whitespace - '|(draft|wip)\\s+' + // Draft_ or WIP_ where "_" is at least one whitespace - '|\\(draft\\)\\s*' + // (Draft) and any following whitespace - ')+' + // At least one repeated match of the preceding parenthetical + 'draft\\s-\\s' + // Draft_-_ where "_" are *exactly* one whitespace + '|\\[(draft|wip)\\]\\s*' + // [Draft] or [WIP] and any following whitespace + '|(draft|wip):\\s*' + // Draft: or WIP: and any following whitespace + '|(draft|wip)\\s+' + // Draft_ or WIP_ where "_" is at least one whitespace + '|\\(draft\\)\\s*' + // (Draft) and any following whitespace + ')+' + // At least one repeated match of the preceding parenthetical '\\s*', // Any amount of trailing whitespace 'i', // Match any case(s) ); diff --git a/app/assets/javascripts/issuable_index.js b/app/assets/javascripts/issuable_index.js index e888e481fe5..92158c42de3 100644 --- a/app/assets/javascripts/issuable_index.js +++ b/app/assets/javascripts/issuable_index.js @@ -21,9 +21,7 @@ export default class IssuableIndex { axios .put($resetToken.attr('href')) .then(({ data }) => { - $('#issuable_email') - .val(data.new_address) - .focus(); + $('#issuable_email').val(data.new_address).focus(); $resetToken.text(s__('EmailToken|reset it')); }) diff --git a/app/assets/javascripts/issuable_show/components/issuable_edit_form.vue b/app/assets/javascripts/issuable_show/components/issuable_edit_form.vue index 93e4db8b99c..830a740ff78 100644 --- a/app/assets/javascripts/issuable_show/components/issuable_edit_form.vue +++ b/app/assets/javascripts/issuable_show/components/issuable_edit_form.vue @@ -141,8 +141,7 @@ export default { :data-supports-quick-actions="enableAutocomplete" :aria-label="__('Description')" :placeholder="__('Write a comment or drag your files here…')" - class="note-textarea js-gfm-input js-autosize markdown-area - qa-description-textarea" + class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea" dir="auto" @keydown="handleKeydown($event, 'description')" ></textarea> diff --git a/app/assets/javascripts/issuable_suggestions/index.js b/app/assets/javascripts/issuable_suggestions/index.js index 40916c9d27f..9949527106b 100644 --- a/app/assets/javascripts/issuable_suggestions/index.js +++ b/app/assets/javascripts/issuable_suggestions/index.js @@ -5,7 +5,7 @@ import App from './components/app.vue'; Vue.use(VueApollo); -export default function() { +export default function () { const el = document.getElementById('js-suggestions'); const issueTitle = document.getElementById('issue_title'); const { projectPath } = el.dataset; diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index 5d2880c3c10..66462937ef5 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -54,11 +54,7 @@ export default class Issue { $(document).trigger('issuable:change', isClosed); let numProjectIssues = Number( - projectIssuesCounter - .first() - .text() - .trim() - .replace(/[^\d]/, ''), + projectIssuesCounter.first().text().trim().replace(/[^\d]/, ''), ); numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1; projectIssuesCounter.text(addDelimiter(numProjectIssues)); diff --git a/app/assets/javascripts/issue_show/components/fields/description.vue b/app/assets/javascripts/issue_show/components/fields/description.vue index 83ab4106802..8d417e32d62 100644 --- a/app/assets/javascripts/issue_show/components/fields/description.vue +++ b/app/assets/javascripts/issue_show/components/fields/description.vue @@ -53,8 +53,7 @@ export default { id="issue-description" ref="textarea" v-model="formState.description" - class="note-textarea js-gfm-input js-autosize markdown-area - qa-description-textarea" + class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea" dir="auto" :data-supports-quick-actions="!glFeatures.tributeAutocomplete" :aria-label="__('Description')" diff --git a/app/assets/javascripts/jobs/components/manual_variables_form.vue b/app/assets/javascripts/jobs/components/manual_variables_form.vue index bf1930c9a37..9189c88c1c7 100644 --- a/app/assets/javascripts/jobs/components/manual_variables_form.vue +++ b/app/assets/javascripts/jobs/components/manual_variables_form.vue @@ -93,7 +93,10 @@ export default { this.secretValue = ''; }, deleteVariable(id) { - this.variables.splice(this.variables.findIndex(el => el.id === id), 1); + this.variables.splice( + this.variables.findIndex(el => el.id === id), + 1, + ); }, }, }; diff --git a/app/assets/javascripts/label_manager.js b/app/assets/javascripts/label_manager.js index 469f7ce94b0..92dffb87e1a 100644 --- a/app/assets/javascripts/label_manager.js +++ b/app/assets/javascripts/label_manager.js @@ -135,7 +135,7 @@ export default class LabelManager { getSortedLabelsIds() { const sortedIds = []; - this.prioritizedLabels.find('> li').each(function() { + this.prioritizedLabels.find('> li').each(function () { const id = $(this).data('id'); if (id) { diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index ac5aa24d5d8..2928a64b7e8 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -49,7 +49,7 @@ export default class LabelsSelect { const fieldName = $dropdown.data('fieldName'); let initialSelected = $selectbox .find(`input[name="${$dropdown.data('fieldName')}"]`) - .map(function() { + .map(function () { return this.value; }) .get(); @@ -64,11 +64,11 @@ export default class LabelsSelect { ); } - const saveLabelData = function() { + const saveLabelData = function () { const selected = $dropdown .closest('.selectbox') .find(`input[name='${fieldName}']`) - .map(function() { + .map(function () { return this.value; }) .get(); @@ -210,9 +210,7 @@ export default class LabelsSelect { } } else { if (this.id(label)) { - const dropdownValue = this.id(label) - .toString() - .replace(/'/g, "\\'"); + const dropdownValue = this.id(label).toString().replace(/'/g, "\\'"); if ( $form.find( @@ -346,10 +344,7 @@ export default class LabelsSelect { const isMRIndex = page === 'projects:merge_requests:index'; if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) { - $dropdown - .parent() - .find('.dropdown-clear-active') - .removeClass('is-active'); + $dropdown.parent().find('.dropdown-clear-active').removeClass('is-active'); } if ($dropdown.hasClass('js-issuable-form-dropdown')) { @@ -559,7 +554,7 @@ export default class LabelsSelect { // eslint-disable-next-line class-methods-use-this setOriginalDropdownData($container, $dropdown) { const labels = []; - $container.find('[name="label_name[]"]').map(function() { + $container.find('[name="label_name[]"]').map(function () { return labels.push(this.value); }); $dropdown.data('marked', labels); diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index f88a0433535..9e52de4b959 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -68,7 +68,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa closestSubmit.disable(); } // eslint-disable-next-line func-names - return field.on(eventName, function() { + return field.on(eventName, function () { if (rstrip($(this).val()) === '') { return closestSubmit.disable(); } diff --git a/app/assets/javascripts/lib/utils/text_markdown.js b/app/assets/javascripts/lib/utils/text_markdown.js index c711c0bd163..edff057997a 100644 --- a/app/assets/javascripts/lib/utils/text_markdown.js +++ b/app/assets/javascripts/lib/utils/text_markdown.js @@ -14,18 +14,12 @@ function addBlockTags(blockTag, selected) { } function lineBefore(text, textarea) { - const split = text - .substring(0, textarea.selectionStart) - .trim() - .split('\n'); + const split = text.substring(0, textarea.selectionStart).trim().split('\n'); return split[split.length - 1]; } function lineAfter(text, textarea) { - return text - .substring(textarea.selectionEnd) - .trim() - .split('\n')[0]; + return text.substring(textarea.selectionEnd).trim().split('\n')[0]; } function convertMonacoSelectionToAceFormat(sel) { @@ -342,7 +336,7 @@ export function addMarkdownListeners(form) { // eslint-disable-next-line @gitlab/no-global-event-off const $allToolbarBtns = $('.js-md', form) .off('click') - .on('click', function() { + .on('click', function () { const $toolbarBtn = $(this); return updateTextForToolbarBtn($toolbarBtn); diff --git a/app/assets/javascripts/line_highlighter.js b/app/assets/javascripts/line_highlighter.js index 8621a133776..3760dc60d0f 100644 --- a/app/assets/javascripts/line_highlighter.js +++ b/app/assets/javascripts/line_highlighter.js @@ -32,7 +32,7 @@ import 'vendor/jquery.scrollTo'; // </div> // -const LineHighlighter = function(options = {}) { +const LineHighlighter = function (options = {}) { options.highlightLineClass = options.highlightLineClass || 'hll'; options.fileHolderSelector = options.fileHolderSelector || '.file-holder'; options.scrollFileHolder = options.scrollFileHolder || false; @@ -50,7 +50,7 @@ const LineHighlighter = function(options = {}) { this.highlightHash(); }; -LineHighlighter.prototype.bindEvents = function() { +LineHighlighter.prototype.bindEvents = function () { const $fileHolder = $(this.options.fileHolderSelector); $fileHolder.on('click', 'a[data-line-number]', this.clickHandler); @@ -58,7 +58,7 @@ LineHighlighter.prototype.bindEvents = function() { window.addEventListener('hashchange', e => this.highlightHash(e.target.location.hash)); }; -LineHighlighter.prototype.highlightHash = function(newHash) { +LineHighlighter.prototype.highlightHash = function (newHash) { let range; if (newHash && typeof newHash === 'string') this._hash = newHash; @@ -83,13 +83,11 @@ LineHighlighter.prototype.highlightHash = function(newHash) { } }; -LineHighlighter.prototype.clickHandler = function(event) { +LineHighlighter.prototype.clickHandler = function (event) { let range; event.preventDefault(); this.clearHighlight(); - const lineNumber = $(event.target) - .closest('a') - .data('lineNumber'); + const lineNumber = $(event.target).closest('a').data('lineNumber'); const current = this.hashToRange(this._hash); if (!(current[0] && event.shiftKey)) { // If there's no current selection, or there is but Shift wasn't held, @@ -107,7 +105,7 @@ LineHighlighter.prototype.clickHandler = function(event) { } }; -LineHighlighter.prototype.clearHighlight = function() { +LineHighlighter.prototype.clearHighlight = function () { return $(`.${this.highlightLineClass}`).removeClass(this.highlightLineClass); }; @@ -122,7 +120,7 @@ LineHighlighter.prototype.clearHighlight = function() { // hashToRange('#foo') # => [null, null] // // Returns an Array -LineHighlighter.prototype.hashToRange = function(hash) { +LineHighlighter.prototype.hashToRange = function (hash) { // ?L(\d+)(?:-(\d+))?$/) const matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/); if (matches && matches.length) { @@ -136,14 +134,14 @@ LineHighlighter.prototype.hashToRange = function(hash) { // Highlight a single line // // lineNumber - Line number to highlight -LineHighlighter.prototype.highlightLine = function(lineNumber) { +LineHighlighter.prototype.highlightLine = function (lineNumber) { return $(`#LC${lineNumber}`).addClass(this.highlightLineClass); }; // Highlight all lines within a range // // range - Array containing the starting and ending line numbers -LineHighlighter.prototype.highlightRange = function(range) { +LineHighlighter.prototype.highlightRange = function (range) { if (range[1]) { const results = []; const ref = range[0] <= range[1] ? range : range.reverse(); @@ -158,7 +156,7 @@ LineHighlighter.prototype.highlightRange = function(range) { }; // Set the URL hash string -LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) { +LineHighlighter.prototype.setHash = function (firstLineNumber, lastLineNumber) { let hash; if (lastLineNumber) { hash = `#L${firstLineNumber}-${lastLineNumber}`; @@ -172,7 +170,7 @@ LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) { // Make the actual hash change in the browser // // This method is stubbed in tests. -LineHighlighter.prototype.__setLocationHash__ = function(value) { +LineHighlighter.prototype.__setLocationHash__ = function (value) { return window.history.pushState( { url: value, diff --git a/app/assets/javascripts/logs/components/environment_logs.vue b/app/assets/javascripts/logs/components/environment_logs.vue index f7c0bd5ae13..a114b3c7d4d 100644 --- a/app/assets/javascripts/logs/components/environment_logs.vue +++ b/app/assets/javascripts/logs/components/environment_logs.vue @@ -246,9 +246,7 @@ export default { </div>{{trace}} </code></pre> </template> - <template #default - ><div></div - ></template> + <template #default><div></div></template> </gl-infinite-scroll> <div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900"> @@ -262,9 +260,7 @@ export default { > <template #fetched>{{ logs.lines.length }}</template> </gl-sprintf> - <template v-else> - {{ s__('Environments|Currently showing all results.') }}</template - > + <template v-else> {{ s__('Environments|Currently showing all results.') }}</template> </div> </div> </template> diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index de7648c31b1..c74a25f39fe 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -53,7 +53,7 @@ window.$ = jQuery; jQuery.ajaxSetup({ converters: { // eslint-disable-next-line @gitlab/require-i18n-strings, func-names - 'text script': function(text) { + 'text script': function (text) { jQuery.globalEval(text, { nonce: getCspNonceValue() }); return text; }, @@ -137,9 +137,7 @@ function deferredInitialisation() { $('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() { tooltips.dispose(this); - $(this) - .closest('li') - .addClass('gl-display-none!'); + $(this).closest('li').addClass('gl-display-none!'); }); $('.js-remove-tr').on('ajax:before', function removeTRAjaxBeforeCallback() { @@ -147,9 +145,7 @@ function deferredInitialisation() { }); $('.js-remove-tr').on('ajax:success', function removeTRAjaxSuccessCallback() { - $(this) - .closest('tr') - .addClass('gl-display-none!'); + $(this).closest('tr').addClass('gl-display-none!'); }); const glTooltipDelay = localStorage.getItem('gl-tooltip-delay'); @@ -278,15 +274,9 @@ document.addEventListener('DOMContentLoaded', () => { $this.toggleClass('active'); if ($this.hasClass('active')) { - notesHolders - .show() - .find('.hide, .content') - .show(); + notesHolders.show().find('.hide, .content').show(); } else { - notesHolders - .hide() - .find('.content') - .hide(); + notesHolders.hide().find('.content').hide(); } $(document).trigger('toggle.comments'); diff --git a/app/assets/javascripts/member_expiration_date.js b/app/assets/javascripts/member_expiration_date.js index ef7d8cc9efe..de33a68ebf1 100644 --- a/app/assets/javascripts/member_expiration_date.js +++ b/app/assets/javascripts/member_expiration_date.js @@ -41,9 +41,7 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d inputs.next('.js-clear-input').on('click', function clicked(event) { event.preventDefault(); - const input = $(this) - .closest('.clearable-input') - .find(selector); + const input = $(this).closest('.clearable-input').find(selector); const calendar = input.data('pikaday'); calendar.setDate(null); diff --git a/app/assets/javascripts/members.js b/app/assets/javascripts/members.js index 5bd228496da..ab8ed1f4d11 100644 --- a/app/assets/javascripts/members.js +++ b/app/assets/javascripts/members.js @@ -12,13 +12,9 @@ export default class Members { addListeners() { // eslint-disable-next-line @gitlab/no-global-event-off - $('.js-member-update-control') - .off('change') - .on('change', this.formSubmit.bind(this)); + $('.js-member-update-control').off('change').on('change', this.formSubmit.bind(this)); // eslint-disable-next-line @gitlab/no-global-event-off - $('.js-edit-member-form') - .off('ajax:success') - .on('ajax:success', this.formSuccess.bind(this)); + $('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this)); disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change'); } 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 356d8619fed..8cb4d77dc19 100644 --- a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js +++ b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.js @@ -60,19 +60,28 @@ import { __ } from '~/locale'; const DataPromise = axios.get(this.file.content_path); Promise.all([EditorPromise, DataPromise]) - .then(([{ default: EditorLite }, { data: { content, new_path: path } }]) => { - const contentEl = this.$el.querySelector('.editor'); + .then( + ([ + { default: EditorLite }, + { + data: { content, new_path: path }, + }, + ]) => { + const contentEl = this.$el.querySelector('.editor'); - this.originalContent = content; - this.fileLoaded = true; + this.originalContent = content; + this.fileLoaded = true; - this.editor = new EditorLite().createInstance({ - el: contentEl, - blobPath: path, - blobContent: content, - }); - this.editor.onDidChangeModelContent(debounce(this.saveDiffResolution.bind(this), 250)); - }) + this.editor = new EditorLite().createInstance({ + el: contentEl, + blobPath: path, + blobContent: content, + }); + this.editor.onDidChangeModelContent( + debounce(this.saveDiffResolution.bind(this), 250), + ); + }, + ) .catch(() => { flash(__('An error occurred while loading the file')); }); diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 344f8dee5ea..f708ec82b5d 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -47,11 +47,11 @@ function MergeRequest(opts) { } // Local jQuery finder -MergeRequest.prototype.$ = function(selector) { +MergeRequest.prototype.$ = function (selector) { return this.$el.find(selector); }; -MergeRequest.prototype.initTabs = function() { +MergeRequest.prototype.initTabs = function () { if (window.mrTabs) { window.mrTabs.unbindEvents(); } @@ -59,12 +59,12 @@ MergeRequest.prototype.initTabs = function() { window.mrTabs = new MergeRequestTabs(this.opts); }; -MergeRequest.prototype.showAllCommits = function() { +MergeRequest.prototype.showAllCommits = function () { this.$('.first-commits').remove(); return this.$('.all-commits').removeClass('hide'); }; -MergeRequest.prototype.initMRBtnListeners = function() { +MergeRequest.prototype.initMRBtnListeners = function () { const _this = this; const draftToggles = document.querySelectorAll('.js-draft-toggle-button'); @@ -99,7 +99,7 @@ MergeRequest.prototype.initMRBtnListeners = function() { }); } - return $('.btn-close, .btn-reopen').on('click', function(e) { + return $('.btn-close, .btn-reopen').on('click', function (e) { const $this = $(this); const shouldSubmit = $this.hasClass('btn-comment'); if (shouldSubmit && $this.data('submitted')) { @@ -117,7 +117,7 @@ MergeRequest.prototype.initMRBtnListeners = function() { }); }; -MergeRequest.prototype.submitNoteForm = function(form, $button) { +MergeRequest.prototype.submitNoteForm = function (form, $button) { const noteText = form.find('textarea.js-note-text').val(); if (noteText.trim().length > 0) { form.submit(); @@ -126,7 +126,7 @@ MergeRequest.prototype.submitNoteForm = function(form, $button) { } }; -MergeRequest.prototype.initCommitMessageListeners = function() { +MergeRequest.prototype.initCommitMessageListeners = function () { $(document).on('click', 'a.js-with-description-link', e => { const textarea = $('textarea.js-commit-message'); e.preventDefault(); @@ -146,7 +146,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() { }); }; -MergeRequest.setStatusBoxToMerged = function() { +MergeRequest.setStatusBoxToMerged = function () { $('.detail-page-header .status-box') .removeClass('status-box-open') .addClass('status-box-mr-merged') @@ -154,20 +154,20 @@ MergeRequest.setStatusBoxToMerged = function() { .text(__('Merged')); }; -MergeRequest.decreaseCounter = function(by = 1) { +MergeRequest.decreaseCounter = function (by = 1) { const $el = $('.js-merge-counter'); const count = Math.max(parseInt($el.text().replace(/[^\d]/, ''), 10) - by, 0); $el.text(addDelimiter(count)); }; -MergeRequest.hideCloseButton = function() { +MergeRequest.hideCloseButton = function () { const el = document.querySelector('.merge-request .js-issuable-actions'); // Dropdown for mobile screen el.querySelector('li.js-close-item').classList.add('hidden'); }; -MergeRequest.toggleDraftStatus = function(title, isReady) { +MergeRequest.toggleDraftStatus = function (title, isReady) { if (isReady) { createFlash(__('The merge request can now be merged.'), 'notice'); } diff --git a/app/assets/javascripts/mini_pipeline_graph_dropdown.js b/app/assets/javascripts/mini_pipeline_graph_dropdown.js index d4283701367..5e805f857aa 100644 --- a/app/assets/javascripts/mini_pipeline_graph_dropdown.js +++ b/app/assets/javascripts/mini_pipeline_graph_dropdown.js @@ -92,11 +92,7 @@ export default class MiniPipelineGraph { }) .catch(() => { this.toggleLoading(button); - if ( - $(button) - .parent() - .hasClass('open') - ) { + if ($(button).parent().hasClass('open')) { $(button).dropdown('toggle'); } flash(__('An error occurred while fetching the builds.'), 'alert'); diff --git a/app/assets/javascripts/monitoring/components/dashboard_panel_builder.vue b/app/assets/javascripts/monitoring/components/dashboard_panel_builder.vue index 0a1b1cd2c08..bcfa1b04322 100644 --- a/app/assets/javascripts/monitoring/components/dashboard_panel_builder.vue +++ b/app/assets/javascripts/monitoring/components/dashboard_panel_builder.vue @@ -146,7 +146,7 @@ export default { ) " > - <template #code="{content}"> + <template #code="{ content }"> <code>{{ content }}</code> </template> </gl-sprintf> diff --git a/app/assets/javascripts/network/branch_graph.js b/app/assets/javascripts/network/branch_graph.js index 3ea597a08d3..9539f1c52c7 100644 --- a/app/assets/javascripts/network/branch_graph.js +++ b/app/assets/javascripts/network/branch_graph.js @@ -243,11 +243,11 @@ export default class BranchGraph { }) .click(() => window.open(options.commit_url.replace('%s', commit.id), '_blank')) .hover( - function() { + function () { this.tooltip = r.commitTooltip(x + 5, y, commit); return top.push(this.tooltip.insertBefore(this)); }, - function() { + function () { return this.tooltip && this.tooltip.remove() && delete this.tooltip; }, ); diff --git a/app/assets/javascripts/new_branch_form.js b/app/assets/javascripts/new_branch_form.js index 9d064894433..dd820f1adae 100644 --- a/app/assets/javascripts/new_branch_form.js +++ b/app/assets/javascripts/new_branch_form.js @@ -53,13 +53,13 @@ export default class NewBranchForm { const { indexOf } = []; this.branchNameError.empty(); - const unique = function(values, value) { + const unique = function (values, value) { if (indexOf.call(values, value) === -1) { values.push(value); } return values; }; - const formatter = function(values, restriction) { + const formatter = function (values, restriction) { const formatted = values.map(value => { switch (false) { case !/\s/.test(value): diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 9a887021e5d..eb09468ca49 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -108,10 +108,7 @@ export default class Notes { // We are in the Merge Requests page so we need another edit form for Changes tab if (getPagePath(1) === 'merge_requests') { - $('.note-edit-form') - .clone() - .addClass('mr-note-edit-form') - .insertAfter('.note-edit-form'); + $('.note-edit-form').clone().addClass('mr-note-edit-form').insertAfter('.note-edit-form'); } const hash = getLocationHash(); @@ -427,12 +424,7 @@ export default class Notes { } else if (Notes.isUpdatedNote(noteEntity, $note)) { // The server can send the same update multiple times so we need to make sure to only update once per actual update. const isEditing = $note.hasClass('is-editing'); - const initialContent = normalizeNewlines( - $note - .find('.original-note-content') - .text() - .trim(), - ); + const initialContent = normalizeNewlines($note.find('.original-note-content').text().trim()); const $textarea = $note.find('.js-note-text'); const currentContent = $textarea.val(); // There can be CRLF vs LF mismatches if we don't sanitize and compare the same way @@ -541,14 +533,8 @@ export default class Notes { form.find('.js-errors').remove(); // reset text and preview form.find('.js-md-write-button').click(); - form - .find('.js-note-text') - .val('') - .trigger('input'); - form - .find('.js-note-text') - .data('autosave') - .reset(); + form.find('.js-note-text').val('').trigger('input'); + form.find('.js-note-text').data('autosave').reset(); const event = document.createEvent('Event'); event.initEvent('autosize:update', true, false); @@ -690,10 +676,7 @@ export default class Notes { } checkContentToAllowEditing($el) { - const initialContent = $el - .find('.original-note-content') - .text() - .trim(); + const initialContent = $el.find('.original-note-content').text().trim(); const currentContent = $el.find('.js-note-text').val(); let isAllowed = true; @@ -877,10 +860,7 @@ export default class Notes { const form = this.cleanForm(this.formClone.clone()); const replyLink = $(target).closest('.js-discussion-reply-button'); // insert the form after the button - replyLink - .closest('.discussion-reply-holder') - .hide() - .after(form); + replyLink.closest('.discussion-reply-holder').hide().after(form); // show the form return this.setupDiscussionNoteForm(replyLink, form); } @@ -1069,10 +1049,7 @@ export default class Notes { const row = form.closest('tr'); const glForm = form.data('glForm'); glForm.destroy(); - form - .find('.js-note-text') - .data('autosave') - .reset(); + form.find('.js-note-text').data('autosave').reset(); // show the reply button (will only work for replies) form.prev('.discussion-reply-holder').show(); if (row.is('.js-temp-notes-holder')) { @@ -1181,16 +1158,10 @@ export default class Notes { this.glForm = new GLForm($editForm.find('form'), this.enableGFM); - $editForm - .find('form') - .attr('action', `${postUrl}?html=true`) - .attr('data-remote', 'true'); + $editForm.find('form').attr('action', `${postUrl}?html=true`).attr('data-remote', 'true'); $editForm.find('.js-form-target-id').val(targetId); $editForm.find('.js-form-target-type').val(targetType); - $editForm - .find('.js-note-text') - .focus() - .val(originalContent); + $editForm.find('.js-note-text').focus().val(originalContent); $editForm.find('.js-md-write-button').trigger('click'); $editForm.find('.referenced-users').hide(); } @@ -1306,9 +1277,7 @@ export default class Notes { * intrusive. */ collapseLongCommitList() { - const systemNotes = $('#notes-list') - .find('li.system-note') - .has('ul'); + const systemNotes = $('#notes-list').find('li.system-note').has('ul'); $.each(systemNotes, (index, systemNote) => { const $systemNote = $(systemNote); @@ -1365,11 +1334,7 @@ export default class Notes { // There can be CRLF vs LF mismatches if we don't sanitize and compare the same way const sanitizedNoteEntityText = normalizeNewlines(noteEntity.note.trim()); const currentNoteText = normalizeNewlines( - $note - .find('.original-note-content') - .first() - .text() - .trim(), + $note.find('.original-note-content').first().text().trim(), ); return sanitizedNoteEntityText !== currentNoteText; } @@ -1545,10 +1510,7 @@ export default class Notes { let $form = $submitBtn.parents('form'); const $closeBtn = $form.find('.js-note-target-close'); const isDiscussionNote = - $submitBtn - .parent() - .find('li.droplab-item-selected') - .attr('id') === 'discussion'; + $submitBtn.parent().find('li.droplab-item-selected').attr('id') === 'discussion'; const isMainForm = $form.hasClass('js-main-target-form'); const isDiscussionForm = $form.hasClass('js-discussion-note-form'); const isDiscussionResolve = $submitBtn.hasClass('js-comment-resolve-button'); diff --git a/app/assets/javascripts/notes/components/discussion_actions.vue b/app/assets/javascripts/notes/components/discussion_actions.vue index 0272790a75d..21ce608becb 100644 --- a/app/assets/javascripts/notes/components/discussion_actions.vue +++ b/app/assets/javascripts/notes/components/discussion_actions.vue @@ -77,8 +77,8 @@ export default { <div v-if=" !hideJumpToNextUnresolvedInThreads && - discussion.resolvable && - shouldShowJumpToNextDiscussion + discussion.resolvable && + shouldShowJumpToNextDiscussion " class="btn-group discussion-actions ml-sm-2" > diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue index 8b9fdf53e3c..87082a64400 100644 --- a/app/assets/javascripts/notes/components/note_form.vue +++ b/app/assets/javascripts/notes/components/note_form.vue @@ -193,8 +193,7 @@ export default { }, canSuggest() { return ( - this.getNoteableData.can_receive_suggestion && - (this.line && this.line.can_receive_suggestion) + this.getNoteableData.can_receive_suggestion && this.line && this.line.can_receive_suggestion ); }, changedCommentText() { diff --git a/app/assets/javascripts/notifications_dropdown.js b/app/assets/javascripts/notifications_dropdown.js index ae992dd5dc5..4ad0af693fb 100644 --- a/app/assets/javascripts/notifications_dropdown.js +++ b/app/assets/javascripts/notifications_dropdown.js @@ -12,9 +12,7 @@ export default function notificationsDropdown() { } const notificationLevel = $(this).data('notificationLevel'); - const form = $(this) - .parents('.notification-form') - .first(); + const form = $(this).parents('.notification-form').first(); form.find('.js-notification-loading').toggleClass('spinner'); if (form.hasClass('no-label')) { @@ -29,9 +27,7 @@ export default function notificationsDropdown() { const data = e.detail[0]; if (data.saved) { - $(e.currentTarget) - .closest('.js-notification-dropdown') - .replaceWith(data.html); + $(e.currentTarget).closest('.js-notification-dropdown').replaceWith(data.html); } else { Flash(__('Failed to save new settings'), 'alert'); } diff --git a/app/assets/javascripts/packages/details/components/package_files.vue b/app/assets/javascripts/packages/details/components/package_files.vue index ab46dd0114d..dec443ca19d 100644 --- a/app/assets/javascripts/packages/details/components/package_files.vue +++ b/app/assets/javascripts/packages/details/components/package_files.vue @@ -90,7 +90,7 @@ export default { </gl-link> </template> - <template #cell(commit)="{item}"> + <template #cell(commit)="{ item }"> <gl-link :href="item.pipeline.project.commit_url" class="gl-text-gray-500" 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 cbb3bfd35ac..9439da3349d 100644 --- a/app/assets/javascripts/packages/list/components/packages_list_app.vue +++ b/app/assets/javascripts/packages/list/components/packages_list_app.vue @@ -110,7 +110,7 @@ export default { <template #description> <gl-sprintf v-if="filterQuery" :message="$options.i18n.widenFilters" /> <gl-sprintf v-else :message="$options.i18n.noResults"> - <template #noPackagesLink="{content}"> + <template #noPackagesLink="{ content }"> <gl-link :href="emptyListHelpUrl" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> diff --git a/app/assets/javascripts/pages/profiles/index.js b/app/assets/javascripts/pages/profiles/index.js index 883be18b336..d2b00d0ef45 100644 --- a/app/assets/javascripts/pages/profiles/index.js +++ b/app/assets/javascripts/pages/profiles/index.js @@ -4,7 +4,7 @@ import Profile from '~/profile/profile'; document.addEventListener('DOMContentLoaded', () => { // eslint-disable-next-line func-names - $(document).on('input.ssh_key', '#key_key', function() { + $(document).on('input.ssh_key', '#key_key', function () { const $title = $('#key_title'); const comment = $(this) .val() 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 6dd50958fa4..5d3ce30f9d9 100644 --- a/app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue +++ b/app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue @@ -161,9 +161,7 @@ export default { <template #coveragePercentage> {{ coveragePercentage }} </template> - <template #percentSymbol> - % - </template> + <template #percentSymbol> % </template> </gl-sprintf> </template> </gl-area-chart> diff --git a/app/assets/javascripts/pages/projects/init_form.js b/app/assets/javascripts/pages/projects/init_form.js index 019efe077f7..9f20a3e4e46 100644 --- a/app/assets/javascripts/pages/projects/init_form.js +++ b/app/assets/javascripts/pages/projects/init_form.js @@ -1,7 +1,7 @@ import ZenMode from '~/zen_mode'; import GLForm from '~/gl_form'; -export default function($formEl) { +export default function ($formEl) { new ZenMode(); // eslint-disable-line no-new new GLForm($formEl); // eslint-disable-line no-new } diff --git a/app/assets/javascripts/pages/projects/issues/show.js b/app/assets/javascripts/pages/projects/issues/show.js index 614f8262e5b..5162023a111 100644 --- a/app/assets/javascripts/pages/projects/issues/show.js +++ b/app/assets/javascripts/pages/projects/issues/show.js @@ -16,7 +16,7 @@ import initInviteMemberModal from '~/invite_member/init_invite_member_modal'; import { IssuableType } from '~/issuable_show/constants'; -export default function() { +export default function () { const initialDataEl = document.getElementById('js-issuable-app'); const { issueType, ...issuableData } = parseIssuableData(initialDataEl); 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 46f3f55a400..4c766f94fba 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 @@ -29,9 +29,7 @@ export default mrNewCompareNode => { $(mrNewCompareNode).find('.js-source-loading'), $(mrNewCompareNode).find('.mr_source_commit'), { - ref: $(mrNewCompareNode) - .find("input[name='merge_request[source_branch]']") - .val(), + ref: $(mrNewCompareNode).find("input[name='merge_request[source_branch]']").val(), }, ); const updateTargetBranchCommitList = () => @@ -43,9 +41,7 @@ export default mrNewCompareNode => { target_project_id: $(mrNewCompareNode) .find("input[name='merge_request[target_project_id]']") .val(), - ref: $(mrNewCompareNode) - .find("input[name='merge_request[target_branch]']") - .val(), + ref: $(mrNewCompareNode).find("input[name='merge_request[target_branch]']").val(), }, ); initCompareAutocomplete('branches', $dropdown => { diff --git a/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js b/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js index 0714fc21b17..27e10367a48 100644 --- a/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js +++ b/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js @@ -8,7 +8,7 @@ import loadAwardsHandler from '~/awards_handler'; import initInviteMemberTrigger from '~/invite_member/init_invite_member_trigger'; import initInviteMemberModal from '~/invite_member/init_invite_member_modal'; -export default function() { +export default function () { new ZenMode(); // eslint-disable-line no-new initIssuableSidebar(); initPipelines(); diff --git a/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue b/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue index 5ef1f959b2c..aa7414f3ae7 100644 --- a/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue +++ b/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue @@ -125,7 +125,7 @@ export default { :data-testid="option.value" > <gl-sprintf v-if="option.link" :message="option.text"> - <template #link="{content}"> + <template #link="{ content }"> <gl-link :href="option.link" target="_blank" class="gl-font-sm"> {{ content }} </gl-link> diff --git a/app/assets/javascripts/pages/projects/project.js b/app/assets/javascripts/pages/projects/project.js index 8c7aa04a0b6..807063be463 100644 --- a/app/assets/javascripts/pages/projects/project.js +++ b/app/assets/javascripts/pages/projects/project.js @@ -18,34 +18,26 @@ export default class Project { // Ref switcher if (document.querySelector('.js-project-refs-dropdown')) { Project.initRefSwitcher(); - $('.project-refs-select').on('change', function() { - return $(this) - .parents('form') - .trigger('submit'); + $('.project-refs-select').on('change', function () { + return $(this).parents('form').trigger('submit'); }); } - $('.hide-no-ssh-message').on('click', function(e) { + $('.hide-no-ssh-message').on('click', function (e) { Cookies.set('hide_no_ssh_message', 'false'); - $(this) - .parents('.no-ssh-key-message') - .remove(); + $(this).parents('.no-ssh-key-message').remove(); return e.preventDefault(); }); - $('.hide-no-password-message').on('click', function(e) { + $('.hide-no-password-message').on('click', function (e) { Cookies.set('hide_no_password_message', 'false'); - $(this) - .parents('.no-password-message') - .remove(); + $(this).parents('.no-password-message').remove(); return e.preventDefault(); }); - $('.hide-auto-devops-implicitly-enabled-banner').on('click', function(e) { + $('.hide-auto-devops-implicitly-enabled-banner').on('click', function (e) { const projectId = $(this).data('project-id'); const cookieKey = `hide_auto_devops_implicitly_enabled_banner_${projectId}`; Cookies.set(cookieKey, 'false'); - $(this) - .parents('.auto-devops-implicitly-enabled-banner') - .remove(); + $(this).parents('.auto-devops-implicitly-enabled-banner').remove(); return e.preventDefault(); }); @@ -67,7 +59,7 @@ export default class Project { refLink.href = '#'; - return $('.js-project-refs-dropdown').each(function() { + return $('.js-project-refs-dropdown').each(function () { const $dropdown = $(this); const selected = $dropdown.data('selected'); const fieldName = $dropdown.data('fieldName'); diff --git a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue index 5227964572f..f5a10266ed2 100644 --- a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue +++ b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue @@ -354,18 +354,21 @@ export default { <option :value="visibilityOptions.PRIVATE" :disabled="!visibilityAllowed(visibilityOptions.PRIVATE)" - >{{ s__('ProjectSettings|Private') }}</option > + {{ s__('ProjectSettings|Private') }} + </option> <option :value="visibilityOptions.INTERNAL" :disabled="!visibilityAllowed(visibilityOptions.INTERNAL)" - >{{ s__('ProjectSettings|Internal') }}</option > + {{ s__('ProjectSettings|Internal') }} + </option> <option :value="visibilityOptions.PUBLIC" :disabled="!visibilityAllowed(visibilityOptions.PUBLIC)" - >{{ s__('ProjectSettings|Public') }}</option > + {{ s__('ProjectSettings|Public') }} + </option> </select> <gl-icon name="chevron-down" diff --git a/app/assets/javascripts/pages/projects/tags/index/index.js b/app/assets/javascripts/pages/projects/tags/index/index.js index ec56fa3e075..7f85d84a2e8 100644 --- a/app/assets/javascripts/pages/projects/tags/index/index.js +++ b/app/assets/javascripts/pages/projects/tags/index/index.js @@ -3,10 +3,7 @@ import { initRemoveTag } from '../remove_tag'; document.addEventListener('DOMContentLoaded', () => { initRemoveTag({ onDelete: path => { - document - .querySelector(`[data-path="${path}"]`) - .closest('.js-tag-list') - .remove(); + document.querySelector(`[data-path="${path}"]`).closest('.js-tag-list').remove(); }, }); }); diff --git a/app/assets/javascripts/pages/search/show/search.js b/app/assets/javascripts/pages/search/show/search.js index b411b637f36..cbef5ab1bbc 100644 --- a/app/assets/javascripts/pages/search/show/search.js +++ b/app/assets/javascripts/pages/search/show/search.js @@ -16,16 +16,12 @@ export default class Search { } eventListeners() { - $(document) - .off('keyup', this.searchInput) - .on('keyup', this.searchInput, this.searchKeyUp); + $(document).off('keyup', this.searchInput).on('keyup', this.searchInput, this.searchKeyUp); $(document) .off('click', this.searchClear) .on('click', this.searchClear, this.clearSearchField.bind(this)); - $('a.js-search-clear') - .off('click', this.clearSearchFilter) - .on('click', this.clearSearchFilter); + $('a.js-search-clear').off('click', this.clearSearchFilter).on('click', this.clearSearchFilter); } static submitSearch() { @@ -42,10 +38,7 @@ export default class Search { } clearSearchField() { - return $(this.searchInput) - .val('') - .trigger('keyup') - .focus(); + return $(this.searchInput).val('').trigger('keyup').focus(); } // We need to manually follow the link on the anchors diff --git a/app/assets/javascripts/pages/users/activity_calendar.js b/app/assets/javascripts/pages/users/activity_calendar.js index 54666af540e..1322dd0e4c8 100644 --- a/app/assets/javascripts/pages/users/activity_calendar.js +++ b/app/assets/javascripts/pages/users/activity_calendar.js @@ -42,11 +42,7 @@ function formatTooltipText({ date, count }) { return `${contribText}<br />${dateDayName} ${dateText}`; } -const initColorKey = () => - d3 - .scaleLinear() - .range(['#acd5f2', '#254e77']) - .domain([0, 3]); +const initColorKey = () => d3.scaleLinear().range(['#acd5f2', '#254e77']).domain([0, 3]); export default class ActivityCalendar { constructor( @@ -291,10 +287,7 @@ export default class ActivityCalendar { this.colorKey(2), this.colorKey(3), ]; - return d3 - .scaleThreshold() - .domain([0, 10, 20, 30]) - .range(colorRange); + return d3.scaleThreshold().domain([0, 10, 20, 30]).range(colorRange); } clickDay(stamp) { diff --git a/app/assets/javascripts/pages/users/index.js b/app/assets/javascripts/pages/users/index.js index 8adbc2a8168..40574785879 100644 --- a/app/assets/javascripts/pages/users/index.js +++ b/app/assets/javascripts/pages/users/index.js @@ -11,9 +11,7 @@ function initUserProfile(action) { $('.hide-project-limit-message').on('click', e => { e.preventDefault(); Cookies.set('hide_project_limit_message', 'false'); - $(this) - .parents('.project-limit-message') - .remove(); + $(this).parents('.project-limit-message').remove(); }); } diff --git a/app/assets/javascripts/pipeline_editor/components/lint/ci_lint_results.vue b/app/assets/javascripts/pipeline_editor/components/lint/ci_lint_results.vue index 14b0a38da58..58a96c3f725 100644 --- a/app/assets/javascripts/pipeline_editor/components/lint/ci_lint_results.vue +++ b/app/assets/javascripts/pipeline_editor/components/lint/ci_lint_results.vue @@ -103,7 +103,7 @@ export default { data-testid="ci-lint-status" >{{ status.text }} <gl-sprintf :message="$options.includesText"> - <template #code="{content}"> + <template #code="{ content }"> <code> {{ content }} </code> diff --git a/app/assets/javascripts/pipelines/components/graph/job_item.vue b/app/assets/javascripts/pipelines/components/graph/job_item.vue index 93ebe02d4e8..2d3cac88eab 100644 --- a/app/assets/javascripts/pipelines/components/graph/job_item.vue +++ b/app/assets/javascripts/pipelines/components/graph/job_item.vue @@ -151,8 +151,7 @@ export default { :href="detailsPath" :title="tooltipText" :class="jobClasses" - class="js-pipeline-graph-job-link qa-job-link menu-item gl-text-gray-900 gl-active-text-decoration-none - gl-focus-text-decoration-none gl-hover-text-decoration-none" + class="js-pipeline-graph-job-link qa-job-link menu-item gl-text-gray-900 gl-active-text-decoration-none gl-focus-text-decoration-none gl-hover-text-decoration-none" data-testid="job-with-link" @click.stop="hideTooltips" @mouseout="hideTooltips" diff --git a/app/assets/javascripts/pipelines/components/pipeline_graph/drawing_utils.js b/app/assets/javascripts/pipelines/components/pipeline_graph/drawing_utils.js index 35230e1511b..a31f3068d5e 100644 --- a/app/assets/javascripts/pipelines/components/pipeline_graph/drawing_utils.js +++ b/app/assets/javascripts/pipelines/components/pipeline_graph/drawing_utils.js @@ -36,16 +36,10 @@ export const generateLinksData = ({ links }, containerID) => { // positioned in the center of the job node by adding half the height // of the job pill. const paddingLeft = Number( - window - .getComputedStyle(containerEl, null) - .getPropertyValue('padding-left') - .replace('px', ''), + window.getComputedStyle(containerEl, null).getPropertyValue('padding-left').replace('px', ''), ); const paddingTop = Number( - window - .getComputedStyle(containerEl, null) - .getPropertyValue('padding-top') - .replace('px', ''), + window.getComputedStyle(containerEl, null).getPropertyValue('padding-top').replace('px', ''), ); const sourceNodeX = sourceNodeCoordinates.right - containerCoordinates.x - paddingLeft; diff --git a/app/assets/javascripts/pipelines/components/pipelines_list/pipeline_url.vue b/app/assets/javascripts/pipelines/components/pipelines_list/pipeline_url.vue index bde0dd53aac..048b83b2347 100644 --- a/app/assets/javascripts/pipelines/components/pipelines_list/pipeline_url.vue +++ b/app/assets/javascripts/pipelines/components/pipelines_list/pipeline_url.vue @@ -113,7 +113,7 @@ export default { ) " > - <template #strong="{content}"> + <template #strong="{ content }"> <b>{{ content }}</b> </template> </gl-sprintf> diff --git a/app/assets/javascripts/pipelines/components/pipelines_list/tokens/pipeline_trigger_author_token.vue b/app/assets/javascripts/pipelines/components/pipelines_list/tokens/pipeline_trigger_author_token.vue index ae5758233bc..c4f744de458 100644 --- a/app/assets/javascripts/pipelines/components/pipelines_list/tokens/pipeline_trigger_author_token.vue +++ b/app/assets/javascripts/pipelines/components/pipelines_list/tokens/pipeline_trigger_author_token.vue @@ -80,7 +80,7 @@ export default { v-on="$listeners" @input="searchAuthors" > - <template #view="{inputValue}"> + <template #view="{ inputValue }"> <gl-avatar v-if="activeUser" :size="16" diff --git a/app/assets/javascripts/pipelines/pipeline_details_bundle.js b/app/assets/javascripts/pipelines/pipeline_details_bundle.js index 27f71d2b878..c5a1159c8ce 100644 --- a/app/assets/javascripts/pipelines/pipeline_details_bundle.js +++ b/app/assets/javascripts/pipelines/pipeline_details_bundle.js @@ -125,7 +125,7 @@ const createTestDetails = () => { }); }; -export default async function() { +export default async function () { createTestDetails(); createDagApp(); diff --git a/app/assets/javascripts/pipelines/stores/pipeline_store.js b/app/assets/javascripts/pipelines/stores/pipeline_store.js index c6f65277c8d..e34c847457b 100644 --- a/app/assets/javascripts/pipelines/stores/pipeline_store.js +++ b/app/assets/javascripts/pipelines/stores/pipeline_store.js @@ -198,6 +198,9 @@ export default class PipelineStore { } removeExpandedPipelineToRequestData(id) { - this.state.expandedPipelines.splice(this.state.expandedPipelines.findIndex(el => el === id), 1); + this.state.expandedPipelines.splice( + this.state.expandedPipelines.findIndex(el => el === id), + 1, + ); } } diff --git a/app/assets/javascripts/profile/gl_crop.js b/app/assets/javascripts/profile/gl_crop.js index ecb69422287..afc78cbe78a 100644 --- a/app/assets/javascripts/profile/gl_crop.js +++ b/app/assets/javascripts/profile/gl_crop.js @@ -61,7 +61,7 @@ import { loadCSSFile } from '../lib/utils/css_utils'; bindEvents() { const _this = this; - this.fileInput.on('change', function(e) { + this.fileInput.on('change', function (e) { _this.onFileInputChange(e, this); this.value = null; }); @@ -69,7 +69,7 @@ import { loadCSSFile } from '../lib/utils/css_utils'; this.modalCrop.on('shown.bs.modal', this.onModalShow); this.modalCrop.on('hidden.bs.modal', this.onModalHide); this.uploadImageBtn.on('click', this.onUploadImageBtnClick); - this.cropActionsBtn.on('click', function() { + this.cropActionsBtn.on('click', function () { const btn = this; return _this.onActionBtnClick(btn); }); @@ -184,8 +184,8 @@ import { loadCSSFile } from '../lib/utils/css_utils'; const cropModal = document.querySelector('.modal-profile-crop'); if (cropModal) loadCSSFile(cropModal.dataset.cropperCssPath); - $.fn.glCrop = function(opts) { - return this.each(function() { + $.fn.glCrop = function (opts) { + return this.each(function () { return $(this).data('glcrop', new GitLabCrop(this, opts)); }); }; diff --git a/app/assets/javascripts/profile/profile.js b/app/assets/javascripts/profile/profile.js index 4755a4aa9ba..ef3b38095b4 100644 --- a/app/assets/javascripts/profile/profile.js +++ b/app/assets/javascripts/profile/profile.js @@ -33,9 +33,7 @@ export default class Profile { uploadImageBtn: '.js-upload-user-avatar', modalCropImg: '.modal-profile-crop-image', }; - this.avatarGlCrop = $('.js-user-avatar-input') - .glCrop(cropOpts) - .data('glcrop'); + this.avatarGlCrop = $('.js-user-avatar-input').glCrop(cropOpts).data('glcrop'); } bindEvents() { diff --git a/app/assets/javascripts/project_find_file.js b/app/assets/javascripts/project_find_file.js index 0e12c219e45..2ba07a2af27 100644 --- a/app/assets/javascripts/project_find_file.js +++ b/app/assets/javascripts/project_find_file.js @@ -10,7 +10,7 @@ import { deprecatedCreateFlash as flash } from '~/flash'; import { __ } from '~/locale'; // highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> ) -const highlighter = function(element, text, matches) { +const highlighter = function (element, text, matches) { let j = 0; let len = 0; let lastIndex = 0; @@ -65,11 +65,7 @@ export default class ProjectFindFile { if (value !== oldValue) { target.data('oldValue', value); this.findFile(); - return this.element - .find('tr.tree-item') - .eq(0) - .addClass('selected') - .focus(); + return this.element.find('tr.tree-item').eq(0).addClass('selected').focus(); } }); } @@ -90,11 +86,7 @@ export default class ProjectFindFile { this.element.find('.loading').hide(); this.filePaths = data; this.findFile(); - this.element - .find('.files-slider tr.tree-item') - .eq(0) - .addClass('selected') - .focus(); + this.element.find('.files-slider tr.tree-item').eq(0).addClass('selected').focus(); }) .catch(() => flash(__('An error occurred while loading filenames'))); } diff --git a/app/assets/javascripts/project_select.js b/app/assets/javascripts/project_select.js index f7d823802b6..f7818a457d2 100644 --- a/app/assets/javascripts/project_select.js +++ b/app/assets/javascripts/project_select.js @@ -9,7 +9,7 @@ import { loadCSSFile } from './lib/utils/css_utils'; const projectSelect = () => { loadCSSFile(gon.select2_css_path) .then(() => { - $('.ajax-project-select').each(function(i, select) { + $('.ajax-project-select').each(function (i, select) { let placeholder; const simpleFilter = $(select).data('simpleFilter') || false; const isInstantiated = $(select).data('select2'); @@ -35,15 +35,15 @@ const projectSelect = () => { minimumInputLength: 0, query: query => { let projectsCallback; - const finalCallback = function(projects) { + const finalCallback = function (projects) { const data = { results: projects, }; return query.callback(data); }; if (this.includeGroups) { - projectsCallback = function(projects) { - const groupsCallback = function(groups) { + projectsCallback = function (projects) { + const groupsCallback = function (groups) { const data = groups.concat(projects); return finalCallback(data); }; diff --git a/app/assets/javascripts/project_select_combo_button.js b/app/assets/javascripts/project_select_combo_button.js index 865dd23bd80..6e41a268c5f 100644 --- a/app/assets/javascripts/project_select_combo_button.js +++ b/app/assets/javascripts/project_select_combo_button.js @@ -50,9 +50,7 @@ export default class ProjectSelectComboButton { // eslint-disable-next-line promise/no-nesting loadCSSFile(gon.select2_css_path) .then(() => { - $(event.currentTarget) - .siblings('.project-item-select') - .select2('open'); + $(event.currentTarget).siblings('.project-item-select').select2('open'); }) .catch(() => {}); }) @@ -104,14 +102,8 @@ export default class ProjectSelectComboButton { const defaultTextPrefix = this.resourceLabel; // the trailing slice call depluralizes each of these strings (e.g. new-issues -> new-issue) - const localStorageItemType = `new-${this.resourceType - .split('_') - .join('-') - .slice(0, -1)}`; - const presetTextSuffix = this.resourceType - .split('_') - .join(' ') - .slice(0, -1); + const localStorageItemType = `new-${this.resourceType.split('_').join('-').slice(0, -1)}`; + const presetTextSuffix = this.resourceType.split('_').join(' ').slice(0, -1); return { localStorageItemType, // new-issue / new-merge-request diff --git a/app/assets/javascripts/projects/commit_box/info/init_details_button.js b/app/assets/javascripts/projects/commit_box/info/init_details_button.js index 032fbf5316a..833e946af5c 100644 --- a/app/assets/javascripts/projects/commit_box/info/init_details_button.js +++ b/app/assets/javascripts/projects/commit_box/info/init_details_button.js @@ -3,9 +3,7 @@ import $ from 'jquery'; export const initDetailsButton = () => { $('body').on('click', '.js-details-expand', function expand(e) { e.preventDefault(); - $(this) - .next('.js-details-content') - .removeClass('hide'); + $(this).next('.js-details-content').removeClass('hide'); $(this).hide(); }); }; diff --git a/app/assets/javascripts/projects/experiment_new_project_creation/index.js b/app/assets/javascripts/projects/experiment_new_project_creation/index.js index 3715c52b6b9..06920a5ab19 100644 --- a/app/assets/javascripts/projects/experiment_new_project_creation/index.js +++ b/app/assets/javascripts/projects/experiment_new_project_creation/index.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import NewProjectCreationApp from './components/app.vue'; -export default function(el, props) { +export default function (el, props) { return new Vue({ el, components: { diff --git a/app/assets/javascripts/projects/project_new.js b/app/assets/javascripts/projects/project_new.js index d54a48cc444..36021c5ca20 100644 --- a/app/assets/javascripts/projects/project_new.js +++ b/app/assets/javascripts/projects/project_new.js @@ -91,9 +91,7 @@ const bindEvents = () => { $('.how_to_import_link').on('click', e => { e.preventDefault(); - $(e.currentTarget) - .next('.modal') - .show(); + $(e.currentTarget).next('.modal').show(); }); $('.modal-header .close').on('click', () => { @@ -151,10 +149,7 @@ const bindEvents = () => { const selectedTemplate = DEFAULT_PROJECT_TEMPLATES[value]; $selectedTemplateText.text(selectedTemplate.text); - $(selectedTemplate.icon) - .clone() - .addClass('d-block') - .appendTo($selectedIcon); + $(selectedTemplate.icon).clone().addClass('d-block').appendTo($selectedIcon); const $activeTabProjectName = $('.tab-pane.active #project_name'); const $activeTabProjectPath = $('.tab-pane.active #project_path'); diff --git a/app/assets/javascripts/projects/tree/components/commit_pipeline_status_component.vue b/app/assets/javascripts/projects/tree/components/commit_pipeline_status_component.vue index e582d5c3e47..9788a32dcbd 100644 --- a/app/assets/javascripts/projects/tree/components/commit_pipeline_status_component.vue +++ b/app/assets/javascripts/projects/tree/components/commit_pipeline_status_component.vue @@ -83,10 +83,7 @@ export default { }); }, fetchPipelineCommitData() { - this.service - .fetchData() - .then(this.successCallback) - .catch(this.errorCallback); + this.service.fetchData().then(this.successCallback).catch(this.errorCallback); }, }, }; diff --git a/app/assets/javascripts/registry/explorer/components/details_page/delete_alert.vue b/app/assets/javascripts/registry/explorer/components/details_page/delete_alert.vue index 8bdf043a106..56d2ff86fb7 100644 --- a/app/assets/javascripts/registry/explorer/components/details_page/delete_alert.vue +++ b/app/assets/javascripts/registry/explorer/components/details_page/delete_alert.vue @@ -60,7 +60,7 @@ export default { @dismiss="$emit('change', null)" > <gl-sprintf :message="deleteAlertConfig.message"> - <template #docLink="{content}"> + <template #docLink="{ content }"> <gl-link :href="garbageCollectionHelpPagePath" target="_blank"> {{ content }} </gl-link> diff --git a/app/assets/javascripts/registry/explorer/components/details_page/partial_cleanup_alert.vue b/app/assets/javascripts/registry/explorer/components/details_page/partial_cleanup_alert.vue index d13d815a59e..12095655126 100644 --- a/app/assets/javascripts/registry/explorer/components/details_page/partial_cleanup_alert.vue +++ b/app/assets/javascripts/registry/explorer/components/details_page/partial_cleanup_alert.vue @@ -23,12 +23,12 @@ export default { <template> <gl-alert variant="warning" :title="$options.i18n.DELETE_ALERT_TITLE" @dismiss="$emit('dismiss')"> <gl-sprintf :message="$options.i18n.DELETE_ALERT_LINK_TEXT"> - <template #adminLink="{content}"> + <template #adminLink="{ content }"> <gl-link data-testid="run-link" :href="runCleanupPoliciesHelpPagePath" target="_blank">{{ content }}</gl-link> </template> - <template #docLink="{content}"> + <template #docLink="{ content }"> <gl-link data-testid="help-link" :href="cleanupPoliciesHelpPagePath" target="_blank">{{ content }}</gl-link> 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 5aeafd318aa..2fac02768bc 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 @@ -138,9 +138,7 @@ export default { <template #left-secondary> <span data-testid="size"> {{ formattedSize }} - <template v-if="formattedSize && layers" - >·</template - > + <template v-if="formattedSize && layers">·</template> {{ layers }} </span> </template> diff --git a/app/assets/javascripts/registry/explorer/components/list_page/group_empty_state.vue b/app/assets/javascripts/registry/explorer/components/list_page/group_empty_state.vue index 26e9fee63af..4f8f376db58 100644 --- a/app/assets/javascripts/registry/explorer/components/list_page/group_empty_state.vue +++ b/app/assets/javascripts/registry/explorer/components/list_page/group_empty_state.vue @@ -25,7 +25,7 @@ export default { ) " > - <template #docLink="{content}"> + <template #docLink="{ content }"> <gl-link :href="config.helpPagePath" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> diff --git a/app/assets/javascripts/registry/explorer/components/list_page/project_empty_state.vue b/app/assets/javascripts/registry/explorer/components/list_page/project_empty_state.vue index 5308b025cc0..5aa04419ca0 100644 --- a/app/assets/javascripts/registry/explorer/components/list_page/project_empty_state.vue +++ b/app/assets/javascripts/registry/explorer/components/list_page/project_empty_state.vue @@ -45,7 +45,7 @@ export default { <template #description> <p> <gl-sprintf :message="$options.i18n.introText"> - <template #docLink="{content}"> + <template #docLink="{ content }"> <gl-link :href="config.helpPagePath" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> @@ -53,10 +53,10 @@ export default { <h5>{{ $options.i18n.quickStart }}</h5> <p> <gl-sprintf :message="$options.i18n.notLoggedInMessage"> - <template #twofaDocLink="{content}"> + <template #twofaDocLink="{ content }"> <gl-link :href="config.twoFactorAuthHelpLink" target="_blank">{{ content }}</gl-link> </template> - <template #personalAccessTokensDocLink="{content}"> + <template #personalAccessTokensDocLink="{ content }"> <gl-link :href="config.personalAccessTokensHelpLink" target="_blank">{{ content }}</gl-link> @@ -81,7 +81,7 @@ export default { <p class="gl-mb-4"> {{ $options.i18n.addImageText }} </p> - <gl-form-input-group class="gl-mb-4 "> + <gl-form-input-group class="gl-mb-4"> <gl-form-input :value="dockerBuildCommand" readonly diff --git a/app/assets/javascripts/registry/explorer/pages/list.vue b/app/assets/javascripts/registry/explorer/pages/list.vue index 3192ba82db8..d4c052c02cd 100644 --- a/app/assets/javascripts/registry/explorer/pages/list.vue +++ b/app/assets/javascripts/registry/explorer/pages/list.vue @@ -230,7 +230,7 @@ export default { <template #description> <p> <gl-sprintf :message="$options.i18n.CONNECTION_ERROR_MESSAGE"> - <template #docLink="{content}"> + <template #docLink="{ content }"> <gl-link :href="`${config.helpPagePath}#docker-connection-error`" target="_blank"> {{ content }} </gl-link> diff --git a/app/assets/javascripts/registry/settings/components/expiration_input.vue b/app/assets/javascripts/registry/settings/components/expiration_input.vue index 2dbd9d26f60..42b7c7918a5 100644 --- a/app/assets/javascripts/registry/settings/components/expiration_input.vue +++ b/app/assets/javascripts/registry/settings/components/expiration_input.vue @@ -83,7 +83,7 @@ export default { <template #label> <span data-testid="label"> <gl-sprintf :message="label"> - <template #italic="{content}"> + <template #italic="{ content }"> <i>{{ content }}</i> </template> </gl-sprintf> @@ -100,7 +100,7 @@ export default { <template #description> <span data-testid="description" class="gl-text-gray-400"> <gl-sprintf :message="description"> - <template #link="{content}"> + <template #link="{ content }"> <gl-link :href="tagsRegexHelpPagePath" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> diff --git a/app/assets/javascripts/registry/settings/components/expiration_toggle.vue b/app/assets/javascripts/registry/settings/components/expiration_toggle.vue index 7f045244926..0ffd8216ab1 100644 --- a/app/assets/javascripts/registry/settings/components/expiration_toggle.vue +++ b/app/assets/javascripts/registry/settings/components/expiration_toggle.vue @@ -42,7 +42,7 @@ export default { <gl-toggle id="expiration-policy-toggle" v-model="enabled" :disabled="disabled" /> <span class="gl-ml-5 gl-line-height-24" data-testid="description"> <gl-sprintf :message="toggleText"> - <template #strong="{content}"> + <template #strong="{ content }"> <strong>{{ content }}</strong> </template> </gl-sprintf> diff --git a/app/assets/javascripts/registry/settings/components/settings_form.vue b/app/assets/javascripts/registry/settings/components/settings_form.vue index 1f374c7b60e..1ef0170a7f6 100644 --- a/app/assets/javascripts/registry/settings/components/settings_form.vue +++ b/app/assets/javascripts/registry/settings/components/settings_form.vue @@ -214,10 +214,10 @@ export default { <div> <p> <gl-sprintf :message="$options.i18n.KEEP_INFO_TEXT"> - <template #strong="{content}"> + <template #strong="{ content }"> <strong>{{ content }}</strong> </template> - <template #secondStrong="{content}"> + <template #secondStrong="{ content }"> <strong>{{ content }}</strong> </template> </gl-sprintf> @@ -253,10 +253,10 @@ export default { <div> <p> <gl-sprintf :message="$options.i18n.REMOVE_INFO_TEXT"> - <template #strong="{content}"> + <template #strong="{ content }"> <strong>{{ content }}</strong> </template> - <template #secondStrong="{content}"> + <template #secondStrong="{ content }"> <strong>{{ content }}</strong> </template> </gl-sprintf> diff --git a/app/assets/javascripts/reports/components/report_link.vue b/app/assets/javascripts/reports/components/report_link.vue index f285b526a54..1f68f79e487 100644 --- a/app/assets/javascripts/reports/components/report_link.vue +++ b/app/assets/javascripts/reports/components/report_link.vue @@ -21,16 +21,10 @@ export default { rel="noopener noreferrer nofollow" class="break-link" > - {{ issue.path - }}<template v-if="issue.line" - >:{{ issue.line }}</template - > + {{ issue.path }}<template v-if="issue.line">:{{ issue.line }}</template> </a> <template v-else> - {{ issue.path - }}<template v-if="issue.line" - >:{{ issue.line }}</template - > + {{ issue.path }}<template v-if="issue.line">:{{ issue.line }}</template> </template> </div> </template> diff --git a/app/assets/javascripts/repository/components/table/parent_row.vue b/app/assets/javascripts/repository/components/table/parent_row.vue index b4095e00884..3014088146a 100644 --- a/app/assets/javascripts/repository/components/table/parent_row.vue +++ b/app/assets/javascripts/repository/components/table/parent_row.vue @@ -48,9 +48,7 @@ export default { inline class="d-inline-block align-text-bottom" /> - <router-link v-else :to="parentRoute" :aria-label="__('Go to parent')"> - .. - </router-link> + <router-link v-else :to="parentRoute" :aria-label="__('Go to parent')"> .. </router-link> </td> </tr> </template> diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 6f43f837374..b9bc799fb0b 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -15,13 +15,13 @@ function Sidebar() { this.addEventListeners(); } -Sidebar.initialize = function() { +Sidebar.initialize = function () { if (!this.instance) { this.instance = new Sidebar(); } }; -Sidebar.prototype.removeListeners = function() { +Sidebar.prototype.removeListeners = function () { this.sidebar.off('click', '.sidebar-collapsed-icon'); // eslint-disable-next-line @gitlab/no-global-event-off this.sidebar.off('hidden.gl.dropdown'); @@ -32,7 +32,7 @@ Sidebar.prototype.removeListeners = function() { $(document).off('click', '.js-sidebar-toggle'); }; -Sidebar.prototype.addEventListeners = function() { +Sidebar.prototype.addEventListeners = function () { const $document = $(document); this.sidebar.on('click', '.sidebar-collapsed-icon', this, this.sidebarCollapseClicked); @@ -44,7 +44,7 @@ Sidebar.prototype.addEventListeners = function() { .on('click', '.js-issuable-todo', this.toggleTodo); }; -Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { +Sidebar.prototype.sidebarToggleClicked = function (e, triggered) { const $this = $(this); const $collapseIcon = $('.js-sidebar-collapse'); const $expandIcon = $('.js-sidebar-expand'); @@ -60,9 +60,7 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { $('aside.right-sidebar') .removeClass('right-sidebar-expanded') .addClass('right-sidebar-collapsed'); - $('.layout-page') - .removeClass('right-sidebar-expanded') - .addClass('right-sidebar-collapsed'); + $('.layout-page').removeClass('right-sidebar-expanded').addClass('right-sidebar-collapsed'); } else { $toggleContainer.data('is-expanded', true); $expandIcon.addClass('hidden'); @@ -70,9 +68,7 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { $('aside.right-sidebar') .removeClass('right-sidebar-collapsed') .addClass('right-sidebar-expanded'); - $('.layout-page') - .removeClass('right-sidebar-collapsed') - .addClass('right-sidebar-expanded'); + $('.layout-page').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded'); } $this.attr('data-original-title', tooltipLabel); @@ -82,16 +78,14 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { } }; -Sidebar.prototype.toggleTodo = function(e) { +Sidebar.prototype.toggleTodo = function (e) { const $this = $(e.currentTarget); const ajaxType = $this.data('deletePath') ? 'delete' : 'post'; const url = String($this.data('deletePath') || $this.data('createPath')); hide($this); - $('.js-issuable-todo') - .disable() - .addClass('is-loading'); + $('.js-issuable-todo').disable().addClass('is-loading'); axios[ajaxType](url, { issuable_id: $this.data('issuableId'), @@ -110,7 +104,7 @@ Sidebar.prototype.toggleTodo = function(e) { ); }; -Sidebar.prototype.todoUpdateDone = function(data) { +Sidebar.prototype.todoUpdateDone = function (data) { const deletePath = data.delete_path ? data.delete_path : null; const attrPrefix = deletePath ? 'mark' : 'todo'; const $todoBtns = $('.js-issuable-todo'); @@ -140,7 +134,7 @@ Sidebar.prototype.todoUpdateDone = function(data) { }); }; -Sidebar.prototype.sidebarCollapseClicked = function(e) { +Sidebar.prototype.sidebarCollapseClicked = function (e) { if ($(e.currentTarget).hasClass('dont-change-state')) { return; } @@ -150,7 +144,7 @@ Sidebar.prototype.sidebarCollapseClicked = function(e) { return sidebar.openDropdown($block); }; -Sidebar.prototype.openDropdown = function(blockOrName) { +Sidebar.prototype.openDropdown = function (blockOrName) { const $block = typeof blockOrName === 'string' ? this.getBlock(blockOrName) : blockOrName; if (!this.isOpen()) { this.setCollapseAfterUpdate($block); @@ -164,19 +158,19 @@ Sidebar.prototype.openDropdown = function(blockOrName) { }); }; -Sidebar.prototype.setCollapseAfterUpdate = function($block) { +Sidebar.prototype.setCollapseAfterUpdate = function ($block) { $block.addClass('collapse-after-update'); return $('.layout-page').addClass('with-overlay'); }; -Sidebar.prototype.onSidebarDropdownHidden = function(e) { +Sidebar.prototype.onSidebarDropdownHidden = function (e) { const sidebar = e.data; e.preventDefault(); const $block = $(e.target).closest('.block'); return sidebar.sidebarDropdownHidden($block); }; -Sidebar.prototype.sidebarDropdownHidden = function($block) { +Sidebar.prototype.sidebarDropdownHidden = function ($block) { if ($block.hasClass('collapse-after-update')) { $block.removeClass('collapse-after-update'); $('.layout-page').removeClass('with-overlay'); @@ -184,11 +178,11 @@ Sidebar.prototype.sidebarDropdownHidden = function($block) { } }; -Sidebar.prototype.triggerOpenSidebar = function() { +Sidebar.prototype.triggerOpenSidebar = function () { return this.sidebar.find('.js-sidebar-toggle').trigger('click'); }; -Sidebar.prototype.toggleSidebar = function(action) { +Sidebar.prototype.toggleSidebar = function (action) { if (action == null) { action = 'toggle'; } @@ -207,11 +201,11 @@ Sidebar.prototype.toggleSidebar = function(action) { } }; -Sidebar.prototype.isOpen = function() { +Sidebar.prototype.isOpen = function () { return this.sidebar.is('.right-sidebar-expanded'); }; -Sidebar.prototype.getBlock = function(name) { +Sidebar.prototype.getBlock = function (name) { return this.sidebar.find(`.block.${name}`); }; diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index 97674348436..32559242225 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -76,8 +76,8 @@ export class SearchAutocomplete { this.wrap = wrap || $('.search'); this.optsEl = optsEl || this.wrap.find('.search-autocomplete-opts'); this.autocompletePath = autocompletePath || this.optsEl.data('autocompletePath'); - this.projectId = projectId || (this.optsEl.data('autocompleteProjectId') || ''); - this.projectRef = projectRef || (this.optsEl.data('autocompleteProjectRef') || ''); + this.projectId = projectId || this.optsEl.data('autocompleteProjectId') || ''; + this.projectRef = projectRef || this.optsEl.data('autocompleteProjectRef') || ''; this.dropdown = this.wrap.find('.dropdown'); this.dropdownToggle = this.wrap.find('.js-dropdown-search-toggle'); this.dropdownMenu = this.dropdown.find('.dropdown-menu'); diff --git a/app/assets/javascripts/settings_panels.js b/app/assets/javascripts/settings_panels.js index 18160421136..ac5a7cfc4ba 100644 --- a/app/assets/javascripts/settings_panels.js +++ b/app/assets/javascripts/settings_panels.js @@ -4,10 +4,7 @@ import { __ } from './locale'; function expandSection($section) { $section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Collapse')); // eslint-disable-next-line @gitlab/no-global-event-off - $section - .find('.settings-content') - .off('scroll.expandSection') - .scrollTop(0); + $section.find('.settings-content').off('scroll.expandSection').scrollTop(0); $section.addClass('expanded'); if (!$section.hasClass('no-animate')) { $section diff --git a/app/assets/javascripts/single_file_diff.js b/app/assets/javascripts/single_file_diff.js index f751df6367e..bd3f89050e6 100644 --- a/app/assets/javascripts/single_file_diff.js +++ b/app/assets/javascripts/single_file_diff.js @@ -29,17 +29,12 @@ export default class SingleFileDiff { this.isOpen = !this.diffForPath; if (this.diffForPath) { this.collapsedContent = this.content; - this.loadingContent = $(WRAPPER) - .addClass('loading') - .html(LOADING_HTML) - .hide(); + this.loadingContent = $(WRAPPER).addClass('loading').html(LOADING_HTML).hide(); this.content = null; this.collapsedContent.after(this.loadingContent); this.$chevronRightIcon.removeClass('gl-display-none'); } else { - this.collapsedContent = $(WRAPPER) - .html(COLLAPSED_HTML) - .hide(); + this.collapsedContent = $(WRAPPER).html(COLLAPSED_HTML).hide(); this.content.after(this.collapsedContent); this.$chevronDownIcon.removeClass('gl-display-none'); } diff --git a/app/assets/javascripts/smart_interval.js b/app/assets/javascripts/smart_interval.js index c4655d35cf0..2a0ac2b25f1 100644 --- a/app/assets/javascripts/smart_interval.js +++ b/app/assets/javascripts/smart_interval.js @@ -96,9 +96,7 @@ export default class SmartInterval { window.removeEventListener('focus', this.onWindowVisibilityChange); this.cancel(); // eslint-disable-next-line @gitlab/no-global-event-off - $(document) - .off('visibilitychange') - .off('beforeunload'); + $(document).off('visibilitychange').off('beforeunload'); } /* private */ diff --git a/app/assets/javascripts/snippets/components/snippet_blob_view.vue b/app/assets/javascripts/snippets/components/snippet_blob_view.vue index b965c15306d..5a9ac0af060 100644 --- a/app/assets/javascripts/snippets/components/snippet_blob_view.vue +++ b/app/assets/javascripts/snippets/components/snippet_blob_view.vue @@ -53,9 +53,7 @@ export default { }, provide() { return { - blobHash: Math.random() - .toString() - .split('.')[1], + blobHash: Math.random().toString().split('.')[1], }; }, data() { diff --git a/app/assets/javascripts/star.js b/app/assets/javascripts/star.js index 64842ae7f8d..232c97ecae0 100644 --- a/app/assets/javascripts/star.js +++ b/app/assets/javascripts/star.js @@ -16,10 +16,7 @@ export default class Star { .post($this.data('endpoint')) .then(({ data }) => { const isStarred = $starSpan.hasClass('starred'); - $this - .parent() - .find('.count') - .text(data.star_count); + $this.parent().find('.count').text(data.star_count); if (isStarred) { $starSpan.removeClass('starred').text(s__('StarProject|Star')); diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js index 947246b2fbb..25a14107bbc 100644 --- a/app/assets/javascripts/tree.js +++ b/app/assets/javascripts/tree.js @@ -8,7 +8,7 @@ export default class TreeView { this.initKeyNav(); // Code browser tree slider // Make the entire tree-item row clickable, but not if clicking another link (like a commit message) - $('.tree-content-holder .tree-item').on('click', function(e) { + $('.tree-content-holder .tree-item').on('click', function (e) { const $clickedEl = $(e.target); const path = $('.tree-item-file-name a', this).attr('href'); if (!$clickedEl.is('a') && !$clickedEl.is('.str-truncated')) { @@ -20,9 +20,7 @@ export default class TreeView { } }); // Show the "Loading commit data" for only the first element - $('span.log_loading') - .first() - .removeClass('hide'); + $('span.log_loading').first().removeClass('hide'); } initKeyNav() { diff --git a/app/assets/javascripts/users_select/index.js b/app/assets/javascripts/users_select/index.js index 9278e0c5859..9288af0bbf7 100644 --- a/app/assets/javascripts/users_select/index.js +++ b/app/assets/javascripts/users_select/index.js @@ -75,7 +75,7 @@ function UsersSelect(currentUser, els, options = {}) { selectedId = selectedIdDefault; } - const assignYourself = function() { + const assignYourself = function () { const unassignedSelected = $dropdown .closest('.selectbox') .find(`input[name='${$dropdown.data('fieldName')}'][value=0]`); @@ -108,17 +108,17 @@ function UsersSelect(currentUser, els, options = {}) { $block[0].addEventListener('assignYourself', assignYourself); } - const getSelectedUserInputs = function() { + const getSelectedUserInputs = function () { return $selectbox.find(`input[name="${$dropdown.data('fieldName')}"]`); }; - const getSelected = function() { + const getSelected = function () { return getSelectedUserInputs() .map((index, input) => parseInt(input.value, 10)) .get(); }; - const checkMaxSelect = function() { + const checkMaxSelect = function () { const maxSelect = $dropdown.data('maxSelect'); if (maxSelect) { const selected = getSelected(); @@ -144,7 +144,7 @@ function UsersSelect(currentUser, els, options = {}) { } }; - const getMultiSelectDropdownTitle = function(selectedUser, isSelected) { + const getMultiSelectDropdownTitle = function (selectedUser, isSelected) { const selectedUsers = getSelected().filter(u => u !== 0); const firstUser = getSelectedUserInputs() @@ -201,7 +201,7 @@ function UsersSelect(currentUser, els, options = {}) { return assignTo(userSelect.currentUser.id); }); - assignTo = function(selected) { + assignTo = function (selected) { const data = {}; data[abilityName] = {}; data[abilityName].assignee_id = selected != null ? selected : null; @@ -694,7 +694,7 @@ function UsersSelect(currentUser, els, options = {}) { } } -UsersSelect.prototype.initSelection = function(element, callback) { +UsersSelect.prototype.initSelection = function (element, callback) { const id = $(element).val(); if (id === '0') { const nullUser = { @@ -706,7 +706,7 @@ UsersSelect.prototype.initSelection = function(element, callback) { } }; -UsersSelect.prototype.formatResult = function(user) { +UsersSelect.prototype.formatResult = function (user) { let avatar = gon.default_avatar_url; if (user.avatar_url) { avatar = user.avatar_url; @@ -728,11 +728,11 @@ UsersSelect.prototype.formatResult = function(user) { `; }; -UsersSelect.prototype.formatSelection = function(user) { +UsersSelect.prototype.formatSelection = function (user) { return escape(user.name); }; -UsersSelect.prototype.user = function(user_id, callback) { +UsersSelect.prototype.user = function (user_id, callback) { if (!/^\d+$/.test(user_id)) { return false; } @@ -746,7 +746,7 @@ UsersSelect.prototype.user = function(user_id, callback) { // Return users list. Filtered by query // Only active users retrieved -UsersSelect.prototype.users = function(query, options, callback) { +UsersSelect.prototype.users = function (query, options, callback) { const url = this.buildUrl(this.usersPath); const params = { search: query, @@ -755,8 +755,8 @@ UsersSelect.prototype.users = function(query, options, callback) { }; const isMergeRequest = options.issuableType === 'merge_request'; - const isEditMergeRequest = !options.issuableType && (options.iid && options.targetBranch); - const isNewMergeRequest = !options.issuableType && (!options.iid && options.targetBranch); + const isEditMergeRequest = !options.issuableType && options.iid && options.targetBranch; + const isNewMergeRequest = !options.issuableType && !options.iid && options.targetBranch; if (isMergeRequest || isEditMergeRequest || isNewMergeRequest) { params.merge_request_iid = options.iid || null; @@ -772,14 +772,14 @@ UsersSelect.prototype.users = function(query, options, callback) { }); }; -UsersSelect.prototype.buildUrl = function(url) { +UsersSelect.prototype.buildUrl = function (url) { if (gon.relative_url_root != null) { url = gon.relative_url_root.replace(/\/$/, '') + url; } return url; }; -UsersSelect.prototype.renderRow = function( +UsersSelect.prototype.renderRow = function ( issuableType, user, selected, @@ -815,7 +815,7 @@ UsersSelect.prototype.renderRow = function( `; }; -UsersSelect.prototype.renderRowAvatar = function(issuableType, user, img) { +UsersSelect.prototype.renderRowAvatar = function (issuableType, user, img) { if (user.beforeDivider) { return img; } @@ -831,7 +831,7 @@ UsersSelect.prototype.renderRowAvatar = function(issuableType, user, img) { </span>`; }; -UsersSelect.prototype.renderApprovalRules = function(elsClassName, approvalRules = []) { +UsersSelect.prototype.renderApprovalRules = function (elsClassName, approvalRules = []) { const count = approvalRules.length; if (!gon.features?.reviewerApprovalRules || !elsClassName?.includes('reviewer') || !count) { 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 9b2cd41092e..322444ce14b 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 @@ -145,7 +145,7 @@ export default { <template #metricsLink="{ content }"> <gl-link :href="metricsMonitoringUrl">{{ content }}</gl-link> </template> - <template #emphasis="{content}"> + <template #emphasis="{ content }"> <strong>{{ content }}</strong> </template> <template #memoryFrom>{{ memoryFrom }}</template> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue index 5066a88b52b..9db53ae97a7 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue @@ -142,7 +142,7 @@ export default { data-testid="ci-error-message" > <gl-sprintf :message="$options.errorText"> - <template #link="{content}"> + <template #link="{ content }"> <gl-link :href="mrTroubleshootingDocsPath">{{ content }}</gl-link> </template> </gl-sprintf> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue index a9d148505e1..7acdd695cc2 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue @@ -86,12 +86,12 @@ export default { to create one.`) " > - <template #prefixToLink="{content}"> + <template #prefixToLink="{ content }"> <strong> {{ content }} </strong> </template> - <template #addPipelineLink="{content}"> + <template #addPipelineLink="{ content }"> <gl-link :href="pipelinePath" class="gl-ml-1" 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 1d591168a17..322d4124935 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 @@ -113,10 +113,18 @@ export default { }, }, }) - .then(({ data: { mergeRequestSetWip: { mergeRequest: { title } } } }) => { - createFlash(__('The merge request can now be merged.'), 'notice'); - $('.merge-request .detail-page-description .title').text(title); - }) + .then( + ({ + data: { + mergeRequestSetWip: { + mergeRequest: { title }, + }, + }, + }) => { + createFlash(__('The merge request can now be merged.'), 'notice'); + $('.merge-request .detail-page-description .title').text(title); + }, + ) .catch(() => createFlash(__('Something went wrong. Please try again.'))) .finally(() => { this.isMakingRequest = false; 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 3f1f2144d8e..fc9a73f991c 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 @@ -166,7 +166,8 @@ export default { return ( !this.mr.canRemoveSourceBranch && this.mr.shouldRemoveSourceBranch && - (!this.mr.isNothingToMergeState && !this.mr.isMergedState) + !this.mr.isNothingToMergeState && + !this.mr.isMergedState ); }, shouldRenderCollaborationStatus() { diff --git a/app/assets/javascripts/vue_shared/components/content_viewer/viewers/download_viewer.vue b/app/assets/javascripts/vue_shared/components/content_viewer/viewers/download_viewer.vue index 8d55701f499..12078cdc16d 100644 --- a/app/assets/javascripts/vue_shared/components/content_viewer/viewers/download_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/content_viewer/viewers/download_viewer.vue @@ -39,9 +39,7 @@ export default { <div class="file-content"> <p class="gl-mt-3 file-info"> {{ fileName }} - <template v-if="fileSize > 0"> - ({{ fileSizeReadable }}) - </template> + <template v-if="fileSize > 0"> ({{ fileSizeReadable }}) </template> </p> <a :href="path" class="btn btn-default" rel="nofollow" :download="fileName" target="_blank"> <gl-icon :size="16" name="download" class="float-left gl-mr-3" /> diff --git a/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue b/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue index eb7e24734ce..4c3dd6cd229 100644 --- a/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/content_viewer/viewers/image_viewer.vue @@ -95,9 +95,7 @@ export default { <template v-if="hasFileSize"> {{ fileSizeReadable }} </template> - <template v-if="hasFileSize && hasDimensions"> - | - </template> + <template v-if="hasFileSize && hasDimensions"> | </template> <template v-if="hasDimensions"> <strong>{{ s__('ImageViewerDimensions|W') }}</strong >: {{ width }} | <strong>{{ s__('ImageViewerDimensions|H') }}</strong 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 c4bce860ae4..65768487e9b 100644 --- a/app/assets/javascripts/vue_shared/components/deprecated_modal_2.vue +++ b/app/assets/javascripts/vue_shared/components/deprecated_modal_2.vue @@ -46,14 +46,10 @@ export default { }, }, mounted() { - $(this.$el) - .on('shown.bs.modal', this.opened) - .on('hidden.bs.modal', this.closed); + $(this.$el).on('shown.bs.modal', this.opened).on('hidden.bs.modal', this.closed); }, beforeDestroy() { - $(this.$el) - .off('shown.bs.modal', this.opened) - .off('hidden.bs.modal', this.closed); + $(this.$el).off('shown.bs.modal', this.opened).off('hidden.bs.modal', this.closed); }, methods: { emitCancel(event) { diff --git a/app/assets/javascripts/vue_shared/components/file_icon/file_icon_map.js b/app/assets/javascripts/vue_shared/components/file_icon/file_icon_map.js index 91a0ac3aa92..f7cfb59be01 100644 --- a/app/assets/javascripts/vue_shared/components/file_icon/file_icon_map.js +++ b/app/assets/javascripts/vue_shared/components/file_icon/file_icon_map.js @@ -593,15 +593,6 @@ const fileNameIcons = { export default function getIconForFile(name) { return ( - fileNameIcons[name] || - fileExtensionIcons[ - name - ? name - .split('.') - .pop() - .toLowerCase() - : '' - ] || - '' + fileNameIcons[name] || fileExtensionIcons[name ? name.split('.').pop().toLowerCase() : ''] || '' ); } diff --git a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue index 5824cb9438f..15c5b9d6733 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue @@ -49,10 +49,10 @@ export default { ) " > - <template #markdownDocsLink="{content}"> + <template #markdownDocsLink="{ content }"> <gl-link :href="markdownDocsPath" target="_blank">{{ content }}</gl-link> </template> - <template #quickActionsDocsLink="{content}"> + <template #quickActionsDocsLink="{ content }"> <gl-link :href="quickActionsDocsPath" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> @@ -81,7 +81,7 @@ export default { ) " > - <template #retryButton="{content}"> + <template #retryButton="{ content }"> <gl-button variant="link" category="primary" @@ -90,7 +90,7 @@ export default { {{ content }} </gl-button> </template> - <template #newFileButton="{content}"> + <template #newFileButton="{ content }"> <gl-button variant="link" category="primary" diff --git a/app/assets/javascripts/vue_shared/components/notes/system_note.vue b/app/assets/javascripts/vue_shared/components/notes/system_note.vue index f30676e8ef3..cc1203f83f0 100644 --- a/app/assets/javascripts/vue_shared/components/notes/system_note.vue +++ b/app/assets/javascripts/vue_shared/components/notes/system_note.vue @@ -78,16 +78,10 @@ export default { }, // following 2 methods taken from code in `collapseLongCommitList` of notes.js: actionTextHtml() { - return $(this.note.note_html) - .unwrap() - .html(); + return $(this.note.note_html).unwrap().html(); }, hasMoreCommits() { - return ( - $(this.note.note_html) - .filter('ul') - .children().length > MAX_VISIBLE_COMMIT_LIST_COUNT - ); + return $(this.note.note_html).filter('ul').children().length > MAX_VISIBLE_COMMIT_LIST_COUNT; }, descriptionVersion() { return this.descriptionVersions[this.note.description_version_id]; 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 4d47a34c9a3..4d82a954ced 100644 --- a/app/assets/javascripts/vue_shared/components/registry/title_area.vue +++ b/app/assets/javascripts/vue_shared/components/registry/title_area.vue @@ -89,7 +89,7 @@ export default { data-testid="info-message" > <gl-sprintf :message="message.text"> - <template #docLink="{content}"> + <template #docLink="{ content }"> <gl-link :href="message.link" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue index 1ef3d5627ae..22d86ee25d1 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue @@ -143,7 +143,7 @@ export default { > <slot></slot> </dropdown-value> - <div v-if="canEdit" class="selectbox js-selectbox" style="display: none;"> + <div v-if="canEdit" class="selectbox js-selectbox" style="display: none"> <dropdown-hidden-input v-for="label in context.labels" :key="label.id" diff --git a/app/assets/javascripts/vue_shared/directives/validation.js b/app/assets/javascripts/vue_shared/directives/validation.js index 09bec78edcc..772c4b3a082 100644 --- a/app/assets/javascripts/vue_shared/directives/validation.js +++ b/app/assets/javascripts/vue_shared/directives/validation.js @@ -86,7 +86,7 @@ const createValidator = (context, feedbackMap) => ({ el, reportInvalidInput = fa * @param {Object<string, { message: string, isValid: ?function}>} customFeedbackMap * @returns {{ inserted: function, update: function }} validateDirective */ -export default function(customFeedbackMap = {}) { +export default function (customFeedbackMap = {}) { const feedbackMap = merge(defaultFeedbackMap, customFeedbackMap); const elDataMap = new WeakMap(); diff --git a/app/assets/javascripts/vue_shared/security_reports/components/security_summary.vue b/app/assets/javascripts/vue_shared/security_reports/components/security_summary.vue index babb9fddcf6..e3aa25a294e 100644 --- a/app/assets/javascripts/vue_shared/security_reports/components/security_summary.vue +++ b/app/assets/javascripts/vue_shared/security_reports/components/security_summary.vue @@ -34,13 +34,13 @@ export default { <template> <span> <gl-sprintf :message="message.message"> - <template #total="{content}"> + <template #total="{ content }"> <strong>{{ content }}</strong> </template> </gl-sprintf> <span v-if="shouldShowCountMessage" class="gl-font-sm"> <gl-sprintf :message="message.countMessage"> - <template v-for="slotName in $options.slotNames" #[slotName]="{content}"> + <template v-for="slotName in $options.slotNames" #[slotName]="{ content }"> <span :key="slotName"> <strong v-if="message[slotName] > 0" diff --git a/app/assets/javascripts/zen_mode.js b/app/assets/javascripts/zen_mode.js index ab0b0b02aa8..260ee972783 100644 --- a/app/assets/javascripts/zen_mode.js +++ b/app/assets/javascripts/zen_mode.js @@ -48,11 +48,7 @@ export default class ZenMode { return $(e.currentTarget).trigger('zen_mode:leave'); }); $(document).on('zen_mode:enter', e => { - this.enter( - $(e.target) - .closest('.md-area') - .find('.zen-backdrop'), - ); + this.enter($(e.target).closest('.md-area').find('.zen-backdrop')); }); $(document).on('zen_mode:leave', () => { this.exit(); diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index fcbe0b350a3..279d3faa110 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -1031,6 +1031,13 @@ module Ci variables.any? { |variable| variable[:key] == 'CI_DEBUG_TRACE' && variable[:value].casecmp('true') == 0 } end + def drop_with_exit_code!(failure_reason, exit_code) + transaction do + conditionally_allow_failure!(exit_code) + drop!(failure_reason) + end + end + protected def run_status_commit_hooks! @@ -1114,6 +1121,22 @@ module Ci Gitlab::ErrorTracking.track_exception(e) end end + + def conditionally_allow_failure!(exit_code) + return unless ::Gitlab::Ci::Features.allow_failure_with_exit_codes_enabled? + return unless exit_code + + if allowed_to_fail_with_code?(exit_code) + update_columns(allow_failure: true) + end + end + + def allowed_to_fail_with_code?(exit_code) + options + .dig(:allow_failure_criteria, :exit_codes) + .to_a + .include?(exit_code) + end end end diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 238e8f70778..3a1ae2c3ef6 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -438,6 +438,10 @@ class Namespace < ApplicationRecord end end + def root? + !has_parent? + end + private def all_projects_with_pages diff --git a/app/models/namespace_onboarding_action.rb b/app/models/namespace_onboarding_action.rb index 43dd872673c..2b0d6cad02d 100644 --- a/app/models/namespace_onboarding_action.rb +++ b/app/models/namespace_onboarding_action.rb @@ -10,9 +10,15 @@ class NamespaceOnboardingAction < ApplicationRecord git_write: 2, merge_request_created: 3, git_read: 4, + pipeline_created: 5, user_added: 6 }.freeze + # The monitoring window prevents the recording of a namespace_onboarding_action if a namespace is created before this + # time span. We are not interested in older namspaces, because the purpose of this table is to monitor and act on the + # progress of newly created namespaces or namespaces that already have at least one recorded action. + MONITORING_WINDOW = 90.days + enum action: ACTIONS class << self @@ -21,6 +27,9 @@ class NamespaceOnboardingAction < ApplicationRecord end def create_action(namespace, action) + return unless namespace.root? + return if namespace.created_at < MONITORING_WINDOW.ago && !namespace.namespace_onboarding_actions.exists? + NamespaceOnboardingAction.safe_find_or_create_by(namespace: namespace, action: action) end end diff --git a/app/models/snippet_repository.rb b/app/models/snippet_repository.rb index fa25a6f8441..54dbc579d54 100644 --- a/app/models/snippet_repository.rb +++ b/app/models/snippet_repository.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class SnippetRepository < ApplicationRecord + include EachBatch include Shardable DEFAULT_EMPTY_FILE_NAME = 'snippetfile' diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 64545e993a6..04f8f685fa6 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -84,6 +84,7 @@ module Ci if pipeline.persisted? schedule_head_pipeline_update record_conversion_event + create_namespace_onboarding_action end # If pipeline is not persisted, try to recover IID @@ -124,6 +125,10 @@ module Ci Experiments::RecordConversionEventWorker.perform_async(:pipelines_empty_state, current_user.id) end + def create_namespace_onboarding_action + Namespaces::OnboardingPipelineCreatedWorker.perform_async(project.namespace_id) + end + def extra_options(content: nil, dry_run: false) { content: content, dry_run: dry_run } end diff --git a/app/services/ci/update_build_state_service.rb b/app/services/ci/update_build_state_service.rb index f01d41d9414..874f4bf459a 100644 --- a/app/services/ci/update_build_state_service.rb +++ b/app/services/ci/update_build_state_service.rb @@ -111,7 +111,7 @@ module Ci Result.new(status: 200) when 'failed' - build.drop!(params[:failure_reason] || :unknown_failure) + build.drop_with_exit_code!(params[:failure_reason] || :unknown_failure, params[:exit_code]) Result.new(status: 200) else diff --git a/app/services/concerns/schedule_bulk_repository_shard_moves_methods.rb b/app/services/concerns/schedule_bulk_repository_shard_moves_methods.rb new file mode 100644 index 00000000000..eb03f3a9f3a --- /dev/null +++ b/app/services/concerns/schedule_bulk_repository_shard_moves_methods.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module ScheduleBulkRepositoryShardMovesMethods + extend ActiveSupport::Concern + include BaseServiceUtility + + class_methods do + def enqueue(source_storage_name, destination_storage_name = nil) + schedule_bulk_worker_klass.perform_async(source_storage_name, destination_storage_name) + end + + def schedule_bulk_worker_klass + raise NotImplementedError + end + end + + def execute(source_storage_name, destination_storage_name = nil) + shard = Shard.find_by_name!(source_storage_name) + + repository_klass.for_shard(shard).each_batch(column: container_column) do |relation| + container_klass.id_in(relation.select(container_column)).each do |container| + container.with_lock do + next if container.repository_storage != source_storage_name + + storage_move = container.repository_storage_moves.build( + source_storage_name: source_storage_name, + destination_storage_name: destination_storage_name + ) + + unless storage_move.schedule + log_info("Container #{container.full_path} (#{container.id}) was skipped: #{storage_move.errors.full_messages.to_sentence}") + end + end + end + end + + success + end + + private + + def repository_klass + raise NotImplementedError + end + + def container_klass + raise NotImplementedError + end + + def container_column + raise NotImplementedError + end +end diff --git a/app/services/onboarding_progress_service.rb b/app/services/onboarding_progress_service.rb index ebe7caabdef..fe00c96ed4c 100644 --- a/app/services/onboarding_progress_service.rb +++ b/app/services/onboarding_progress_service.rb @@ -2,10 +2,12 @@ class OnboardingProgressService def initialize(namespace) - @namespace = namespace.root_ancestor + @namespace = namespace&.root_ancestor end def execute(action:) + return unless @namespace + NamespaceOnboardingAction.create_action(@namespace, action) end end diff --git a/app/services/projects/schedule_bulk_repository_shard_moves_service.rb b/app/services/projects/schedule_bulk_repository_shard_moves_service.rb index dd49910207f..53de9abdb59 100644 --- a/app/services/projects/schedule_bulk_repository_shard_moves_service.rb +++ b/app/services/projects/schedule_bulk_repository_shard_moves_service.rb @@ -3,33 +3,29 @@ module Projects # Tries to schedule a move for every project with repositories on the source shard class ScheduleBulkRepositoryShardMovesService - include BaseServiceUtility + include ScheduleBulkRepositoryShardMovesMethods + extend ::Gitlab::Utils::Override - def execute(source_storage_name, destination_storage_name = nil) - shard = Shard.find_by_name!(source_storage_name) + private - ProjectRepository.for_shard(shard).each_batch(column: :project_id) do |relation| - Project.id_in(relation.select(:project_id)).each do |project| - project.with_lock do - next if project.repository_storage != source_storage_name - - storage_move = project.repository_storage_moves.build( - source_storage_name: source_storage_name, - destination_storage_name: destination_storage_name - ) + override :repository_klass + def repository_klass + ProjectRepository + end - unless storage_move.schedule - log_info("Project #{project.full_path} (#{project.id}) was skipped: #{storage_move.errors.full_messages.to_sentence}") - end - end - end - end + override :container_klass + def container_klass + Project + end - success + override :container_column + def container_column + :project_id end - def self.enqueue(source_storage_name, destination_storage_name = nil) - ::ProjectScheduleBulkRepositoryShardMovesWorker.perform_async(source_storage_name, destination_storage_name) + override :schedule_bulk_worker_klass + def self.schedule_bulk_worker_klass + ::ProjectScheduleBulkRepositoryShardMovesWorker end end end diff --git a/app/services/snippets/schedule_bulk_repository_shard_moves_service.rb b/app/services/snippets/schedule_bulk_repository_shard_moves_service.rb new file mode 100644 index 00000000000..f7bdd0a99a5 --- /dev/null +++ b/app/services/snippets/schedule_bulk_repository_shard_moves_service.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Snippets + # Tries to schedule a move for every snippet with repositories on the source shard + class ScheduleBulkRepositoryShardMovesService + include ScheduleBulkRepositoryShardMovesMethods + extend ::Gitlab::Utils::Override + + private + + override :repository_klass + def repository_klass + SnippetRepository + end + + override :container_klass + def container_klass + Snippet + end + + override :container_column + def container_column + :snippet_id + end + + override :schedule_bulk_worker_klass + def self.schedule_bulk_worker_klass + ::SnippetScheduleBulkRepositoryShardMovesWorker + end + end +end diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index e56e13360d7..888bc50cbbb 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1795,6 +1795,14 @@ :weight: 1 :idempotent: :tags: [] +- :name: namespaces_onboarding_pipeline_created + :feature_category: :subgroups + :has_external_dependencies: + :urgency: :low + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: namespaces_onboarding_user_added :feature_category: :users :has_external_dependencies: @@ -2103,6 +2111,14 @@ :weight: 1 :idempotent: :tags: [] +- :name: snippet_schedule_bulk_repository_shard_moves + :feature_category: :gitaly + :has_external_dependencies: + :urgency: :throttled + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: snippet_update_repository_storage :feature_category: :gitaly :has_external_dependencies: diff --git a/app/workers/namespaces/onboarding_pipeline_created_worker.rb b/app/workers/namespaces/onboarding_pipeline_created_worker.rb new file mode 100644 index 00000000000..e1de6d0046b --- /dev/null +++ b/app/workers/namespaces/onboarding_pipeline_created_worker.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Namespaces + class OnboardingPipelineCreatedWorker + include ApplicationWorker + + feature_category :subgroups + urgency :low + + deduplicate :until_executing + idempotent! + + def perform(namespace_id) + namespace = Namespace.find_by_id(namespace_id) + return unless namespace + + OnboardingProgressService.new(namespace).execute(action: :pipeline_created) + end + end +end diff --git a/app/workers/snippet_schedule_bulk_repository_shard_moves_worker.rb b/app/workers/snippet_schedule_bulk_repository_shard_moves_worker.rb new file mode 100644 index 00000000000..47f24ad3500 --- /dev/null +++ b/app/workers/snippet_schedule_bulk_repository_shard_moves_worker.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class SnippetScheduleBulkRepositoryShardMovesWorker + include ApplicationWorker + + idempotent! + feature_category :gitaly + urgency :throttled + + def perform(source_storage_name, destination_storage_name = nil) + Snippets::ScheduleBulkRepositoryShardMovesService.new.execute(source_storage_name, destination_storage_name) + end +end diff --git a/changelogs/unreleased/sh-cache-license-data.yml b/changelogs/unreleased/sh-cache-license-data.yml new file mode 100644 index 00000000000..b1683bdc0ee --- /dev/null +++ b/changelogs/unreleased/sh-cache-license-data.yml @@ -0,0 +1,5 @@ +--- +title: Cache license data in a process-memory cache +merge_request: 50318 +author: +type: performance diff --git a/config/helpers/vendor_dll_hash.js b/config/helpers/vendor_dll_hash.js index cfd7be66ad3..ca7b564a07c 100644 --- a/config/helpers/vendor_dll_hash.js +++ b/config/helpers/vendor_dll_hash.js @@ -11,11 +11,7 @@ const CACHE_PATHS = [ const resolvePath = file => path.resolve(__dirname, '../..', file); const readFile = file => fs.readFileSync(file); -const fileHash = buffer => - crypto - .createHash('md5') - .update(buffer) - .digest('hex'); +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 31fdd5bffd1..23afc437608 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -104,7 +104,7 @@ if (specFilters.length) { } // Karma configuration -module.exports = function(config) { +module.exports = function (config) { process.env.TZ = 'Etc/UTC'; const fixturesPath = `tmp/tests/frontend/fixtures${IS_EE ? '-ee' : ''}`; diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml index f38353e8eb6..b2da6ac93bc 100644 --- a/config/sidekiq_queues.yml +++ b/config/sidekiq_queues.yml @@ -200,6 +200,8 @@ - 1 - - namespaceless_project_destroy - 1 +- - namespaces_onboarding_pipeline_created + - 1 - - namespaces_onboarding_user_added - 1 - - new_epic @@ -320,6 +322,8 @@ - 1 - - set_user_status_based_on_user_cap_setting - 1 +- - snippet_schedule_bulk_repository_shard_moves + - 1 - - snippet_update_repository_storage - 1 - - status_page_publish diff --git a/config/webpack.config.js b/config/webpack.config.js index 42e27ea1668..62410cbb92a 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -344,7 +344,7 @@ module.exports = { // webpack-rails only needs assetsByChunkName to function properly new StatsWriterPlugin({ filename: 'manifest.json', - transform: function(data, opts) { + transform: function (data, opts) { const stats = opts.compiler.getStats().toJson({ chunkModules: false, source: false, diff --git a/doc/gitlab-basics/create-branch.md b/doc/gitlab-basics/create-branch.md index c971ff7cb52..3697ae34bf9 100644 --- a/doc/gitlab-basics/create-branch.md +++ b/doc/gitlab-basics/create-branch.md @@ -9,7 +9,7 @@ type: howto A branch is an independent line of development in a [project](../user/project/index.md). -When you create a new branch (in your [terminal](start-using-git.md) or with +When you create a new branch (in your [terminal](start-using-git.md#create-a-branch) or with [the web interface](../user/project/repository/web_editor.md#create-a-new-branch)), you are creating a snapshot of a certain branch, usually the main `master` branch, at its current state. From there, you can start to make your own changes without diff --git a/lib/api/ci/runner.rb b/lib/api/ci/runner.rb index 86e1a939df1..5cfb65e1fbb 100644 --- a/lib/api/ci/runner.rb +++ b/lib/api/ci/runner.rb @@ -180,6 +180,7 @@ module API optional :checksum, type: String, desc: %q(Job's trace CRC32 checksum) optional :bytesize, type: Integer, desc: %q(Job's trace size in bytes) end + optional :exit_code, type: Integer, desc: %q(Job's exit code) end put '/:id' do job = authenticate_job! diff --git a/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb b/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb index 33faa2ef1b0..62dfaeeaae3 100644 --- a/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb +++ b/lib/gitlab/database/postgres_hll/batch_distinct_counter.rb @@ -16,9 +16,9 @@ module Gitlab # Grouped relations are NOT supported yet. # # @example Usage - # ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project, :creator_id).estimate_distinct_count + # ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project, :creator_id).execute # ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project.with_active_services.service_desk_enabled.where(time_period)) - # .estimate_distinct_count( + # .execute( # batch_size: 1_000, # start: ::Project.with_active_services.service_desk_enabled.where(time_period).minimum(:id), # finish: ::Project.with_active_services.service_desk_enabled.where(time_period).maximum(:id) @@ -30,7 +30,6 @@ module Gitlab # for the most of a cases this value is lower. However, if the exact value is necessary other tools has to be used. class BatchDistinctCounter ERROR_RATE = 4.9 # max encountered empirical error rate, used in tests - FALLBACK = -1 MIN_REQUIRED_BATCH_SIZE = 750 SLEEP_TIME_IN_SECONDS = 0.01 # 10 msec sleep MAX_DATA_VOLUME = 4_000_000_000 @@ -38,8 +37,10 @@ module Gitlab # Each query should take < 500ms https://gitlab.com/gitlab-org/gitlab/-/merge_requests/22705 DEFAULT_BATCH_SIZE = 10_000 + ZERO_OFFSET = 1 + BUCKET_ID_MASK = (Buckets::TOTAL_BUCKETS - ZERO_OFFSET).to_s(2) BIT_31_MASK = "B'0#{'1' * 31}'" - BIT_9_MASK = "B'#{'0' * 23}#{'1' * 9}'" + BIT_32_NORMALIZED_BUCKET_ID_MASK = "B'#{'0' * (32 - BUCKET_ID_MASK.size)}#{BUCKET_ID_MASK}'" # @example source_query # SELECT CAST(('X' || md5(CAST(%{column} as text))) as bit(32)) attr_hash_32_bits # FROM %{relation} @@ -48,73 +49,58 @@ module Gitlab # AND %{column} IS NOT NULL BUCKETED_DATA_SQL = <<~SQL WITH hashed_attributes AS (%{source_query}) - SELECT (attr_hash_32_bits & #{BIT_9_MASK})::int AS bucket_num, + SELECT (attr_hash_32_bits & #{BIT_32_NORMALIZED_BUCKET_ID_MASK})::int AS bucket_num, (31 - floor(log(2, min((attr_hash_32_bits & #{BIT_31_MASK})::int))))::int as bucket_hash FROM hashed_attributes GROUP BY 1 SQL - TOTAL_BUCKETS_NUMBER = 512 + WRONG_CONFIGURATION_ERROR = Class.new(ActiveRecord::StatementInvalid) def initialize(relation, column = nil) @relation = relation @column = column || relation.primary_key end - def unwanted_configuration?(finish, batch_size, start) - batch_size <= MIN_REQUIRED_BATCH_SIZE || - (finish - start) >= MAX_DATA_VOLUME || - start > finish - end - - def estimate_distinct_count(batch_size: nil, start: nil, finish: nil) + # Executes counter that iterates over database source and return Gitlab::Database::PostgresHll::Buckets + # that can be used to estimation of number of uniq elements in analysed set + # + # @param batch_size maximal number of rows that will be analysed by single database query + # @param start initial pkey range + # @param finish final pkey range + # @return [Gitlab::Database::PostgresHll::Buckets] HyperLogLog data structure instance that can estimate number of unique elements + def execute(batch_size: nil, start: nil, finish: nil) raise 'BatchCount can not be run inside a transaction' if ActiveRecord::Base.connection.transaction_open? batch_size ||= DEFAULT_BATCH_SIZE - start = actual_start(start) finish = actual_finish(finish) - raise "Batch counting expects positive values only for #{@column}" if start < 0 || finish < 0 - return FALLBACK if unwanted_configuration?(finish, batch_size, start) + raise WRONG_CONFIGURATION_ERROR if unwanted_configuration?(start, finish, batch_size) batch_start = start - hll_blob = {} + hll_buckets = Buckets.new while batch_start <= finish begin - hll_blob.merge!(hll_blob_for_batch(batch_start, batch_start + batch_size)) {|_key, old, new| new > old ? new : old } + hll_buckets.merge_hash!(hll_buckets_for_batch(batch_start, batch_start + batch_size)) batch_start += batch_size end sleep(SLEEP_TIME_IN_SECONDS) end - estimate_cardinality(hll_blob) + hll_buckets end private - # arbitrary values that are present in #estimate_cardinality - # are sourced from https://www.sisense.com/blog/hyperloglog-in-pure-sql/ - # article, they are not representing any entity and serves as tune value - # for the whole equation - def estimate_cardinality(hll_blob) - num_zero_buckets = TOTAL_BUCKETS_NUMBER - hll_blob.size - - num_uniques = ( - ((TOTAL_BUCKETS_NUMBER**2) * (0.7213 / (1 + 1.079 / TOTAL_BUCKETS_NUMBER))) / - (num_zero_buckets + hll_blob.values.sum { |bucket_hash| 2**(-1 * bucket_hash)} ) - ).to_i - - if num_zero_buckets > 0 && num_uniques < 2.5 * TOTAL_BUCKETS_NUMBER - ((0.7213 / (1 + 1.079 / TOTAL_BUCKETS_NUMBER)) * (TOTAL_BUCKETS_NUMBER * - Math.log2(TOTAL_BUCKETS_NUMBER.to_f / num_zero_buckets))) - else - num_uniques - end + def unwanted_configuration?(start, finish, batch_size) + batch_size <= MIN_REQUIRED_BATCH_SIZE || + (finish - start) >= MAX_DATA_VOLUME || + start > finish || start < 0 || finish < 0 end - def hll_blob_for_batch(start, finish) + def hll_buckets_for_batch(start, finish) @relation .connection .execute(BUCKETED_DATA_SQL % { source_query: source_query(start, finish) }) diff --git a/lib/gitlab/database/postgres_hll/buckets.rb b/lib/gitlab/database/postgres_hll/buckets.rb new file mode 100644 index 00000000000..429e823379f --- /dev/null +++ b/lib/gitlab/database/postgres_hll/buckets.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module Gitlab + module Database + module PostgresHll + # Bucket class represent data structure build with HyperLogLog algorithm + # that models data distribution in analysed set. This representation than can be used + # for following purposes + # 1. Estimating number of unique elements that this structure represents + # 2. Merging with other Buckets structure to later estimate number of unique elements in sum of two + # represented data sets + # 3. Serializing Buckets structure to json format, that can be stored in various persistence layers + # + # @example Usage + # ::Gitlab::Database::PostgresHll::Buckets.new(141 => 1, 56 => 1).estimated_distinct_count + # ::Gitlab::Database::PostgresHll::Buckets.new(141 => 1, 56 => 1).merge_hash!(141 => 1, 56 => 5).estimated_distinct_count + # ::Gitlab::Database::PostgresHll::Buckets.new(141 => 1, 56 => 1).to_json + + # @note HyperLogLog is an PROBABILISTIC algorithm that ESTIMATES distinct count of given attribute value for supplied relation + # Like all probabilistic algorithm is has ERROR RATE margin, that can affect values, + # for given implementation no higher value was reported (https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45673#accuracy-estimation) than 5.3% + # for the most of a cases this value is lower. However, if the exact value is necessary other tools has to be used. + class Buckets + TOTAL_BUCKETS = 512 + + def initialize(buckets = {}) + @buckets = buckets + end + + # Based on HyperLogLog structure estimates number of unique elements in analysed set. + # + # @return [Float] Estimate number of unique elements + def estimated_distinct_count + @estimated_distinct_count ||= estimate_cardinality + end + + # Updates instance underlying HyperLogLog structure by merging it with other HyperLogLog structure + # + # @param other_buckets_hash hash with HyperLogLog structure representation + def merge_hash!(other_buckets_hash) + buckets.merge!(other_buckets_hash) {|_key, old, new| new > old ? new : old } + end + + # Serialize instance underlying HyperLogLog structure to JSON format, that can be stored in various persistence layers + # + # @return [String] HyperLogLog data structure serialized to JSON + def to_json(_ = nil) + buckets.to_json + end + + private + + attr_accessor :buckets + + # arbitrary values that are present in #estimate_cardinality + # are sourced from https://www.sisense.com/blog/hyperloglog-in-pure-sql/ + # article, they are not representing any entity and serves as tune value + # for the whole equation + def estimate_cardinality + num_zero_buckets = TOTAL_BUCKETS - buckets.size + + num_uniques = ( + ((TOTAL_BUCKETS**2) * (0.7213 / (1 + 1.079 / TOTAL_BUCKETS))) / + (num_zero_buckets + buckets.values.sum { |bucket_hash| 2**(-1 * bucket_hash)} ) + ).to_i + + if num_zero_buckets > 0 && num_uniques < 2.5 * TOTAL_BUCKETS + ((0.7213 / (1 + 1.079 / TOTAL_BUCKETS)) * (TOTAL_BUCKETS * + Math.log2(TOTAL_BUCKETS.to_f / num_zero_buckets))) + else + num_uniques + end + end + end + end + end +end diff --git a/lib/gitlab/utils/usage_data.rb b/lib/gitlab/utils/usage_data.rb index 0d28a1cd035..261fc6fbdbd 100644 --- a/lib/gitlab/utils/usage_data.rb +++ b/lib/gitlab/utils/usage_data.rb @@ -61,7 +61,10 @@ module Gitlab end def estimate_batch_distinct_count(relation, column = nil, batch_size: nil, start: nil, finish: nil) - Gitlab::Database::PostgresHll::BatchDistinctCounter.new(relation, column).estimate_distinct_count(batch_size: batch_size, start: start, finish: finish) + Gitlab::Database::PostgresHll::BatchDistinctCounter + .new(relation, column) + .execute(batch_size: batch_size, start: start, finish: finish) + .estimated_distinct_count rescue ActiveRecord::StatementInvalid FALLBACK # catch all rescue should be removed as a part of feature flag rollout issue diff --git a/package.json b/package.json index 44464389a2a..164100c864f 100644 --- a/package.json +++ b/package.json @@ -208,7 +208,7 @@ "nodemon": "^2.0.4", "pixelmatch": "^4.0.2", "postcss": "^7.0.14", - "prettier": "1.18.2", + "prettier": "2.2.1", "readdir-enhanced": "^2.2.4", "stylelint": "^10.1.0", "stylelint-config-recommended": "^2.2.0", diff --git a/scripts/frontend/frontend_script_utils.js b/scripts/frontend/frontend_script_utils.js index e3d357b4a40..5614737d278 100644 --- a/scripts/frontend/frontend_script_utils.js +++ b/scripts/frontend/frontend_script_utils.js @@ -9,12 +9,7 @@ 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 => { diff --git a/scripts/frontend/prettier.js b/scripts/frontend/prettier.js index 7772f80c233..b55822505c3 100644 --- a/scripts/frontend/prettier.js +++ b/scripts/frontend/prettier.js @@ -11,7 +11,7 @@ const globIgnore = ['**/node_modules/**', 'vendor/**', 'public/**']; const readFileAsync = (file, options) => new Promise((resolve, reject) => { - fs.readFile(file, options, function(err, data) { + fs.readFile(file, options, function (err, data) { if (err) reject(err); else resolve(data); }); @@ -19,7 +19,7 @@ const readFileAsync = (file, options) => const writeFileAsync = (file, data, options) => new Promise((resolve, reject) => { - fs.writeFile(file, data, options, function(err) { + fs.writeFile(file, data, options, function (err) { if (err) reject(err); else resolve(); }); diff --git a/scripts/frontend/stylelint/stylelint-duplicate-selectors.js b/scripts/frontend/stylelint/stylelint-duplicate-selectors.js index 4b46ee21a7a..89242158157 100644 --- a/scripts/frontend/stylelint/stylelint-duplicate-selectors.js +++ b/scripts/frontend/stylelint/stylelint-duplicate-selectors.js @@ -8,12 +8,12 @@ const messages = stylelint.utils.ruleMessages(ruleName, { }, }); -module.exports = stylelint.createPlugin(ruleName, function(enabled) { +module.exports = stylelint.createPlugin(ruleName, function (enabled) { if (!enabled) { return; } - return function(root, result) { + return function (root, result) { const selectorGroups = {}; utils.createPropertiesHashmap(root, result, ruleName, messages, selectorGroups, true); }; diff --git a/scripts/frontend/stylelint/stylelint-utility-classes.js b/scripts/frontend/stylelint/stylelint-utility-classes.js index 8a1cfdbf302..1b266fc31c9 100644 --- a/scripts/frontend/stylelint/stylelint-utility-classes.js +++ b/scripts/frontend/stylelint/stylelint-utility-classes.js @@ -10,12 +10,12 @@ const messages = stylelint.utils.ruleMessages(ruleName, { }, }); -module.exports = stylelint.createPlugin(ruleName, function(enabled) { +module.exports = stylelint.createPlugin(ruleName, function (enabled) { if (!enabled) { return; } - return function(root, result) { + return function (root, result) { utils.createPropertiesHashmap(root, result, ruleName, messages, utilityClasses, false); }; }); diff --git a/scripts/frontend/stylelint/stylelint-utility-map.js b/scripts/frontend/stylelint/stylelint-utility-map.js index 941198e82a4..cc555fb6d2a 100644 --- a/scripts/frontend/stylelint/stylelint-utility-map.js +++ b/scripts/frontend/stylelint/stylelint-utility-map.js @@ -42,7 +42,7 @@ sass.render( prettierOptions, ); - fs.writeFile(hashMapPath, prettyHashmap, function(err) { + fs.writeFile(hashMapPath, prettyHashmap, function (err) { if (err) { return console.log(err); } diff --git a/scripts/frontend/stylelint/stylelint-utils.js b/scripts/frontend/stylelint/stylelint-utils.js index 2d931c1c4c2..09b75bb1d63 100644 --- a/scripts/frontend/stylelint/stylelint-utils.js +++ b/scripts/frontend/stylelint/stylelint-utils.js @@ -25,7 +25,7 @@ module.exports.createPropertiesHashmap = ( ) ) { let cssArray = []; - rule.nodes.forEach(function(property) { + rule.nodes.forEach(function (property) { const { prop, value } = property; if (property && value) { const propval = `${prop}${value}${property.important ? '!important' : ''}`; diff --git a/scripts/frontend/webpack_dev_server.js b/scripts/frontend/webpack_dev_server.js index 8026a8d47e2..fbb80c9617d 100755 --- a/scripts/frontend/webpack_dev_server.js +++ b/scripts/frontend/webpack_dev_server.js @@ -51,7 +51,7 @@ else { // print useful messages for nodemon events nodemon - .on('start', function() { + .on('start', function () { console.log(`Starting webpack webserver on http://${DEV_SERVER_HOST}:${DEV_SERVER_PORT}`); if (STATIC_MODE) { console.log('You are starting webpack in compile-once mode'); @@ -59,10 +59,10 @@ nodemon console.log('If you change them often, you might want to unset DEV_SERVER_STATIC'); } }) - .on('quit', function() { + .on('quit', function () { console.log('Shutting down webpack process'); process.exit(); }) - .on('restart', function(files) { + .on('restart', function (files) { console.log('Restarting webpack process due to: ', files); }); diff --git a/spec/frontend/activities_spec.js b/spec/frontend/activities_spec.js index d14be3a1f26..5033cabcf37 100644 --- a/spec/frontend/activities_spec.js +++ b/spec/frontend/activities_spec.js @@ -56,11 +56,7 @@ describe('Activities', () => { const testName = shouldHighlight ? 'should highlight' : 'should not highlight'; it(`${testName} ${getEventName(x)}`, () => { - expect( - $(getSelector(x)) - .parent() - .hasClass('active'), - ).toEqual(shouldHighlight); + expect($(getSelector(x)).parent().hasClass('active')).toEqual(shouldHighlight); }); })(x); } diff --git a/spec/frontend/alert_management/components/alert_management_table_spec.js b/spec/frontend/alert_management/components/alert_management_table_spec.js index f7a629142f9..0cc3d565e10 100644 --- a/spec/frontend/alert_management/components/alert_management_table_spec.js +++ b/spec/frontend/alert_management/components/alert_management_table_spec.js @@ -85,11 +85,7 @@ describe('AlertManagementTable', () => { }); expect(findAlertsTable().exists()).toBe(true); expect(findLoader().exists()).toBe(true); - expect( - findAlerts() - .at(0) - .classes(), - ).not.toContain('gl-hover-bg-blue-50'); + expect(findAlerts().at(0).classes()).not.toContain('gl-hover-bg-blue-50'); }); it('error state', () => { @@ -101,11 +97,7 @@ describe('AlertManagementTable', () => { expect(findAlertsTable().text()).toContain('No alerts to display'); expect(findLoader().exists()).toBe(false); expect(findAlert().props().variant).toBe('danger'); - expect( - findAlerts() - .at(0) - .classes(), - ).not.toContain('gl-hover-bg-blue-50'); + expect(findAlerts().at(0).classes()).not.toContain('gl-hover-bg-blue-50'); }); it('empty state', () => { @@ -125,11 +117,7 @@ describe('AlertManagementTable', () => { expect(findAlertsTable().text()).toContain('No alerts to display'); expect(findLoader().exists()).toBe(false); expect(findAlert().props().variant).toBe('info'); - expect( - findAlerts() - .at(0) - .classes(), - ).not.toContain('gl-hover-bg-blue-50'); + expect(findAlerts().at(0).classes()).not.toContain('gl-hover-bg-blue-50'); }); it('has data state', () => { @@ -140,11 +128,7 @@ describe('AlertManagementTable', () => { expect(findLoader().exists()).toBe(false); expect(findAlertsTable().exists()).toBe(true); expect(findAlerts()).toHaveLength(mockAlerts.length); - expect( - findAlerts() - .at(0) - .classes(), - ).toContain('gl-hover-bg-blue-50'); + expect(findAlerts().at(0).classes()).toContain('gl-hover-bg-blue-50'); }); it('displays the alert ID and title formatted correctly', () => { @@ -170,11 +154,7 @@ describe('AlertManagementTable', () => { data: { alerts: { list: mockAlerts }, alertsCount, errored: false }, loading: false, }); - expect( - findStatusDropdown() - .find('.dropdown-title') - .exists(), - ).toBe(false); + expect(findStatusDropdown().find('.dropdown-title').exists()).toBe(false); }); it('shows correct severity icons', async () => { @@ -186,11 +166,7 @@ describe('AlertManagementTable', () => { await wrapper.vm.$nextTick(); expect(wrapper.find(GlTable).exists()).toBe(true); - expect( - findAlertsTable() - .find(GlIcon) - .classes('icon-critical'), - ).toBe(true); + expect(findAlertsTable().find(GlIcon).classes('icon-critical')).toBe(true); }); it('renders severity text', () => { @@ -199,11 +175,7 @@ describe('AlertManagementTable', () => { loading: false, }); - expect( - findSeverityFields() - .at(0) - .text(), - ).toBe('Critical'); + expect(findSeverityFields().at(0).text()).toBe('Critical'); }); it('renders Unassigned when no assignee(s) present', () => { @@ -212,11 +184,7 @@ describe('AlertManagementTable', () => { loading: false, }); - expect( - findAssignees() - .at(0) - .text(), - ).toBe('Unassigned'); + expect(findAssignees().at(0).text()).toBe('Unassigned'); }); it('renders user avatar when assignee present', () => { @@ -225,9 +193,7 @@ describe('AlertManagementTable', () => { loading: false, }); - const avatar = findAssignees() - .at(1) - .find(GlAvatar); + const avatar = findAssignees().at(1).find(GlAvatar); const { src, label } = avatar.attributes(); const { name, avatarUrl } = mockAlerts[1].assignees.nodes[0]; @@ -244,9 +210,7 @@ describe('AlertManagementTable', () => { expect(visitUrl).not.toHaveBeenCalled(); - findAlerts() - .at(0) - .trigger('click'); + findAlerts().at(0).trigger('click'); expect(visitUrl).toHaveBeenCalledWith('/1527542/details', false); }); @@ -258,11 +222,9 @@ describe('AlertManagementTable', () => { expect(visitUrl).not.toHaveBeenCalled(); - findAlerts() - .at(0) - .trigger('click', { - metaKey: true, - }); + findAlerts().at(0).trigger('click', { + metaKey: true, + }); expect(visitUrl).toHaveBeenCalledWith('/1527542/details', true); }); @@ -276,24 +238,12 @@ describe('AlertManagementTable', () => { }); it('shows "None" when no link exists', () => { - expect( - findIssueFields() - .at(0) - .text(), - ).toBe('None'); + expect(findIssueFields().at(0).text()).toBe('None'); }); it('renders a link when one exists', () => { - expect( - findIssueFields() - .at(1) - .text(), - ).toBe('#1'); - expect( - findIssueFields() - .at(1) - .attributes('href'), - ).toBe('/gitlab-org/gitlab/-/issues/1'); + expect(findIssueFields().at(1).text()).toBe('#1'); + expect(findIssueFields().at(1).attributes('href')).toBe('/gitlab-org/gitlab/-/issues/1'); }); }); @@ -350,11 +300,7 @@ describe('AlertManagementTable', () => { loading: false, }); - expect( - findAlerts() - .at(0) - .classes(), - ).toContain('new-alert'); + expect(findAlerts().at(0).classes()).toContain('new-alert'); }); it('should not highlight the row when alert is not new', () => { @@ -363,11 +309,7 @@ describe('AlertManagementTable', () => { loading: false, }); - expect( - findAlerts() - .at(0) - .classes(), - ).not.toContain('new-alert'); + expect(findAlerts().at(0).classes()).not.toContain('new-alert'); }); }); }); diff --git a/spec/frontend/alert_management/components/sidebar/alert_managment_sidebar_assignees_spec.js b/spec/frontend/alert_management/components/sidebar/alert_managment_sidebar_assignees_spec.js index 6430273ec59..00c479071fe 100644 --- a/spec/frontend/alert_management/components/sidebar/alert_managment_sidebar_assignees_spec.js +++ b/spec/frontend/alert_management/components/sidebar/alert_managment_sidebar_assignees_spec.js @@ -165,21 +165,9 @@ describe('Alert Details Sidebar Assignees', () => { }, }); - expect( - findAssigned() - .find('img') - .attributes('src'), - ).toBe('/url'); - expect( - findAssigned() - .find('.dropdown-menu-user-full-name') - .text(), - ).toBe('root'); - expect( - findAssigned() - .find('.dropdown-menu-user-username') - .text(), - ).toBe('@root'); + expect(findAssigned().find('img').attributes('src')).toBe('/url'); + expect(findAssigned().find('.dropdown-menu-user-full-name').text()).toBe('root'); + expect(findAssigned().find('.dropdown-menu-user-username').text()).toBe('@root'); }); }); }); diff --git a/spec/frontend/alerts_settings/alert_mapping_builder_spec.js b/spec/frontend/alerts_settings/alert_mapping_builder_spec.js index 12536c27dfe..5acf0f050ae 100644 --- a/spec/frontend/alerts_settings/alert_mapping_builder_spec.js +++ b/spec/frontend/alerts_settings/alert_mapping_builder_spec.js @@ -28,11 +28,7 @@ describe('AlertMappingBuilder', () => { }); const findColumnInRow = (row, column) => - wrapper - .findAll('.gl-display-table-row') - .at(row) - .findAll('.gl-display-table-cell ') - .at(column); + wrapper.findAll('.gl-display-table-row').at(row).findAll('.gl-display-table-cell ').at(column); it('renders column captions', () => { expect(findColumnInRow(0, 0).text()).toContain(i18n.columns.gitlabKeyTitle); diff --git a/spec/frontend/alerts_settings/alerts_integrations_list_spec.js b/spec/frontend/alerts_settings/alerts_integrations_list_spec.js index 3a7392f64f7..5a3874d055b 100644 --- a/spec/frontend/alerts_settings/alerts_integrations_list_spec.js +++ b/spec/frontend/alerts_settings/alerts_integrations_list_spec.js @@ -72,11 +72,7 @@ describe('AlertIntegrationsList', () => { it('renders an highlighted row when a current integration is selected to edit', () => { mountComponent({ data: { currentIntegration: { id: '1' } } }); - expect( - findTableComponentRows() - .at(0) - .classes(), - ).toContain('gl-bg-blue-50'); + expect(findTableComponentRows().at(0).classes()).toContain('gl-bg-blue-50'); }); describe('integration status', () => { diff --git a/spec/frontend/alerts_settings/alerts_settings_form_spec.js b/spec/frontend/alerts_settings/alerts_settings_form_spec.js index 428c6f93444..af0999a997f 100644 --- a/spec/frontend/alerts_settings/alerts_settings_form_spec.js +++ b/spec/frontend/alerts_settings/alerts_settings_form_spec.js @@ -86,11 +86,7 @@ describe('AlertsSettingsFormNew', () => { await wrapper.vm.$nextTick(); - expect( - findFormFields() - .at(0) - .isVisible(), - ).toBe(true); + expect(findFormFields().at(0).isVisible()).toBe(true); }); it('disables the dropdown and shows help text when multi integrations are not supported', async () => { @@ -104,11 +100,7 @@ describe('AlertsSettingsFormNew', () => { const options = findSelect().findAll('option'); await options.at(2).setSelected(); - expect( - findFormFields() - .at(0) - .attributes('disabled'), - ).toBe('disabled'); + expect(findFormFields().at(0).attributes('disabled')).toBe('disabled'); }); }); @@ -119,9 +111,7 @@ describe('AlertsSettingsFormNew', () => { const options = findSelect().findAll('option'); await options.at(1).setSelected(); - await findFormFields() - .at(0) - .setValue('Test integration'); + await findFormFields().at(0).setValue('Test integration'); await findFormToggle().trigger('click'); await wrapper.vm.$nextTick(); @@ -145,12 +135,8 @@ describe('AlertsSettingsFormNew', () => { const options = findSelect().findAll('option'); await options.at(2).setSelected(); - await findFormFields() - .at(0) - .setValue('Test integration'); - await findFormFields() - .at(1) - .setValue('https://test.com'); + await findFormFields().at(0).setValue('Test integration'); + await findFormFields().at(1).setValue('https://test.com'); await findFormToggle().trigger('click'); await wrapper.vm.$nextTick(); @@ -179,9 +165,7 @@ describe('AlertsSettingsFormNew', () => { }, }); - await findFormFields() - .at(0) - .setValue('Test integration post'); + await findFormFields().at(0).setValue('Test integration post'); await findFormToggle().trigger('click'); await wrapper.vm.$nextTick(); @@ -210,12 +194,8 @@ describe('AlertsSettingsFormNew', () => { }, }); - await findFormFields() - .at(0) - .setValue('Test integration'); - await findFormFields() - .at(1) - .setValue('https://test-post.com'); + await findFormFields().at(0).setValue('Test integration'); + await findFormFields().at(1).setValue('https://test-post.com'); await findFormToggle().trigger('click'); await wrapper.vm.$nextTick(); @@ -300,11 +280,7 @@ describe('AlertsSettingsFormNew', () => { resetSamplePayloadConfirmed, }); await wrapper.vm.$nextTick(); - expect( - findTestPayloadSection() - .find(GlFormTextarea) - .attributes('disabled'), - ).toBe(disabled); + expect(findTestPayloadSection().find(GlFormTextarea).attributes('disabled')).toBe(disabled); }); }); diff --git a/spec/frontend/authentication/u2f/authenticate_spec.js b/spec/frontend/authentication/u2f/authenticate_spec.js index 7a87b420195..427e2cef00c 100644 --- a/spec/frontend/authentication/u2f/authenticate_spec.js +++ b/spec/frontend/authentication/u2f/authenticate_spec.js @@ -55,10 +55,7 @@ describe('U2FAuthenticate', () => { jest.spyOn(component, 'renderAuthenticated').mockReturnValue(true); u2fDevice = new MockU2FDevice(); - component - .start() - .then(done) - .catch(done.fail); + component.start().then(done).catch(done.fail); }); it('allows authenticating via a U2F device', () => { diff --git a/spec/frontend/authentication/u2f/register_spec.js b/spec/frontend/authentication/u2f/register_spec.js index e89ef773be6..1c2e7c45a23 100644 --- a/spec/frontend/authentication/u2f/register_spec.js +++ b/spec/frontend/authentication/u2f/register_spec.js @@ -15,10 +15,7 @@ describe('U2FRegister', () => { u2fDevice = new MockU2FDevice(); container = $('#js-register-token-2fa'); component = new U2FRegister(container, {}); - component - .start() - .then(done) - .catch(done.fail); + component.start().then(done).catch(done.fail); }); it('allows registering a U2F device', () => { diff --git a/spec/frontend/awards_handler_spec.js b/spec/frontend/awards_handler_spec.js index c6a9c911ccf..2462026be0f 100644 --- a/spec/frontend/awards_handler_spec.js +++ b/spec/frontend/awards_handler_spec.js @@ -57,9 +57,7 @@ describe('AwardsHandler', () => { preloadFixtures('snippets/show.html'); const openAndWaitForEmojiMenu = (sel = '.js-add-award') => { - $(sel) - .eq(0) - .click(); + $(sel).eq(0).click(); jest.runOnlyPendingTimers(); @@ -337,9 +335,7 @@ describe('AwardsHandler', () => { it('should remove already selected emoji', async () => { await openEmojiMenuAndAddEmoji(); - $('.js-add-award') - .eq(0) - .click(); + $('.js-add-award').eq(0).click(); const $block = $('.js-awards-block'); const $emoji = $('.emoji-menu').find( `.emoji-menu-list:not(.frequent-emojis) ${emojiSelector}`, diff --git a/spec/frontend/badges/components/badge_list_row_spec.js b/spec/frontend/badges/components/badge_list_row_spec.js index 31f0d850857..32898abb4f7 100644 --- a/spec/frontend/badges/components/badge_list_row_spec.js +++ b/spec/frontend/badges/components/badge_list_row_spec.js @@ -91,9 +91,7 @@ describe('BadgeListRow component', () => { beforeEach(done => { badge.kind = GROUP_BADGE; - Vue.nextTick() - .then(done) - .catch(done.fail); + Vue.nextTick().then(done).catch(done.fail); }); it('renders the badge kind', () => { diff --git a/spec/frontend/badges/components/badge_list_spec.js b/spec/frontend/badges/components/badge_list_spec.js index 5ffc046eb97..4b61fc6658a 100644 --- a/spec/frontend/badges/components/badge_list_spec.js +++ b/spec/frontend/badges/components/badge_list_spec.js @@ -76,9 +76,7 @@ describe('BadgeList component', () => { beforeEach(done => { store.state.kind = GROUP_BADGE; - Vue.nextTick() - .then(done) - .catch(done.fail); + Vue.nextTick().then(done).catch(done.fail); }); it('renders a message if no badges exist', done => { diff --git a/spec/frontend/badges/store/actions_spec.js b/spec/frontend/badges/store/actions_spec.js index 921c21cb55e..365520d709c 100644 --- a/spec/frontend/badges/store/actions_spec.js +++ b/spec/frontend/badges/store/actions_spec.js @@ -9,7 +9,10 @@ import { createDummyBadge, createDummyBadgeResponse } from '../dummy_badge'; describe('Badges store actions', () => { const dummyEndpointUrl = `${TEST_HOST}/badges/endpoint`; - const dummyBadges = [{ ...createDummyBadge(), id: 5 }, { ...createDummyBadge(), id: 6 }]; + const dummyBadges = [ + { ...createDummyBadge(), id: 5 }, + { ...createDummyBadge(), id: 6 }, + ]; let axiosMock; let badgeId; diff --git a/spec/frontend/batch_comments/components/diff_file_drafts_spec.js b/spec/frontend/batch_comments/components/diff_file_drafts_spec.js index 6e0b61db9fa..dcb68b1804f 100644 --- a/spec/frontend/batch_comments/components/diff_file_drafts_spec.js +++ b/spec/frontend/batch_comments/components/diff_file_drafts_spec.js @@ -44,18 +44,8 @@ describe('Batch comments diff file drafts component', () => { expect(vm.findAll('.js-diff-notes-index').length).toEqual(2); - expect( - vm - .findAll('.js-diff-notes-index') - .at(0) - .text(), - ).toEqual('1'); - - expect( - vm - .findAll('.js-diff-notes-index') - .at(1) - .text(), - ).toEqual('2'); + expect(vm.findAll('.js-diff-notes-index').at(0).text()).toEqual('1'); + + expect(vm.findAll('.js-diff-notes-index').at(1).text()).toEqual('2'); }); }); diff --git a/spec/frontend/behaviors/requires_input_spec.js b/spec/frontend/behaviors/requires_input_spec.js index 617fe49b059..0f27f89d6dc 100644 --- a/spec/frontend/behaviors/requires_input_spec.js +++ b/spec/frontend/behaviors/requires_input_spec.js @@ -32,30 +32,18 @@ describe('requiresInput', () => { it('enables submit when all required fields receive input', () => { $('.js-requires-input').requiresInput(); - $('#required1') - .val('input1') - .change(); + $('#required1').val('input1').change(); expect(submitButton).toBeDisabled(); - $('#optional1') - .val('input1') - .change(); + $('#optional1').val('input1').change(); expect(submitButton).toBeDisabled(); - $('#required2') - .val('input2') - .change(); - $('#required3') - .val('input3') - .change(); - $('#required4') - .val('input4') - .change(); - $('#required5') - .val('1') - .change(); + $('#required2').val('input2').change(); + $('#required3').val('input3').change(); + $('#required4').val('input4').change(); + $('#required5').val('1').change(); expect($('.submit')).not.toBeDisabled(); }); diff --git a/spec/frontend/blob/components/blob_header_filepath_spec.js b/spec/frontend/blob/components/blob_header_filepath_spec.js index 067a4ae61a0..7b8b5050486 100644 --- a/spec/frontend/blob/components/blob_header_filepath_spec.js +++ b/spec/frontend/blob/components/blob_header_filepath_spec.js @@ -32,12 +32,7 @@ describe('Blob Header Filepath', () => { it('renders regular name', () => { createComponent(); - expect( - wrapper - .find('.js-blob-header-filepath') - .text() - .trim(), - ).toBe(MockBlob.path); + expect(wrapper.find('.js-blob-header-filepath').text().trim()).toBe(MockBlob.path); }); it('does not fail if the name is empty', () => { @@ -71,12 +66,7 @@ describe('Blob Header Filepath', () => { ); expect(wrapper.text()).toContain(slotContent); - expect( - wrapper - .text() - .trim() - .substring(0, slotContent.length), - ).toBe(slotContent); + expect(wrapper.text().trim().substring(0, slotContent.length)).toBe(slotContent); }); }); diff --git a/spec/frontend/boards/components/board_assignee_dropdown_spec.js b/spec/frontend/boards/components/board_assignee_dropdown_spec.js index bbdcc707f09..1797437d282 100644 --- a/spec/frontend/boards/components/board_assignee_dropdown_spec.js +++ b/spec/frontend/boards/components/board_assignee_dropdown_spec.js @@ -102,7 +102,7 @@ describe('BoardCardAssigneeDropdown', () => { beforeEach(() => { store.state.activeId = '1'; store.state.issues = { - '1': { + 1: { iid, assignees: [{ username: activeIssueName, name: activeIssueName, id: activeIssueName }], }, @@ -145,12 +145,7 @@ describe('BoardCardAssigneeDropdown', () => { it('renders gl-avatar-labeled in gl-avatar-link', () => { const item = findByText('hello'); - expect( - item - .find(GlAvatarLink) - .find(GlAvatarLabeled) - .exists(), - ).toBe(true); + expect(item.find(GlAvatarLink).find(GlAvatarLabeled).exists()).toBe(true); }); }); diff --git a/spec/frontend/boards/components/board_card_spec.js b/spec/frontend/boards/components/board_card_spec.js index 8186723173c..e600bc8704d 100644 --- a/spec/frontend/boards/components/board_card_spec.js +++ b/spec/frontend/boards/components/board_card_spec.js @@ -134,9 +134,7 @@ describe('BoardCard', () => { it('does not set detail issue if link is clicked', () => { mountComponent(); - findIssueCardInner() - .find('a') - .trigger('mouseup'); + findIssueCardInner().find('a').trigger('mouseup'); expect(boardsStore.detail.issue).toEqual({}); }); 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 8e5c0af6f9d..21b3fac15ef 100644 --- a/spec/frontend/boards/components/issue_time_estimate_deprecated_spec.js +++ b/spec/frontend/boards/components/issue_time_estimate_deprecated_spec.js @@ -24,12 +24,7 @@ describe('Issue Time Estimate component', () => { }); it('renders the correct time estimate', () => { - expect( - wrapper - .find('time') - .text() - .trim(), - ).toEqual('2w 3d 1m'); + expect(wrapper.find('time').text().trim()).toEqual('2w 3d 1m'); }); it('renders expanded time estimate in tooltip', () => { @@ -41,12 +36,7 @@ describe('Issue Time Estimate component', () => { wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' }); wrapper.vm.$nextTick(() => { expect(alertSpy).not.toHaveBeenCalled(); - expect( - wrapper - .find('time') - .text() - .trim(), - ).toEqual('0m'); + expect(wrapper.find('time').text().trim()).toEqual('0m'); expect(wrapper.find('.js-issue-time-estimate').text()).toContain('0m'); done(); }); @@ -64,12 +54,7 @@ describe('Issue Time Estimate component', () => { }); it('renders the correct time estimate', () => { - expect( - wrapper - .find('time') - .text() - .trim(), - ).toEqual('104h 1m'); + expect(wrapper.find('time').text().trim()).toEqual('104h 1m'); }); it('renders expanded time estimate in tooltip', () => { diff --git a/spec/frontend/boards/components/issue_time_estimate_spec.js b/spec/frontend/boards/components/issue_time_estimate_spec.js index 2ef439ebc04..b09f879ea85 100644 --- a/spec/frontend/boards/components/issue_time_estimate_spec.js +++ b/spec/frontend/boards/components/issue_time_estimate_spec.js @@ -21,12 +21,7 @@ describe('Issue Time Estimate component', () => { }); it('renders the correct time estimate', () => { - expect( - wrapper - .find('time') - .text() - .trim(), - ).toEqual('2w 3d 1m'); + expect(wrapper.find('time').text().trim()).toEqual('2w 3d 1m'); }); it('renders expanded time estimate in tooltip', () => { @@ -38,12 +33,7 @@ describe('Issue Time Estimate component', () => { wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' }); wrapper.vm.$nextTick(() => { expect(alertSpy).not.toHaveBeenCalled(); - expect( - wrapper - .find('time') - .text() - .trim(), - ).toEqual('0m'); + expect(wrapper.find('time').text().trim()).toEqual('0m'); expect(wrapper.find('.js-issue-time-estimate').text()).toContain('0m'); done(); }); @@ -63,12 +53,7 @@ describe('Issue Time Estimate component', () => { }); it('renders the correct time estimate', () => { - expect( - wrapper - .find('time') - .text() - .trim(), - ).toEqual('104h 1m'); + expect(wrapper.find('time').text().trim()).toEqual('104h 1m'); }); it('renders expanded time estimate in tooltip', () => { diff --git a/spec/frontend/boards/components/sidebar/board_sidebar_labels_select_spec.js b/spec/frontend/boards/components/sidebar/board_sidebar_labels_select_spec.js index da000d21f6a..cc877ca818b 100644 --- a/spec/frontend/boards/components/sidebar/board_sidebar_labels_select_spec.js +++ b/spec/frontend/boards/components/sidebar/board_sidebar_labels_select_spec.js @@ -84,7 +84,10 @@ describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => { }); describe('when labels are updated over existing labels', () => { - const testLabelsPayload = [{ id: 5, set: true }, { id: 7, set: true }]; + const testLabelsPayload = [ + { id: 5, set: true }, + { id: 7, set: true }, + ]; const expectedLabels = [{ id: 5 }, { id: 7 }]; beforeEach(async () => { diff --git a/spec/frontend/boards/issue_card_deprecated_spec.js b/spec/frontend/boards/issue_card_deprecated_spec.js index 6debe8c0409..0b34be65029 100644 --- a/spec/frontend/boards/issue_card_deprecated_spec.js +++ b/spec/frontend/boards/issue_card_deprecated_spec.js @@ -245,12 +245,7 @@ describe('Issue card component', () => { }); it('renders more avatar counter', () => { - expect( - wrapper - .find('.board-card-assignee .avatar-counter') - .text() - .trim(), - ).toEqual('+2'); + expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('+2'); }); it('renders two assignees', () => { @@ -278,12 +273,7 @@ describe('Issue card component', () => { }); wrapper.vm.$nextTick(() => { - expect( - wrapper - .find('.board-card-assignee .avatar-counter') - .text() - .trim(), - ).toEqual('99+'); + expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('99+'); done(); }); }); diff --git a/spec/frontend/boards/issue_card_inner_spec.js b/spec/frontend/boards/issue_card_inner_spec.js index 3070f826c0d..d6029c4b66f 100644 --- a/spec/frontend/boards/issue_card_inner_spec.js +++ b/spec/frontend/boards/issue_card_inner_spec.js @@ -250,12 +250,7 @@ describe('Issue card component', () => { }); it('renders more avatar counter', () => { - expect( - wrapper - .find('.board-card-assignee .avatar-counter') - .text() - .trim(), - ).toEqual('+2'); + expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('+2'); }); it('renders two assignees', () => { @@ -281,12 +276,7 @@ describe('Issue card component', () => { await wrapper.vm.$nextTick(); - expect( - wrapper - .find('.board-card-assignee .avatar-counter') - .text() - .trim(), - ).toEqual('99+'); + expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('99+'); }); }); }); diff --git a/spec/frontend/boards/project_select_spec.js b/spec/frontend/boards/project_select_spec.js index e187828702e..fd4f84e996a 100644 --- a/spec/frontend/boards/project_select_spec.js +++ b/spec/frontend/boards/project_select_spec.js @@ -39,9 +39,7 @@ describe('ProjectSelect component', () => { const findLabel = () => wrapper.find("[data-testid='header-label']"); const findGlDropdown = () => wrapper.find(GlDropdown); const findGlDropdownLoadingIcon = () => - findGlDropdown() - .find('button:first-child') - .find(GlLoadingIcon); + findGlDropdown().find('button:first-child').find(GlLoadingIcon); const findGlSearchBoxByType = () => wrapper.find(GlSearchBoxByType); const findGlDropdownItems = () => wrapper.findAll(GlDropdownItem); const findFirstGlDropdownItem = () => findGlDropdownItems().at(0); @@ -159,9 +157,7 @@ describe('ProjectSelect component', () => { await createWrapper(); - await findFirstGlDropdownItem() - .find('button') - .trigger('click'); + await findFirstGlDropdownItem().find('button').trigger('click'); }); it('emits setSelectedProject with correct project metadata', () => { @@ -174,11 +170,9 @@ describe('ProjectSelect component', () => { }); it('renders the name of the selected project', () => { - expect( - findGlDropdown() - .find('.gl-new-dropdown-button-text') - .text(), - ).toBe(mockProjectsList1[0].name); + expect(findGlDropdown().find('.gl-new-dropdown-button-text').text()).toBe( + mockProjectsList1[0].name, + ); }); }); diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index 19018447f3f..efe9afde530 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -526,8 +526,8 @@ describe('moveIssue', () => { }; const issues = { - '436': mockIssue, - '437': mockIssue2, + 436: mockIssue, + 437: mockIssue2, }; const state = { diff --git a/spec/frontend/boards/stores/getters_spec.js b/spec/frontend/boards/stores/getters_spec.js index 6ceb8867d1f..8a9ff8232e7 100644 --- a/spec/frontend/boards/stores/getters_spec.js +++ b/spec/frontend/boards/stores/getters_spec.js @@ -39,7 +39,7 @@ describe('Boards - Getters', () => { }); describe('getIssueById', () => { - const state = { issues: { '1': 'issue' } }; + const state = { issues: { 1: 'issue' } }; it.each` id | expected @@ -56,7 +56,7 @@ describe('Boards - Getters', () => { ${'1'} | ${'issue'} ${''} | ${{}} `('returns $expected when $id is passed to state', ({ id, expected }) => { - const state = { issues: { '1': 'issue' }, activeId: id }; + const state = { issues: { 1: 'issue' }, activeId: id }; expect(getters.activeIssue(state)).toEqual(expected); }); diff --git a/spec/frontend/boards/stores/mutations_spec.js b/spec/frontend/boards/stores/mutations_spec.js index 50c621cdd52..1fa948b3848 100644 --- a/spec/frontend/boards/stores/mutations_spec.js +++ b/spec/frontend/boards/stores/mutations_spec.js @@ -236,7 +236,7 @@ describe('Board Store Mutations', () => { 'gid://gitlab/List/1': [mockIssue.id], }; const issues = { - '1': mockIssue, + 1: mockIssue, }; state = { @@ -345,8 +345,8 @@ describe('Board Store Mutations', () => { }; const issues = { - '1': mockIssue, - '2': mockIssue2, + 1: mockIssue, + 2: mockIssue2, }; state = { @@ -374,7 +374,7 @@ describe('Board Store Mutations', () => { describe('MOVE_ISSUE_SUCCESS', () => { it('updates issue in issues state', () => { const issues = { - '436': { id: rawIssue.id }, + 436: { id: rawIssue.id }, }; state = { @@ -386,7 +386,7 @@ describe('Board Store Mutations', () => { issue: rawIssue, }); - expect(state.issues).toEqual({ '436': { ...mockIssue, id: 436 } }); + expect(state.issues).toEqual({ 436: { ...mockIssue, id: 436 } }); }); }); @@ -446,7 +446,7 @@ describe('Board Store Mutations', () => { 'gid://gitlab/List/1': [mockIssue.id], }; const issues = { - '1': mockIssue, + 1: mockIssue, }; state = { @@ -472,8 +472,8 @@ describe('Board Store Mutations', () => { 'gid://gitlab/List/1': [mockIssue.id, mockIssue2.id], }; const issues = { - '1': mockIssue, - '2': mockIssue2, + 1: mockIssue, + 2: mockIssue2, }; state = { @@ -496,8 +496,8 @@ describe('Board Store Mutations', () => { 'gid://gitlab/List/1': [mockIssue.id, mockIssue2.id], }; const issues = { - '1': mockIssue, - '2': mockIssue2, + 1: mockIssue, + 2: mockIssue2, }; state = { 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 e07afb5d736..b10f4984aff 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 @@ -19,10 +19,7 @@ describe('TriggersList', () => { const findHeaderAt = i => wrapper.findAll('thead th').at(i); const findRows = () => wrapper.findAll('tbody tr'); const findRowAt = i => findRows().at(i); - const findCell = (i, col) => - findRowAt(i) - .findAll('td') - .at(col); + 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"]'); @@ -67,11 +64,7 @@ describe('TriggersList', () => { it('displays a time ago label when last used', () => { expect(findCell(0, 3).text()).toBe('Never'); - expect( - findCell(1, 3) - .find(TimeAgoTooltip) - .props('time'), - ).toBe(triggers[1].lastUsed); + expect(findCell(1, 3).find(TimeAgoTooltip).props('time')).toBe(triggers[1].lastUsed); }); it('displays actions in a rows', () => { diff --git a/spec/frontend/ci_variable_list/ci_variable_list/ci_variable_list_spec.js b/spec/frontend/ci_variable_list/ci_variable_list/ci_variable_list_spec.js index 4a2e56c570d..ad1bdec1735 100644 --- a/spec/frontend/ci_variable_list/ci_variable_list/ci_variable_list_spec.js +++ b/spec/frontend/ci_variable_list/ci_variable_list/ci_variable_list_spec.js @@ -31,10 +31,7 @@ describe('VariableList', () => { it('should add another row when editing the last rows key input', () => { const $row = $wrapper.find('.js-row'); - $row - .find('.js-ci-variable-input-key') - .val('foo') - .trigger('input'); + $row.find('.js-ci-variable-input-key').val('foo').trigger('input'); expect($wrapper.find('.js-row').length).toBe(2); @@ -46,10 +43,7 @@ describe('VariableList', () => { it('should add another row when editing the last rows value textarea', () => { const $row = $wrapper.find('.js-row'); - $row - .find('.js-ci-variable-input-value') - .val('foo') - .trigger('input'); + $row.find('.js-ci-variable-input-value').val('foo').trigger('input'); expect($wrapper.find('.js-row').length).toBe(2); @@ -61,18 +55,11 @@ describe('VariableList', () => { it('should remove empty row after blurring', () => { const $row = $wrapper.find('.js-row'); - $row - .find('.js-ci-variable-input-key') - .val('foo') - .trigger('input'); + $row.find('.js-ci-variable-input-key').val('foo').trigger('input'); expect($wrapper.find('.js-row').length).toBe(2); - $row - .find('.js-ci-variable-input-key') - .val('') - .trigger('input') - .trigger('blur'); + $row.find('.js-ci-variable-input-key').val('').trigger('input').trigger('blur'); expect($wrapper.find('.js-row').length).toBe(1); }); diff --git a/spec/frontend/confirm_modal_spec.js b/spec/frontend/confirm_modal_spec.js index 70076532a94..1b7edfb8ee6 100644 --- a/spec/frontend/confirm_modal_spec.js +++ b/spec/frontend/confirm_modal_spec.js @@ -78,9 +78,7 @@ describe('ConfirmModal', () => { describe('when button clicked', () => { beforeEach(() => { initConfirmModal(); - findJsHooks() - .item(0) - .click(); + findJsHooks().item(0).click(); }); it('does not replace JsHook with GlModal', () => { @@ -116,9 +114,7 @@ describe('ConfirmModal', () => { `(`when multiple buttons exist`, ({ index }) => { beforeEach(() => { initConfirmModal(); - findJsHooks() - .item(index) - .click(); + findJsHooks().item(index).click(); }); it('correct props are passed to gl-modal', () => { diff --git a/spec/frontend/create_cluster/components/cluster_form_dropdown_spec.js b/spec/frontend/create_cluster/components/cluster_form_dropdown_spec.js index 17abf409717..de6725a2b74 100644 --- a/spec/frontend/create_cluster/components/cluster_form_dropdown_spec.js +++ b/spec/frontend/create_cluster/components/cluster_form_dropdown_spec.js @@ -44,10 +44,7 @@ describe('ClusterFormDropdown', () => { wrapper.setProps({ items }); return wrapper.vm.$nextTick().then(() => { - wrapper - .findAll('.js-dropdown-item') - .at(1) - .trigger('click'); + wrapper.findAll('.js-dropdown-item').at(1).trigger('click'); return wrapper.vm.$nextTick(); }); }); @@ -65,17 +62,11 @@ describe('ClusterFormDropdown', () => { return wrapper.vm .$nextTick() .then(() => { - wrapper - .findAll('.js-dropdown-item') - .at(0) - .trigger('click'); + wrapper.findAll('.js-dropdown-item').at(0).trigger('click'); return wrapper.vm.$nextTick(); }) .then(() => { - wrapper - .findAll('.js-dropdown-item') - .at(1) - .trigger('click'); + wrapper.findAll('.js-dropdown-item').at(1).trigger('click'); return wrapper.vm.$nextTick(); }); }); @@ -102,10 +93,7 @@ describe('ClusterFormDropdown', () => { wrapper.setProps({ items, multiple: true, value: null }); return wrapper.vm.$nextTick().then(() => { - wrapper - .findAll('.js-dropdown-item') - .at(0) - .trigger('click'); + wrapper.findAll('.js-dropdown-item').at(0).trigger('click'); expect(wrapper.emitted('input')[0]).toEqual([[firstItem.value]]); }); diff --git a/spec/frontend/create_cluster/eks_cluster/services/aws_services_facade_spec.js b/spec/frontend/create_cluster/eks_cluster/services/aws_services_facade_spec.js index 03c22c570a8..2853d18e2cb 100644 --- a/spec/frontend/create_cluster/eks_cluster/services/aws_services_facade_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/services/aws_services_facade_spec.js @@ -101,7 +101,10 @@ describe('awsServicesFacade', () => { let vpcsOutput; beforeEach(() => { - vpcs = [{ VpcId: 'vpc-1', Tags: [] }, { VpcId: 'vpc-2', Tags: [] }]; + vpcs = [ + { VpcId: 'vpc-1', Tags: [] }, + { VpcId: 'vpc-2', Tags: [] }, + ]; vpcsOutput = vpcs.map(({ VpcId: vpcId }) => ({ name: vpcId, value: vpcId })); mockDescribeVpcsPromise.mockResolvedValueOnce({ Vpcs: vpcs }); diff --git a/spec/frontend/create_item_dropdown_spec.js b/spec/frontend/create_item_dropdown_spec.js index a814952faab..148b3468ff2 100644 --- a/spec/frontend/create_item_dropdown_spec.js +++ b/spec/frontend/create_item_dropdown_spec.js @@ -27,20 +27,14 @@ describe('CreateItemDropdown', () => { function createItemAndClearInput(text) { // Filter for the new item - $wrapperEl - .find('.dropdown-input-field') - .val(text) - .trigger('input'); + $wrapperEl.find('.dropdown-input-field').val(text).trigger('input'); // Create the new item const $createButton = $wrapperEl.find('.js-dropdown-create-new-item'); $createButton.click(); // Clear out the filter - $wrapperEl - .find('.dropdown-input-field') - .val('') - .trigger('input'); + $wrapperEl.find('.dropdown-input-field').val('').trigger('input'); } beforeEach(() => { @@ -91,10 +85,7 @@ describe('CreateItemDropdown', () => { $('.js-dropdown-menu-toggle').click(); // Filter for the new item - $wrapperEl - .find('.dropdown-input-field') - .val(NEW_ITEM_TEXT) - .trigger('input'); + $wrapperEl.find('.dropdown-input-field').val(NEW_ITEM_TEXT).trigger('input'); }); it('create new item button should include the filter text', () => { diff --git a/spec/frontend/deploy_freeze/components/deploy_freeze_modal_spec.js b/spec/frontend/deploy_freeze/components/deploy_freeze_modal_spec.js index 9f28ddfd230..039e85d604b 100644 --- a/spec/frontend/deploy_freeze/components/deploy_freeze_modal_spec.js +++ b/spec/frontend/deploy_freeze/components/deploy_freeze_modal_spec.js @@ -29,10 +29,7 @@ describe('Deploy freeze modal', () => { }); const findModal = () => wrapper.find(GlModal); - const addDeployFreezeButton = () => - findModal() - .findAll(GlButton) - .at(1); + const addDeployFreezeButton = () => findModal().findAll(GlButton).at(1); const setInput = (freezeStartCron, freezeEndCron, selectedTimezone) => { store.state.freezeStartCron = freezeStartCron; diff --git a/spec/frontend/deploy_keys/components/app_spec.js b/spec/frontend/deploy_keys/components/app_spec.js index 291502c9ed7..8d37b5ce38f 100644 --- a/spec/frontend/deploy_keys/components/app_spec.js +++ b/spec/frontend/deploy_keys/components/app_spec.js @@ -64,12 +64,7 @@ describe('Deploy keys app component', () => { expect(element.exists()).toBe(true); expect(element.text().trim()).toContain(label); - expect( - element - .find('.badge') - .text() - .trim(), - ).toBe(count.toString()); + expect(element.find('.badge').text().trim()).toBe(count.toString()); }); }); diff --git a/spec/frontend/deploy_keys/components/key_spec.js b/spec/frontend/deploy_keys/components/key_spec.js index d990c64c241..f1305a45adc 100644 --- a/spec/frontend/deploy_keys/components/key_spec.js +++ b/spec/frontend/deploy_keys/components/key_spec.js @@ -9,11 +9,7 @@ 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 => { wrapper = mount(key, { @@ -103,10 +99,7 @@ describe('Deploy keys key', () => { it('expands all project labels after click', () => { createComponent({ deployKey }); const { length } = deployKey.deploy_keys_projects; - wrapper - .findAll('.deploy-project-label') - .at(1) - .trigger('click'); + wrapper.findAll('.deploy-project-label').at(1).trigger('click'); return wrapper.vm.$nextTick().then(() => { const labels = wrapper.findAll('.deploy-project-label'); diff --git a/spec/frontend/deploy_keys/components/keys_panel_spec.js b/spec/frontend/deploy_keys/components/keys_panel_spec.js index 53c8ba073bc..ecfbcaec894 100644 --- a/spec/frontend/deploy_keys/components/keys_panel_spec.js +++ b/spec/frontend/deploy_keys/components/keys_panel_spec.js @@ -48,12 +48,9 @@ describe('Deploy keys panel', () => { expect(wrapper.find('.settings-message').exists()).toBe(true); - expect( - wrapper - .find('.settings-message') - .text() - .trim(), - ).toBe('No deploy keys found. Create one with the form above.'); + expect(wrapper.find('.settings-message').text().trim()).toBe( + 'No deploy keys found. Create one with the form above.', + ); }); it('renders no table header if keys are empty', () => { diff --git a/spec/frontend/deprecated_jquery_dropdown_spec.js b/spec/frontend/deprecated_jquery_dropdown_spec.js index e6323859899..32e3a1532a4 100644 --- a/spec/frontend/deprecated_jquery_dropdown_spec.js +++ b/spec/frontend/deprecated_jquery_dropdown_spec.js @@ -230,10 +230,7 @@ describe('deprecatedJQueryDropdown', () => { it('should still have input value on close and restore', () => { const $searchInput = $(SEARCH_INPUT_SELECTOR); initDropDown.call(this, false, true); - $searchInput - .trigger('focus') - .val('g') - .trigger('input'); + $searchInput.trigger('focus').val('g').trigger('input'); expect($searchInput.val()).toEqual('g'); test.dropdownButtonElement.trigger('hidden.bs.dropdown'); 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 9fbd9b2c2a3..0687db177b4 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 @@ -150,16 +150,8 @@ describe('Design discussions component', () => { }); it('shows only the first note', () => { - expect( - findDesignNotes() - .at(0) - .isVisible(), - ).toBe(true); - expect( - findDesignNotes() - .at(1) - .isVisible(), - ).toBe(false); + expect(findDesignNotes().at(0).isVisible()).toBe(true); + expect(findDesignNotes().at(1).isVisible()).toBe(false); }); it('renders resolved message', () => { @@ -193,11 +185,7 @@ describe('Design discussions component', () => { }); it('renders the second note', () => { - expect( - findDesignNotes() - .at(1) - .isVisible(), - ).toBe(true); + expect(findDesignNotes().at(1).isVisible()).toBe(true); }); it('renders a reply placeholder', () => { diff --git a/spec/frontend/design_management/pages/index_spec.js b/spec/frontend/design_management/pages/index_spec.js index 147169dd9aa..31810fc34f0 100644 --- a/spec/frontend/design_management/pages/index_spec.js +++ b/spec/frontend/design_management/pages/index_spec.js @@ -545,16 +545,12 @@ describe('Design management index page', () => { }); it('adds two designs to selected designs when their checkboxes are checked', () => { - findDesignCheckboxes() - .at(0) - .trigger('click'); + findDesignCheckboxes().at(0).trigger('click'); return wrapper.vm .$nextTick() .then(() => { - findDesignCheckboxes() - .at(1) - .trigger('click'); + findDesignCheckboxes().at(1).trigger('click'); return wrapper.vm.$nextTick(); }) @@ -581,9 +577,7 @@ describe('Design management index page', () => { }); it('removes all designs from selected designs when at least one design was selected', () => { - findDesignCheckboxes() - .at(0) - .trigger('click'); + findDesignCheckboxes().at(0).trigger('click'); return wrapper.vm .$nextTick() @@ -716,11 +710,7 @@ describe('Design management index page', () => { await wrapper.vm.$nextTick(); expect(findDesigns()).toHaveLength(3); - expect( - findDesigns() - .at(0) - .props('id'), - ).toBe('1'); + expect(findDesigns().at(0).props('id')).toBe('1'); }); it('calls a mutation with correct parameters and reorders designs', async () => { @@ -732,11 +722,7 @@ describe('Design management index page', () => { await wrapper.vm.$nextTick(); - expect( - findDesigns() - .at(0) - .props('id'), - ).toBe('2'); + expect(findDesigns().at(0).props('id')).toBe('2'); }); it('prevents reordering when reorderDesigns mutation is in progress', async () => { diff --git a/spec/frontend/diffs/components/diff_discussions_spec.js b/spec/frontend/diffs/components/diff_discussions_spec.js index 96b76183cee..4f2fa4b84e3 100644 --- a/spec/frontend/diffs/components/diff_discussions_spec.js +++ b/spec/frontend/diffs/components/diff_discussions_spec.js @@ -91,12 +91,7 @@ describe('DiffDiscussions', () => { const noteableDiscussion = wrapper.find(NoteableDiscussion); expect(noteableDiscussion.find('.badge-pill').exists()).toBe(true); - expect( - noteableDiscussion - .find('.badge-pill') - .text() - .trim(), - ).toBe('1'); + expect(noteableDiscussion.find('.badge-pill').text().trim()).toBe('1'); }); }); }); diff --git a/spec/frontend/diffs/components/diff_gutter_avatars_spec.js b/spec/frontend/diffs/components/diff_gutter_avatars_spec.js index 61e110b345a..5884a9ebd3a 100644 --- a/spec/frontend/diffs/components/diff_gutter_avatars_spec.js +++ b/spec/frontend/diffs/components/diff_gutter_avatars_spec.js @@ -66,9 +66,7 @@ describe('DiffGutterAvatars', () => { }); it('should emit toggleDiscussions event on avatars click', () => { - findUserAvatars() - .at(0) - .trigger('click'); + findUserAvatars().at(0).trigger('click'); return wrapper.vm.$nextTick().then(() => { expect(wrapper.emitted().toggleLineDiscussions).toBeTruthy(); diff --git a/spec/frontend/diffs/components/diff_view_spec.js b/spec/frontend/diffs/components/diff_view_spec.js index 4d90112d8f6..2190aa1794f 100644 --- a/spec/frontend/diffs/components/diff_view_spec.js +++ b/spec/frontend/diffs/components/diff_view_spec.js @@ -64,12 +64,7 @@ describe('DiffView', () => { inline: type === 'inline', }); expect(wrapper.findAll(DiffCommentCell).length).toBe(total); - expect( - wrapper - .find(container) - .find(DiffCommentCell) - .exists(), - ).toBe(true); + expect(wrapper.find(container).find(DiffCommentCell).exists()).toBe(true); }, ); diff --git a/spec/frontend/diffs/components/image_diff_overlay_spec.js b/spec/frontend/diffs/components/image_diff_overlay_spec.js index 087715111b4..209c101d09f 100644 --- a/spec/frontend/diffs/components/image_diff_overlay_spec.js +++ b/spec/frontend/diffs/components/image_diff_overlay_spec.js @@ -49,18 +49,8 @@ describe('Diffs image diff overlay component', () => { createComponent(); const imageBadges = getAllImageBadges(); - expect( - imageBadges - .at(0) - .text() - .trim(), - ).toBe('1'); - expect( - imageBadges - .at(1) - .text() - .trim(), - ).toBe('2'); + expect(imageBadges.at(0).text().trim()).toBe('1'); + expect(imageBadges.at(1).text().trim()).toBe('2'); }); it('renders icon when showCommentIcon is true', () => { diff --git a/spec/frontend/diffs/components/tree_list_spec.js b/spec/frontend/diffs/components/tree_list_spec.js index c89403e4869..4666321e0c2 100644 --- a/spec/frontend/diffs/components/tree_list_spec.js +++ b/spec/frontend/diffs/components/tree_list_spec.js @@ -88,16 +88,8 @@ describe('Diffs tree list component', () => { it('renders tree', () => { expect(getFileRows()).toHaveLength(2); - expect( - getFileRows() - .at(0) - .html(), - ).toContain('index.js'); - expect( - getFileRows() - .at(1) - .html(), - ).toContain('app'); + expect(getFileRows().at(0).html()).toContain('index.js'); + expect(getFileRows().at(1).html()).toContain('app'); }); it('hides file stats', () => { @@ -111,9 +103,7 @@ describe('Diffs tree list component', () => { it('calls toggleTreeOpen when clicking folder', () => { jest.spyOn(wrapper.vm.$store, 'dispatch').mockReturnValue(undefined); - getFileRows() - .at(1) - .trigger('click'); + getFileRows().at(1).trigger('click'); expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('diffs/toggleTreeOpen', 'app'); }); diff --git a/spec/frontend/diffs/store/actions_spec.js b/spec/frontend/diffs/store/actions_spec.js index 55e744e573b..b351f4e4eca 100644 --- a/spec/frontend/diffs/store/actions_spec.js +++ b/spec/frontend/diffs/store/actions_spec.js @@ -272,7 +272,7 @@ describe('DiffsStoreActions', () => { afterEach(() => mock.restore()); it('should commit SET_COVERAGE_DATA with received response', done => { - const data = { files: { 'app.js': { '1': 0, '2': 1 } } }; + const data = { files: { 'app.js': { 1: 0, 2: 1 } } }; mock.onGet(endpointCoverage).reply(200, { data }); @@ -1410,7 +1410,7 @@ describe('DiffsStoreActions', () => { const state = { diffFiles: [{ file_hash: '123' }] }; const rootGetters = { getDiscussion: () => ({ diff_file: { file_hash: '123' } }), - notesById: { '1': { discussion_id: '2' } }, + notesById: { 1: { discussion_id: '2' } }, }; setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); @@ -1423,7 +1423,7 @@ describe('DiffsStoreActions', () => { const state = { diffFiles: [{ file_hash: '123' }] }; const rootGetters = { getDiscussion: () => ({ id: '1' }), - notesById: { '1': { discussion_id: '2' } }, + notesById: { 1: { discussion_id: '2' } }, }; setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); @@ -1436,7 +1436,7 @@ describe('DiffsStoreActions', () => { const state = { diffFiles: [{ file_hash: '123' }] }; const rootGetters = { getDiscussion: () => ({ diff_file: { file_hash: '124' } }), - notesById: { '1': { discussion_id: '2' } }, + notesById: { 1: { discussion_id: '2' } }, }; setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); diff --git a/spec/frontend/diffs/store/getters_spec.js b/spec/frontend/diffs/store/getters_spec.js index 8cbcefa28d1..4d7f861ac22 100644 --- a/spec/frontend/diffs/store/getters_spec.js +++ b/spec/frontend/diffs/store/getters_spec.js @@ -251,9 +251,12 @@ describe('Diffs Module Getters', () => { discussionMock.diff_file.file_hash = diffFileMock.file_hash; expect( - getters.getDiffFileDiscussions(localState, {}, {}, { discussions: [discussionMock] })( - diffFileMock, - ).length, + getters.getDiffFileDiscussions( + localState, + {}, + {}, + { discussions: [discussionMock] }, + )(diffFileMock).length, ).toEqual(1); }); @@ -345,7 +348,7 @@ describe('Diffs Module Getters', () => { describe('fileLineCoverage', () => { beforeEach(() => { - Object.assign(localState.coverageFiles, { files: { 'app.js': { '1': 0, '2': 5 } } }); + Object.assign(localState.coverageFiles, { files: { 'app.js': { 1: 0, 2: 5 } } }); }); it('returns empty object when no coverage data is available', () => { diff --git a/spec/frontend/diffs/store/mutations_spec.js b/spec/frontend/diffs/store/mutations_spec.js index be187c49a20..2c342d8e2a5 100644 --- a/spec/frontend/diffs/store/mutations_spec.js +++ b/spec/frontend/diffs/store/mutations_spec.js @@ -105,7 +105,7 @@ describe('DiffsStoreMutations', () => { describe('SET_COVERAGE_DATA', () => { it('should set coverage data properly', () => { const state = { coverageFiles: {} }; - const coverage = { 'app.js': { '1': 0, '2': 1 } }; + const coverage = { 'app.js': { 1: 0, 2: 1 } }; mutations[types.SET_COVERAGE_DATA](state, coverage); diff --git a/spec/frontend/error_tracking/components/error_tracking_actions_spec.js b/spec/frontend/error_tracking/components/error_tracking_actions_spec.js index b22805f5227..05b3d2f1dec 100644 --- a/spec/frontend/error_tracking/components/error_tracking_actions_spec.js +++ b/spec/frontend/error_tracking/components/error_tracking_actions_spec.js @@ -41,16 +41,8 @@ describe('Error Tracking Actions', () => { expect(findButtons().exists()).toBe(true); return wrapper.vm.$nextTick().then(() => { - expect( - findButtons() - .at(0) - .attributes('title'), - ).toBe('Ignore'); - expect( - findButtons() - .at(1) - .attributes('title'), - ).toBe('Resolve'); + expect(findButtons().at(0).attributes('title')).toBe('Ignore'); + expect(findButtons().at(1).attributes('title')).toBe('Resolve'); }); }); }); @@ -64,11 +56,7 @@ describe('Error Tracking Actions', () => { expect(findButtons().exists()).toBe(true); return wrapper.vm.$nextTick().then(() => { - expect( - findButtons() - .at(0) - .attributes('title'), - ).toBe('Undo Ignore'); + expect(findButtons().at(0).attributes('title')).toBe('Undo Ignore'); }); }); }); @@ -82,11 +70,7 @@ describe('Error Tracking Actions', () => { expect(findButtons().exists()).toBe(true); return wrapper.vm.$nextTick().then(() => { - expect( - findButtons() - .at(1) - .attributes('title'), - ).toBe('Unresolve'); + expect(findButtons().at(1).attributes('title')).toBe('Unresolve'); }); }); }); 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 9a2d086e161..fa8992a8d9f 100644 --- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js +++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js @@ -19,18 +19,9 @@ describe('ErrorTrackingList', () => { const findErrorListTable = () => wrapper.find('table'); const findErrorListRows = () => wrapper.findAll('tbody tr'); const dropdownsArray = () => wrapper.findAll(GlDropdown); - const findRecentSearchesDropdown = () => - dropdownsArray() - .at(0) - .find(GlDropdown); - const findStatusFilterDropdown = () => - dropdownsArray() - .at(1) - .find(GlDropdown); - const findSortDropdown = () => - dropdownsArray() - .at(2) - .find(GlDropdown); + const findRecentSearchesDropdown = () => dropdownsArray().at(0).find(GlDropdown); + const findStatusFilterDropdown = () => dropdownsArray().at(1).find(GlDropdown); + const findSortDropdown = () => dropdownsArray().at(2).find(GlDropdown); const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findPagination = () => wrapper.find(GlPagination); const findErrorActions = () => wrapper.find(ErrorTrackingActions); diff --git a/spec/frontend/error_tracking/store/list/actions_spec.js b/spec/frontend/error_tracking/store/list/actions_spec.js index 7326472e1dd..e829912580a 100644 --- a/spec/frontend/error_tracking/store/list/actions_spec.js +++ b/spec/frontend/error_tracking/store/list/actions_spec.js @@ -48,7 +48,10 @@ describe('error tracking actions', () => { actions.startPolling, {}, {}, - [{ type: types.SET_LOADING, payload: true }, { type: types.SET_LOADING, payload: false }], + [ + { type: types.SET_LOADING, payload: true }, + { type: types.SET_LOADING, payload: false }, + ], [], () => { expect(createFlash).toHaveBeenCalledTimes(1); @@ -64,7 +67,10 @@ describe('error tracking actions', () => { actions.restartPolling, {}, {}, - [{ type: types.SET_ERRORS, payload: [] }, { type: types.SET_LOADING, payload: true }], + [ + { type: types.SET_ERRORS, payload: [] }, + { type: types.SET_LOADING, payload: true }, + ], [], ); }); @@ -110,7 +116,10 @@ describe('error tracking actions', () => { actions.sortByField, field, {}, - [{ type: types.SET_CURSOR, payload: null }, { type: types.SET_SORT_FIELD, payload: field }], + [ + { type: types.SET_CURSOR, payload: null }, + { type: types.SET_SORT_FIELD, payload: field }, + ], [{ type: 'stopPolling' }, { type: 'startPolling' }], ); }); diff --git a/spec/frontend/error_tracking_settings/components/error_tracking_form_spec.js b/spec/frontend/error_tracking_settings/components/error_tracking_form_spec.js index f4a765a3d73..e2a8b57f555 100644 --- a/spec/frontend/error_tracking_settings/components/error_tracking_form_spec.js +++ b/spec/frontend/error_tracking_settings/components/error_tracking_form_spec.js @@ -35,12 +35,7 @@ describe('error tracking settings form', () => { it('is rendered', () => { expect(wrapper.findAll(GlFormInput).length).toBe(2); expect(wrapper.find(GlFormInput).attributes('id')).toBe('error-tracking-api-host'); - expect( - wrapper - .findAll(GlFormInput) - .at(1) - .attributes('id'), - ).toBe('error-tracking-token'); + expect(wrapper.findAll(GlFormInput).at(1).attributes('id')).toBe('error-tracking-token'); expect(wrapper.findAll(GlButton).exists()).toBe(true); }); @@ -56,12 +51,9 @@ describe('error tracking settings form', () => { ); expect(pageText).not.toContain('Connection has failed. Re-check Auth Token and try again'); - expect( - wrapper - .findAll(GlFormInput) - .at(0) - .attributes('placeholder'), - ).toContain('https://mysentryserver.com'); + expect(wrapper.findAll(GlFormInput).at(0).attributes('placeholder')).toContain( + 'https://mysentryserver.com', + ); }); }); diff --git a/spec/frontend/feature_flags/components/environments_dropdown_spec.js b/spec/frontend/feature_flags/components/environments_dropdown_spec.js index 7bc71ef51c7..39ec05ebd4f 100644 --- a/spec/frontend/feature_flags/components/environments_dropdown_spec.js +++ b/spec/frontend/feature_flags/components/environments_dropdown_spec.js @@ -136,10 +136,7 @@ describe('Feature flags > Environments dropdown ', () => { }); it('emits create event', async () => { - wrapper - .findAll(GlButton) - .at(0) - .vm.$emit('click'); + wrapper.findAll(GlButton).at(0).vm.$emit('click'); await wrapper.vm.$nextTick(); expect(wrapper.emitted('createClicked')).toEqual([['production']]); }); diff --git a/spec/frontend/feature_flags/components/feature_flags_spec.js b/spec/frontend/feature_flags/components/feature_flags_spec.js index 3c1234fea94..83a2293be89 100644 --- a/spec/frontend/feature_flags/components/feature_flags_spec.js +++ b/spec/frontend/feature_flags/components/feature_flags_spec.js @@ -101,11 +101,9 @@ describe('Feature flags', () => { it('shows a feature flags limit reached alert', () => { expect(limitAlert().exists()).toBe(true); - expect( - limitAlert() - .find(GlSprintf) - .attributes('message'), - ).toContain('Feature flags limit reached'); + expect(limitAlert().find(GlSprintf).attributes('message')).toContain( + 'Feature flags limit reached', + ); }); describe('when the alert is dismissed', () => { diff --git a/spec/frontend/feature_flags/components/form_spec.js b/spec/frontend/feature_flags/components/form_spec.js index 2c2a726d26f..2473c59e450 100644 --- a/spec/frontend/feature_flags/components/form_spec.js +++ b/spec/frontend/feature_flags/components/form_spec.js @@ -347,10 +347,7 @@ describe('feature flag form', () => { return wrapper.vm.$nextTick(); }) .then(() => { - wrapper - .find('.js-add-new-scope') - .find(ToggleButton) - .vm.$emit('change', true); + wrapper.find('.js-add-new-scope').find(ToggleButton).vm.$emit('change', true); }) .then(() => { wrapper.find(ToggleButton).vm.$emit('change', true); 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 158f70f7d47..36782403d6d 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 @@ -84,18 +84,11 @@ describe('Recent Searches Dropdown Content', () => { }); it('expect second dropdown to have 2 tokens', () => { - expect( - findDropdownItems() - .at(1) - .findAll('.js-dropdown-token'), - ).toHaveLength(2); + expect(findDropdownItems().at(1).findAll('.js-dropdown-token')).toHaveLength(2); }); it('emits recentSearchesItemSelected on dropdown item click', () => { - findDropdownItems() - .at(0) - .find('.js-dropdown-button') - .trigger('click'); + findDropdownItems().at(0).find('.js-dropdown-button').trigger('click'); expect(onRecentSearchesItemSelectedSpy).toHaveBeenCalledWith('foo'); }); diff --git a/spec/frontend/gfm_auto_complete_spec.js b/spec/frontend/gfm_auto_complete_spec.js index eb9343847f1..048491683b9 100644 --- a/spec/frontend/gfm_auto_complete_spec.js +++ b/spec/frontend/gfm_auto_complete_spec.js @@ -656,10 +656,7 @@ describe('GfmAutoComplete', () => { }); const triggerDropdown = text => { - $textarea - .trigger('focus') - .val(text) - .caret('pos', -1); + $textarea.trigger('focus').val(text).caret('pos', -1); $textarea.trigger('keyup'); return new Promise(window.requestAnimationFrame); diff --git a/spec/frontend/gl_field_errors_spec.js b/spec/frontend/gl_field_errors_spec.js index 078659bf429..f5b50c238df 100644 --- a/spec/frontend/gl_field_errors_spec.js +++ b/spec/frontend/gl_field_errors_spec.js @@ -41,18 +41,9 @@ describe('GL Style Field Errors', () => { }); it('should not show any errors before submit attempt', () => { - testContext.$form - .find('.email') - .val('not-a-valid-email') - .keyup(); - testContext.$form - .find('.text-required') - .val('') - .keyup(); - testContext.$form - .find('.alphanumberic') - .val('?---*') - .keyup(); + testContext.$form.find('.email').val('not-a-valid-email').keyup(); + testContext.$form.find('.text-required').val('').keyup(); + testContext.$form.find('.alphanumberic').val('?---*').keyup(); const errorsShown = testContext.$form.find('.gl-field-error-outline'); @@ -60,18 +51,9 @@ describe('GL Style Field Errors', () => { }); it('should show errors when input valid is submitted', () => { - testContext.$form - .find('.email') - .val('not-a-valid-email') - .keyup(); - testContext.$form - .find('.text-required') - .val('') - .keyup(); - testContext.$form - .find('.alphanumberic') - .val('?---*') - .keyup(); + testContext.$form.find('.email').val('not-a-valid-email').keyup(); + testContext.$form.find('.text-required').val('').keyup(); + testContext.$form.find('.alphanumberic').val('?---*').keyup(); testContext.$form.submit(); diff --git a/spec/frontend/groups/components/visibility_level_dropdown_spec.js b/spec/frontend/groups/components/visibility_level_dropdown_spec.js index bf9508dc768..8f65a0e9c13 100644 --- a/spec/frontend/groups/components/visibility_level_dropdown_spec.js +++ b/spec/frontend/groups/components/visibility_level_dropdown_spec.js @@ -56,10 +56,7 @@ describe('Visibility Level Dropdown', () => { describe('Selecting an option', () => { beforeEach(() => { - wrapper - .findAll(GlDropdownItem) - .at(1) - .vm.$emit('click'); + wrapper.findAll(GlDropdownItem).at(1).vm.$emit('click'); }); it('sets the value of the hidden input to the selected value', () => { diff --git a/spec/frontend/helpers/monitor_helper_spec.js b/spec/frontend/helpers/monitor_helper_spec.js index 219b05e312b..ef2a9fb0665 100644 --- a/spec/frontend/helpers/monitor_helper_spec.js +++ b/spec/frontend/helpers/monitor_helper_spec.js @@ -3,7 +3,11 @@ import { getSeriesLabel, makeDataSeries } from '~/helpers/monitor_helper'; describe('monitor helper', () => { const defaultConfig = { default: true, name: 'default name' }; const name = 'data name'; - const series = [[1, 1], [2, 2], [3, 3]]; + const series = [ + [1, 1], + [2, 2], + [3, 3], + ]; describe('getSeriesLabel', () => { const metricAttributes = { __name__: 'up', app: 'prometheus' }; diff --git a/spec/frontend/helpers/user_mock_data_helper.js b/spec/frontend/helpers/user_mock_data_helper.js index a6adc9dc3a0..db747283d9e 100644 --- a/spec/frontend/helpers/user_mock_data_helper.js +++ b/spec/frontend/helpers/user_mock_data_helper.js @@ -2,12 +2,7 @@ let id = 1; // Code taken from: https://gist.github.com/6174/6062387 const getRandomString = () => - Math.random() - .toString(36) - .substring(2, 15) + - Math.random() - .toString(36) - .substring(2, 15); + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); const getRandomUrl = () => `https://${getRandomString()}.com/${getRandomString()}`; diff --git a/spec/frontend/ide/components/file_row_extra_spec.js b/spec/frontend/ide/components/file_row_extra_spec.js index 2a106ad37c0..b6ad801d589 100644 --- a/spec/frontend/ide/components/file_row_extra_spec.js +++ b/spec/frontend/ide/components/file_row_extra_spec.js @@ -45,15 +45,16 @@ describe('IDE extra file row component', () => { expect(vm.folderChangesTooltip).toBe(undefined); }); - [{ input: 1, output: '1 changed file' }, { input: 2, output: '2 changed files' }].forEach( - ({ input, output }) => { - it('returns changed files count if changes count is not 0', () => { - changesCount = input; - - expect(vm.folderChangesTooltip).toBe(output); - }); - }, - ); + [ + { input: 1, output: '1 changed file' }, + { input: 2, output: '2 changed files' }, + ].forEach(({ input, output }) => { + it('returns changed files count if changes count is not 0', () => { + changesCount = input; + + expect(vm.folderChangesTooltip).toBe(output); + }); + }); }); describe('show tree changes count', () => { diff --git a/spec/frontend/ide/components/file_templates/bar_spec.js b/spec/frontend/ide/components/file_templates/bar_spec.js index 5a33837fb14..75bc9ca73ea 100644 --- a/spec/frontend/ide/components/file_templates/bar_spec.js +++ b/spec/frontend/ide/components/file_templates/bar_spec.js @@ -67,10 +67,7 @@ describe('IDE file templates bar component', () => { it('calls fetchTemplate on click', () => { jest.spyOn(vm, 'fetchTemplate').mockImplementation(); - vm.$el - .querySelectorAll('.dropdown-content')[1] - .querySelector('button') - .click(); + vm.$el.querySelectorAll('.dropdown-content')[1].querySelector('button').click(); expect(vm.fetchTemplate).toHaveBeenCalledWith({ name: 'test', diff --git a/spec/frontend/ide/components/ide_sidebar_nav_spec.js b/spec/frontend/ide/components/ide_sidebar_nav_spec.js index 49d476b56e4..502d64fb86b 100644 --- a/spec/frontend/ide/components/ide_sidebar_nav_spec.js +++ b/spec/frontend/ide/components/ide_sidebar_nav_spec.js @@ -58,10 +58,7 @@ describe('ide/components/ide_sidebar_nav', () => { tooltip: getBinding(button.element, 'tooltip').value, }; }); - const clickTab = () => - findButtons() - .at(TEST_CURRENT_INDEX) - .trigger('click'); + const clickTab = () => findButtons().at(TEST_CURRENT_INDEX).trigger('click'); describe.each` isOpen | side | otherSide | classes | classesObj | emitEvent | emitArg diff --git a/spec/frontend/ide/components/jobs/stage_spec.js b/spec/frontend/ide/components/jobs/stage_spec.js index 3a47571ee13..97d601e0a11 100644 --- a/spec/frontend/ide/components/jobs/stage_spec.js +++ b/spec/frontend/ide/components/jobs/stage_spec.js @@ -60,10 +60,7 @@ describe('IDE pipeline stage', () => { it('emits clickViewLog entity with job', () => { const [job] = defaultProps.stage.jobs; createComponent(); - wrapper - .findAll(Item) - .at(0) - .vm.$emit('clickViewLog', job); + wrapper.findAll(Item).at(0).vm.$emit('clickViewLog', job); return wrapper.vm.$nextTick().then(() => { expect(wrapper.emitted().clickViewLog[0][0]).toBe(job); }); diff --git a/spec/frontend/ide/components/merge_requests/list_spec.js b/spec/frontend/ide/components/merge_requests/list_spec.js index 80dcd861451..d1b980156b3 100644 --- a/spec/frontend/ide/components/merge_requests/list_spec.js +++ b/spec/frontend/ide/components/merge_requests/list_spec.js @@ -82,9 +82,7 @@ describe('IDE merge requests list', () => { return wrapper.vm .$nextTick() .then(() => { - findSearchTypeButtons() - .at(0) - .trigger('click'); + findSearchTypeButtons().at(0).trigger('click'); return wrapper.vm.$nextTick(); }) .then(() => { @@ -168,9 +166,7 @@ describe('IDE merge requests list', () => { describe('with search type', () => { beforeEach(() => { - findSearchTypeButtons() - .at(0) - .trigger('click'); + findSearchTypeButtons().at(0).trigger('click'); return wrapper.vm .$nextTick() diff --git a/spec/frontend/ide/components/pipelines/list_spec.js b/spec/frontend/ide/components/pipelines/list_spec.js index c1744fefe20..0238fff6aa9 100644 --- a/spec/frontend/ide/components/pipelines/list_spec.js +++ b/spec/frontend/ide/components/pipelines/list_spec.js @@ -165,11 +165,7 @@ describe('IDE pipelines list', () => { const isLoadingJobs = true; createComponent({}, { ...withLatestPipelineState, stages, isLoadingJobs }); - const jobProps = wrapper - .findAll(GlTab) - .at(0) - .find(JobsList) - .props(); + const jobProps = wrapper.findAll(GlTab).at(0).find(JobsList).props(); expect(jobProps.stages).toBe(stages); expect(jobProps.loading).toBe(isLoadingJobs); }); @@ -180,11 +176,7 @@ describe('IDE pipelines list', () => { const isLoadingJobs = true; createComponent({}, { ...withLatestPipelineState, isLoadingJobs }); - const jobProps = wrapper - .findAll(GlTab) - .at(1) - .find(JobsList) - .props(); + const jobProps = wrapper.findAll(GlTab).at(1).find(JobsList).props(); expect(jobProps.stages).toBe(failedStages); expect(jobProps.loading).toBe(isLoadingJobs); }); diff --git a/spec/frontend/ide/components/repo_commit_section_spec.js b/spec/frontend/ide/components/repo_commit_section_spec.js index 096079308cd..47e99677a70 100644 --- a/spec/frontend/ide/components/repo_commit_section_spec.js +++ b/spec/frontend/ide/components/repo_commit_section_spec.js @@ -77,18 +77,8 @@ describe('RepoCommitSection', () => { }); it('renders no changes text', () => { - expect( - wrapper - .find(EmptyState) - .text() - .trim(), - ).toContain('No changes'); - expect( - wrapper - .find(EmptyState) - .find('img') - .attributes('src'), - ).toBe(TEST_NO_CHANGES_SVG); + expect(wrapper.find(EmptyState).text().trim()).toContain('No changes'); + expect(wrapper.find(EmptyState).find('img').attributes('src')).toBe(TEST_NO_CHANGES_SVG); }); }); diff --git a/spec/frontend/ide/lib/create_file_diff_spec.js b/spec/frontend/ide/lib/create_file_diff_spec.js index 4b428468a6d..0e1f8a8c541 100644 --- a/spec/frontend/ide/lib/create_file_diff_spec.js +++ b/spec/frontend/ide/lib/create_file_diff_spec.js @@ -21,11 +21,7 @@ const spliceLines = (content, lineNumber, deleteCount = 0, newLines = []) => { return lines.join('\n'); }; -const mapLines = (content, mapFn) => - content - .split('\n') - .map(mapFn) - .join('\n'); +const mapLines = (content, mapFn) => content.split('\n').map(mapFn).join('\n'); describe('IDE lib/create_file_diff', () => { it('returns empty string with "garbage" action', () => { diff --git a/spec/frontend/ide/stores/actions/merge_request_spec.js b/spec/frontend/ide/stores/actions/merge_request_spec.js index b1cceda9d85..f7dd6fd47eb 100644 --- a/spec/frontend/ide/stores/actions/merge_request_spec.js +++ b/spec/frontend/ide/stores/actions/merge_request_spec.js @@ -71,7 +71,7 @@ describe('IDE store merge request actions', () => { .dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' }) .then(() => { expect(store.state.projects.abcproject.mergeRequests).toEqual({ - '2': expect.objectContaining(mrData), + 2: expect.objectContaining(mrData), }); done(); }) diff --git a/spec/frontend/ide/stores/modules/commit/actions_spec.js b/spec/frontend/ide/stores/modules/commit/actions_spec.js index cfe2bddf76c..899b8f2c7e8 100644 --- a/spec/frontend/ide/stores/modules/commit/actions_spec.js +++ b/spec/frontend/ide/stores/modules/commit/actions_spec.js @@ -456,9 +456,7 @@ describe('IDE commit module actions', () => { .dispatch('commit/commitChanges') .then(() => { expect(visitUrl).toHaveBeenCalledWith( - `webUrl/-/merge_requests/new?merge_request[source_branch]=${ - store.getters['commit/placeholderBranchName'] - }&merge_request[target_branch]=master&nav_source=webide`, + `webUrl/-/merge_requests/new?merge_request[source_branch]=${store.getters['commit/placeholderBranchName']}&merge_request[target_branch]=master&nav_source=webide`, ); done(); diff --git a/spec/frontend/incidents/components/incidents_list_spec.js b/spec/frontend/incidents/components/incidents_list_spec.js index 6329a84ff6e..8212776742c 100644 --- a/spec/frontend/incidents/components/incidents_list_spec.js +++ b/spec/frontend/incidents/components/incidents_list_spec.js @@ -158,17 +158,11 @@ describe('Incidents List', () => { describe('Assignees', () => { it('shows Unassigned when there are no assignees', () => { - expect( - findAssignees() - .at(0) - .text(), - ).toBe(I18N.unassigned); + expect(findAssignees().at(0).text()).toBe(I18N.unassigned); }); it('renders an avatar component when there is an assignee', () => { - const avatar = findAssignees() - .at(1) - .find(GlAvatar); + const avatar = findAssignees().at(1).find(GlAvatar); const { src, label } = avatar.attributes(); const { name, avatarUrl } = mockIncidents[1].assignees.nodes[0]; @@ -189,9 +183,7 @@ describe('Incidents List', () => { }); it('contains a link to the incident details page', async () => { - findTableRows() - .at(0) - .trigger('click'); + findTableRows().at(0).trigger('click'); expect(visitUrl).toHaveBeenCalledWith( joinPaths(`/project/issues/incident`, mockIncidents[0].iid), ); 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 11b9eda2585..e94645c4e1d 100644 --- a/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js +++ b/spec/frontend/incidents_settings/components/incidents_settings_tabs_spec.js @@ -42,16 +42,9 @@ describe('IncidentsSettingTabs', () => { 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); expect( - findIntegrationTabs() - .at(index) - .attributes('title'), - ).toBe(tab.title); - expect( - findIntegrationTabs() - .at(index) - .find(`[data-testid="${tab.component}-tab"]`) - .exists(), + findIntegrationTabs().at(index).find(`[data-testid="${tab.component}-tab"]`).exists(), ).toBe(true); }); }); diff --git a/spec/frontend/integrations/edit/components/dynamic_field_spec.js b/spec/frontend/integrations/edit/components/dynamic_field_spec.js index 53234419f5f..ecd03103992 100644 --- a/spec/frontend/integrations/edit/components/dynamic_field_spec.js +++ b/spec/frontend/integrations/edit/components/dynamic_field_spec.js @@ -37,153 +37,142 @@ describe('DynamicField', () => { const findGlFormTextarea = () => wrapper.find(GlFormTextarea); describe('template', () => { - describe.each([[true, 'disabled', 'readonly'], [false, undefined, undefined]])( - 'dynamic field, when isInheriting = `%p`', - (isInheriting, disabled, readonly) => { - describe('type is checkbox', () => { - beforeEach(() => { - createComponent( - { - type: 'checkbox', - }, - isInheriting, - ); - }); - - it(`renders GlFormCheckbox, which ${isInheriting ? 'is' : 'is not'} disabled`, () => { - expect(findGlFormCheckbox().exists()).toBe(true); - expect( - findGlFormCheckbox() - .find('[type=checkbox]') - .attributes('disabled'), - ).toBe(disabled); - }); + describe.each([ + [true, 'disabled', 'readonly'], + [false, undefined, undefined], + ])('dynamic field, when isInheriting = `%p`', (isInheriting, disabled, readonly) => { + describe('type is checkbox', () => { + beforeEach(() => { + createComponent( + { + type: 'checkbox', + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormSelect().exists()).toBe(false); - expect(findGlFormTextarea().exists()).toBe(false); - expect(findGlFormInput().exists()).toBe(false); - }); + it(`renders GlFormCheckbox, which ${isInheriting ? 'is' : 'is not'} disabled`, () => { + expect(findGlFormCheckbox().exists()).toBe(true); + expect(findGlFormCheckbox().find('[type=checkbox]').attributes('disabled')).toBe( + disabled, + ); }); - describe('type is select', () => { - beforeEach(() => { - createComponent( - { - type: 'select', - choices: [['all', 'All details'], ['standard', 'Standard']], - }, - isInheriting, - ); - }); + it('does not render other types of input', () => { + expect(findGlFormSelect().exists()).toBe(false); + expect(findGlFormTextarea().exists()).toBe(false); + expect(findGlFormInput().exists()).toBe(false); + }); + }); - it(`renders GlFormSelect, which ${isInheriting ? 'is' : 'is not'} disabled`, () => { - expect(findGlFormSelect().exists()).toBe(true); - expect(findGlFormSelect().findAll('option')).toHaveLength(2); - expect( - findGlFormSelect() - .find('select') - .attributes('disabled'), - ).toBe(disabled); - }); + describe('type is select', () => { + beforeEach(() => { + createComponent( + { + type: 'select', + choices: [ + ['all', 'All details'], + ['standard', 'Standard'], + ], + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormCheckbox().exists()).toBe(false); - expect(findGlFormTextarea().exists()).toBe(false); - expect(findGlFormInput().exists()).toBe(false); - }); + it(`renders GlFormSelect, which ${isInheriting ? 'is' : 'is not'} disabled`, () => { + expect(findGlFormSelect().exists()).toBe(true); + expect(findGlFormSelect().findAll('option')).toHaveLength(2); + expect(findGlFormSelect().find('select').attributes('disabled')).toBe(disabled); }); - describe('type is textarea', () => { - beforeEach(() => { - createComponent( - { - type: 'textarea', - }, - isInheriting, - ); - }); + it('does not render other types of input', () => { + expect(findGlFormCheckbox().exists()).toBe(false); + expect(findGlFormTextarea().exists()).toBe(false); + expect(findGlFormInput().exists()).toBe(false); + }); + }); - it(`renders GlFormTextarea, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { - expect(findGlFormTextarea().exists()).toBe(true); - expect( - findGlFormTextarea() - .find('textarea') - .attributes('readonly'), - ).toBe(readonly); - }); + describe('type is textarea', () => { + beforeEach(() => { + createComponent( + { + type: 'textarea', + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormCheckbox().exists()).toBe(false); - expect(findGlFormSelect().exists()).toBe(false); - expect(findGlFormInput().exists()).toBe(false); - }); + it(`renders GlFormTextarea, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { + expect(findGlFormTextarea().exists()).toBe(true); + expect(findGlFormTextarea().find('textarea').attributes('readonly')).toBe(readonly); }); - describe('type is password', () => { - beforeEach(() => { - createComponent( - { - type: 'password', - }, - isInheriting, - ); - }); + it('does not render other types of input', () => { + expect(findGlFormCheckbox().exists()).toBe(false); + expect(findGlFormSelect().exists()).toBe(false); + expect(findGlFormInput().exists()).toBe(false); + }); + }); - it(`renders GlFormInput, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { - expect(findGlFormInput().exists()).toBe(true); - expect(findGlFormInput().attributes('type')).toBe('password'); - expect(findGlFormInput().attributes('readonly')).toBe(readonly); - }); + describe('type is password', () => { + beforeEach(() => { + createComponent( + { + type: 'password', + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormCheckbox().exists()).toBe(false); - expect(findGlFormSelect().exists()).toBe(false); - expect(findGlFormTextarea().exists()).toBe(false); - }); + it(`renders GlFormInput, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { + expect(findGlFormInput().exists()).toBe(true); + expect(findGlFormInput().attributes('type')).toBe('password'); + expect(findGlFormInput().attributes('readonly')).toBe(readonly); }); - describe('type is text', () => { - beforeEach(() => { - createComponent( - { - type: 'text', - required: true, - }, - isInheriting, - ); - }); + it('does not render other types of input', () => { + expect(findGlFormCheckbox().exists()).toBe(false); + expect(findGlFormSelect().exists()).toBe(false); + expect(findGlFormTextarea().exists()).toBe(false); + }); + }); - it(`renders GlFormInput, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { - expect(findGlFormInput().exists()).toBe(true); - expect(findGlFormInput().attributes()).toMatchObject({ + describe('type is text', () => { + beforeEach(() => { + createComponent( + { type: 'text', - id: 'service_project_url', - name: 'service[project_url]', - placeholder: defaultProps.placeholder, - required: 'required', - }); - expect(findGlFormInput().attributes('readonly')).toBe(readonly); - }); + required: true, + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormCheckbox().exists()).toBe(false); - expect(findGlFormSelect().exists()).toBe(false); - expect(findGlFormTextarea().exists()).toBe(false); + it(`renders GlFormInput, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { + expect(findGlFormInput().exists()).toBe(true); + expect(findGlFormInput().attributes()).toMatchObject({ + type: 'text', + id: 'service_project_url', + name: 'service[project_url]', + placeholder: defaultProps.placeholder, + required: 'required', }); + expect(findGlFormInput().attributes('readonly')).toBe(readonly); }); - }, - ); + + it('does not render other types of input', () => { + expect(findGlFormCheckbox().exists()).toBe(false); + expect(findGlFormSelect().exists()).toBe(false); + expect(findGlFormTextarea().exists()).toBe(false); + }); + }); + }); describe('help text', () => { it('renders description with help text', () => { createComponent(); - expect( - findGlFormGroup() - .find('small') - .text(), - ).toBe(defaultProps.help); + expect(findGlFormGroup().find('small').text()).toBe(defaultProps.help); }); it('renders description with help text as HTML', () => { @@ -193,11 +182,7 @@ describe('DynamicField', () => { help: helpHTML, }); - expect( - findGlFormGroup() - .find('small') - .html(), - ).toContain(helpHTML); + expect(findGlFormGroup().find('small').html()).toContain(helpHTML); }); }); @@ -205,11 +190,7 @@ describe('DynamicField', () => { it('renders label with title', () => { createComponent(); - expect( - findGlFormGroup() - .find('label') - .text(), - ).toBe(defaultProps.title); + expect(findGlFormGroup().find('label').text()).toBe(defaultProps.title); }); describe('for password field with some value (hidden by backend)', () => { @@ -219,11 +200,7 @@ describe('DynamicField', () => { value: 'true', }); - expect( - findGlFormGroup() - .find('label') - .text(), - ).toBe(`Enter new ${defaultProps.title}`); + expect(findGlFormGroup().find('label').text()).toBe(`Enter new ${defaultProps.title}`); }); }); }); 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 782930eb6a2..f3827d6f55a 100644 --- a/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js +++ b/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js @@ -57,9 +57,7 @@ describe('JiraTriggerFields', () => { // browsers don't include unchecked boxes in form submissions. it('includes comment settings as false even if unchecked', () => { expect( - findCommentSettings() - .find('input[name="service[comment_on_event_enabled]"]') - .exists(), + findCommentSettings().find('input[name="service[comment_on_event_enabled]"]').exists(), ).toBe(true); }); 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 dd05f49b458..1864888ef49 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,10 +130,7 @@ 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 headingTextAt = index => categorizedHeadings().at(index).text(); const mountComponent = showCategorizedIssues => { wrapper = mount(RelatedIssuesBlock, { propsData: { diff --git a/spec/frontend/issuable/related_issues/components/related_issues_list_spec.js b/spec/frontend/issuable/related_issues/components/related_issues_list_spec.js index 39bc244297b..ffd9683cd6b 100644 --- a/spec/frontend/issuable/related_issues/components/related_issues_list_spec.js +++ b/spec/frontend/issuable/related_issues/components/related_issues_list_spec.js @@ -182,12 +182,7 @@ describe('RelatedIssuesList', () => { }); it('shows due date', () => { - expect( - wrapper - .find(IssueDueDate) - .find('.board-card-info-text') - .text(), - ).toBe('Nov 22, 2010'); + expect(wrapper.find(IssueDueDate).find('.board-card-info-text').text()).toBe('Nov 22, 2010'); }); }); }); diff --git a/spec/frontend/issuable/related_issues/components/related_issues_root_spec.js b/spec/frontend/issuable/related_issues/components/related_issues_root_spec.js index 2c02e1e1de4..93fe321957c 100644 --- a/spec/frontend/issuable/related_issues/components/related_issues_root_spec.js +++ b/spec/frontend/issuable/related_issues/components/related_issues_root_spec.js @@ -315,9 +315,7 @@ describe('RelatedIssuesRoot', () => { const input = 23; wrapper.vm.onInput({ - untouchedRawReferences: String(input) - .trim() - .split(/\s/), + untouchedRawReferences: String(input).trim().split(/\s/), touchedReference: input, }); diff --git a/spec/frontend/issuable_list/components/issuable_item_spec.js b/spec/frontend/issuable_list/components/issuable_item_spec.js index 3a9a0d3fd59..3c01bf2d319 100644 --- a/spec/frontend/issuable_list/components/issuable_item_spec.js +++ b/spec/frontend/issuable_list/components/issuable_item_spec.js @@ -252,12 +252,9 @@ describe('IssuableItem', () => { await wrapper.vm.$nextTick(); - expect( - wrapper - .find('[data-testid="issuable-title"]') - .find(GlLink) - .attributes('target'), - ).toBe('_blank'); + expect(wrapper.find('[data-testid="issuable-title"]').find(GlLink).attributes('target')).toBe( + '_blank', + ); }); it('renders issuable reference', () => { diff --git a/spec/frontend/issuable_show/components/issuable_body_spec.js b/spec/frontend/issuable_show/components/issuable_body_spec.js index 5708eaf4a31..65bace1ce3f 100644 --- a/spec/frontend/issuable_show/components/issuable_body_spec.js +++ b/spec/frontend/issuable_show/components/issuable_body_spec.js @@ -98,10 +98,7 @@ describe('IssuableBody', () => { it('renders issuable edit info', () => { const editedEl = wrapper.find('small'); - const sanitizedText = editedEl - .text() - .replace(/\n/g, ' ') - .replace(/\s+/g, ' '); + const sanitizedText = editedEl.text().replace(/\n/g, ' ').replace(/\s+/g, ' '); expect(sanitizedText).toContain('Edited'); expect(sanitizedText).toContain('ago'); diff --git a/spec/frontend/issuable_suggestions/components/app_spec.js b/spec/frontend/issuable_suggestions/components/app_spec.js index 0cb5b9c90ba..fb8ef00567c 100644 --- a/spec/frontend/issuable_suggestions/components/app_spec.js +++ b/spec/frontend/issuable_suggestions/components/app_spec.js @@ -85,12 +85,7 @@ describe('Issuable suggestions app component', () => { wrapper.setData(data); return wrapper.vm.$nextTick(() => { - expect( - wrapper - .findAll('li') - .at(0) - .classes(), - ).toContain('gl-mb-3'); + expect(wrapper.findAll('li').at(0).classes()).toContain('gl-mb-3'); }); }); @@ -98,12 +93,7 @@ describe('Issuable suggestions app component', () => { wrapper.setData(data); return wrapper.vm.$nextTick(() => { - expect( - wrapper - .findAll('li') - .at(1) - .classes(), - ).not.toContain('gl-mb-3'); + expect(wrapper.findAll('li').at(1).classes()).not.toContain('gl-mb-3'); }); }); }); diff --git a/spec/frontend/issue_show/components/header_actions_spec.js b/spec/frontend/issue_show/components/header_actions_spec.js index b9836ae7240..8af99cd5a31 100644 --- a/spec/frontend/issue_show/components/header_actions_spec.js +++ b/spec/frontend/issue_show/components/header_actions_spec.js @@ -70,10 +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 = {}, diff --git a/spec/frontend/issue_show/components/pinned_links_spec.js b/spec/frontend/issue_show/components/pinned_links_spec.js index bb67feee601..74a0b39a852 100644 --- a/spec/frontend/issue_show/components/pinned_links_spec.js +++ b/spec/frontend/issue_show/components/pinned_links_spec.js @@ -26,11 +26,7 @@ describe('PinnedLinks', () => { zoomMeetingUrl: `<a href="${plainZoomUrl}">Zoom</a>`, }); - expect( - findButtons() - .at(0) - .text(), - ).toBe(JOIN_ZOOM_MEETING); + expect(findButtons().at(0).text()).toBe(JOIN_ZOOM_MEETING); }); it('displays Status link', () => { @@ -38,11 +34,7 @@ describe('PinnedLinks', () => { publishedIncidentUrl: `<a href="${plainStatusUrl}">Status</a>`, }); - expect( - findButtons() - .at(0) - .text(), - ).toBe(STATUS_PAGE_PUBLISHED); + expect(findButtons().at(0).text()).toBe(STATUS_PAGE_PUBLISHED); }); it('does not render if there are no links', () => { 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 1f80b4fc54a..c14d78322e8 100644 --- a/spec/frontend/issues_list/components/issuables_list_app_spec.js +++ b/spec/frontend/issues_list/components/issuables_list_app_spec.js @@ -238,15 +238,15 @@ describe('Issuables list component', () => { wrapper.vm.onSelectIssuable({ issuable: i0, selected: false }); expect(wrapper.vm.selection).toEqual({}); wrapper.vm.onSelectIssuable({ issuable: i1, selected: true }); - expect(wrapper.vm.selection).toEqual({ '1': true }); + expect(wrapper.vm.selection).toEqual({ 1: true }); wrapper.vm.onSelectIssuable({ issuable: i0, selected: true }); - expect(wrapper.vm.selection).toEqual({ '1': true, '0': true }); + expect(wrapper.vm.selection).toEqual({ 1: true, 0: true }); wrapper.vm.onSelectIssuable({ issuable: i2, selected: true }); - expect(wrapper.vm.selection).toEqual({ '1': true, '0': true, '2': true }); + expect(wrapper.vm.selection).toEqual({ 1: true, 0: true, 2: true }); wrapper.vm.onSelectIssuable({ issuable: i2, selected: true }); - expect(wrapper.vm.selection).toEqual({ '1': true, '0': true, '2': true }); + expect(wrapper.vm.selection).toEqual({ 1: true, 0: true, 2: true }); wrapper.vm.onSelectIssuable({ issuable: i0, selected: false }); - expect(wrapper.vm.selection).toEqual({ '1': true, '2': true }); + expect(wrapper.vm.selection).toEqual({ 1: true, 2: true }); }); it('broadcasts a message to the bulk edit sidebar when a value is added to selection', () => { diff --git a/spec/frontend/jobs/components/empty_state_spec.js b/spec/frontend/jobs/components/empty_state_spec.js index 29d0c4e07aa..f9a6afe0770 100644 --- a/spec/frontend/jobs/components/empty_state_spec.js +++ b/spec/frontend/jobs/components/empty_state_spec.js @@ -46,11 +46,7 @@ describe('Empty State', () => { }); it('renders provided title', () => { - expect( - findTitle() - .text() - .trim(), - ).toBe(defaultProps.title); + expect(findTitle().text().trim()).toBe(defaultProps.title); }); }); @@ -60,11 +56,7 @@ describe('Empty State', () => { }); it('renders content', () => { - expect( - findContent() - .text() - .trim(), - ).toBe(content); + expect(findContent().text().trim()).toBe(content); }); }); diff --git a/spec/frontend/jobs/components/job_app_spec.js b/spec/frontend/jobs/components/job_app_spec.js index 94653d4d4c7..d5fa158806f 100644 --- a/spec/frontend/jobs/components/job_app_spec.js +++ b/spec/frontend/jobs/components/job_app_spec.js @@ -133,13 +133,9 @@ describe('Job App', () => { }); it('should render provided job information', () => { - expect( - wrapper - .find('.header-main-content') - .text() - .replace(/\s+/g, ' ') - .trim(), - ).toContain('passed Job #4757 triggered 1 year ago by Root'); + expect(wrapper.find('.header-main-content').text().replace(/\s+/g, ' ').trim()).toContain( + 'passed Job #4757 triggered 1 year ago by Root', + ); }); it('should render new issue link', () => { @@ -151,11 +147,7 @@ describe('Job App', () => { it('should render created key', () => setupAndMount().then(() => { expect( - wrapper - .find('.header-main-content') - .text() - .replace(/\s+/g, ' ') - .trim(), + wrapper.find('.header-main-content').text().replace(/\s+/g, ' ').trim(), ).toContain('passed Job #4757 created 3 weeks ago by Root'); })); }); diff --git a/spec/frontend/jobs/components/log/line_spec.js b/spec/frontend/jobs/components/log/line_spec.js index 914ae2424c8..a127ee98c2a 100644 --- a/spec/frontend/jobs/components/log/line_spec.js +++ b/spec/frontend/jobs/components/log/line_spec.js @@ -34,10 +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/log/log_spec.js b/spec/frontend/jobs/components/log/log_spec.js index 015d5e01a46..f662ffa1780 100644 --- a/spec/frontend/jobs/components/log/log_spec.js +++ b/spec/frontend/jobs/components/log/log_spec.js @@ -62,11 +62,7 @@ describe('Job Log', () => { }); it('renders an icon with the open state', () => { - expect( - findCollapsibleLine() - .find('[data-testid="angle-down-icon"]') - .exists(), - ).toBe(true); + expect(findCollapsibleLine().find('[data-testid="angle-down-icon"]').exists()).toBe(true); }); describe('on click header section', () => { diff --git a/spec/frontend/lib/utils/chart_utils_spec.js b/spec/frontend/lib/utils/chart_utils_spec.js index e811b8405fb..65bb68c5017 100644 --- a/spec/frontend/lib/utils/chart_utils_spec.js +++ b/spec/frontend/lib/utils/chart_utils_spec.js @@ -3,7 +3,11 @@ import { firstAndLastY } from '~/lib/utils/chart_utils'; describe('Chart utils', () => { describe('firstAndLastY', () => { it('returns the first and last y-values of a given data set as an array', () => { - const data = [['', 1], ['', 2], ['', 3]]; + const data = [ + ['', 1], + ['', 2], + ['', 3], + ]; expect(firstAndLastY(data)).toEqual([1, 3]); }); diff --git a/spec/frontend/line_highlighter_spec.js b/spec/frontend/line_highlighter_spec.js index 0da1ea1df2d..dd4f85deccd 100644 --- a/spec/frontend/line_highlighter_spec.js +++ b/spec/frontend/line_highlighter_spec.js @@ -88,9 +88,7 @@ describe('LineHighlighter', () => { describe('clickHandler', () => { it('handles clicking on a child icon element', () => { const spy = jest.spyOn(testContext.class, 'setHash'); - $('#L13 i') - .mousedown() - .click(); + $('#L13 i').mousedown().click(); expect(spy).toHaveBeenCalledWith(13); expect($('#LC13')).toHaveClass(testContext.css); diff --git a/spec/frontend/logs/components/environment_logs_spec.js b/spec/frontend/logs/components/environment_logs_spec.js index e32deaea993..74e924a8f6e 100644 --- a/spec/frontend/logs/components/environment_logs_spec.js +++ b/spec/frontend/logs/components/environment_logs_spec.js @@ -181,11 +181,7 @@ describe('EnvironmentLogs', () => { it('shows a logs trace', () => { expect(findLogTrace().text()).toBe(''); - expect( - findLogTrace() - .find('.js-build-loader-animation') - .isVisible(), - ).toBe(true); + expect(findLogTrace().find('.js-build-loader-animation').isVisible()).toBe(true); }); }); diff --git a/spec/frontend/matchers.js b/spec/frontend/matchers.js index 50feba86a61..3db5aba2758 100644 --- a/spec/frontend/matchers.js +++ b/spec/frontend/matchers.js @@ -40,10 +40,7 @@ export default { let clearMatch; try { - clearReceived = received - .replace(/\s\s+/gm, ' ') - .replace(/\s\./gm, '.') - .trim(); + clearReceived = received.replace(/\s\s+/gm, ' ').replace(/\s\./gm, '.').trim(); } catch (e) { return { actual: received, message: 'The received value is not a string', pass: false }; } diff --git a/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js b/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js index a48942dd277..05ea0dc2886 100644 --- a/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js +++ b/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js @@ -57,10 +57,8 @@ describe('ResendInviteButton', () => { it('displays form with correct action and inputs', () => { expect(findForm().attributes('action')).toBe('/groups/foo-bar/-/group_members/1/resend_invite'); - expect( - findForm() - .find('input[name="authenticity_token"]') - .attributes('value'), - ).toBe('mock-csrf-token'); + expect(findForm().find('input[name="authenticity_token"]').attributes('value')).toBe( + 'mock-csrf-token', + ); }); }); 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 ca885000c2f..37f5333343a 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 @@ -86,7 +86,10 @@ describe('MembersFilteredSearchBar', () => { token: GlFilteredSearchToken, unique: true, operators: [{ value: '=', description: 'is' }], - options: [{ value: 'exclude', title: 'Direct' }, { value: 'only', title: 'Inherited' }], + options: [ + { value: 'exclude', title: 'Direct' }, + { value: 'only', title: 'Inherited' }, + ], }, ]); }); diff --git a/spec/frontend/members/components/table/expiration_datepicker_spec.js b/spec/frontend/members/components/table/expiration_datepicker_spec.js index ba1b2256e76..7319989e1d9 100644 --- a/spec/frontend/members/components/table/expiration_datepicker_spec.js +++ b/spec/frontend/members/components/table/expiration_datepicker_spec.js @@ -72,11 +72,9 @@ describe('ExpirationDatepicker', () => { }); it('sets `minDate` prop as tomorrow', () => { - expect( - findDatepicker() - .props('minDate') - .toISOString(), - ).toBe(new Date('2020-3-16').toISOString()); + expect(findDatepicker().props('minDate').toISOString()).toBe( + new Date('2020-3-16').toISOString(), + ); }); it('sets `target` prop as `null` so datepicker opens on focus', () => { diff --git a/spec/frontend/members/components/table/members_table_spec.js b/spec/frontend/members/components/table/members_table_spec.js index 9945cc7ee57..728853b585b 100644 --- a/spec/frontend/members/components/table/members_table_spec.js +++ b/spec/frontend/members/components/table/members_table_spec.js @@ -100,10 +100,7 @@ describe('MembersTable', () => { if (expectedComponent) { expect( - wrapper - .find(`[data-label="${label}"][role="cell"]`) - .find(expectedComponent) - .exists(), + wrapper.find(`[data-label="${label}"][role="cell"]`).find(expectedComponent).exists(), ).toBe(true); } }); @@ -117,10 +114,7 @@ describe('MembersTable', () => { expect(actionField.exists()).toBe(true); expect(actionField.classes('gl-sr-only')).toBe(true); expect( - wrapper - .find(`[data-label="Actions"][role="cell"]`) - .find(MemberActionButtons) - .exists(), + wrapper.find(`[data-label="Actions"][role="cell"]`).find(MemberActionButtons).exists(), ).toBe(true); }); @@ -177,12 +171,9 @@ describe('MembersTable', () => { it('renders badge in "Max role" field', () => { createComponent({ members: [memberMock], tableFields: ['maxRole'] }); - expect( - wrapper - .find(`[data-label="Max role"][role="cell"]`) - .find(GlBadge) - .text(), - ).toBe(memberMock.accessLevel.stringValue); + expect(wrapper.find(`[data-label="Max role"][role="cell"]`).find(GlBadge).text()).toBe( + memberMock.accessLevel.stringValue, + ); }); }); @@ -203,10 +194,6 @@ describe('MembersTable', () => { it('adds QA selector to table row', () => { createComponent(); - expect( - findTable() - .find('tbody tr') - .attributes('data-qa-selector'), - ).toBe('member_row'); + expect(findTable().find('tbody tr').attributes('data-qa-selector')).toBe('member_row'); }); }); diff --git a/spec/frontend/merge_request_spec.js b/spec/frontend/merge_request_spec.js index 1cb7206b97f..4f9e063a0e1 100644 --- a/spec/frontend/merge_request_spec.js +++ b/spec/frontend/merge_request_spec.js @@ -32,10 +32,7 @@ describe('MergeRequest', () => { jest.spyOn($, 'ajax').mockImplementation(); const changeEvent = document.createEvent('HTMLEvents'); changeEvent.initEvent('change', true, true); - $('input[type=checkbox]') - .first() - .attr('checked', true)[0] - .dispatchEvent(changeEvent); + $('input[type=checkbox]').first().attr('checked', true)[0].dispatchEvent(changeEvent); setImmediate(() => { expect($('.js-task-list-field').val()).toBe( '- [x] Task List Item\n- [ ]\n- [ ] Task List Item 2\n', @@ -49,10 +46,7 @@ describe('MergeRequest', () => { jest.spyOn($, 'ajax').mockImplementation(); const changeEvent = document.createEvent('HTMLEvents'); changeEvent.initEvent('change', true, true); - $('input[type=checkbox]') - .last() - .attr('checked', true)[0] - .dispatchEvent(changeEvent); + $('input[type=checkbox]').last().attr('checked', true)[0].dispatchEvent(changeEvent); setImmediate(() => { expect($('.js-task-list-field').val()).toBe( '- [ ] Task List Item\n- [ ]\n- [x] Task List Item 2\n', diff --git a/spec/frontend/milestones/milestone_combobox_spec.js b/spec/frontend/milestones/milestone_combobox_spec.js index 047484f117f..c7a123f7d99 100644 --- a/spec/frontend/milestones/milestone_combobox_spec.js +++ b/spec/frontend/milestones/milestone_combobox_spec.js @@ -336,9 +336,7 @@ describe('Milestone combobox component', () => { await localVue.nextTick(); expect( - findFirstProjectMilestonesDropdownItem() - .find('span') - .classes('selected-item'), + findFirstProjectMilestonesDropdownItem().find('span').classes('selected-item'), ).toBe(false); selectFirstProjectMilestone(); @@ -346,9 +344,7 @@ describe('Milestone combobox component', () => { await localVue.nextTick(); expect( - findFirstProjectMilestonesDropdownItem() - .find('span') - .classes('selected-item'), + findFirstProjectMilestonesDropdownItem().find('span').classes('selected-item'), ).toBe(true); }); @@ -465,21 +461,17 @@ describe('Milestone combobox component', () => { await localVue.nextTick(); - expect( - findFirstGroupMilestonesDropdownItem() - .find('span') - .classes('selected-item'), - ).toBe(false); + expect(findFirstGroupMilestonesDropdownItem().find('span').classes('selected-item')).toBe( + false, + ); selectFirstGroupMilestone(); await localVue.nextTick(); - expect( - findFirstGroupMilestonesDropdownItem() - .find('span') - .classes('selected-item'), - ).toBe(true); + expect(findFirstGroupMilestonesDropdownItem().find('span').classes('selected-item')).toBe( + true, + ); }); describe('when a group milestones is selected', () => { diff --git a/spec/frontend/monitoring/alert_widget_spec.js b/spec/frontend/monitoring/alert_widget_spec.js index d004b1da0b6..e66c389a4ab 100644 --- a/spec/frontend/monitoring/alert_widget_spec.js +++ b/spec/frontend/monitoring/alert_widget_spec.js @@ -28,12 +28,20 @@ describe('AlertWidget', () => { const nonFiringAlertResult = [ { - values: [[0, 1], [1, 42], [2, 41]], + values: [ + [0, 1], + [1, 42], + [2, 41], + ], }, ]; const firingAlertResult = [ { - values: [[0, 42], [1, 43], [2, 44]], + values: [ + [0, 42], + [1, 43], + [2, 44], + ], }, ]; const metricId = '5'; @@ -88,10 +96,7 @@ describe('AlertWidget', () => { const findWidgetForm = () => wrapper.find({ ref: 'widgetForm' }); const findAlertErrorMessage = () => wrapper.find({ ref: 'alertErrorMessage' }); const findCurrentSettingsText = () => - wrapper - .find({ ref: 'alertCurrentSetting' }) - .text() - .replace(/\s\s+/g, ' '); + wrapper.find({ ref: 'alertCurrentSetting' }).text().replace(/\s\s+/g, ' '); const findBadge = () => wrapper.find(GlBadge); const findTooltip = () => wrapper.find(GlTooltip); @@ -300,11 +305,7 @@ describe('AlertWidget', () => { createComponent(propsWithManyAlerts); return waitForPromises().then(() => { - expect( - findTooltip() - .text() - .replace(/\s\s+/g, ' '), - ).toEqual('Firing: alert-label > 42'); + expect(findTooltip().text().replace(/\s\s+/g, ' ')).toEqual('Firing: alert-label > 42'); }); }); }); diff --git a/spec/frontend/monitoring/components/dashboard_panel_spec.js b/spec/frontend/monitoring/components/dashboard_panel_spec.js index 1808faf8f0e..0936e390770 100644 --- a/spec/frontend/monitoring/components/dashboard_panel_spec.js +++ b/spec/frontend/monitoring/components/dashboard_panel_spec.js @@ -777,11 +777,7 @@ describe('Dashboard Panel', () => { await wrapper.vm.$nextTick(); expect(findRunbookLinks().length).toBe(1); - expect( - findRunbookLinks() - .at(0) - .attributes('href'), - ).toBe(invalidUrl); + expect(findRunbookLinks().at(0).attributes('href')).toBe(invalidUrl); }); }); }); diff --git a/spec/frontend/monitoring/components/dashboard_spec.js b/spec/frontend/monitoring/components/dashboard_spec.js index 27e479ba498..0552d1621bf 100644 --- a/spec/frontend/monitoring/components/dashboard_spec.js +++ b/spec/frontend/monitoring/components/dashboard_spec.js @@ -587,12 +587,9 @@ describe('Dashboard', () => { }); it('group empty area displays a NO_DATA state', () => { - expect( - wrapper - .findAll({ ref: 'empty-group' }) - .at(0) - .props('selectedState'), - ).toEqual(metricStates.NO_DATA); + expect(wrapper.findAll({ ref: 'empty-group' }).at(0).props('selectedState')).toEqual( + metricStates.NO_DATA, + ); }); }); @@ -634,9 +631,7 @@ describe('Dashboard', () => { describe('when rearrange button is clicked', () => { const findFirstDraggableRemoveButton = () => - findDraggablePanels() - .at(0) - .find('.js-draggable-remove'); + findDraggablePanels().at(0).find('.js-draggable-remove'); beforeEach(() => { findRearrangeButton().vm.$emit('click'); @@ -668,11 +663,7 @@ describe('Dashboard', () => { }); it('shows a remove button, which removes a panel', () => { - expect( - findFirstDraggableRemoveButton() - .find('a') - .exists(), - ).toBe(true); + expect(findFirstDraggableRemoveButton().find('a').exists()).toBe(true); expect(findDraggablePanels().length).toEqual(metricsDashboardPanelCount); findFirstDraggableRemoveButton().trigger('click'); @@ -772,10 +763,7 @@ describe('Dashboard', () => { const panelIndex = 1; // skip expanded panel const getClipboardTextFirstPanel = () => - wrapper - .findAll(DashboardPanel) - .at(panelIndex) - .props('clipboardText'); + wrapper.findAll(DashboardPanel).at(panelIndex).props('clipboardText'); beforeEach(() => { setupStoreWithData(store); diff --git a/spec/frontend/monitoring/components/duplicate_dashboard_modal_spec.js b/spec/frontend/monitoring/components/duplicate_dashboard_modal_spec.js index d8ffb4443ac..442269d93fa 100644 --- a/spec/frontend/monitoring/components/duplicate_dashboard_modal_spec.js +++ b/spec/frontend/monitoring/components/duplicate_dashboard_modal_spec.js @@ -101,9 +101,7 @@ describe('duplicate dashboard modal', () => { commitMessage: 'A commit message', }; - findModal() - .find(DuplicateDashboardForm) - .vm.$emit('change', formVals); + findModal().find(DuplicateDashboardForm).vm.$emit('change', formVals); // Binding's second argument contains the modal id expect(wrapper.vm.form).toEqual(formVals); diff --git a/spec/frontend/monitoring/components/variables/dropdown_field_spec.js b/spec/frontend/monitoring/components/variables/dropdown_field_spec.js index cc384aef231..690df5045ae 100644 --- a/spec/frontend/monitoring/components/variables/dropdown_field_spec.js +++ b/spec/frontend/monitoring/components/variables/dropdown_field_spec.js @@ -10,7 +10,10 @@ describe('Custom variable component', () => { label: 'Select environment', value: 'Production', options: { - values: [{ text: 'Production', value: 'prod' }, { text: 'Canary', value: 'canary' }], + values: [ + { text: 'Production', value: 'prod' }, + { text: 'Canary', value: 'canary' }, + ], }, }; @@ -54,9 +57,7 @@ describe('Custom variable component', () => { createShallowWrapper(); jest.spyOn(wrapper.vm, '$emit'); - findDropdownItems() - .at(1) - .vm.$emit('click'); + findDropdownItems().at(1).vm.$emit('click'); return wrapper.vm.$nextTick(() => { expect(wrapper.vm.$emit).toHaveBeenCalledWith('input', 'canary'); diff --git a/spec/frontend/monitoring/router_spec.js b/spec/frontend/monitoring/router_spec.js index 8b97c8ed125..c30c4c56a6c 100644 --- a/spec/frontend/monitoring/router_spec.js +++ b/spec/frontend/monitoring/router_spec.js @@ -63,12 +63,7 @@ describe('Monitoring router', () => { }); expect(wrapper.find(DashboardPage).exists()).toBe(true); - expect( - wrapper - .find(DashboardPage) - .find(Dashboard) - .exists(), - ).toBe(true); + expect(wrapper.find(DashboardPage).find(Dashboard).exists()).toBe(true); }); }); @@ -91,12 +86,7 @@ describe('Monitoring router', () => { }); expect(wrapper.find(DashboardPage).exists()).toBe(true); - expect( - wrapper - .find(DashboardPage) - .find(Dashboard) - .exists(), - ).toBe(true); + expect(wrapper.find(DashboardPage).find(Dashboard).exists()).toBe(true); }); }); diff --git a/spec/frontend/monitoring/store/mutations_spec.js b/spec/frontend/monitoring/store/mutations_spec.js index 8d1351fc909..984e52e7bef 100644 --- a/spec/frontend/monitoring/store/mutations_spec.js +++ b/spec/frontend/monitoring/store/mutations_spec.js @@ -465,7 +465,10 @@ describe('Monitoring mutations', () => { }); expect(variable.options).toEqual({ - values: [{ text: 'prometheus', value: 'prometheus' }, { text: 'node', value: 'node' }], + values: [ + { text: 'prometheus', value: 'prometheus' }, + { text: 'node', value: 'node' }, + ], }); }); }); diff --git a/spec/frontend/monitoring/store/utils_spec.js b/spec/frontend/monitoring/store/utils_spec.js index b97948fa1bf..80b15e76879 100644 --- a/spec/frontend/monitoring/store/utils_spec.js +++ b/spec/frontend/monitoring/store/utils_spec.js @@ -775,7 +775,11 @@ describe('normalizeQueryResponseData', () => { job: 'prometheus', instance: 'localhost:9090', }, - values: [[1435781430.781, '1'], [1435781445.781, '2'], [1435781460.781, '3']], + values: [ + [1435781430.781, '1'], + [1435781445.781, '2'], + [1435781460.781, '3'], + ], }, { metric: { @@ -783,7 +787,11 @@ describe('normalizeQueryResponseData', () => { job: 'node', instance: 'localhost:9091', }, - values: [[1435781430.781, '4'], [1435781445.781, '5'], [1435781460.781, '6']], + values: [ + [1435781430.781, '4'], + [1435781445.781, '5'], + [1435781460.781, '6'], + ], }, ], }; @@ -840,7 +848,10 @@ describe('normalizeQueryResponseData', () => { job: 'prometheus', instance: 'localhost:9090', }, - values: [[1435781430.781, '1'], [1435781460.781, 'NaN']], + values: [ + [1435781430.781, '1'], + [1435781460.781, 'NaN'], + ], }, ], }; @@ -849,7 +860,10 @@ describe('normalizeQueryResponseData', () => { { metric: { __name__: 'up', instance: 'localhost:9090', job: 'prometheus' }, value: ['2015-07-01T20:11:00.781Z', NaN], - values: [['2015-07-01T20:10:30.781Z', 1], ['2015-07-01T20:11:00.781Z', NaN]], + values: [ + ['2015-07-01T20:10:30.781Z', 1], + ['2015-07-01T20:11:00.781Z', NaN], + ], }, ]); }); diff --git a/spec/frontend/new_branch_spec.js b/spec/frontend/new_branch_spec.js index cff7ec1a9ee..a28daa653b0 100644 --- a/spec/frontend/new_branch_spec.js +++ b/spec/frontend/new_branch_spec.js @@ -12,9 +12,7 @@ describe('Branch', () => { preloadFixtures('branches/new_branch.html'); function fillNameWith(value) { - $('.js-branch-name') - .val(value) - .trigger('blur'); + $('.js-branch-name').val(value).trigger('blur'); } function expectToHaveError(error) { diff --git a/spec/frontend/notes/components/discussion_actions_spec.js b/spec/frontend/notes/components/discussion_actions_spec.js index b26eb00bfdc..32ebcd13b8a 100644 --- a/spec/frontend/notes/components/discussion_actions_spec.js +++ b/spec/frontend/notes/components/discussion_actions_spec.js @@ -117,19 +117,13 @@ describe('DiscussionActions', () => { it('emits showReplyForm event when clicking on reply placeholder', () => { jest.spyOn(wrapper.vm, '$emit'); - wrapper - .find(ReplyPlaceholder) - .find('button') - .trigger('click'); + wrapper.find(ReplyPlaceholder).find('button').trigger('click'); expect(wrapper.vm.$emit).toHaveBeenCalledWith('showReplyForm'); }); it('emits resolve event when clicking on resolve button', () => { jest.spyOn(wrapper.vm, '$emit'); - wrapper - .find(ResolveDiscussionButton) - .find('button') - .trigger('click'); + wrapper.find(ResolveDiscussionButton).find('button').trigger('click'); expect(wrapper.vm.$emit).toHaveBeenCalledWith('resolve'); }); }); diff --git a/spec/frontend/notes/components/discussion_filter_note_spec.js b/spec/frontend/notes/components/discussion_filter_note_spec.js index d35f8f7c28d..9ae3f08df77 100644 --- a/spec/frontend/notes/components/discussion_filter_note_spec.js +++ b/spec/frontend/notes/components/discussion_filter_note_spec.js @@ -31,20 +31,14 @@ describe('DiscussionFilterNote component', () => { it('emits `dropdownSelect` event with 0 parameter on clicking Show all activity button', () => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); - wrapper - .findAll(GlButton) - .at(0) - .vm.$emit('click'); + wrapper.findAll(GlButton).at(0).vm.$emit('click'); expect(eventHub.$emit).toHaveBeenCalledWith('dropdownSelect', 0); }); it('emits `dropdownSelect` event with 1 parameter on clicking Show comments only button', () => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); - wrapper - .findAll(GlButton) - .at(1) - .vm.$emit('click'); + wrapper.findAll(GlButton).at(1).vm.$emit('click'); expect(eventHub.$emit).toHaveBeenCalledWith('dropdownSelect', 1); }); diff --git a/spec/frontend/notes/components/discussion_filter_spec.js b/spec/frontend/notes/components/discussion_filter_spec.js index 9f3655c53b9..0ac60efa45b 100644 --- a/spec/frontend/notes/components/discussion_filter_spec.js +++ b/spec/frontend/notes/components/discussion_filter_spec.js @@ -82,12 +82,9 @@ describe('DiscussionFilter component', () => { }); it('renders the default selected item', () => { - expect( - wrapper - .find('#discussion-filter-dropdown .dropdown-item') - .text() - .trim(), - ).toBe(discussionFiltersMock[0].title); + expect(wrapper.find('#discussion-filter-dropdown .dropdown-item').text().trim()).toBe( + discussionFiltersMock[0].title, + ); }); it('updates to the selected item', () => { diff --git a/spec/frontend/notes/components/note_actions_spec.js b/spec/frontend/notes/components/note_actions_spec.js index f01c6c6b84e..2965d3d3adc 100644 --- a/spec/frontend/notes/components/note_actions_spec.js +++ b/spec/frontend/notes/components/note_actions_spec.js @@ -65,23 +65,11 @@ describe('noteActions', () => { }); it('should render noteable author badge', () => { - expect( - wrapper - .findAll('.note-role') - .at(0) - .text() - .trim(), - ).toEqual('Author'); + expect(wrapper.findAll('.note-role').at(0).text().trim()).toEqual('Author'); }); it('should render access level badge', () => { - expect( - wrapper - .findAll('.note-role') - .at(1) - .text() - .trim(), - ).toEqual(props.accessLevel); + expect(wrapper.findAll('.note-role').at(1).text().trim()).toEqual(props.accessLevel); }); it('should render contributor badge', () => { @@ -91,13 +79,7 @@ describe('noteActions', () => { }); return wrapper.vm.$nextTick().then(() => { - expect( - wrapper - .findAll('.note-role') - .at(1) - .text() - .trim(), - ).toBe('Contributor'); + expect(wrapper.findAll('.note-role').at(1).text().trim()).toBe('Contributor'); }); }); diff --git a/spec/frontend/notes/components/note_form_spec.js b/spec/frontend/notes/components/note_form_spec.js index cc434d6c952..c48c72c63de 100644 --- a/spec/frontend/notes/components/note_form_spec.js +++ b/spec/frontend/notes/components/note_form_spec.js @@ -91,12 +91,7 @@ describe('issue_note_form component', () => { const conflictWarning = wrapper.find('.js-conflict-edit-warning'); expect(conflictWarning.exists()).toBe(true); - expect( - conflictWarning - .text() - .replace(/\s+/g, ' ') - .trim(), - ).toBe(message); + expect(conflictWarning.text().replace(/\s+/g, ' ').trim()).toBe(message); }); }); }); diff --git a/spec/frontend/notes/components/notes_app_spec.js b/spec/frontend/notes/components/notes_app_spec.js index e905a12919e..2e01fa887ae 100644 --- a/spec/frontend/notes/components/notes_app_spec.js +++ b/spec/frontend/notes/components/notes_app_spec.js @@ -129,12 +129,9 @@ describe('note_app', () => { '/gitlab-org/gitlab-foss/issues/26/discussions.json' ][0].notes[0]; - expect( - wrapper - .find('.main-notes-list .note-header-author-name') - .text() - .trim(), - ).toEqual(note.author.name); + expect(wrapper.find('.main-notes-list .note-header-author-name').text().trim()).toEqual( + note.author.name, + ); expect(wrapper.find('.main-notes-list .note-text').html()).toContain(note.note_html); }); @@ -272,23 +269,15 @@ describe('note_app', () => { it('should render markdown docs url', () => { const { markdownDocsPath } = mockData.notesDataMock; - expect( - wrapper - .find(`a[href="${markdownDocsPath}"]`) - .text() - .trim(), - ).toEqual('Markdown'); + expect(wrapper.find(`a[href="${markdownDocsPath}"]`).text().trim()).toEqual('Markdown'); }); it('should render quick action docs url', () => { const { quickActionsDocsPath } = mockData.notesDataMock; - expect( - wrapper - .find(`a[href="${quickActionsDocsPath}"]`) - .text() - .trim(), - ).toEqual('quick actions'); + expect(wrapper.find(`a[href="${quickActionsDocsPath}"]`).text().trim()).toEqual( + 'quick actions', + ); }); }); @@ -304,12 +293,9 @@ describe('note_app', () => { const { markdownDocsPath } = mockData.notesDataMock; return Vue.nextTick().then(() => { - expect( - wrapper - .find(`.edit-note a[href="${markdownDocsPath}"]`) - .text() - .trim(), - ).toEqual('Markdown is supported'); + expect(wrapper.find(`.edit-note a[href="${markdownDocsPath}"]`).text().trim()).toEqual( + 'Markdown is supported', + ); }); }); diff --git a/spec/frontend/notes/old_notes_spec.js b/spec/frontend/notes/old_notes_spec.js index dee4f93f0ce..39c80e111ed 100644 --- a/spec/frontend/notes/old_notes_spec.js +++ b/spec/frontend/notes/old_notes_spec.js @@ -82,9 +82,7 @@ describe.skip('Old Notes (~/notes.js)', () => { it('modifies the Markdown field', () => { const changeEvent = document.createEvent('HTMLEvents'); changeEvent.initEvent('change', true, true); - $('input[type=checkbox]') - .attr('checked', true)[0] - .dispatchEvent(changeEvent); + $('input[type=checkbox]').attr('checked', true)[0].dispatchEvent(changeEvent); expect($('.js-task-list-field.original-task-list').val()).toBe('- [x] Task List Item'); }); @@ -746,12 +744,7 @@ describe.skip('Old Notes (~/notes.js)', () => { .find(`#note_${note.id}`) .find('.js-task-list-container'); - expect( - $updatedNoteEl - .find('.note-text') - .text() - .trim(), - ).toEqual(''); + expect($updatedNoteEl.find('.note-text').text().trim()).toEqual(''); done(); }); @@ -912,26 +905,15 @@ describe.skip('Old Notes (~/notes.js)', () => { expect($tempNote.find('.timeline-icon .avatar').attr('src')).toEqual(currentUserAvatar); expect($tempNote.find('.timeline-content').hasClass('discussion')).toBeFalsy(); - expect( - $tempNoteHeader - .find('.d-none.d-sm-inline-block') - .text() - .trim(), - ).toEqual(currentUserFullname); - - expect( - $tempNoteHeader - .find('.note-headline-light') - .text() - .trim(), - ).toEqual(`@${currentUsername}`); - - expect( - $tempNote - .find('.note-body .note-text p') - .text() - .trim(), - ).toEqual(sampleComment); + expect($tempNoteHeader.find('.d-none.d-sm-inline-block').text().trim()).toEqual( + currentUserFullname, + ); + + expect($tempNoteHeader.find('.note-headline-light').text().trim()).toEqual( + `@${currentUsername}`, + ); + + expect($tempNote.find('.note-body .note-text p').text().trim()).toEqual(sampleComment); }); it('should return constructed placeholder element for discussion note based on form contents', () => { @@ -959,12 +941,9 @@ describe.skip('Old Notes (~/notes.js)', () => { }); const $tempNoteHeader = $tempNote.find('.note-header'); - expect( - $tempNoteHeader - .find('.d-none.d-sm-inline-block') - .text() - .trim(), - ).toEqual('Foo <script>alert("XSS")</script>'); + expect($tempNoteHeader.find('.d-none.d-sm-inline-block').text().trim()).toEqual( + 'Foo <script>alert("XSS")</script>', + ); }); }); @@ -987,12 +966,7 @@ describe.skip('Old Notes (~/notes.js)', () => { expect($tempNote.attr('id')).toEqual(uniqueId); expect($tempNote.hasClass('being-posted')).toBeTruthy(); expect($tempNote.hasClass('fade-in-half')).toBeTruthy(); - expect( - $tempNote - .find('.timeline-content i') - .text() - .trim(), - ).toEqual(sampleCommandDescription); + expect($tempNote.find('.timeline-content i').text().trim()).toEqual(sampleCommandDescription); }); }); diff --git a/spec/frontend/notes/stores/actions_spec.js b/spec/frontend/notes/stores/actions_spec.js index c9912621785..35608e7f7b4 100644 --- a/spec/frontend/notes/stores/actions_spec.js +++ b/spec/frontend/notes/stores/actions_spec.js @@ -302,10 +302,7 @@ describe('Actions Notes Store', () => { .onGet(notesDataMock.notesPath) .reply(200, { notes: [], last_fetched_at: '123456' }, { 'poll-interval': '1000' }); - store - .dispatch('setNotesData', notesDataMock) - .then(done) - .catch(done.fail); + store.dispatch('setNotesData', notesDataMock).then(done).catch(done.fail); }); it('calls service with last fetched state', done => { diff --git a/spec/frontend/notes/stores/getters_spec.js b/spec/frontend/notes/stores/getters_spec.js index 1a369caee49..deef3572763 100644 --- a/spec/frontend/notes/stores/getters_spec.js +++ b/spec/frontend/notes/stores/getters_spec.js @@ -298,17 +298,18 @@ describe('Getters Notes Store', () => { }; }); - [{ step: 1, id: '123', expected: '123' }, { step: -1, id: '123', expected: '123' }].forEach( - ({ step, id, expected }) => { - it(`with step ${step} and match, returns only value`, () => { - const params = createDiscussionNeighborParams(id, true, step); - - expect(getters.findUnresolvedDiscussionIdNeighbor(state, localGetters)(params)).toBe( - expected, - ); - }); - }, - ); + [ + { step: 1, id: '123', expected: '123' }, + { step: -1, id: '123', expected: '123' }, + ].forEach(({ step, id, expected }) => { + it(`with step ${step} and match, returns only value`, () => { + const params = createDiscussionNeighborParams(id, true, step); + + expect(getters.findUnresolvedDiscussionIdNeighbor(state, localGetters)(params)).toBe( + expected, + ); + }); + }); it('with no match, returns only value', () => { const params = createDiscussionNeighborParams('bogus', true, 1); diff --git a/spec/frontend/oauth_remember_me_spec.js b/spec/frontend/oauth_remember_me_spec.js index e12db05ac43..250886e3781 100644 --- a/spec/frontend/oauth_remember_me_spec.js +++ b/spec/frontend/oauth_remember_me_spec.js @@ -3,9 +3,7 @@ import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me'; describe('OAuthRememberMe', () => { const findFormAction = selector => { - return $(`#oauth-container .oauth-login${selector}`) - .parent('form') - .attr('action'); + return $(`#oauth-container .oauth-login${selector}`).parent('form').attr('action'); }; preloadFixtures('static/oauth_remember_me.html'); diff --git a/spec/frontend/packages/details/components/conan_installation_spec.js b/spec/frontend/packages/details/components/conan_installation_spec.js index c79d1bb50dd..92c1f8e7f4a 100644 --- a/spec/frontend/packages/details/components/conan_installation_spec.js +++ b/spec/frontend/packages/details/components/conan_installation_spec.js @@ -48,21 +48,13 @@ describe('ConanInstallation', () => { describe('installation commands', () => { it('renders the correct command', () => { - expect( - findCodeInstructions() - .at(0) - .props('instruction'), - ).toBe(conanInstallationCommandStr); + expect(findCodeInstructions().at(0).props('instruction')).toBe(conanInstallationCommandStr); }); }); describe('setup commands', () => { it('renders the correct command', () => { - expect( - findCodeInstructions() - .at(1) - .props('instruction'), - ).toBe(conanSetupCommandStr); + expect(findCodeInstructions().at(1).props('instruction')).toBe(conanSetupCommandStr); }); }); }); diff --git a/spec/frontend/packages/details/components/maven_installation_spec.js b/spec/frontend/packages/details/components/maven_installation_spec.js index f301a03a7f3..ff62969e709 100644 --- a/spec/frontend/packages/details/components/maven_installation_spec.js +++ b/spec/frontend/packages/details/components/maven_installation_spec.js @@ -51,11 +51,7 @@ describe('MavenInstallation', () => { describe('installation commands', () => { it('renders the correct xml block', () => { - expect( - findCodeInstructions() - .at(0) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(0).props()).toMatchObject({ instruction: xmlCodeBlock, multiline: true, trackingAction: TrackingActions.COPY_MAVEN_XML, @@ -63,11 +59,7 @@ describe('MavenInstallation', () => { }); it('renders the correct maven command', () => { - expect( - findCodeInstructions() - .at(1) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(1).props()).toMatchObject({ instruction: mavenCommandStr, multiline: false, trackingAction: TrackingActions.COPY_MAVEN_COMMAND, @@ -77,11 +69,7 @@ describe('MavenInstallation', () => { describe('setup commands', () => { it('renders the correct xml block', () => { - expect( - findCodeInstructions() - .at(2) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(2).props()).toMatchObject({ instruction: mavenSetupXml, multiline: true, trackingAction: TrackingActions.COPY_MAVEN_SETUP, diff --git a/spec/frontend/packages/details/components/npm_installation_spec.js b/spec/frontend/packages/details/components/npm_installation_spec.js index 4223a05453c..dd6e62185a9 100644 --- a/spec/frontend/packages/details/components/npm_installation_spec.js +++ b/spec/frontend/packages/details/components/npm_installation_spec.js @@ -47,11 +47,7 @@ describe('NpmInstallation', () => { describe('installation commands', () => { it('renders the correct npm command', () => { - expect( - findCodeInstructions() - .at(0) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(0).props()).toMatchObject({ instruction: 'npm i @Test/package', multiline: false, trackingAction: TrackingActions.COPY_NPM_INSTALL_COMMAND, @@ -59,11 +55,7 @@ describe('NpmInstallation', () => { }); it('renders the correct yarn command', () => { - expect( - findCodeInstructions() - .at(1) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(1).props()).toMatchObject({ instruction: 'yarn add @Test/package', multiline: false, trackingAction: TrackingActions.COPY_YARN_INSTALL_COMMAND, @@ -73,11 +65,7 @@ describe('NpmInstallation', () => { describe('setup commands', () => { it('renders the correct npm command', () => { - expect( - findCodeInstructions() - .at(2) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(2).props()).toMatchObject({ instruction: 'echo @Test:registry=undefined/ >> .npmrc', multiline: false, trackingAction: TrackingActions.COPY_NPM_SETUP_COMMAND, @@ -85,11 +73,7 @@ describe('NpmInstallation', () => { }); it('renders the correct yarn command', () => { - expect( - findCodeInstructions() - .at(3) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(3).props()).toMatchObject({ instruction: 'echo \\"@Test:registry\\" \\"undefined/\\" >> .yarnrc', multiline: false, trackingAction: TrackingActions.COPY_YARN_SETUP_COMMAND, diff --git a/spec/frontend/packages/details/components/nuget_installation_spec.js b/spec/frontend/packages/details/components/nuget_installation_spec.js index b381d131e94..685d0808dd9 100644 --- a/spec/frontend/packages/details/components/nuget_installation_spec.js +++ b/spec/frontend/packages/details/components/nuget_installation_spec.js @@ -49,11 +49,7 @@ describe('NugetInstallation', () => { describe('installation commands', () => { it('renders the correct command', () => { - expect( - findCodeInstructions() - .at(0) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(0).props()).toMatchObject({ instruction: nugetInstallationCommandStr, trackingAction: TrackingActions.COPY_NUGET_INSTALL_COMMAND, }); @@ -62,11 +58,7 @@ describe('NugetInstallation', () => { describe('setup commands', () => { it('renders the correct command', () => { - expect( - findCodeInstructions() - .at(1) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(1).props()).toMatchObject({ instruction: nugetSetupCommandStr, trackingAction: TrackingActions.COPY_NUGET_SETUP_COMMAND, }); diff --git a/spec/frontend/packages/details/store/actions_spec.js b/spec/frontend/packages/details/store/actions_spec.js index 70f87d18bcb..96fcf90b0fb 100644 --- a/spec/frontend/packages/details/store/actions_spec.js +++ b/spec/frontend/packages/details/store/actions_spec.js @@ -42,7 +42,10 @@ describe('Actions Package details store', () => { fetchPackageVersions, undefined, { packageEntity }, - [{ type: types.SET_LOADING, payload: true }, { type: types.SET_LOADING, payload: false }], + [ + { type: types.SET_LOADING, payload: true }, + { type: types.SET_LOADING, payload: false }, + ], [], () => { expect(Api.projectPackage).toHaveBeenCalledWith( @@ -61,7 +64,10 @@ describe('Actions Package details store', () => { fetchPackageVersions, undefined, { packageEntity }, - [{ type: types.SET_LOADING, payload: true }, { type: types.SET_LOADING, payload: false }], + [ + { type: types.SET_LOADING, payload: true }, + { type: types.SET_LOADING, payload: false }, + ], [], () => { expect(Api.projectPackage).toHaveBeenCalledWith( diff --git a/spec/frontend/packages/list/stores/actions_spec.js b/spec/frontend/packages/list/stores/actions_spec.js index cf205ecbac4..71b4d07a8af 100644 --- a/spec/frontend/packages/list/stores/actions_spec.js +++ b/spec/frontend/packages/list/stores/actions_spec.js @@ -109,7 +109,10 @@ describe('Actions Package list store', () => { undefined, { config: { isGroupPage: false, resourceId: 2 }, sorting }, [], - [{ type: 'setLoading', payload: true }, { type: 'setLoading', payload: false }], + [ + { type: 'setLoading', payload: true }, + { type: 'setLoading', payload: false }, + ], () => { expect(createFlash).toHaveBeenCalled(); done(); @@ -192,7 +195,10 @@ describe('Actions Package list store', () => { payload, null, [], - [{ type: 'setLoading', payload: true }, { type: 'setLoading', payload: false }], + [ + { type: 'setLoading', payload: true }, + { type: 'setLoading', payload: false }, + ], () => { expect(createFlash).toHaveBeenCalled(); done(); diff --git a/spec/frontend/packages/shared/components/package_tags_spec.js b/spec/frontend/packages/shared/components/package_tags_spec.js index cc49a9a9244..d26e4e76b87 100644 --- a/spec/frontend/packages/shared/components/package_tags_spec.js +++ b/spec/frontend/packages/shared/components/package_tags_spec.js @@ -75,11 +75,7 @@ describe('PackageTags', () => { const expectedStyle = [...defaultStyle, 'gl-display-flex', 'gl-ml-3']; - expect( - tagBadges() - .at(0) - .classes(), - ).toEqual(expect.arrayContaining(expectedStyle)); + expect(tagBadges().at(0).classes()).toEqual(expect.arrayContaining(expectedStyle)); }); it('shows tag badge for medium or heigher resolutions', () => { @@ -87,11 +83,7 @@ describe('PackageTags', () => { const expectedStyle = [...defaultStyle, 'd-md-flex']; - expect( - tagBadges() - .at(1) - .classes(), - ).toEqual(expect.arrayContaining(expectedStyle)); + expect(tagBadges().at(1).classes()).toEqual(expect.arrayContaining(expectedStyle)); }); it('correctly prepends left and appends right when there is more than one tag', () => { diff --git a/spec/frontend/pages/projects/forks/new/components/fork_groups_list_spec.js b/spec/frontend/pages/projects/forks/new/components/fork_groups_list_spec.js index 9993e4da980..c9b88c2ba34 100644 --- a/spec/frontend/pages/projects/forks/new/components/fork_groups_list_spec.js +++ b/spec/frontend/pages/projects/forks/new/components/fork_groups_list_spec.js @@ -104,12 +104,10 @@ describe('Fork groups list component', () => { expect(wrapper.findAll(ForkGroupsListItem)).toHaveLength(namespaces.length); namespaces.forEach((namespace, idx) => { - expect( - wrapper - .findAll(ForkGroupsListItem) - .at(idx) - .props(), - ).toStrictEqual({ group: namespace, hasReachedProjectLimit }); + expect(wrapper.findAll(ForkGroupsListItem).at(idx).props()).toStrictEqual({ + group: namespace, + hasReachedProjectLimit, + }); }); }); @@ -123,11 +121,6 @@ describe('Fork groups list component', () => { await nextTick(); expect(wrapper.findAll(ForkGroupsListItem)).toHaveLength(1); - expect( - wrapper - .findAll(ForkGroupsListItem) - .at(0) - .props().group.name, - ).toBe('otherdummy'); + expect(wrapper.findAll(ForkGroupsListItem).at(0).props().group.name).toBe('otherdummy'); }); }); diff --git a/spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js b/spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js index 5efcedf678b..fb45cf9e5d3 100644 --- a/spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js +++ b/spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js @@ -88,10 +88,7 @@ describe('Timezone Dropdown', () => { onSelectTimezone, }); - $wrapper - .find(tzListSel) - .first() - .trigger('click'); + $wrapper.find(tzListSel).first().trigger('click'); expect(onSelectTimezone).toHaveBeenCalled(); }); @@ -118,10 +115,7 @@ describe('Timezone Dropdown', () => { displayFormat, }); - $wrapper - .find(tzListSel) - .first() - .trigger('click'); + $wrapper.find(tzListSel).first().trigger('click'); expect(displayFormat).toHaveBeenCalled(); }); diff --git a/spec/frontend/pages/projects/shared/permissions/components/project_feature_settings_spec.js b/spec/frontend/pages/projects/shared/permissions/components/project_feature_settings_spec.js index a9fad921ea1..6e57823b761 100644 --- a/spec/frontend/pages/projects/shared/permissions/components/project_feature_settings_spec.js +++ b/spec/frontend/pages/projects/shared/permissions/components/project_feature_settings_spec.js @@ -6,7 +6,13 @@ import projectFeatureToggle from '~/vue_shared/components/toggle_button.vue'; describe('Project Feature Settings', () => { const defaultProps = { name: 'Test', - options: [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]], + options: [ + [1, 1], + [2, 2], + [3, 3], + [4, 4], + [5, 5], + ], value: 1, disabledInput: false, showToggle: true, @@ -82,10 +88,7 @@ describe('Project Feature Settings', () => { wrapper = mount(projectFeatureSetting, { propsData: defaultProps }); expect(wrapper.emitted().change).toBeUndefined(); - wrapper - .find(projectFeatureToggle) - .find('button') - .trigger('click'); + wrapper.find(projectFeatureToggle).find('button').trigger('click'); return wrapper.vm.$nextTick().then(() => { expect(wrapper.emitted().change.length).toBe(1); @@ -119,10 +122,7 @@ describe('Project Feature Settings', () => { it('should emit the change when a new option is selected', () => { expect(wrapper.emitted().change).toBeUndefined(); - wrapper - .findAll('option') - .at(1) - .trigger('change'); + wrapper.findAll('option').at(1).trigger('change'); return wrapper.vm.$nextTick().then(() => { expect(wrapper.emitted().change.length).toBe(1); diff --git a/spec/frontend/pages/search/show/refresh_counts_spec.js b/spec/frontend/pages/search/show/refresh_counts_spec.js index ead268b3971..9a21647f5d0 100644 --- a/spec/frontend/pages/search/show/refresh_counts_spec.js +++ b/spec/frontend/pages/search/show/refresh_counts_spec.js @@ -5,7 +5,10 @@ import refreshCounts from '~/pages/search/show/refresh_counts'; const URL = `${TEST_HOST}/search/count?search=lorem+ipsum&project_id=3`; const urlWithScope = scope => `${URL}&scope=${scope}`; -const counts = [{ scope: 'issues', count: 4 }, { scope: 'merge_requests', count: 5 }]; +const counts = [ + { scope: 'issues', count: 4 }, + { scope: 'merge_requests', count: 5 }, +]; const fixture = `<div class="badge">22</div> <div class="badge js-search-count hidden" data-url="${urlWithScope('issues')}"></div> <div class="badge js-search-count hidden" data-url="${urlWithScope('merge_requests')}"></div>`; diff --git a/spec/frontend/pages/sessions/new/preserve_url_fragment_spec.js b/spec/frontend/pages/sessions/new/preserve_url_fragment_spec.js index 4b50342bf84..9be471aade2 100644 --- a/spec/frontend/pages/sessions/new/preserve_url_fragment_spec.js +++ b/spec/frontend/pages/sessions/new/preserve_url_fragment_spec.js @@ -3,9 +3,7 @@ import preserveUrlFragment from '~/pages/sessions/new/preserve_url_fragment'; describe('preserve_url_fragment', () => { const findFormAction = selector => { - return $(`.omniauth-container ${selector}`) - .parent('form') - .attr('action'); + return $(`.omniauth-container ${selector}`).parent('form').attr('action'); }; preloadFixtures('sessions/new.html'); diff --git a/spec/frontend/pipeline_editor/components/lint/ci_lint_spec.js b/spec/frontend/pipeline_editor/components/lint/ci_lint_spec.js index e69f0b953d2..40e1d7fdb24 100644 --- a/spec/frontend/pipeline_editor/components/lint/ci_lint_spec.js +++ b/spec/frontend/pipeline_editor/components/lint/ci_lint_spec.js @@ -49,11 +49,7 @@ describe('~/pipeline_editor/components/lint/ci_lint.vue', () => { }); it('displays link to the right help page', () => { - expect( - findAlert() - .find(GlLink) - .attributes('href'), - ).toBe(mockLintHelpPagePath); + expect(findAlert().find(GlLink).attributes('href')).toBe(mockLintHelpPagePath); }); it('displays jobs', () => { diff --git a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js index 1e09c311439..b692ed636ab 100644 --- a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js +++ b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js @@ -177,11 +177,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { }); it('displays the tab and its content', async () => { - expect( - findTabAt(0) - .find(TextEditor) - .exists(), - ).toBe(true); + expect(findTabAt(0).find(TextEditor).exists()).toBe(true); }); it('displays tab lazily, until editor is ready', async () => { diff --git a/spec/frontend/pipeline_new/components/pipeline_new_form_spec.js b/spec/frontend/pipeline_new/components/pipeline_new_form_spec.js index b42339f626e..015a97169fa 100644 --- a/spec/frontend/pipeline_new/components/pipeline_new_form_spec.js +++ b/spec/frontend/pipeline_new/components/pipeline_new_form_spec.js @@ -44,10 +44,7 @@ describe('Pipeline New Form', () => { const findWarnings = () => wrapper.findAll('[data-testid="run-pipeline-warning"]'); const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const getExpectedPostParams = () => JSON.parse(mock.history.post[0].data); - const changeRef = i => - findDropdownItems() - .at(i) - .vm.$emit('click'); + const changeRef = i => findDropdownItems().at(i).vm.$emit('click'); const createComponent = (term = '', props = {}, method = shallowMount) => { wrapper = method(PipelineNewForm, { @@ -99,11 +96,7 @@ describe('Pipeline New Form', () => { createComponent('master'); expect(findDropdownItems()).toHaveLength(1); - expect( - findDropdownItems() - .at(0) - .text(), - ).toBe('master'); + expect(findDropdownItems().at(0).text()).toBe('master'); }); }); @@ -136,9 +129,7 @@ describe('Pipeline New Form', () => { }); it('removes ci variable row on remove icon button click', async () => { - findRemoveIcons() - .at(1) - .trigger('click'); + findRemoveIcons().at(1).trigger('click'); await wrapper.vm.$nextTick(); @@ -298,26 +289,16 @@ describe('Pipeline New Form', () => { }); it('adds a description to the first variable from yml', () => { - expect( - findVariableRows() - .at(0) - .text(), - ).toContain(mockYmlDesc); + expect(findVariableRows().at(0).text()).toContain(mockYmlDesc); }); it('removes the description when a variable key changes', async () => { findKeyInputs().at(0).element.value = 'yml_var_modified'; - findKeyInputs() - .at(0) - .trigger('change'); + findKeyInputs().at(0).trigger('change'); await wrapper.vm.$nextTick(); - expect( - findVariableRows() - .at(0) - .text(), - ).not.toContain(mockYmlDesc); + expect(findVariableRows().at(0).text()).not.toContain(mockYmlDesc); }); }); diff --git a/spec/frontend/pipelines/components/dag/dag_annotations_spec.js b/spec/frontend/pipelines/components/dag/dag_annotations_spec.js index 5747c91bee8..80807c0b330 100644 --- a/spec/frontend/pipelines/components/dag/dag_annotations_spec.js +++ b/spec/frontend/pipelines/components/dag/dag_annotations_spec.js @@ -66,11 +66,7 @@ describe('The DAG annotations', () => { expect(getAllTextBlocks().length).toBe(Object.keys(multiNote).length); Object.values(multiNote).forEach((item, idx) => { - expect( - getAllTextBlocks() - .at(idx) - .text(), - ).toBe(`${item.source.name} → ${item.target.name}`); + expect(getAllTextBlocks().at(idx).text()).toBe(`${item.source.name} → ${item.target.name}`); }); }); diff --git a/spec/frontend/pipelines/components/dag/dag_graph_spec.js b/spec/frontend/pipelines/components/dag/dag_graph_spec.js index 7786212cb69..02692cc3994 100644 --- a/spec/frontend/pipelines/components/dag/dag_graph_spec.js +++ b/spec/frontend/pipelines/components/dag/dag_graph_spec.js @@ -88,11 +88,7 @@ describe('The DAG graph', () => { }); it('renders the title as text', () => { - expect( - getAllLabels() - .at(0) - .text(), - ).toBe(parsedData.nodes[0].name); + expect(getAllLabels().at(0).text()).toBe(parsedData.nodes[0].name); }); }); }); diff --git a/spec/frontend/pipelines/components/dag/parsing_utils_spec.js b/spec/frontend/pipelines/components/dag/parsing_utils_spec.js index ceb6b64d4ad..5d3f680a57c 100644 --- a/spec/frontend/pipelines/components/dag/parsing_utils_spec.js +++ b/spec/frontend/pipelines/components/dag/parsing_utils_spec.js @@ -30,7 +30,10 @@ describe('DAG visualization parsing utilities', () => { { source: 'job2', target: 'job4' }, ]; - const dedupedLinks = [{ source: 'job1', target: 'job2' }, { source: 'job2', target: 'job4' }]; + const dedupedLinks = [ + { source: 'job1', target: 'job2' }, + { source: 'job2', target: 'job4' }, + ]; const nodeLookup = { job1: { diff --git a/spec/frontend/pipelines/graph/graph_component_legacy_spec.js b/spec/frontend/pipelines/graph/graph_component_legacy_spec.js index 3b1909b6564..7662520650f 100644 --- a/spec/frontend/pipelines/graph/graph_component_legacy_spec.js +++ b/spec/frontend/pipelines/graph/graph_component_legacy_spec.js @@ -104,11 +104,9 @@ describe('graph component', () => { }); it('should include the left-connector class in the build of the second child', () => { - expect( - findStageColumnAt(1) - .find('.build:nth-child(1)') - .classes('left-connector'), - ).toBe(true); + expect(findStageColumnAt(1).find('.build:nth-child(1)').classes('left-connector')).toBe( + true, + ); }); it('should include the js-has-linked-pipelines flag', () => { @@ -119,12 +117,7 @@ describe('graph component', () => { describe('computeds and methods', () => { describe('capitalizeStageName', () => { it('it capitalizes the stage name', () => { - expect( - wrapper - .findAll('.stage-column .stage-name') - .at(1) - .text(), - ).toBe('Prebuild'); + expect(wrapper.findAll('.stage-column .stage-name').at(1).text()).toBe('Prebuild'); }); }); diff --git a/spec/frontend/pipelines/graph/graph_component_spec.js b/spec/frontend/pipelines/graph/graph_component_spec.js index 7572dd83798..7b12070e08f 100644 --- a/spec/frontend/pipelines/graph/graph_component_spec.js +++ b/spec/frontend/pipelines/graph/graph_component_spec.js @@ -47,9 +47,7 @@ describe('graph component', () => { describe('when column requests a refresh', () => { beforeEach(() => { - findStageColumns() - .at(0) - .vm.$emit('refreshPipelineGraph'); + findStageColumns().at(0).vm.$emit('refreshPipelineGraph'); }); it('refreshPipelineGraph is emitted', () => { diff --git a/spec/frontend/pipelines/graph/stage_column_component_legacy_spec.js b/spec/frontend/pipelines/graph/stage_column_component_legacy_spec.js index 463e4c12c7d..2965325ea7c 100644 --- a/spec/frontend/pipelines/graph/stage_column_component_legacy_spec.js +++ b/spec/frontend/pipelines/graph/stage_column_component_legacy_spec.js @@ -40,12 +40,7 @@ describe('stage column component', () => { }); it('should render provided title', () => { - expect( - wrapper - .find('.stage-name') - .text() - .trim(), - ).toBe('foo'); + expect(wrapper.find('.stage-name').text().trim()).toBe('foo'); }); it('should render the provided groups', () => { diff --git a/spec/frontend/pipelines/pipelines_actions_spec.js b/spec/frontend/pipelines/pipelines_actions_spec.js index 071a2b24889..69c1b7ce43d 100644 --- a/spec/frontend/pipelines/pipelines_actions_spec.js +++ b/spec/frontend/pipelines/pipelines_actions_spec.js @@ -55,11 +55,7 @@ describe('Pipelines Actions dropdown', () => { }); it("renders a disabled action when it's not playable", () => { - expect( - findAllDropdownItems() - .at(1) - .attributes('disabled'), - ).toBe('true'); + expect(findAllDropdownItems().at(1).attributes('disabled')).toBe('true'); }); describe('on click', () => { @@ -100,9 +96,7 @@ describe('Pipelines Actions dropdown', () => { mock.onPost(scheduledJobAction.path).reply(200); jest.spyOn(window, 'confirm').mockReturnValue(true); - findAllDropdownItems() - .at(0) - .vm.$emit('click'); + findAllDropdownItems().at(0).vm.$emit('click'); expect(window.confirm).toHaveBeenCalled(); @@ -115,28 +109,20 @@ describe('Pipelines Actions dropdown', () => { mock.onPost(scheduledJobAction.path).reply(200); jest.spyOn(window, 'confirm').mockReturnValue(false); - findAllDropdownItems() - .at(0) - .vm.$emit('click'); + findAllDropdownItems().at(0).vm.$emit('click'); expect(window.confirm).toHaveBeenCalled(); expect(mock.history.post.length).toBe(0); }); it('displays the remaining time in the dropdown', () => { - expect( - findAllCountdowns() - .at(0) - .props('endDateString'), - ).toBe(scheduledJobAction.scheduled_at); + expect(findAllCountdowns().at(0).props('endDateString')).toBe( + scheduledJobAction.scheduled_at, + ); }); it('displays 00:00:00 for expired jobs in the dropdown', () => { - expect( - findAllCountdowns() - .at(1) - .props('endDateString'), - ).toBe(expiredJobAction.scheduled_at); + expect(findAllCountdowns().at(1).props('endDateString')).toBe(expiredJobAction.scheduled_at); }); }); }); diff --git a/spec/frontend/pipelines/pipelines_spec.js b/spec/frontend/pipelines/pipelines_spec.js index ce0e76ba22d..14caf785027 100644 --- a/spec/frontend/pipelines/pipelines_spec.js +++ b/spec/frontend/pipelines/pipelines_spec.js @@ -194,16 +194,8 @@ describe('Pipelines', () => { }); it('renders empty state', () => { - expect( - findEmptyState() - .find('h4') - .text(), - ).toBe('Build with confidence'); - expect( - findEmptyState() - .find(GlButton) - .attributes('href'), - ).toBe(paths.helpPagePath); + expect(findEmptyState().find('h4').text()).toBe('Build with confidence'); + expect(findEmptyState().find(GlButton).attributes('href')).toBe(paths.helpPagePath); }); it('does not render tabs nor buttons', () => { @@ -320,11 +312,7 @@ describe('Pipelines', () => { 'This project is not currently set up to run pipelines.', ); - expect( - findEmptyState() - .find(GlButton) - .exists(), - ).toBeFalsy(); + expect(findEmptyState().find(GlButton).exists()).toBeFalsy(); }); it('does not render tabs or buttons', () => { diff --git a/spec/frontend/pipelines/pipelines_store_spec.js b/spec/frontend/pipelines/pipelines_store_spec.js index ce21f788ed5..f374ecd0c0a 100644 --- a/spec/frontend/pipelines/pipelines_store_spec.js +++ b/spec/frontend/pipelines/pipelines_store_spec.js @@ -21,7 +21,10 @@ describe('Pipelines Store', () => { }); it('should store the provided array', () => { - const array = [{ id: 1, status: 'running' }, { id: 2, status: 'success' }]; + const array = [ + { id: 1, status: 'running' }, + { id: 2, status: 'success' }, + ]; store.storePipelines(array); expect(store.state.pipelines).toEqual(array); diff --git a/spec/frontend/pipelines/pipelines_table_row_spec.js b/spec/frontend/pipelines/pipelines_table_row_spec.js index 32d53c0f1f8..d682c45f816 100644 --- a/spec/frontend/pipelines/pipelines_table_row_spec.js +++ b/spec/frontend/pipelines/pipelines_table_row_spec.js @@ -82,10 +82,7 @@ describe('Pipelines Table Row', () => { ).toEqual(pipeline.user.path); expect( - wrapper - .find('.table-section:nth-child(3) .js-user-avatar-image-toolip') - .text() - .trim(), + wrapper.find('.table-section:nth-child(3) .js-user-avatar-image-toolip').text().trim(), ).toEqual(pipeline.user.name); }); }); diff --git a/spec/frontend/profile/account/components/delete_account_modal_spec.js b/spec/frontend/profile/account/components/delete_account_modal_spec.js index 7834456f7c4..6ee919a8cc5 100644 --- a/spec/frontend/profile/account/components/delete_account_modal_spec.js +++ b/spec/frontend/profile/account/components/delete_account_modal_spec.js @@ -65,9 +65,7 @@ describe('DeleteAccountModal component', () => { vm.isOpen = true; - Vue.nextTick() - .then(done) - .catch(done.fail); + Vue.nextTick().then(done).catch(done.fail); }); it('does not accept empty password', done => { @@ -117,9 +115,7 @@ describe('DeleteAccountModal component', () => { vm.isOpen = true; - Vue.nextTick() - .then(done) - .catch(done.fail); + Vue.nextTick().then(done).catch(done.fail); }); it('does not accept wrong username', done => { diff --git a/spec/frontend/project_find_file_spec.js b/spec/frontend/project_find_file_spec.js index 6a50f68a4e9..104233eb6d5 100644 --- a/spec/frontend/project_find_file_spec.js +++ b/spec/frontend/project_find_file_spec.js @@ -58,7 +58,10 @@ describe('ProjectFindFile', () => { mock = new MockAdapter(axios); element = $(TEMPLATE); - mock.onGet(FILE_FIND_URL).replyOnce(200, files.map(x => x.path)); + mock.onGet(FILE_FIND_URL).replyOnce( + 200, + files.map(x => x.path), + ); getProjectFindFileInstance(); // This triggers a load / axios call + subsequent render in the constructor setImmediate(done); diff --git a/spec/frontend/projects/commits/components/author_select_spec.js b/spec/frontend/projects/commits/components/author_select_spec.js index 68c285a4097..63920ddfd72 100644 --- a/spec/frontend/projects/commits/components/author_select_spec.js +++ b/spec/frontend/projects/commits/components/author_select_spec.js @@ -139,11 +139,7 @@ describe('Author Select', () => { }); it('has a "Any Author" as the first list item', () => { - expect( - findDropdownItems() - .at(0) - .text(), - ).toBe('Any Author'); + expect(findDropdownItems().at(0).text()).toBe('Any Author'); }); it('displays the project authors', () => { @@ -163,21 +159,13 @@ describe('Author Select', () => { wrapper.setData({ currentAuthor }); return wrapper.vm.$nextTick().then(() => { - expect( - findDropdownItems() - .at(1) - .props(), - ).toEqual(expect.objectContaining(result)); + expect(findDropdownItems().at(1).props()).toEqual(expect.objectContaining(result)); }); }); it("display the author's name", () => { return wrapper.vm.$nextTick().then(() => { - expect( - findDropdownItems() - .at(1) - .text(), - ).toBe(currentAuthor); + expect(findDropdownItems().at(1).text()).toBe(currentAuthor); }); }); @@ -186,9 +174,7 @@ describe('Author Select', () => { const spy = jest.spyOn(urlUtility, 'redirectTo'); spy.mockImplementation(() => 'mock'); - findDropdownItems() - .at(1) - .vm.$emit('click'); + findDropdownItems().at(1).vm.$emit('click'); expect(spy).toHaveBeenCalledWith(redirectToUrl); }); @@ -198,9 +184,7 @@ describe('Author Select', () => { const spy = jest.spyOn(urlUtility, 'redirectTo'); spy.mockImplementation(); - findDropdownItems() - .at(0) - .vm.$emit('click'); + findDropdownItems().at(0).vm.$emit('click'); expect(spy).toHaveBeenCalledWith(redirectToUrl); }); }); diff --git a/spec/frontend/projects/pipelines/charts/mock_data.js b/spec/frontend/projects/pipelines/charts/mock_data.js index da055536fcc..3bc09f0b0a0 100644 --- a/spec/frontend/projects/pipelines/charts/mock_data.js +++ b/spec/frontend/projects/pipelines/charts/mock_data.js @@ -25,11 +25,23 @@ export const lastYearChartData = { export const transformedAreaChartData = [ { name: 'all', - data: [['01 Jan', 4], ['02 Jan', 6], ['03 Jan', 3], ['04 Jan', 6], ['05 Jan', 7]], + data: [ + ['01 Jan', 4], + ['02 Jan', 6], + ['03 Jan', 3], + ['04 Jan', 6], + ['05 Jan', 7], + ], }, { name: 'success', - data: [['01 Jan', 3], ['02 Jan', 3], ['03 Jan', 3], ['04 Jan', 3], ['05 Jan', 5]], + data: [ + ['01 Jan', 3], + ['02 Jan', 3], + ['03 Jan', 3], + ['04 Jan', 3], + ['05 Jan', 5], + ], }, ]; diff --git a/spec/frontend/projects/project_new_spec.js b/spec/frontend/projects/project_new_spec.js index c32979dcd74..ed6bd818bd9 100644 --- a/spec/frontend/projects/project_new_spec.js +++ b/spec/frontend/projects/project_new_spec.js @@ -38,10 +38,7 @@ describe('New Project', () => { beforeEach(() => { projectNew.bindEvents(); - $projectPath - .val('') - .keyup() - .val(dummyImportUrl); + $projectPath.val('').keyup().val(dummyImportUrl); }); it('does not change project path for disabled $projectImportUrl', () => { diff --git a/spec/frontend/prometheus_metrics/prometheus_metrics_spec.js b/spec/frontend/prometheus_metrics/prometheus_metrics_spec.js index 2460851a6a4..429707eab58 100644 --- a/spec/frontend/prometheus_metrics/prometheus_metrics_spec.js +++ b/spec/frontend/prometheus_metrics/prometheus_metrics_spec.js @@ -91,12 +91,7 @@ describe('PrometheusMetrics', () => { ); expect($metricsListLi.length).toEqual(metrics.length); - expect( - $metricsListLi - .first() - .find('.badge') - .text(), - ).toEqual(`${metrics[0].active_metrics}`); + expect($metricsListLi.first().find('.badge').text()).toEqual(`${metrics[0].active_metrics}`); }); it('should show missing environment variables list', () => { diff --git a/spec/frontend/ref/components/ref_selector_spec.js b/spec/frontend/ref/components/ref_selector_spec.js index 7f0a4c7d3f4..ca5a5a62235 100644 --- a/spec/frontend/ref/components/ref_selector_spec.js +++ b/spec/frontend/ref/components/ref_selector_spec.js @@ -313,9 +313,7 @@ describe('Ref selector component', () => { it('renders the "Branches" heading with a total number indicator', () => { expect( - findBranchesSection() - .find('[data-testid="section-header"]') - .text(), + findBranchesSection().find('[data-testid="section-header"]').text(), ).toMatchInterpolatedText('Branches 123'); }); @@ -392,9 +390,7 @@ describe('Ref selector component', () => { it('renders the "Tags" heading with a total number indicator', () => { expect( - findTagsSection() - .find('[data-testid="section-header"]') - .text(), + findTagsSection().find('[data-testid="section-header"]').text(), ).toMatchInterpolatedText('Tags 456'); }); @@ -460,9 +456,7 @@ describe('Ref selector component', () => { it('renders the "Commits" heading with a total number indicator', () => { expect( - findCommitsSection() - .find('[data-testid="section-header"]') - .text(), + findCommitsSection().find('[data-testid="section-header"]').text(), ).toMatchInterpolatedText('Commits 1'); }); 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 e1b75636735..1cde19510a2 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 @@ -306,11 +306,7 @@ describe('tags list row', () => { }); it(`is ${clipboard} that clipboard button exist`, () => { - expect( - finderFunction() - .find(ClipboardButton) - .exists(), - ).toBe(clipboard); + expect(finderFunction().find(ClipboardButton).exists()).toBe(clipboard); }); }); }); diff --git a/spec/frontend/registry/explorer/components/details_page/tags_list_spec.js b/spec/frontend/registry/explorer/components/details_page/tags_list_spec.js index 035b59731c9..b843e9a2ad3 100644 --- a/spec/frontend/registry/explorer/components/details_page/tags_list_spec.js +++ b/spec/frontend/registry/explorer/components/details_page/tags_list_spec.js @@ -78,18 +78,14 @@ describe('Tags List', () => { it('is enabled when at least one item is selected', async () => { mountComponent(); - findTagsListRow() - .at(0) - .vm.$emit('select'); + findTagsListRow().at(0).vm.$emit('select'); await wrapper.vm.$nextTick(); expect(findDeleteButton().attributes('disabled')).toBe(undefined); }); it('click event emits a deleted event with selected items', () => { mountComponent(); - findTagsListRow() - .at(0) - .vm.$emit('select'); + findTagsListRow().at(0).vm.$emit('select'); findDeleteButton().vm.$emit('click'); expect(wrapper.emitted('delete')).toEqual([[{ 'beta-24753': true }]]); @@ -116,22 +112,14 @@ describe('Tags List', () => { describe('events', () => { it('select event update the selected items', async () => { mountComponent(); - findTagsListRow() - .at(0) - .vm.$emit('select'); + findTagsListRow().at(0).vm.$emit('select'); await wrapper.vm.$nextTick(); - expect( - findTagsListRow() - .at(0) - .attributes('selected'), - ).toBe('true'); + expect(findTagsListRow().at(0).attributes('selected')).toBe('true'); }); it('delete event emit a delete event', () => { mountComponent(); - findTagsListRow() - .at(0) - .vm.$emit('delete'); + findTagsListRow().at(0).vm.$emit('delete'); expect(wrapper.emitted('delete')).toEqual([[{ 'beta-24753': true }]]); }); }); diff --git a/spec/frontend/registry/explorer/components/details_page/tags_loader_spec.js b/spec/frontend/registry/explorer/components/details_page/tags_loader_spec.js index b27d3e2c042..40d84d9d4a5 100644 --- a/spec/frontend/registry/explorer/components/details_page/tags_loader_spec.js +++ b/spec/frontend/registry/explorer/components/details_page/tags_loader_spec.js @@ -32,11 +32,7 @@ describe('TagsLoader component', () => { it('has the correct props', () => { mountComponent(); - expect( - findGlSkeletonLoaders() - .at(0) - .props(), - ).toMatchObject({ + expect(findGlSkeletonLoaders().at(0).props()).toMatchObject({ width: component.loader.width, height: component.loader.height, }); diff --git a/spec/frontend/registry/explorer/components/list_page/__snapshots__/project_empty_state_spec.js.snap b/spec/frontend/registry/explorer/components/list_page/__snapshots__/project_empty_state_spec.js.snap index bab6b25cc15..46b07b4c2d6 100644 --- a/spec/frontend/registry/explorer/components/list_page/__snapshots__/project_empty_state_spec.js.snap +++ b/spec/frontend/registry/explorer/components/list_page/__snapshots__/project_empty_state_spec.js.snap @@ -56,7 +56,7 @@ exports[`Registry Project Empty state to match the default snapshot 1`] = ` </p> <gl-form-input-group-stub - class="gl-mb-4 " + class="gl-mb-4" predefinedoptions="[object Object]" value="" > diff --git a/spec/frontend/registry/explorer/components/list_page/image_list_spec.js b/spec/frontend/registry/explorer/components/list_page/image_list_spec.js index 54befc9973a..9c293cb5c31 100644 --- a/spec/frontend/registry/explorer/components/list_page/image_list_spec.js +++ b/spec/frontend/registry/explorer/components/list_page/image_list_spec.js @@ -35,9 +35,7 @@ describe('Image List', () => { it('when delete event is emitted on the row it emits up a delete event', () => { mountComponent(); - findRow() - .at(0) - .vm.$emit('delete', 'foo'); + findRow().at(0).vm.$emit('delete', 'foo'); expect(wrapper.emitted('delete')).toEqual([['foo']]); }); }); diff --git a/spec/frontend/registry/explorer/components/registry_breadcrumb_spec.js b/spec/frontend/registry/explorer/components/registry_breadcrumb_spec.js index fb0b98ba004..692972185c8 100644 --- a/spec/frontend/registry/explorer/components/registry_breadcrumb_spec.js +++ b/spec/frontend/registry/explorer/components/registry_breadcrumb_spec.js @@ -119,11 +119,7 @@ describe('Registry Breadcrumb', () => { }); it('has the same classes as the last children of the crumbs', () => { - expect( - findLastCrumb() - .classes() - .join(' '), - ).toEqual(lastChildren.className); + expect(findLastCrumb().classes().join(' ')).toEqual(lastChildren.className); }); it('has a link to the current route', () => { diff --git a/spec/frontend/registry/settings/components/expiration_dropdown_spec.js b/spec/frontend/registry/settings/components/expiration_dropdown_spec.js index e0cac317ad6..329aa55e739 100644 --- a/spec/frontend/registry/settings/components/expiration_dropdown_spec.js +++ b/spec/frontend/registry/settings/components/expiration_dropdown_spec.js @@ -8,7 +8,10 @@ describe('ExpirationDropdown', () => { const defaultProps = { name: 'foo', label: 'label-bar', - formOptions: [{ key: 'foo', label: 'bar' }, { key: 'baz', label: 'zab' }], + formOptions: [ + { key: 'foo', label: 'bar' }, + { key: 'baz', label: 'zab' }, + ], }; const findFormSelect = () => wrapper.find(GlFormSelect); diff --git a/spec/frontend/registry/settings/utils_spec.js b/spec/frontend/registry/settings/utils_spec.js index f92d51db307..7bc627908af 100644 --- a/spec/frontend/registry/settings/utils_spec.js +++ b/spec/frontend/registry/settings/utils_spec.js @@ -11,7 +11,10 @@ describe('Utils', () => { [{ variable: 1 }, { variable: 2 }], olderThanTranslationGenerator, ); - expect(result).toEqual([{ variable: 1, label: '1 day' }, { variable: 2, label: '2 days' }]); + expect(result).toEqual([ + { variable: 1, label: '1 day' }, + { variable: 2, label: '2 days' }, + ]); }); }); diff --git a/spec/frontend/related_merge_requests/components/related_merge_requests_spec.js b/spec/frontend/related_merge_requests/components/related_merge_requests_spec.js index db33a9cdce1..e0395d93036 100644 --- a/spec/frontend/related_merge_requests/components/related_merge_requests_spec.js +++ b/spec/frontend/related_merge_requests/components/related_merge_requests_spec.js @@ -73,10 +73,7 @@ describe('RelatedMergeRequests', () => { expect(wrapper.find('.js-items-count').text()).toEqual('2'); expect(wrapper.findAll(RelatedIssuableItem).length).toEqual(2); - const props = wrapper - .findAll(RelatedIssuableItem) - .at(1) - .props(); + const props = wrapper.findAll(RelatedIssuableItem).at(1).props(); const data = mockData[1]; expect(props.idKey).toEqual(data.id); diff --git a/spec/frontend/releases/components/release_block_milestone_info_spec.js b/spec/frontend/releases/components/release_block_milestone_info_spec.js index bb34693c757..5cde8d630e6 100644 --- a/spec/frontend/releases/components/release_block_milestone_info_spec.js +++ b/spec/frontend/releases/components/release_block_milestone_info_spec.js @@ -67,9 +67,7 @@ describe('Release block milestone info', () => { ).toBe(true); milestones.forEach((m, i) => { - const milestoneLink = milestoneListContainer() - .findAll(GlLink) - .at(i); + const milestoneLink = milestoneListContainer().findAll(GlLink).at(i); expect(milestoneLink.text()).toBe(m.title); expect(milestoneLink.attributes('href')).toBe(m.webUrl); @@ -118,9 +116,7 @@ describe('Release block milestone info', () => { }); const clickShowMoreFewerButton = () => { - milestoneListContainer() - .find(GlButton) - .trigger('click'); + milestoneListContainer().find(GlButton).trigger('click'); return wrapper.vm.$nextTick(); }; diff --git a/spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js b/spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js index 77d7c6f8678..ecb657af6f1 100644 --- a/spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js +++ b/spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js @@ -139,11 +139,7 @@ describe('Grouped code quality reports app', () => { }); it('renders a help icon with more information', () => { - expect( - findWidget() - .find('[data-testid="question-icon"]') - .exists(), - ).toBe(true); + expect(findWidget().find('[data-testid="question-icon"]').exists()).toBe(true); }); }); @@ -157,11 +153,7 @@ describe('Grouped code quality reports app', () => { }); it('does not render a help icon', () => { - expect( - findWidget() - .find('[data-testid="question-icon"]') - .exists(), - ).toBe(false); + expect(findWidget().find('[data-testid="question-icon"]').exists()).toBe(false); }); }); }); diff --git a/spec/frontend/reports/components/grouped_test_reports_app_spec.js b/spec/frontend/reports/components/grouped_test_reports_app_spec.js index 66d429017b2..345936d86e2 100644 --- a/spec/frontend/reports/components/grouped_test_reports_app_spec.js +++ b/spec/frontend/reports/components/grouped_test_reports_app_spec.js @@ -232,11 +232,9 @@ describe('Grouped test reports app', () => { }); it('renders resolved errors', () => { - expect( - findAllIssueDescriptions() - .at(2) - .text(), - ).toContain(resolvedFailures.suites[0].resolved_errors[0].name); + expect(findAllIssueDescriptions().at(2).text()).toContain( + resolvedFailures.suites[0].resolved_errors[0].name, + ); }); }); diff --git a/spec/frontend/repository/components/breadcrumbs_spec.js b/spec/frontend/repository/components/breadcrumbs_spec.js index 38e5c9aaca5..a0dc608ddc9 100644 --- a/spec/frontend/repository/components/breadcrumbs_spec.js +++ b/spec/frontend/repository/components/breadcrumbs_spec.js @@ -36,23 +36,15 @@ describe('Repository breadcrumbs component', () => { it('escapes hash in directory path', () => { factory('app/assets/javascripts#'); - expect( - vm - .findAll(RouterLinkStub) - .at(3) - .props('to'), - ).toEqual('/-/tree/app/assets/javascripts%23'); + expect(vm.findAll(RouterLinkStub).at(3).props('to')).toEqual( + '/-/tree/app/assets/javascripts%23', + ); }); it('renders last link as active', () => { factory('app/assets'); - expect( - vm - .findAll(RouterLinkStub) - .at(2) - .attributes('aria-current'), - ).toEqual('page'); + expect(vm.findAll(RouterLinkStub).at(2).attributes('aria-current')).toEqual('page'); }); it('does not render add to tree dropdown when permissions are false', () => { diff --git a/spec/frontend/repository/components/directory_download_links_spec.js b/spec/frontend/repository/components/directory_download_links_spec.js index 4d70b44de08..72c4165c2e9 100644 --- a/spec/frontend/repository/components/directory_download_links_spec.js +++ b/spec/frontend/repository/components/directory_download_links_spec.js @@ -7,7 +7,10 @@ function factory(currentPath) { vm = shallowMount(DirectoryDownloadLinks, { propsData: { currentPath, - links: [{ text: 'zip', path: 'http://test.com/' }, { text: 'tar', path: 'http://test.com/' }], + links: [ + { text: 'zip', path: 'http://test.com/' }, + { text: 'tar', path: 'http://test.com/' }, + ], }, }); } diff --git a/spec/frontend/self_monitor/components/self_monitor_form_spec.js b/spec/frontend/self_monitor/components/self_monitor_form_spec.js index 618cc16cdf4..dfa961c5115 100644 --- a/spec/frontend/self_monitor/components/self_monitor_form_spec.js +++ b/spec/frontend/self_monitor/components/self_monitor_form_spec.js @@ -79,10 +79,7 @@ describe('self monitor component', () => { wrapper = shallowMount(SelfMonitor, { store }); expect( - wrapper - .find({ ref: 'selfMonitoringFormText' }) - .find('a') - .attributes('href'), + wrapper.find({ ref: 'selfMonitoringFormText' }).find('a').attributes('href'), ).toEqual(`${TEST_HOST}/instance-administrators-random/gitlab-self-monitoring`); }); }); diff --git a/spec/frontend/serverless/mock_data.js b/spec/frontend/serverless/mock_data.js index ef616ceb37f..1816ad62a04 100644 --- a/spec/frontend/serverless/mock_data.js +++ b/spec/frontend/serverless/mock_data.js @@ -102,7 +102,10 @@ export const mockMetrics = { result: [ { metric: {}, - values: [[1551352298.756, '0'], [1551352358.756, '0']], + values: [ + [1551352298.756, '0'], + [1551352358.756, '0'], + ], }, ], }, diff --git a/spec/frontend/sidebar/components/assignees/collapsed_assignee_spec.js b/spec/frontend/sidebar/components/assignees/collapsed_assignee_spec.js index 49a6d9e8ae6..ee1f8ed8d2b 100644 --- a/spec/frontend/sidebar/components/assignees/collapsed_assignee_spec.js +++ b/spec/frontend/sidebar/components/assignees/collapsed_assignee_spec.js @@ -28,12 +28,7 @@ describe('CollapsedAssignee assignee component', () => { it('has author name', () => { createComponent(); - expect( - wrapper - .find('.author') - .text() - .trim(), - ).toEqual(TEST_USER.name); + expect(wrapper.find('.author').text().trim()).toEqual(TEST_USER.name); }); it('has assignee avatar', () => { diff --git a/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js b/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js index 638d3706d12..3366d70f0fe 100644 --- a/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js +++ b/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js @@ -119,21 +119,11 @@ describe('SidebarSeverity', () => { }); it('should display only icon with a tooltip', () => { - expect( - findSeverityToken() - .at(0) - .attributes('icononly'), - ).toBe('true'); - expect( - findSeverityToken() - .at(0) - .attributes('iconsize'), - ).toBe('14'); - expect( - findTooltip() - .text() - .replace(/\s+/g, ' '), - ).toContain(`Severity: ${INCIDENT_SEVERITY[severity].label}`); + expect(findSeverityToken().at(0).attributes('icononly')).toBe('true'); + expect(findSeverityToken().at(0).attributes('iconsize')).toBe('14'); + expect(findTooltip().text().replace(/\s+/g, ' ')).toContain( + `Severity: ${INCIDENT_SEVERITY[severity].label}`, + ); }); it('should expand the dropdown on collapsed icon click', async () => { diff --git a/spec/frontend/sidebar/sidebar_move_issue_spec.js b/spec/frontend/sidebar/sidebar_move_issue_spec.js index ad919f69546..ba14c61400f 100644 --- a/spec/frontend/sidebar/sidebar_move_issue_spec.js +++ b/spec/frontend/sidebar/sidebar_move_issue_spec.js @@ -133,10 +133,7 @@ describe('SidebarMoveIssue', () => { // Wait for the autocomplete request to finish setImmediate(() => { - test.$content - .find('.js-move-issue-dropdown-item') - .eq(0) - .trigger('click'); + test.$content.find('.js-move-issue-dropdown-item').eq(0).trigger('click'); expect(test.mediator.setMoveToProjectId).toHaveBeenCalledWith(0); expect(test.$confirmButton.prop('disabled')).toBeTruthy(); @@ -152,10 +149,7 @@ describe('SidebarMoveIssue', () => { // Wait for the autocomplete request to finish setImmediate(() => { - test.$content - .find('.js-move-issue-dropdown-item') - .eq(1) - .trigger('click'); + test.$content.find('.js-move-issue-dropdown-item').eq(1).trigger('click'); expect(test.mediator.setMoveToProjectId).toHaveBeenCalledWith(20); expect(test.$confirmButton.attr('disabled')).toBe(undefined); diff --git a/spec/frontend/sidebar/todo_spec.js b/spec/frontend/sidebar/todo_spec.js index b0e94f16dd7..4adfaf7ad7b 100644 --- a/spec/frontend/sidebar/todo_spec.js +++ b/spec/frontend/sidebar/todo_spec.js @@ -42,12 +42,7 @@ describe('SidebarTodo', () => { ({ isTodo, iconClass, label, icon }) => { createComponent({ isTodo }); - expect( - wrapper - .find(GlIcon) - .classes() - .join(' '), - ).toStrictEqual(iconClass); + expect(wrapper.find(GlIcon).classes().join(' ')).toStrictEqual(iconClass); expect(wrapper.find(GlIcon).props('name')).toStrictEqual(icon); expect(wrapper.find('button').text()).toBe(label); }, 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 055168a1711..ddfbeb9a58f 100644 --- a/spec/frontend/snippets/components/snippet_blob_actions_edit_spec.js +++ b/spec/frontend/snippets/components/snippet_blob_actions_edit_spec.js @@ -50,14 +50,8 @@ describe('snippets/components/snippet_blob_actions_edit', () => { }, classes: index > 0 ? ['gl-mt-3'] : [], })); - const triggerBlobDelete = idx => - findBlobEdits() - .at(idx) - .vm.$emit('delete'); - const triggerBlobUpdate = (idx, props) => - findBlobEdits() - .at(idx) - .vm.$emit('blob-updated', props); + const triggerBlobDelete = idx => findBlobEdits().at(idx).vm.$emit('delete'); + const triggerBlobUpdate = (idx, props) => findBlobEdits().at(idx).vm.$emit('blob-updated', props); afterEach(() => { wrapper.destroy(); @@ -213,11 +207,7 @@ describe('snippets/components/snippet_blob_actions_edit', () => { it('disables delete button', () => { expect(findBlobEdits()).toHaveLength(1); - expect( - findBlobEdits() - .at(0) - .props(), - ).toMatchObject({ + expect(findBlobEdits().at(0).props()).toMatchObject({ showDelete: true, canDelete: false, }); diff --git a/spec/frontend/transfer_edit_spec.js b/spec/frontend/transfer_edit_spec.js index dc9455a569d..ad8c9c68f37 100644 --- a/spec/frontend/transfer_edit_spec.js +++ b/spec/frontend/transfer_edit_spec.js @@ -13,41 +13,19 @@ describe('setupTransferEdit', () => { }); it('disables submit button on load', () => { - expect( - $(formSelector) - .find(':submit') - .prop('disabled'), - ).toBe(true); + expect($(formSelector).find(':submit').prop('disabled')).toBe(true); }); it('enables submit button when selection changes to non-empty value', () => { - const nonEmptyValue = $(formSelector) - .find(targetSelector) - .find('option') - .not(':empty') - .val(); - $(formSelector) - .find(targetSelector) - .val(nonEmptyValue) - .trigger('change'); - - expect( - $(formSelector) - .find(':submit') - .prop('disabled'), - ).toBeFalsy(); + const nonEmptyValue = $(formSelector).find(targetSelector).find('option').not(':empty').val(); + $(formSelector).find(targetSelector).val(nonEmptyValue).trigger('change'); + + expect($(formSelector).find(':submit').prop('disabled')).toBeFalsy(); }); it('disables submit button when selection changes to empty value', () => { - $(formSelector) - .find(targetSelector) - .val('') - .trigger('change'); - - expect( - $(formSelector) - .find(':submit') - .prop('disabled'), - ).toBe(true); + $(formSelector).find(targetSelector).val('').trigger('change'); + + expect($(formSelector).find(':submit').prop('disabled')).toBe(true); }); }); diff --git a/spec/frontend/version_check_image_spec.js b/spec/frontend/version_check_image_spec.js index 2ab157105a1..5bb28687be3 100644 --- a/spec/frontend/version_check_image_spec.js +++ b/spec/frontend/version_check_image_spec.js @@ -19,7 +19,7 @@ describe('VersionCheckImage', () => { it('registers an error event', () => { jest.spyOn($.prototype, 'on').mockImplementation(() => {}); // eslint-disable-next-line func-names - jest.spyOn($.prototype, 'off').mockImplementation(function() { + jest.spyOn($.prototype, 'off').mockImplementation(function () { return this; }); 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 65ca3639dcc..62086de9465 100644 --- a/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js +++ b/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js @@ -31,10 +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; 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 1b1624e3e8f..1097f1f8b8d 100644 --- a/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js +++ b/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js @@ -39,20 +39,10 @@ describe('Artifacts List', () => { }); it('renders job url', () => { - expect( - wrapper - .findAll(GlLink) - .at(1) - .attributes('href'), - ).toEqual(data.artifacts[0].job_path); + expect(wrapper.findAll(GlLink).at(1).attributes('href')).toEqual(data.artifacts[0].job_path); }); it('renders job name', () => { - expect( - wrapper - .findAll(GlLink) - .at(1) - .text(), - ).toEqual(data.artifacts[0].job_name); + expect(wrapper.findAll(GlLink).at(1).text()).toEqual(data.artifacts[0].job_name); }); }); 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 8a604355625..d872ba9ffac 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 @@ -65,18 +65,8 @@ describe('Merge Request Collapsible Extension', () => { }); it('renders the buttons disabled', () => { - expect( - wrapper - .findAll('button') - .at(0) - .attributes('disabled'), - ).toEqual('disabled'); - expect( - wrapper - .findAll('button') - .at(1) - .attributes('disabled'), - ).toEqual('disabled'); + expect(wrapper.findAll('button').at(0).attributes('disabled')).toEqual('disabled'); + expect(wrapper.findAll('button').at(1).attributes('disabled')).toEqual('disabled'); }); it('renders loading spinner', () => { 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 7ecd8629607..7364e0ef15e 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 @@ -72,21 +72,13 @@ describe('MRWidgetPipeline', () => { }); it('should render pipeline ID', () => { - expect( - findPipelineID() - .text() - .trim(), - ).toBe(`#${mockData.pipeline.id}`); + expect(findPipelineID().text().trim()).toBe(`#${mockData.pipeline.id}`); }); it('should render pipeline status and commit id', () => { expect(findPipelineInfoContainer().text()).toMatch(mockData.pipeline.details.status.label); - expect( - findCommitLink() - .text() - .trim(), - ).toBe(mockData.pipeline.commit.short_id); + expect(findCommitLink().text().trim()).toBe(mockData.pipeline.commit.short_id); expect(findCommitLink().attributes('href')).toBe(mockData.pipeline.commit.commit_path); }); @@ -148,11 +140,7 @@ describe('MRWidgetPipeline', () => { }); it('should render pipeline ID', () => { - expect( - findPipelineID() - .text() - .trim(), - ).toBe(`#${mockData.pipeline.id}`); + expect(findPipelineID().text().trim()).toBe(`#${mockData.pipeline.id}`); }); it('should render pipeline status', () => { diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_closed_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_closed_spec.js index 322f440763c..55d7e2391b2 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_closed_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_closed_spec.js @@ -39,10 +39,7 @@ describe('MRWidgetClosed', () => { it('renders closed by information with author and time', () => { expect( - vm.$el - .querySelector('.js-mr-widget-author') - .textContent.trim() - .replace(/\s\s+/g, ' '), + vm.$el.querySelector('.js-mr-widget-author').textContent.trim().replace(/\s\s+/g, ' '), ).toContain('Closed by Administrator less than a minute ago'); }); @@ -54,10 +51,7 @@ describe('MRWidgetClosed', () => { it('renders information about the changes not being merged', () => { expect( - vm.$el - .querySelector('.mr-info-list') - .textContent.trim() - .replace(/\s\s+/g, ' '), + vm.$el.querySelector('.mr-info-list').textContent.trim().replace(/\s\s+/g, ' '), ).toContain('The changes were not merged into so_long_jquery'); }); 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 ad21e6e6f4f..ee67b6aae55 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 @@ -167,12 +167,9 @@ describe('MRWidgetConflicts', () => { }, }); - expect( - vm - .text() - .trim() - .replace(/\s\s+/g, ' '), - ).toContain('ask someone with write access'); + expect(vm.text().trim().replace(/\s\s+/g, ' ')).toContain( + 'ask someone with write access', + ); }); it('should not have action buttons', async () => { 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 9057ffaea45..003415961af 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 @@ -480,7 +480,10 @@ describe('ReadyToMerge', () => { jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged')); jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {}); - vm.handleMergePolling(() => {}, () => {}); + vm.handleMergePolling( + () => {}, + () => {}, + ); setImmediate(() => { const statusBox = document.querySelector('.status-box'); @@ -496,7 +499,10 @@ describe('ReadyToMerge', () => { jest.spyOn(vm.service, 'poll').mockReturnValue(returnPromise('merged')); jest.spyOn(vm, 'initiateRemoveSourceBranchPolling').mockImplementation(() => {}); - vm.handleMergePolling(() => {}, () => {}); + vm.handleMergePolling( + () => {}, + () => {}, + ); setImmediate(() => { expect(document.querySelector('.js-merge-counter').textContent).toBe('0'); @@ -657,10 +663,7 @@ describe('ReadyToMerge', () => { const findCommitsHeaderElement = () => wrapper.find(CommitsHeader); const findCommitEditElements = () => wrapper.findAll(CommitEdit); const findCommitDropdownElement = () => wrapper.find(CommitMessageDropdown); - const findFirstCommitEditLabel = () => - findCommitEditElements() - .at(0) - .props('label'); + const findFirstCommitEditLabel = () => findCommitEditElements().at(0).props('label'); describe('squash checkbox', () => { it('should be rendered when squash before merge is enabled and there is more than 1 commit', () => { diff --git a/spec/frontend/vue_mr_widget/mock_data.js b/spec/frontend/vue_mr_widget/mock_data.js index 8ee920f06a1..7f82f3ee233 100644 --- a/spec/frontend/vue_mr_widget/mock_data.js +++ b/spec/frontend/vue_mr_widget/mock_data.js @@ -194,7 +194,10 @@ export default { updated_at: '2017-04-07T15:28:44.800Z', }, pipelineCoverageDelta: '15.25', - buildsWithCoverage: [{ name: 'karma', coverage: '40.2' }, { name: 'rspec', coverage: '80.4' }], + buildsWithCoverage: [ + { name: 'karma', coverage: '40.2' }, + { name: 'rspec', coverage: '80.4' }, + ], work_in_progress: false, source_branch_exists: false, mergeable_discussions_state: true, diff --git a/spec/frontend/vue_mr_widget/mr_widget_how_to_merge_modal_spec.js b/spec/frontend/vue_mr_widget/mr_widget_how_to_merge_modal_spec.js index aaaee3327a8..bd22183cbea 100644 --- a/spec/frontend/vue_mr_widget/mr_widget_how_to_merge_modal_spec.js +++ b/spec/frontend/vue_mr_widget/mr_widget_how_to_merge_modal_spec.js @@ -50,19 +50,11 @@ describe('MRWidgetHowToMerge', () => { it('should render different instructions based on if the user can merge', () => { mountComponent({ props: { canMerge: true } }); - expect( - findInstructionsFields() - .at(2) - .text(), - ).toContain('git push origin'); + expect(findInstructionsFields().at(2).text()).toContain('git push origin'); }); it('should render different instructions based on if the merge is based off a fork', () => { mountComponent({ props: { isFork: true } }); - expect( - findInstructionsFields() - .at(0) - .text(), - ).toContain('FETCH_HEAD'); + expect(findInstructionsFields().at(0).text()).toContain('FETCH_HEAD'); }); }); diff --git a/spec/frontend/vue_shared/components/awards_list_spec.js b/spec/frontend/vue_shared/components/awards_list_spec.js index d20de81c446..0fcb7a41f17 100644 --- a/spec/frontend/vue_shared/components/awards_list_spec.js +++ b/spec/frontend/vue_shared/components/awards_list_spec.js @@ -135,9 +135,7 @@ describe('vue_shared/components/awards_list', () => { it('with award clicked, it emits award', () => { expect(wrapper.emitted().award).toBeUndefined(); - findAwardButtons() - .at(2) - .vm.$emit('click'); + findAwardButtons().at(2).vm.$emit('click'); expect(wrapper.emitted().award).toEqual([[EMOJI_SMILE]]); }); @@ -162,9 +160,7 @@ describe('vue_shared/components/awards_list', () => { it('when clicked, it emits award as number', () => { expect(wrapper.emitted().award).toBeUndefined(); - findAwardButtons() - .at(0) - .vm.$emit('click'); + findAwardButtons().at(0).vm.$emit('click'); expect(wrapper.emitted().award).toEqual([[Number(EMOJI_100)]]); }); diff --git a/spec/frontend/vue_shared/components/color_picker/color_picker_spec.js b/spec/frontend/vue_shared/components/color_picker/color_picker_spec.js index a50a4b742b3..c8fe6c3131c 100644 --- a/spec/frontend/vue_shared/components/color_picker/color_picker_spec.js +++ b/spec/frontend/vue_shared/components/color_picker/color_picker_spec.js @@ -130,9 +130,7 @@ describe('ColorPicker', () => { it('has preset color selected', async () => { createComponent(); - await presetColors() - .at(0) - .trigger('click'); + await presetColors().at(0).trigger('click'); expect(wrapper.vm.$data.selectedColor).toBe(setColor); }); diff --git a/spec/frontend/vue_shared/components/commit_spec.js b/spec/frontend/vue_shared/components/commit_spec.js index 9b5c0941a0d..b420e220081 100644 --- a/spec/frontend/vue_shared/components/commit_spec.js +++ b/spec/frontend/vue_shared/components/commit_spec.js @@ -43,12 +43,7 @@ describe('Commit component', () => { }, }); - expect( - wrapper - .find('.icon-container') - .find(GlIcon) - .exists(), - ).toBe(true); + expect(wrapper.find('.icon-container').find(GlIcon).exists()).toBe(true); }); describe('Given all the props', () => { diff --git a/spec/frontend/vue_shared/components/expand_button_spec.js b/spec/frontend/vue_shared/components/expand_button_spec.js index aea90e5b31f..09566c6d959 100644 --- a/spec/frontend/vue_shared/components/expand_button_spec.js +++ b/spec/frontend/vue_shared/components/expand_button_spec.js @@ -41,12 +41,7 @@ describe('Expand button', () => { }); it('does not render expanded text', () => { - expect( - wrapper - .find(ExpandButton) - .text() - .trim(), - ).not.toBe(text.short); + expect(wrapper.find(ExpandButton).text().trim()).not.toBe(text.short); }); describe('when short text is provided', () => { @@ -60,12 +55,7 @@ describe('Expand button', () => { }); it('renders short text', () => { - expect( - wrapper - .find(ExpandButton) - .text() - .trim(), - ).toBe(text.short); + expect(wrapper.find(ExpandButton).text().trim()).toBe(text.short); }); it('renders button before text', () => { @@ -108,12 +98,7 @@ describe('Expand button', () => { }); it('only renders expanded text', () => { - expect( - wrapper - .find(ExpandButton) - .text() - .trim(), - ).toBe(text.expanded); + expect(wrapper.find(ExpandButton).text().trim()).toBe(text.expanded); }); it('renders button after text', () => { @@ -140,21 +125,11 @@ describe('Expand button', () => { }); it('clicking hides expanded text', () => { - expect( - wrapper - .find(ExpandButton) - .text() - .trim(), - ).toBe(text.expanded); + expect(wrapper.find(ExpandButton).text().trim()).toBe(text.expanded); expanderAppendEl().trigger('click'); return wrapper.vm.$nextTick().then(() => { - expect( - wrapper - .find(ExpandButton) - .text() - .trim(), - ).not.toBe(text.expanded); + expect(wrapper.find(ExpandButton).text().trim()).not.toBe(text.expanded); }); }); @@ -172,21 +147,11 @@ describe('Expand button', () => { }); it('clicking reveals short text', () => { - expect( - wrapper - .find(ExpandButton) - .text() - .trim(), - ).toBe(text.expanded); + expect(wrapper.find(ExpandButton).text().trim()).toBe(text.expanded); expanderAppendEl().trigger('click'); return wrapper.vm.$nextTick().then(() => { - expect( - wrapper - .find(ExpandButton) - .text() - .trim(), - ).toBe(text.short); + expect(wrapper.find(ExpandButton).text().trim()).toBe(text.short); }); }); }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_utils_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_utils_spec.js index 4869e75a2f3..9e96c154546 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_utils_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_utils_spec.js @@ -82,7 +82,10 @@ describe('prepareTokens', () => { ], [ 'assignees', - [{ value: 'krillin', operator: '=' }, { value: 'piccolo', operator: '!=' }], + [ + { value: 'krillin', operator: '=' }, + { value: 'piccolo', operator: '!=' }, + ], [ { type: 'assignees', value: { data: 'krillin', operator: '=' } }, { type: 'assignees', value: { data: 'piccolo', operator: '!=' } }, @@ -90,7 +93,10 @@ describe('prepareTokens', () => { ], [ 'foo', - [{ value: 'bar', operator: '!=' }, { value: 'baz', operator: '!=' }], + [ + { value: 'bar', operator: '!=' }, + { value: 'baz', operator: '!=' }, + ], [ { type: 'foo', value: { data: 'bar', operator: '!=' } }, { type: 'foo', value: { data: 'baz', operator: '!=' } }, @@ -112,7 +118,10 @@ describe('processFilters', () => { expect(result).toStrictEqual({ foo: [{ value: 'foo', operator: '=' }], - bar: [{ value: 'bar1', operator: '=' }, { value: 'bar2', operator: '!=' }], + bar: [ + { value: 'bar1', operator: '=' }, + { value: 'bar2', operator: '!=' }, + ], }); }); @@ -164,17 +173,26 @@ describe('filterToQueryObject', () => { ], [ 'foo', - [{ value: 'bar', operator: '=' }, { value: 'baz', operator: '=' }], + [ + { value: 'bar', operator: '=' }, + { value: 'baz', operator: '=' }, + ], { foo: ['bar', 'baz'], 'not[foo]': null }, ], [ 'foo', - [{ value: 'bar', operator: '!=' }, { value: 'baz', operator: '!=' }], + [ + { value: 'bar', operator: '!=' }, + { value: 'baz', operator: '!=' }, + ], { foo: null, 'not[foo]': ['bar', 'baz'] }, ], [ 'foo', - [{ value: 'bar', operator: '!=' }, { value: 'baz', operator: '=' }], + [ + { value: 'bar', operator: '!=' }, + { value: 'baz', operator: '=' }, + ], { foo: ['baz'], 'not[foo]': ['bar'] }, ], ])('gathers filter values %s=%j into query object=%j', (token, value, result) => { @@ -200,15 +218,30 @@ describe('urlQueryToFilter', () => { ['not[foo]=bar&foo=baz', { foo: { value: 'baz', operator: '=' } }], [ 'foo[]=bar&foo[]=baz¬[foo]=', - { foo: [{ value: 'bar', operator: '=' }, { value: 'baz', operator: '=' }] }, + { + foo: [ + { value: 'bar', operator: '=' }, + { value: 'baz', operator: '=' }, + ], + }, ], [ 'foo[]=¬[foo][]=bar¬[foo][]=baz', - { foo: [{ value: 'bar', operator: '!=' }, { value: 'baz', operator: '!=' }] }, + { + foo: [ + { value: 'bar', operator: '!=' }, + { value: 'baz', operator: '!=' }, + ], + }, ], [ 'foo[]=baz¬[foo][]=bar', - { foo: [{ value: 'baz', operator: '=' }, { value: 'bar', operator: '!=' }] }, + { + foo: [ + { value: 'baz', operator: '=' }, + { value: 'bar', operator: '!=' }, + ], + }, ], ['not[foo][]=bar', { foo: [{ value: 'bar', operator: '!=' }] }], ])('gathers filter values %s into query object=%j', (query, result) => { diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js b/spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js index 64fbe70696d..2c7b6de9ce3 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/mock_data.js @@ -110,7 +110,10 @@ export const mockMembershipToken = { token: GlFilteredSearchToken, unique: true, operators: [{ value: '=', description: 'is' }], - options: [{ value: 'exclude', title: 'Direct' }, { value: 'only', title: 'Inherited' }], + options: [ + { value: 'exclude', title: 'Direct' }, + { value: 'only', title: 'Inherited' }, + ], }; export const mockMembershipTokenOptionsWithoutTitles = { diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js index 74172db81c2..e3ca2a710d0 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js @@ -181,12 +181,9 @@ describe('LabelToken', () => { expect(tokenSegments).toHaveLength(3); // Label, =, "Foo Label" expect(tokenSegments.at(2).text()).toBe(`~${mockRegularLabel.title}`); // "Foo Label" - expect( - tokenSegments - .at(2) - .find('.gl-token') - .attributes('style'), - ).toBe('background-color: rgb(186, 218, 85); color: rgb(255, 255, 255);'); + expect(tokenSegments.at(2).find('.gl-token').attributes('style')).toBe( + 'background-color: rgb(186, 218, 85); color: rgb(255, 255, 255);', + ); }); it('renders provided defaultLabels as suggestions', async () => { diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js index 67f9a9c70cc..0247833cf22 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js @@ -140,7 +140,10 @@ describe('MilestoneToken', () => { }); describe('template', () => { - const defaultMilestones = [{ text: 'foo', value: 'foo' }, { text: 'bar', value: 'baz' }]; + const defaultMilestones = [ + { text: 'foo', value: 'foo' }, + { text: 'bar', value: 'baz' }, + ]; beforeEach(async () => { wrapper = createComponent({ value: { data: `"${mockRegularMilestone.title}"` } }); diff --git a/spec/frontend/vue_shared/components/gl_countdown_spec.js b/spec/frontend/vue_shared/components/gl_countdown_spec.js index 365c9fad478..1c56b451776 100644 --- a/spec/frontend/vue_shared/components/gl_countdown_spec.js +++ b/spec/frontend/vue_shared/components/gl_countdown_spec.js @@ -22,9 +22,7 @@ describe('GlCountdown', () => { endDateString: '2000-01-01T01:02:03Z', }); - Vue.nextTick() - .then(done) - .catch(done.fail); + Vue.nextTick().then(done).catch(done.fail); }); it('displays remaining time', () => { @@ -50,9 +48,7 @@ describe('GlCountdown', () => { endDateString: '1900-01-01T00:00:00Z', }); - Vue.nextTick() - .then(done) - .catch(done.fail); + Vue.nextTick().then(done).catch(done.fail); }); it('displays 00:00:00', () => { diff --git a/spec/frontend/vue_shared/components/issue/related_issuable_item_spec.js b/spec/frontend/vue_shared/components/issue/related_issuable_item_spec.js index 2319bf61482..441d73caf5b 100644 --- a/spec/frontend/vue_shared/components/issue/related_issuable_item_spec.js +++ b/spec/frontend/vue_shared/components/issue/related_issuable_item_spec.js @@ -115,9 +115,7 @@ describe('RelatedIssuableItem', () => { const tokenMetadata = () => wrapper.find('.item-meta'); it('renders item path and ID', () => { - const pathAndID = tokenMetadata() - .find('.item-path-id') - .text(); + const pathAndID = tokenMetadata().find('.item-path-id').text(); expect(pathAndID).toContain('gitlab-org/gitlab-test'); expect(pathAndID).toContain('#1'); diff --git a/spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js b/spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js index b67f4cf12bf..f9a8b64f89b 100644 --- a/spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js +++ b/spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js @@ -61,11 +61,7 @@ describe('SuggestionDiffRow', () => { }); expect(wrapper.classes()).toContain('line_holder'); - expect( - findSuggestionContent() - .find('span') - .classes(), - ).toContain('line'); + expect(findSuggestionContent().find('span').classes()).toContain('line'); }); it('renders the rich text when it is available', () => { diff --git a/spec/frontend/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs_spec.js b/spec/frontend/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs_spec.js index 0f7c8e97635..491f783622a 100644 --- a/spec/frontend/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs_spec.js +++ b/spec/frontend/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs_spec.js @@ -124,7 +124,10 @@ describe('AlertManagementEmptyState', () => { it('renders the tabs selection with valid tabs', () => { mountComponent({ props: { - statusTabs: [{ status: 'opened', title: 'Open' }, { status: 'closed', title: 'Closed' }], + statusTabs: [ + { status: 'opened', title: 'Open' }, + { status: 'closed', title: 'Closed' }, + ], }, }); @@ -216,12 +219,7 @@ describe('AlertManagementEmptyState', () => { findPagination().vm.$emit('input', 3); await wrapper.vm.$nextTick(); - expect( - findPagination() - .findAll('.page-item') - .at(0) - .text(), - ).toBe('Prev'); + expect(findPagination().findAll('.page-item').at(0).text()).toBe('Prev'); }); it('returns prevPage number', async () => { @@ -244,12 +242,7 @@ describe('AlertManagementEmptyState', () => { findPagination().vm.$emit('input', 3); await wrapper.vm.$nextTick(); - expect( - findPagination() - .findAll('.page-item') - .at(1) - .text(), - ).toBe('Next'); + expect(findPagination().findAll('.page-item').at(1).text()).toBe('Next'); }); it('returns nextPage number', async () => { 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 b743a663f06..24a2cb7ae06 100644 --- a/spec/frontend/vue_shared/components/registry/title_area_spec.js +++ b/spec/frontend/vue_shared/components/registry/title_area_spec.js @@ -142,16 +142,8 @@ describe('title area', () => { await wrapper.vm.$nextTick(); - expect( - findSlotOrderElements() - .at(0) - .attributes('data-testid'), - ).toBe(DYNAMIC_SLOT); - expect( - findSlotOrderElements() - .at(1) - .attributes('data-testid'), - ).toBe('metadata-foo'); + expect(findSlotOrderElements().at(0).attributes('data-testid')).toBe(DYNAMIC_SLOT); + expect(findSlotOrderElements().at(1).attributes('data-testid')).toBe('metadata-foo'); }); }); diff --git a/spec/frontend/vue_shared/components/sidebar/date_picker_spec.js b/spec/frontend/vue_shared/components/sidebar/date_picker_spec.js index 47edfbe3115..fc1fa3fc1c1 100644 --- a/spec/frontend/vue_shared/components/sidebar/date_picker_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/date_picker_spec.js @@ -46,12 +46,7 @@ describe('SidebarDatePicker', () => { it('should render None if there is no selectedDate', () => { mountComponent(); - expect( - wrapper - .find('.value-content span') - .text() - .trim(), - ).toEqual('None'); + expect(wrapper.find('.value-content span').text().trim()).toEqual('None'); }); it('should render date-picker when editing', () => { @@ -63,12 +58,7 @@ describe('SidebarDatePicker', () => { it('should render label', () => { const label = 'label'; mountComponent({ label }); - expect( - wrapper - .find('.title') - .text() - .trim(), - ).toEqual(label); + expect(wrapper.find('.title').text().trim()).toEqual(label); }); it('should render loading-icon when isLoading', () => { @@ -82,12 +72,7 @@ describe('SidebarDatePicker', () => { }); it('should render edit button', () => { - expect( - wrapper - .find('.title .btn-blank') - .text() - .trim(), - ).toEqual('Edit'); + expect(wrapper.find('.title .btn-blank').text().trim()).toEqual('Edit'); }); it('should enable editing when edit button is clicked', async () => { @@ -102,12 +87,7 @@ describe('SidebarDatePicker', () => { it('should render date if selectedDate', () => { mountComponent({ selectedDate: new Date('07/07/2017') }); - expect( - wrapper - .find('.value-content strong') - .text() - .trim(), - ).toEqual('Jul 7, 2017'); + expect(wrapper.find('.value-content strong').text().trim()).toEqual('Jul 7, 2017'); }); describe('selectedDate and editable', () => { @@ -116,12 +96,7 @@ describe('SidebarDatePicker', () => { }); it('should render remove button if selectedDate and editable', () => { - expect( - wrapper - .find('.value-content .btn-blank') - .text() - .trim(), - ).toEqual('remove'); + expect(wrapper.find('.value-content .btn-blank').text().trim()).toEqual('remove'); }); it('should emit saveDate with null when remove button is clicked', () => { diff --git a/spec/frontend/vue_shared/components/sidebar/issuable_move_dropdown_spec.js b/spec/frontend/vue_shared/components/sidebar/issuable_move_dropdown_spec.js index a97e26caf53..256b3cff525 100644 --- a/spec/frontend/vue_shared/components/sidebar/issuable_move_dropdown_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/issuable_move_dropdown_spec.js @@ -184,11 +184,7 @@ describe('IssuableMoveDropdown', () => { }); it('renders gl-dropdown-form component', () => { - expect( - findDropdownEl() - .find(GlDropdownForm) - .exists(), - ).toBe(true); + expect(findDropdownEl().find(GlDropdownForm).exists()).toBe(true); }); it('renders header element', () => { @@ -216,11 +212,7 @@ describe('IssuableMoveDropdown', () => { await wrapper.vm.$nextTick(); - expect( - findDropdownEl() - .find(GlLoadingIcon) - .exists(), - ).toBe(true); + expect(findDropdownEl().find(GlLoadingIcon).exists()).toBe(true); }); it('renders gl-dropdown-item components for available projects', async () => { @@ -288,10 +280,7 @@ describe('IssuableMoveDropdown', () => { await wrapper.vm.$nextTick(); expect( - wrapper - .find('[data-testid="footer"]') - .find(GlButton) - .attributes('disabled'), + wrapper.find('[data-testid="footer"]').find(GlButton).attributes('disabled'), ).not.toBeDefined(); }); }); @@ -331,10 +320,7 @@ describe('IssuableMoveDropdown', () => { }); it('close icon in dropdown header closes the dropdown when clicked', () => { - wrapper - .find('[data-testid="header"]') - .find(GlButton) - .vm.$emit('click', mockEvent); + wrapper.find('[data-testid="header"]').find(GlButton).vm.$emit('click', mockEvent); expect(wrapper.vm.$refs.dropdown.hide).toHaveBeenCalled(); }); @@ -346,10 +332,7 @@ describe('IssuableMoveDropdown', () => { await wrapper.vm.$nextTick(); - wrapper - .findAll(GlDropdownItem) - .at(0) - .vm.$emit('click', mockEvent); + wrapper.findAll(GlDropdownItem).at(0).vm.$emit('click', mockEvent); expect(wrapper.vm.selectedProject).toBe(mockProjects[0]); }); @@ -361,10 +344,7 @@ describe('IssuableMoveDropdown', () => { await wrapper.vm.$nextTick(); - wrapper - .find('[data-testid="footer"]') - .find(GlButton) - .vm.$emit('click'); + wrapper.find('[data-testid="footer"]').find(GlButton).vm.$emit('click'); expect(wrapper.vm.$refs.dropdown.hide).toHaveBeenCalled(); expect(wrapper.emitted('move-issuable')).toBeTruthy(); diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_spec.js index 53e8a0e1278..ecb3c3a42c8 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_spec.js @@ -71,12 +71,7 @@ describe('DropdownValueComponent', () => { it('render slot content inside component when `labels` prop is empty', () => { const vmEmptyLabels = createComponent([]); - expect( - vmEmptyLabels - .find('.text-secondary') - .text() - .trim(), - ).toBe(mockConfig.emptyValueText); + expect(vmEmptyLabels.find('.text-secondary').text().trim()).toBe(mockConfig.emptyValueText); vmEmptyLabels.destroy(); }); 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 04320a72be6..14273afc979 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 @@ -125,10 +125,7 @@ describe('DropdownContentsCreateView', () => { }); it('renders dropdown back button element', () => { - const backBtnEl = wrapper - .find('.dropdown-title') - .findAll(GlButton) - .at(0); + const backBtnEl = wrapper.find('.dropdown-title').findAll(GlButton).at(0); expect(backBtnEl.exists()).toBe(true); expect(backBtnEl.attributes('aria-label')).toBe('Go back'); @@ -143,10 +140,7 @@ describe('DropdownContentsCreateView', () => { }); it('renders dropdown close button element', () => { - const closeBtnEl = wrapper - .find('.dropdown-title') - .findAll(GlButton) - .at(1); + const closeBtnEl = wrapper.find('.dropdown-title').findAll(GlButton).at(1); expect(closeBtnEl.exists()).toBe(true); expect(closeBtnEl.attributes('aria-label')).toBe('Close'); @@ -190,10 +184,7 @@ describe('DropdownContentsCreateView', () => { }); it('renders create button element', () => { - const createBtnEl = wrapper - .find('.dropdown-actions') - .findAll(GlButton) - .at(0); + const createBtnEl = wrapper.find('.dropdown-actions').findAll(GlButton).at(0); expect(createBtnEl.exists()).toBe(true); expect(createBtnEl.text()).toContain('Create'); @@ -211,10 +202,7 @@ describe('DropdownContentsCreateView', () => { }); it('renders cancel button element', () => { - const cancelBtnEl = wrapper - .find('.dropdown-actions') - .findAll(GlButton) - .at(1); + const cancelBtnEl = wrapper.find('.dropdown-actions').findAll(GlButton).at(1); expect(cancelBtnEl.exists()).toBe(true); expect(cancelBtnEl.text()).toContain('Cancel'); diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js index 78367b3a5b4..989cd256e26 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js @@ -371,9 +371,7 @@ describe('DropdownContentsLabelsView', () => { wrapper.vm.$store.state.allowLabelCreate = false; return wrapper.vm.$nextTick(() => { - const createLabelLink = findDropdownFooter() - .findAll(GlLink) - .at(0); + const createLabelLink = findDropdownFooter().findAll(GlLink).at(0); expect(createLabelLink.text()).not.toBe('Create label'); }); diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/getters_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/getters_spec.js index 52116f757c5..1f899e84897 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/getters_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/getters_spec.js @@ -26,7 +26,10 @@ describe('LabelsSelect Getters', () => { }); it('returns first label title and remaining labels count when state.labels has more than 1 label', () => { - const labels = [{ id: 1, title: 'Foo', set: true }, { id: 2, title: 'Bar', set: true }]; + const labels = [ + { id: 1, title: 'Foo', set: true }, + { id: 2, title: 'Bar', set: true }, + ]; expect(getters.dropdownButtonText({ labels }, { isDropdownVariantSidebar: true })).toBe( 'Foo +1 more', diff --git a/spec/frontend/vue_shared/components/split_button_spec.js b/spec/frontend/vue_shared/components/split_button_spec.js index e09bc073042..f1a427e1351 100644 --- a/spec/frontend/vue_shared/components/split_button_spec.js +++ b/spec/frontend/vue_shared/components/split_button_spec.js @@ -26,10 +26,7 @@ describe('SplitButton', () => { }; const findDropdown = () => wrapper.find(GlDropdown); - const findDropdownItem = (index = 0) => - findDropdown() - .findAll(GlDropdownItem) - .at(index); + const findDropdownItem = (index = 0) => findDropdown().findAll(GlDropdownItem).at(index); const selectItem = index => { findDropdownItem(index).vm.$emit('click'); diff --git a/spec/frontend/vue_shared/directives/tooltip_spec.js b/spec/frontend/vue_shared/directives/tooltip_spec.js index 4217b8d3c02..31ea48b941d 100644 --- a/spec/frontend/vue_shared/directives/tooltip_spec.js +++ b/spec/frontend/vue_shared/directives/tooltip_spec.js @@ -151,11 +151,7 @@ describe('Tooltip directive', () => { }); it('should have tooltip plugin applied to all instances', () => { - expect( - $(wrapper.vm.$el) - .find('.js-look-for-tooltip') - .data('bs.tooltip'), - ).toBeDefined(); + expect($(wrapper.vm.$el).find('.js-look-for-tooltip').data('bs.tooltip')).toBeDefined(); }); }); }); diff --git a/spec/frontend_integration/ide/helpers/ide_helper.js b/spec/frontend_integration/ide/helpers/ide_helper.js index 7ae7c4cb0b6..212ec06b766 100644 --- a/spec/frontend_integration/ide/helpers/ide_helper.js +++ b/spec/frontend_integration/ide/helpers/ide_helper.js @@ -122,10 +122,7 @@ export const waitForTabToOpen = fileName => findByText(document.querySelector('.multi-file-edit-pane'), fileName); export const createFile = async (path, content) => { - const parentPath = path - .split('/') - .slice(0, -1) - .join('/'); + const parentPath = path.split('/').slice(0, -1).join('/'); const parentRow = await findAndTraverseToPath(parentPath); diff --git a/spec/frontend_integration/test_helpers/factories/commit_id.js b/spec/frontend_integration/test_helpers/factories/commit_id.js index 9fa278c9dde..815da19a2d9 100644 --- a/spec/frontend_integration/test_helpers/factories/commit_id.js +++ b/spec/frontend_integration/test_helpers/factories/commit_id.js @@ -1,7 +1,5 @@ const COMMIT_ID_LENGTH = 40; -const DEFAULT_COMMIT_ID = Array(COMMIT_ID_LENGTH) - .fill('0') - .join(''); +const DEFAULT_COMMIT_ID = Array(COMMIT_ID_LENGTH).fill('0').join(''); export const createCommitId = (index = 0) => `${index}${DEFAULT_COMMIT_ID}`.substr(0, COMMIT_ID_LENGTH); diff --git a/spec/frontend_integration/test_helpers/utils/obj_spec.js b/spec/frontend_integration/test_helpers/utils/obj_spec.js index 0ad7b4a1a4c..614250ccddc 100644 --- a/spec/frontend_integration/test_helpers/utils/obj_spec.js +++ b/spec/frontend_integration/test_helpers/utils/obj_spec.js @@ -3,9 +3,9 @@ import { withKeys, withValues } from './obj'; describe('frontend_integration/test_helpers/utils/obj', () => { describe('withKeys', () => { it('picks and maps keys', () => { - expect(withKeys({ a: '123', b: 456, c: 'd' }, { b: 'lorem', c: 'ipsum', z: 'zed ' })).toEqual( - { lorem: 456, ipsum: 'd' }, - ); + expect( + withKeys({ a: '123', b: 456, c: 'd' }, { b: 'lorem', c: 'ipsum', z: 'zed ' }), + ).toEqual({ lorem: 456, ipsum: 'd' }); }); }); diff --git a/spec/javascripts/fly_out_nav_browser_spec.js b/spec/javascripts/fly_out_nav_browser_spec.js index f84cee72042..c7949640ce9 100644 --- a/spec/javascripts/fly_out_nav_browser_spec.js +++ b/spec/javascripts/fly_out_nav_browser_spec.js @@ -255,8 +255,9 @@ describe('Fly out sidebar navigation', () => { showSubLevelItems(el); expect(subItems.style.transform).toBe( - `translate3d(200px, ${Math.floor(el.getBoundingClientRect().top) - - getHeaderHeight()}px, 0px)`, + `translate3d(200px, ${ + Math.floor(el.getBoundingClientRect().top) - getHeaderHeight() + }px, 0px)`, ); }); diff --git a/spec/javascripts/lib/utils/browser_spec.js b/spec/javascripts/lib/utils/browser_spec.js index 6b1074a3b4f..a537719f238 100644 --- a/spec/javascripts/lib/utils/browser_spec.js +++ b/spec/javascripts/lib/utils/browser_spec.js @@ -24,7 +24,7 @@ const PIXEL_TOLERANCE = 0.2; const urlToImage = url => new Promise(resolve => { const img = new Image(); - img.onload = function() { + img.onload = function () { resolve(img); }; img.src = url; diff --git a/spec/javascripts/matchers.js b/spec/javascripts/matchers.js index 5b7b7dc78b1..b698f283eb4 100644 --- a/spec/javascripts/matchers.js +++ b/spec/javascripts/matchers.js @@ -32,8 +32,9 @@ export default { return { pass: differentPixels < 20, - message: `${differentPixels} pixels differ more than ${threshold * - 100} percent between input and output.`, + message: `${differentPixels} pixels differ more than ${ + threshold * 100 + } percent between input and output.`, }; }, }; diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js index b37a53515a6..012b5059090 100644 --- a/spec/javascripts/test_bundle.js +++ b/spec/javascripts/test_bundle.js @@ -40,7 +40,7 @@ Vue.config.warnHandler = (msg, vm, trace) => { }; let hasVueErrors = false; -Vue.config.errorHandler = function(err) { +Vue.config.errorHandler = function (err) { hasVueErrors = true; fail(err); }; @@ -118,8 +118,8 @@ testContexts.forEach(context => { } catch (err) { console.log(err); console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path); - describe('Test bundle', function() { - it(`includes '${path}'`, function() { + describe('Test bundle', function () { + it(`includes '${path}'`, function () { expect(err).toBeNull(); }); }); diff --git a/spec/lib/gitlab/database/postgres_hll/batch_distinct_counter_spec.rb b/spec/lib/gitlab/database/postgres_hll/batch_distinct_counter_spec.rb index 934e2274358..2c550f14a08 100644 --- a/spec/lib/gitlab/database/postgres_hll/batch_distinct_counter_spec.rb +++ b/spec/lib/gitlab/database/postgres_hll/batch_distinct_counter_spec.rb @@ -24,107 +24,48 @@ RSpec.describe Gitlab::Database::PostgresHll::BatchDistinctCounter do allow(ActiveRecord::Base.connection).to receive(:transaction_open?).and_return(in_transaction) end - context 'different distribution of relation records' do - [10, 100, 100_000].each do |spread| - context "records are spread within #{spread}" do - before do - ids = (1..spread).to_a.sample(10) - create_list(:issue, 10).each_with_index do |issue, i| - issue.id = ids[i] - end - end - - it 'counts table' do - expect(described_class.new(model).estimate_distinct_count).to be_within(error_rate).percent_of(10) - end - end - end - end - context 'unit test for different counting parameters' do before_all do create_list(:issue, 3, author: user) create_list(:issue, 2, author: another_user) end - describe '#estimate_distinct_count' do - it 'counts table' do - expect(described_class.new(model).estimate_distinct_count).to be_within(error_rate).percent_of(5) - end - - it 'counts with column field' do - expect(described_class.new(model, column).estimate_distinct_count).to be_within(error_rate).percent_of(2) - end - - it 'counts with :id field' do - expect(described_class.new(model, :id).estimate_distinct_count).to be_within(error_rate).percent_of(5) - end - - it 'counts with "id" field' do - expect(described_class.new(model, "id").estimate_distinct_count).to be_within(error_rate).percent_of(5) - end - - it 'counts with table.column field' do - expect(described_class.new(model, "#{model.table_name}.#{column}").estimate_distinct_count).to be_within(error_rate).percent_of(2) - end - - it 'counts with Arel column' do - expect(described_class.new(model, model.arel_table[column]).estimate_distinct_count).to be_within(error_rate).percent_of(2) - end - - it 'counts over joined relations' do - expect(described_class.new(model.joins(:author), "users.email").estimate_distinct_count).to be_within(error_rate).percent_of(2) - end - - it 'counts with :column field with batch_size of 50K' do - expect(described_class.new(model, column).estimate_distinct_count(batch_size: 50_000)).to be_within(error_rate).percent_of(2) - end - - it 'will not count table with a batch size less than allowed' do - expect(described_class.new(model, column).estimate_distinct_count(batch_size: small_batch_size)).to eq(fallback) - end - - it 'counts with different number of batches and aggregates total result' do - stub_const('Gitlab::Database::PostgresHll::BatchDistinctCounter::MIN_REQUIRED_BATCH_SIZE', 0) - - [1, 2, 4, 5, 6].each { |i| expect(described_class.new(model).estimate_distinct_count(batch_size: i)).to be_within(error_rate).percent_of(5) } - end - - it 'counts with a start and finish' do - expect(described_class.new(model, column).estimate_distinct_count(start: model.minimum(:id), finish: model.maximum(:id))).to be_within(error_rate).percent_of(2) + describe '#execute' do + it 'builds hll buckets' do + expect(described_class.new(model).execute).to be_an_instance_of(Gitlab::Database::PostgresHll::Buckets) end - it "defaults the batch size to #{Gitlab::Database::PostgresHll::BatchDistinctCounter::DEFAULT_BATCH_SIZE}" do + it "defaults batch size to #{Gitlab::Database::PostgresHll::BatchDistinctCounter::DEFAULT_BATCH_SIZE}" do min_id = model.minimum(:id) batch_end_id = min_id + calculate_batch_size(Gitlab::Database::PostgresHll::BatchDistinctCounter::DEFAULT_BATCH_SIZE) expect(model).to receive(:where).with("id" => min_id..batch_end_id).and_call_original - described_class.new(model).estimate_distinct_count + described_class.new(model).execute end context 'when a transaction is open' do let(:in_transaction) { true } it 'raises an error' do - expect { described_class.new(model, column).estimate_distinct_count }.to raise_error('BatchCount can not be run inside a transaction') + expect { described_class.new(model, column).execute }.to raise_error('BatchCount can not be run inside a transaction') end end context 'disallowed configurations' do let(:default_batch_size) { Gitlab::Database::PostgresHll::BatchDistinctCounter::DEFAULT_BATCH_SIZE } - it 'returns fallback if start is bigger than finish' do - expect(described_class.new(model, column).estimate_distinct_count(start: 1, finish: 0)).to eq(fallback) + it 'raises WRONG_CONFIGURATION_ERROR if start is bigger than finish' do + expect { described_class.new(model, column).execute(start: 1, finish: 0) }.to raise_error(described_class::WRONG_CONFIGURATION_ERROR) end - it 'returns fallback if data volume exceeds upper limit' do + it 'raises WRONG_CONFIGURATION_ERROR if data volume exceeds upper limit' do large_finish = Gitlab::Database::PostgresHll::BatchDistinctCounter::MAX_DATA_VOLUME + 1 - expect(described_class.new(model, column).estimate_distinct_count(start: 1, finish: large_finish)).to eq(fallback) + expect { described_class.new(model, column).execute(start: 1, finish: large_finish) }.to raise_error(described_class::WRONG_CONFIGURATION_ERROR) end - it 'returns fallback if batch size is less than min required' do - expect(described_class.new(model, column).estimate_distinct_count(batch_size: small_batch_size)).to eq(fallback) + it 'raises WRONG_CONFIGURATION_ERROR if batch size is less than min required' do + expect { described_class.new(model, column).execute(batch_size: small_batch_size) }.to raise_error(described_class::WRONG_CONFIGURATION_ERROR) end end end diff --git a/spec/lib/gitlab/database/postgres_hll/buckets_spec.rb b/spec/lib/gitlab/database/postgres_hll/buckets_spec.rb new file mode 100644 index 00000000000..b4d8fd4a449 --- /dev/null +++ b/spec/lib/gitlab/database/postgres_hll/buckets_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Database::PostgresHll::Buckets do + let(:error_rate) { Gitlab::Database::PostgresHll::BatchDistinctCounter::ERROR_RATE } # HyperLogLog is a probabilistic algorithm, which provides estimated data, with given error margin + let(:buckets_hash_5) { { 121 => 2, 126 => 1, 141 => 1, 383 => 1, 56 => 1 } } + let(:buckets_hash_2) { { 141 => 1, 56 => 1 } } + + describe '#estimated_distinct_count' do + it 'provides estimated cardinality', :aggregate_failures do + expect(described_class.new(buckets_hash_5).estimated_distinct_count).to be_within(error_rate).percent_of(5) + expect(described_class.new(buckets_hash_2).estimated_distinct_count).to be_within(error_rate).percent_of(2) + expect(described_class.new({}).estimated_distinct_count).to eq 0 + expect(described_class.new.estimated_distinct_count).to eq 0 + end + end + + describe '#merge_hash!' do + let(:hash_a) { { 1 => 1, 2 => 3 } } + let(:hash_b) { { 1 => 2, 2 => 1 } } + + it 'merges two hashes together into union of two sets' do + expect(described_class.new(hash_a).merge_hash!(hash_b).to_json).to eq described_class.new(1 => 2, 2 => 3).to_json + end + end + + describe '#to_json' do + it 'serialize HyperLogLog buckets as hash' do + expect(described_class.new(1 => 5).to_json).to eq '{"1":5}' + end + end +end diff --git a/spec/lib/gitlab/utils/usage_data_spec.rb b/spec/lib/gitlab/utils/usage_data_spec.rb index 521d6584a20..099faf170a8 100644 --- a/spec/lib/gitlab/utils/usage_data_spec.rb +++ b/spec/lib/gitlab/utils/usage_data_spec.rb @@ -38,32 +38,123 @@ RSpec.describe Gitlab::Utils::UsageData do end describe '#estimate_batch_distinct_count' do + let(:error_rate) { Gitlab::Database::PostgresHll::BatchDistinctCounter::ERROR_RATE } # HyperLogLog is a probabilistic algorithm, which provides estimated data, with given error margin let(:relation) { double(:relation) } + before do + allow(ActiveRecord::Base.connection).to receive(:transaction_open?).and_return(false) + end + it 'delegates counting to counter class instance' do + buckets = instance_double(Gitlab::Database::PostgresHll::Buckets) + expect_next_instance_of(Gitlab::Database::PostgresHll::BatchDistinctCounter, relation, 'column') do |instance| - expect(instance).to receive(:estimate_distinct_count) + expect(instance).to receive(:execute) .with(batch_size: nil, start: nil, finish: nil) - .and_return(5) + .and_return(buckets) end + expect(buckets).to receive(:estimated_distinct_count).and_return(5) expect(described_class.estimate_batch_distinct_count(relation, 'column')).to eq(5) end - it 'returns default fallback value when counting fails due to database error' do - stub_const("Gitlab::Utils::UsageData::FALLBACK", 15) - allow(Gitlab::Database::PostgresHll::BatchDistinctCounter).to receive(:new).and_raise(ActiveRecord::StatementInvalid.new('')) + context 'quasi integration test for different counting parameters' do + let_it_be(:user) { create(:user, email: 'email1@domain.com') } + let_it_be(:another_user) { create(:user, email: 'email2@domain.com') } + + let(:model) { Issue } + let(:column) { :author_id } + + context 'different distribution of relation records' do + [10, 100, 100_000].each do |spread| + context "records are spread within #{spread}" do + before do + ids = (1..spread).to_a.sample(10) + create_list(:issue, 10).each_with_index do |issue, i| + issue.id = ids[i] + end + end + + it 'counts table' do + expect(described_class.estimate_batch_distinct_count(model)).to be_within(error_rate).percent_of(10) + end + end + end + end + + context 'different counting parameters' do + before_all do + create_list(:issue, 3, author: user) + create_list(:issue, 2, author: another_user) + end + + it 'counts table' do + expect(described_class.estimate_batch_distinct_count(model)).to be_within(error_rate).percent_of(5) + end + + it 'counts with column field' do + expect(described_class.estimate_batch_distinct_count(model, column)).to be_within(error_rate).percent_of(2) + end + + it 'counts with :id field' do + expect(described_class.estimate_batch_distinct_count(model, :id)).to be_within(error_rate).percent_of(5) + end + + it 'counts with "id" field' do + expect(described_class.estimate_batch_distinct_count(model, "id")).to be_within(error_rate).percent_of(5) + end + + it 'counts with table.column field' do + expect(described_class.estimate_batch_distinct_count(model, "#{model.table_name}.#{column}")).to be_within(error_rate).percent_of(2) + end + + it 'counts with Arel column' do + expect(described_class.estimate_batch_distinct_count(model, model.arel_table[column])).to be_within(error_rate).percent_of(2) + end + + it 'counts over joined relations' do + expect(described_class.estimate_batch_distinct_count(model.joins(:author), "users.email")).to be_within(error_rate).percent_of(2) + end + + it 'counts with :column field with batch_size of 50K' do + expect(described_class.estimate_batch_distinct_count(model, column, batch_size: 50_000)).to be_within(error_rate).percent_of(2) + end + + it 'counts with different number of batches and aggregates total result' do + stub_const('Gitlab::Database::PostgresHll::BatchDistinctCounter::MIN_REQUIRED_BATCH_SIZE', 0) + + [1, 2, 4, 5, 6].each { |i| expect(described_class.estimate_batch_distinct_count(model, batch_size: i)).to be_within(error_rate).percent_of(5) } + end - expect(described_class.estimate_batch_distinct_count(relation)).to eq(15) + it 'counts with a start and finish' do + expect(described_class.estimate_batch_distinct_count(model, column, start: model.minimum(:id), finish: model.maximum(:id))).to be_within(error_rate).percent_of(2) + end + end end - it 'logs error and returns DISTRIBUTED_HLL_FALLBACK value when counting raises any error', :aggregate_failures do - error = StandardError.new('') - stub_const("Gitlab::Utils::UsageData::DISTRIBUTED_HLL_FALLBACK", 15) - allow(Gitlab::Database::PostgresHll::BatchDistinctCounter).to receive(:new).and_raise(error) + describe 'error handling' do + before do + stub_const("Gitlab::Utils::UsageData::FALLBACK", 3) + stub_const("Gitlab::Utils::UsageData::DISTRIBUTED_HLL_FALLBACK", 4) + end + + it 'returns fallback if counter raises WRONG_CONFIGURATION_ERROR' do + expect(described_class.estimate_batch_distinct_count(relation, 'id', start: 1, finish: 0)).to eq 3 + end - expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).with(error) - expect(described_class.estimate_batch_distinct_count(relation)).to eq(15) + it 'returns default fallback value when counting fails due to database error' do + allow(Gitlab::Database::PostgresHll::BatchDistinctCounter).to receive(:new).and_raise(ActiveRecord::StatementInvalid.new('')) + + expect(described_class.estimate_batch_distinct_count(relation)).to eq(3) + end + + it 'logs error and returns DISTRIBUTED_HLL_FALLBACK value when counting raises any error', :aggregate_failures do + error = StandardError.new('') + allow(Gitlab::Database::PostgresHll::BatchDistinctCounter).to receive(:new).and_raise(error) + + expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).with(error) + expect(described_class.estimate_batch_distinct_count(relation)).to eq(4) + end end end diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index ea03cbc3706..4e10ca58cf4 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -850,12 +850,13 @@ RSpec.describe ApplicationSetting do end end - describe '#instance_review_permitted?', :request_store do + describe '#instance_review_permitted?', :request_store, :use_clean_rails_memory_store_caching do subject { setting.instance_review_permitted? } before do - RequestStore.store[:current_license] = nil - expect(Rails.cache).to receive(:fetch).and_return( + allow(License).to receive(:current).and_return(nil) if Gitlab.ee? + allow(Rails.cache).to receive(:fetch).and_call_original + expect(Rails.cache).to receive(:fetch).with('limited_users_count', anything).and_return( ::ApplicationSetting::INSTANCE_REVIEW_MIN_USERS + users_over_minimum ) end diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index b045533a3cd..f0c84898d67 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -4824,4 +4824,107 @@ RSpec.describe Ci::Build do it { is_expected.to eq false } end end + + describe '#drop_with_exit_code!' do + let(:exit_code) { 1 } + let(:options) { {} } + + before do + build.options.merge!(options) + build.save! + end + + subject(:drop_with_exit_code) do + build.drop_with_exit_code!(:unknown_failure, exit_code) + end + + shared_examples 'drops the build without changing allow_failure' do + it 'does not change allow_failure' do + expect { drop_with_exit_code } + .not_to change { build.reload.allow_failure } + end + + it 'drops the build' do + expect { drop_with_exit_code } + .to change { build.reload.failed? } + end + end + + context 'when exit_codes are not defined' do + it_behaves_like 'drops the build without changing allow_failure' + end + + context 'when allow_failure_criteria is nil' do + let(:options) { { allow_failure_criteria: nil } } + + it_behaves_like 'drops the build without changing allow_failure' + end + + context 'when exit_codes is nil' do + let(:options) do + { + allow_failure_criteria: { + exit_codes: nil + } + } + end + + it_behaves_like 'drops the build without changing allow_failure' + end + + context 'when exit_codes do not match' do + let(:options) do + { + allow_failure_criteria: { + exit_codes: [2, 3, 4] + } + } + end + + it_behaves_like 'drops the build without changing allow_failure' + end + + context 'with matching exit codes' do + let(:options) do + { allow_failure_criteria: { exit_codes: [1, 2, 3] } } + end + + it 'changes allow_failure' do + expect { drop_with_exit_code } + .to change { build.reload.allow_failure } + end + + it 'drops the build' do + expect { drop_with_exit_code } + .to change { build.reload.failed? } + end + + it 'is executed inside a transaction' do + expect(build).to receive(:drop!) + .with(:unknown_failure) + .and_raise(ActiveRecord::Rollback) + + expect(build).to receive(:conditionally_allow_failure!) + .with(1) + .and_call_original + + expect { drop_with_exit_code } + .not_to change { build.reload.allow_failure } + end + + context 'when exit_code is nil' do + let(:exit_code) {} + + it_behaves_like 'drops the build without changing allow_failure' + end + + context 'when ci_allow_failure_with_exit_codes is disabled' do + before do + stub_feature_flags(ci_allow_failure_with_exit_codes: false) + end + + it_behaves_like 'drops the build without changing allow_failure' + end + end + end end diff --git a/spec/models/namespace_onboarding_action_spec.rb b/spec/models/namespace_onboarding_action_spec.rb index 70dcb989b32..aba6b2061c3 100644 --- a/spec/models/namespace_onboarding_action_spec.rb +++ b/spec/models/namespace_onboarding_action_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe NamespaceOnboardingAction do - let(:namespace) { build(:namespace) } + let(:namespace) { create(:namespace) } describe 'associations' do it { is_expected.to belong_to(:namespace).required } @@ -46,6 +46,32 @@ RSpec.describe NamespaceOnboardingAction do expect { create_action }.to change { count_namespace_actions }.by(0) end + context 'when the namespace is created outside the monitoring window' do + let(:namespace) { create(:namespace, created_at: (NamespaceOnboardingAction::MONITORING_WINDOW + 1.day).ago) } + + it 'does not create an action for the namespace' do + expect { create_action }.not_to change { count_namespace_actions } + end + + context 'when an action has already been recorded for the namespace' do + before do + described_class.create!(namespace: namespace, action: :git_write) + end + + it 'creates an action for the namespace' do + expect { create_action }.to change { count_namespace_actions }.by(1) + end + end + end + + context 'when the namespace is not a root' do + let(:namespace) { create(:namespace, parent: build(:namespace)) } + + it 'does not create an action for the namespace' do + expect { create_action }.not_to change { count_namespace_actions } + end + end + def count_namespace_actions described_class.where(namespace: namespace, action: action).count end diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 0130618d004..f86669d60b7 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -1500,4 +1500,24 @@ RSpec.describe Namespace do end end end + + describe '#root?' do + subject { namespace.root? } + + context 'when is subgroup' do + before do + namespace.parent = build(:group) + end + + it 'returns false' do + is_expected.to eq(false) + end + end + + context 'when is root' do + it 'returns true' do + is_expected.to eq(true) + end + end + end end diff --git a/spec/requests/api/ci/runner/jobs_put_spec.rb b/spec/requests/api/ci/runner/jobs_put_spec.rb index e9d793d5a22..f4c99307b1a 100644 --- a/spec/requests/api/ci/runner/jobs_put_spec.rb +++ b/spec/requests/api/ci/runner/jobs_put_spec.rb @@ -78,6 +78,33 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do end end + context 'when an exit_code is provided' do + context 'when the exit_codes are acceptable' do + before do + job.options[:allow_failure_criteria] = { exit_codes: [1] } + job.save! + end + + it 'accepts an exit code' do + update_job(state: 'failed', exit_code: 1) + + expect(job.reload).to be_failed + expect(job.allow_failure).to be_truthy + expect(job).to be_unknown_failure + end + end + + context 'when the exit_codes are not defined' do + it 'ignore the exit code' do + update_job(state: 'failed', exit_code: 1) + + expect(job.reload).to be_failed + expect(job.allow_failure).to be_falsy + expect(job).to be_unknown_failure + end + end + end + context 'when failure_reason is script_failure' do before do update_job(state: 'failed', failure_reason: 'script_failure') diff --git a/spec/requests/api/graphql/project/alert_management/alert/assignees_spec.rb b/spec/requests/api/graphql/project/alert_management/alert/assignees_spec.rb index dd001a73349..9ab94f1d749 100644 --- a/spec/requests/api/graphql/project/alert_management/alert/assignees_spec.rb +++ b/spec/requests/api/graphql/project/alert_management/alert/assignees_spec.rb @@ -60,19 +60,35 @@ RSpec.describe 'getting Alert Management Alert Assignees' do expect(second_assignees).to be_empty end - it 'avoids N+1 queries' do - base_count = ActiveRecord::QueryRecorder.new do - post_graphql(query, current_user: current_user) + describe 'performance' do + let(:first_n) { var('Int') } + let(:params) { { first: first_n } } + let(:limited_query) { with_signature([first_n], query) } + + before do + create(:alert_management_alert, project: project, assignees: [current_user]) + end + + it 'can limit results' do + post_graphql(limited_query, current_user: current_user, variables: first_n.with(1)) + + expect(alerts.size).to eq 1 + expect(alerts).not_to include(a_hash_including('iid' => first_alert.iid.to_s)) end - # An N+1 would mean a new alert would increase the query count - third_alert = create(:alert_management_alert, project: project, assignees: [current_user]) + it 'can include all results' do + post_graphql(limited_query, current_user: current_user) - expect { post_graphql(query, current_user: current_user) }.not_to exceed_query_limit(base_count) + expect(alerts.size).to be > 1 + expect(alerts).to include(a_hash_including('iid' => first_alert.iid.to_s)) + end - third_assignees = assignees[third_alert.iid.to_s] + it 'avoids N+1 queries' do + base_count = ActiveRecord::QueryRecorder.new do + post_graphql(limited_query, current_user: current_user, variables: first_n.with(1)) + end - expect(third_assignees.length).to eq(1) - expect(third_assignees.first).to include('username' => current_user.username) + expect { post_graphql(limited_query, current_user: current_user) }.not_to exceed_query_limit(base_count) + end end end diff --git a/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb b/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb index 1350cba119b..5d46f370756 100644 --- a/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb +++ b/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb @@ -65,16 +65,28 @@ RSpec.describe 'getting Alert Management Alert Notes' do expect(second_notes_result).to be_empty end - it 'avoids N+1 queries' do - base_count = ActiveRecord::QueryRecorder.new do - post_graphql(query, current_user: current_user) + describe 'performance' do + let(:first_n) { var('Int') } + let(:params) { { first: first_n } } + + before do + # An N+1 would mean a new alert would increase the query count + create(:alert_management_alert, project: project) end - # An N+1 would mean a new alert would increase the query count - create(:alert_management_alert, project: project) + it 'avoids N+1 queries' do + q = with_signature([first_n], query) - expect { post_graphql(query, current_user: current_user) }.not_to exceed_query_limit(base_count) - expect(alerts_result.length).to eq(3) + base_count = ActiveRecord::QueryRecorder.new do + post_graphql(q, current_user: current_user, variables: first_n.with(1)) + expect(alerts_result.length).to eq(1) + end + + expect do + post_graphql(q, current_user: current_user, variables: first_n.with(3)) + expect(alerts_result.length).to eq(3) + end.not_to exceed_query_limit(base_count) + end end context 'for non-system notes' do diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 971ab176cfa..4b8abb5f47a 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -490,6 +490,7 @@ RSpec.describe Ci::CreatePipelineService do expect(execute_service).not_to be_persisted expect(Ci::Pipeline.count).to eq(0) + expect(Namespaces::OnboardingPipelineCreatedWorker).not_to receive(:perform_async) end shared_examples 'a failed pipeline' do @@ -1427,6 +1428,13 @@ RSpec.describe Ci::CreatePipelineService do pipeline end + it 'schedules a namespace onboarding create action worker' do + expect(Namespaces::OnboardingPipelineCreatedWorker) + .to receive(:perform_async).with(project.namespace_id) + + pipeline + end + context 'when target sha is specified' do let(:target_sha) { merge_request.target_branch_sha } diff --git a/spec/services/ci/update_build_state_service_spec.rb b/spec/services/ci/update_build_state_service_spec.rb index 3112e5dda1b..63190cc5d49 100644 --- a/spec/services/ci/update_build_state_service_spec.rb +++ b/spec/services/ci/update_build_state_service_spec.rb @@ -82,8 +82,9 @@ RSpec.describe Ci::UpdateBuildStateService do let(:params) do { output: { checksum: 'crc32:12345678', bytesize: 123 }, + state: 'failed', failure_reason: 'script_failure', - state: 'failed' + exit_code: 42 } end @@ -95,6 +96,15 @@ RSpec.describe Ci::UpdateBuildStateService do expect(result.status).to eq 200 end + it 'updates the allow_failure flag' do + expect(build) + .to receive(:drop_with_exit_code!) + .with('script_failure', 42) + .and_call_original + + subject.execute + end + it 'does not increment invalid trace metric' do execute_with_stubbed_metrics! @@ -115,6 +125,15 @@ RSpec.describe Ci::UpdateBuildStateService do expect(build).to be_failed end + it 'updates the allow_failure flag' do + expect(build) + .to receive(:drop_with_exit_code!) + .with('script_failure', 42) + .and_call_original + + subject.execute + end + it 'responds with 200 OK status' do result = subject.execute diff --git a/spec/services/onboarding_progress_service_spec.rb b/spec/services/onboarding_progress_service_spec.rb index 59b6083d38a..de4c0d2a3ba 100644 --- a/spec/services/onboarding_progress_service_spec.rb +++ b/spec/services/onboarding_progress_service_spec.rb @@ -5,29 +5,39 @@ require 'spec_helper' RSpec.describe OnboardingProgressService do describe '#execute' do let(:namespace) { create(:namespace, parent: root_namespace) } + let(:root_namespace) { nil } + let(:action) { :namespace_action } subject(:execute_service) { described_class.new(namespace).execute(action: :subscription_created) } context 'when the namespace is a root' do - let(:root_namespace) { nil } - - it 'records a namespace onboarding progress action for the given namespace' do + it 'records a namespace onboarding progress action fot the given namespace' do expect(NamespaceOnboardingAction).to receive(:create_action) - .with(namespace, :subscription_created).and_call_original + .with(namespace, :subscription_created).and_call_original expect { execute_service }.to change(NamespaceOnboardingAction, :count).by(1) end end context 'when the namespace is not the root' do - let_it_be(:root_namespace) { build(:namespace) } + let(:root_namespace) { build(:namespace) } it 'records a namespace onboarding progress action for the root namespace' do expect(NamespaceOnboardingAction).to receive(:create_action) - .with(root_namespace, :subscription_created).and_call_original + .with(root_namespace, :subscription_created).and_call_original expect { execute_service }.to change(NamespaceOnboardingAction, :count).by(1) end end + + context 'when no namespace is passed' do + let(:namespace) { nil } + + it 'does not record a namespace onboarding progress action' do + expect(NamespaceOnboardingAction).not_to receive(:create_action) + + execute_service + end + end end end diff --git a/spec/services/projects/schedule_bulk_repository_shard_moves_service_spec.rb b/spec/services/projects/schedule_bulk_repository_shard_moves_service_spec.rb index 5b76386bfab..15c9d1e5925 100644 --- a/spec/services/projects/schedule_bulk_repository_shard_moves_service_spec.rb +++ b/spec/services/projects/schedule_bulk_repository_shard_moves_service_spec.rb @@ -3,45 +3,10 @@ require 'spec_helper' RSpec.describe Projects::ScheduleBulkRepositoryShardMovesService do - before do - stub_storage_settings('test_second_storage' => { 'path' => 'tmp/tests/extra_storage' }) - end - - let!(:project) { create(:project, :repository).tap { |project| project.track_project_repository } } - let(:source_storage_name) { 'default' } - let(:destination_storage_name) { 'test_second_storage' } - - describe '#execute' do - it 'schedules project repository storage moves' do - expect { subject.execute(source_storage_name, destination_storage_name) } - .to change(ProjectRepositoryStorageMove, :count).by(1) - - storage_move = project.repository_storage_moves.last! - - expect(storage_move).to have_attributes( - source_storage_name: source_storage_name, - destination_storage_name: destination_storage_name, - state_name: :scheduled - ) - end - - context 'read-only repository' do - let!(:project) { create(:project, :repository, :read_only).tap { |project| project.track_project_repository } } - - it 'does not get scheduled' do - expect(subject).to receive(:log_info) - .with("Project #{project.full_path} (#{project.id}) was skipped: Project is read only") - expect { subject.execute(source_storage_name, destination_storage_name) } - .to change(ProjectRepositoryStorageMove, :count).by(0) - end - end - end - - describe '.enqueue' do - it 'defers to the worker' do - expect(::ProjectScheduleBulkRepositoryShardMovesWorker).to receive(:perform_async).with(source_storage_name, destination_storage_name) + it_behaves_like 'moves repository shard in bulk' do + let_it_be_with_reload(:container) { create(:project, :repository).tap { |project| project.track_project_repository } } - described_class.enqueue(source_storage_name, destination_storage_name) - end + let(:move_service_klass) { ProjectRepositoryStorageMove } + let(:bulk_worker_klass) { ::ProjectScheduleBulkRepositoryShardMovesWorker } end end diff --git a/spec/services/snippets/schedule_bulk_repository_shard_moves_service_spec.rb b/spec/services/snippets/schedule_bulk_repository_shard_moves_service_spec.rb new file mode 100644 index 00000000000..764c7f94a46 --- /dev/null +++ b/spec/services/snippets/schedule_bulk_repository_shard_moves_service_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Snippets::ScheduleBulkRepositoryShardMovesService do + it_behaves_like 'moves repository shard in bulk' do + let_it_be_with_reload(:container) { create(:snippet, :repository) } + + let(:move_service_klass) { SnippetRepositoryStorageMove } + let(:bulk_worker_klass) { ::SnippetScheduleBulkRepositoryShardMovesWorker } + end +end diff --git a/spec/support/shared_examples/services/schedule_bulk_repository_shard_moves_shared_examples.rb b/spec/support/shared_examples/services/schedule_bulk_repository_shard_moves_shared_examples.rb new file mode 100644 index 00000000000..e67fc4ab04a --- /dev/null +++ b/spec/support/shared_examples/services/schedule_bulk_repository_shard_moves_shared_examples.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'moves repository shard in bulk' do + let(:source_storage_name) { 'default' } + let(:destination_storage_name) { 'test_second_storage' } + + before do + stub_storage_settings(destination_storage_name => { 'path' => 'tmp/tests/extra_storage' }) + end + + describe '#execute' do + it 'schedules container repository storage moves' do + expect { subject.execute(source_storage_name, destination_storage_name) } + .to change(move_service_klass, :count).by(1) + + storage_move = container.repository_storage_moves.last! + + expect(storage_move).to have_attributes( + source_storage_name: source_storage_name, + destination_storage_name: destination_storage_name, + state_name: :scheduled + ) + end + + context 'read-only repository' do + it 'does not get scheduled' do + container.set_repository_read_only! + + expect(subject).to receive(:log_info) + .with(/Container #{container.full_path} \(#{container.id}\) was skipped: #{container.class} is read only/) + expect { subject.execute(source_storage_name, destination_storage_name) } + .to change(move_service_klass, :count).by(0) + end + end + end + + describe '.enqueue' do + it 'defers to the worker' do + expect(bulk_worker_klass).to receive(:perform_async).with(source_storage_name, destination_storage_name) + + described_class.enqueue(source_storage_name, destination_storage_name) + end + end +end diff --git a/spec/support/shared_examples/workers/schedule_bulk_repository_shard_moves_shared_examples.rb b/spec/support/shared_examples/workers/schedule_bulk_repository_shard_moves_shared_examples.rb new file mode 100644 index 00000000000..465aca63148 --- /dev/null +++ b/spec/support/shared_examples/workers/schedule_bulk_repository_shard_moves_shared_examples.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'schedules bulk repository shard moves' do + let(:source_storage_name) { 'default' } + let(:destination_storage_name) { 'test_second_storage' } + + describe "#perform" do + before do + stub_storage_settings(destination_storage_name => { 'path' => 'tmp/tests/extra_storage' }) + + allow(worker_klass).to receive(:perform_async) + end + + include_examples 'an idempotent worker' do + let(:job_args) { [source_storage_name, destination_storage_name] } + + it 'schedules container repository storage moves' do + expect { subject }.to change(move_service_klass, :count).by(1) + + storage_move = container.repository_storage_moves.last! + + expect(storage_move).to have_attributes( + source_storage_name: source_storage_name, + destination_storage_name: destination_storage_name, + state_name: :scheduled + ) + end + end + end +end diff --git a/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb b/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb new file mode 100644 index 00000000000..240a0b69834 --- /dev/null +++ b/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Namespaces::OnboardingPipelineCreatedWorker, '#perform' do + include AfterNextHelpers + + let_it_be(:ci_pipeline) { create(:ci_pipeline) } + + it 'records the event' do + expect_next(OnboardingProgressService, ci_pipeline.project.namespace) + .to receive(:execute).with(action: :pipeline_created).and_call_original + + expect do + subject.perform(ci_pipeline.project.namespace_id) + end.to change(NamespaceOnboardingAction, :count).by(1) + end + + context "when a namespace doesn't exist" do + it "does nothing" do + expect_next(OnboardingProgressService, ci_pipeline.project.namespace).not_to receive(:execute) + + expect { subject.perform(nil) }.not_to change(NamespaceOnboardingAction, :count) + end + end +end diff --git a/spec/workers/project_schedule_bulk_repository_shard_moves_worker_spec.rb b/spec/workers/project_schedule_bulk_repository_shard_moves_worker_spec.rb index aadfae51906..fb762593d75 100644 --- a/spec/workers/project_schedule_bulk_repository_shard_moves_worker_spec.rb +++ b/spec/workers/project_schedule_bulk_repository_shard_moves_worker_spec.rb @@ -3,31 +3,10 @@ require 'spec_helper' RSpec.describe ProjectScheduleBulkRepositoryShardMovesWorker do - describe "#perform" do - before do - stub_storage_settings('test_second_storage' => { 'path' => 'tmp/tests/extra_storage' }) + it_behaves_like 'schedules bulk repository shard moves' do + let_it_be_with_reload(:container) { create(:project, :repository).tap { |project| project.track_project_repository } } - allow(ProjectUpdateRepositoryStorageWorker).to receive(:perform_async) - end - - let!(:project) { create(:project, :repository).tap { |project| project.track_project_repository } } - let(:source_storage_name) { 'default' } - let(:destination_storage_name) { 'test_second_storage' } - - include_examples 'an idempotent worker' do - let(:job_args) { [source_storage_name, destination_storage_name] } - - it 'schedules project repository storage moves' do - expect { subject }.to change(ProjectRepositoryStorageMove, :count).by(1) - - storage_move = project.repository_storage_moves.last! - - expect(storage_move).to have_attributes( - source_storage_name: source_storage_name, - destination_storage_name: destination_storage_name, - state_name: :scheduled - ) - end - end + let(:move_service_klass) { ProjectRepositoryStorageMove } + let(:worker_klass) { ProjectUpdateRepositoryStorageWorker } end end diff --git a/spec/workers/snippet_schedule_bulk_repository_shard_moves_worker_spec.rb b/spec/workers/snippet_schedule_bulk_repository_shard_moves_worker_spec.rb new file mode 100644 index 00000000000..3a09b6ce449 --- /dev/null +++ b/spec/workers/snippet_schedule_bulk_repository_shard_moves_worker_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe SnippetScheduleBulkRepositoryShardMovesWorker do + it_behaves_like 'schedules bulk repository shard moves' do + let_it_be_with_reload(:container) { create(:snippet, :repository).tap { |snippet| snippet.create_repository } } + + let(:move_service_klass) { SnippetRepositoryStorageMove } + let(:worker_klass) { SnippetUpdateRepositoryStorageWorker } + end +end diff --git a/yarn.lock b/yarn.lock index 4cfa1e883f5..a09fcbaa4d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9555,16 +9555,21 @@ pretender@^3.4.3: fake-xml-http-request "^2.1.1" route-recognizer "^0.3.3" -prettier@1.18.2, prettier@^1.18.2: - version "1.18.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" - integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== - prettier@2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== +prettier@2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== + +prettier@^1.18.2: + version "1.18.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" + integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== + pretty-format@^25.2.1, pretty-format@^25.5.0: version "25.5.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.5.0.tgz#7873c1d774f682c34b8d48b6743a2bf2ac55791a" |