Commit 26b68c70 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 30 files: 1 of 8

Mandatory not to break master. Automatically created with prettier.
parent 03b77c3f
......@@ -36,7 +36,7 @@ export default {
)
"
>
<template #docLink="{content}">
<template #docLink="{ content }">
<gl-link :href="docsLink" target="_blank">{{ content }}</gl-link>
</template>
<template #strong="{ content }"
......
......@@ -35,7 +35,7 @@ export default {
)
"
>
<template #docLink="{content}">
<template #docLink="{ content }">
<gl-link :href="docsLink" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import StatisticsPanelApp from './components/app.vue';
import createStore from './store';
export default function(el) {
export default function (el) {
if (!el) {
return false;
}
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import AdminUsersApp from './components/app.vue';
export default function(el = document.querySelector('#js-admin-users-app')) {
export default function (el = document.querySelector('#js-admin-users-app')) {
if (!el) {
return false;
}
......
......@@ -194,14 +194,20 @@ export default {
projectPath: this.projectPath,
},
})
.then(({ data: { createAlertIssue: { errors, issue } } }) => {
if (errors?.length) {
[this.createIncidentError] = errors;
this.incidentCreationInProgress = false;
} else if (issue) {
visitUrl(this.incidentPath(issue.iid));
}
})
.then(
({
data: {
createAlertIssue: { errors, issue },
},
}) => {
if (errors?.length) {
[this.createIncidentError] = errors;
this.incidentCreationInProgress = false;
} else if (issue) {
visitUrl(this.incidentPath(issue.iid));
}
},
)
.catch(error => {
this.createIncidentError = error;
this.incidentCreationInProgress = false;
......
......@@ -192,7 +192,7 @@ export default {
</script>
<template>
<div class="block alert-assignees ">
<div class="block alert-assignees">
<div ref="assignees" class="sidebar-collapsed-icon" @click="$emit('toggle-sidebar')">
<gl-icon name="user" :size="14" />
<gl-loading-icon v-if="isUpdating" />
......
......@@ -98,10 +98,7 @@ export class AwardsHandler {
showEmojiMenu($addBtn) {
if ($addBtn.hasClass('js-note-emoji')) {
$addBtn
.closest('.note')
.find('.js-awards-block')
.addClass('current');
$addBtn.closest('.note').find('.js-awards-block').addClass('current');
} else {
$addBtn.closest('.js-awards-block').addClass('current');
}
......@@ -531,9 +528,7 @@ export class AwardsHandler {
const $search = $('.js-emoji-menu-search');
this.registerEventListener('on', $search, 'input', e => {
const term = $(e.target)
.val()
.trim();
const term = $(e.target).val().trim();
this.searchEmojis(term);
});
......@@ -556,17 +551,11 @@ export class AwardsHandler {
// Generate a search result block
const h5 = $('<h5 class="emoji-search-title"/>').text('Search results');
const foundEmojis = this.findMatchingEmojiElements(term).show();
const ul = $('<ul>')
.addClass('emoji-menu-list emoji-menu-search')
.append(foundEmojis);
const ul = $('<ul>').addClass('emoji-menu-list emoji-menu-search').append(foundEmojis);
$('.emoji-menu-content ul, .emoji-menu-content h5').hide();
$('.emoji-menu-content')
.append(h5)
.append(ul);
$('.emoji-menu-content').append(h5).append(ul);
} else {
$('.emoji-menu-content')
.children()
.show();
$('.emoji-menu-content').children().show();
}
}
......
......@@ -98,9 +98,7 @@ export default {
{{ titleText }}
</span>
<template v-if="showLinePosition">
<template v-if="!glFeatures.multilineComments"
>:{{ linePosition }}</template
>
<template v-if="!glFeatures.multilineComments">:{{ linePosition }}</template>
<template v-else-if="startLineNumber === endLineNumber">
:<span :class="getLineClasses(startLineNumber)">{{ startLineNumber }}</span>
</template>
......
......@@ -23,7 +23,7 @@ MarkdownPreview.prototype.emptyMessage = __('Nothing to preview.');
MarkdownPreview.prototype.ajaxCache = {};
MarkdownPreview.prototype.showPreview = function($form) {
MarkdownPreview.prototype.showPreview = function ($form) {
const preview = $form.find('.js-md-preview');
const url = preview.data('url');
if (preview.hasClass('md-preview-loading')) {
......@@ -60,7 +60,7 @@ MarkdownPreview.prototype.showPreview = function($form) {
}
};
MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
MarkdownPreview.prototype.fetchMarkdownPreview = function (text, url, success) {
if (!url) {
return;
}
......@@ -82,11 +82,11 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
.catch(() => flash(__('An error occurred while fetching markdown preview')));
};
MarkdownPreview.prototype.hideReferencedUsers = function($form) {
MarkdownPreview.prototype.hideReferencedUsers = function ($form) {
$form.find('.referenced-users').hide();
};
MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) {
MarkdownPreview.prototype.renderReferencedUsers = function (users, $form) {
const referencedUsers = $form.find('.referenced-users');
if (referencedUsers.length) {
if (users.length >= this.referenceThreshold) {
......@@ -98,11 +98,11 @@ MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) {
}
};
MarkdownPreview.prototype.hideReferencedCommands = function($form) {
MarkdownPreview.prototype.hideReferencedCommands = function ($form) {
$form.find('.referenced-commands').hide();
};
MarkdownPreview.prototype.renderReferencedCommands = function(commands, $form) {
MarkdownPreview.prototype.renderReferencedCommands = function (commands, $form) {
const referencedCommands = $form.find('.referenced-commands');
if (commands.length > 0) {
referencedCommands.html(commands);
......@@ -120,7 +120,7 @@ const writeButtonSelector = '.js-md-write-button';
lastTextareaPreviewed = null;
const markdownToolbar = $('.md-header-toolbar');
$.fn.setupMarkdownPreview = function() {
$.fn.setupMarkdownPreview = function () {
const $form = $(this);
$form.find('textarea.markdown-area').on('input', () => {
markdownPreview.hideReferencedUsers($form);
......@@ -136,14 +136,8 @@ $(document).on('markdown-preview:show', (e, $form) => {
lastTextareaHeight = lastTextareaPreviewed.height();
// toggle tabs
$form
.find(writeButtonSelector)
.parent()
.removeClass('active');
$form
.find(previewButtonSelector)
.parent()
.addClass('active');
$form.find(writeButtonSelector).parent().removeClass('active');
$form.find(previewButtonSelector).parent().addClass('active');
// toggle content
$form.find('.md-write-holder').hide();
......@@ -163,14 +157,8 @@ $(document).on('markdown-preview:hide', (e, $form) => {
}
// toggle tabs
$form
.find(writeButtonSelector)
.parent()
.addClass('active');
$form
.find(previewButtonSelector)
.parent()
.removeClass('active');
$form.find(writeButtonSelector).parent().addClass('active');
$form.find(previewButtonSelector).parent().removeClass('active');
// toggle content
$form.find('.md-write-holder').show();
......@@ -194,13 +182,13 @@ $(document).on('markdown-preview:toggle', (e, keyboardEvent) => {
}
});
$(document).on('click', previewButtonSelector, function(e) {
$(document).on('click', previewButtonSelector, function (e) {
e.preventDefault();
const $form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:show', [$form]);
});
$(document).on('click', writeButtonSelector, function(e) {
$(document).on('click', writeButtonSelector, function (e) {
e.preventDefault();
const $form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:hide', [$form]);
......
......@@ -98,9 +98,7 @@ export default class Shortcuts {
});
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-shortcuts-modal-trigger')
.off('click')
.on('click', this.onToggleHelp);
$('.js-shortcuts-modal-trigger').off('click').on('click', this.onToggleHelp);
if (shouldDisableShortcuts()) {
disableShortcuts();
......
......@@ -43,16 +43,14 @@ export default class BlobFileDropzone {
previewsContainer: '.dropzone-previews',
headers: csrf.headers,
init() {
this.on('processing', function() {
this.on('processing', function () {
this.options.url = form.attr('action');
});
this.on('addedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false);
dropzoneMessage.addClass(HIDDEN_CLASS);
$('.dropzone-alerts')
.html('')
.hide();
$('.dropzone-alerts').html('').hide();
});
this.on('removedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false);
......@@ -62,7 +60,7 @@ export default class BlobFileDropzone {
$('#modal-upload-blob').modal('hide');
visitUrl(response.filePath);
});
this.on('maxfilesexceeded', function(file) {
this.on('maxfilesexceeded', function (file) {
dropzoneMessage.addClass(HIDDEN_CLASS);
this.removeFile(file);
});
......@@ -74,9 +72,7 @@ export default class BlobFileDropzone {
},
// Override behavior of adding error underneath preview
error(file, errorMessage) {
const stripped = $('<div/>')
.html(errorMessage)
.text();
const stripped = $('<div/>').html(errorMessage).text();
$('.dropzone-alerts')
.html(sprintf(__('Error uploading file: %{stripped}'), { stripped }))
.show();
......
......@@ -98,7 +98,7 @@ export default {
</template>
<p>
<gl-sprintf :message="$options.i18n.bodyMessage">
<template #codeQualityLink="{content}">
<template #codeQualityLink="{ content }">
<gl-link :href="codeQualityLink" target="_blank" class="font-size-inherit">{{
content
}}</gl-link>
......@@ -106,12 +106,12 @@ export default {
</gl-sprintf>
</p>
<gl-sprintf :message="$options.i18n.helpMessage">
<template #beginnerLink="{content}">
<template #beginnerLink="{ content }">
<gl-link :href="$options.beginnerLink" target="_blank">
{{ content }}
</gl-link>
</template>
<template #exampleLink="{content}">
<template #exampleLink="{ content }">
<gl-link :href="exampleLink" target="_blank">
{{ content }}
</gl-link>
......
......@@ -82,9 +82,7 @@ export default Vue.extend({
});
$('.js-issue-board-sidebar', this.$el).each((i, el) => {
$(el)
.data('deprecatedJQueryDropdown')
.clearMenu();
$(el).data('deprecatedJQueryDropdown').clearMenu();
});
}
......
......@@ -65,9 +65,7 @@ export default {
this.loading = false;
};
this.loadIssues()
.then(loadingDone)
.catch(loadingDone);
this.loadIssues().then(loadingDone).catch(loadingDone);
} else if (!this.showAddIssuesModal) {
this.issues = [];
this.selectedIssues = [];
......@@ -83,9 +81,7 @@ export default {
this.filterLoading = false;
};
this.loadIssues(true)
.then(loadingDone)
.catch(loadingDone);
this.loadIssues(true).then(loadingDone).catch(loadingDone);
}
},
deep: true,
......
......@@ -40,7 +40,7 @@ $(document)
});
export default function initNewListDropdown() {
$('.js-new-board-list').each(function() {
$('.js-new-board-list').each(function () {
const $dropdownToggle = $(this);
const $dropdown = $dropdownToggle.closest('.dropdown');
new CreateLabelDropdown(
......
......@@ -212,11 +212,17 @@ export default {
listId,
},
})
.then(({ data: { destroyBoardList: { errors } } }) => {
if (errors.length > 0) {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
}
})
.then(
({
data: {
destroyBoardList: { errors },
},
}) => {
if (errors.length > 0) {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
}
},
)
.catch(() => {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
});
......
......@@ -24,7 +24,7 @@ export default class BuildArtifacts {
// eslint-disable-next-line class-methods-use-this
setupEntryClick() {
return $('.tree-holder').on('click', 'tr[data-link]', function() {
return $('.tree-holder').on('click', 'tr[data-link]', function () {
visitUrl(this.dataset.link, parseBoolean(this.dataset.externalLink));
});
}
......
......@@ -111,7 +111,7 @@ export default {
<gl-form-checkbox v-model="dryRun"
>{{ __('Simulate a pipeline created for the default branch') }}
<gl-link :href="pipelineSimulationHelpPagePath" target="_blank"
><gl-icon class="gl-text-blue-600" name="question-o"/></gl-link
><gl-icon class="gl-text-blue-600" name="question-o" /></gl-link
></gl-form-checkbox>
</div>
<gl-button data-testid="ci-lint-clear" @click="clear">{{ __('Clear') }}</gl-button>
......
......@@ -61,7 +61,7 @@ export default {
class="triggers-list"
responsive
>
<template #cell(token)="{item}">
<template #cell(token)="{ item }">
{{ item.token }}
<clipboard-button
v-if="item.hasTokenExposed"
......@@ -82,7 +82,7 @@ export default {
</gl-badge>
</div>
</template>
<template #cell(description)="{item}">
<template #cell(description)="{ item }">
<tooltip-on-truncate
:title="item.description"
truncate-target="child"
......@@ -92,7 +92,7 @@ export default {
<div class="gl-flex-fill-1 gl-text-truncate">{{ item.description }}</div>
</tooltip-on-truncate>
</template>
<template #cell(owner)="{item}">
<template #cell(owner)="{ item }">
<span class="trigger-owner sr-only">{{ item.owner.name }}</span>
<user-avatar-link
v-if="item.owner"
......@@ -102,11 +102,11 @@ export default {
:img-alt="item.owner.name"
/>
</template>
<template #cell(lastUsed)="{item}">
<template #cell(lastUsed)="{ item }">
<time-ago-tooltip v-if="item.lastUsed" :time="item.lastUsed" />
<span v-else>{{ __('Never') }}</span>
</template>
<template #cell(actions)="{item}">
<template #cell(actions)="{ item }">
<gl-button
:title="s__('Pipelines|Edit')"
icon="pencil"
......
......@@ -223,10 +223,7 @@ export default class VariableList {
getAllData() {
// Ignore the last empty row because we don't want to try persist
// a blank variable and run into validation problems.
const validRows = this.$container
.find('.js-row')
.toArray()
.slice(0, -1);
const validRows = this.$container.find('.js-row').toArray().slice(0, -1);
return validRows.map(rowEl => {
const resultant = {};
......
......@@ -461,7 +461,7 @@ export default {
)
"
>
<template #code="{content}">
<template #code="{ content }">
<code>{{ content }}</code>
</template>
<template #link="{ content }">
......
......@@ -254,9 +254,7 @@ export default {
<template #freeSpacePercentage>{{
totalCpuAndUsage(item.nodes).freeSpacePercentage
}}</template>
<template #percentSymbol
>%</template
>
<template #percentSymbol>%</template>
</gl-sprintf>
</span>
......@@ -277,9 +275,7 @@ export default {
<template #freeSpacePercentage>{{
totalMemoryAndUsage(item.nodes).freeSpacePercentage
}}</template>
<template #percentSymbol
>%</template
>
<template #percentSymbol>%</template>
</gl-sprintf>
</span>
......@@ -293,7 +289,7 @@ export default {
/>
</template>
<template #cell(cluster_type)="{value}">
<template #cell(cluster_type)="{ value }">
<gl-badge variant="muted">
{{ value }}
</gl-badge>
......
......@@ -56,15 +56,15 @@ export default class ImageFile {
let dragging = false;
const $body = $('body');
const $offsetEl = $el.parent();
const dragStart = function() {
const dragStart = function () {
dragging = true;
$body.css('user-select', 'none');
};
const dragStop = function() {
const dragStop = function () {
dragging = false;
$body.css('user-select', '');
};
const dragMove = function(e) {
const dragMove = function (e) {
const moveX = e.pageX || e.touches[0].pageX;
const left = moveX - ($offsetEl.offset().left + padding);
if (!dragging) return;
......@@ -73,11 +73,7 @@ export default class ImageFile {
};
// eslint-disable-next-line @gitlab/no-global-event-off
$el
.off('mousedown')
.off('touchstart')
.on('mousedown', dragStart)
.on('touchstart', dragStart);
$el.off('mousedown').off('touchstart').on('mousedown', dragStart).on('touchstart', dragStart);
// eslint-disable-next-line @gitlab/no-global-event-off
$body
......@@ -109,9 +105,9 @@ export default class ImageFile {
}
views = {
'two-up': function() {
'two-up': function () {
return $('.two-up.view .wrap', this.file).each((index, wrap) => {
$('img', wrap).each(function() {
$('img', wrap).each(function () {
const currentWidth = $(this).width();
if (currentWidth > availWidth / 2) {
return $(this).width(availWidth / 2);
......@@ -157,7 +153,7 @@ export default class ImageFile {
});
});
},
'onion-skin': function() {
'onion-skin': function () {
let maxHeight, maxWidth;
maxWidth = 0;
maxHeight = 0;
......
......@@ -85,10 +85,7 @@ export default class CommitsList {
// Update commits count in the previous commits header.
commitsCount += Number(
$(processedData)
.nextUntil('li.js-commit-header')
.first()
.find('li.commit').length,
$(processedData).nextUntil('li.js-commit-header').first().find('li.commit').length,
);
$commitsHeadersLast
......
......@@ -13,14 +13,10 @@ import 'bootstrap/js/dist/tab';
// custom jQuery functions
$.fn.extend({
disable() {
return $(this)
.prop('disabled', true)
.addClass('disabled');
return $(this).prop('disabled', true).addClass('disabled');
},
enable() {
return $(this)
.prop('disabled', false)
.removeClass('disabled');
return $(this).prop('disabled', false).removeClass('disabled');
},
});
......
......@@ -9,7 +9,7 @@ import { fixTitle } from '~/tooltips';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
export default function initCompareAutocomplete(limitTo = null, clickHandler = () => {}) {
$('.js-compare-dropdown').each(function() {
$('.js-compare-dropdown').each(function () {
const $dropdown = $(this);
const selected = $dropdown.data('selected');
const $dropdownContainer = $dropdown.closest('.dropdown');
......@@ -51,9 +51,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
.text(ref)
.attr('data-ref', ref);
if (ref.header != null) {
return $('<li />')
.addClass('dropdown-header')
.text(ref.header);
return $('<li />').addClass('dropdown-header').text(ref.header);
}
return $('<li />').append(link);
},
......
......@@ -43,7 +43,10 @@ export default class ContextualSidebar {
$(document).trigger('content.resize');
});
$(window).on('resize', debounce(() => this.render(), 100));
$(window).on(
'resize',
debounce(() => this.render(), 100),
);
}
// See documentation: https://design.gitlab.com/regions/navigation#contextual-navigation
......
......@@ -57,9 +57,7 @@ export default {
if (this.hasZone) {
this.isLoading = true;
this.fetchMachineTypes()
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
this.fetchMachineTypes().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
}
},
},
......
......@@ -99,9 +99,7 @@ export default {
created() {
this.isLoading = true;
this.fetchProjects()
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
this.fetchProjects().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
},
methods: {
...mapActions(['fetchProjects', 'setIsValidatingProjectBilling', 'validateProjectBilling']),
......@@ -175,9 +173,7 @@ export default {
<gl-sprintf :message="helpText">
<template #linkToBilling="{ content }">
<gl-link
:href="
'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral'
"
:href="'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral'"
target="_blank"
>{{ content }} <gl-icon name="external-link"
/></gl-link>
......
......@@ -46,9 +46,7 @@ export default {
if (!isValidating && this.projectHasBillingEnabled) {
this.isLoading = true;
this.fetchZones()
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
this.fetchZones().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
}
},
},
......
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