diff options
Diffstat (limited to 'app/assets/javascripts')
102 files changed, 400 insertions, 207 deletions
diff --git a/app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue b/app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue index c1ec46cfc50..9bcdcec8b78 100644 --- a/app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue +++ b/app/assets/javascripts/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue @@ -267,7 +267,8 @@ export default { }); } }); - } else if (this.uniqueCommits.length > 0) { + } + if (this.uniqueCommits.length > 0) { return this.createContextCommits({ commits: this.uniqueCommits, forceReload: true }); } diff --git a/app/assets/javascripts/admin/abuse_report/components/labels_select.vue b/app/assets/javascripts/admin/abuse_report/components/labels_select.vue index 9e0c5e25f20..747c9a1a947 100644 --- a/app/assets/javascripts/admin/abuse_report/components/labels_select.vue +++ b/app/assets/javascripts/admin/abuse_report/components/labels_select.vue @@ -74,7 +74,8 @@ export default { selectText() { if (!this.selected.length) { return this.$options.i18n.labelsListTitle; - } else if (this.selected.length > 1) { + } + if (this.selected.length > 1) { return sprintf(s__('LabelSelect|%{firstLabelName} +%{remainingLabelCount} more'), { firstLabelName: this.selected[0].title, remainingLabelCount: this.selected.length - 1, diff --git a/app/assets/javascripts/admin/broadcast_messages/components/message_form.vue b/app/assets/javascripts/admin/broadcast_messages/components/message_form.vue index 109df943c42..2c555aca3c0 100644 --- a/app/assets/javascripts/admin/broadcast_messages/components/message_form.vue +++ b/app/assets/javascripts/admin/broadcast_messages/components/message_form.vue @@ -234,7 +234,8 @@ export default { initialTarget() { if (this.targetAccessLevels.length > 0) { return TARGET_ROLES; - } else if (this.targetPath !== '') { + } + if (this.targetPath !== '') { return TARGET_ALL_MATCHING_PATH; } return TARGET_ALL; diff --git a/app/assets/javascripts/analytics/cycle_analytics/components/formatted_stage_count.vue b/app/assets/javascripts/analytics/cycle_analytics/components/formatted_stage_count.vue index b622b0441e2..724e9c91305 100644 --- a/app/assets/javascripts/analytics/cycle_analytics/components/formatted_stage_count.vue +++ b/app/assets/javascripts/analytics/cycle_analytics/components/formatted_stage_count.vue @@ -13,7 +13,8 @@ export default { formattedStageCount() { if (!this.stageCount) { return '-'; - } else if (this.stageCount > 1000) { + } + if (this.stageCount > 1000) { return sprintf(s__('ValueStreamAnalytics|%{stageCount}+ items'), { stageCount: formatNumber(1000), }); diff --git a/app/assets/javascripts/analytics/shared/components/projects_dropdown_filter.vue b/app/assets/javascripts/analytics/shared/components/projects_dropdown_filter.vue index f881c924ae5..ddfc6baafa9 100644 --- a/app/assets/javascripts/analytics/shared/components/projects_dropdown_filter.vue +++ b/app/assets/javascripts/analytics/shared/components/projects_dropdown_filter.vue @@ -69,7 +69,8 @@ export default { selectedProjectsLabel() { if (this.selectedProjects.length === 1) { return this.selectedProjects[0].name; - } else if (this.selectedProjects.length > 1) { + } + if (this.selectedProjects.length > 1) { return n__( 'CycleAnalytics|Project selected', 'CycleAnalytics|%d projects selected', diff --git a/app/assets/javascripts/authentication/webauthn/error.js b/app/assets/javascripts/authentication/webauthn/error.js index 40dbecd8bc9..ce6c79a1f11 100644 --- a/app/assets/javascripts/authentication/webauthn/error.js +++ b/app/assets/javascripts/authentication/webauthn/error.js @@ -14,11 +14,14 @@ export default class WebAuthnError { message() { if (this.errorName === 'NotSupportedError') { return __('Your device is not compatible with GitLab. Please try another device'); - } else if (this.errorName === 'InvalidStateError' && this.flowType === WEBAUTHN_AUTHENTICATE) { + } + if (this.errorName === 'InvalidStateError' && this.flowType === WEBAUTHN_AUTHENTICATE) { return __('This device has not been registered with us.'); - } else if (this.errorName === 'InvalidStateError' && this.flowType === WEBAUTHN_REGISTER) { + } + if (this.errorName === 'InvalidStateError' && this.flowType === WEBAUTHN_REGISTER) { return __('This device has already been registered with us.'); - } else if (this.errorName === 'SecurityError' && this.httpsDisabled) { + } + if (this.errorName === 'SecurityError' && this.httpsDisabled) { return __( 'WebAuthn only works with HTTPS-enabled websites. Contact your administrator for more details.', ); diff --git a/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js b/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js index 095634340c1..e1c1bd58ee2 100644 --- a/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js +++ b/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js @@ -20,7 +20,8 @@ export default () => ({ const checkbox = el.querySelector('input[type=checkbox].task-list-item-checkbox'); if (checkbox?.matches('[data-inapplicable]')) { return { state: 'inapplicable' }; - } else if (checkbox?.checked) { + } + if (checkbox?.checked) { return { state: 'done' }; } diff --git a/app/assets/javascripts/blob/line_highlighter.js b/app/assets/javascripts/blob/line_highlighter.js index 4e97d0aa915..9c6a5958e1f 100644 --- a/app/assets/javascripts/blob/line_highlighter.js +++ b/app/assets/javascripts/blob/line_highlighter.js @@ -96,7 +96,8 @@ LineHighlighter.prototype.clickHandler = function (event) { // treat this like a single-line selection. this.setHash(lineNumber); return this.highlightLine(lineNumber); - } else if (event.shiftKey) { + } + if (event.shiftKey) { if (lineNumber < current[0]) { range = [lineNumber, current[0]]; } else { diff --git a/app/assets/javascripts/boards/components/issue_due_date.vue b/app/assets/javascripts/boards/components/issue_due_date.vue index 1f28974afd1..46009df2bd3 100644 --- a/app/assets/javascripts/boards/components/issue_due_date.vue +++ b/app/assets/javascripts/boards/components/issue_due_date.vue @@ -52,11 +52,14 @@ export default { if (timeDifference === 0) { return __('Today'); - } else if (timeDifference === 1) { + } + if (timeDifference === 1) { return __('Tomorrow'); - } else if (timeDifference === -1) { + } + if (timeDifference === -1) { return __('Yesterday'); - } else if (timeDifference > 0 && timeDifference < 7) { + } + if (timeDifference > 0 && timeDifference < 7) { return dateFormat(issueDueDate, 'dddd'); } diff --git a/app/assets/javascripts/ci/pipeline_details/graph/components/linked_pipeline.vue b/app/assets/javascripts/ci/pipeline_details/graph/components/linked_pipeline.vue index cc52ff57c13..d6adaf78da4 100644 --- a/app/assets/javascripts/ci/pipeline_details/graph/components/linked_pipeline.vue +++ b/app/assets/javascripts/ci/pipeline_details/graph/components/linked_pipeline.vue @@ -72,7 +72,8 @@ export default { method: this.cancelPipeline, ariaLabel: __('Cancel downstream pipeline'), }; - } else if (this.isRetryable) { + } + if (this.isRetryable) { return { icon: 'retry', method: this.retryPipeline, @@ -141,7 +142,8 @@ export default { label() { if (this.parentPipeline) { return __('Parent'); - } else if (this.childPipeline) { + } + if (this.childPipeline) { return __('Child'); } return __('Multi-project'); diff --git a/app/assets/javascripts/ci/pipeline_details/pipelines_list/components/pipeline_url.vue b/app/assets/javascripts/ci/pipeline_details/pipelines_list/components/pipeline_url.vue index ff1a01d5037..10ed3decd2c 100644 --- a/app/assets/javascripts/ci/pipeline_details/pipelines_list/components/pipeline_url.vue +++ b/app/assets/javascripts/ci/pipeline_details/pipelines_list/components/pipeline_url.vue @@ -151,7 +151,10 @@ export default { <div v-if="!pipelineName" class="commit-title gl-mb-2" data-testid="commit-title-container"> <span v-if="commitTitle" class="gl-display-flex"> - <tooltip-on-truncate :title="commitTitle" class="gl-flex-grow-1 gl-text-truncate"> + <tooltip-on-truncate + :title="commitTitle" + class="gl-flex-grow-1 gl-text-truncate gl-p-3 gl-ml-n3 gl-mr-n3 gl-mt-n3 gl-mb-n3" + > <gl-link :href="commitUrl" class="commit-row-message gl-text-blue-600!" diff --git a/app/assets/javascripts/ci/pipeline_editor/components/job_assistant_drawer/utils.js b/app/assets/javascripts/ci/pipeline_editor/components/job_assistant_drawer/utils.js index a604d79259d..32eda355e66 100644 --- a/app/assets/javascripts/ci/pipeline_editor/components/job_assistant_drawer/utils.js +++ b/app/assets/javascripts/ci/pipeline_editor/components/job_assistant_drawer/utils.js @@ -10,7 +10,8 @@ const trimText = (val) => (isString(val) ? trim(val) : val); export const removeEmptyObj = (obj) => { if (isArray(obj)) { return reject(map(obj, removeEmptyObj), isEmptyValue); - } else if (isObject(obj)) { + } + if (isObject(obj)) { return omitBy(mapValues(obj, removeEmptyObj), isEmptyValue); } return obj; @@ -19,7 +20,8 @@ export const removeEmptyObj = (obj) => { export const trimFields = (data) => { if (isArray(data)) { return data.map(trimFields); - } else if (isObject(data)) { + } + if (isObject(data)) { return mapValues(data, trimFields); } return trimText(data); diff --git a/app/assets/javascripts/ci/reports/components/issue_status_icon.vue b/app/assets/javascripts/ci/reports/components/issue_status_icon.vue index bd41b8d23f1..56010a5f588 100644 --- a/app/assets/javascripts/ci/reports/components/issue_status_icon.vue +++ b/app/assets/javascripts/ci/reports/components/issue_status_icon.vue @@ -22,7 +22,8 @@ export default { iconName() { if (this.isStatusFailed) { return 'status_failed_borderless'; - } else if (this.isStatusSuccess) { + } + if (this.isStatusSuccess) { return 'status_success_borderless'; } diff --git a/app/assets/javascripts/ci/reports/components/report_section.vue b/app/assets/javascripts/ci/reports/components/report_section.vue index a4ec7b6a325..fd6c6cca6b7 100644 --- a/app/assets/javascripts/ci/reports/components/report_section.vue +++ b/app/assets/javascripts/ci/reports/components/report_section.vue @@ -159,7 +159,8 @@ export default { slotName() { if (this.isSuccess) { return SLOT_SUCCESS; - } else if (this.isLoading) { + } + if (this.isLoading) { return SLOT_LOADING; } diff --git a/app/assets/javascripts/ci/runner/components/stat/runner_count.vue b/app/assets/javascripts/ci/runner/components/stat/runner_count.vue index c33c42f3afe..cee1088d90b 100644 --- a/app/assets/javascripts/ci/runner/components/stat/runner_count.vue +++ b/app/assets/javascripts/ci/runner/components/stat/runner_count.vue @@ -55,7 +55,8 @@ export default { query() { if (this.scope === INSTANCE_TYPE) { return allRunnersCountQuery; - } else if (this.scope === GROUP_TYPE) { + } + if (this.scope === GROUP_TYPE) { return groupRunnersCountQuery; } return null; @@ -74,7 +75,8 @@ export default { update(data) { if (this.scope === INSTANCE_TYPE) { return data?.runners?.count; - } else if (this.scope === GROUP_TYPE) { + } + if (this.scope === GROUP_TYPE) { return data?.group?.runners?.count; } return null; diff --git a/app/assets/javascripts/ci/runner/runner_search_utils.js b/app/assets/javascripts/ci/runner/runner_search_utils.js index 3dc99baa329..8915198350f 100644 --- a/app/assets/javascripts/ci/runner/runner_search_utils.js +++ b/app/assets/javascripts/ci/runner/runner_search_utils.js @@ -97,7 +97,8 @@ const outdatedStatusParams = (status) => { [PARAM_KEY_PAUSED]: ['false'], [PARAM_KEY_STATUS]: [], // Important! clear PARAM_KEY_STATUS to avoid a redirection loop! }; - } else if (status === STATUS_PAUSED) { + } + if (status === STATUS_PAUSED) { return { [PARAM_KEY_PAUSED]: ['true'], [PARAM_KEY_STATUS]: [], // Important! clear PARAM_KEY_STATUS to avoid a redirection loop! diff --git a/app/assets/javascripts/ci_secure_files/components/metadata/modal.vue b/app/assets/javascripts/ci_secure_files/components/metadata/modal.vue index fdf720a5f94..cbb9c31b54b 100644 --- a/app/assets/javascripts/ci_secure_files/components/metadata/modal.vue +++ b/app/assets/javascripts/ci_secure_files/components/metadata/modal.vue @@ -101,10 +101,12 @@ export default { if (this.fileExtension === 'cer') { this.track('load_secure_file_metadata_cer'); return this.cerItems(); - } else if (this.fileExtension === 'p12') { + } + if (this.fileExtension === 'p12') { this.track('load_secure_file_metadata_p12'); return this.p12Items(); - } else if (this.fileExtension === 'mobileprovision') { + } + if (this.fileExtension === 'mobileprovision') { this.track('load_secure_file_metadata_mobileprovision'); return this.mobileprovisionItems(this.metadata); } diff --git a/app/assets/javascripts/clusters_list/components/agent_table.vue b/app/assets/javascripts/clusters_list/components/agent_table.vue index 529be7169db..7482aaca36e 100644 --- a/app/assets/javascripts/clusters_list/components/agent_table.vue +++ b/app/assets/javascripts/clusters_list/components/agent_table.vue @@ -191,9 +191,11 @@ export default { getVersionPopoverTitle(agent) { if (this.isVersionMismatch(agent) && this.isVersionOutdated(agent)) { return this.$options.i18n.versionMismatchOutdatedTitle; - } else if (this.isVersionMismatch(agent)) { + } + if (this.isVersionMismatch(agent)) { return this.$options.i18n.versionMismatchTitle; - } else if (this.isVersionOutdated(agent)) { + } + if (this.isVersionOutdated(agent)) { return this.$options.i18n.versionOutdatedTitle; } diff --git a/app/assets/javascripts/clusters_list/components/available_agents_dropdown.vue b/app/assets/javascripts/clusters_list/components/available_agents_dropdown.vue index 75850cbb108..96ecbe9fa12 100644 --- a/app/assets/javascripts/clusters_list/components/available_agents_dropdown.vue +++ b/app/assets/javascripts/clusters_list/components/available_agents_dropdown.vue @@ -30,7 +30,8 @@ export default { dropdownText() { if (this.isRegistering) { return this.$options.i18n.registeringAgent; - } else if (this.selectedAgent === null) { + } + if (this.selectedAgent === null) { return this.$options.i18n.selectAgent; } diff --git a/app/assets/javascripts/clusters_list/components/clusters.vue b/app/assets/javascripts/clusters_list/components/clusters.vue index 590fdb947b3..0258d8e0da0 100644 --- a/app/assets/javascripts/clusters_list/components/clusters.vue +++ b/app/assets/javascripts/clusters_list/components/clusters.vue @@ -125,9 +125,11 @@ export default { k8sQuantityToGb(quantity) { if (!quantity) { return 0; - } else if (quantity.endsWith(__('Ki'))) { + } + if (quantity.endsWith(__('Ki'))) { return parseInt(quantity.substr(0, quantity.length - 2), 10) * 0.000001024; - } else if (quantity.endsWith(__('Mi'))) { + } + if (quantity.endsWith(__('Mi'))) { return parseInt(quantity.substr(0, quantity.length - 2), 10) * 0.001048576; } @@ -138,9 +140,11 @@ export default { k8sQuantityToCpu(quantity) { if (!quantity) { return 0; - } else if (quantity.endsWith('m')) { + } + if (quantity.endsWith('m')) { return parseInt(quantity.substr(0, quantity.length - 1), 10) / 1000.0; - } else if (quantity.endsWith('n')) { + } + if (quantity.endsWith('n')) { return parseInt(quantity.substr(0, quantity.length - 1), 10) / 1000000000.0; } diff --git a/app/assets/javascripts/clusters_list/components/clusters_actions.vue b/app/assets/javascripts/clusters_list/components/clusters_actions.vue index c388d3fee71..e92b98946d0 100644 --- a/app/assets/javascripts/clusters_list/components/clusters_actions.vue +++ b/app/assets/javascripts/clusters_list/components/clusters_actions.vue @@ -37,7 +37,8 @@ export default { if (!this.displayClusterAgents) { return connectClusterDeprecated; - } else if (!this.certificateBasedClustersEnabled) { + } + if (!this.certificateBasedClustersEnabled) { return connectCluster; } return connectWithAgent; diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_pushed.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_pushed.vue index 557f2912f17..a2516f37c92 100644 --- a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_pushed.vue +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_pushed.vue @@ -53,7 +53,8 @@ export default { message() { if (this.ref.is_new) { return this.$options.i18n.new[this.ref.type]; - } else if (this.ref.is_removed) { + } + if (this.ref.is_removed) { return this.$options.i18n.removed[this.ref.type]; } diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js index ae5d3298b62..bacd84048af 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js @@ -11,7 +11,8 @@ export class GitLabDropdownRemote { execute() { if (typeof this.dataEndpoint === 'string') { return this.fetchData(); - } else if (typeof this.dataEndpoint === 'function') { + } + if (typeof this.dataEndpoint === 'function') { if (this.options.beforeSend) { this.options.beforeSend(); } diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/render.js b/app/assets/javascripts/deprecated_jquery_dropdown/render.js index 97698d55011..1b133c57302 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/render.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/render.js @@ -89,7 +89,8 @@ function checkSelected(data, options) { if (!options.parent) { return !data.id; - } else if (value) { + } + if (value) { return ( options.parent.querySelector(`input[name='${options.fieldName}'][value='${value}']`) != null ); diff --git a/app/assets/javascripts/deprecated_notes.js b/app/assets/javascripts/deprecated_notes.js index 4e5e07c57e4..008e12abbcd 100644 --- a/app/assets/javascripts/deprecated_notes.js +++ b/app/assets/javascripts/deprecated_notes.js @@ -458,7 +458,8 @@ export default class Notes { this.setupNewNote($newNote); this.refresh(); return this.updateNotesCount(1); - } else if (Notes.isUpdatedNote(noteEntity, $note)) { + } + 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()); diff --git a/app/assets/javascripts/diffs/components/diff_view.vue b/app/assets/javascripts/diffs/components/diff_view.vue index 88ea4e15552..641616a34f5 100644 --- a/app/assets/javascripts/diffs/components/diff_view.vue +++ b/app/assets/javascripts/diffs/components/diff_view.vue @@ -186,7 +186,8 @@ export default { getCountBetweenIndex(index) { if (index === 0) { return -1; - } else if (!this.diffLines[index + 1]) { + } + if (!this.diffLines[index + 1]) { return -1; } diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index bbc602aedf6..7c68b5f69f1 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -910,7 +910,8 @@ export const setSuggestPopoverDismissed = ({ commit, state }) => export function changeCurrentCommit({ dispatch, commit, state }, { commitId }) { if (!commitId) { return Promise.reject(new Error('`commitId` is a required argument')); - } else if (!state.commit) { + } + if (!state.commit) { return Promise.reject(new Error('`state` must already contain a valid `commit`')); // eslint-disable-line @gitlab/require-i18n-strings } diff --git a/app/assets/javascripts/diffs/store/getters.js b/app/assets/javascripts/diffs/store/getters.js index d82959daa9d..bfafb4d281d 100644 --- a/app/assets/javascripts/diffs/store/getters.js +++ b/app/assets/javascripts/diffs/store/getters.js @@ -139,7 +139,8 @@ export const fileLineCoverage = (state) => (file, line) => { if (lineCoverage === 0) { return { text: __('No test coverage'), class: 'no-coverage' }; - } else if (lineCoverage >= 0) { + } + if (lineCoverage >= 0) { return { text: n__('Test coverage: %d hit', 'Test coverage: %d hits', lineCoverage), class: 'coverage', diff --git a/app/assets/javascripts/environments/components/kubernetes_status_bar.vue b/app/assets/javascripts/environments/components/kubernetes_status_bar.vue index e8857dfe459..c603d83db9c 100644 --- a/app/assets/javascripts/environments/components/kubernetes_status_bar.vue +++ b/app/assets/javascripts/environments/components/kubernetes_status_bar.vue @@ -145,15 +145,20 @@ export default { syncStatusBadge() { if (!this.fluxCRD.length && this.fluxApiError) { return { ...SYNC_STATUS_BADGES.unavailable, popoverText: this.fluxApiError }; - } else if (!this.fluxCRD.length) { + } + if (!this.fluxCRD.length) { return SYNC_STATUS_BADGES.unavailable; - } else if (this.fluxAnyFailed) { + } + if (this.fluxAnyFailed) { return { ...SYNC_STATUS_BADGES.failed, popoverText: this.fluxAnyFailed.message }; - } else if (this.fluxAnyStalled) { + } + if (this.fluxAnyStalled) { return { ...SYNC_STATUS_BADGES.stalled, popoverText: this.fluxAnyStalled.message }; - } else if (this.fluxAnyReconciling) { + } + if (this.fluxAnyReconciling) { return SYNC_STATUS_BADGES.reconciling; - } else if (this.fluxAnyReconciled) { + } + if (this.fluxAnyReconciled) { return SYNC_STATUS_BADGES.reconciled; } return SYNC_STATUS_BADGES.unknown; diff --git a/app/assets/javascripts/frequent_items/utils.js b/app/assets/javascripts/frequent_items/utils.js index 1c33c8b1084..f71405a5bc4 100644 --- a/app/assets/javascripts/frequent_items/utils.js +++ b/app/assets/javascripts/frequent_items/utils.js @@ -24,7 +24,8 @@ export const getTopFrequentItems = (items) => { // and then by lastAccessedOn with recent most first if (itemA.frequency !== itemB.frequency) { return itemB.frequency - itemA.frequency; - } else if (itemA.lastAccessedOn !== itemB.lastAccessedOn) { + } + if (itemA.lastAccessedOn !== itemB.lastAccessedOn) { return itemB.lastAccessedOn - itemA.lastAccessedOn; } diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 9e7006bb6e7..a9e7b853cd2 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -393,13 +393,16 @@ class GfmAutoComplete { if (command === MEMBER_COMMAND.ASSIGN) { // Only include members which are not assigned to Issuable currently return data.filter((member) => !assignees.includes(member.search)); - } else if (command === MEMBER_COMMAND.UNASSIGN) { + } + if (command === MEMBER_COMMAND.UNASSIGN) { // Only include members which are assigned to Issuable currently return data.filter((member) => assignees.includes(member.search)); - } else if (command === MEMBER_COMMAND.ASSIGN_REVIEWER) { + } + if (command === MEMBER_COMMAND.ASSIGN_REVIEWER) { // Only include members which are not assigned as a reviewer to Issuable currently return data.filter((member) => !reviewers.includes(member.search)); - } else if (command === MEMBER_COMMAND.UNASSIGN_REVIEWER) { + } + if (command === MEMBER_COMMAND.UNASSIGN_REVIEWER) { // Only include members which are not assigned as a reviewer to Issuable currently return data.filter((member) => reviewers.includes(member.search)); } @@ -642,7 +645,8 @@ class GfmAutoComplete { if (command === LABEL_COMMAND.LABEL || command === LABEL_COMMAND.LABELS) { // Return labels with set: undefined. return data.filter((label) => !label.set); - } else if (command === LABEL_COMMAND.UNLABEL) { + } + if (command === LABEL_COMMAND.UNLABEL) { // Return labels with set: true. return data.filter((label) => label.set); } @@ -751,7 +755,8 @@ class GfmAutoComplete { if (command === CONTACTS_ADD_COMMAND) { // Return contacts that are active and not already on the issue return data.filter((contact) => contact.state === CONTACT_STATE_ACTIVE && !contact.set); - } else if (command === CONTACTS_REMOVE_COMMAND) { + } + if (command === CONTACTS_REMOVE_COMMAND) { // Return contacts already on the issue return data.filter((contact) => contact.set); } @@ -779,10 +784,8 @@ class GfmAutoComplete { if (GfmAutoComplete.isLoading(data)) { self.fetchData(this.$inputor, this.at); return data; - } else if ( - GfmAutoComplete.isTypeWithBackendFiltering(this.at) && - self.previousQuery !== query - ) { + } + if (GfmAutoComplete.isTypeWithBackendFiltering(this.at) && self.previousQuery !== query) { self.fetchData(this.$inputor, this.at, query); self.previousQuery = query; return data; diff --git a/app/assets/javascripts/gitlab_version_check/components/gitlab_version_check_badge.vue b/app/assets/javascripts/gitlab_version_check/components/gitlab_version_check_badge.vue index 1536a9a525b..25ddfc911f3 100644 --- a/app/assets/javascripts/gitlab_version_check/components/gitlab_version_check_badge.vue +++ b/app/assets/javascripts/gitlab_version_check/components/gitlab_version_check_badge.vue @@ -30,9 +30,11 @@ export default { title() { if (this.status === STATUS_TYPES.SUCCESS) { return s__('VersionCheck|Up to date'); - } else if (this.status === STATUS_TYPES.WARNING) { + } + if (this.status === STATUS_TYPES.WARNING) { return s__('VersionCheck|Update available'); - } else if (this.status === STATUS_TYPES.DANGER) { + } + if (this.status === STATUS_TYPES.DANGER) { return s__('VersionCheck|Update ASAP'); } diff --git a/app/assets/javascripts/google_cloud/deployments/service_table.vue b/app/assets/javascripts/google_cloud/deployments/service_table.vue index 26c9fd14dc6..9388b41127e 100644 --- a/app/assets/javascripts/google_cloud/deployments/service_table.vue +++ b/app/assets/javascripts/google_cloud/deployments/service_table.vue @@ -34,7 +34,7 @@ export default { methods: { actionUrl(key) { if (key === cloudRun) return this.cloudRunUrl; - else if (key === cloudStorage) return this.cloudStorageUrl; + if (key === cloudStorage) return this.cloudStorageUrl; return '#'; }, }, diff --git a/app/assets/javascripts/ide/commit_icon.js b/app/assets/javascripts/ide/commit_icon.js index 70ee9cff22b..07eef897910 100644 --- a/app/assets/javascripts/ide/commit_icon.js +++ b/app/assets/javascripts/ide/commit_icon.js @@ -3,7 +3,8 @@ import { commitItemIconMap } from './constants'; export default (file) => { if (file.deleted) { return commitItemIconMap.deleted; - } else if (file.tempFile && !file.prevPath) { + } + if (file.tempFile && !file.prevPath) { return commitItemIconMap.addition; } diff --git a/app/assets/javascripts/ide/components/new_dropdown/modal.vue b/app/assets/javascripts/ide/components/new_dropdown/modal.vue index 854daa20628..741845e3325 100644 --- a/app/assets/javascripts/ide/components/new_dropdown/modal.vue +++ b/app/assets/javascripts/ide/components/new_dropdown/modal.vue @@ -32,7 +32,8 @@ export default { if (this.modalType === modalTypes.tree) { return __('Create new directory'); - } else if (this.modalType === modalTypes.rename) { + } + if (this.modalType === modalTypes.rename) { return entry.type === modalTypes.tree ? __('Rename folder') : __('Rename file'); } @@ -43,7 +44,8 @@ export default { if (this.modalType === modalTypes.tree) { return __('Create directory'); - } else if (this.modalType === modalTypes.rename) { + } + if (this.modalType === modalTypes.rename) { return entry.type === modalTypes.tree ? __('Rename folder') : __('Rename file'); } diff --git a/app/assets/javascripts/ide/components/terminal/terminal.vue b/app/assets/javascripts/ide/components/terminal/terminal.vue index 9e8b3d87397..b2e90a64758 100644 --- a/app/assets/javascripts/ide/components/terminal/terminal.vue +++ b/app/assets/javascripts/ide/components/terminal/terminal.vue @@ -37,7 +37,8 @@ export default { loadingText() { if (isStartingStatus(this.status)) { return __('Starting...'); - } else if (this.status === STOPPING) { + } + if (this.status === STOPPING) { return __('Stopping...'); } diff --git a/app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue b/app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue index 38e53b64503..332408b9ecf 100644 --- a/app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue +++ b/app/assets/javascripts/ide/components/terminal_sync/terminal_sync_status.vue @@ -31,12 +31,14 @@ export default { icon: '', text: this.isStarted ? MSG_TERMINAL_SYNC_UPLOADING : MSG_TERMINAL_SYNC_CONNECTING, }; - } else if (this.isError) { + } + if (this.isError) { return { icon: 'warning', text: this.message, }; - } else if (this.isStarted) { + } + if (this.isStarted) { return { icon: 'mobile-issue-close', text: MSG_TERMINAL_SYNC_RUNNING, diff --git a/app/assets/javascripts/ide/lib/diff/controller.js b/app/assets/javascripts/ide/lib/diff/controller.js index 7595a1cedf1..ec28845d805 100644 --- a/app/assets/javascripts/ide/lib/diff/controller.js +++ b/app/assets/javascripts/ide/lib/diff/controller.js @@ -7,9 +7,11 @@ import DirtyDiffWorker from './diff_worker?worker'; export const getDiffChangeType = (change) => { if (change.modified) { return 'modified'; - } else if (change.added) { + } + if (change.added) { return 'added'; - } else if (change.removed) { + } + if (change.removed) { return 'removed'; } diff --git a/app/assets/javascripts/ide/lib/errors.js b/app/assets/javascripts/ide/lib/errors.js index a8a048e588f..5063cf5fd4f 100644 --- a/app/assets/javascripts/ide/lib/errors.js +++ b/app/assets/javascripts/ide/lib/errors.js @@ -55,9 +55,11 @@ export const parseCommitError = (e) => { if (CODEOWNERS_REGEX.test(message)) { return createCodeownersCommitError(message); - } else if (BRANCH_CHANGED_REGEX.test(message)) { + } + if (BRANCH_CHANGED_REGEX.test(message)) { return createBranchChangedCommitError(message); - } else if (BRANCH_ALREADY_EXISTS.test(message)) { + } + if (BRANCH_ALREADY_EXISTS.test(message)) { return branchAlreadyExistsCommitError(message); } diff --git a/app/assets/javascripts/ide/lib/files.js b/app/assets/javascripts/ide/lib/files.js index 3fdf012bbb2..415e34f56b8 100644 --- a/app/assets/javascripts/ide/lib/files.js +++ b/app/assets/javascripts/ide/lib/files.js @@ -35,7 +35,8 @@ export const decorateFiles = ({ const insertParent = (path) => { if (!path) { return null; - } else if (entries[path]) { + } + if (entries[path]) { return entries[path]; } diff --git a/app/assets/javascripts/ide/lib/mirror.js b/app/assets/javascripts/ide/lib/mirror.js index f437965b25a..286798d7560 100644 --- a/app/assets/javascripts/ide/lib/mirror.js +++ b/app/assets/javascripts/ide/lib/mirror.js @@ -32,7 +32,8 @@ const isErrorPayload = (payload) => payload && payload.status_code !== HTTP_STAT const getErrorFromResponse = (data) => { if (isErrorResponse(data.error)) { return { message: data.error.Message }; - } else if (isErrorPayload(data.payload)) { + } + if (isErrorPayload(data.payload)) { return { message: data.payload.error_message }; } diff --git a/app/assets/javascripts/ide/stores/actions/project.js b/app/assets/javascripts/ide/stores/actions/project.js index f4fa52b2d4d..11e3d8260f7 100644 --- a/app/assets/javascripts/ide/stores/actions/project.js +++ b/app/assets/javascripts/ide/stores/actions/project.js @@ -133,7 +133,8 @@ export const loadBranch = ({ dispatch, getters, state }, { projectId, branchId } if (currentProject?.branches?.[branchId]) { return Promise.resolve(); - } else if (getters.emptyRepo) { + } + if (getters.emptyRepo) { return dispatch('loadEmptyBranch', { projectId, branchId }); } diff --git a/app/assets/javascripts/ide/stores/getters.js b/app/assets/javascripts/ide/stores/getters.js index c0f666c6652..74fe61b6e2f 100644 --- a/app/assets/javascripts/ide/stores/getters.js +++ b/app/assets/javascripts/ide/stores/getters.js @@ -30,7 +30,8 @@ const getCannotPushCodeViewModel = (state) => { text: MSG_GO_TO_FORK, }, }; - } else if (forkPath) { + } + if (forkPath) { return { message: MSG_CANNOT_PUSH_CODE_SHOULD_FORK, action: { diff --git a/app/assets/javascripts/ide/stores/modules/terminal/messages.js b/app/assets/javascripts/ide/stores/modules/terminal/messages.js index ad7ad35a98c..a2b45f9dc62 100644 --- a/app/assets/javascripts/ide/stores/modules/terminal/messages.js +++ b/app/assets/javascripts/ide/stores/modules/terminal/messages.js @@ -39,7 +39,8 @@ export const configCheckError = (status, helpUrl) => { }, false, ); - } else if (status === HTTP_STATUS_FORBIDDEN) { + } + if (status === HTTP_STATUS_FORBIDDEN) { return ERROR_PERMISSION; } diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index ec661fdb0d6..bac3803e68f 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -81,9 +81,11 @@ export const setPageTitleForFile = (state, file) => { export const commitActionForFile = (file) => { if (file.prevPath) { return commitActionTypes.move; - } else if (file.deleted) { + } + if (file.deleted) { return commitActionTypes.delete; - } else if (file.tempFile) { + } + if (file.tempFile) { return commitActionTypes.create; } @@ -131,7 +133,8 @@ export const createNewMergeRequestUrl = (projectUrl, source, target) => const sortTreesByTypeAndName = (a, b) => { if (a.type === 'tree' && b.type === 'blob') { return -1; - } else if (a.type === 'blob' && b.type === 'tree') { + } + if (a.type === 'blob' && b.type === 'tree') { return 1; } if (a.name < b.name) return -1; diff --git a/app/assets/javascripts/import_entities/components/import_status.vue b/app/assets/javascripts/import_entities/components/import_status.vue index 94c04123112..91436457b03 100644 --- a/app/assets/javascripts/import_entities/components/import_status.vue +++ b/app/assets/javascripts/import_entities/components/import_status.vue @@ -133,9 +133,11 @@ export default { if (fetched === imported) { return { name: 'status-success', class: 'gl-text-green-400' }; - } else if (imported === 0) { + } + if (imported === 0) { return { name: 'status-scheduled', class: 'gl-text-gray-400' }; - } else if (this.status === STATUSES.FINISHED) { + } + if (this.status === STATUSES.FINISHED) { return { name: 'status-alert', class: 'gl-text-orange-400' }; } diff --git a/app/assets/javascripts/issuable/components/issue_milestone.vue b/app/assets/javascripts/issuable/components/issue_milestone.vue index c7da3e59098..3340ef2338c 100644 --- a/app/assets/javascripts/issuable/components/issue_milestone.vue +++ b/app/assets/javascripts/issuable/components/issue_milestone.vue @@ -42,7 +42,8 @@ export default { milestoneDatesAbsolute() { if (this.milestoneDue) { return `(${dateInWords(this.milestoneDue)})`; - } else if (this.milestoneStart) { + } + if (this.milestoneStart) { return `(${dateInWords(this.milestoneStart)})`; } return ''; diff --git a/app/assets/javascripts/issues/list/components/issue_card_time_info.vue b/app/assets/javascripts/issues/list/components/issue_card_time_info.vue index 06c2e29a904..22c0984ebdb 100644 --- a/app/assets/javascripts/issues/list/components/issue_card_time_info.vue +++ b/app/assets/javascripts/issues/list/components/issue_card_time_info.vue @@ -66,11 +66,14 @@ export default { if (dueDate && isInPast(due)) { return __('Past due'); - } else if (dueDate && isToday(due)) { + } + if (dueDate && isToday(due)) { return __('Today'); - } else if (startDate && isInFuture(start)) { + } + if (startDate && isInFuture(start)) { return __('Upcoming'); - } else if (dueDate) { + } + if (dueDate) { return getTimeRemainingInWords(due); } return ''; diff --git a/app/assets/javascripts/issues/service_desk/components/empty_state_with_any_issues.vue b/app/assets/javascripts/issues/service_desk/components/empty_state_with_any_issues.vue index a15c8ee2e9f..ab9e70ae223 100644 --- a/app/assets/javascripts/issues/service_desk/components/empty_state_with_any_issues.vue +++ b/app/assets/javascripts/issues/service_desk/components/empty_state_with_any_issues.vue @@ -38,7 +38,8 @@ export default { description: noSearchResultsDescription, svgHeight: 150, }; - } else if (this.isOpenTab) { + } + if (this.isOpenTab) { return { title: noOpenIssuesTitle, description: infoBannerUserNote }; } diff --git a/app/assets/javascripts/jobs/components/job/sidebar/stages_dropdown.vue b/app/assets/javascripts/jobs/components/job/sidebar/stages_dropdown.vue index 220b13277d2..3fee1427256 100644 --- a/app/assets/javascripts/jobs/components/job/sidebar/stages_dropdown.vue +++ b/app/assets/javascripts/jobs/components/job/sidebar/stages_dropdown.vue @@ -52,9 +52,11 @@ export default { pipelineInfo() { if (!this.hasRef) { return s__('Job|%{boldStart}Pipeline%{boldEnd} %{id}'); - } else if (!this.isTriggeredByMergeRequest) { + } + if (!this.isTriggeredByMergeRequest) { return s__('Job|%{boldStart}Pipeline%{boldEnd} %{id} for %{ref}'); - } else if (!this.isMergeRequestPipeline) { + } + if (!this.isMergeRequestPipeline) { return s__('Job|%{boldStart}Pipeline%{boldEnd} %{id} for %{mrId} with %{source}'); } @@ -78,7 +80,8 @@ export default { if (!this.hasRef) { return; - } else if (!this.isTriggeredByMergeRequest) { + } + if (!this.isTriggeredByMergeRequest) { button = this.$refs['copy-source-ref-link']; } else { button = this.$refs['copy-source-branch-link']; diff --git a/app/assets/javascripts/jobs/components/job/stuck_block.vue b/app/assets/javascripts/jobs/components/job/stuck_block.vue index 1a678ce69a8..8c73f09daea 100644 --- a/app/assets/javascripts/jobs/components/job/stuck_block.vue +++ b/app/assets/javascripts/jobs/components/job/stuck_block.vue @@ -43,7 +43,8 @@ export default { dataTestId: 'job-stuck-with-tags', showTags: true, }; - } else if (this.hasOfflineRunnersForProject) { + } + if (this.hasOfflineRunnersForProject) { return { text: s__(`Job|This job is stuck because the project doesn't have any runners online assigned to it.`), diff --git a/app/assets/javascripts/labels/labels_select.js b/app/assets/javascripts/labels/labels_select.js index 587cc82f0fa..db1dbc72624 100644 --- a/app/assets/javascripts/labels/labels_select.js +++ b/app/assets/javascripts/labels/labels_select.js @@ -276,7 +276,8 @@ export default class LabelsSelect { if (selected && selected.id === 0) { this.selected = []; return __('No label'); - } else if (isSelected) { + } + if (isSelected) { this.selected.push(title); } else if (!isSelected && title) { const index = this.selected.indexOf(title); @@ -285,7 +286,8 @@ export default class LabelsSelect { if (selectedLabels.length === 1) { return selectedLabels; - } else if (selectedLabels.length) { + } + if (selectedLabels.length) { return sprintf(__('%{firstLabel} +%{labelCount} more'), { firstLabel: selectedLabels[0], labelCount: selectedLabels.length - 1, diff --git a/app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js b/app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js index d52672b9d08..4e0d19f2c2a 100644 --- a/app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js +++ b/app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js @@ -133,7 +133,8 @@ export const dayInQuarter = (date, quarter) => { return quarter.reduce((acc, month) => { if (dateValues.month > month.getMonth()) { return acc + totalDaysInMonth(month); - } else if (dateValues.month === month.getMonth()) { + } + if (dateValues.month === month.getMonth()) { return acc + dateValues.date; } return acc + 0; @@ -562,9 +563,11 @@ export const approximateDuration = (seconds = 0) => { if (seconds < 30) { return __('less than a minute'); - } else if (seconds < MINUTES_LIMIT) { + } + if (seconds < MINUTES_LIMIT) { return n__('1 minute', '%d minutes', seconds < ONE_MINUTE_LIMIT ? 1 : minutes); - } else if (seconds < HOURS_LIMIT) { + } + if (seconds < HOURS_LIMIT) { return n__('about 1 hour', 'about %d hours', seconds < ONE_HOUR_LIMIT ? 1 : hours); } return n__('1 day', '%d days', seconds < ONE_DAY_LIMIT ? 1 : days); diff --git a/app/assets/javascripts/lib/utils/datetime/date_format_utility.js b/app/assets/javascripts/lib/utils/datetime/date_format_utility.js index b0264796d90..c4b8f95e99f 100644 --- a/app/assets/javascripts/lib/utils/datetime/date_format_utility.js +++ b/app/assets/javascripts/lib/utils/datetime/date_format_utility.js @@ -93,10 +93,12 @@ export const humanizeTimeInterval = (intervalInSeconds) => { if (intervalInSeconds < 60 /* = 1 minute */) { const seconds = Math.round(intervalInSeconds * 10) / 10; return n__('%d second', '%d seconds', seconds); - } else if (intervalInSeconds < 3600 /* = 1 hour */) { + } + if (intervalInSeconds < 3600 /* = 1 hour */) { const minutes = Math.round(intervalInSeconds / 6) / 10; return n__('%d minute', '%d minutes', minutes); - } else if (intervalInSeconds < 86400 /* = 1 day */) { + } + if (intervalInSeconds < 86400 /* = 1 day */) { const hours = Math.round(intervalInSeconds / 360) / 10; return n__('%d hour', '%d hours', hours); } @@ -378,19 +380,24 @@ export const formatTimeAsSummary = ({ seconds, hours, days, minutes, weeks, mont return sprintf(s__('ValueStreamAnalytics|%{value}M'), { value: roundToNearestHalf(months), }); - } else if (weeks) { + } + if (weeks) { return sprintf(s__('ValueStreamAnalytics|%{value}w'), { value: roundToNearestHalf(weeks), }); - } else if (days) { + } + if (days) { return sprintf(s__('ValueStreamAnalytics|%{value}d'), { value: roundToNearestHalf(days), }); - } else if (hours) { + } + if (hours) { return sprintf(s__('ValueStreamAnalytics|%{value}h'), { value: hours }); - } else if (minutes) { + } + if (minutes) { return sprintf(s__('ValueStreamAnalytics|%{value}m'), { value: minutes }); - } else if (seconds) { + } + if (seconds) { return unescape(sanitize(s__('ValueStreamAnalytics|<1m'), { ALLOWED_TAGS: [] })); } return '-'; @@ -441,11 +448,13 @@ export const humanTimeframe = (startDate, dueDate) => { startDate: startDateInWords, dueDate: dueDateInWords, }); - } else if (startDate && !dueDate) { + } + if (startDate && !dueDate) { return sprintf(__('%{startDate} – No due date'), { startDate: dateInWords(start, true, false), }); - } else if (!startDate && dueDate) { + } + if (!startDate && dueDate) { return sprintf(__('No start date – %{dueDate}'), { dueDate: dateInWords(due, true, false), }); diff --git a/app/assets/javascripts/lib/utils/grammar.js b/app/assets/javascripts/lib/utils/grammar.js index 6d6361d19b6..64ba151d829 100644 --- a/app/assets/javascripts/lib/utils/grammar.js +++ b/app/assets/javascripts/lib/utils/grammar.js @@ -19,9 +19,11 @@ import { sprintf, s__ } from '~/locale'; export const toNounSeriesText = (items, { onlyCommas = false } = {}) => { if (items.length === 0) { return ''; - } else if (items.length === 1) { + } + if (items.length === 1) { return sprintf(s__(`nounSeries|%{item}`), { item: items[0] }, false); - } else if (items.length === 2 && !onlyCommas) { + } + if (items.length === 2 && !onlyCommas) { return sprintf( s__('nounSeries|%{firstItem} and %{lastItem}'), { diff --git a/app/assets/javascripts/lib/utils/number_utils.js b/app/assets/javascripts/lib/utils/number_utils.js index 0e943cdb623..d17719c0bc0 100644 --- a/app/assets/javascripts/lib/utils/number_utils.js +++ b/app/assets/javascripts/lib/utils/number_utils.js @@ -84,9 +84,11 @@ export function numberToHumanSizeSplit(size, digits = 2) { if (abs < BYTES_IN_KIB) { return [size.toString(), BYTES_FORMAT_BYTES]; - } else if (abs < BYTES_IN_KIB ** 2) { + } + if (abs < BYTES_IN_KIB ** 2) { return [bytesToKiB(size).toFixed(digits), BYTES_FORMAT_KIB]; - } else if (abs < BYTES_IN_KIB ** 3) { + } + if (abs < BYTES_IN_KIB ** 3) { return [bytesToMiB(size).toFixed(digits), BYTES_FORMAT_MIB]; } return [bytesToGiB(size).toFixed(digits), BYTES_FORMAT_GIB]; diff --git a/app/assets/javascripts/lib/utils/text_markdown.js b/app/assets/javascripts/lib/utils/text_markdown.js index e6eb74834c0..d48e0217fd8 100644 --- a/app/assets/javascripts/lib/utils/text_markdown.js +++ b/app/assets/javascripts/lib/utils/text_markdown.js @@ -202,7 +202,8 @@ function moveCursor({ const startPosition = textArea.selectionStart - (tag.length - tag.indexOf(select)); const endPosition = startPosition + select.length; return textArea.setSelectionRange(startPosition, endPosition); - } else if (editor) { + } + if (editor) { editor.selectWithinSelection(select, tag); return; } diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index 31e16f7b4db..ce8b304e104 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -529,9 +529,11 @@ export const humanizeBranchValidationErrors = (invalidChars = []) => { if (chars.length && !chars.includes(' ')) { return sprintf(__("Can't contain %{chars}"), { chars: chars.join(', ') }); - } else if (chars.includes(' ') && chars.length <= 1) { + } + if (chars.includes(' ') && chars.length <= 1) { return __("Can't contain spaces"); - } else if (chars.includes(' ') && chars.length > 1) { + } + if (chars.includes(' ') && chars.length > 1) { return sprintf(__("Can't contain spaces, %{chars}"), { chars: chars.filter((c) => c !== ' ').join(', '), }); diff --git a/app/assets/javascripts/members/components/modals/remove_member_modal.vue b/app/assets/javascripts/members/components/modals/remove_member_modal.vue index c7bd1525558..ecc769174f4 100644 --- a/app/assets/javascripts/members/components/modals/remove_member_modal.vue +++ b/app/assets/javascripts/members/components/modals/remove_member_modal.vue @@ -56,7 +56,8 @@ export default { actionText() { if (this.isAccessRequest) { return __('Deny access request'); - } else if (this.isInvite) { + } + if (this.isInvite) { return s__('Member|Revoke invite'); } diff --git a/app/assets/javascripts/members/components/table/members_table_cell.vue b/app/assets/javascripts/members/components/table/members_table_cell.vue index 407cbc55dd3..cac8c9fb4db 100644 --- a/app/assets/javascripts/members/components/table/members_table_cell.vue +++ b/app/assets/javascripts/members/components/table/members_table_cell.vue @@ -32,9 +32,11 @@ export default { memberType() { if (this.isGroup) { return MEMBER_TYPES.group; - } else if (this.isInvite) { + } + if (this.isInvite) { return MEMBER_TYPES.invite; - } else if (this.isAccessRequest) { + } + if (this.isAccessRequest) { return MEMBER_TYPES.accessRequest; } diff --git a/app/assets/javascripts/notebook/cells/output/index.vue b/app/assets/javascripts/notebook/cells/output/index.vue index c8268b1a9ae..a7b753b7ca8 100644 --- a/app/assets/javascripts/notebook/cells/output/index.vue +++ b/app/assets/javascripts/notebook/cells/output/index.vue @@ -33,19 +33,26 @@ export default { outputType(output) { if (output.text) { return 'text/plain'; - } else if (output.output_type === ERROR_OUTPUT_TYPE) { + } + if (output.output_type === ERROR_OUTPUT_TYPE) { return 'error'; - } else if (output.data['image/png']) { + } + if (output.data['image/png']) { return 'image/png'; - } else if (output.data['image/jpeg']) { + } + if (output.data['image/jpeg']) { return 'image/jpeg'; - } else if (output.data['text/html']) { + } + if (output.data['text/html']) { return 'text/html'; - } else if (output.data['text/latex']) { + } + if (output.data['text/latex']) { return 'text/latex'; - } else if (output.data['image/svg+xml']) { + } + if (output.data['image/svg+xml']) { return 'image/svg+xml'; - } else if (output.data[TEXT_MARKDOWN]) { + } + if (output.data[TEXT_MARKDOWN]) { return TEXT_MARKDOWN; } @@ -63,21 +70,29 @@ export default { getComponent(output) { if (output.text) { return CodeOutput; - } else if (output.output_type === ERROR_OUTPUT_TYPE) { + } + if (output.output_type === ERROR_OUTPUT_TYPE) { return ErrorOutput; - } else if (output.data['image/png']) { + } + if (output.data['image/png']) { return ImageOutput; - } else if (output.data['image/jpeg']) { + } + if (output.data['image/jpeg']) { return ImageOutput; - } else if (isDataframe(output)) { + } + if (isDataframe(output)) { return DataframeOutput; - } else if (output.data['text/html']) { + } + if (output.data['text/html']) { return HtmlOutput; - } else if (output.data['text/latex']) { + } + if (output.data['text/latex']) { return LatexOutput; - } else if (output.data['image/svg+xml']) { + } + if (output.data['image/svg+xml']) { return HtmlOutput; - } else if (output.data[TEXT_MARKDOWN]) { + } + if (output.data[TEXT_MARKDOWN]) { return MarkdownOutput; } diff --git a/app/assets/javascripts/notes/components/discussion_filter.vue b/app/assets/javascripts/notes/components/discussion_filter.vue index 7266cdb6405..90f7a6862f0 100644 --- a/app/assets/javascripts/notes/components/discussion_filter.vue +++ b/app/assets/javascripts/notes/components/discussion_filter.vue @@ -137,7 +137,8 @@ export default { filterType(value) { if (value === 0) { return DISCUSSION_FILTER_TYPES.ALL; - } else if (value === 1) { + } + if (value === 1) { return DISCUSSION_FILTER_TYPES.COMMENTS; } return DISCUSSION_FILTER_TYPES.HISTORY; diff --git a/app/assets/javascripts/notes/components/mr_discussion_filter.vue b/app/assets/javascripts/notes/components/mr_discussion_filter.vue index 08d3670ae6a..c2ac95ca56e 100644 --- a/app/assets/javascripts/notes/components/mr_discussion_filter.vue +++ b/app/assets/javascripts/notes/components/mr_discussion_filter.vue @@ -36,7 +36,8 @@ export default { if (length === MR_FILTER_OPTIONS.length) { return __('All activity'); - } else if (length > 1) { + } + if (length > 1) { return `%{strongStart}${firstSelected.text}%{strongEnd} +${length - 1} more`; } diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue index 6c4e5f3227f..363383fd7ad 100644 --- a/app/assets/javascripts/notes/components/note_form.vue +++ b/app/assets/javascripts/notes/components/note_form.vue @@ -160,12 +160,14 @@ export default { filePath: this.diffFile.file_path, refs: this.diffFile.diff_refs, }; - } else if (this.note && this.note.position) { + } + if (this.note && this.note.position) { return { filePath: this.note.position.new_path, refs: this.note.position, }; - } else if (this.discussion && this.discussion.diff_file) { + } + if (this.discussion && this.discussion.diff_file) { return { filePath: this.discussion.diff_file.file_path, refs: this.discussion.diff_file.diff_refs, diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index a20bce2e53a..7eb01897296 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -376,7 +376,8 @@ export const resolveDiscussion = ({ state, dispatch, getters }, { discussionId } if (!discussion) { return Promise.reject(); - } else if (isResolved) { + } + if (isResolved) { return Promise.resolve(); } 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 5f6a73782c3..642fd56eab1 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 @@ -69,7 +69,8 @@ export default { formattedTime() { if (this.randomHour > 12) { return `${this.randomHour - 12}:00pm`; - } else if (this.randomHour === 12) { + } + if (this.randomHour === 12) { return `12:00pm`; } return `${this.randomHour}:00am`; diff --git a/app/assets/javascripts/performance_bar/components/detailed_metric.vue b/app/assets/javascripts/performance_bar/components/detailed_metric.vue index 5bef7e6e322..b53e2709f83 100644 --- a/app/assets/javascripts/performance_bar/components/detailed_metric.vue +++ b/app/assets/javascripts/performance_bar/components/detailed_metric.vue @@ -67,7 +67,8 @@ export default { metricDetailsLabel() { if (this.metricDetails.duration && this.metricDetails.calls) { return `${this.metricDetails.duration} / ${this.metricDetails.calls}`; - } else if (this.metricDetails.calls) { + } + if (this.metricDetails.calls) { return this.metricDetails.calls; } diff --git a/app/assets/javascripts/protected_branches/protected_branch_edit.js b/app/assets/javascripts/protected_branches/protected_branch_edit.js index b6c86750723..bbf10ef3b01 100644 --- a/app/assets/javascripts/protected_branches/protected_branch_edit.js +++ b/app/assets/javascripts/protected_branches/protected_branch_edit.js @@ -164,7 +164,8 @@ export default class ProtectedBranchEdit { username: currentSelectedItem.username, avatar_url: currentSelectedItem.avatar_url, }; - } else if (currentItem.group_id) { + } + if (currentItem.group_id) { return { id: currentItem.id, group_id: currentItem.group_id, diff --git a/app/assets/javascripts/related_issues/components/add_issuable_form.vue b/app/assets/javascripts/related_issues/components/add_issuable_form.vue index b3033ddf3b6..d36b29f69a5 100644 --- a/app/assets/javascripts/related_issues/components/add_issuable_form.vue +++ b/app/assets/javascripts/related_issues/components/add_issuable_form.vue @@ -115,7 +115,8 @@ export default { addRelatedErrorMessage() { if (this.itemAddFailureMessage) { return this.itemAddFailureMessage; - } else if (this.itemAddFailureType === itemAddFailureTypesMap.NOT_FOUND) { + } + if (this.itemAddFailureType === itemAddFailureTypesMap.NOT_FOUND) { return addRelatedIssueErrorMap[this.issuableType]; } // Only other failure is MAX_NUMBER_OF_CHILD_EPICS at the moment diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue index 4f0907df7f2..a76d822317a 100644 --- a/app/assets/javascripts/repository/components/table/row.vue +++ b/app/assets/javascripts/repository/components/table/row.vue @@ -123,7 +123,8 @@ export default { path: joinPaths('/-/blob', this.escapedRef, this.path), refType: this.refType, }); - } else if (this.isFolder) { + } + if (this.isFolder) { return buildURLwithRefType({ path: joinPaths('/-/tree', this.escapedRef, this.path), refType: this.refType, diff --git a/app/assets/javascripts/search/store/utils.js b/app/assets/javascripts/search/store/utils.js index 2f02ef3475c..b15f89fc6a2 100644 --- a/app/assets/javascripts/search/store/utils.js +++ b/app/assets/javascripts/search/store/utils.js @@ -68,7 +68,8 @@ export const setFrequentItemToLS = (key, data, itemData) => { frequentItems.sort((a, b) => { if (a.frequency > b.frequency) { return -1; - } else if (a.frequency < b.frequency) { + } + if (a.frequency < b.frequency) { return 1; } return b.lastUsed - a.lastUsed; diff --git a/app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue b/app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue index 577c01c50ff..8a912b00df1 100644 --- a/app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue +++ b/app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue @@ -84,7 +84,8 @@ export default { if (mergeLength === this.users.length) { return ''; - } else if (mergeLength > 0) { + } + if (mergeLength > 0) { return sprintf(__('%{mergeLength}/%{usersLength} can merge'), { mergeLength, usersLength: this.users.length, diff --git a/app/assets/javascripts/sidebar/components/labels/labels_select_vue/store/getters.js b/app/assets/javascripts/sidebar/components/labels/labels_select_vue/store/getters.js index 03ace6286e0..3ab7757d34d 100644 --- a/app/assets/javascripts/sidebar/components/labels/labels_select_vue/store/getters.js +++ b/app/assets/javascripts/sidebar/components/labels/labels_select_vue/store/getters.js @@ -19,7 +19,8 @@ export const dropdownButtonText = (state, getters) => { if (!selectedLabels.length) { return state.dropdownButtonText || __('Label'); - } else if (selectedLabels.length > 1) { + } + if (selectedLabels.length > 1) { return sprintf(s__('LabelSelect|%{firstLabelName} +%{remainingLabelCount} more'), { firstLabelName: selectedLabels[0].title, remainingLabelCount: selectedLabels.length - 1, diff --git a/app/assets/javascripts/sidebar/components/labels/labels_select_widget/dropdown_contents.vue b/app/assets/javascripts/sidebar/components/labels/labels_select_widget/dropdown_contents.vue index 53582aacabd..a513c247be7 100644 --- a/app/assets/javascripts/sidebar/components/labels/labels_select_widget/dropdown_contents.vue +++ b/app/assets/javascripts/sidebar/components/labels/labels_select_widget/dropdown_contents.vue @@ -101,7 +101,8 @@ export default { buttonText() { if (!this.localSelectedLabels.length) { return this.dropdownButtonText || __('Label'); - } else if (this.localSelectedLabels.length > 1) { + } + if (this.localSelectedLabels.length > 1) { return sprintf(s__('LabelSelect|%{firstLabelName} +%{remainingLabelCount} more'), { firstLabelName: this.localSelectedLabels[0].title, remainingLabelCount: this.localSelectedLabels.length - 1, diff --git a/app/assets/javascripts/sidebar/components/reviewers/collapsed_reviewer_list.vue b/app/assets/javascripts/sidebar/components/reviewers/collapsed_reviewer_list.vue index 88a74784dd2..415c40b4779 100644 --- a/app/assets/javascripts/sidebar/components/reviewers/collapsed_reviewer_list.vue +++ b/app/assets/javascripts/sidebar/components/reviewers/collapsed_reviewer_list.vue @@ -52,7 +52,8 @@ export default { if (mergeLength === this.users.length) { return ''; - } else if (mergeLength > 0) { + } + if (mergeLength > 0) { return sprintf(__('%{mergeLength}/%{usersLength} can merge'), { mergeLength, usersLength: this.users.length, diff --git a/app/assets/javascripts/sidebar/components/time_tracking/collapsed_state.vue b/app/assets/javascripts/sidebar/components/time_tracking/collapsed_state.vue index 465f971717f..ac05ae3896b 100644 --- a/app/assets/javascripts/sidebar/components/time_tracking/collapsed_state.vue +++ b/app/assets/javascripts/sidebar/components/time_tracking/collapsed_state.vue @@ -42,11 +42,14 @@ export default { divClass() { if (this.showComparisonState) { return 'compare'; - } else if (this.showEstimateOnlyState) { + } + if (this.showEstimateOnlyState) { return 'estimate-only'; - } else if (this.showSpentOnlyState) { + } + if (this.showSpentOnlyState) { return 'spend-only'; - } else if (this.showNoTimeTrackingState) { + } + if (this.showNoTimeTrackingState) { return 'no-tracking'; } @@ -55,9 +58,11 @@ export default { spanClass() { if (this.showComparisonState) { return ''; - } else if (this.showEstimateOnlyState || this.showSpentOnlyState) { + } + if (this.showEstimateOnlyState || this.showSpentOnlyState) { return 'bold'; - } else if (this.showNoTimeTrackingState) { + } + if (this.showNoTimeTrackingState) { return 'no-value collapse-truncated-title gl-pt-2 gl-px-3 gl-font-sm'; } @@ -66,11 +71,14 @@ export default { text() { if (this.showComparisonState) { return `${this.timeSpentHumanReadable} / ${this.timeEstimateHumanReadable}`; - } else if (this.showEstimateOnlyState) { + } + if (this.showEstimateOnlyState) { return `-- / ${this.timeEstimateHumanReadable}`; - } else if (this.showSpentOnlyState) { + } + if (this.showSpentOnlyState) { return `${this.timeSpentHumanReadable} / --`; - } else if (this.showNoTimeTrackingState) { + } + if (this.showNoTimeTrackingState) { return __('None'); } diff --git a/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue b/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue index 91b23689f0d..aff592d48e0 100644 --- a/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue +++ b/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue @@ -123,9 +123,11 @@ export default { // 3. issuableIid and fullPath are not provided if (!this.issuableType || !timeTrackingQueries[this.issuableType]) { return true; - } else if (this.initialTimeTracking) { + } + if (this.initialTimeTracking) { return true; - } else if (!this.issuableIid || !this.fullPath) { + } + if (!this.issuableIid || !this.fullPath) { return true; } return false; diff --git a/app/assets/javascripts/snippets/utils/blob.js b/app/assets/javascripts/snippets/utils/blob.js index a228d6111ce..97f21654aae 100644 --- a/app/assets/javascripts/snippets/utils/blob.js +++ b/app/assets/javascripts/snippets/utils/blob.js @@ -34,7 +34,8 @@ const diff = ({ content, path }, origBlob) => { content, filePath: path, }; - } else if (origBlob.path !== path || origBlob.content !== content) { + } + if (origBlob.path !== path || origBlob.content !== content) { return { action: origBlob.path === path ? SNIPPET_BLOB_ACTION_UPDATE : SNIPPET_BLOB_ACTION_MOVE, previousPath: origBlob.path, diff --git a/app/assets/javascripts/super_sidebar/utils.js b/app/assets/javascripts/super_sidebar/utils.js index cbf93155fb6..72a62ed6b71 100644 --- a/app/assets/javascripts/super_sidebar/utils.js +++ b/app/assets/javascripts/super_sidebar/utils.js @@ -18,7 +18,8 @@ const sortItemsByFrequencyAndLastAccess = (items) => // and then by lastAccessedOn with recent most first if (itemA.frequency !== itemB.frequency) { return itemB.frequency - itemA.frequency; - } else if (itemA.lastAccessedOn !== itemB.lastAccessedOn) { + } + if (itemA.lastAccessedOn !== itemB.lastAccessedOn) { return itemB.lastAccessedOn - itemA.lastAccessedOn; } diff --git a/app/assets/javascripts/users_select/index.js b/app/assets/javascripts/users_select/index.js index 1b36f02226d..aa68cf5a161 100644 --- a/app/assets/javascripts/users_select/index.js +++ b/app/assets/javascripts/users_select/index.js @@ -171,9 +171,11 @@ function UsersSelect(currentUser, els, options = {}) { if (selectedUsers.length === 0) { return s__('UsersSelect|Unassigned'); - } else if (selectedUsers.length === 1) { + } + if (selectedUsers.length === 1) { return firstUser.name; - } else if (isSelected) { + } + if (isSelected) { const otherSelected = selectedUsers.filter((s) => s !== selectedUser.id); return sprintf(s__('UsersSelect|%{name} + %{length} more'), { name: selectedUser.name, diff --git a/app/assets/javascripts/vue_merge_request_widget/components/added_commit_message.vue b/app/assets/javascripts/vue_merge_request_widget/components/added_commit_message.vue index 5090081d281..3b62345b969 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/added_commit_message.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/added_commit_message.vue @@ -70,7 +70,8 @@ export default { message() { if (this.state === STATUS_CLOSED) { return s__('mrWidgetCommitsAdded|The changes were not merged into %{targetBranch}.'); - } else if (this.isMerged) { + } + if (this.isMerged) { return s__( 'mrWidgetCommitsAdded|Changes merged into %{targetBranch} with %{mergeCommitSha}%{squashedCommits}.', ); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue b/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue index 95fa01c23f1..4ed470440cc 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue @@ -131,7 +131,8 @@ export default { variant: 'confirm', action: () => this.approve(), }; - } else if (this.showUnapprove) { + } + if (this.showUnapprove) { return { text: s__('mrWidget|Revoke approval'), variant: 'default', 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 c7d34d45f06..efe71ed569a 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 @@ -58,7 +58,8 @@ export default { return s__( 'mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} increased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB', ); - } else if (memoryTo < memoryFrom) { + } + if (memoryTo < memoryFrom) { return s__( 'mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} decreased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB', ); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/utils.js b/app/assets/javascripts/vue_merge_request_widget/components/extensions/utils.js index 757178ee336..83f5c1490e2 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/utils.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/utils.js @@ -65,11 +65,8 @@ const createText = (text) => { export const generateText = (text) => { if (typeof text === 'string') { return createText(escapeText(text)); - } else if ( - typeof text === 'object' && - typeof text.text === 'string' && - typeof text.href === 'string' - ) { + } + if (typeof text === 'object' && typeof text.text === 'string' && typeof text.href === 'string') { return createText( `${ text.prependText ? `${escapeText(text.prependText)} ` : '' diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue index 400759aa086..4f39bd1d972 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue @@ -38,7 +38,7 @@ export default { }, modifyLinkMessage() { if (this.isFastForwardEnabled) return __('Modify commit message'); - else if (this.isSquashEnabled) return __('Modify commit messages'); + if (this.isSquashEnabled) return __('Modify commit messages'); return __('Modify merge commit'); }, ariaLabel() { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/merge_checks_failed.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/merge_checks_failed.vue index 61eec503951..bf2c5e52184 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/merge_checks_failed.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/merge_checks_failed.vue @@ -30,9 +30,11 @@ export default { failedText() { if (this.mr.approvals && !this.mr.isApproved) { return this.$options.i18n.approvalNeeded; - } else if (this.mr.detailedMergeStatus === DETAILED_MERGE_STATUS.BLOCKED_STATUS) { + } + if (this.mr.detailedMergeStatus === DETAILED_MERGE_STATUS.BLOCKED_STATUS) { return this.$options.i18n.blockingMergeRequests; - } else if (this.mr.detailedMergeStatus === DETAILED_MERGE_STATUS.EXTERNAL_STATUS_CHECKS) { + } + if (this.mr.detailedMergeStatus === DETAILED_MERGE_STATUS.EXTERNAL_STATUS_CHECKS) { return this.$options.i18n.externalStatusChecksFailed; } diff --git a/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js b/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js index 713c9e610b3..3af984dcf6c 100644 --- a/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js +++ b/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js @@ -23,14 +23,17 @@ export default { const { newErrors, resolvedErrors, parsingInProgress } = data; if (parsingInProgress) { return i18n.loading; - } else if (newErrors.length >= 1 && resolvedErrors.length >= 1) { + } + if (newErrors.length >= 1 && resolvedErrors.length >= 1) { return i18n.improvementAndDegradationCopy( i18n.findings(resolvedErrors, codeQualityPrefixes.fixed), i18n.findings(newErrors, codeQualityPrefixes.new), ); - } else if (resolvedErrors.length >= 1) { + } + if (resolvedErrors.length >= 1) { return i18n.singularCopy(i18n.findings(resolvedErrors, codeQualityPrefixes.fixed)); - } else if (newErrors.length >= 1) { + } + if (newErrors.length >= 1) { return i18n.singularCopy(i18n.findings(newErrors, codeQualityPrefixes.new)); } return i18n.noChanges; @@ -38,7 +41,8 @@ export default { statusIcon() { if (this.collapsedData.newErrors.length >= 1) { return EXTENSION_ICONS.warning; - } else if (this.collapsedData.resolvedErrors.length >= 1) { + } + if (this.collapsedData.resolvedErrors.length >= 1) { return EXTENSION_ICONS.success; } return EXTENSION_ICONS.neutral; diff --git a/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.vue b/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.vue index d30acf24684..cd3a98effa3 100644 --- a/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.vue +++ b/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.vue @@ -36,9 +36,11 @@ export default { if (!this.pollingFinished) { return { title: i18n.loading }; - } else if (this.hasError) { + } + if (this.hasError) { return { title: i18n.error }; - } else if ( + } + if ( this.collapsedData?.new_errors?.length >= 1 && this.collapsedData?.resolved_errors?.length >= 1 ) { @@ -48,11 +50,13 @@ export default { i18n.findings(new_errors, codeQualityPrefixes.new), ), }; - } else if (this.collapsedData?.resolved_errors?.length >= 1) { + } + if (this.collapsedData?.resolved_errors?.length >= 1) { return { title: i18n.singularCopy(i18n.findings(resolved_errors, codeQualityPrefixes.fixed)), }; - } else if (this.collapsedData?.new_errors?.length >= 1) { + } + if (this.collapsedData?.new_errors?.length >= 1) { return { title: i18n.singularCopy(i18n.findings(new_errors, codeQualityPrefixes.new)) }; } return { title: i18n.noChanges }; @@ -95,7 +99,8 @@ export default { statusIcon() { if (this.collapsedData?.new_errors?.length >= 1) { return EXTENSION_ICONS.warning; - } else if (this.collapsedData?.resolved_errors?.length >= 1) { + } + if (this.collapsedData?.resolved_errors?.length >= 1) { return EXTENSION_ICONS.success; } return EXTENSION_ICONS.neutral; diff --git a/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js b/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js index f90056a8e1a..d6bab074f3f 100644 --- a/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js +++ b/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js @@ -4,31 +4,44 @@ import { stateKey } from './state_maps'; export default function deviseState() { if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.PREPARING) { return stateKey.preparing; - } else if (!this.commitsCount) { + } + if (!this.commitsCount) { return stateKey.nothingToMerge; - } else if (this.projectArchived) { + } + if (this.projectArchived) { return stateKey.archived; - } else if (this.branchMissing) { + } + if (this.branchMissing) { return stateKey.missingBranch; - } else if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.CHECKING) { + } + if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.CHECKING) { return stateKey.checking; - } else if (this.hasConflicts) { + } + if (this.hasConflicts) { return stateKey.conflicts; - } else if (this.shouldBeRebased) { + } + if (this.shouldBeRebased) { return stateKey.rebase; - } else if (this.hasMergeChecksFailed && !this.autoMergeEnabled) { + } + if (this.hasMergeChecksFailed && !this.autoMergeEnabled) { return stateKey.mergeChecksFailed; - } else if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.CI_MUST_PASS) { + } + if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.CI_MUST_PASS) { return stateKey.pipelineFailed; - } else if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.DRAFT_STATUS) { + } + if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.DRAFT_STATUS) { return stateKey.draft; - } else if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.DISCUSSIONS_NOT_RESOLVED) { + } + if (this.detailedMergeStatus === DETAILED_MERGE_STATUS.DISCUSSIONS_NOT_RESOLVED) { return stateKey.unresolvedDiscussions; - } else if (this.canMerge && this.isSHAMismatch) { + } + if (this.canMerge && this.isSHAMismatch) { return stateKey.shaMismatch; - } else if (this.autoMergeEnabled && !this.mergeError) { + } + if (this.autoMergeEnabled && !this.mergeError) { return stateKey.autoMergeEnabled; - } else if ( + } + if ( this.detailedMergeStatus === DETAILED_MERGE_STATUS.MERGEABLE || this.detailedMergeStatus === DETAILED_MERGE_STATUS.CI_STILL_RUNNING ) { diff --git a/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js b/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js index a74b7ed8587..bb74f82145f 100644 --- a/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js +++ b/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js @@ -351,11 +351,14 @@ export default class MergeRequestStore { if (availableAutoMergeStrategies.includes(MTWPS_MERGE_STRATEGY)) { return MTWPS_MERGE_STRATEGY; - } else if (availableAutoMergeStrategies.includes(MT_MERGE_STRATEGY)) { + } + if (availableAutoMergeStrategies.includes(MT_MERGE_STRATEGY)) { return MT_MERGE_STRATEGY; - } else if (availableAutoMergeStrategies.includes(MWCP_MERGE_STRATEGY)) { + } + if (availableAutoMergeStrategies.includes(MWCP_MERGE_STRATEGY)) { return MWCP_MERGE_STRATEGY; - } else if (availableAutoMergeStrategies.includes(MWPS_MERGE_STRATEGY)) { + } + if (availableAutoMergeStrategies.includes(MWPS_MERGE_STRATEGY)) { return MWPS_MERGE_STRATEGY; } diff --git a/app/assets/javascripts/vue_shared/components/changed_file_icon.vue b/app/assets/javascripts/vue_shared/components/changed_file_icon.vue index 14e99977a85..2a47e96b2e2 100644 --- a/app/assets/javascripts/vue_shared/components/changed_file_icon.vue +++ b/app/assets/javascripts/vue_shared/components/changed_file_icon.vue @@ -50,11 +50,14 @@ export default { tooltipTitle() { if (!this.showTooltip) { return undefined; - } else if (this.file.deleted) { + } + if (this.file.deleted) { return __('Deleted'); - } else if (this.file.tempFile) { + } + if (this.file.tempFile) { return __('Added'); - } else if (this.file.changed) { + } + if (this.file.changed) { return __('Modified'); } diff --git a/app/assets/javascripts/vue_shared/components/diff_viewer/diff_viewer.vue b/app/assets/javascripts/vue_shared/components/diff_viewer/diff_viewer.vue index 7080e046b30..535f1c5f645 100644 --- a/app/assets/javascripts/vue_shared/components/diff_viewer/diff_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/diff_viewer/diff_viewer.vue @@ -65,7 +65,8 @@ export default { viewer() { if (this.diffViewerMode === diffViewerModes.renamed) { return RenamedFile; - } else if (this.diffMode === diffModes.mode_changed) { + } + if (this.diffMode === diffModes.mode_changed) { return ModeChanged; } diff --git a/app/assets/javascripts/vue_shared/components/file_finder/index.vue b/app/assets/javascripts/vue_shared/components/file_finder/index.vue index db0b0ea185b..226f44a1541 100644 --- a/app/assets/javascripts/vue_shared/components/file_finder/index.vue +++ b/app/assets/javascripts/vue_shared/components/file_finder/index.vue @@ -145,7 +145,8 @@ export default { el.classList.contains('inputarea') ) { return true; - } else if (combo === 'mod+p') { + } + if (combo === 'mod+p') { return false; } diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue b/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue index 007aae3f5a0..797a38d8171 100644 --- a/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue @@ -74,7 +74,8 @@ export default { if (this.blob.name && this.blob.name.endsWith(`.${SVELTE_LANGUAGE}`)) { // override for svelte files until https://github.com/rouge-ruby/rouge/issues/1717 is resolved return SVELTE_LANGUAGE; - } else if (this.isCodeownersFile) { + } + if (this.isCodeownersFile) { // override for codeowners files return this.$options.codeownersLanguage; } diff --git a/app/assets/javascripts/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue b/app/assets/javascripts/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue index bda88a48e48..9ba5e8724f9 100644 --- a/app/assets/javascripts/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue +++ b/app/assets/javascripts/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue @@ -70,7 +70,8 @@ export default { selectTarget() { if (isFunction(this.truncateTarget)) { return this.truncateTarget(this.$el); - } else if (this.truncateTarget === 'child') { + } + if (this.truncateTarget === 'child') { return this.$el.childNodes[0]; } return this.$el; diff --git a/app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue b/app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue index 446c8c97df0..30f616dd8e1 100644 --- a/app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue +++ b/app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue @@ -83,9 +83,11 @@ export default { if (this.user.status.emoji && this.user.status.message_html) { return `${glEmojiTag(this.user.status.emoji)} ${this.user.status.message_html}`; - } else if (this.user.status.message_html) { + } + if (this.user.status.message_html) { return this.user.status.message_html; - } else if (this.user.status.emoji) { + } + if (this.user.status.emoji) { return glEmojiTag(this.user.status.emoji); } diff --git a/app/assets/javascripts/vue_shared/components/web_ide_link.vue b/app/assets/javascripts/vue_shared/components/web_ide_link.vue index 79d14b5f2d0..beb8321a271 100644 --- a/app/assets/javascripts/vue_shared/components/web_ide_link.vue +++ b/app/assets/javascripts/vue_shared/components/web_ide_link.vue @@ -195,9 +195,11 @@ export default { webIdeActionText() { if (this.webIdeText) { return this.webIdeText; - } else if (this.isBlob) { + } + if (this.isBlob) { return __('Open in Web IDE'); - } else if (this.isFork) { + } + if (this.isFork) { return __('Edit fork in Web IDE'); } diff --git a/app/assets/javascripts/vue_shared/issuable/list/components/issuable_item.vue b/app/assets/javascripts/vue_shared/issuable/list/components/issuable_item.vue index ec3078cd5a9..324228111d4 100644 --- a/app/assets/javascripts/vue_shared/issuable/list/components/issuable_item.vue +++ b/app/assets/javascripts/vue_shared/issuable/list/components/issuable_item.vue @@ -138,7 +138,8 @@ export default { return sprintf(__('closed %{timeago}'), { timeago: this.timeFormatted(this.issuable.closedAt), }); - } else if (this.issuable.updatedAt !== this.issuable.createdAt) { + } + if (this.issuable.updatedAt !== this.issuable.createdAt) { return sprintf(__('updated %{timeAgo}'), { timeAgo: this.timeFormatted(this.issuable.updatedAt), }); diff --git a/app/assets/javascripts/vuex_shared/bindings.js b/app/assets/javascripts/vuex_shared/bindings.js index bc3741a3880..07b16a13e68 100644 --- a/app/assets/javascripts/vuex_shared/bindings.js +++ b/app/assets/javascripts/vuex_shared/bindings.js @@ -20,7 +20,8 @@ export const mapComputed = (list, defaultUpdateFn, root) => { get() { if (getter) { return this.$store.getters[getter]; - } else if (root) { + } + if (root) { if (typeof root === 'function') { return root(this.$store.state)[key]; } diff --git a/app/assets/javascripts/work_items/components/shared/work_item_link_child_metadata.vue b/app/assets/javascripts/work_items/components/shared/work_item_link_child_metadata.vue index ddeac2b92ae..38d8d239a7e 100644 --- a/app/assets/javascripts/work_items/components/shared/work_item_link_child_metadata.vue +++ b/app/assets/javascripts/work_items/components/shared/work_item_link_child_metadata.vue @@ -42,7 +42,8 @@ export default { assigneesContainerClass() { if (this.assignees.length === 2) { return 'fixed-width-avatars-2'; - } else if (this.assignees.length > 2) { + } + if (this.assignees.length > 2) { return 'fixed-width-avatars-3'; } return ''; diff --git a/app/assets/javascripts/work_items/components/work_item_links/work_item_links_form.vue b/app/assets/javascripts/work_items/components/work_item_links/work_item_links_form.vue index a58752a861a..55440e1603c 100644 --- a/app/assets/javascripts/work_items/components/work_item_links/work_item_links_form.vue +++ b/app/assets/javascripts/work_items/components/work_item_links/work_item_links_form.vue @@ -151,7 +151,8 @@ export default { addOrCreateButtonLabel() { if (this.isCreateForm) { return sprintfWorkItem(I18N_WORK_ITEM_CREATE_BUTTON_LABEL, this.childrenTypeName); - } else if (this.workItemsToAdd.length > 1) { + } + if (this.workItemsToAdd.length > 1) { return sprintfWorkItem(I18N_WORK_ITEM_ADD_MULTIPLE_BUTTON_LABEL, this.childrenTypeName); } return sprintfWorkItem(I18N_WORK_ITEM_ADD_BUTTON_LABEL, this.childrenTypeName); diff --git a/app/assets/javascripts/work_items_hierarchy/hierarchy_util.js b/app/assets/javascripts/work_items_hierarchy/hierarchy_util.js index 61d93acdb91..57f4783955c 100644 --- a/app/assets/javascripts/work_items_hierarchy/hierarchy_util.js +++ b/app/assets/javascripts/work_items_hierarchy/hierarchy_util.js @@ -3,7 +3,8 @@ import { LICENSE_PLAN } from './constants'; export function inferLicensePlan({ hasSubEpics, hasEpics }) { if (hasSubEpics) { return LICENSE_PLAN.ULTIMATE; - } else if (hasEpics) { + } + if (hasEpics) { return LICENSE_PLAN.PREMIUM; } return LICENSE_PLAN.FREE; |