Commit c04bd247 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 23 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 1173c801
......@@ -517,39 +517,6 @@ app/assets/javascripts/lib/utils/text_markdown.js
app/assets/javascripts/lib/utils/text_utility.js
app/assets/javascripts/lib/utils/type_utility.js
## vigorous-wiles
app/assets/javascripts/pages/projects/issues/show.js
app/assets/javascripts/pages/projects/jobs/index/index.js
app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue
app/assets/javascripts/pages/projects/labels/index/index.js
app/assets/javascripts/pages/projects/merge_requests/creations/new/compare.js
app/assets/javascripts/pages/projects/new/index.js
app/assets/javascripts/pages/projects/pages_domains/form.js
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/timezone_dropdown.js
app/assets/javascripts/pages/projects/pipelines/init_pipelines.js
app/assets/javascripts/pages/projects/project.js
app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
app/assets/javascripts/pages/projects/shared/permissions/external.js
app/assets/javascripts/pages/projects/shared/permissions/index.js
app/assets/javascripts/pages/projects/tags/index/index.js
app/assets/javascripts/pages/search/show/refresh_counts.js
app/assets/javascripts/pages/sessions/new/length_validator.js
app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js
app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js
app/assets/javascripts/pages/sessions/new/username_validator.js
app/assets/javascripts/pages/shared/mount_badge_settings.js
app/assets/javascripts/pages/shared/wikis/wikis.js
app/assets/javascripts/pages/users/activity_calendar.js
app/assets/javascripts/pages/users/index.js
app/assets/javascripts/pdf/index.vue
app/assets/javascripts/pdf/page/index.vue
app/assets/javascripts/performance/utils.js
app/assets/javascripts/performance_bar/components/detailed_metric.vue
app/assets/javascripts/performance_bar/components/request_selector.vue
app/assets/javascripts/performance_bar/index.js
app/assets/javascripts/performance_bar/performance_bar_log.js
## musing-khayyam
app/assets/javascripts/performance_bar/services/performance_bar_service.js
app/assets/javascripts/performance_bar/stores/performance_bar_store.js
......
......@@ -37,7 +37,7 @@ export default function () {
initRelatedMergeRequestsApp();
import(/* webpackChunkName: 'design_management' */ '~/design_management')
.then(module => module.default())
.then((module) => module.default())
.catch(() => {});
new ZenMode(); // eslint-disable-line no-new
......
......@@ -5,7 +5,7 @@ import Tracking from '~/tracking';
document.addEventListener('DOMContentLoaded', () => {
const remainingTimeElements = document.querySelectorAll('.js-remaining-time');
remainingTimeElements.forEach(
el =>
(el) =>
new Vue({
...GlCountdown,
el,
......@@ -22,5 +22,5 @@ document.addEventListener('DOMContentLoaded', () => {
}
};
const buttons = document.querySelectorAll('.js-empty-state-button');
buttons.forEach(button => button.addEventListener('click', trackButtonClick));
buttons.forEach((button) => button.addEventListener('click', trackButtonClick));
});
......@@ -58,14 +58,14 @@ export default {
eventHub.$emit('promoteLabelModal.requestStarted', this.url);
return axios
.post(this.url, { params: { format: 'json' } })
.then(response => {
.then((response) => {
eventHub.$emit('promoteLabelModal.requestFinished', {
labelUrl: this.url,
successful: true,
});
visitUrl(response.data.url);
})
.catch(error => {
.catch((error) => {
eventHub.$emit('promoteLabelModal.requestFinished', {
labelUrl: this.url,
successful: false,
......
......@@ -19,7 +19,7 @@ const initLabelIndex = () => {
}
};
const onRequestStarted = labelUrl => {
const onRequestStarted = (labelUrl) => {
const button = document.querySelector(
`.js-promote-project-label-button[data-url="${labelUrl}"]`,
);
......@@ -46,7 +46,7 @@ const initLabelIndex = () => {
eventHub.$on('promoteLabelModal.props', this.setModalProps);
eventHub.$emit('promoteLabelModal.mounted');
promoteLabelButtons.forEach(button => {
promoteLabelButtons.forEach((button) => {
button.removeAttribute('disabled');
button.addEventListener('click', () => {
this.$root.$emit('bv::show::modal', 'promote-label-modal');
......
......@@ -19,7 +19,7 @@ const updateCommitList = (url, $loadingIndicator, $commitList, params) => {
});
};
export default mrNewCompareNode => {
export default (mrNewCompareNode) => {
const { sourceBranchUrl, targetBranchUrl } = mrNewCompareNode.dataset;
initTargetProjectDropdown();
......@@ -44,7 +44,7 @@ export default mrNewCompareNode => {
ref: $(mrNewCompareNode).find("input[name='merge_request[target_branch]']").val(),
},
);
initCompareAutocomplete('branches', $dropdown => {
initCompareAutocomplete('branches', ($dropdown) => {
if ($dropdown.is('.js-target-branch')) {
updateTargetBranchCommitList();
} else if ($dropdown.is('.js-source-branch')) {
......
......@@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => {
import(
/* webpackChunkName: 'experiment_new_project_creation' */ '../../../projects/experiment_new_project_creation'
)
.then(m => {
.then((m) => {
const el = document.querySelector('.js-experiment-new-project-creation');
if (!el) {
......
import setupToggleButtons from '~/toggle_buttons';
function updateVisibility(selector, isVisible) {
Array.from(document.querySelectorAll(selector)).forEach(el => {
Array.from(document.querySelectorAll(selector)).forEach((el) => {
if (isVisible) {
el.classList.remove('d-none');
} else {
......@@ -14,12 +14,12 @@ export default () => {
const toggleContainer = document.querySelector('.js-auto-ssl-toggle-container');
if (toggleContainer) {
const onToggleButtonClicked = isAutoSslEnabled => {
const onToggleButtonClicked = (isAutoSslEnabled) => {
updateVisibility('.js-shown-unless-auto-ssl', !isAutoSslEnabled);
updateVisibility('.js-shown-if-auto-ssl', isAutoSslEnabled);
Array.from(document.querySelectorAll('.js-enabled-unless-auto-ssl')).forEach(el => {
Array.from(document.querySelectorAll('.js-enabled-unless-auto-ssl')).forEach((el) => {
if (isAutoSslEnabled) {
el.setAttribute('disabled', 'disabled');
} else {
......
......@@ -15,19 +15,19 @@ export default class TargetBranchDropdown {
data: this.formatBranchesList(),
filterable: true,
selectable: true,
toggleLabel: item => item.name,
toggleLabel: (item) => item.name,
search: {
fields: ['name'],
},
clicked: cfg => this.updateInputValue(cfg),
text: item => item.name,
clicked: (cfg) => this.updateInputValue(cfg),
text: (item) => item.name,
});
this.setDropdownToggle();
}
formatBranchesList() {
return this.$dropdown.data('data').map(val => ({ name: val }));
return this.$dropdown.data('data').map((val) => ({ name: val }));
}
setDropdownToggle() {
......
......@@ -5,10 +5,10 @@ const defaults = {
$inputEl: null,
$dropdownEl: null,
onSelectTimezone: null,
displayFormat: item => item.name,
displayFormat: (item) => item.name,
};
export const formatUtcOffset = offset => {
export const formatUtcOffset = (offset) => {
const parsed = parseInt(offset, 10);
if (Number.isNaN(parsed) || parsed === 0) {
return `0`;
......@@ -17,11 +17,11 @@ export const formatUtcOffset = offset => {
return `${prefix} ${Math.abs(offset / 3600)}`;
};
export const formatTimezone = item => `[UTC ${formatUtcOffset(item.offset)}] ${item.name}`;
export const formatTimezone = (item) => `[UTC ${formatUtcOffset(item.offset)}] ${item.name}`;
export const findTimezoneByIdentifier = (tzList = [], identifier = null) => {
if (tzList && tzList.length && identifier && identifier.length) {
return tzList.find(tz => tz.identifier === identifier) || null;
return tzList.find((tz) => tz.identifier === identifier) || null;
}
return null;
};
......@@ -52,8 +52,8 @@ export default class TimezoneDropdown {
search: {
fields: ['name'],
},
clicked: cfg => this.updateInputValue(cfg),
text: item => formatTimezone(item),
clicked: (cfg) => this.updateInputValue(cfg),
text: (item) => formatTimezone(item),
});
this.setDropdownToggle(this.displayFormat(this.initialTimezone));
......
......@@ -6,7 +6,7 @@ export default () => {
const fullMergeRequestList = document.querySelector('.js-full-mr-list');
if (mergeRequestListToggle) {
mergeRequestListToggle.addEventListener('click', e => {
mergeRequestListToggle.addEventListener('click', (e) => {
e.preventDefault();
truncatedMergeRequestList.classList.toggle('hide');
fullMergeRequestList.classList.toggle('hide');
......
......@@ -46,7 +46,7 @@ export default class Project {
static projectSelectDropdown() {
projectSelect();
$('.project-item-select').on('click', e => Project.changeProject($(e.currentTarget).val()));
$('.project-item-select').on('click', (e) => Project.changeProject($(e.currentTarget).val()));
}
static changeProject(url) {
......@@ -124,7 +124,7 @@ export default class Project {
if (loc.includes('/-/')) {
const refs = this.fullData.Branches.concat(this.fullData.Tags);
const currentRef = refs.find(ref => loc.indexOf(ref) > -1);
const currentRef = refs.find((ref) => loc.indexOf(ref) > -1);
if (currentRef) {
const targetPath = loc.split(currentRef)[1].slice(1);
selectedUrl.searchParams.set('path', targetPath);
......
......@@ -23,7 +23,7 @@ document.addEventListener('DOMContentLoaded', () => {
// hide extra auto devops settings based checkbox state
const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings');
const instanceDefaultBadge = document.querySelector('.js-instance-default-badge');
document.querySelector('.js-toggle-extra-settings').addEventListener('click', event => {
document.querySelector('.js-toggle-extra-settings').addEventListener('click', (event) => {
const { target } = event;
if (instanceDefaultBadge) instanceDefaultBadge.style.display = 'none';
autoDevOpsExtraSettings.classList.toggle('hidden', !target.checked);
......
......@@ -14,5 +14,5 @@ export function toggleHiddenClassBySelector(selector, hidden) {
if (!selectorCache[selector]) {
selectorCache[selector] = document.querySelectorAll(selector);
}
selectorCache[selector].forEach(elm => toggleHiddenClass(elm, hidden));
selectorCache[selector].forEach((elm) => toggleHiddenClass(elm, hidden));
}
......@@ -8,6 +8,6 @@ export default function initProjectPermissionsSettings() {
return new Vue({
el: mountPoint,
render: createElement => createElement(settingsPanel, { props: { ...componentProps } }),
render: (createElement) => createElement(settingsPanel, { props: { ...componentProps } }),
});
}
......@@ -2,7 +2,7 @@ import { initRemoveTag } from '../remove_tag';
document.addEventListener('DOMContentLoaded', () => {
initRemoveTag({
onDelete: path => {
onDelete: (path) => {
document.querySelector(`[data-path="${path}"]`).closest('.js-tag-list').remove();
},
});
......
......@@ -11,7 +11,7 @@ function refreshCount(el) {
return axios
.get(url)
.then(({ data }) => showCount(el, data.count))
.catch(e => {
.catch((e) => {
// eslint-disable-next-line no-console
console.error(`Failed to fetch search count from '${url}'.`, e);
});
......
......@@ -9,7 +9,7 @@ export default class LengthValidator extends InputValidator {
const container = opts.container || '';
const validateLengthElements = document.querySelectorAll(`${container} .js-validate-length`);
validateLengthElements.forEach(element =>
validateLengthElements.forEach((element) =>
element.addEventListener('input', this.eventHandler.bind(this)),
);
}
......
......@@ -13,7 +13,7 @@ export default function preserveUrlFragment(fragment = '') {
// Append the fragment to all sign-in/sign-up form actions so it is preserved when the user is
// eventually redirected back to the originally requested URL.
const forms = document.querySelectorAll('#signin-container .tab-content form');
Array.prototype.forEach.call(forms, form => {
Array.prototype.forEach.call(forms, (form) => {
const actionWithFragment = setUrlFragment(form.getAttribute('action'), `#${normalFragment}`);
form.setAttribute('action', actionWithFragment);
});
......@@ -21,7 +21,7 @@ export default function preserveUrlFragment(fragment = '') {
// Append a redirect_fragment query param to all oauth provider links. The redirect_fragment
// query param will be available in the omniauth callback upon successful authentication
const oauthForms = document.querySelectorAll('#signin-container .omniauth-container form');
Array.prototype.forEach.call(oauthForms, oauthForm => {
Array.prototype.forEach.call(oauthForms, (oauthForm) => {
const newHref = mergeUrlParams(
{ redirect_fragment: normalFragment },
oauthForm.getAttribute('action'),
......
......@@ -20,7 +20,7 @@ export default class SigninTabsMemoizer {
bootstrap() {
const tabs = document.querySelectorAll(this.tabSelector);
if (tabs.length > 0) {
tabs[0].addEventListener('click', e => {
tabs[0].addEventListener('click', (e) => {
if (e.target && e.target.nodeName === 'A') {
const anchorName = e.target.getAttribute('href');
this.saveData(anchorName);
......
......@@ -20,11 +20,11 @@ export default class UsernameValidator extends InputValidator {
const container = opts.container || '';
const validateLengthElements = document.querySelectorAll(`${container} .js-validate-username`);
this.debounceValidateInput = debounce(inputDomElement => {
this.debounceValidateInput = debounce((inputDomElement) => {
UsernameValidator.validateUsernameInput(inputDomElement);
}, debounceTimeoutDuration);
validateLengthElements.forEach(element =>
validateLengthElements.forEach((element) =>
element.addEventListener('input', this.eventHandler.bind(this)),
);
}
......@@ -42,7 +42,7 @@ export default class UsernameValidator extends InputValidator {
if (inputDomElement.checkValidity() && username.length > 1) {
UsernameValidator.setMessageVisibility(inputDomElement, pendingMessageSelector);
UsernameValidator.fetchUsernameAvailability(username)
.then(usernameTaken => {
.then((usernameTaken) => {
UsernameValidator.setInputState(inputDomElement, !usernameTaken);
UsernameValidator.setMessageVisibility(inputDomElement, pendingMessageSelector, false);
UsernameValidator.setMessageVisibility(
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import BadgeSettings from '~/badges/components/badge_settings.vue';
import store from '~/badges/store';
export default kind => {
export default (kind) => {
const badgeSettingsElement = document.getElementById('badge-settings');
store.dispatch('loadBadges', {
......
......@@ -20,7 +20,7 @@ export default class Wikis {
const sidebarToggles = document.querySelectorAll('.js-sidebar-wiki-toggle');
for (let i = 0; i < sidebarToggles.length; i += 1) {
sidebarToggles[i].addEventListener('click', e => this.handleToggleSidebar(e));
sidebarToggles[i].addEventListener('click', (e) => this.handleToggleSidebar(e));
}
this.isNewWikiPage = Boolean(document.querySelector('.js-new-wiki-page'));
......@@ -35,7 +35,7 @@ export default class Wikis {
if (this.editTitleInput.value) this.setWikiCommitMessage(this.editTitleInput.value);
// Set the commit message as the page title is changed
this.editTitleInput.addEventListener('keyup', e => this.handleWikiTitleChange(e));
this.editTitleInput.addEventListener('keyup', (e) => this.handleWikiTitleChange(e));
}
window.addEventListener('resize', () => this.renderSidebar());
......@@ -45,7 +45,7 @@ export default class Wikis {
const linkExample = document.querySelector('.js-markup-link-example');
if (changeFormatSelect) {
changeFormatSelect.addEventListener('change', e => {
changeFormatSelect.addEventListener('change', (e) => {
linkExample.innerHTML = MARKDOWN_LINK_TEXT[e.target.value];
});
}
......@@ -121,6 +121,6 @@ export default class Wikis {
static showToasts() {
const toasts = document.querySelectorAll('.js-toast-message');
toasts.forEach(toast => showToast(toast.dataset.message));
toasts.forEach((toast) => showToast(toast.dataset.message));
}
}
......@@ -173,17 +173,17 @@ export default class ActivityCalendar {
return `translate(${this.daySizeWithSpace * i + 1 + this.daySizeWithSpace}, 18)`;
})
.selectAll('rect')
.data(stamp => stamp)
.data((stamp) => stamp)
.enter()
.append('rect')
.attr('x', '0')
.attr('y', stamp => this.dayYPos(stamp.day))
.attr('y', (stamp) => this.dayYPos(stamp.day))
.attr('width', this.daySize)
.attr('height', this.daySize)
.attr('fill', stamp =>
.attr('fill', (stamp) =>
stamp.count !== 0 ? this.color(Math.min(stamp.count, 40)) : '#ededed',
)
.attr('title', stamp => formatTooltipText(stamp))
.attr('title', (stamp) => formatTooltipText(stamp))
.attr('class', 'user-contrib-cell has-tooltip')
.attr('data-html', true)
.attr('data-container', 'body')
......@@ -226,8 +226,8 @@ export default class ActivityCalendar {
.append('text')
.attr('text-anchor', 'middle')
.attr('x', 8)
.attr('y', day => day.y)
.text(day => day.text)
.attr('y', (day) => day.y)
.text((day) => day.text)
.attr('class', 'user-contrib-text');
}
......@@ -239,10 +239,10 @@ export default class ActivityCalendar {
.data(this.months)
.enter()
.append('text')
.attr('x', date => date.x)
.attr('x', (date) => date.x)
.attr('y', 10)
.attr('class', 'user-contrib-text')
.text(date => this.monthNames[date.month]);
.text((date) => this.monthNames[date.month]);
}
renderKey() {
......@@ -272,7 +272,7 @@ export default class ActivityCalendar {
.attr('height', this.daySize)
.attr('x', (color, i) => this.daySizeWithSpace * i)
.attr('y', 0)
.attr('fill', color => color)
.attr('fill', (color) => color)
.attr('class', 'has-tooltip')
.attr('title', (color, i) => keyValues[i])
.attr('data-container', 'body')
......
......@@ -8,7 +8,7 @@ function initUserProfile(action) {
new UserTabs({ parentEl: '.user-profile', action });
// hide project limit message
$('.hide-project-limit-message').on('click', e => {
$('.hide-project-limit-message').on('click', (e) => {
e.preventDefault();
Cookies.set('hide_project_limit_message', 'false');
$(this).parents('.project-limit-message').remove();
......
......@@ -40,11 +40,11 @@ export default {
cMapPacked: true,
})
.promise.then(this.renderPages)
.then(pages => {
.then((pages) => {
this.pages = pages;
this.$emit('pdflabload');
})
.catch(error => {
.catch((error) => {
this.$emit('pdflaberror', error);
});
},
......
......@@ -39,7 +39,7 @@ export default {
.promise.then(() => {
this.rendering = false;
})
.catch(error => {
.catch((error) => {
this.$emit('pdflaberror', error);
});
},
......
......@@ -3,7 +3,7 @@ export const performanceMarkAndMeasure = ({ mark, measures = [] } = {}) => {
if (mark && !performance.getEntriesByName(mark).length) {
performance.mark(mark);
}
measures.forEach(measure => {
measures.forEach((measure) => {
performance.measure(measure.name, measure.start, measure.end);
});
});
......
......@@ -76,12 +76,12 @@ export default {
this.openedBacktraces = [...this.openedBacktraces, toggledIndex];
} else {
this.openedBacktraces = this.openedBacktraces.filter(
openedIndex => openedIndex !== toggledIndex,
(openedIndex) => openedIndex !== toggledIndex,
);
}
},
itemHasOpenedBacktrace(toggledIndex) {
return this.openedBacktraces.find(openedIndex => openedIndex === toggledIndex) >= 0;
return this.openedBacktraces.find((openedIndex) => openedIndex === toggledIndex) >= 0;
},
},
};
......
......@@ -25,7 +25,7 @@ export default {
},
computed: {
requestsWithWarnings() {
return this.requests.filter(request => request.hasWarnings);
return this.requests.filter((request) => request.hasWarnings);
},
warningMessage() {
return n__(
......
......@@ -10,7 +10,7 @@ import initPerformanceBarLog from './performance_bar_log';
Vue.use(Translate);
const initPerformanceBar = el => {
const initPerformanceBar = (el) => {
const performanceBarData = el.dataset;
return new Vue({
......@@ -55,7 +55,7 @@ const initPerformanceBar = el => {
this.store.addRequest(requestId, requestUrl);
PerformanceBarService.fetchRequestDetails(this.peekUrl, requestId)
.then(res => {
.then((res) => {
this.store.addRequestDetails(requestId, res.data);
if (this.requestId === requestId) this.collectFrontendPerformanceMetrics();
......@@ -84,7 +84,7 @@ const initPerformanceBar = el => {
if ('PerformanceObserver' in window) {
// We start observing for more incoming timings
const observer = new PerformanceObserver(list => {
const observer = new PerformanceObserver((list) => {
newEntries = newEntries.concat(list.getEntries().map(this.transformResourceEntry));
this.updateFrontendPerformanceMetrics(durationString, newEntries);
});
......
......@@ -3,7 +3,7 @@ import { getCLS, getFID, getLCP } from 'web-vitals';
import { PERFORMANCE_TYPE_MARK, PERFORMANCE_TYPE_MEASURE } from '~/performance/constants';
const initVitalsLog = () => {
const reportVital = data => {
const reportVital = (data) => {
console.log(`${String.fromCodePoint(0x1f4c8)} ${data.name} : `, data);
};
......@@ -18,9 +18,9 @@ const initVitalsLog = () => {
};
const logUserTimingMetrics = () => {
const metricsProcessor = list => {
const metricsProcessor = (list) => {
const entries = list.getEntries();
entries.forEach(entry => {
entries.forEach((entry) => {
const { name, entryType, startTime, duration } = entry;
const typeMapper = {
[PERFORMANCE_TYPE_MARK]: String.fromCodePoint(0x1f3af),
......
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