Commit b2b48f22 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'leipert-upgrade-prettier' into 'master'

Upgrade prettier to v2

See merge request gitlab-org/gitlab!50464
parents f749620c 9b1d8b4c
......@@ -9,3 +9,137 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.css
*.scss
*.md
# temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively:
ee/spec/frontend/api_spec.js
ee/spec/frontend/admin/dev_ops_report
ee/spec/frontend/analytics/code_review_analytics/components
ee/spec/frontend/analytics/contribution_analytics/components
ee/spec/frontend/analytics/cycle_analytics
ee/spec/frontend/analytics/merge_request_analytics
ee/spec/frontend/analytics/productivity_analytics
ee/spec/frontend/analytics/repository_analytics/components
ee/spec/frontend/analytics/shared/components
ee/spec/frontend/approvals/components
ee/spec/frontend/audit_events/components
ee/spec/frontend/billings/subscriptions/components
ee/spec/frontend/boards/components
ee/spec/frontend/boards/stores
ee/spec/frontend/burndown_chart
ee/spec/frontend/compliance_dashboard/components/merge_requests
ee/spec/frontend/dependencies/components
ee/spec/frontend/epic/store
ee/spec/frontend/geo_nodes/components
ee/spec/frontend/geo_replicable/components
ee/spec/frontend/groups/components
ee/spec/frontend/groups/settings/
ee/spec/frontend/incidents/components
ee/spec/frontend/insights
ee/spec/frontend/issuable/related_issues/components
ee/spec/frontend/issues_analytics/components
ee/spec/frontend/iterations/components
ee/spec/frontend/license_compliance/components
ee/spec/frontend/members/components/ldap
ee/spec/frontend/on_demand_scans/components/profile_selector
ee/spec/frontend/oncall_schedule
ee/spec/frontend/pages/admin/users
ee/spec/frontend/related_items_tree/components
ee/spec/frontend/related_items_tree/store
ee/spec/frontend/roadmap/components
ee/spec/frontend/security_configuration/components
ee/spec/frontend/security_configuration/dast_scanner_profiles_form/components
ee/spec/frontend/security_configuration/sast/components
ee/spec/frontend/security_dashboard/components
ee/spec/frontend/security_dashboard/store/modules/project_selector
ee/spec/frontend/sidebar/components
ee/spec/frontend/storage_counter/components
ee/spec/frontend/subscriptions/new/components
ee/spec/frontend/threat_monitoring
ee/spec/frontend/vue_mr_widget
ee/spec/frontend/vue_shared/components/sidebar/epics_select
ee/spec/frontend/vue_shared/license_compliance/components
ee/spec/frontend/vue_shared/license_compliance/store
ee/spec/frontend/vue_shared/security_reports/components
ee/spec/frontend/vulnerabilities
spec/frontend/alert_management/components
spec/frontend/alerts_settings
spec/frontend/authentication/u2f
spec/frontend/badges/components
spec/frontend/badges/store
spec/frontend/batch_comments/components
spec/frontend/behaviors
spec/frontend/blob/components
spec/frontend/boards
spec/frontend/ci_settings_pipeline_triggers/components
spec/frontend/ci_variable_list/ci_variable_list
spec/frontend/create_cluster/components
spec/frontend/create_cluster/eks_cluster/services
spec/frontend/deploy_freeze/components
spec/frontend/deploy_keys/components
spec/frontend/design_management/components/design_notes
spec/frontend/design_management/pages
spec/frontend/diffs/components
spec/frontend/diffs/store
spec/frontend/error_tracking/components
spec/frontend/error_tracking/store/list
spec/frontend/error_tracking_settings/components
spec/frontend/feature_flags/components
spec/frontend/filtered_search/components
spec/frontend/groups/components
spec/frontend/helpers
spec/frontend/ide/components
spec/frontend/ide/lib
spec/frontend/ide/stores
spec/frontend/incidents/components
spec/frontend/incidents_settings/components
spec/frontend/integrations/edit/components
spec/frontend/issuable/related_issues/components
spec/frontend/issuable_list/components
spec/frontend/issuable_show/components
spec/frontend/issuable_suggestions/components
spec/frontend/issue_show/components
spec/frontend/issues_list/components
spec/frontend/jobs/components
spec/frontend/lib/utils
spec/frontend/logs/components
spec/frontend/members/components/action_buttons
spec/frontend/members/components/filter_sort
spec/frontend/members/components/table
spec/frontend/milestones
spec/frontend/monitoring
spec/frontend/notes
spec/frontend/packages/details/components
spec/frontend/packages/details/store
spec/frontend/packages/list/stores
spec/frontend/packages/shared/components
spec/frontend/pages/projects/forks/new/components
spec/frontend/pages/projects/pipeline_schedules/shared/components
spec/frontend/pages/projects/shared/permissions/components
spec/frontend/pages/search/show
spec/frontend/pages/sessions/new
spec/frontend/pipeline_editor
spec/frontend/pipeline_editor/components/lint
spec/frontend/pipeline_new/components
spec/frontend/pipelines
spec/frontend/profile/account/components
spec/frontend/projects
spec/frontend/prometheus_metrics
spec/frontend/ref/components
spec/frontend/registry/explorer/components
spec/frontend/registry/settings
spec/frontend/related_merge_requests/components
spec/frontend/releases/components
spec/frontend/reports/codequality_report
spec/frontend/reports/components
spec/frontend/repository/components
spec/frontend/self_monitor/components
spec/frontend/serverless
spec/frontend/sidebar
spec/frontend/snippets/components
spec/frontend/vue_mr_widget
spec/frontend/vue_shared/components
spec/frontend/vue_shared/directives
spec/frontend_integration/ide/helpers
spec/frontend_integration/test_helpers/factories
spec/frontend_integration/test_helpers/utils
spec/javascripts
{
"printWidth": 100,
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "all"
}
......@@ -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 }"
......
......@@ -35,7 +35,7 @@ export default {
)
"
>
<template #docLink="{content}">
<template #docLink="{ content }">
<gl-link :href="docsLink" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -194,14 +194,20 @@ export default {
projectPath: this.projectPath,
},
})
.then(({ data: { createAlertIssue: { errors, issue } } }) => {
.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;
......
......@@ -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" />
......
......@@ -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();
}
}
......
......@@ -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>
......
......@@ -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]);
......
......@@ -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();
......
......@@ -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();
......
......@@ -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>
......
......@@ -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();
});
}
......
......@@ -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,
......
......@@ -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(
......
......@@ -212,11 +212,17 @@ export default {
listId,
},
})
.then(({ data: { destroyBoardList: { errors } } }) => {
.then(
({
data: {
destroyBoardList: { errors },
},
}) => {
if (errors.length > 0) {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
}
})
},
)
.catch(() => {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
});
......
......@@ -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));
});
}
......
......@@ -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>
......
......@@ -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"
......
......@@ -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 = {};
......
......@@ -461,7 +461,7 @@ export default {
)
"
>
<template #code="{content}">
<template #code="{ content }">
<code>{{ content }}</code>
</template>
<template #link="{ content }">
......
......@@ -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>
......
......@@ -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;
......
......@@ -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
......
......@@ -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');
},
});
......
......@@ -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);
},
......
......@@ -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
......
......@@ -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);
}
},
},
......
......@@ -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>
......
......@@ -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);
}
},
},
......
......@@ -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) {
......
......@@ -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>
......@@ -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
......
......@@ -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')) {
......
......@@ -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);
});
}
......
......@@ -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));
}
......
......@@ -32,12 +32,7 @@ export default {
},
},
methods: {
updateStoreAfterDelete(
store,
{
data: { designManagementDelete },
},
) {
updateStoreAfterDelete(store, { data: { designManagementDelete } }) {
updateStoreAfterDesignsDelete(
store,
designManagementDelete,
......
......@@ -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));
......
......@@ -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,
......
......@@ -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) {
......
......@@ -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();
}
......
......@@ -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));
......
......@@ -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 },
);
},
......
......@@ -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;
......
......@@ -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>
......
......@@ -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>
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -2,7 +2,7 @@
import { ACTIVE_CLASS } from './constants';
const Keyboard = function() {
const Keyboard = function () {
var currentKey;
var currentFocus;
var isUpArrow = false;
......
......@@ -46,7 +46,7 @@ const Ajax = {
.then(data => self._loadData(data, config, self))
.catch(config.onError);
},
destroy: function() {
destroy: function () {
this.destroyed = true;
},
};
......
......@@ -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('&');
......
/* 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;
......
......@@ -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) {
......
......@@ -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();
});
......
......@@ -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);
});
}
......
......@@ -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,
......
......@@ -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) {
......
......@@ -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 }}&nbsp;</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 }}&nbsp;</span>
</template>
<template #errorLine>
......
......@@ -30,7 +30,7 @@ export default {
},
computed: {
strategyComponent() {
return STRATEGIES[(this.strategy?.name)];
return STRATEGIES[this.strategy?.name];
},
},
methods: {
......
......@@ -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;
......
......@@ -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(),
......
......@@ -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);
......
......@@ -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 => {
......
......@@ -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');
});
}
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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),
),
);
}
......@@ -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'],
......
......@@ -37,7 +37,13 @@ const conf = {
blockComment: ['{{!--', '--}}'],
},
brackets: [['<!--', '-->'], ['<', '>'], ['{{', '}}'], ['{', '}'], ['(', ')']],
brackets: [
['<!--', '-->'],
['<', '>'],
['{{', '}}'],
['{', '}'],
['(', ')'],
],
autoClosingPairs: [
{ open: '{', close: '}' },
......
......@@ -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}}}`;
......
......@@ -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}`;
});
}
......
......@@ -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;
......
......@@ -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>
......
......@@ -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) {
......
......@@ -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'));
})
......
......@@ -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>
......
......@@ -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;
......
......@@ -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));
......
......@@ -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')"
......
......@@ -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,
);
},
},
};
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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();
}
......
......@@ -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);
......
......@@ -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,
......
......@@ -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>
......@@ -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');
......
......@@ -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);
......
......@@ -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');
}
......
......@@ -60,7 +60,13 @@ import { __ } from '~/locale';
const DataPromise = axios.get(this.file.content_path);
Promise.all([EditorPromise, DataPromise])
.then(([{ default: EditorLite }, { data: { content, new_path: path } }]) => {
.then(
([
{ default: EditorLite },
{
data: { content, new_path: path },
},
]) => {
const contentEl = this.$el.querySelector('.editor');
this.originalContent = content;
......@@ -71,8 +77,11 @@ import { __ } from '~/locale';
blobPath: path,
blobContent: content,
});
this.editor.onDidChangeModelContent(debounce(this.saveDiffResolution.bind(this), 250));
})
this.editor.onDidChangeModelContent(
debounce(this.saveDiffResolution.bind(this), 250),
);
},
)
.catch(() => {
flash(__('An error occurred while loading the file'));
});
......
......@@ -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');
}
......
......@@ -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');
......
......@@ -146,7 +146,7 @@ export default {
)
"
>
<template #code="{content}">
<template #code="{ content }">
<code>{{ content }}</code>
</template>
</gl-sprintf>
......
......@@ -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;
},
);
......
......@@ -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):
......
......@@ -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');
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment