Commit c152d514 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 30 files: 2 of 8

Mandatory not to break master. Automatically created with prettier.
parent 26b68c70
......@@ -46,7 +46,7 @@ export default class CreateLabelDropdown {
addBinding() {
const self = this;
this.$colorSuggestions.on('click', function(e) {
this.$colorSuggestions.on('click', function (e) {
const $this = $(this);
self.addColorValue(e, $this);
});
......@@ -72,10 +72,7 @@ export default class CreateLabelDropdown {
e.stopPropagation();
this.$newColorField.val($this.data('color')).trigger('change');
this.$colorPreview
.css('background-color', $this.data('color'))
.parent()
.addClass('is-active');
this.$colorPreview.css('background-color', $this.data('color')).parent().addClass('is-active');
}
enableLabelCreateButton() {
......@@ -94,10 +91,7 @@ export default class CreateLabelDropdown {
this.$addList.prop('checked', this.addListDefault);
this.$colorPreview
.css('background-color', '')
.parent()
.removeClass('is-active');
this.$colorPreview.css('background-color', '').parent().removeClass('is-active');
}
saveLabel(e) {
......
......@@ -30,8 +30,6 @@ export default {
{{ time.seconds }} <span> {{ s__('Time|s') }} </span>
</template>
</template>
<template v-else>
--
</template>
<template v-else> -- </template>
</span>
</template>
......@@ -123,10 +123,7 @@ export class GitLabDropdown {
if ($(this.el).is('input')) {
currentIndex = -1;
} else {
$(selector, this.dropdown)
.first()
.find('a')
.addClass('is-focused');
$(selector, this.dropdown).first().find('a').addClass('is-focused');
currentIndex = 0;
}
}
......@@ -493,10 +490,7 @@ export class GitLabDropdown {
if (!this.options.multiSelect || el.hasClass('dropdown-clear-active')) {
this.dropdown.find(`.${ACTIVE_CLASS}`).removeClass(ACTIVE_CLASS);
if (!isInput) {
this.dropdown
.parent()
.find(`input[name='${fieldName}']`)
.remove();
this.dropdown.parent().find(`input[name='${fieldName}']`).remove();
}
}
if (field && field.length && value == null) {
......@@ -536,10 +530,7 @@ export class GitLabDropdown {
$(`input[name="${fieldName}"]`).remove();
}
const $input = $('<input>')
.attr('type', 'hidden')
.attr('name', fieldName)
.val(value);
const $input = $('<input>').attr('type', 'hidden').attr('name', fieldName).val(value);
if (this.options.inputId != null) {
$input.attr('id', this.options.inputId);
}
......@@ -678,9 +669,7 @@ export class GitLabDropdown {
toggleText = this.options.updateLabel;
}
return $(this.el)
.find('.dropdown-toggle-text')
.text(toggleText);
return $(this.el).find('.dropdown-toggle-text').text(toggleText);
}
// eslint-disable-next-line class-methods-use-this
......
......@@ -22,10 +22,7 @@ export class GitLabDropdownFilter {
// Clear click
e.preventDefault();
e.stopPropagation();
return this.input
.val('')
.trigger('input')
.focus();
return this.input.val('').trigger('input').focus();
});
// Key events
timeout = '';
......@@ -113,7 +110,7 @@ export class GitLabDropdownFilter {
const elements = this.options.elements();
if (searchText) {
// eslint-disable-next-line func-names
elements.each(function() {
elements.each(function () {
const $el = $(this);
const matches = fuzzaldrinPlus.match($el.text().trim(), searchText);
if (!$el.is('.dropdown-header')) {
......
......@@ -9,10 +9,7 @@ export class GitLabDropdownInput {
// Clear click
e.preventDefault();
e.stopPropagation();
return this.input
.val('')
.trigger('input')
.focus();
return this.input.val('').trigger('input').focus();
});
this.input
......@@ -31,10 +28,7 @@ export class GitLabDropdownInput {
.toLowerCase() // replace non alphanumeric
.replace(/(-)\1+/g, '-'); // replace repeated dashes
this.cb(this.options.fieldName, val, {}, true);
this.input
.closest('.dropdown')
.find('.dropdown-toggle-text')
.text(val);
this.input.closest('.dropdown').find('.dropdown-toggle-text').text(val);
});
}
......
......@@ -3,7 +3,7 @@ import { GitLabDropdown } from './gl_dropdown';
export default function initDeprecatedJQueryDropdown($el, opts) {
// eslint-disable-next-line func-names
return $el.each(function() {
return $el.each(function () {
if (!$.data(this, 'deprecatedJQueryDropdown')) {
$.data(this, 'deprecatedJQueryDropdown', new GitLabDropdown(this, opts));
}
......
......@@ -32,12 +32,7 @@ export default {
},
},
methods: {
updateStoreAfterDelete(
store,
{
data: { designManagementDelete },
},
) {
updateStoreAfterDelete(store, { data: { designManagementDelete } }) {
updateStoreAfterDesignsDelete(
store,
designManagementDelete,
......
......@@ -116,12 +116,7 @@ export default {
variables: {
id,
},
update(
store,
{
data: { todoMarkDone },
},
) {
update(store, { data: { todoMarkDone } }) {
const todoMarkDoneFirstError = (todoMarkDone.errors || [])[0];
if (todoMarkDoneFirstError) {
this.$emit('error', Error(todoMarkDoneFirstError));
......
......@@ -167,12 +167,7 @@ export default {
next();
},
methods: {
addImageDiffNoteToStore(
store,
{
data: { createImageDiffNote },
},
) {
addImageDiffNoteToStore(store, { data: { createImageDiffNote } }) {
updateStoreAfterAddImageDiffNote(
store,
createImageDiffNote,
......@@ -180,12 +175,7 @@ export default {
this.designVariables,
);
},
updateImageDiffNoteInStore(
store,
{
data: { repositionImageDiffNote },
},
) {
updateImageDiffNoteInStore(store, { data: { repositionImageDiffNote } }) {
return updateStoreAfterRepositionImageDiffNote(
store,
repositionImageDiffNote,
......
......@@ -187,12 +187,7 @@ export default {
.then(res => this.onUploadDesignDone(res))
.catch(() => this.onUploadDesignError());
},
afterUploadDesign(
store,
{
data: { designManagementUpload },
},
) {
afterUploadDesign(store, { data: { designManagementUpload } }) {
updateStoreAfterUploadDesign(store, designManagementUpload, this.projectQueryBody);
},
onUploadDesignDone(res) {
......
......@@ -13,13 +13,7 @@ export default [
name: DESIGN_ROUTE_NAME,
path: '/designs/:id',
component: DesignDetail,
beforeEnter(
{
params: { id },
},
_,
next,
) {
beforeEnter({ params: { id } }, _, next) {
if (typeof id === 'string') {
next();
}
......
......@@ -24,9 +24,7 @@ export default class Diff {
if (!tab || (tab && tab.dataset && tab.dataset.isLocked !== ''))
FilesCommentButton.init($diffFile);
const firstFile = $('.files')
.first()
.get(0);
const firstFile = $('.files').first().get(0);
const canCreateNote = firstFile && firstFile.hasAttribute('data-can-create-note');
$diffFile.each((index, file) => initImageDiffHelper.initImageDiff(file, canCreateNote));
......
......@@ -281,12 +281,7 @@ export default {
const id = window?.location?.hash;
if (id && id.indexOf('#note') !== 0) {
this.setHighlightedRow(
id
.split('diff-content')
.pop()
.slice(1),
);
this.setHighlightedRow(id.split('diff-content').pop().slice(1));
}
},
beforeCreate() {
......@@ -404,10 +399,7 @@ export default {
},
setDiscussions() {
requestIdleCallback(
() =>
this.assignDiscussionsToDiff()
.then(this.$nextTick)
.then(this.startTaskList),
() => this.assignDiscussionsToDiff().then(this.$nextTick).then(this.startTaskList),
{ timeout: 1000 },
);
},
......
......@@ -139,7 +139,7 @@ export default {
return !this.isCollapsed || this.automaticallyCollapsed;
},
showWarning() {
return this.isCollapsed && (this.automaticallyCollapsed && !this.viewDiffsFileByFile);
return this.isCollapsed && this.automaticallyCollapsed && !this.viewDiffsFileByFile;
},
showContent() {
return !this.isCollapsed && !this.isFileTooLarge;
......
......@@ -58,9 +58,9 @@ export default {
class="code diff-wrap-lines js-syntax-highlight text-file js-diff-inline-view"
>
<colgroup>
<col style="width: 50px;" />
<col style="width: 50px;" />
<col style="width: 8px;" />
<col style="width: 50px" />
<col style="width: 50px" />
<col style="width: 8px" />
<col />
</colgroup>
<tbody>
......
......@@ -57,11 +57,11 @@ export default {
class="code diff-wrap-lines js-syntax-highlight text-file"
>
<colgroup>
<col style="width: 50px;" />
<col style="width: 8px;" />
<col style="width: 50px" />
<col style="width: 8px" />
<col />
<col style="width: 50px;" />
<col style="width: 8px;" />
<col style="width: 50px" />
<col style="width: 8px" />
<col />
</colgroup>
<tbody>
......
......@@ -307,7 +307,8 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
const nextFile = state.diffFiles.find(
file =>
!file.renderIt &&
(file.viewer && (!isCollapsed(file) || file.viewer.name !== diffViewerModes.text)),
file.viewer &&
(!isCollapsed(file) || file.viewer.name !== diffViewerModes.text),
);
if (nextFile) {
......
......@@ -138,7 +138,10 @@ export const fileLineCoverage = state => (file, line) => {
* @returns {number}
*/
export const currentDiffIndex = state =>
Math.max(0, state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId));
Math.max(
0,
state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId),
);
export const diffLines = state => (file, unifiedDiffComponents) => {
if (!unifiedDiffComponents && state.diffViewType === INLINE_DIFF_VIEW_TYPE) {
......
......@@ -2,7 +2,7 @@
import { ACTIVE_CLASS } from './constants';
const Keyboard = function() {
const Keyboard = function () {
var currentKey;
var currentFocus;
var isUpArrow = false;
......
......@@ -46,7 +46,7 @@ const Ajax = {
.then(data => self._loadData(data, config, self))
.catch(config.onError);
},
destroy: function() {
destroy: function () {
this.destroyed = true;
},
};
......
......@@ -2,7 +2,7 @@
import AjaxCache from '../../lib/utils/ajax_cache';
const AjaxFilter = {
init: function(hook) {
init: function (hook) {
this.destroyed = false;
this.hook = hook;
this.notLoading();
......@@ -93,9 +93,9 @@ const AjaxFilter = {
list.currentIndex = 0;
},
buildParams: function(params) {
buildParams: function (params) {
if (!params) return '';
var paramsArray = Object.keys(params).map(function(param) {
var paramsArray = Object.keys(params).map(function (param) {
return param + '=' + (params[param] || '');
});
return '?' + paramsArray.join('&');
......
/* eslint-disable */
const Filter = {
keydown: function(e) {
keydown: function (e) {
if (this.destroyed) return;
var hiddenCount = 0;
......@@ -21,22 +21,22 @@ const Filter = {
if (config && config.filterFunction && typeof config.filterFunction === 'function') {
filterFunction = config.filterFunction;
} else {
filterFunction = function(o) {
filterFunction = function (o) {
// cheap string search
o.droplab_hidden = o[config.template].toLowerCase().indexOf(value) === -1;
return o;
};
}
dataHiddenCount = data.filter(function(o) {
dataHiddenCount = data.filter(function (o) {
return !o.droplab_hidden;
}).length;
matches = data.map(function(o) {
matches = data.map(function (o) {
return filterFunction(o, value);
});
hiddenCount = matches.filter(function(o) {
hiddenCount = matches.filter(function (o) {
return !o.droplab_hidden;
}).length;
......
......@@ -5,12 +5,7 @@ import { DATA_TRIGGER, DATA_DROPDOWN, TEMPLATE_REGEX } from './constants';
const utils = {
toCamelCase(attr) {
return this.camelize(
attr
.split('-')
.slice(1)
.join(' '),
);
return this.camelize(attr.split('-').slice(1).join(' '));
},
template(templateString, data) {
......
......@@ -219,12 +219,8 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
const caretStart = textarea.selectionStart;
const caretEnd = textarea.selectionEnd;
const textEnd = $(child).val().length;
const beforeSelection = $(child)
.val()
.substring(0, caretStart);
const afterSelection = $(child)
.val()
.substring(caretEnd, textEnd);
const beforeSelection = $(child).val().substring(0, caretStart);
const afterSelection = $(child).val().substring(caretEnd, textEnd);
$(child).val(beforeSelection + formattedText + afterSelection);
textarea.setSelectionRange(caretStart + formattedText.length, caretEnd + formattedText.length);
textarea.style.height = `${textarea.scrollHeight}px`;
......@@ -289,10 +285,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
form.find('.markdown-selector').click(function onMarkdownClick(e) {
e.preventDefault();
$(this)
.closest('.gfm-form')
.find('.div-dropzone')
.click();
$(this).closest('.gfm-form').find('.div-dropzone').click();
formTextarea.focus();
});
......
......@@ -197,9 +197,7 @@ export default class DueDateSelectors {
$('.js-clear-due-date,.js-clear-start-date').on('click', e => {
e.preventDefault();
const calendar = $(e.target)
.siblings('.datepicker')
.data('pikaday');
const calendar = $(e.target).siblings('.datepicker').data('pikaday');
calendar.setDate(null);
});
}
......
......@@ -22,9 +22,7 @@ export class CiSchemaExtension extends EditorLiteExtension {
.replace(':project_path', projectPath)
.replace(':ref', ref)
.replace(':filename', EXTENSION_CI_SCHEMA_FILE_NAME_MATCH);
const modelFileName = this.getModel()
.uri.path.split('/')
.pop();
const modelFileName = this.getModel().uri.path.split('/').pop();
registerSchema({
uri: ciSchemaUri,
......
......@@ -242,8 +242,9 @@ export function getEmojiInfo(query) {
export function emojiFallbackImageSrc(inputName) {
const { name } = getEmojiInfo(inputName);
return `${gon.asset_host || ''}${gon.relative_url_root ||
''}/-/emojis/${EMOJI_VERSION}/${name}.png`;
return `${gon.asset_host || ''}${
gon.relative_url_root || ''
}/-/emojis/${EMOJI_VERSION}/${name}.png`;
}
export function emojiImageTag(name, src) {
......
......@@ -100,7 +100,7 @@ export default {
/>
<gl-sprintf v-if="errorFn" :message="__('%{spanStart}in%{spanEnd} %{errorFn}')">
<template #span="{content}">
<template #span="{ content }">
<span class="gl-text-gray-200">{{ content }}&nbsp;</span>
</template>
<template #errorFn>
......@@ -109,7 +109,7 @@ export default {
</gl-sprintf>
<gl-sprintf :message="__('%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}')">
<template #span="{content}">
<template #span="{ content }">
<span class="gl-text-gray-200">{{ content }}&nbsp;</span>
</template>
<template #errorLine>
......
......@@ -30,7 +30,7 @@ export default {
},
computed: {
strategyComponent() {
return STRATEGIES[(this.strategy?.name)];
return STRATEGIES[this.strategy?.name];
},
},
methods: {
......
......@@ -74,12 +74,7 @@ export default {
state.isRotating = true;
state.hasRotateError = false;
},
[types.RECEIVE_ROTATE_INSTANCE_ID_SUCCESS](
state,
{
data: { token },
},
) {
[types.RECEIVE_ROTATE_INSTANCE_ID_SUCCESS](state, { data: { token } }) {
state.isRotating = false;
state.instanceId = token;
state.hasRotateError = false;
......
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