Commit 333bad89 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 14 of 73

Part of our prettier migration; changing the arrow-parens style.
parent b1f29131
...@@ -19,7 +19,7 @@ class RecentSearchesStore { ...@@ -19,7 +19,7 @@ class RecentSearchesStore {
} }
setRecentSearches(searches = []) { setRecentSearches(searches = []) {
const trimmedSearches = searches.map(search => const trimmedSearches = searches.map((search) =>
typeof search === 'string' ? search.trim() : search, typeof search === 'string' ? search.trim() : search,
); );
......
...@@ -40,7 +40,7 @@ export default class VisualTokenValue { ...@@ -40,7 +40,7 @@ export default class VisualTokenValue {
return ( return (
UsersCache.retrieve(username) UsersCache.retrieve(username)
.then(user => { .then((user) => {
if (!user) { if (!user) {
return; return;
} }
...@@ -68,9 +68,9 @@ export default class VisualTokenValue { ...@@ -68,9 +68,9 @@ export default class VisualTokenValue {
); );
return AjaxCache.retrieve(labelsEndpointWithParams) return AjaxCache.retrieve(labelsEndpointWithParams)
.then(labels => { .then((labels) => {
const matchingLabel = (labels || []).find( const matchingLabel = (labels || []).find(
label => `~${DropdownUtils.getEscapedText(label.title)}` === tokenValue, (label) => `~${DropdownUtils.getEscapedText(label.title)}` === tokenValue,
); );
if (!matchingLabel) { if (!matchingLabel) {
...@@ -96,8 +96,8 @@ export default class VisualTokenValue { ...@@ -96,8 +96,8 @@ export default class VisualTokenValue {
); );
return AjaxCache.retrieve(epicsEndpointWithParams) return AjaxCache.retrieve(epicsEndpointWithParams)
.then(epics => { .then((epics) => {
const matchingEpic = (epics || []).find(epic => epic.id === Number(tokenValue)); const matchingEpic = (epics || []).find((epic) => epic.id === Number(tokenValue));
if (!matchingEpic) { if (!matchingEpic) {
return; return;
......
...@@ -34,7 +34,7 @@ const hideFlash = (flashEl, fadeTransition = true) => { ...@@ -34,7 +34,7 @@ const hideFlash = (flashEl, fadeTransition = true) => {
if (!fadeTransition) flashEl.dispatchEvent(new Event('transitionend')); if (!fadeTransition) flashEl.dispatchEvent(new Event('transitionend'));
}; };
const createAction = config => ` const createAction = (config) => `
<a <a
href="${config.href || '#'}" href="${config.href || '#'}"
class="flash-action" class="flash-action"
...@@ -97,7 +97,7 @@ const deprecatedCreateFlash = function deprecatedCreateFlash( ...@@ -97,7 +97,7 @@ const deprecatedCreateFlash = function deprecatedCreateFlash(
if (actionConfig.clickHandler) { if (actionConfig.clickHandler) {
flashEl flashEl
.querySelector('.flash-action') .querySelector('.flash-action')
.addEventListener('click', e => actionConfig.clickHandler(e)); .addEventListener('click', (e) => actionConfig.clickHandler(e));
} }
} }
...@@ -151,7 +151,7 @@ const createFlash = function createFlash({ ...@@ -151,7 +151,7 @@ const createFlash = function createFlash({
if (actionConfig.clickHandler) { if (actionConfig.clickHandler) {
flashEl flashEl
.querySelector('.flash-action') .querySelector('.flash-action')
.addEventListener('click', e => actionConfig.clickHandler(e)); .addEventListener('click', (e) => actionConfig.clickHandler(e));
} }
} }
......
...@@ -12,7 +12,7 @@ let sidebar; ...@@ -12,7 +12,7 @@ let sidebar;
export const mousePos = []; export const mousePos = [];
export const setSidebar = el => { export const setSidebar = (el) => {
sidebar = el; sidebar = el;
}; };
export const getOpenMenu = () => currentOpenMenu; export const getOpenMenu = () => currentOpenMenu;
...@@ -32,7 +32,7 @@ const setHeaderHeight = () => { ...@@ -32,7 +32,7 @@ const setHeaderHeight = () => {
export const isSidebarCollapsed = () => export const isSidebarCollapsed = () =>
sidebar && sidebar.classList.contains(SIDEBAR_COLLAPSED_CLASS); sidebar && sidebar.classList.contains(SIDEBAR_COLLAPSED_CLASS);
export const canShowActiveSubItems = el => { export const canShowActiveSubItems = (el) => {
if (el.classList.contains('active') && !isSidebarCollapsed()) { if (el.classList.contains('active') && !isSidebarCollapsed()) {
return false; return false;
} }
...@@ -71,7 +71,7 @@ export const calculateTop = (boundingRect, outerHeight) => { ...@@ -71,7 +71,7 @@ export const calculateTop = (boundingRect, outerHeight) => {
: boundingRect.top; : boundingRect.top;
}; };
export const hideMenu = el => { export const hideMenu = (el) => {
if (!el) return; if (!el) return;
const parentEl = el.parentNode; const parentEl = el.parentNode;
...@@ -112,7 +112,7 @@ export const moveSubItemsToPosition = (el, subItems) => { ...@@ -112,7 +112,7 @@ export const moveSubItemsToPosition = (el, subItems) => {
} }
}; };
export const showSubLevelItems = el => { export const showSubLevelItems = (el) => {
const subItems = el.querySelector('.sidebar-sub-level-items'); const subItems = el.querySelector('.sidebar-sub-level-items');
const isIconOnly = subItems && subItems.classList.contains('is-fly-out-only'); const isIconOnly = subItems && subItems.classList.contains('is-fly-out-only');
...@@ -139,7 +139,7 @@ export const mouseEnterTopItems = (el, timeout = getHideSubItemsInterval()) => { ...@@ -139,7 +139,7 @@ export const mouseEnterTopItems = (el, timeout = getHideSubItemsInterval()) => {
}, timeout); }, timeout);
}; };
export const mouseLeaveTopItem = el => { export const mouseLeaveTopItem = (el) => {
const subItems = el.querySelector('.sidebar-sub-level-items'); const subItems = el.querySelector('.sidebar-sub-level-items');
if ( if (
...@@ -152,7 +152,7 @@ export const mouseLeaveTopItem = el => { ...@@ -152,7 +152,7 @@ export const mouseLeaveTopItem = el => {
el.classList.remove(IS_OVER_CLASS); el.classList.remove(IS_OVER_CLASS);
}; };
export const documentMouseMove = e => { export const documentMouseMove = (e) => {
mousePos.push({ mousePos.push({
x: e.clientX, x: e.clientX,
y: e.clientY, y: e.clientY,
...@@ -161,7 +161,7 @@ export const documentMouseMove = e => { ...@@ -161,7 +161,7 @@ export const documentMouseMove = e => {
if (mousePos.length > 6) mousePos.shift(); if (mousePos.length > 6) mousePos.shift();
}; };
export const subItemsMouseLeave = relatedTarget => { export const subItemsMouseLeave = (relatedTarget) => {
clearTimeout(timeoutId); clearTimeout(timeoutId);
if (relatedTarget && !relatedTarget.closest(`.${IS_OVER_CLASS}`)) { if (relatedTarget && !relatedTarget.closest(`.${IS_OVER_CLASS}`)) {
...@@ -189,15 +189,15 @@ export default () => { ...@@ -189,15 +189,15 @@ export default () => {
requestIdleCallback(setHeaderHeight); requestIdleCallback(setHeaderHeight);
items.forEach(el => { items.forEach((el) => {
const subItems = el.querySelector('.sidebar-sub-level-items'); const subItems = el.querySelector('.sidebar-sub-level-items');
if (subItems) { if (subItems) {
subItems.addEventListener('mouseleave', e => subItemsMouseLeave(e.relatedTarget)); subItems.addEventListener('mouseleave', (e) => subItemsMouseLeave(e.relatedTarget));
} }
el.addEventListener('mouseenter', e => mouseEnterTopItems(e.currentTarget)); el.addEventListener('mouseenter', (e) => mouseEnterTopItems(e.currentTarget));
el.addEventListener('mouseleave', e => mouseLeaveTopItem(e.currentTarget)); el.addEventListener('mouseleave', (e) => mouseLeaveTopItem(e.currentTarget));
}); });
document.addEventListener('mousemove', documentMouseMove); document.addEventListener('mousemove', documentMouseMove);
......
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
// Check if item already exists in list // Check if item already exists in list
const itemMatchIndex = storedFrequentItems.findIndex( const itemMatchIndex = storedFrequentItems.findIndex(
frequentItem => frequentItem.id === item.id, (frequentItem) => frequentItem.id === item.id,
); );
if (itemMatchIndex > -1) { if (itemMatchIndex > -1) {
......
...@@ -18,7 +18,7 @@ const frequentItemDropdowns = [ ...@@ -18,7 +18,7 @@ const frequentItemDropdowns = [
]; ];
export default function initFrequentItemDropdowns() { export default function initFrequentItemDropdowns() {
frequentItemDropdowns.forEach(dropdown => { frequentItemDropdowns.forEach((dropdown) => {
const { namespace, key } = dropdown; const { namespace, key } = dropdown;
const el = document.getElementById(`js-${namespace}-dropdown`); const el = document.getElementById(`js-${namespace}-dropdown`);
const navEl = document.getElementById(`nav-${namespace}-dropdown`); const navEl = document.getElementById(`nav-${namespace}-dropdown`);
......
...@@ -59,7 +59,7 @@ export const fetchSearchedItems = ({ state, dispatch }, searchQuery) => { ...@@ -59,7 +59,7 @@ export const fetchSearchedItems = ({ state, dispatch }, searchQuery) => {
} }
return Api[state.namespace](searchQuery, params) return Api[state.namespace](searchQuery, params)
.then(results => { .then((results) => {
dispatch('receiveSearchedItemsSuccess', results); dispatch('receiveSearchedItemsSuccess', results);
}) })
.catch(() => { .catch(() => {
......
export const hasSearchQuery = state => state.searchQuery !== ''; export const hasSearchQuery = (state) => state.searchQuery !== '';
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
[types.RECEIVE_SEARCHED_ITEMS_SUCCESS](state, results) { [types.RECEIVE_SEARCHED_ITEMS_SUCCESS](state, results) {
const rawItems = results.data ? results.data : results; // Api.groups returns array, Api.projects returns object const rawItems = results.data ? results.data : results; // Api.groups returns array, Api.projects returns object
Object.assign(state, { Object.assign(state, {
items: rawItems.map(rawItem => ({ items: rawItems.map((rawItem) => ({
id: rawItem.id, id: rawItem.id,
name: rawItem.name, name: rawItem.name,
namespace: rawItem.name_with_namespace || rawItem.full_name, namespace: rawItem.name_with_namespace || rawItem.full_name,
......
...@@ -5,7 +5,7 @@ import { FREQUENT_ITEMS, HOUR_IN_MS } from './constants'; ...@@ -5,7 +5,7 @@ import { FREQUENT_ITEMS, HOUR_IN_MS } from './constants';
export const isMobile = () => ['md', 'sm', 'xs'].includes(bp.getBreakpointSize()); export const isMobile = () => ['md', 'sm', 'xs'].includes(bp.getBreakpointSize());
export const getTopFrequentItems = items => { export const getTopFrequentItems = (items) => {
if (!items) { if (!items) {
return []; return [];
} }
...@@ -13,7 +13,7 @@ export const getTopFrequentItems = items => { ...@@ -13,7 +13,7 @@ export const getTopFrequentItems = items => {
? FREQUENT_ITEMS.LIST_COUNT_MOBILE ? FREQUENT_ITEMS.LIST_COUNT_MOBILE
: FREQUENT_ITEMS.LIST_COUNT_DESKTOP; : FREQUENT_ITEMS.LIST_COUNT_DESKTOP;
const frequentItems = items.filter(item => item.frequency >= FREQUENT_ITEMS.ELIGIBLE_FREQUENCY); const frequentItems = items.filter((item) => item.frequency >= FREQUENT_ITEMS.ELIGIBLE_FREQUENCY);
if (!frequentItems || frequentItems.length === 0) { if (!frequentItems || frequentItems.length === 0) {
return []; return [];
...@@ -45,9 +45,9 @@ export const updateExistingFrequentItem = (frequentItem, item) => { ...@@ -45,9 +45,9 @@ export const updateExistingFrequentItem = (frequentItem, item) => {
}; };
}; };
export const sanitizeItem = item => { export const sanitizeItem = (item) => {
// Only sanitize if the key exists on the item // Only sanitize if the key exists on the item
const maybeSanitize = key => { const maybeSanitize = (key) => {
if (!Object.prototype.hasOwnProperty.call(item, key)) { if (!Object.prototype.hasOwnProperty.call(item, key)) {
return {}; return {};
} }
......
...@@ -15,7 +15,7 @@ function sanitize(str) { ...@@ -15,7 +15,7 @@ function sanitize(str) {
} }
export function membersBeforeSave(members) { export function membersBeforeSave(members) {
return members.map(member => { return members.map((member) => {
const GROUP_TYPE = 'Group'; const GROUP_TYPE = 'Group';
let title = ''; let title = '';
...@@ -156,7 +156,7 @@ class GfmAutoComplete { ...@@ -156,7 +156,7 @@ class GfmAutoComplete {
...this.getDefaultCallbacks(), ...this.getDefaultCallbacks(),
beforeSave(commands) { beforeSave(commands) {
if (GfmAutoComplete.isLoading(commands)) return commands; if (GfmAutoComplete.isLoading(commands)) return commands;
return $.map(commands, c => { return $.map(commands, (c) => {
let search = c.name; let search = c.name;
if (c.aliases.length > 0) { if (c.aliases.length > 0) {
search = `${search} ${c.aliases.join(' ')}`; search = `${search} ${c.aliases.join(' ')}`;
...@@ -237,7 +237,7 @@ class GfmAutoComplete { ...@@ -237,7 +237,7 @@ class GfmAutoComplete {
}); });
// return to the form atwho wants // return to the form atwho wants
return results.map(name => ({ name })); return results.map((name) => ({ name }));
}, },
}, },
}); });
...@@ -288,7 +288,7 @@ class GfmAutoComplete { ...@@ -288,7 +288,7 @@ class GfmAutoComplete {
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. // Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands.
command = subtextNodes.find(node => { command = subtextNodes.find((node) => {
if (Object.values(MEMBER_COMMAND).includes(node)) { if (Object.values(MEMBER_COMMAND).includes(node)) {
return node; return node;
} }
...@@ -298,7 +298,7 @@ class GfmAutoComplete { ...@@ -298,7 +298,7 @@ class GfmAutoComplete {
// Cache assignees list for easier filtering later // Cache assignees list for easier filtering later
assignees = assignees =
SidebarMediator.singleton?.store?.assignees?.map( SidebarMediator.singleton?.store?.assignees?.map(
assignee => `${assignee.username} ${assignee.name}`, (assignee) => `${assignee.username} ${assignee.name}`,
) || []; ) || [];
const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers); const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers);
...@@ -316,10 +316,10 @@ class GfmAutoComplete { ...@@ -316,10 +316,10 @@ class GfmAutoComplete {
if (command === MEMBER_COMMAND.ASSIGN) { if (command === MEMBER_COMMAND.ASSIGN) {
// Only include members which are not assigned to Issuable currently // Only include members which are not assigned to Issuable currently
return data.filter(member => !assignees.includes(member.search)); return data.filter((member) => !assignees.includes(member.search));
} else if (command === MEMBER_COMMAND.UNASSIGN) { } else if (command === MEMBER_COMMAND.UNASSIGN) {
// Only include members which are assigned to Issuable currently // Only include members which are assigned to Issuable currently
return data.filter(member => assignees.includes(member.search)); return data.filter((member) => assignees.includes(member.search));
} }
return data; return data;
...@@ -346,7 +346,7 @@ class GfmAutoComplete { ...@@ -346,7 +346,7 @@ class GfmAutoComplete {
callbacks: { callbacks: {
...this.getDefaultCallbacks(), ...this.getDefaultCallbacks(),
beforeSave(issues) { beforeSave(issues) {
return $.map(issues, i => { return $.map(issues, (i) => {
if (i.title == null) { if (i.title == null) {
return i; return i;
} }
...@@ -380,7 +380,7 @@ class GfmAutoComplete { ...@@ -380,7 +380,7 @@ class GfmAutoComplete {
callbacks: { callbacks: {
...this.getDefaultCallbacks(), ...this.getDefaultCallbacks(),
beforeSave(milestones) { beforeSave(milestones) {
return $.map(milestones, m => { return $.map(milestones, (m) => {
if (m.title == null) { if (m.title == null) {
return m; return m;
} }
...@@ -413,7 +413,7 @@ class GfmAutoComplete { ...@@ -413,7 +413,7 @@ class GfmAutoComplete {
callbacks: { callbacks: {
...this.getDefaultCallbacks(), ...this.getDefaultCallbacks(),
beforeSave(merges) { beforeSave(merges) {
return $.map(merges, m => { return $.map(merges, (m) => {
if (m.title == null) { if (m.title == null) {
return m; return m;
} }
...@@ -454,7 +454,7 @@ class GfmAutoComplete { ...@@ -454,7 +454,7 @@ class GfmAutoComplete {
...this.getDefaultCallbacks(), ...this.getDefaultCallbacks(),
beforeSave(merges) { beforeSave(merges) {
if (GfmAutoComplete.isLoading(merges)) return merges; if (GfmAutoComplete.isLoading(merges)) return merges;
return $.map(merges, m => ({ return $.map(merges, (m) => ({
title: sanitize(m.title), title: sanitize(m.title),
color: m.color, color: m.color,
search: m.title, search: m.title,
...@@ -465,7 +465,7 @@ class GfmAutoComplete { ...@@ -465,7 +465,7 @@ class GfmAutoComplete {
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. // Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands.
command = subtextNodes.find(node => { command = subtextNodes.find((node) => {
if ( if (
node === LABEL_COMMAND.LABEL || node === LABEL_COMMAND.LABEL ||
node === LABEL_COMMAND.RELABEL || node === LABEL_COMMAND.RELABEL ||
...@@ -486,7 +486,7 @@ class GfmAutoComplete { ...@@ -486,7 +486,7 @@ class GfmAutoComplete {
return null; return null;
} }
const lastCandidate = subtext.split(flag).pop(); const lastCandidate = subtext.split(flag).pop();
if (labels.find(label => label.title.startsWith(lastCandidate))) { if (labels.find((label) => label.title.startsWith(lastCandidate))) {
return lastCandidate; return lastCandidate;
} }
} else { } else {
...@@ -513,10 +513,10 @@ class GfmAutoComplete { ...@@ -513,10 +513,10 @@ class GfmAutoComplete {
// because we want to return all the labels (unfiltered) for that command. // because we want to return all the labels (unfiltered) for that command.
if (command === LABEL_COMMAND.LABEL) { if (command === LABEL_COMMAND.LABEL) {
// Return labels with set: undefined. // Return labels with set: undefined.
return data.filter(label => !label.set); return data.filter((label) => !label.set);
} else if (command === LABEL_COMMAND.UNLABEL) { } else if (command === LABEL_COMMAND.UNLABEL) {
// Return labels with set: true. // Return labels with set: true.
return data.filter(label => label.set); return data.filter((label) => label.set);
} }
return data; return data;
...@@ -543,7 +543,7 @@ class GfmAutoComplete { ...@@ -543,7 +543,7 @@ class GfmAutoComplete {
callbacks: { callbacks: {
...this.getDefaultCallbacks(), ...this.getDefaultCallbacks(),
beforeSave(snippets) { beforeSave(snippets) {
return $.map(snippets, m => { return $.map(snippets, (m) => {
if (m.title == null) { if (m.title == null) {
return m; return m;
} }
...@@ -648,7 +648,7 @@ class GfmAutoComplete { ...@@ -648,7 +648,7 @@ class GfmAutoComplete {
this.loadEmojiData($input, at).catch(() => {}); this.loadEmojiData($input, at).catch(() => {});
} else if (dataSource) { } else if (dataSource) {
AjaxCache.retrieve(dataSource, true) AjaxCache.retrieve(dataSource, true)
.then(data => { .then((data) => {
this.loadData($input, at, data); this.loadData($input, at, data);
}) })
.catch(() => { .catch(() => {
...@@ -690,11 +690,11 @@ class GfmAutoComplete { ...@@ -690,11 +690,11 @@ class GfmAutoComplete {
} }
lookup[key].push({ kind, emoji }); lookup[key].push({ kind, emoji });
}; };
Object.values(emojis).forEach(emoji => { Object.values(emojis).forEach((emoji) => {
add(emoji.name, 'name', emoji); add(emoji.name, 'name', emoji);
add(emoji.d, 'description', emoji); add(emoji.d, 'description', emoji);
add(emoji.e, 'unicode', emoji); add(emoji.e, 'unicode', emoji);
emoji.aliases.forEach(a => add(a, 'alias', emoji)); emoji.aliases.forEach((a) => add(a, 'alias', emoji));
}); });
this.emojiLookup = lookup; this.emojiLookup = lookup;
...@@ -766,7 +766,7 @@ GfmAutoComplete.atTypeMap = { ...@@ -766,7 +766,7 @@ GfmAutoComplete.atTypeMap = {
}; };
GfmAutoComplete.typesWithBackendFiltering = ['vulnerabilities']; GfmAutoComplete.typesWithBackendFiltering = ['vulnerabilities'];
GfmAutoComplete.isTypeWithBackendFiltering = type => GfmAutoComplete.isTypeWithBackendFiltering = (type) =>
GfmAutoComplete.typesWithBackendFiltering.includes(GfmAutoComplete.atTypeMap[type]); GfmAutoComplete.typesWithBackendFiltering.includes(GfmAutoComplete.atTypeMap[type]);
function findEmoji(name) { function findEmoji(name) {
......
...@@ -16,14 +16,14 @@ export default class GlFieldErrors { ...@@ -16,14 +16,14 @@ export default class GlFieldErrors {
initValidators() { initValidators() {
// register selectors here as needed // register selectors here as needed
const validateSelectors = [':text', ':password', '[type=email]', '[type=url]', '[type=number]'] const validateSelectors = [':text', ':password', '[type=email]', '[type=url]', '[type=number]']
.map(selector => `input${selector}`) .map((selector) => `input${selector}`)
.join(','); .join(',');
this.state.inputs = this.form this.state.inputs = this.form
.find(validateSelectors) .find(validateSelectors)
.toArray() .toArray()
.filter(input => !input.classList.contains(customValidationFlag)) .filter((input) => !input.classList.contains(customValidationFlag))
.map(input => new GlFieldError({ input, formErrors: this })); .map((input) => new GlFieldError({ input, formErrors: this }));
this.form.on('submit', GlFieldErrors.catchInvalidFormSubmit); this.form.on('submit', GlFieldErrors.catchInvalidFormSubmit);
} }
...@@ -45,7 +45,7 @@ export default class GlFieldErrors { ...@@ -45,7 +45,7 @@ export default class GlFieldErrors {
/* Public method for triggering validity updates manually */ /* Public method for triggering validity updates manually */
updateFormValidityState() { updateFormValidityState() {
this.state.inputs.forEach(field => { this.state.inputs.forEach((field) => {
if (field.state.submitted) { if (field.state.submitted) {
field.updateValidity(); field.updateValidity();
} }
......
...@@ -20,7 +20,7 @@ export default class GLForm { ...@@ -20,7 +20,7 @@ export default class GLForm {
// Disable autocomplete for keywords which do not have dataSources available // Disable autocomplete for keywords which do not have dataSources available
const dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {}; const dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {};
Object.keys(this.enableGFM).forEach(item => { Object.keys(this.enableGFM).forEach((item) => {
if (item !== 'emojis' && !dataSources[item]) { if (item !== 'emojis' && !dataSources[item]) {
this.enableGFM[item] = false; this.enableGFM[item] = false;
} }
......
...@@ -28,7 +28,7 @@ export default class GpgBadges { ...@@ -28,7 +28,7 @@ export default class GpgBadges {
return axios return axios
.get(endpoint, { params }) .get(endpoint, { params })
.then(({ data }) => { .then(({ data }) => {
data.signatures.forEach(signature => { data.signatures.forEach((signature) => {
badges.filter(`[data-commit-sha="${signature.commit_sha}"]`).replaceWith(signature.html); badges.filter(`[data-commit-sha="${signature.commit_sha}"]`).replaceWith(signature.html);
}); });
}) })
......
...@@ -24,7 +24,7 @@ export const updateGrafanaIntegration = ({ state, dispatch }) => ...@@ -24,7 +24,7 @@ export const updateGrafanaIntegration = ({ state, dispatch }) =>
}, },
}) })
.then(() => dispatch('receiveGrafanaIntegrationUpdateSuccess')) .then(() => dispatch('receiveGrafanaIntegrationUpdateSuccess'))
.catch(error => dispatch('receiveGrafanaIntegrationUpdateError', error)); .catch((error) => dispatch('receiveGrafanaIntegrationUpdateError', error));
export const receiveGrafanaIntegrationUpdateSuccess = () => { export const receiveGrafanaIntegrationUpdateSuccess = () => {
/** /**
......
...@@ -6,7 +6,7 @@ import mutations from './mutations'; ...@@ -6,7 +6,7 @@ import mutations from './mutations';
Vue.use(Vuex); Vue.use(Vuex);
export const createStore = initialState => export const createStore = (initialState) =>
new Vuex.Store({ new Vuex.Store({
state: createState(initialState), state: createState(initialState),
actions, actions,
......
...@@ -51,4 +51,4 @@ export const convertToGraphQLId = (type, id) => { ...@@ -51,4 +51,4 @@ export const convertToGraphQLId = (type, id) => {
* @param {Array} ids An array of id values * @param {Array} ids An array of id values
* @returns {Array} * @returns {Array}
*/ */
export const convertToGraphQLIds = (type, ids) => ids.map(id => convertToGraphQLId(type, id)); export const convertToGraphQLIds = (type, ids) => ids.map((id) => convertToGraphQLId(type, id));
...@@ -12,7 +12,7 @@ export default class Group { ...@@ -12,7 +12,7 @@ export default class Group {
this.resetHandler = this.reset.bind(this); this.resetHandler = this.reset.bind(this);
this.updateGroupPathSlugHandler = this.updateGroupPathSlug.bind(this); this.updateGroupPathSlugHandler = this.updateGroupPathSlug.bind(this);
this.groupNames.forEach(groupName => { this.groupNames.forEach((groupName) => {
if (groupName.value === '') { if (groupName.value === '') {
groupName.addEventListener('keyup', this.updateHandler); groupName.addEventListener('keyup', this.updateHandler);
...@@ -22,7 +22,7 @@ export default class Group { ...@@ -22,7 +22,7 @@ export default class Group {
} }
}); });
this.groupPaths.forEach(groupPath => { this.groupPaths.forEach((groupPath) => {
groupPath.addEventListener('keydown', this.resetHandler); groupPath.addEventListener('keydown', this.resetHandler);
}); });
} }
...@@ -30,21 +30,21 @@ export default class Group { ...@@ -30,21 +30,21 @@ export default class Group {
update({ currentTarget: { value: updatedValue } }) { update({ currentTarget: { value: updatedValue } }) {
const slug = slugify(updatedValue); const slug = slugify(updatedValue);
this.groupNames.forEach(element => { this.groupNames.forEach((element) => {
element.value = updatedValue; element.value = updatedValue;
}); });
this.groupPaths.forEach(element => { this.groupPaths.forEach((element) => {
element.value = slug; element.value = slug;
}); });
} }
reset() { reset() {
this.groupNames.forEach(groupName => { this.groupNames.forEach((groupName) => {
groupName.removeEventListener('keyup', this.updateHandler); groupName.removeEventListener('keyup', this.updateHandler);
groupName.removeEventListener('blur', this.checkPathHandler); groupName.removeEventListener('blur', this.checkPathHandler);
}); });
this.groupPaths.forEach(groupPath => { this.groupPaths.forEach((groupPath) => {
groupPath.removeEventListener('keydown', this.resetHandler); groupPath.removeEventListener('keydown', this.resetHandler);
}); });
} }
...@@ -59,7 +59,7 @@ export default class Group { ...@@ -59,7 +59,7 @@ export default class Group {
if (exists && suggests.length) { if (exists && suggests.length) {
const [suggestedSlug] = suggests; const [suggestedSlug] = suggests;
this.groupPaths.forEach(element => { this.groupPaths.forEach((element) => {
element.value = suggestedSlug; element.value = suggestedSlug;
}); });
} else if (exists && !suggests.length) { } else if (exists && !suggests.length) {
......
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
.then(() => { .then(() => {
this.isLoading = false; this.isLoading = false;
}) })
.catch(error => { .catch((error) => {
const message = [ const message = [
error.response?.data?.error || __('An error occurred while updating configuration.'), error.response?.data?.error || __('An error occurred while updating configuration.'),
ERROR_MESSAGE, ERROR_MESSAGE,
......
...@@ -108,7 +108,7 @@ export default { ...@@ -108,7 +108,7 @@ export default {
fetchGroups({ parentId, page, filterGroupsBy, sortBy, archived, updatePagination }) { fetchGroups({ parentId, page, filterGroupsBy, sortBy, archived, updatePagination }) {
return this.service return this.service
.getGroups(parentId, page, filterGroupsBy, sortBy, archived) .getGroups(parentId, page, filterGroupsBy, sortBy, archived)
.then(res => { .then((res) => {
if (updatePagination) { if (updatePagination) {
this.updatePagination(res.headers); this.updatePagination(res.headers);
} }
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
sortBy, sortBy,
archived, archived,
updatePagination: true, updatePagination: true,
}).then(res => { }).then((res) => {
this.isLoading = false; this.isLoading = false;
this.updateGroups(res, Boolean(filterGroupsBy)); this.updateGroups(res, Boolean(filterGroupsBy));
}); });
...@@ -149,7 +149,7 @@ export default { ...@@ -149,7 +149,7 @@ export default {
sortBy, sortBy,
archived, archived,
updatePagination: true, updatePagination: true,
}).then(res => { }).then((res) => {
this.isLoading = false; this.isLoading = false;
$.scrollTo(0); $.scrollTo(0);
...@@ -173,7 +173,7 @@ export default { ...@@ -173,7 +173,7 @@ export default {
this.fetchGroups({ this.fetchGroups({
parentId: parentGroup.id, parentId: parentGroup.id,
}) })
.then(res => { .then((res) => {
this.store.setGroupChildren(parentGroup, res); this.store.setGroupChildren(parentGroup, res);
}) })
.catch(() => { .catch(() => {
...@@ -194,12 +194,12 @@ export default { ...@@ -194,12 +194,12 @@ export default {
this.targetGroup.isBeingRemoved = true; this.targetGroup.isBeingRemoved = true;
this.service this.service
.leaveGroup(this.targetGroup.leavePath) .leaveGroup(this.targetGroup.leavePath)
.then(res => { .then((res) => {
$.scrollTo(0); $.scrollTo(0);
this.store.removeGroup(this.targetGroup, this.targetParentGroup); this.store.removeGroup(this.targetGroup, this.targetParentGroup);
this.$toast.show(res.data.notice); this.$toast.show(res.data.notice);
}) })
.catch(err => { .catch((err) => {
let message = COMMON_STR.FAILURE; let message = COMMON_STR.FAILURE;
if (err.status === 403) { if (err.status === 403) {
message = COMMON_STR.LEAVE_FORBIDDEN; message = COMMON_STR.LEAVE_FORBIDDEN;
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
}, },
methods: { methods: {
getDefaultOption() { getDefaultOption() {
return this.visibilityLevelOptions.find(option => option.level === this.defaultLevel); return this.visibilityLevelOptions.find((option) => option.level === this.defaultLevel);
}, },
onClick(option) { onClick(option) {
this.selectedOption = option; this.selectedOption = option;
......
...@@ -18,6 +18,6 @@ export default function initInviteMembersBanner() { ...@@ -18,6 +18,6 @@ export default function initInviteMembersBanner() {
isDismissedKey, isDismissedKey,
trackLabel, trackLabel,
}, },
render: createElement => createElement(InviteMembersBanner), render: (createElement) => createElement(InviteMembersBanner),
}); });
} }
...@@ -38,6 +38,6 @@ export const initGroupMembersApp = ( ...@@ -38,6 +38,6 @@ export const initGroupMembersApp = (
el, el,
components: { App }, components: { App },
store, store,
render: createElement => createElement('app'), render: (createElement) => createElement('app'),
}); });
}; };
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
GROUP_LINK_ACCESS_LEVEL_PROPERTY_NAME, GROUP_LINK_ACCESS_LEVEL_PROPERTY_NAME,
} from './constants'; } from './constants';
export const parseDataAttributes = el => { export const parseDataAttributes = (el) => {
const { members, groupId, memberPath, canManageMembers } = el.dataset; const { members, groupId, memberPath, canManageMembers } = el.dataset;
return { return {
......
...@@ -12,15 +12,15 @@ export default class GroupsStore { ...@@ -12,15 +12,15 @@ export default class GroupsStore {
setGroups(rawGroups) { setGroups(rawGroups) {
if (rawGroups && rawGroups.length) { if (rawGroups && rawGroups.length) {
this.state.groups = rawGroups.map(rawGroup => this.formatGroupItem(rawGroup)); this.state.groups = rawGroups.map((rawGroup) => this.formatGroupItem(rawGroup));
} else { } else {
this.state.groups = []; this.state.groups = [];
} }
} }
setSearchedGroups(rawGroups) { setSearchedGroups(rawGroups) {
const formatGroups = groups => const formatGroups = (groups) =>
groups.map(group => { groups.map((group) => {
const formattedGroup = this.formatGroupItem(group); const formattedGroup = this.formatGroupItem(group);
if (formattedGroup.children && formattedGroup.children.length) { if (formattedGroup.children && formattedGroup.children.length) {
formattedGroup.children = formatGroups(formattedGroup.children); formattedGroup.children = formatGroups(formattedGroup.children);
...@@ -37,7 +37,7 @@ export default class GroupsStore { ...@@ -37,7 +37,7 @@ export default class GroupsStore {
setGroupChildren(parentGroup, children) { setGroupChildren(parentGroup, children) {
const updatedParentGroup = parentGroup; const updatedParentGroup = parentGroup;
updatedParentGroup.children = children.map(rawChild => this.formatGroupItem(rawChild)); updatedParentGroup.children = children.map((rawChild) => this.formatGroupItem(rawChild));
updatedParentGroup.isOpen = true; updatedParentGroup.isOpen = true;
updatedParentGroup.isChildrenLoading = false; updatedParentGroup.isChildrenLoading = false;
} }
...@@ -103,9 +103,9 @@ export default class GroupsStore { ...@@ -103,9 +103,9 @@ export default class GroupsStore {
removeGroup(group, parentGroup) { removeGroup(group, parentGroup) {
const updatedParentGroup = parentGroup; const updatedParentGroup = parentGroup;
if (updatedParentGroup.children && updatedParentGroup.children.length) { if (updatedParentGroup.children && updatedParentGroup.children.length) {
updatedParentGroup.children = parentGroup.children.filter(child => group.id !== child.id); updatedParentGroup.children = parentGroup.children.filter((child) => group.id !== child.id);
} else { } else {
this.state.groups = this.state.groups.filter(child => group.id !== child.id); this.state.groups = this.state.groups.filter((child) => group.id !== child.id);
} }
} }
} }
...@@ -20,11 +20,11 @@ export default class TransferDropdown { ...@@ -20,11 +20,11 @@ export default class TransferDropdown {
initDeprecatedJQueryDropdown(this.groupDropdown, { initDeprecatedJQueryDropdown(this.groupDropdown, {
selectable: true, selectable: true,
filterable: true, filterable: true,
toggleLabel: item => item.text, toggleLabel: (item) => item.text,
search: { fields: ['text'] }, search: { fields: ['text'] },
data: extraOptions.concat(this.data), data: extraOptions.concat(this.data),
text: item => item.text, text: (item) => item.text,
clicked: options => { clicked: (options) => {
const { e } = options; const { e } = options;
e.preventDefault(); e.preventDefault();
this.assignSelected(options.selectedObj); this.assignSelected(options.selectedObj);
......
...@@ -6,11 +6,11 @@ import { normalizeHeaders } from './lib/utils/common_utils'; ...@@ -6,11 +6,11 @@ import { normalizeHeaders } from './lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { loadCSSFile } from './lib/utils/css_utils'; import { loadCSSFile } from './lib/utils/css_utils';
const fetchGroups = params => { const fetchGroups = (params) => {
axios[params.type.toLowerCase()](params.url, { axios[params.type.toLowerCase()](params.url, {
params: params.data, params: params.data,
}) })
.then(res => { .then((res) => {
const results = res.data || []; const results = res.data || [];
const headers = normalizeHeaders(res.headers); const headers = normalizeHeaders(res.headers);
const currentPage = parseInt(headers['X-PAGE'], 10) || 0; const currentPage = parseInt(headers['X-PAGE'], 10) || 0;
...@@ -67,7 +67,7 @@ const groupsSelect = () => { ...@@ -67,7 +67,7 @@ const groupsSelect = () => {
const groups = data.length ? data : data.results || []; const groups = data.length ? data : data.results || [];
const more = data.pagination ? data.pagination.more : false; const more = data.pagination ? data.pagination.more : false;
const results = groups.filter(group => skipGroups.indexOf(group.id) === -1); const results = groups.filter((group) => skipGroups.indexOf(group.id) === -1);
return { return {
results, results,
......
...@@ -45,7 +45,7 @@ class EventHub { ...@@ -45,7 +45,7 @@ class EventHub {
$off(type, handler) { $off(type, handler) {
const handlers = this.$_all.get(type) || []; const handlers = this.$_all.get(type) || [];
const newHandlers = handler ? handlers.filter(x => x !== handler) : []; const newHandlers = handler ? handlers.filter((x) => x !== handler) : [];
if (newHandlers.length) { if (newHandlers.length) {
this.$_all.set(type, newHandlers); this.$_all.set(type, newHandlers);
...@@ -77,7 +77,7 @@ class EventHub { ...@@ -77,7 +77,7 @@ class EventHub {
$emit(type, ...args) { $emit(type, ...args) {
const handlers = this.$_all.get(type) || []; const handlers = this.$_all.get(type) || [];
handlers.forEach(handler => { handlers.forEach((handler) => {
handler(...args); handler(...args);
}); });
} }
......
...@@ -38,7 +38,7 @@ const templatedLabel = (queryLabel, metricAttributes) => { ...@@ -38,7 +38,7 @@ const templatedLabel = (queryLabel, metricAttributes) => {
* @example * @example
* multiMetricLabel('', {__name__: "up", app: "prometheus"}) -> "__name__: up, app: prometheus" * multiMetricLabel('', {__name__: "up", app: "prometheus"}) -> "__name__: up, app: prometheus"
*/ */
const multiMetricLabel = metricAttributes => { const multiMetricLabel = (metricAttributes) => {
return Object.entries(metricAttributes) return Object.entries(metricAttributes)
.map(([templateVar, label]) => `${templateVar}: ${label}`) .map(([templateVar, label]) => `${templateVar}: ${label}`)
.join(', '); .join(', ');
...@@ -64,7 +64,7 @@ export const getSeriesLabel = (queryLabel, metricAttributes) => { ...@@ -64,7 +64,7 @@ export const getSeriesLabel = (queryLabel, metricAttributes) => {
* @returns {Array} The formatted values * @returns {Array} The formatted values
*/ */
export const makeDataSeries = (queryResults, defaultConfig) => export const makeDataSeries = (queryResults, defaultConfig) =>
queryResults.map(result => { queryResults.map((result) => {
return { return {
...defaultConfig, ...defaultConfig,
data: result.values, data: result.values,
......
...@@ -23,13 +23,13 @@ const handleStartupEvents = () => { ...@@ -23,13 +23,13 @@ const handleStartupEvents = () => {
/* For `waitForCSSLoaded` methods, see docs.gitlab.com/ee/development/fe_guide/performance.html#important-considerations */ /* For `waitForCSSLoaded` methods, see docs.gitlab.com/ee/development/fe_guide/performance.html#important-considerations */
export const waitForCSSLoaded = (action = () => {}) => { export const waitForCSSLoaded = (action = () => {}) => {
if (!gon?.features?.startupCss || allLinksLoaded()) { if (!gon?.features?.startupCss || allLinksLoaded()) {
return new Promise(resolve => { return new Promise((resolve) => {
action(); action();
resolve(); resolve();
}); });
} }
return new Promise(resolve => { return new Promise((resolve) => {
document.addEventListener(CSS_LOADED_EVENT, resolve, { once: true }); document.addEventListener(CSS_LOADED_EVENT, resolve, { once: true });
document.addEventListener(STARTUP_LINK_LOADED_EVENT, handleStartupEvents); document.addEventListener(STARTUP_LINK_LOADED_EVENT, handleStartupEvents);
}).then(action); }).then(action);
......
import { commitItemIconMap } from './constants'; import { commitItemIconMap } from './constants';
export default file => { export default (file) => {
if (file.deleted) { if (file.deleted) {
return commitItemIconMap.deleted; return commitItemIconMap.deleted;
} else if (file.tempFile && !file.prevPath) { } else if (file.tempFile && !file.prevPath) {
......
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