Commit 07f5bc94 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 30 files: 4 of 8

Mandatory not to break master. Automatically created with prettier.
parent 888002a6
......@@ -12,13 +12,9 @@ export default class Members {
addListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-member-update-control')
.off('change')
.on('change', this.formSubmit.bind(this));
$('.js-member-update-control').off('change').on('change', this.formSubmit.bind(this));
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-edit-member-form')
.off('ajax:success')
.on('ajax:success', this.formSuccess.bind(this));
$('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this));
disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change');
}
......
......@@ -60,19 +60,28 @@ import { __ } from '~/locale';
const DataPromise = axios.get(this.file.content_path);
Promise.all([EditorPromise, DataPromise])
.then(([{ default: EditorLite }, { data: { content, new_path: path } }]) => {
const contentEl = this.$el.querySelector('.editor');
.then(
([
{ default: EditorLite },
{
data: { content, new_path: path },
},
]) => {
const contentEl = this.$el.querySelector('.editor');
this.originalContent = content;
this.fileLoaded = true;
this.originalContent = content;
this.fileLoaded = true;
this.editor = new EditorLite().createInstance({
el: contentEl,
blobPath: path,
blobContent: content,
});
this.editor.onDidChangeModelContent(debounce(this.saveDiffResolution.bind(this), 250));
})
this.editor = new EditorLite().createInstance({
el: contentEl,
blobPath: path,
blobContent: content,
});
this.editor.onDidChangeModelContent(
debounce(this.saveDiffResolution.bind(this), 250),
);
},
)
.catch(() => {
flash(__('An error occurred while loading the file'));
});
......
......@@ -47,11 +47,11 @@ function MergeRequest(opts) {
}
// Local jQuery finder
MergeRequest.prototype.$ = function(selector) {
MergeRequest.prototype.$ = function (selector) {
return this.$el.find(selector);
};
MergeRequest.prototype.initTabs = function() {
MergeRequest.prototype.initTabs = function () {
if (window.mrTabs) {
window.mrTabs.unbindEvents();
}
......@@ -59,12 +59,12 @@ MergeRequest.prototype.initTabs = function() {
window.mrTabs = new MergeRequestTabs(this.opts);
};
MergeRequest.prototype.showAllCommits = function() {
MergeRequest.prototype.showAllCommits = function () {
this.$('.first-commits').remove();
return this.$('.all-commits').removeClass('hide');
};
MergeRequest.prototype.initMRBtnListeners = function() {
MergeRequest.prototype.initMRBtnListeners = function () {
const _this = this;
const draftToggles = document.querySelectorAll('.js-draft-toggle-button');
......@@ -99,7 +99,7 @@ MergeRequest.prototype.initMRBtnListeners = function() {
});
}
return $('.btn-close, .btn-reopen').on('click', function(e) {
return $('.btn-close, .btn-reopen').on('click', function (e) {
const $this = $(this);
const shouldSubmit = $this.hasClass('btn-comment');
if (shouldSubmit && $this.data('submitted')) {
......@@ -117,7 +117,7 @@ MergeRequest.prototype.initMRBtnListeners = function() {
});
};
MergeRequest.prototype.submitNoteForm = function(form, $button) {
MergeRequest.prototype.submitNoteForm = function (form, $button) {
const noteText = form.find('textarea.js-note-text').val();
if (noteText.trim().length > 0) {
form.submit();
......@@ -126,7 +126,7 @@ MergeRequest.prototype.submitNoteForm = function(form, $button) {
}
};
MergeRequest.prototype.initCommitMessageListeners = function() {
MergeRequest.prototype.initCommitMessageListeners = function () {
$(document).on('click', 'a.js-with-description-link', e => {
const textarea = $('textarea.js-commit-message');
e.preventDefault();
......@@ -146,7 +146,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() {
});
};
MergeRequest.setStatusBoxToMerged = function() {
MergeRequest.setStatusBoxToMerged = function () {
$('.detail-page-header .status-box')
.removeClass('status-box-open')
.addClass('status-box-mr-merged')
......@@ -154,20 +154,20 @@ MergeRequest.setStatusBoxToMerged = function() {
.text(__('Merged'));
};
MergeRequest.decreaseCounter = function(by = 1) {
MergeRequest.decreaseCounter = function (by = 1) {
const $el = $('.js-merge-counter');
const count = Math.max(parseInt($el.text().replace(/[^\d]/, ''), 10) - by, 0);
$el.text(addDelimiter(count));
};
MergeRequest.hideCloseButton = function() {
MergeRequest.hideCloseButton = function () {
const el = document.querySelector('.merge-request .js-issuable-actions');
// Dropdown for mobile screen
el.querySelector('li.js-close-item').classList.add('hidden');
};
MergeRequest.toggleDraftStatus = function(title, isReady) {
MergeRequest.toggleDraftStatus = function (title, isReady) {
if (isReady) {
createFlash(__('The merge request can now be merged.'), 'notice');
}
......
......@@ -92,11 +92,7 @@ export default class MiniPipelineGraph {
})
.catch(() => {
this.toggleLoading(button);
if (
$(button)
.parent()
.hasClass('open')
) {
if ($(button).parent().hasClass('open')) {
$(button).dropdown('toggle');
}
flash(__('An error occurred while fetching the builds.'), 'alert');
......
......@@ -146,7 +146,7 @@ export default {
)
"
>
<template #code="{content}">
<template #code="{ content }">
<code>{{ content }}</code>
</template>
</gl-sprintf>
......
......@@ -243,11 +243,11 @@ export default class BranchGraph {
})
.click(() => window.open(options.commit_url.replace('%s', commit.id), '_blank'))
.hover(
function() {
function () {
this.tooltip = r.commitTooltip(x + 5, y, commit);
return top.push(this.tooltip.insertBefore(this));
},
function() {
function () {
return this.tooltip && this.tooltip.remove() && delete this.tooltip;
},
);
......
......@@ -53,13 +53,13 @@ export default class NewBranchForm {
const { indexOf } = [];
this.branchNameError.empty();
const unique = function(values, value) {
const unique = function (values, value) {
if (indexOf.call(values, value) === -1) {
values.push(value);
}
return values;
};
const formatter = function(values, restriction) {
const formatter = function (values, restriction) {
const formatted = values.map(value => {
switch (false) {
case !/\s/.test(value):
......
......@@ -108,10 +108,7 @@ export default class Notes {
// We are in the Merge Requests page so we need another edit form for Changes tab
if (getPagePath(1) === 'merge_requests') {
$('.note-edit-form')
.clone()
.addClass('mr-note-edit-form')
.insertAfter('.note-edit-form');
$('.note-edit-form').clone().addClass('mr-note-edit-form').insertAfter('.note-edit-form');
}
const hash = getLocationHash();
......@@ -427,12 +424,7 @@ export default class Notes {
} else if (Notes.isUpdatedNote(noteEntity, $note)) {
// The server can send the same update multiple times so we need to make sure to only update once per actual update.
const isEditing = $note.hasClass('is-editing');
const initialContent = normalizeNewlines(
$note
.find('.original-note-content')
.text()
.trim(),
);
const initialContent = normalizeNewlines($note.find('.original-note-content').text().trim());
const $textarea = $note.find('.js-note-text');
const currentContent = $textarea.val();
// There can be CRLF vs LF mismatches if we don't sanitize and compare the same way
......@@ -541,14 +533,8 @@ export default class Notes {
form.find('.js-errors').remove();
// reset text and preview
form.find('.js-md-write-button').click();
form
.find('.js-note-text')
.val('')
.trigger('input');
form
.find('.js-note-text')
.data('autosave')
.reset();
form.find('.js-note-text').val('').trigger('input');
form.find('.js-note-text').data('autosave').reset();
const event = document.createEvent('Event');
event.initEvent('autosize:update', true, false);
......@@ -690,10 +676,7 @@ export default class Notes {
}
checkContentToAllowEditing($el) {
const initialContent = $el
.find('.original-note-content')
.text()
.trim();
const initialContent = $el.find('.original-note-content').text().trim();
const currentContent = $el.find('.js-note-text').val();
let isAllowed = true;
......@@ -877,10 +860,7 @@ export default class Notes {
const form = this.cleanForm(this.formClone.clone());
const replyLink = $(target).closest('.js-discussion-reply-button');
// insert the form after the button
replyLink
.closest('.discussion-reply-holder')
.hide()
.after(form);
replyLink.closest('.discussion-reply-holder').hide().after(form);
// show the form
return this.setupDiscussionNoteForm(replyLink, form);
}
......@@ -1069,10 +1049,7 @@ export default class Notes {
const row = form.closest('tr');
const glForm = form.data('glForm');
glForm.destroy();
form
.find('.js-note-text')
.data('autosave')
.reset();
form.find('.js-note-text').data('autosave').reset();
// show the reply button (will only work for replies)
form.prev('.discussion-reply-holder').show();
if (row.is('.js-temp-notes-holder')) {
......@@ -1181,16 +1158,10 @@ export default class Notes {
this.glForm = new GLForm($editForm.find('form'), this.enableGFM);
$editForm
.find('form')
.attr('action', `${postUrl}?html=true`)
.attr('data-remote', 'true');
$editForm.find('form').attr('action', `${postUrl}?html=true`).attr('data-remote', 'true');
$editForm.find('.js-form-target-id').val(targetId);
$editForm.find('.js-form-target-type').val(targetType);
$editForm
.find('.js-note-text')
.focus()
.val(originalContent);
$editForm.find('.js-note-text').focus().val(originalContent);
$editForm.find('.js-md-write-button').trigger('click');
$editForm.find('.referenced-users').hide();
}
......@@ -1306,9 +1277,7 @@ export default class Notes {
* intrusive.
*/
collapseLongCommitList() {
const systemNotes = $('#notes-list')
.find('li.system-note')
.has('ul');
const systemNotes = $('#notes-list').find('li.system-note').has('ul');
$.each(systemNotes, (index, systemNote) => {
const $systemNote = $(systemNote);
......@@ -1365,11 +1334,7 @@ export default class Notes {
// There can be CRLF vs LF mismatches if we don't sanitize and compare the same way
const sanitizedNoteEntityText = normalizeNewlines(noteEntity.note.trim());
const currentNoteText = normalizeNewlines(
$note
.find('.original-note-content')
.first()
.text()
.trim(),
$note.find('.original-note-content').first().text().trim(),
);
return sanitizedNoteEntityText !== currentNoteText;
}
......@@ -1545,10 +1510,7 @@ export default class Notes {
let $form = $submitBtn.parents('form');
const $closeBtn = $form.find('.js-note-target-close');
const isDiscussionNote =
$submitBtn
.parent()
.find('li.droplab-item-selected')
.attr('id') === 'discussion';
$submitBtn.parent().find('li.droplab-item-selected').attr('id') === 'discussion';
const isMainForm = $form.hasClass('js-main-target-form');
const isDiscussionForm = $form.hasClass('js-discussion-note-form');
const isDiscussionResolve = $submitBtn.hasClass('js-comment-resolve-button');
......
......@@ -77,8 +77,8 @@ export default {
<div
v-if="
!hideJumpToNextUnresolvedInThreads &&
discussion.resolvable &&
shouldShowJumpToNextDiscussion
discussion.resolvable &&
shouldShowJumpToNextDiscussion
"
class="btn-group discussion-actions ml-sm-2"
>
......
......@@ -193,8 +193,7 @@ export default {
},
canSuggest() {
return (
this.getNoteableData.can_receive_suggestion &&
(this.line && this.line.can_receive_suggestion)
this.getNoteableData.can_receive_suggestion && this.line && this.line.can_receive_suggestion
);
},
changedCommentText() {
......
......@@ -12,9 +12,7 @@ export default function notificationsDropdown() {
}
const notificationLevel = $(this).data('notificationLevel');
const form = $(this)
.parents('.notification-form')
.first();
const form = $(this).parents('.notification-form').first();
form.find('.js-notification-loading').toggleClass('spinner');
if (form.hasClass('no-label')) {
......@@ -29,9 +27,7 @@ export default function notificationsDropdown() {
const data = e.detail[0];
if (data.saved) {
$(e.currentTarget)
.closest('.js-notification-dropdown')
.replaceWith(data.html);
$(e.currentTarget).closest('.js-notification-dropdown').replaceWith(data.html);
} else {
Flash(__('Failed to save new settings'), 'alert');
}
......
......@@ -90,7 +90,7 @@ export default {
</gl-link>
</template>
<template #cell(commit)="{item}">
<template #cell(commit)="{ item }">
<gl-link
:href="item.pipeline.project.commit_url"
class="gl-text-gray-500"
......
......@@ -110,7 +110,7 @@ export default {
<template #description>
<gl-sprintf v-if="filterQuery" :message="$options.i18n.widenFilters" />
<gl-sprintf v-else :message="$options.i18n.noResults">
<template #noPackagesLink="{content}">
<template #noPackagesLink="{ content }">
<gl-link :href="emptyListHelpUrl" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
......
......@@ -4,7 +4,7 @@ import Profile from '~/profile/profile';
document.addEventListener('DOMContentLoaded', () => {
// eslint-disable-next-line func-names
$(document).on('input.ssh_key', '#key_key', function() {
$(document).on('input.ssh_key', '#key_key', function () {
const $title = $('#key_title');
const comment = $(this)
.val()
......
......@@ -161,9 +161,7 @@ export default {
<template #coveragePercentage>
{{ coveragePercentage }}
</template>
<template #percentSymbol>
%
</template>
<template #percentSymbol> % </template>
</gl-sprintf>
</template>
</gl-area-chart>
......
import ZenMode from '~/zen_mode';
import GLForm from '~/gl_form';
export default function($formEl) {
export default function ($formEl) {
new ZenMode(); // eslint-disable-line no-new
new GLForm($formEl); // eslint-disable-line no-new
}
......@@ -16,7 +16,7 @@ import initInviteMemberModal from '~/invite_member/init_invite_member_modal';
import { IssuableType } from '~/issuable_show/constants';
export default function() {
export default function () {
const initialDataEl = document.getElementById('js-issuable-app');
const { issueType, ...issuableData } = parseIssuableData(initialDataEl);
......
......@@ -29,9 +29,7 @@ export default mrNewCompareNode => {
$(mrNewCompareNode).find('.js-source-loading'),
$(mrNewCompareNode).find('.mr_source_commit'),
{
ref: $(mrNewCompareNode)
.find("input[name='merge_request[source_branch]']")
.val(),
ref: $(mrNewCompareNode).find("input[name='merge_request[source_branch]']").val(),
},
);
const updateTargetBranchCommitList = () =>
......@@ -43,9 +41,7 @@ export default mrNewCompareNode => {
target_project_id: $(mrNewCompareNode)
.find("input[name='merge_request[target_project_id]']")
.val(),
ref: $(mrNewCompareNode)
.find("input[name='merge_request[target_branch]']")
.val(),
ref: $(mrNewCompareNode).find("input[name='merge_request[target_branch]']").val(),
},
);
initCompareAutocomplete('branches', $dropdown => {
......
......@@ -8,7 +8,7 @@ import loadAwardsHandler from '~/awards_handler';
import initInviteMemberTrigger from '~/invite_member/init_invite_member_trigger';
import initInviteMemberModal from '~/invite_member/init_invite_member_modal';
export default function() {
export default function () {
new ZenMode(); // eslint-disable-line no-new
initIssuableSidebar();
initPipelines();
......
......@@ -125,7 +125,7 @@ export default {
:data-testid="option.value"
>
<gl-sprintf v-if="option.link" :message="option.text">
<template #link="{content}">
<template #link="{ content }">
<gl-link :href="option.link" target="_blank" class="gl-font-sm">
{{ content }}
</gl-link>
......
......@@ -18,34 +18,26 @@ export default class Project {
// Ref switcher
if (document.querySelector('.js-project-refs-dropdown')) {
Project.initRefSwitcher();
$('.project-refs-select').on('change', function() {
return $(this)
.parents('form')
.trigger('submit');
$('.project-refs-select').on('change', function () {
return $(this).parents('form').trigger('submit');
});
}
$('.hide-no-ssh-message').on('click', function(e) {
$('.hide-no-ssh-message').on('click', function (e) {
Cookies.set('hide_no_ssh_message', 'false');
$(this)
.parents('.no-ssh-key-message')
.remove();
$(this).parents('.no-ssh-key-message').remove();
return e.preventDefault();
});
$('.hide-no-password-message').on('click', function(e) {
$('.hide-no-password-message').on('click', function (e) {
Cookies.set('hide_no_password_message', 'false');
$(this)
.parents('.no-password-message')
.remove();
$(this).parents('.no-password-message').remove();
return e.preventDefault();
});
$('.hide-auto-devops-implicitly-enabled-banner').on('click', function(e) {
$('.hide-auto-devops-implicitly-enabled-banner').on('click', function (e) {
const projectId = $(this).data('project-id');
const cookieKey = `hide_auto_devops_implicitly_enabled_banner_${projectId}`;
Cookies.set(cookieKey, 'false');
$(this)
.parents('.auto-devops-implicitly-enabled-banner')
.remove();
$(this).parents('.auto-devops-implicitly-enabled-banner').remove();
return e.preventDefault();
});
......@@ -67,7 +59,7 @@ export default class Project {
refLink.href = '#';
return $('.js-project-refs-dropdown').each(function() {
return $('.js-project-refs-dropdown').each(function () {
const $dropdown = $(this);
const selected = $dropdown.data('selected');
const fieldName = $dropdown.data('fieldName');
......
......@@ -354,18 +354,21 @@ export default {
<option
:value="visibilityOptions.PRIVATE"
:disabled="!visibilityAllowed(visibilityOptions.PRIVATE)"
>{{ s__('ProjectSettings|Private') }}</option
>
{{ s__('ProjectSettings|Private') }}
</option>
<option
:value="visibilityOptions.INTERNAL"
:disabled="!visibilityAllowed(visibilityOptions.INTERNAL)"
>{{ s__('ProjectSettings|Internal') }}</option
>
{{ s__('ProjectSettings|Internal') }}
</option>
<option
:value="visibilityOptions.PUBLIC"
:disabled="!visibilityAllowed(visibilityOptions.PUBLIC)"
>{{ s__('ProjectSettings|Public') }}</option
>
{{ s__('ProjectSettings|Public') }}
</option>
</select>
<gl-icon
name="chevron-down"
......
......@@ -3,10 +3,7 @@ import { initRemoveTag } from '../remove_tag';
document.addEventListener('DOMContentLoaded', () => {
initRemoveTag({
onDelete: path => {
document
.querySelector(`[data-path="${path}"]`)
.closest('.js-tag-list')
.remove();
document.querySelector(`[data-path="${path}"]`).closest('.js-tag-list').remove();
},
});
});
......@@ -16,16 +16,12 @@ export default class Search {
}
eventListeners() {
$(document)
.off('keyup', this.searchInput)
.on('keyup', this.searchInput, this.searchKeyUp);
$(document).off('keyup', this.searchInput).on('keyup', this.searchInput, this.searchKeyUp);
$(document)
.off('click', this.searchClear)
.on('click', this.searchClear, this.clearSearchField.bind(this));
$('a.js-search-clear')
.off('click', this.clearSearchFilter)
.on('click', this.clearSearchFilter);
$('a.js-search-clear').off('click', this.clearSearchFilter).on('click', this.clearSearchFilter);
}
static submitSearch() {
......@@ -42,10 +38,7 @@ export default class Search {
}
clearSearchField() {
return $(this.searchInput)
.val('')
.trigger('keyup')
.focus();
return $(this.searchInput).val('').trigger('keyup').focus();
}
// We need to manually follow the link on the anchors
......
......@@ -42,11 +42,7 @@ function formatTooltipText({ date, count }) {
return `${contribText}<br />${dateDayName} ${dateText}`;
}
const initColorKey = () =>
d3
.scaleLinear()
.range(['#acd5f2', '#254e77'])
.domain([0, 3]);
const initColorKey = () => d3.scaleLinear().range(['#acd5f2', '#254e77']).domain([0, 3]);
export default class ActivityCalendar {
constructor(
......@@ -291,10 +287,7 @@ export default class ActivityCalendar {
this.colorKey(2),
this.colorKey(3),
];
return d3
.scaleThreshold()
.domain([0, 10, 20, 30])
.range(colorRange);
return d3.scaleThreshold().domain([0, 10, 20, 30]).range(colorRange);
}
clickDay(stamp) {
......
......@@ -11,9 +11,7 @@ function initUserProfile(action) {
$('.hide-project-limit-message').on('click', e => {
e.preventDefault();
Cookies.set('hide_project_limit_message', 'false');
$(this)
.parents('.project-limit-message')
.remove();
$(this).parents('.project-limit-message').remove();
});
}
......
......@@ -103,7 +103,7 @@ export default {
data-testid="ci-lint-status"
>{{ status.text }}
<gl-sprintf :message="$options.includesText">
<template #code="{content}">
<template #code="{ content }">
<code>
{{ content }}
</code>
......
......@@ -151,8 +151,7 @@ export default {
:href="detailsPath"
:title="tooltipText"
:class="jobClasses"
class="js-pipeline-graph-job-link qa-job-link menu-item gl-text-gray-900 gl-active-text-decoration-none
gl-focus-text-decoration-none gl-hover-text-decoration-none"
class="js-pipeline-graph-job-link qa-job-link menu-item gl-text-gray-900 gl-active-text-decoration-none gl-focus-text-decoration-none gl-hover-text-decoration-none"
data-testid="job-with-link"
@click.stop="hideTooltips"
@mouseout="hideTooltips"
......
......@@ -36,16 +36,10 @@ export const generateLinksData = ({ links }, containerID) => {
// positioned in the center of the job node by adding half the height
// of the job pill.
const paddingLeft = Number(
window
.getComputedStyle(containerEl, null)
.getPropertyValue('padding-left')
.replace('px', ''),
window.getComputedStyle(containerEl, null).getPropertyValue('padding-left').replace('px', ''),
);
const paddingTop = Number(
window
.getComputedStyle(containerEl, null)
.getPropertyValue('padding-top')
.replace('px', ''),
window.getComputedStyle(containerEl, null).getPropertyValue('padding-top').replace('px', ''),
);
const sourceNodeX = sourceNodeCoordinates.right - containerCoordinates.x - paddingLeft;
......
......@@ -113,7 +113,7 @@ export default {
)
"
>
<template #strong="{content}">
<template #strong="{ content }">
<b>{{ content }}</b>
</template>
</gl-sprintf>
......
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