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 ...@@ -9,3 +9,137 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.css *.css
*.scss *.scss
*.md *.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, "printWidth": 100,
"singleQuote": true, "singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "all" "trailingComma": "all"
} }
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
) )
" "
> >
<template #docLink="{content}"> <template #docLink="{ content }">
<gl-link :href="docsLink" target="_blank">{{ content }}</gl-link> <gl-link :href="docsLink" target="_blank">{{ content }}</gl-link>
</template> </template>
<template #strong="{ content }" <template #strong="{ content }"
......
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
) )
" "
> >
<template #docLink="{content}"> <template #docLink="{ content }">
<gl-link :href="docsLink" target="_blank">{{ content }}</gl-link> <gl-link :href="docsLink" target="_blank">{{ content }}</gl-link>
</template> </template>
</gl-sprintf> </gl-sprintf>
......
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import StatisticsPanelApp from './components/app.vue'; import StatisticsPanelApp from './components/app.vue';
import createStore from './store'; import createStore from './store';
export default function(el) { export default function (el) {
if (!el) { if (!el) {
return false; return false;
} }
......
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import AdminUsersApp from './components/app.vue'; 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) { if (!el) {
return false; return false;
} }
......
...@@ -194,14 +194,20 @@ export default { ...@@ -194,14 +194,20 @@ export default {
projectPath: this.projectPath, projectPath: this.projectPath,
}, },
}) })
.then(({ data: { createAlertIssue: { errors, issue } } }) => { .then(
if (errors?.length) { ({
[this.createIncidentError] = errors; data: {
this.incidentCreationInProgress = false; createAlertIssue: { errors, issue },
} else if (issue) { },
visitUrl(this.incidentPath(issue.iid)); }) => {
} if (errors?.length) {
}) [this.createIncidentError] = errors;
this.incidentCreationInProgress = false;
} else if (issue) {
visitUrl(this.incidentPath(issue.iid));
}
},
)
.catch(error => { .catch(error => {
this.createIncidentError = error; this.createIncidentError = error;
this.incidentCreationInProgress = false; this.incidentCreationInProgress = false;
......
...@@ -192,7 +192,7 @@ export default { ...@@ -192,7 +192,7 @@ export default {
</script> </script>
<template> <template>
<div class="block alert-assignees "> <div class="block alert-assignees">
<div ref="assignees" class="sidebar-collapsed-icon" @click="$emit('toggle-sidebar')"> <div ref="assignees" class="sidebar-collapsed-icon" @click="$emit('toggle-sidebar')">
<gl-icon name="user" :size="14" /> <gl-icon name="user" :size="14" />
<gl-loading-icon v-if="isUpdating" /> <gl-loading-icon v-if="isUpdating" />
......
...@@ -98,10 +98,7 @@ export class AwardsHandler { ...@@ -98,10 +98,7 @@ export class AwardsHandler {
showEmojiMenu($addBtn) { showEmojiMenu($addBtn) {
if ($addBtn.hasClass('js-note-emoji')) { if ($addBtn.hasClass('js-note-emoji')) {
$addBtn $addBtn.closest('.note').find('.js-awards-block').addClass('current');
.closest('.note')
.find('.js-awards-block')
.addClass('current');
} else { } else {
$addBtn.closest('.js-awards-block').addClass('current'); $addBtn.closest('.js-awards-block').addClass('current');
} }
...@@ -531,9 +528,7 @@ export class AwardsHandler { ...@@ -531,9 +528,7 @@ export class AwardsHandler {
const $search = $('.js-emoji-menu-search'); const $search = $('.js-emoji-menu-search');
this.registerEventListener('on', $search, 'input', e => { this.registerEventListener('on', $search, 'input', e => {
const term = $(e.target) const term = $(e.target).val().trim();
.val()
.trim();
this.searchEmojis(term); this.searchEmojis(term);
}); });
...@@ -556,17 +551,11 @@ export class AwardsHandler { ...@@ -556,17 +551,11 @@ export class AwardsHandler {
// Generate a search result block // Generate a search result block
const h5 = $('<h5 class="emoji-search-title"/>').text('Search results'); const h5 = $('<h5 class="emoji-search-title"/>').text('Search results');
const foundEmojis = this.findMatchingEmojiElements(term).show(); const foundEmojis = this.findMatchingEmojiElements(term).show();
const ul = $('<ul>') const ul = $('<ul>').addClass('emoji-menu-list emoji-menu-search').append(foundEmojis);
.addClass('emoji-menu-list emoji-menu-search')
.append(foundEmojis);
$('.emoji-menu-content ul, .emoji-menu-content h5').hide(); $('.emoji-menu-content ul, .emoji-menu-content h5').hide();
$('.emoji-menu-content') $('.emoji-menu-content').append(h5).append(ul);
.append(h5)
.append(ul);
} else { } else {
$('.emoji-menu-content') $('.emoji-menu-content').children().show();
.children()
.show();
} }
} }
......
...@@ -98,9 +98,7 @@ export default { ...@@ -98,9 +98,7 @@ export default {
{{ titleText }} {{ titleText }}
</span> </span>
<template v-if="showLinePosition"> <template v-if="showLinePosition">
<template v-if="!glFeatures.multilineComments" <template v-if="!glFeatures.multilineComments">:{{ linePosition }}</template>
>:{{ linePosition }}</template
>
<template v-else-if="startLineNumber === endLineNumber"> <template v-else-if="startLineNumber === endLineNumber">
:<span :class="getLineClasses(startLineNumber)">{{ startLineNumber }}</span> :<span :class="getLineClasses(startLineNumber)">{{ startLineNumber }}</span>
</template> </template>
......
...@@ -23,7 +23,7 @@ MarkdownPreview.prototype.emptyMessage = __('Nothing to preview.'); ...@@ -23,7 +23,7 @@ MarkdownPreview.prototype.emptyMessage = __('Nothing to preview.');
MarkdownPreview.prototype.ajaxCache = {}; MarkdownPreview.prototype.ajaxCache = {};
MarkdownPreview.prototype.showPreview = function($form) { MarkdownPreview.prototype.showPreview = function ($form) {
const preview = $form.find('.js-md-preview'); const preview = $form.find('.js-md-preview');
const url = preview.data('url'); const url = preview.data('url');
if (preview.hasClass('md-preview-loading')) { if (preview.hasClass('md-preview-loading')) {
...@@ -60,7 +60,7 @@ MarkdownPreview.prototype.showPreview = function($form) { ...@@ -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) { if (!url) {
return; return;
} }
...@@ -82,11 +82,11 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) { ...@@ -82,11 +82,11 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
.catch(() => flash(__('An error occurred while fetching markdown preview'))); .catch(() => flash(__('An error occurred while fetching markdown preview')));
}; };
MarkdownPreview.prototype.hideReferencedUsers = function($form) { MarkdownPreview.prototype.hideReferencedUsers = function ($form) {
$form.find('.referenced-users').hide(); $form.find('.referenced-users').hide();
}; };
MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) { MarkdownPreview.prototype.renderReferencedUsers = function (users, $form) {
const referencedUsers = $form.find('.referenced-users'); const referencedUsers = $form.find('.referenced-users');
if (referencedUsers.length) { if (referencedUsers.length) {
if (users.length >= this.referenceThreshold) { if (users.length >= this.referenceThreshold) {
...@@ -98,11 +98,11 @@ MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) { ...@@ -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(); $form.find('.referenced-commands').hide();
}; };
MarkdownPreview.prototype.renderReferencedCommands = function(commands, $form) { MarkdownPreview.prototype.renderReferencedCommands = function (commands, $form) {
const referencedCommands = $form.find('.referenced-commands'); const referencedCommands = $form.find('.referenced-commands');
if (commands.length > 0) { if (commands.length > 0) {
referencedCommands.html(commands); referencedCommands.html(commands);
...@@ -120,7 +120,7 @@ const writeButtonSelector = '.js-md-write-button'; ...@@ -120,7 +120,7 @@ const writeButtonSelector = '.js-md-write-button';
lastTextareaPreviewed = null; lastTextareaPreviewed = null;
const markdownToolbar = $('.md-header-toolbar'); const markdownToolbar = $('.md-header-toolbar');
$.fn.setupMarkdownPreview = function() { $.fn.setupMarkdownPreview = function () {
const $form = $(this); const $form = $(this);
$form.find('textarea.markdown-area').on('input', () => { $form.find('textarea.markdown-area').on('input', () => {
markdownPreview.hideReferencedUsers($form); markdownPreview.hideReferencedUsers($form);
...@@ -136,14 +136,8 @@ $(document).on('markdown-preview:show', (e, $form) => { ...@@ -136,14 +136,8 @@ $(document).on('markdown-preview:show', (e, $form) => {
lastTextareaHeight = lastTextareaPreviewed.height(); lastTextareaHeight = lastTextareaPreviewed.height();
// toggle tabs // toggle tabs
$form $form.find(writeButtonSelector).parent().removeClass('active');
.find(writeButtonSelector) $form.find(previewButtonSelector).parent().addClass('active');
.parent()
.removeClass('active');
$form
.find(previewButtonSelector)
.parent()
.addClass('active');
// toggle content // toggle content
$form.find('.md-write-holder').hide(); $form.find('.md-write-holder').hide();
...@@ -163,14 +157,8 @@ $(document).on('markdown-preview:hide', (e, $form) => { ...@@ -163,14 +157,8 @@ $(document).on('markdown-preview:hide', (e, $form) => {
} }
// toggle tabs // toggle tabs
$form $form.find(writeButtonSelector).parent().addClass('active');
.find(writeButtonSelector) $form.find(previewButtonSelector).parent().removeClass('active');
.parent()
.addClass('active');
$form
.find(previewButtonSelector)
.parent()
.removeClass('active');
// toggle content // toggle content
$form.find('.md-write-holder').show(); $form.find('.md-write-holder').show();
...@@ -194,13 +182,13 @@ $(document).on('markdown-preview:toggle', (e, keyboardEvent) => { ...@@ -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(); e.preventDefault();
const $form = $(this).closest('form'); const $form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:show', [$form]); $(document).triggerHandler('markdown-preview:show', [$form]);
}); });
$(document).on('click', writeButtonSelector, function(e) { $(document).on('click', writeButtonSelector, function (e) {
e.preventDefault(); e.preventDefault();
const $form = $(this).closest('form'); const $form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:hide', [$form]); $(document).triggerHandler('markdown-preview:hide', [$form]);
......
...@@ -98,9 +98,7 @@ export default class Shortcuts { ...@@ -98,9 +98,7 @@ export default class Shortcuts {
}); });
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
$('.js-shortcuts-modal-trigger') $('.js-shortcuts-modal-trigger').off('click').on('click', this.onToggleHelp);
.off('click')
.on('click', this.onToggleHelp);
if (shouldDisableShortcuts()) { if (shouldDisableShortcuts()) {
disableShortcuts(); disableShortcuts();
......
...@@ -43,16 +43,14 @@ export default class BlobFileDropzone { ...@@ -43,16 +43,14 @@ export default class BlobFileDropzone {
previewsContainer: '.dropzone-previews', previewsContainer: '.dropzone-previews',
headers: csrf.headers, headers: csrf.headers,
init() { init() {
this.on('processing', function() { this.on('processing', function () {
this.options.url = form.attr('action'); this.options.url = form.attr('action');
}); });
this.on('addedfile', () => { this.on('addedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false); toggleLoading(submitButton, submitButtonLoadingIcon, false);
dropzoneMessage.addClass(HIDDEN_CLASS); dropzoneMessage.addClass(HIDDEN_CLASS);
$('.dropzone-alerts') $('.dropzone-alerts').html('').hide();
.html('')
.hide();
}); });
this.on('removedfile', () => { this.on('removedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false); toggleLoading(submitButton, submitButtonLoadingIcon, false);
...@@ -62,7 +60,7 @@ export default class BlobFileDropzone { ...@@ -62,7 +60,7 @@ export default class BlobFileDropzone {
$('#modal-upload-blob').modal('hide'); $('#modal-upload-blob').modal('hide');
visitUrl(response.filePath); visitUrl(response.filePath);
}); });
this.on('maxfilesexceeded', function(file) { this.on('maxfilesexceeded', function (file) {
dropzoneMessage.addClass(HIDDEN_CLASS); dropzoneMessage.addClass(HIDDEN_CLASS);
this.removeFile(file); this.removeFile(file);
}); });
...@@ -74,9 +72,7 @@ export default class BlobFileDropzone { ...@@ -74,9 +72,7 @@ export default class BlobFileDropzone {
}, },
// Override behavior of adding error underneath preview // Override behavior of adding error underneath preview
error(file, errorMessage) { error(file, errorMessage) {
const stripped = $('<div/>') const stripped = $('<div/>').html(errorMessage).text();
.html(errorMessage)
.text();
$('.dropzone-alerts') $('.dropzone-alerts')
.html(sprintf(__('Error uploading file: %{stripped}'), { stripped })) .html(sprintf(__('Error uploading file: %{stripped}'), { stripped }))
.show(); .show();
......
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
</template> </template>
<p> <p>
<gl-sprintf :message="$options.i18n.bodyMessage"> <gl-sprintf :message="$options.i18n.bodyMessage">
<template #codeQualityLink="{content}"> <template #codeQualityLink="{ content }">
<gl-link :href="codeQualityLink" target="_blank" class="font-size-inherit">{{ <gl-link :href="codeQualityLink" target="_blank" class="font-size-inherit">{{
content content
}}</gl-link> }}</gl-link>
...@@ -106,12 +106,12 @@ export default { ...@@ -106,12 +106,12 @@ export default {
</gl-sprintf> </gl-sprintf>
</p> </p>
<gl-sprintf :message="$options.i18n.helpMessage"> <gl-sprintf :message="$options.i18n.helpMessage">
<template #beginnerLink="{content}"> <template #beginnerLink="{ content }">
<gl-link :href="$options.beginnerLink" target="_blank"> <gl-link :href="$options.beginnerLink" target="_blank">
{{ content }} {{ content }}
</gl-link> </gl-link>
</template> </template>
<template #exampleLink="{content}"> <template #exampleLink="{ content }">
<gl-link :href="exampleLink" target="_blank"> <gl-link :href="exampleLink" target="_blank">
{{ content }} {{ content }}
</gl-link> </gl-link>
......
...@@ -82,9 +82,7 @@ export default Vue.extend({ ...@@ -82,9 +82,7 @@ export default Vue.extend({
}); });
$('.js-issue-board-sidebar', this.$el).each((i, el) => { $('.js-issue-board-sidebar', this.$el).each((i, el) => {
$(el) $(el).data('deprecatedJQueryDropdown').clearMenu();
.data('deprecatedJQueryDropdown')
.clearMenu();
}); });
} }
......
...@@ -65,9 +65,7 @@ export default { ...@@ -65,9 +65,7 @@ export default {
this.loading = false; this.loading = false;
}; };
this.loadIssues() this.loadIssues().then(loadingDone).catch(loadingDone);
.then(loadingDone)
.catch(loadingDone);
} else if (!this.showAddIssuesModal) { } else if (!this.showAddIssuesModal) {
this.issues = []; this.issues = [];
this.selectedIssues = []; this.selectedIssues = [];
...@@ -83,9 +81,7 @@ export default { ...@@ -83,9 +81,7 @@ export default {
this.filterLoading = false; this.filterLoading = false;
}; };
this.loadIssues(true) this.loadIssues(true).then(loadingDone).catch(loadingDone);
.then(loadingDone)
.catch(loadingDone);
} }
}, },
deep: true, deep: true,
......
...@@ -40,7 +40,7 @@ $(document) ...@@ -40,7 +40,7 @@ $(document)
}); });
export default function initNewListDropdown() { export default function initNewListDropdown() {
$('.js-new-board-list').each(function() { $('.js-new-board-list').each(function () {
const $dropdownToggle = $(this); const $dropdownToggle = $(this);
const $dropdown = $dropdownToggle.closest('.dropdown'); const $dropdown = $dropdownToggle.closest('.dropdown');
new CreateLabelDropdown( new CreateLabelDropdown(
......
...@@ -212,11 +212,17 @@ export default { ...@@ -212,11 +212,17 @@ export default {
listId, listId,
}, },
}) })
.then(({ data: { destroyBoardList: { errors } } }) => { .then(
if (errors.length > 0) { ({
commit(types.REMOVE_LIST_FAILURE, listsBackup); data: {
} destroyBoardList: { errors },
}) },
}) => {
if (errors.length > 0) {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
}
},
)
.catch(() => { .catch(() => {
commit(types.REMOVE_LIST_FAILURE, listsBackup); commit(types.REMOVE_LIST_FAILURE, listsBackup);
}); });
......
...@@ -24,7 +24,7 @@ export default class BuildArtifacts { ...@@ -24,7 +24,7 @@ export default class BuildArtifacts {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
setupEntryClick() { 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)); visitUrl(this.dataset.link, parseBoolean(this.dataset.externalLink));
}); });
} }
......
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
<gl-form-checkbox v-model="dryRun" <gl-form-checkbox v-model="dryRun"
>{{ __('Simulate a pipeline created for the default branch') }} >{{ __('Simulate a pipeline created for the default branch') }}
<gl-link :href="pipelineSimulationHelpPagePath" target="_blank" <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> ></gl-form-checkbox>
</div> </div>
<gl-button data-testid="ci-lint-clear" @click="clear">{{ __('Clear') }}</gl-button> <gl-button data-testid="ci-lint-clear" @click="clear">{{ __('Clear') }}</gl-button>
......
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
class="triggers-list" class="triggers-list"
responsive responsive
> >
<template #cell(token)="{item}"> <template #cell(token)="{ item }">
{{ item.token }} {{ item.token }}
<clipboard-button <clipboard-button
v-if="item.hasTokenExposed" v-if="item.hasTokenExposed"
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
</gl-badge> </gl-badge>
</div> </div>
</template> </template>
<template #cell(description)="{item}"> <template #cell(description)="{ item }">
<tooltip-on-truncate <tooltip-on-truncate
:title="item.description" :title="item.description"
truncate-target="child" truncate-target="child"
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
<div class="gl-flex-fill-1 gl-text-truncate">{{ item.description }}</div> <div class="gl-flex-fill-1 gl-text-truncate">{{ item.description }}</div>
</tooltip-on-truncate> </tooltip-on-truncate>
</template> </template>
<template #cell(owner)="{item}"> <template #cell(owner)="{ item }">
<span class="trigger-owner sr-only">{{ item.owner.name }}</span> <span class="trigger-owner sr-only">{{ item.owner.name }}</span>
<user-avatar-link <user-avatar-link
v-if="item.owner" v-if="item.owner"
...@@ -102,11 +102,11 @@ export default { ...@@ -102,11 +102,11 @@ export default {
:img-alt="item.owner.name" :img-alt="item.owner.name"
/> />
</template> </template>
<template #cell(lastUsed)="{item}"> <template #cell(lastUsed)="{ item }">
<time-ago-tooltip v-if="item.lastUsed" :time="item.lastUsed" /> <time-ago-tooltip v-if="item.lastUsed" :time="item.lastUsed" />
<span v-else>{{ __('Never') }}</span> <span v-else>{{ __('Never') }}</span>
</template> </template>
<template #cell(actions)="{item}"> <template #cell(actions)="{ item }">
<gl-button <gl-button
:title="s__('Pipelines|Edit')" :title="s__('Pipelines|Edit')"
icon="pencil" icon="pencil"
......
...@@ -223,10 +223,7 @@ export default class VariableList { ...@@ -223,10 +223,7 @@ export default class VariableList {
getAllData() { getAllData() {
// Ignore the last empty row because we don't want to try persist // Ignore the last empty row because we don't want to try persist
// a blank variable and run into validation problems. // a blank variable and run into validation problems.
const validRows = this.$container const validRows = this.$container.find('.js-row').toArray().slice(0, -1);
.find('.js-row')
.toArray()
.slice(0, -1);
return validRows.map(rowEl => { return validRows.map(rowEl => {
const resultant = {}; const resultant = {};
......
...@@ -461,7 +461,7 @@ export default { ...@@ -461,7 +461,7 @@ export default {
) )
" "
> >
<template #code="{content}"> <template #code="{ content }">
<code>{{ content }}</code> <code>{{ content }}</code>
</template> </template>
<template #link="{ content }"> <template #link="{ content }">
......
...@@ -254,9 +254,7 @@ export default { ...@@ -254,9 +254,7 @@ export default {
<template #freeSpacePercentage>{{ <template #freeSpacePercentage>{{
totalCpuAndUsage(item.nodes).freeSpacePercentage totalCpuAndUsage(item.nodes).freeSpacePercentage
}}</template> }}</template>
<template #percentSymbol <template #percentSymbol>%</template>
>%</template
>
</gl-sprintf> </gl-sprintf>
</span> </span>
...@@ -277,9 +275,7 @@ export default { ...@@ -277,9 +275,7 @@ export default {
<template #freeSpacePercentage>{{ <template #freeSpacePercentage>{{
totalMemoryAndUsage(item.nodes).freeSpacePercentage totalMemoryAndUsage(item.nodes).freeSpacePercentage
}}</template> }}</template>
<template #percentSymbol <template #percentSymbol>%</template>
>%</template
>
</gl-sprintf> </gl-sprintf>
</span> </span>
...@@ -293,7 +289,7 @@ export default { ...@@ -293,7 +289,7 @@ export default {
/> />
</template> </template>
<template #cell(cluster_type)="{value}"> <template #cell(cluster_type)="{ value }">
<gl-badge variant="muted"> <gl-badge variant="muted">
{{ value }} {{ value }}
</gl-badge> </gl-badge>
......
...@@ -56,15 +56,15 @@ export default class ImageFile { ...@@ -56,15 +56,15 @@ export default class ImageFile {
let dragging = false; let dragging = false;
const $body = $('body'); const $body = $('body');
const $offsetEl = $el.parent(); const $offsetEl = $el.parent();
const dragStart = function() { const dragStart = function () {
dragging = true; dragging = true;
$body.css('user-select', 'none'); $body.css('user-select', 'none');
}; };
const dragStop = function() { const dragStop = function () {
dragging = false; dragging = false;
$body.css('user-select', ''); $body.css('user-select', '');
}; };
const dragMove = function(e) { const dragMove = function (e) {
const moveX = e.pageX || e.touches[0].pageX; const moveX = e.pageX || e.touches[0].pageX;
const left = moveX - ($offsetEl.offset().left + padding); const left = moveX - ($offsetEl.offset().left + padding);
if (!dragging) return; if (!dragging) return;
...@@ -73,11 +73,7 @@ export default class ImageFile { ...@@ -73,11 +73,7 @@ export default class ImageFile {
}; };
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
$el $el.off('mousedown').off('touchstart').on('mousedown', dragStart).on('touchstart', dragStart);
.off('mousedown')
.off('touchstart')
.on('mousedown', dragStart)
.on('touchstart', dragStart);
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
$body $body
...@@ -109,9 +105,9 @@ export default class ImageFile { ...@@ -109,9 +105,9 @@ export default class ImageFile {
} }
views = { views = {
'two-up': function() { 'two-up': function () {
return $('.two-up.view .wrap', this.file).each((index, wrap) => { return $('.two-up.view .wrap', this.file).each((index, wrap) => {
$('img', wrap).each(function() { $('img', wrap).each(function () {
const currentWidth = $(this).width(); const currentWidth = $(this).width();
if (currentWidth > availWidth / 2) { if (currentWidth > availWidth / 2) {
return $(this).width(availWidth / 2); return $(this).width(availWidth / 2);
...@@ -157,7 +153,7 @@ export default class ImageFile { ...@@ -157,7 +153,7 @@ export default class ImageFile {
}); });
}); });
}, },
'onion-skin': function() { 'onion-skin': function () {
let maxHeight, maxWidth; let maxHeight, maxWidth;
maxWidth = 0; maxWidth = 0;
maxHeight = 0; maxHeight = 0;
......
...@@ -85,10 +85,7 @@ export default class CommitsList { ...@@ -85,10 +85,7 @@ export default class CommitsList {
// Update commits count in the previous commits header. // Update commits count in the previous commits header.
commitsCount += Number( commitsCount += Number(
$(processedData) $(processedData).nextUntil('li.js-commit-header').first().find('li.commit').length,
.nextUntil('li.js-commit-header')
.first()
.find('li.commit').length,
); );
$commitsHeadersLast $commitsHeadersLast
......
...@@ -13,14 +13,10 @@ import 'bootstrap/js/dist/tab'; ...@@ -13,14 +13,10 @@ import 'bootstrap/js/dist/tab';
// custom jQuery functions // custom jQuery functions
$.fn.extend({ $.fn.extend({
disable() { disable() {
return $(this) return $(this).prop('disabled', true).addClass('disabled');
.prop('disabled', true)
.addClass('disabled');
}, },
enable() { enable() {
return $(this) return $(this).prop('disabled', false).removeClass('disabled');
.prop('disabled', false)
.removeClass('disabled');
}, },
}); });
......
...@@ -9,7 +9,7 @@ import { fixTitle } from '~/tooltips'; ...@@ -9,7 +9,7 @@ import { fixTitle } from '~/tooltips';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown'; import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
export default function initCompareAutocomplete(limitTo = null, clickHandler = () => {}) { export default function initCompareAutocomplete(limitTo = null, clickHandler = () => {}) {
$('.js-compare-dropdown').each(function() { $('.js-compare-dropdown').each(function () {
const $dropdown = $(this); const $dropdown = $(this);
const selected = $dropdown.data('selected'); const selected = $dropdown.data('selected');
const $dropdownContainer = $dropdown.closest('.dropdown'); const $dropdownContainer = $dropdown.closest('.dropdown');
...@@ -51,9 +51,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( ...@@ -51,9 +51,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
.text(ref) .text(ref)
.attr('data-ref', ref); .attr('data-ref', ref);
if (ref.header != null) { if (ref.header != null) {
return $('<li />') return $('<li />').addClass('dropdown-header').text(ref.header);
.addClass('dropdown-header')
.text(ref.header);
} }
return $('<li />').append(link); return $('<li />').append(link);
}, },
......
...@@ -43,7 +43,10 @@ export default class ContextualSidebar { ...@@ -43,7 +43,10 @@ export default class ContextualSidebar {
$(document).trigger('content.resize'); $(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 // See documentation: https://design.gitlab.com/regions/navigation#contextual-navigation
......
...@@ -57,9 +57,7 @@ export default { ...@@ -57,9 +57,7 @@ export default {
if (this.hasZone) { if (this.hasZone) {
this.isLoading = true; this.isLoading = true;
this.fetchMachineTypes() this.fetchMachineTypes().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
} }
}, },
}, },
......
...@@ -99,9 +99,7 @@ export default { ...@@ -99,9 +99,7 @@ export default {
created() { created() {
this.isLoading = true; this.isLoading = true;
this.fetchProjects() this.fetchProjects().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
}, },
methods: { methods: {
...mapActions(['fetchProjects', 'setIsValidatingProjectBilling', 'validateProjectBilling']), ...mapActions(['fetchProjects', 'setIsValidatingProjectBilling', 'validateProjectBilling']),
...@@ -175,9 +173,7 @@ export default { ...@@ -175,9 +173,7 @@ export default {
<gl-sprintf :message="helpText"> <gl-sprintf :message="helpText">
<template #linkToBilling="{ content }"> <template #linkToBilling="{ content }">
<gl-link <gl-link
:href=" :href="'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral'"
'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral'
"
target="_blank" target="_blank"
>{{ content }} <gl-icon name="external-link" >{{ content }} <gl-icon name="external-link"
/></gl-link> /></gl-link>
......
...@@ -46,9 +46,7 @@ export default { ...@@ -46,9 +46,7 @@ export default {
if (!isValidating && this.projectHasBillingEnabled) { if (!isValidating && this.projectHasBillingEnabled) {
this.isLoading = true; this.isLoading = true;
this.fetchZones() this.fetchZones().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
} }
}, },
}, },
......
...@@ -46,7 +46,7 @@ export default class CreateLabelDropdown { ...@@ -46,7 +46,7 @@ export default class CreateLabelDropdown {
addBinding() { addBinding() {
const self = this; const self = this;
this.$colorSuggestions.on('click', function(e) { this.$colorSuggestions.on('click', function (e) {
const $this = $(this); const $this = $(this);
self.addColorValue(e, $this); self.addColorValue(e, $this);
}); });
...@@ -72,10 +72,7 @@ export default class CreateLabelDropdown { ...@@ -72,10 +72,7 @@ export default class CreateLabelDropdown {
e.stopPropagation(); e.stopPropagation();
this.$newColorField.val($this.data('color')).trigger('change'); this.$newColorField.val($this.data('color')).trigger('change');
this.$colorPreview this.$colorPreview.css('background-color', $this.data('color')).parent().addClass('is-active');
.css('background-color', $this.data('color'))
.parent()
.addClass('is-active');
} }
enableLabelCreateButton() { enableLabelCreateButton() {
...@@ -94,10 +91,7 @@ export default class CreateLabelDropdown { ...@@ -94,10 +91,7 @@ export default class CreateLabelDropdown {
this.$addList.prop('checked', this.addListDefault); this.$addList.prop('checked', this.addListDefault);
this.$colorPreview this.$colorPreview.css('background-color', '').parent().removeClass('is-active');
.css('background-color', '')
.parent()
.removeClass('is-active');
} }
saveLabel(e) { saveLabel(e) {
......
...@@ -30,8 +30,6 @@ export default { ...@@ -30,8 +30,6 @@ export default {
{{ time.seconds }} <span> {{ s__('Time|s') }} </span> {{ time.seconds }} <span> {{ s__('Time|s') }} </span>
</template> </template>
</template> </template>
<template v-else> <template v-else> -- </template>
--
</template>
</span> </span>
</template> </template>
...@@ -123,10 +123,7 @@ export class GitLabDropdown { ...@@ -123,10 +123,7 @@ export class GitLabDropdown {
if ($(this.el).is('input')) { if ($(this.el).is('input')) {
currentIndex = -1; currentIndex = -1;
} else { } else {
$(selector, this.dropdown) $(selector, this.dropdown).first().find('a').addClass('is-focused');
.first()
.find('a')
.addClass('is-focused');
currentIndex = 0; currentIndex = 0;
} }
} }
...@@ -493,10 +490,7 @@ export class GitLabDropdown { ...@@ -493,10 +490,7 @@ export class GitLabDropdown {
if (!this.options.multiSelect || el.hasClass('dropdown-clear-active')) { if (!this.options.multiSelect || el.hasClass('dropdown-clear-active')) {
this.dropdown.find(`.${ACTIVE_CLASS}`).removeClass(ACTIVE_CLASS); this.dropdown.find(`.${ACTIVE_CLASS}`).removeClass(ACTIVE_CLASS);
if (!isInput) { if (!isInput) {
this.dropdown this.dropdown.parent().find(`input[name='${fieldName}']`).remove();
.parent()
.find(`input[name='${fieldName}']`)
.remove();
} }
} }
if (field && field.length && value == null) { if (field && field.length && value == null) {
...@@ -536,10 +530,7 @@ export class GitLabDropdown { ...@@ -536,10 +530,7 @@ export class GitLabDropdown {
$(`input[name="${fieldName}"]`).remove(); $(`input[name="${fieldName}"]`).remove();
} }
const $input = $('<input>') const $input = $('<input>').attr('type', 'hidden').attr('name', fieldName).val(value);
.attr('type', 'hidden')
.attr('name', fieldName)
.val(value);
if (this.options.inputId != null) { if (this.options.inputId != null) {
$input.attr('id', this.options.inputId); $input.attr('id', this.options.inputId);
} }
...@@ -678,9 +669,7 @@ export class GitLabDropdown { ...@@ -678,9 +669,7 @@ export class GitLabDropdown {
toggleText = this.options.updateLabel; toggleText = this.options.updateLabel;
} }
return $(this.el) return $(this.el).find('.dropdown-toggle-text').text(toggleText);
.find('.dropdown-toggle-text')
.text(toggleText);
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
......
...@@ -22,10 +22,7 @@ export class GitLabDropdownFilter { ...@@ -22,10 +22,7 @@ export class GitLabDropdownFilter {
// Clear click // Clear click
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return this.input return this.input.val('').trigger('input').focus();
.val('')
.trigger('input')
.focus();
}); });
// Key events // Key events
timeout = ''; timeout = '';
...@@ -113,7 +110,7 @@ export class GitLabDropdownFilter { ...@@ -113,7 +110,7 @@ export class GitLabDropdownFilter {
const elements = this.options.elements(); const elements = this.options.elements();
if (searchText) { if (searchText) {
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
elements.each(function() { elements.each(function () {
const $el = $(this); const $el = $(this);
const matches = fuzzaldrinPlus.match($el.text().trim(), searchText); const matches = fuzzaldrinPlus.match($el.text().trim(), searchText);
if (!$el.is('.dropdown-header')) { if (!$el.is('.dropdown-header')) {
......
...@@ -9,10 +9,7 @@ export class GitLabDropdownInput { ...@@ -9,10 +9,7 @@ export class GitLabDropdownInput {
// Clear click // Clear click
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return this.input return this.input.val('').trigger('input').focus();
.val('')
.trigger('input')
.focus();
}); });
this.input this.input
...@@ -31,10 +28,7 @@ export class GitLabDropdownInput { ...@@ -31,10 +28,7 @@ export class GitLabDropdownInput {
.toLowerCase() // replace non alphanumeric .toLowerCase() // replace non alphanumeric
.replace(/(-)\1+/g, '-'); // replace repeated dashes .replace(/(-)\1+/g, '-'); // replace repeated dashes
this.cb(this.options.fieldName, val, {}, true); this.cb(this.options.fieldName, val, {}, true);
this.input this.input.closest('.dropdown').find('.dropdown-toggle-text').text(val);
.closest('.dropdown')
.find('.dropdown-toggle-text')
.text(val);
}); });
} }
......
...@@ -3,7 +3,7 @@ import { GitLabDropdown } from './gl_dropdown'; ...@@ -3,7 +3,7 @@ import { GitLabDropdown } from './gl_dropdown';
export default function initDeprecatedJQueryDropdown($el, opts) { export default function initDeprecatedJQueryDropdown($el, opts) {
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
return $el.each(function() { return $el.each(function () {
if (!$.data(this, 'deprecatedJQueryDropdown')) { if (!$.data(this, 'deprecatedJQueryDropdown')) {
$.data(this, 'deprecatedJQueryDropdown', new GitLabDropdown(this, opts)); $.data(this, 'deprecatedJQueryDropdown', new GitLabDropdown(this, opts));
} }
......
...@@ -32,12 +32,7 @@ export default { ...@@ -32,12 +32,7 @@ export default {
}, },
}, },
methods: { methods: {
updateStoreAfterDelete( updateStoreAfterDelete(store, { data: { designManagementDelete } }) {
store,
{
data: { designManagementDelete },
},
) {
updateStoreAfterDesignsDelete( updateStoreAfterDesignsDelete(
store, store,
designManagementDelete, designManagementDelete,
......
...@@ -116,12 +116,7 @@ export default { ...@@ -116,12 +116,7 @@ export default {
variables: { variables: {
id, id,
}, },
update( update(store, { data: { todoMarkDone } }) {
store,
{
data: { todoMarkDone },
},
) {
const todoMarkDoneFirstError = (todoMarkDone.errors || [])[0]; const todoMarkDoneFirstError = (todoMarkDone.errors || [])[0];
if (todoMarkDoneFirstError) { if (todoMarkDoneFirstError) {
this.$emit('error', Error(todoMarkDoneFirstError)); this.$emit('error', Error(todoMarkDoneFirstError));
......
...@@ -167,12 +167,7 @@ export default { ...@@ -167,12 +167,7 @@ export default {
next(); next();
}, },
methods: { methods: {
addImageDiffNoteToStore( addImageDiffNoteToStore(store, { data: { createImageDiffNote } }) {
store,
{
data: { createImageDiffNote },
},
) {
updateStoreAfterAddImageDiffNote( updateStoreAfterAddImageDiffNote(
store, store,
createImageDiffNote, createImageDiffNote,
...@@ -180,12 +175,7 @@ export default { ...@@ -180,12 +175,7 @@ export default {
this.designVariables, this.designVariables,
); );
}, },
updateImageDiffNoteInStore( updateImageDiffNoteInStore(store, { data: { repositionImageDiffNote } }) {
store,
{
data: { repositionImageDiffNote },
},
) {
return updateStoreAfterRepositionImageDiffNote( return updateStoreAfterRepositionImageDiffNote(
store, store,
repositionImageDiffNote, repositionImageDiffNote,
......
...@@ -187,12 +187,7 @@ export default { ...@@ -187,12 +187,7 @@ export default {
.then(res => this.onUploadDesignDone(res)) .then(res => this.onUploadDesignDone(res))
.catch(() => this.onUploadDesignError()); .catch(() => this.onUploadDesignError());
}, },
afterUploadDesign( afterUploadDesign(store, { data: { designManagementUpload } }) {
store,
{
data: { designManagementUpload },
},
) {
updateStoreAfterUploadDesign(store, designManagementUpload, this.projectQueryBody); updateStoreAfterUploadDesign(store, designManagementUpload, this.projectQueryBody);
}, },
onUploadDesignDone(res) { onUploadDesignDone(res) {
......
...@@ -13,13 +13,7 @@ export default [ ...@@ -13,13 +13,7 @@ export default [
name: DESIGN_ROUTE_NAME, name: DESIGN_ROUTE_NAME,
path: '/designs/:id', path: '/designs/:id',
component: DesignDetail, component: DesignDetail,
beforeEnter( beforeEnter({ params: { id } }, _, next) {
{
params: { id },
},
_,
next,
) {
if (typeof id === 'string') { if (typeof id === 'string') {
next(); next();
} }
......
...@@ -24,9 +24,7 @@ export default class Diff { ...@@ -24,9 +24,7 @@ export default class Diff {
if (!tab || (tab && tab.dataset && tab.dataset.isLocked !== '')) if (!tab || (tab && tab.dataset && tab.dataset.isLocked !== ''))
FilesCommentButton.init($diffFile); FilesCommentButton.init($diffFile);
const firstFile = $('.files') const firstFile = $('.files').first().get(0);
.first()
.get(0);
const canCreateNote = firstFile && firstFile.hasAttribute('data-can-create-note'); const canCreateNote = firstFile && firstFile.hasAttribute('data-can-create-note');
$diffFile.each((index, file) => initImageDiffHelper.initImageDiff(file, canCreateNote)); $diffFile.each((index, file) => initImageDiffHelper.initImageDiff(file, canCreateNote));
......
...@@ -281,12 +281,7 @@ export default { ...@@ -281,12 +281,7 @@ export default {
const id = window?.location?.hash; const id = window?.location?.hash;
if (id && id.indexOf('#note') !== 0) { if (id && id.indexOf('#note') !== 0) {
this.setHighlightedRow( this.setHighlightedRow(id.split('diff-content').pop().slice(1));
id
.split('diff-content')
.pop()
.slice(1),
);
} }
}, },
beforeCreate() { beforeCreate() {
...@@ -404,10 +399,7 @@ export default { ...@@ -404,10 +399,7 @@ export default {
}, },
setDiscussions() { setDiscussions() {
requestIdleCallback( requestIdleCallback(
() => () => this.assignDiscussionsToDiff().then(this.$nextTick).then(this.startTaskList),
this.assignDiscussionsToDiff()
.then(this.$nextTick)
.then(this.startTaskList),
{ timeout: 1000 }, { timeout: 1000 },
); );
}, },
......
...@@ -139,7 +139,7 @@ export default { ...@@ -139,7 +139,7 @@ export default {
return !this.isCollapsed || this.automaticallyCollapsed; return !this.isCollapsed || this.automaticallyCollapsed;
}, },
showWarning() { showWarning() {
return this.isCollapsed && (this.automaticallyCollapsed && !this.viewDiffsFileByFile); return this.isCollapsed && this.automaticallyCollapsed && !this.viewDiffsFileByFile;
}, },
showContent() { showContent() {
return !this.isCollapsed && !this.isFileTooLarge; return !this.isCollapsed && !this.isFileTooLarge;
......
...@@ -58,9 +58,9 @@ export default { ...@@ -58,9 +58,9 @@ export default {
class="code diff-wrap-lines js-syntax-highlight text-file js-diff-inline-view" class="code diff-wrap-lines js-syntax-highlight text-file js-diff-inline-view"
> >
<colgroup> <colgroup>
<col style="width: 50px;" /> <col style="width: 50px" />
<col style="width: 50px;" /> <col style="width: 50px" />
<col style="width: 8px;" /> <col style="width: 8px" />
<col /> <col />
</colgroup> </colgroup>
<tbody> <tbody>
......
...@@ -57,11 +57,11 @@ export default { ...@@ -57,11 +57,11 @@ export default {
class="code diff-wrap-lines js-syntax-highlight text-file" class="code diff-wrap-lines js-syntax-highlight text-file"
> >
<colgroup> <colgroup>
<col style="width: 50px;" /> <col style="width: 50px" />
<col style="width: 8px;" /> <col style="width: 8px" />
<col /> <col />
<col style="width: 50px;" /> <col style="width: 50px" />
<col style="width: 8px;" /> <col style="width: 8px" />
<col /> <col />
</colgroup> </colgroup>
<tbody> <tbody>
......
...@@ -307,7 +307,8 @@ export const startRenderDiffsQueue = ({ state, commit }) => { ...@@ -307,7 +307,8 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
const nextFile = state.diffFiles.find( const nextFile = state.diffFiles.find(
file => file =>
!file.renderIt && !file.renderIt &&
(file.viewer && (!isCollapsed(file) || file.viewer.name !== diffViewerModes.text)), file.viewer &&
(!isCollapsed(file) || file.viewer.name !== diffViewerModes.text),
); );
if (nextFile) { if (nextFile) {
......
...@@ -138,7 +138,10 @@ export const fileLineCoverage = state => (file, line) => { ...@@ -138,7 +138,10 @@ export const fileLineCoverage = state => (file, line) => {
* @returns {number} * @returns {number}
*/ */
export const currentDiffIndex = state => 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) => { export const diffLines = state => (file, unifiedDiffComponents) => {
if (!unifiedDiffComponents && state.diffViewType === INLINE_DIFF_VIEW_TYPE) { if (!unifiedDiffComponents && state.diffViewType === INLINE_DIFF_VIEW_TYPE) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { ACTIVE_CLASS } from './constants'; import { ACTIVE_CLASS } from './constants';
const Keyboard = function() { const Keyboard = function () {
var currentKey; var currentKey;
var currentFocus; var currentFocus;
var isUpArrow = false; var isUpArrow = false;
......
...@@ -46,7 +46,7 @@ const Ajax = { ...@@ -46,7 +46,7 @@ const Ajax = {
.then(data => self._loadData(data, config, self)) .then(data => self._loadData(data, config, self))
.catch(config.onError); .catch(config.onError);
}, },
destroy: function() { destroy: function () {
this.destroyed = true; this.destroyed = true;
}, },
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import AjaxCache from '../../lib/utils/ajax_cache'; import AjaxCache from '../../lib/utils/ajax_cache';
const AjaxFilter = { const AjaxFilter = {
init: function(hook) { init: function (hook) {
this.destroyed = false; this.destroyed = false;
this.hook = hook; this.hook = hook;
this.notLoading(); this.notLoading();
...@@ -93,9 +93,9 @@ const AjaxFilter = { ...@@ -93,9 +93,9 @@ const AjaxFilter = {
list.currentIndex = 0; list.currentIndex = 0;
}, },
buildParams: function(params) { buildParams: function (params) {
if (!params) return ''; if (!params) return '';
var paramsArray = Object.keys(params).map(function(param) { var paramsArray = Object.keys(params).map(function (param) {
return param + '=' + (params[param] || ''); return param + '=' + (params[param] || '');
}); });
return '?' + paramsArray.join('&'); return '?' + paramsArray.join('&');
......
/* eslint-disable */ /* eslint-disable */
const Filter = { const Filter = {
keydown: function(e) { keydown: function (e) {
if (this.destroyed) return; if (this.destroyed) return;
var hiddenCount = 0; var hiddenCount = 0;
...@@ -21,22 +21,22 @@ const Filter = { ...@@ -21,22 +21,22 @@ const Filter = {
if (config && config.filterFunction && typeof config.filterFunction === 'function') { if (config && config.filterFunction && typeof config.filterFunction === 'function') {
filterFunction = config.filterFunction; filterFunction = config.filterFunction;
} else { } else {
filterFunction = function(o) { filterFunction = function (o) {
// cheap string search // cheap string search
o.droplab_hidden = o[config.template].toLowerCase().indexOf(value) === -1; o.droplab_hidden = o[config.template].toLowerCase().indexOf(value) === -1;
return o; return o;
}; };
} }
dataHiddenCount = data.filter(function(o) { dataHiddenCount = data.filter(function (o) {
return !o.droplab_hidden; return !o.droplab_hidden;
}).length; }).length;
matches = data.map(function(o) { matches = data.map(function (o) {
return filterFunction(o, value); return filterFunction(o, value);
}); });
hiddenCount = matches.filter(function(o) { hiddenCount = matches.filter(function (o) {
return !o.droplab_hidden; return !o.droplab_hidden;
}).length; }).length;
......
...@@ -5,12 +5,7 @@ import { DATA_TRIGGER, DATA_DROPDOWN, TEMPLATE_REGEX } from './constants'; ...@@ -5,12 +5,7 @@ import { DATA_TRIGGER, DATA_DROPDOWN, TEMPLATE_REGEX } from './constants';
const utils = { const utils = {
toCamelCase(attr) { toCamelCase(attr) {
return this.camelize( return this.camelize(attr.split('-').slice(1).join(' '));
attr
.split('-')
.slice(1)
.join(' '),
);
}, },
template(templateString, data) { template(templateString, data) {
......
...@@ -219,12 +219,8 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { ...@@ -219,12 +219,8 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
const caretStart = textarea.selectionStart; const caretStart = textarea.selectionStart;
const caretEnd = textarea.selectionEnd; const caretEnd = textarea.selectionEnd;
const textEnd = $(child).val().length; const textEnd = $(child).val().length;
const beforeSelection = $(child) const beforeSelection = $(child).val().substring(0, caretStart);
.val() const afterSelection = $(child).val().substring(caretEnd, textEnd);
.substring(0, caretStart);
const afterSelection = $(child)
.val()
.substring(caretEnd, textEnd);
$(child).val(beforeSelection + formattedText + afterSelection); $(child).val(beforeSelection + formattedText + afterSelection);
textarea.setSelectionRange(caretStart + formattedText.length, caretEnd + formattedText.length); textarea.setSelectionRange(caretStart + formattedText.length, caretEnd + formattedText.length);
textarea.style.height = `${textarea.scrollHeight}px`; textarea.style.height = `${textarea.scrollHeight}px`;
...@@ -289,10 +285,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { ...@@ -289,10 +285,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
form.find('.markdown-selector').click(function onMarkdownClick(e) { form.find('.markdown-selector').click(function onMarkdownClick(e) {
e.preventDefault(); e.preventDefault();
$(this) $(this).closest('.gfm-form').find('.div-dropzone').click();
.closest('.gfm-form')
.find('.div-dropzone')
.click();
formTextarea.focus(); formTextarea.focus();
}); });
......
...@@ -197,9 +197,7 @@ export default class DueDateSelectors { ...@@ -197,9 +197,7 @@ export default class DueDateSelectors {
$('.js-clear-due-date,.js-clear-start-date').on('click', e => { $('.js-clear-due-date,.js-clear-start-date').on('click', e => {
e.preventDefault(); e.preventDefault();
const calendar = $(e.target) const calendar = $(e.target).siblings('.datepicker').data('pikaday');
.siblings('.datepicker')
.data('pikaday');
calendar.setDate(null); calendar.setDate(null);
}); });
} }
......
...@@ -22,9 +22,7 @@ export class CiSchemaExtension extends EditorLiteExtension { ...@@ -22,9 +22,7 @@ export class CiSchemaExtension extends EditorLiteExtension {
.replace(':project_path', projectPath) .replace(':project_path', projectPath)
.replace(':ref', ref) .replace(':ref', ref)
.replace(':filename', EXTENSION_CI_SCHEMA_FILE_NAME_MATCH); .replace(':filename', EXTENSION_CI_SCHEMA_FILE_NAME_MATCH);
const modelFileName = this.getModel() const modelFileName = this.getModel().uri.path.split('/').pop();
.uri.path.split('/')
.pop();
registerSchema({ registerSchema({
uri: ciSchemaUri, uri: ciSchemaUri,
......
...@@ -242,8 +242,9 @@ export function getEmojiInfo(query) { ...@@ -242,8 +242,9 @@ export function getEmojiInfo(query) {
export function emojiFallbackImageSrc(inputName) { export function emojiFallbackImageSrc(inputName) {
const { name } = getEmojiInfo(inputName); const { name } = getEmojiInfo(inputName);
return `${gon.asset_host || ''}${gon.relative_url_root || return `${gon.asset_host || ''}${
''}/-/emojis/${EMOJI_VERSION}/${name}.png`; gon.relative_url_root || ''
}/-/emojis/${EMOJI_VERSION}/${name}.png`;
} }
export function emojiImageTag(name, src) { export function emojiImageTag(name, src) {
......
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
/> />
<gl-sprintf v-if="errorFn" :message="__('%{spanStart}in%{spanEnd} %{errorFn}')"> <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> <span class="gl-text-gray-200">{{ content }}&nbsp;</span>
</template> </template>
<template #errorFn> <template #errorFn>
...@@ -109,7 +109,7 @@ export default { ...@@ -109,7 +109,7 @@ export default {
</gl-sprintf> </gl-sprintf>
<gl-sprintf :message="__('%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}')"> <gl-sprintf :message="__('%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}')">
<template #span="{content}"> <template #span="{ content }">
<span class="gl-text-gray-200">{{ content }}&nbsp;</span> <span class="gl-text-gray-200">{{ content }}&nbsp;</span>
</template> </template>
<template #errorLine> <template #errorLine>
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
}, },
computed: { computed: {
strategyComponent() { strategyComponent() {
return STRATEGIES[(this.strategy?.name)]; return STRATEGIES[this.strategy?.name];
}, },
}, },
methods: { methods: {
......
...@@ -74,12 +74,7 @@ export default { ...@@ -74,12 +74,7 @@ export default {
state.isRotating = true; state.isRotating = true;
state.hasRotateError = false; state.hasRotateError = false;
}, },
[types.RECEIVE_ROTATE_INSTANCE_ID_SUCCESS]( [types.RECEIVE_ROTATE_INSTANCE_ID_SUCCESS](state, { data: { token } }) {
state,
{
data: { token },
},
) {
state.isRotating = false; state.isRotating = false;
state.instanceId = token; state.instanceId = token;
state.hasRotateError = false; state.hasRotateError = false;
......
...@@ -200,8 +200,9 @@ export default class AvailableDropdownMappings { ...@@ -200,8 +200,9 @@ export default class AvailableDropdownMappings {
} }
getMergeRequestTargetBranchesEndpoint() { getMergeRequestTargetBranchesEndpoint() {
const endpoint = `${gon.relative_url_root || const endpoint = `${
''}/autocomplete/merge_request_target_branches.json`; gon.relative_url_root || ''
}/autocomplete/merge_request_target_branches.json`;
const params = { const params = {
group_id: this.getGroupId(), group_id: this.getGroupId(),
......
...@@ -193,7 +193,8 @@ export default class FilteredSearchVisualTokens { ...@@ -193,7 +193,8 @@ export default class FilteredSearchVisualTokens {
}); });
} else if ( } else if (
!isLastVisualTokenValid && !isLastVisualTokenValid &&
(lastVisualToken && !lastVisualToken.querySelector('.operator')) lastVisualToken &&
!lastVisualToken.querySelector('.operator')
) { ) {
const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container'); const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container');
tokensContainer.removeChild(lastVisualToken); tokensContainer.removeChild(lastVisualToken);
......
...@@ -285,10 +285,7 @@ class GfmAutoComplete { ...@@ -285,10 +285,7 @@ class GfmAutoComplete {
...this.getDefaultCallbacks(), ...this.getDefaultCallbacks(),
beforeSave: membersBeforeSave, beforeSave: membersBeforeSave,
matcher(flag, subtext) { matcher(flag, subtext) {
const subtextNodes = subtext const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
.split(/\n+/g)
.pop()
.split(GfmAutoComplete.regexSubtext);
// Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands. // Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands.
command = subtextNodes.find(node => { command = subtextNodes.find(node => {
...@@ -465,10 +462,7 @@ class GfmAutoComplete { ...@@ -465,10 +462,7 @@ class GfmAutoComplete {
})); }));
}, },
matcher(flag, subtext) { matcher(flag, subtext) {
const subtextNodes = subtext const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
.split(/\n+/g)
.pop()
.split(GfmAutoComplete.regexSubtext);
// Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands. // Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands.
command = subtextNodes.find(node => { command = subtextNodes.find(node => {
......
...@@ -108,14 +108,10 @@ export default class GLForm { ...@@ -108,14 +108,10 @@ export default class GLForm {
addEventListeners() { addEventListeners() {
this.textarea.on('focus', function focusTextArea() { this.textarea.on('focus', function focusTextArea() {
$(this) $(this).closest('.md-area').addClass('is-focused');
.closest('.md-area')
.addClass('is-focused');
}); });
this.textarea.on('blur', function blurTextArea() { this.textarea.on('blur', function blurTextArea() {
$(this) $(this).closest('.md-area').removeClass('is-focused');
.closest('.md-area')
.removeClass('is-focused');
}); });
} }
......
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
/> />
<div <div
:class="{ 'd-sm-flex': !group.isChildrenLoading }" :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"> <a :href="group.relativePath" class="no-expand">
<img <img
......
...@@ -65,10 +65,7 @@ export default class GroupFilterableList extends FilterableList { ...@@ -65,10 +65,7 @@ export default class GroupFilterableList extends FilterableList {
setDefaultFilterOption() { setDefaultFilterOption() {
const defaultOption = $.trim( const defaultOption = $.trim(
this.$dropdown this.$dropdown.find('.dropdown-menu li.js-filter-sort-order a').first().text(),
.find('.dropdown-menu li.js-filter-sort-order a')
.first()
.text(),
); );
this.$dropdown.find('.dropdown-label').text(defaultOption); this.$dropdown.find('.dropdown-label').text(defaultOption);
} }
......
...@@ -31,9 +31,7 @@ export default { ...@@ -31,9 +31,7 @@ export default {
}, },
removeDropdownListeners() { removeDropdownListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
$(this.$refs.dropdown) $(this.$refs.dropdown).off('show.bs.dropdown').off('hide.bs.dropdown');
.off('show.bs.dropdown')
.off('hide.bs.dropdown');
}, },
showDropdown() { showDropdown() {
this.isVisibleDropdown = true; this.isVisibleDropdown = true;
......
...@@ -50,5 +50,10 @@ export function getRulesWithTraversal(filePath, getFileContent) { ...@@ -50,5 +50,10 @@ export function getRulesWithTraversal(filePath, getFileContent) {
return Promise.all( return Promise.all(
editorconfigPaths.map(path => getFileContent(path).then(content => ({ path, content }))), 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 = { ...@@ -11,7 +11,11 @@ const conf = {
lineComment: '//', lineComment: '//',
blockComment: ['/*', '*/'], blockComment: ['/*', '*/'],
}, },
brackets: [['{', '}'], ['[', ']'], ['(', ')']], brackets: [
['{', '}'],
['[', ']'],
['(', ')'],
],
autoClosingPairs: [ autoClosingPairs: [
{ open: '{', close: '}' }, { open: '{', close: '}' },
{ open: '[', close: ']' }, { open: '[', close: ']' },
...@@ -161,7 +165,11 @@ const language = { ...@@ -161,7 +165,11 @@ const language = {
[/\/\/.*$/, 'comment'], [/\/\/.*$/, 'comment'],
[/#.*$/, 'comment'], [/#.*$/, 'comment'],
], ],
comment: [[/[^\/*]+/, 'comment'], [/\*\//, 'comment', '@pop'], [/[\/*]/, 'comment']], comment: [
[/[^\/*]+/, 'comment'],
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment'],
],
string: [ string: [
[/\$\{/, { token: 'delimiter', next: '@stringExpression' }], [/\$\{/, { token: 'delimiter', next: '@stringExpression' }],
[/[^\\"\$]+/, 'string'], [/[^\\"\$]+/, 'string'],
......
...@@ -37,7 +37,13 @@ const conf = { ...@@ -37,7 +37,13 @@ const conf = {
blockComment: ['{{!--', '--}}'], blockComment: ['{{!--', '--}}'],
}, },
brackets: [['<!--', '-->'], ['<', '>'], ['{{', '}}'], ['{', '}'], ['(', ')']], brackets: [
['<!--', '-->'],
['<', '>'],
['{{', '}}'],
['{', '}'],
['(', ')'],
],
autoClosingPairs: [ autoClosingPairs: [
{ open: '{', close: '}' }, { open: '{', close: '}' },
......
...@@ -254,12 +254,7 @@ export function extractMarkdownImagesFromEntries(mdFile, entries) { ...@@ -254,12 +254,7 @@ export function extractMarkdownImagesFromEntries(mdFile, entries) {
const imageContent = entries[imagePath]?.content || entries[imagePath]?.raw; const imageContent = entries[imagePath]?.content || entries[imagePath]?.raw;
if (!isAbsolute(path) && imageContent) { if (!isAbsolute(path) && imageContent) {
const ext = path.includes('.') const ext = path.includes('.') ? path.split('.').pop().trim() : 'jpeg';
? path
.split('.')
.pop()
.trim()
: 'jpeg';
const src = `data:image/${ext};base64,${imageContent}`; const src = `data:image/${ext};base64,${imageContent}`;
i += 1; i += 1;
const key = `{{${prefix}${i}}}`; const key = `{{${prefix}${i}}}`;
......
...@@ -154,12 +154,7 @@ export function getFileEOL(content = '') { ...@@ -154,12 +154,7 @@ export function getFileEOL(content = '') {
*/ */
export function addNumericSuffix(filename, randomize = false) { export function addNumericSuffix(filename, randomize = false) {
return filename.replace(/([ _-]?)(\d*)(\..+?$|$)/, (_, before, number, after) => { return filename.replace(/([ _-]?)(\d*)(\..+?$|$)/, (_, before, number, after) => {
const n = randomize const n = randomize ? Math.random().toString().substring(2, 7).slice(-5) : Number(number) + 1;
? Math.random()
.toString()
.substring(2, 7)
.slice(-5)
: Number(number) + 1;
return `${before || '-'}${n}${after}`; return `${before || '-'}${n}${after}`;
}); });
} }
......
...@@ -265,9 +265,7 @@ export default { ...@@ -265,9 +265,7 @@ export default {
if (field?.sortKey) { if (field?.sortKey) {
sortKey = field.sortKey; sortKey = field.sortKey;
} else { } else {
sortKey = convertToSnakeCase(sortBy) sortKey = convertToSnakeCase(sortBy).replace(/_.*/, '').toUpperCase();
.replace(/_.*/, '')
.toUpperCase();
} }
this.pagination = initialPaginationState; this.pagination = initialPaginationState;
......
...@@ -195,7 +195,7 @@ export default { ...@@ -195,7 +195,7 @@ export default {
<div class="gl-mt-2"> <div class="gl-mt-2">
<gl-sprintf :message="$options.labels.readMoreText"> <gl-sprintf :message="$options.labels.readMoreText">
<template #link="{content}"> <template #link="{ content }">
<gl-link :href="helpLink" target="_blank">{{ content }}</gl-link> <gl-link :href="helpLink" target="_blank">{{ content }}</gl-link>
</template> </template>
</gl-sprintf> </gl-sprintf>
......
...@@ -37,10 +37,7 @@ class AutoWidthDropdownSelect { ...@@ -37,10 +37,7 @@ class AutoWidthDropdownSelect {
// We have to look at the parent because // We have to look at the parent because
// `offsetParent` on a `display: none;` is `null` // `offsetParent` on a `display: none;` is `null`
const offsetParentWidth = $(this) const offsetParentWidth = $(this).parent().offsetParent().width();
.parent()
.offsetParent()
.width();
// Reset any width to let it naturally flow // Reset any width to let it naturally flow
$dropdown.css('width', 'auto'); $dropdown.css('width', 'auto');
if ($dropdown.outerWidth(false) > offsetParentWidth) { if ($dropdown.outerWidth(false) > offsetParentWidth) {
......
...@@ -52,12 +52,12 @@ export default class IssuableForm { ...@@ -52,12 +52,12 @@ export default class IssuableForm {
/* eslint-disable @gitlab/require-i18n-strings */ /* eslint-disable @gitlab/require-i18n-strings */
this.wipRegex = new RegExp( this.wipRegex = new RegExp(
'^\\s*(' + // Line start, then any amount of leading whitespace '^\\s*(' + // Line start, then any amount of leading whitespace
'draft\\s-\\s' + // Draft_-_ where "_" are *exactly* one whitespace 'draft\\s-\\s' + // Draft_-_ where "_" are *exactly* one whitespace
'|\\[(draft|wip)\\]\\s*' + // [Draft] or [WIP] and any following whitespace '|\\[(draft|wip)\\]\\s*' + // [Draft] or [WIP] and any following whitespace
'|(draft|wip):\\s*' + // Draft: or WIP: and any following whitespace '|(draft|wip):\\s*' + // Draft: or WIP: and any following whitespace
'|(draft|wip)\\s+' + // Draft_ or WIP_ where "_" is at least one whitespace '|(draft|wip)\\s+' + // Draft_ or WIP_ where "_" is at least one whitespace
'|\\(draft\\)\\s*' + // (Draft) and any following whitespace '|\\(draft\\)\\s*' + // (Draft) and any following whitespace
')+' + // At least one repeated match of the preceding parenthetical ')+' + // At least one repeated match of the preceding parenthetical
'\\s*', // Any amount of trailing whitespace '\\s*', // Any amount of trailing whitespace
'i', // Match any case(s) 'i', // Match any case(s)
); );
......
...@@ -21,9 +21,7 @@ export default class IssuableIndex { ...@@ -21,9 +21,7 @@ export default class IssuableIndex {
axios axios
.put($resetToken.attr('href')) .put($resetToken.attr('href'))
.then(({ data }) => { .then(({ data }) => {
$('#issuable_email') $('#issuable_email').val(data.new_address).focus();
.val(data.new_address)
.focus();
$resetToken.text(s__('EmailToken|reset it')); $resetToken.text(s__('EmailToken|reset it'));
}) })
......
...@@ -141,8 +141,7 @@ export default { ...@@ -141,8 +141,7 @@ export default {
:data-supports-quick-actions="enableAutocomplete" :data-supports-quick-actions="enableAutocomplete"
:aria-label="__('Description')" :aria-label="__('Description')"
:placeholder="__('Write a comment or drag your files here…')" :placeholder="__('Write a comment or drag your files here…')"
class="note-textarea js-gfm-input js-autosize markdown-area class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
qa-description-textarea"
dir="auto" dir="auto"
@keydown="handleKeydown($event, 'description')" @keydown="handleKeydown($event, 'description')"
></textarea> ></textarea>
......
...@@ -5,7 +5,7 @@ import App from './components/app.vue'; ...@@ -5,7 +5,7 @@ import App from './components/app.vue';
Vue.use(VueApollo); Vue.use(VueApollo);
export default function() { export default function () {
const el = document.getElementById('js-suggestions'); const el = document.getElementById('js-suggestions');
const issueTitle = document.getElementById('issue_title'); const issueTitle = document.getElementById('issue_title');
const { projectPath } = el.dataset; const { projectPath } = el.dataset;
......
...@@ -54,11 +54,7 @@ export default class Issue { ...@@ -54,11 +54,7 @@ export default class Issue {
$(document).trigger('issuable:change', isClosed); $(document).trigger('issuable:change', isClosed);
let numProjectIssues = Number( let numProjectIssues = Number(
projectIssuesCounter projectIssuesCounter.first().text().trim().replace(/[^\d]/, ''),
.first()
.text()
.trim()
.replace(/[^\d]/, ''),
); );
numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1; numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1;
projectIssuesCounter.text(addDelimiter(numProjectIssues)); projectIssuesCounter.text(addDelimiter(numProjectIssues));
......
...@@ -53,8 +53,7 @@ export default { ...@@ -53,8 +53,7 @@ export default {
id="issue-description" id="issue-description"
ref="textarea" ref="textarea"
v-model="formState.description" v-model="formState.description"
class="note-textarea js-gfm-input js-autosize markdown-area class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
qa-description-textarea"
dir="auto" dir="auto"
:data-supports-quick-actions="!glFeatures.tributeAutocomplete" :data-supports-quick-actions="!glFeatures.tributeAutocomplete"
:aria-label="__('Description')" :aria-label="__('Description')"
......
...@@ -93,7 +93,10 @@ export default { ...@@ -93,7 +93,10 @@ export default {
this.secretValue = ''; this.secretValue = '';
}, },
deleteVariable(id) { 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 { ...@@ -135,7 +135,7 @@ export default class LabelManager {
getSortedLabelsIds() { getSortedLabelsIds() {
const sortedIds = []; const sortedIds = [];
this.prioritizedLabels.find('> li').each(function() { this.prioritizedLabels.find('> li').each(function () {
const id = $(this).data('id'); const id = $(this).data('id');
if (id) { if (id) {
......
...@@ -49,7 +49,7 @@ export default class LabelsSelect { ...@@ -49,7 +49,7 @@ export default class LabelsSelect {
const fieldName = $dropdown.data('fieldName'); const fieldName = $dropdown.data('fieldName');
let initialSelected = $selectbox let initialSelected = $selectbox
.find(`input[name="${$dropdown.data('fieldName')}"]`) .find(`input[name="${$dropdown.data('fieldName')}"]`)
.map(function() { .map(function () {
return this.value; return this.value;
}) })
.get(); .get();
...@@ -64,11 +64,11 @@ export default class LabelsSelect { ...@@ -64,11 +64,11 @@ export default class LabelsSelect {
); );
} }
const saveLabelData = function() { const saveLabelData = function () {
const selected = $dropdown const selected = $dropdown
.closest('.selectbox') .closest('.selectbox')
.find(`input[name='${fieldName}']`) .find(`input[name='${fieldName}']`)
.map(function() { .map(function () {
return this.value; return this.value;
}) })
.get(); .get();
...@@ -210,9 +210,7 @@ export default class LabelsSelect { ...@@ -210,9 +210,7 @@ export default class LabelsSelect {
} }
} else { } else {
if (this.id(label)) { if (this.id(label)) {
const dropdownValue = this.id(label) const dropdownValue = this.id(label).toString().replace(/'/g, "\\'");
.toString()
.replace(/'/g, "\\'");
if ( if (
$form.find( $form.find(
...@@ -346,10 +344,7 @@ export default class LabelsSelect { ...@@ -346,10 +344,7 @@ export default class LabelsSelect {
const isMRIndex = page === 'projects:merge_requests:index'; const isMRIndex = page === 'projects:merge_requests:index';
if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) { if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) {
$dropdown $dropdown.parent().find('.dropdown-clear-active').removeClass('is-active');
.parent()
.find('.dropdown-clear-active')
.removeClass('is-active');
} }
if ($dropdown.hasClass('js-issuable-form-dropdown')) { if ($dropdown.hasClass('js-issuable-form-dropdown')) {
...@@ -559,7 +554,7 @@ export default class LabelsSelect { ...@@ -559,7 +554,7 @@ export default class LabelsSelect {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
setOriginalDropdownData($container, $dropdown) { setOriginalDropdownData($container, $dropdown) {
const labels = []; const labels = [];
$container.find('[name="label_name[]"]').map(function() { $container.find('[name="label_name[]"]').map(function () {
return labels.push(this.value); return labels.push(this.value);
}); });
$dropdown.data('marked', labels); $dropdown.data('marked', labels);
......
...@@ -68,7 +68,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa ...@@ -68,7 +68,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa
closestSubmit.disable(); closestSubmit.disable();
} }
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
return field.on(eventName, function() { return field.on(eventName, function () {
if (rstrip($(this).val()) === '') { if (rstrip($(this).val()) === '') {
return closestSubmit.disable(); return closestSubmit.disable();
} }
......
...@@ -14,18 +14,12 @@ function addBlockTags(blockTag, selected) { ...@@ -14,18 +14,12 @@ function addBlockTags(blockTag, selected) {
} }
function lineBefore(text, textarea) { function lineBefore(text, textarea) {
const split = text const split = text.substring(0, textarea.selectionStart).trim().split('\n');
.substring(0, textarea.selectionStart)
.trim()
.split('\n');
return split[split.length - 1]; return split[split.length - 1];
} }
function lineAfter(text, textarea) { function lineAfter(text, textarea) {
return text return text.substring(textarea.selectionEnd).trim().split('\n')[0];
.substring(textarea.selectionEnd)
.trim()
.split('\n')[0];
} }
function convertMonacoSelectionToAceFormat(sel) { function convertMonacoSelectionToAceFormat(sel) {
...@@ -342,7 +336,7 @@ export function addMarkdownListeners(form) { ...@@ -342,7 +336,7 @@ export function addMarkdownListeners(form) {
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
const $allToolbarBtns = $('.js-md', form) const $allToolbarBtns = $('.js-md', form)
.off('click') .off('click')
.on('click', function() { .on('click', function () {
const $toolbarBtn = $(this); const $toolbarBtn = $(this);
return updateTextForToolbarBtn($toolbarBtn); return updateTextForToolbarBtn($toolbarBtn);
......
...@@ -32,7 +32,7 @@ import 'vendor/jquery.scrollTo'; ...@@ -32,7 +32,7 @@ import 'vendor/jquery.scrollTo';
// </div> // </div>
// //
const LineHighlighter = function(options = {}) { const LineHighlighter = function (options = {}) {
options.highlightLineClass = options.highlightLineClass || 'hll'; options.highlightLineClass = options.highlightLineClass || 'hll';
options.fileHolderSelector = options.fileHolderSelector || '.file-holder'; options.fileHolderSelector = options.fileHolderSelector || '.file-holder';
options.scrollFileHolder = options.scrollFileHolder || false; options.scrollFileHolder = options.scrollFileHolder || false;
...@@ -50,7 +50,7 @@ const LineHighlighter = function(options = {}) { ...@@ -50,7 +50,7 @@ const LineHighlighter = function(options = {}) {
this.highlightHash(); this.highlightHash();
}; };
LineHighlighter.prototype.bindEvents = function() { LineHighlighter.prototype.bindEvents = function () {
const $fileHolder = $(this.options.fileHolderSelector); const $fileHolder = $(this.options.fileHolderSelector);
$fileHolder.on('click', 'a[data-line-number]', this.clickHandler); $fileHolder.on('click', 'a[data-line-number]', this.clickHandler);
...@@ -58,7 +58,7 @@ LineHighlighter.prototype.bindEvents = function() { ...@@ -58,7 +58,7 @@ LineHighlighter.prototype.bindEvents = function() {
window.addEventListener('hashchange', e => this.highlightHash(e.target.location.hash)); window.addEventListener('hashchange', e => this.highlightHash(e.target.location.hash));
}; };
LineHighlighter.prototype.highlightHash = function(newHash) { LineHighlighter.prototype.highlightHash = function (newHash) {
let range; let range;
if (newHash && typeof newHash === 'string') this._hash = newHash; if (newHash && typeof newHash === 'string') this._hash = newHash;
...@@ -83,13 +83,11 @@ LineHighlighter.prototype.highlightHash = function(newHash) { ...@@ -83,13 +83,11 @@ LineHighlighter.prototype.highlightHash = function(newHash) {
} }
}; };
LineHighlighter.prototype.clickHandler = function(event) { LineHighlighter.prototype.clickHandler = function (event) {
let range; let range;
event.preventDefault(); event.preventDefault();
this.clearHighlight(); this.clearHighlight();
const lineNumber = $(event.target) const lineNumber = $(event.target).closest('a').data('lineNumber');
.closest('a')
.data('lineNumber');
const current = this.hashToRange(this._hash); const current = this.hashToRange(this._hash);
if (!(current[0] && event.shiftKey)) { if (!(current[0] && event.shiftKey)) {
// If there's no current selection, or there is but Shift wasn't held, // If there's no current selection, or there is but Shift wasn't held,
...@@ -107,7 +105,7 @@ LineHighlighter.prototype.clickHandler = function(event) { ...@@ -107,7 +105,7 @@ LineHighlighter.prototype.clickHandler = function(event) {
} }
}; };
LineHighlighter.prototype.clearHighlight = function() { LineHighlighter.prototype.clearHighlight = function () {
return $(`.${this.highlightLineClass}`).removeClass(this.highlightLineClass); return $(`.${this.highlightLineClass}`).removeClass(this.highlightLineClass);
}; };
...@@ -122,7 +120,7 @@ LineHighlighter.prototype.clearHighlight = function() { ...@@ -122,7 +120,7 @@ LineHighlighter.prototype.clearHighlight = function() {
// hashToRange('#foo') # => [null, null] // hashToRange('#foo') # => [null, null]
// //
// Returns an Array // Returns an Array
LineHighlighter.prototype.hashToRange = function(hash) { LineHighlighter.prototype.hashToRange = function (hash) {
// ?L(\d+)(?:-(\d+))?$/) // ?L(\d+)(?:-(\d+))?$/)
const matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/); const matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/);
if (matches && matches.length) { if (matches && matches.length) {
...@@ -136,14 +134,14 @@ LineHighlighter.prototype.hashToRange = function(hash) { ...@@ -136,14 +134,14 @@ LineHighlighter.prototype.hashToRange = function(hash) {
// Highlight a single line // Highlight a single line
// //
// lineNumber - Line number to highlight // lineNumber - Line number to highlight
LineHighlighter.prototype.highlightLine = function(lineNumber) { LineHighlighter.prototype.highlightLine = function (lineNumber) {
return $(`#LC${lineNumber}`).addClass(this.highlightLineClass); return $(`#LC${lineNumber}`).addClass(this.highlightLineClass);
}; };
// Highlight all lines within a range // Highlight all lines within a range
// //
// range - Array containing the starting and ending line numbers // range - Array containing the starting and ending line numbers
LineHighlighter.prototype.highlightRange = function(range) { LineHighlighter.prototype.highlightRange = function (range) {
if (range[1]) { if (range[1]) {
const results = []; const results = [];
const ref = range[0] <= range[1] ? range : range.reverse(); const ref = range[0] <= range[1] ? range : range.reverse();
...@@ -158,7 +156,7 @@ LineHighlighter.prototype.highlightRange = function(range) { ...@@ -158,7 +156,7 @@ LineHighlighter.prototype.highlightRange = function(range) {
}; };
// Set the URL hash string // Set the URL hash string
LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) { LineHighlighter.prototype.setHash = function (firstLineNumber, lastLineNumber) {
let hash; let hash;
if (lastLineNumber) { if (lastLineNumber) {
hash = `#L${firstLineNumber}-${lastLineNumber}`; hash = `#L${firstLineNumber}-${lastLineNumber}`;
...@@ -172,7 +170,7 @@ LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) { ...@@ -172,7 +170,7 @@ LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) {
// Make the actual hash change in the browser // Make the actual hash change in the browser
// //
// This method is stubbed in tests. // This method is stubbed in tests.
LineHighlighter.prototype.__setLocationHash__ = function(value) { LineHighlighter.prototype.__setLocationHash__ = function (value) {
return window.history.pushState( return window.history.pushState(
{ {
url: value, url: value,
......
...@@ -246,9 +246,7 @@ export default { ...@@ -246,9 +246,7 @@ export default {
</div>{{trace}} </div>{{trace}}
</code></pre> </code></pre>
</template> </template>
<template #default <template #default><div></div></template>
><div></div
></template>
</gl-infinite-scroll> </gl-infinite-scroll>
<div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900"> <div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900">
...@@ -262,9 +260,7 @@ export default { ...@@ -262,9 +260,7 @@ export default {
> >
<template #fetched>{{ logs.lines.length }}</template> <template #fetched>{{ logs.lines.length }}</template>
</gl-sprintf> </gl-sprintf>
<template v-else> <template v-else> {{ s__('Environments|Currently showing all results.') }}</template>
{{ s__('Environments|Currently showing all results.') }}</template
>
</div> </div>
</div> </div>
</template> </template>
...@@ -53,7 +53,7 @@ window.$ = jQuery; ...@@ -53,7 +53,7 @@ window.$ = jQuery;
jQuery.ajaxSetup({ jQuery.ajaxSetup({
converters: { converters: {
// eslint-disable-next-line @gitlab/require-i18n-strings, func-names // eslint-disable-next-line @gitlab/require-i18n-strings, func-names
'text script': function(text) { 'text script': function (text) {
jQuery.globalEval(text, { nonce: getCspNonceValue() }); jQuery.globalEval(text, { nonce: getCspNonceValue() });
return text; return text;
}, },
...@@ -137,9 +137,7 @@ function deferredInitialisation() { ...@@ -137,9 +137,7 @@ function deferredInitialisation() {
$('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() { $('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() {
tooltips.dispose(this); tooltips.dispose(this);
$(this) $(this).closest('li').addClass('gl-display-none!');
.closest('li')
.addClass('gl-display-none!');
}); });
$('.js-remove-tr').on('ajax:before', function removeTRAjaxBeforeCallback() { $('.js-remove-tr').on('ajax:before', function removeTRAjaxBeforeCallback() {
...@@ -147,9 +145,7 @@ function deferredInitialisation() { ...@@ -147,9 +145,7 @@ function deferredInitialisation() {
}); });
$('.js-remove-tr').on('ajax:success', function removeTRAjaxSuccessCallback() { $('.js-remove-tr').on('ajax:success', function removeTRAjaxSuccessCallback() {
$(this) $(this).closest('tr').addClass('gl-display-none!');
.closest('tr')
.addClass('gl-display-none!');
}); });
const glTooltipDelay = localStorage.getItem('gl-tooltip-delay'); const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
...@@ -278,15 +274,9 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -278,15 +274,9 @@ document.addEventListener('DOMContentLoaded', () => {
$this.toggleClass('active'); $this.toggleClass('active');
if ($this.hasClass('active')) { if ($this.hasClass('active')) {
notesHolders notesHolders.show().find('.hide, .content').show();
.show()
.find('.hide, .content')
.show();
} else { } else {
notesHolders notesHolders.hide().find('.content').hide();
.hide()
.find('.content')
.hide();
} }
$(document).trigger('toggle.comments'); $(document).trigger('toggle.comments');
......
...@@ -41,9 +41,7 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d ...@@ -41,9 +41,7 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d
inputs.next('.js-clear-input').on('click', function clicked(event) { inputs.next('.js-clear-input').on('click', function clicked(event) {
event.preventDefault(); event.preventDefault();
const input = $(this) const input = $(this).closest('.clearable-input').find(selector);
.closest('.clearable-input')
.find(selector);
const calendar = input.data('pikaday'); const calendar = input.data('pikaday');
calendar.setDate(null); calendar.setDate(null);
......
...@@ -12,13 +12,9 @@ export default class Members { ...@@ -12,13 +12,9 @@ export default class Members {
addListeners() { addListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
$('.js-member-update-control') $('.js-member-update-control').off('change').on('change', this.formSubmit.bind(this));
.off('change')
.on('change', this.formSubmit.bind(this));
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
$('.js-edit-member-form') $('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this));
.off('ajax:success')
.on('ajax:success', this.formSuccess.bind(this));
disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change'); disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change');
} }
......
...@@ -60,19 +60,28 @@ import { __ } from '~/locale'; ...@@ -60,19 +60,28 @@ import { __ } from '~/locale';
const DataPromise = axios.get(this.file.content_path); const DataPromise = axios.get(this.file.content_path);
Promise.all([EditorPromise, DataPromise]) Promise.all([EditorPromise, DataPromise])
.then(([{ default: EditorLite }, { data: { content, new_path: path } }]) => { .then(
const contentEl = this.$el.querySelector('.editor'); ([
{ default: EditorLite },
{
data: { content, new_path: path },
},
]) => {
const contentEl = this.$el.querySelector('.editor');
this.originalContent = content; this.originalContent = content;
this.fileLoaded = true; this.fileLoaded = true;
this.editor = new EditorLite().createInstance({ this.editor = new EditorLite().createInstance({
el: contentEl, el: contentEl,
blobPath: path, blobPath: path,
blobContent: content, blobContent: content,
}); });
this.editor.onDidChangeModelContent(debounce(this.saveDiffResolution.bind(this), 250)); this.editor.onDidChangeModelContent(
}) debounce(this.saveDiffResolution.bind(this), 250),
);
},
)
.catch(() => { .catch(() => {
flash(__('An error occurred while loading the file')); flash(__('An error occurred while loading the file'));
}); });
......
...@@ -47,11 +47,11 @@ function MergeRequest(opts) { ...@@ -47,11 +47,11 @@ function MergeRequest(opts) {
} }
// Local jQuery finder // Local jQuery finder
MergeRequest.prototype.$ = function(selector) { MergeRequest.prototype.$ = function (selector) {
return this.$el.find(selector); return this.$el.find(selector);
}; };
MergeRequest.prototype.initTabs = function() { MergeRequest.prototype.initTabs = function () {
if (window.mrTabs) { if (window.mrTabs) {
window.mrTabs.unbindEvents(); window.mrTabs.unbindEvents();
} }
...@@ -59,12 +59,12 @@ MergeRequest.prototype.initTabs = function() { ...@@ -59,12 +59,12 @@ MergeRequest.prototype.initTabs = function() {
window.mrTabs = new MergeRequestTabs(this.opts); window.mrTabs = new MergeRequestTabs(this.opts);
}; };
MergeRequest.prototype.showAllCommits = function() { MergeRequest.prototype.showAllCommits = function () {
this.$('.first-commits').remove(); this.$('.first-commits').remove();
return this.$('.all-commits').removeClass('hide'); return this.$('.all-commits').removeClass('hide');
}; };
MergeRequest.prototype.initMRBtnListeners = function() { MergeRequest.prototype.initMRBtnListeners = function () {
const _this = this; const _this = this;
const draftToggles = document.querySelectorAll('.js-draft-toggle-button'); const draftToggles = document.querySelectorAll('.js-draft-toggle-button');
...@@ -99,7 +99,7 @@ MergeRequest.prototype.initMRBtnListeners = function() { ...@@ -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 $this = $(this);
const shouldSubmit = $this.hasClass('btn-comment'); const shouldSubmit = $this.hasClass('btn-comment');
if (shouldSubmit && $this.data('submitted')) { if (shouldSubmit && $this.data('submitted')) {
...@@ -117,7 +117,7 @@ MergeRequest.prototype.initMRBtnListeners = function() { ...@@ -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(); const noteText = form.find('textarea.js-note-text').val();
if (noteText.trim().length > 0) { if (noteText.trim().length > 0) {
form.submit(); form.submit();
...@@ -126,7 +126,7 @@ MergeRequest.prototype.submitNoteForm = function(form, $button) { ...@@ -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 => { $(document).on('click', 'a.js-with-description-link', e => {
const textarea = $('textarea.js-commit-message'); const textarea = $('textarea.js-commit-message');
e.preventDefault(); e.preventDefault();
...@@ -146,7 +146,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() { ...@@ -146,7 +146,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() {
}); });
}; };
MergeRequest.setStatusBoxToMerged = function() { MergeRequest.setStatusBoxToMerged = function () {
$('.detail-page-header .status-box') $('.detail-page-header .status-box')
.removeClass('status-box-open') .removeClass('status-box-open')
.addClass('status-box-mr-merged') .addClass('status-box-mr-merged')
...@@ -154,20 +154,20 @@ MergeRequest.setStatusBoxToMerged = function() { ...@@ -154,20 +154,20 @@ MergeRequest.setStatusBoxToMerged = function() {
.text(__('Merged')); .text(__('Merged'));
}; };
MergeRequest.decreaseCounter = function(by = 1) { MergeRequest.decreaseCounter = function (by = 1) {
const $el = $('.js-merge-counter'); const $el = $('.js-merge-counter');
const count = Math.max(parseInt($el.text().replace(/[^\d]/, ''), 10) - by, 0); const count = Math.max(parseInt($el.text().replace(/[^\d]/, ''), 10) - by, 0);
$el.text(addDelimiter(count)); $el.text(addDelimiter(count));
}; };
MergeRequest.hideCloseButton = function() { MergeRequest.hideCloseButton = function () {
const el = document.querySelector('.merge-request .js-issuable-actions'); const el = document.querySelector('.merge-request .js-issuable-actions');
// Dropdown for mobile screen // Dropdown for mobile screen
el.querySelector('li.js-close-item').classList.add('hidden'); el.querySelector('li.js-close-item').classList.add('hidden');
}; };
MergeRequest.toggleDraftStatus = function(title, isReady) { MergeRequest.toggleDraftStatus = function (title, isReady) {
if (isReady) { if (isReady) {
createFlash(__('The merge request can now be merged.'), 'notice'); createFlash(__('The merge request can now be merged.'), 'notice');
} }
......
...@@ -92,11 +92,7 @@ export default class MiniPipelineGraph { ...@@ -92,11 +92,7 @@ export default class MiniPipelineGraph {
}) })
.catch(() => { .catch(() => {
this.toggleLoading(button); this.toggleLoading(button);
if ( if ($(button).parent().hasClass('open')) {
$(button)
.parent()
.hasClass('open')
) {
$(button).dropdown('toggle'); $(button).dropdown('toggle');
} }
flash(__('An error occurred while fetching the builds.'), 'alert'); flash(__('An error occurred while fetching the builds.'), 'alert');
......
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
) )
" "
> >
<template #code="{content}"> <template #code="{ content }">
<code>{{ content }}</code> <code>{{ content }}</code>
</template> </template>
</gl-sprintf> </gl-sprintf>
......
...@@ -243,11 +243,11 @@ export default class BranchGraph { ...@@ -243,11 +243,11 @@ export default class BranchGraph {
}) })
.click(() => window.open(options.commit_url.replace('%s', commit.id), '_blank')) .click(() => window.open(options.commit_url.replace('%s', commit.id), '_blank'))
.hover( .hover(
function() { function () {
this.tooltip = r.commitTooltip(x + 5, y, commit); this.tooltip = r.commitTooltip(x + 5, y, commit);
return top.push(this.tooltip.insertBefore(this)); return top.push(this.tooltip.insertBefore(this));
}, },
function() { function () {
return this.tooltip && this.tooltip.remove() && delete this.tooltip; return this.tooltip && this.tooltip.remove() && delete this.tooltip;
}, },
); );
......
...@@ -53,13 +53,13 @@ export default class NewBranchForm { ...@@ -53,13 +53,13 @@ export default class NewBranchForm {
const { indexOf } = []; const { indexOf } = [];
this.branchNameError.empty(); this.branchNameError.empty();
const unique = function(values, value) { const unique = function (values, value) {
if (indexOf.call(values, value) === -1) { if (indexOf.call(values, value) === -1) {
values.push(value); values.push(value);
} }
return values; return values;
}; };
const formatter = function(values, restriction) { const formatter = function (values, restriction) {
const formatted = values.map(value => { const formatted = values.map(value => {
switch (false) { switch (false) {
case !/\s/.test(value): case !/\s/.test(value):
......
...@@ -108,10 +108,7 @@ export default class Notes { ...@@ -108,10 +108,7 @@ export default class Notes {
// We are in the Merge Requests page so we need another edit form for Changes tab // We are in the Merge Requests page so we need another edit form for Changes tab
if (getPagePath(1) === 'merge_requests') { if (getPagePath(1) === 'merge_requests') {
$('.note-edit-form') $('.note-edit-form').clone().addClass('mr-note-edit-form').insertAfter('.note-edit-form');
.clone()
.addClass('mr-note-edit-form')
.insertAfter('.note-edit-form');
} }
const hash = getLocationHash(); const hash = getLocationHash();
...@@ -427,12 +424,7 @@ export default class Notes { ...@@ -427,12 +424,7 @@ export default class Notes {
} else if (Notes.isUpdatedNote(noteEntity, $note)) { } 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. // 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 isEditing = $note.hasClass('is-editing');
const initialContent = normalizeNewlines( const initialContent = normalizeNewlines($note.find('.original-note-content').text().trim());
$note
.find('.original-note-content')
.text()
.trim(),
);
const $textarea = $note.find('.js-note-text'); const $textarea = $note.find('.js-note-text');
const currentContent = $textarea.val(); const currentContent = $textarea.val();
// There can be CRLF vs LF mismatches if we don't sanitize and compare the same way // 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 { ...@@ -541,14 +533,8 @@ export default class Notes {
form.find('.js-errors').remove(); form.find('.js-errors').remove();
// reset text and preview // reset text and preview
form.find('.js-md-write-button').click(); form.find('.js-md-write-button').click();
form form.find('.js-note-text').val('').trigger('input');
.find('.js-note-text') form.find('.js-note-text').data('autosave').reset();
.val('')
.trigger('input');
form
.find('.js-note-text')
.data('autosave')
.reset();
const event = document.createEvent('Event'); const event = document.createEvent('Event');
event.initEvent('autosize:update', true, false); event.initEvent('autosize:update', true, false);
...@@ -690,10 +676,7 @@ export default class Notes { ...@@ -690,10 +676,7 @@ export default class Notes {
} }
checkContentToAllowEditing($el) { checkContentToAllowEditing($el) {
const initialContent = $el const initialContent = $el.find('.original-note-content').text().trim();
.find('.original-note-content')
.text()
.trim();
const currentContent = $el.find('.js-note-text').val(); const currentContent = $el.find('.js-note-text').val();
let isAllowed = true; let isAllowed = true;
...@@ -877,10 +860,7 @@ export default class Notes { ...@@ -877,10 +860,7 @@ export default class Notes {
const form = this.cleanForm(this.formClone.clone()); const form = this.cleanForm(this.formClone.clone());
const replyLink = $(target).closest('.js-discussion-reply-button'); const replyLink = $(target).closest('.js-discussion-reply-button');
// insert the form after the button // insert the form after the button
replyLink replyLink.closest('.discussion-reply-holder').hide().after(form);
.closest('.discussion-reply-holder')
.hide()
.after(form);
// show the form // show the form
return this.setupDiscussionNoteForm(replyLink, form); return this.setupDiscussionNoteForm(replyLink, form);
} }
...@@ -1069,10 +1049,7 @@ export default class Notes { ...@@ -1069,10 +1049,7 @@ export default class Notes {
const row = form.closest('tr'); const row = form.closest('tr');
const glForm = form.data('glForm'); const glForm = form.data('glForm');
glForm.destroy(); glForm.destroy();
form form.find('.js-note-text').data('autosave').reset();
.find('.js-note-text')
.data('autosave')
.reset();
// show the reply button (will only work for replies) // show the reply button (will only work for replies)
form.prev('.discussion-reply-holder').show(); form.prev('.discussion-reply-holder').show();
if (row.is('.js-temp-notes-holder')) { if (row.is('.js-temp-notes-holder')) {
...@@ -1181,16 +1158,10 @@ export default class Notes { ...@@ -1181,16 +1158,10 @@ export default class Notes {
this.glForm = new GLForm($editForm.find('form'), this.enableGFM); this.glForm = new GLForm($editForm.find('form'), this.enableGFM);
$editForm $editForm.find('form').attr('action', `${postUrl}?html=true`).attr('data-remote', 'true');
.find('form')
.attr('action', `${postUrl}?html=true`)
.attr('data-remote', 'true');
$editForm.find('.js-form-target-id').val(targetId); $editForm.find('.js-form-target-id').val(targetId);
$editForm.find('.js-form-target-type').val(targetType); $editForm.find('.js-form-target-type').val(targetType);
$editForm $editForm.find('.js-note-text').focus().val(originalContent);
.find('.js-note-text')
.focus()
.val(originalContent);
$editForm.find('.js-md-write-button').trigger('click'); $editForm.find('.js-md-write-button').trigger('click');
$editForm.find('.referenced-users').hide(); $editForm.find('.referenced-users').hide();
} }
...@@ -1306,9 +1277,7 @@ export default class Notes { ...@@ -1306,9 +1277,7 @@ export default class Notes {
* intrusive. * intrusive.
*/ */
collapseLongCommitList() { collapseLongCommitList() {
const systemNotes = $('#notes-list') const systemNotes = $('#notes-list').find('li.system-note').has('ul');
.find('li.system-note')
.has('ul');
$.each(systemNotes, (index, systemNote) => { $.each(systemNotes, (index, systemNote) => {
const $systemNote = $(systemNote); const $systemNote = $(systemNote);
...@@ -1365,11 +1334,7 @@ export default class Notes { ...@@ -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 // There can be CRLF vs LF mismatches if we don't sanitize and compare the same way
const sanitizedNoteEntityText = normalizeNewlines(noteEntity.note.trim()); const sanitizedNoteEntityText = normalizeNewlines(noteEntity.note.trim());
const currentNoteText = normalizeNewlines( const currentNoteText = normalizeNewlines(
$note $note.find('.original-note-content').first().text().trim(),
.find('.original-note-content')
.first()
.text()
.trim(),
); );
return sanitizedNoteEntityText !== currentNoteText; return sanitizedNoteEntityText !== currentNoteText;
} }
...@@ -1545,10 +1510,7 @@ export default class Notes { ...@@ -1545,10 +1510,7 @@ export default class Notes {
let $form = $submitBtn.parents('form'); let $form = $submitBtn.parents('form');
const $closeBtn = $form.find('.js-note-target-close'); const $closeBtn = $form.find('.js-note-target-close');
const isDiscussionNote = const isDiscussionNote =
$submitBtn $submitBtn.parent().find('li.droplab-item-selected').attr('id') === 'discussion';
.parent()
.find('li.droplab-item-selected')
.attr('id') === 'discussion';
const isMainForm = $form.hasClass('js-main-target-form'); const isMainForm = $form.hasClass('js-main-target-form');
const isDiscussionForm = $form.hasClass('js-discussion-note-form'); const isDiscussionForm = $form.hasClass('js-discussion-note-form');
const isDiscussionResolve = $submitBtn.hasClass('js-comment-resolve-button'); 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