Commit 888002a6 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 30 files: 3 of 8

Mandatory not to break master. Automatically created with prettier.
parent c152d514
......@@ -200,8 +200,9 @@ export default class AvailableDropdownMappings {
}
getMergeRequestTargetBranchesEndpoint() {
const endpoint = `${gon.relative_url_root ||
''}/autocomplete/merge_request_target_branches.json`;
const endpoint = `${
gon.relative_url_root || ''
}/autocomplete/merge_request_target_branches.json`;
const params = {
group_id: this.getGroupId(),
......
......@@ -193,7 +193,8 @@ export default class FilteredSearchVisualTokens {
});
} else if (
!isLastVisualTokenValid &&
(lastVisualToken && !lastVisualToken.querySelector('.operator'))
lastVisualToken &&
!lastVisualToken.querySelector('.operator')
) {
const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container');
tokensContainer.removeChild(lastVisualToken);
......
......@@ -285,10 +285,7 @@ class GfmAutoComplete {
...this.getDefaultCallbacks(),
beforeSave: membersBeforeSave,
matcher(flag, subtext) {
const subtextNodes = subtext
.split(/\n+/g)
.pop()
.split(GfmAutoComplete.regexSubtext);
const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
// Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands.
command = subtextNodes.find(node => {
......@@ -465,10 +462,7 @@ class GfmAutoComplete {
}));
},
matcher(flag, subtext) {
const subtextNodes = subtext
.split(/\n+/g)
.pop()
.split(GfmAutoComplete.regexSubtext);
const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
// Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands.
command = subtextNodes.find(node => {
......
......@@ -108,14 +108,10 @@ export default class GLForm {
addEventListeners() {
this.textarea.on('focus', function focusTextArea() {
$(this)
.closest('.md-area')
.addClass('is-focused');
$(this).closest('.md-area').addClass('is-focused');
});
this.textarea.on('blur', function blurTextArea() {
$(this)
.closest('.md-area')
.removeClass('is-focused');
$(this).closest('.md-area').removeClass('is-focused');
});
}
......
......@@ -126,7 +126,7 @@ export default {
/>
<div
:class="{ 'd-sm-flex': !group.isChildrenLoading }"
class="avatar-container rect-avatar s32 d-none flex-grow-0 flex-shrink-0 "
class="avatar-container rect-avatar s32 d-none flex-grow-0 flex-shrink-0"
>
<a :href="group.relativePath" class="no-expand">
<img
......
......@@ -65,10 +65,7 @@ export default class GroupFilterableList extends FilterableList {
setDefaultFilterOption() {
const defaultOption = $.trim(
this.$dropdown
.find('.dropdown-menu li.js-filter-sort-order a')
.first()
.text(),
this.$dropdown.find('.dropdown-menu li.js-filter-sort-order a').first().text(),
);
this.$dropdown.find('.dropdown-label').text(defaultOption);
}
......
......@@ -31,9 +31,7 @@ export default {
},
removeDropdownListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off
$(this.$refs.dropdown)
.off('show.bs.dropdown')
.off('hide.bs.dropdown');
$(this.$refs.dropdown).off('show.bs.dropdown').off('hide.bs.dropdown');
},
showDropdown() {
this.isVisibleDropdown = true;
......
......@@ -50,5 +50,10 @@ export function getRulesWithTraversal(filePath, getFileContent) {
return Promise.all(
editorconfigPaths.map(path => getFileContent(path).then(content => ({ path, content }))),
).then(results => getRulesWithConfigs(filePath, results.filter(x => x.content)));
).then(results =>
getRulesWithConfigs(
filePath,
results.filter(x => x.content),
),
);
}
......@@ -11,7 +11,11 @@ const conf = {
lineComment: '//',
blockComment: ['/*', '*/'],
},
brackets: [['{', '}'], ['[', ']'], ['(', ')']],
brackets: [
['{', '}'],
['[', ']'],
['(', ')'],
],
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
......@@ -161,7 +165,11 @@ const language = {
[/\/\/.*$/, 'comment'],
[/#.*$/, 'comment'],
],
comment: [[/[^\/*]+/, 'comment'], [/\*\//, 'comment', '@pop'], [/[\/*]/, 'comment']],
comment: [
[/[^\/*]+/, 'comment'],
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment'],
],
string: [
[/\$\{/, { token: 'delimiter', next: '@stringExpression' }],
[/[^\\"\$]+/, 'string'],
......
......@@ -37,7 +37,13 @@ const conf = {
blockComment: ['{{!--', '--}}'],
},
brackets: [['<!--', '-->'], ['<', '>'], ['{{', '}}'], ['{', '}'], ['(', ')']],
brackets: [
['<!--', '-->'],
['<', '>'],
['{{', '}}'],
['{', '}'],
['(', ')'],
],
autoClosingPairs: [
{ open: '{', close: '}' },
......
......@@ -254,12 +254,7 @@ export function extractMarkdownImagesFromEntries(mdFile, entries) {
const imageContent = entries[imagePath]?.content || entries[imagePath]?.raw;
if (!isAbsolute(path) && imageContent) {
const ext = path.includes('.')
? path
.split('.')
.pop()
.trim()
: 'jpeg';
const ext = path.includes('.') ? path.split('.').pop().trim() : 'jpeg';
const src = `data:image/${ext};base64,${imageContent}`;
i += 1;
const key = `{{${prefix}${i}}}`;
......
......@@ -154,12 +154,7 @@ export function getFileEOL(content = '') {
*/
export function addNumericSuffix(filename, randomize = false) {
return filename.replace(/([ _-]?)(\d*)(\..+?$|$)/, (_, before, number, after) => {
const n = randomize
? Math.random()
.toString()
.substring(2, 7)
.slice(-5)
: Number(number) + 1;
const n = randomize ? Math.random().toString().substring(2, 7).slice(-5) : Number(number) + 1;
return `${before || '-'}${n}${after}`;
});
}
......
......@@ -265,9 +265,7 @@ export default {
if (field?.sortKey) {
sortKey = field.sortKey;
} else {
sortKey = convertToSnakeCase(sortBy)
.replace(/_.*/, '')
.toUpperCase();
sortKey = convertToSnakeCase(sortBy).replace(/_.*/, '').toUpperCase();
}
this.pagination = initialPaginationState;
......
......@@ -195,7 +195,7 @@ export default {
<div class="gl-mt-2">
<gl-sprintf :message="$options.labels.readMoreText">
<template #link="{content}">
<template #link="{ content }">
<gl-link :href="helpLink" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
......
......@@ -37,10 +37,7 @@ class AutoWidthDropdownSelect {
// We have to look at the parent because
// `offsetParent` on a `display: none;` is `null`
const offsetParentWidth = $(this)
.parent()
.offsetParent()
.width();
const offsetParentWidth = $(this).parent().offsetParent().width();
// Reset any width to let it naturally flow
$dropdown.css('width', 'auto');
if ($dropdown.outerWidth(false) > offsetParentWidth) {
......
......@@ -21,9 +21,7 @@ export default class IssuableIndex {
axios
.put($resetToken.attr('href'))
.then(({ data }) => {
$('#issuable_email')
.val(data.new_address)
.focus();
$('#issuable_email').val(data.new_address).focus();
$resetToken.text(s__('EmailToken|reset it'));
})
......
......@@ -141,8 +141,7 @@ export default {
:data-supports-quick-actions="enableAutocomplete"
:aria-label="__('Description')"
:placeholder="__('Write a comment or drag your files here…')"
class="note-textarea js-gfm-input js-autosize markdown-area
qa-description-textarea"
class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
dir="auto"
@keydown="handleKeydown($event, 'description')"
></textarea>
......
......@@ -5,7 +5,7 @@ import App from './components/app.vue';
Vue.use(VueApollo);
export default function() {
export default function () {
const el = document.getElementById('js-suggestions');
const issueTitle = document.getElementById('issue_title');
const { projectPath } = el.dataset;
......
......@@ -54,11 +54,7 @@ export default class Issue {
$(document).trigger('issuable:change', isClosed);
let numProjectIssues = Number(
projectIssuesCounter
.first()
.text()
.trim()
.replace(/[^\d]/, ''),
projectIssuesCounter.first().text().trim().replace(/[^\d]/, ''),
);
numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1;
projectIssuesCounter.text(addDelimiter(numProjectIssues));
......
......@@ -53,8 +53,7 @@ export default {
id="issue-description"
ref="textarea"
v-model="formState.description"
class="note-textarea js-gfm-input js-autosize markdown-area
qa-description-textarea"
class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
dir="auto"
:data-supports-quick-actions="!glFeatures.tributeAutocomplete"
:aria-label="__('Description')"
......
......@@ -93,7 +93,10 @@ export default {
this.secretValue = '';
},
deleteVariable(id) {
this.variables.splice(this.variables.findIndex(el => el.id === id), 1);
this.variables.splice(
this.variables.findIndex(el => el.id === id),
1,
);
},
},
};
......
......@@ -135,7 +135,7 @@ export default class LabelManager {
getSortedLabelsIds() {
const sortedIds = [];
this.prioritizedLabels.find('> li').each(function() {
this.prioritizedLabels.find('> li').each(function () {
const id = $(this).data('id');
if (id) {
......
......@@ -49,7 +49,7 @@ export default class LabelsSelect {
const fieldName = $dropdown.data('fieldName');
let initialSelected = $selectbox
.find(`input[name="${$dropdown.data('fieldName')}"]`)
.map(function() {
.map(function () {
return this.value;
})
.get();
......@@ -64,11 +64,11 @@ export default class LabelsSelect {
);
}
const saveLabelData = function() {
const saveLabelData = function () {
const selected = $dropdown
.closest('.selectbox')
.find(`input[name='${fieldName}']`)
.map(function() {
.map(function () {
return this.value;
})
.get();
......@@ -210,9 +210,7 @@ export default class LabelsSelect {
}
} else {
if (this.id(label)) {
const dropdownValue = this.id(label)
.toString()
.replace(/'/g, "\\'");
const dropdownValue = this.id(label).toString().replace(/'/g, "\\'");
if (
$form.find(
......@@ -346,10 +344,7 @@ export default class LabelsSelect {
const isMRIndex = page === 'projects:merge_requests:index';
if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) {
$dropdown
.parent()
.find('.dropdown-clear-active')
.removeClass('is-active');
$dropdown.parent().find('.dropdown-clear-active').removeClass('is-active');
}
if ($dropdown.hasClass('js-issuable-form-dropdown')) {
......@@ -559,7 +554,7 @@ export default class LabelsSelect {
// eslint-disable-next-line class-methods-use-this
setOriginalDropdownData($container, $dropdown) {
const labels = [];
$container.find('[name="label_name[]"]').map(function() {
$container.find('[name="label_name[]"]').map(function () {
return labels.push(this.value);
});
$dropdown.data('marked', labels);
......
......@@ -68,7 +68,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa
closestSubmit.disable();
}
// eslint-disable-next-line func-names
return field.on(eventName, function() {
return field.on(eventName, function () {
if (rstrip($(this).val()) === '') {
return closestSubmit.disable();
}
......
......@@ -14,18 +14,12 @@ function addBlockTags(blockTag, selected) {
}
function lineBefore(text, textarea) {
const split = text
.substring(0, textarea.selectionStart)
.trim()
.split('\n');
const split = text.substring(0, textarea.selectionStart).trim().split('\n');
return split[split.length - 1];
}
function lineAfter(text, textarea) {
return text
.substring(textarea.selectionEnd)
.trim()
.split('\n')[0];
return text.substring(textarea.selectionEnd).trim().split('\n')[0];
}
function convertMonacoSelectionToAceFormat(sel) {
......@@ -342,7 +336,7 @@ export function addMarkdownListeners(form) {
// eslint-disable-next-line @gitlab/no-global-event-off
const $allToolbarBtns = $('.js-md', form)
.off('click')
.on('click', function() {
.on('click', function () {
const $toolbarBtn = $(this);
return updateTextForToolbarBtn($toolbarBtn);
......
......@@ -32,7 +32,7 @@ import 'vendor/jquery.scrollTo';
// </div>
//
const LineHighlighter = function(options = {}) {
const LineHighlighter = function (options = {}) {
options.highlightLineClass = options.highlightLineClass || 'hll';
options.fileHolderSelector = options.fileHolderSelector || '.file-holder';
options.scrollFileHolder = options.scrollFileHolder || false;
......@@ -50,7 +50,7 @@ const LineHighlighter = function(options = {}) {
this.highlightHash();
};
LineHighlighter.prototype.bindEvents = function() {
LineHighlighter.prototype.bindEvents = function () {
const $fileHolder = $(this.options.fileHolderSelector);
$fileHolder.on('click', 'a[data-line-number]', this.clickHandler);
......@@ -58,7 +58,7 @@ LineHighlighter.prototype.bindEvents = function() {
window.addEventListener('hashchange', e => this.highlightHash(e.target.location.hash));
};
LineHighlighter.prototype.highlightHash = function(newHash) {
LineHighlighter.prototype.highlightHash = function (newHash) {
let range;
if (newHash && typeof newHash === 'string') this._hash = newHash;
......@@ -83,13 +83,11 @@ LineHighlighter.prototype.highlightHash = function(newHash) {
}
};
LineHighlighter.prototype.clickHandler = function(event) {
LineHighlighter.prototype.clickHandler = function (event) {
let range;
event.preventDefault();
this.clearHighlight();
const lineNumber = $(event.target)
.closest('a')
.data('lineNumber');
const lineNumber = $(event.target).closest('a').data('lineNumber');
const current = this.hashToRange(this._hash);
if (!(current[0] && event.shiftKey)) {
// If there's no current selection, or there is but Shift wasn't held,
......@@ -107,7 +105,7 @@ LineHighlighter.prototype.clickHandler = function(event) {
}
};
LineHighlighter.prototype.clearHighlight = function() {
LineHighlighter.prototype.clearHighlight = function () {
return $(`.${this.highlightLineClass}`).removeClass(this.highlightLineClass);
};
......@@ -122,7 +120,7 @@ LineHighlighter.prototype.clearHighlight = function() {
// hashToRange('#foo') # => [null, null]
//
// Returns an Array
LineHighlighter.prototype.hashToRange = function(hash) {
LineHighlighter.prototype.hashToRange = function (hash) {
// ?L(\d+)(?:-(\d+))?$/)
const matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/);
if (matches && matches.length) {
......@@ -136,14 +134,14 @@ LineHighlighter.prototype.hashToRange = function(hash) {
// Highlight a single line
//
// lineNumber - Line number to highlight
LineHighlighter.prototype.highlightLine = function(lineNumber) {
LineHighlighter.prototype.highlightLine = function (lineNumber) {
return $(`#LC${lineNumber}`).addClass(this.highlightLineClass);
};
// Highlight all lines within a range
//
// range - Array containing the starting and ending line numbers
LineHighlighter.prototype.highlightRange = function(range) {
LineHighlighter.prototype.highlightRange = function (range) {
if (range[1]) {
const results = [];
const ref = range[0] <= range[1] ? range : range.reverse();
......@@ -158,7 +156,7 @@ LineHighlighter.prototype.highlightRange = function(range) {
};
// Set the URL hash string
LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) {
LineHighlighter.prototype.setHash = function (firstLineNumber, lastLineNumber) {
let hash;
if (lastLineNumber) {
hash = `#L${firstLineNumber}-${lastLineNumber}`;
......@@ -172,7 +170,7 @@ LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) {
// Make the actual hash change in the browser
//
// This method is stubbed in tests.
LineHighlighter.prototype.__setLocationHash__ = function(value) {
LineHighlighter.prototype.__setLocationHash__ = function (value) {
return window.history.pushState(
{
url: value,
......
......@@ -246,9 +246,7 @@ export default {
</div>{{trace}}
</code></pre>
</template>
<template #default
><div></div
></template>
<template #default><div></div></template>
</gl-infinite-scroll>
<div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900">
......@@ -262,9 +260,7 @@ export default {
>
<template #fetched>{{ logs.lines.length }}</template>
</gl-sprintf>
<template v-else>
{{ s__('Environments|Currently showing all results.') }}</template
>
<template v-else> {{ s__('Environments|Currently showing all results.') }}</template>
</div>
</div>
</template>
......@@ -53,7 +53,7 @@ window.$ = jQuery;
jQuery.ajaxSetup({
converters: {
// eslint-disable-next-line @gitlab/require-i18n-strings, func-names
'text script': function(text) {
'text script': function (text) {
jQuery.globalEval(text, { nonce: getCspNonceValue() });
return text;
},
......@@ -137,9 +137,7 @@ function deferredInitialisation() {
$('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() {
tooltips.dispose(this);
$(this)
.closest('li')
.addClass('gl-display-none!');
$(this).closest('li').addClass('gl-display-none!');
});
$('.js-remove-tr').on('ajax:before', function removeTRAjaxBeforeCallback() {
......@@ -147,9 +145,7 @@ function deferredInitialisation() {
});
$('.js-remove-tr').on('ajax:success', function removeTRAjaxSuccessCallback() {
$(this)
.closest('tr')
.addClass('gl-display-none!');
$(this).closest('tr').addClass('gl-display-none!');
});
const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
......@@ -278,15 +274,9 @@ document.addEventListener('DOMContentLoaded', () => {
$this.toggleClass('active');
if ($this.hasClass('active')) {
notesHolders
.show()
.find('.hide, .content')
.show();
notesHolders.show().find('.hide, .content').show();
} else {
notesHolders
.hide()
.find('.content')
.hide();
notesHolders.hide().find('.content').hide();
}
$(document).trigger('toggle.comments');
......
......@@ -41,9 +41,7 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d
inputs.next('.js-clear-input').on('click', function clicked(event) {
event.preventDefault();
const input = $(this)
.closest('.clearable-input')
.find(selector);
const input = $(this).closest('.clearable-input').find(selector);
const calendar = input.data('pikaday');
calendar.setDate(null);
......
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