Commit 2a753263 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'leipert-prettier-arrow-parens-6' into 'master'

Format files with prettier arrowParens [6/15]

See merge request gitlab-org/gitlab!50532
parents 9a5c0155 bcbbcb2e
...@@ -9,7 +9,7 @@ export default class PerformanceBarService { ...@@ -9,7 +9,7 @@ export default class PerformanceBarService {
} }
static registerInterceptor(peekUrl, callback) { static registerInterceptor(peekUrl, callback) {
PerformanceBarService.interceptor = response => { PerformanceBarService.interceptor = (response) => {
const [fireCallback, requestId, requestUrl] = PerformanceBarService.callbackParams( const [fireCallback, requestId, requestUrl] = PerformanceBarService.callbackParams(
response, response,
peekUrl, peekUrl,
......
...@@ -20,7 +20,7 @@ export default class PerformanceBarStore { ...@@ -20,7 +20,7 @@ export default class PerformanceBarStore {
} }
findRequest(requestId) { findRequest(requestId) {
return this.requests.find(request => request.id === requestId); return this.requests.find((request) => request.id === requestId);
} }
addRequestDetails(requestId, requestDetails) { addRequestDetails(requestId, requestDetails) {
...@@ -43,13 +43,13 @@ export default class PerformanceBarStore { ...@@ -43,13 +43,13 @@ export default class PerformanceBarStore {
} }
requestsWithDetails() { requestsWithDetails() {
return this.requests.filter(request => request.details); return this.requests.filter((request) => request.details);
} }
canTrackRequest(requestUrl) { canTrackRequest(requestUrl) {
return ( return (
requestUrl.endsWith('/api/graphql') || requestUrl.endsWith('/api/graphql') ||
this.requests.filter(request => request.url === requestUrl).length < 2 this.requests.filter((request) => request.url === requestUrl).length < 2
); );
} }
......
...@@ -28,10 +28,10 @@ export default class PersistentUserCallout { ...@@ -28,10 +28,10 @@ export default class PersistentUserCallout {
} }
handleCloseButtonCallout(closeButton) { handleCloseButtonCallout(closeButton) {
closeButton.addEventListener('click', event => this.dismiss(event)); closeButton.addEventListener('click', (event) => this.dismiss(event));
if (this.deferLinks) { if (this.deferLinks) {
this.container.addEventListener('click', event => { this.container.addEventListener('click', (event) => {
const isDeferredLink = event.target.classList.contains(DEFERRED_LINK_CLASS); const isDeferredLink = event.target.classList.contains(DEFERRED_LINK_CLASS);
if (isDeferredLink) { if (isDeferredLink) {
const { href, target } = event.target; const { href, target } = event.target;
...@@ -43,7 +43,7 @@ export default class PersistentUserCallout { ...@@ -43,7 +43,7 @@ export default class PersistentUserCallout {
} }
handleFollowLinkCallout(followLink) { handleFollowLinkCallout(followLink) {
followLink.addEventListener('click', event => this.registerCalloutWithLink(event)); followLink.addEventListener('click', (event) => this.registerCalloutWithLink(event));
} }
dismiss(event, deferredLinkOptions = null) { dismiss(event, deferredLinkOptions = null) {
......
...@@ -11,7 +11,7 @@ const PERSISTENT_USER_CALLOUTS = [ ...@@ -11,7 +11,7 @@ const PERSISTENT_USER_CALLOUTS = [
]; ];
const initCallouts = () => { const initCallouts = () => {
PERSISTENT_USER_CALLOUTS.forEach(calloutContainer => PERSISTENT_USER_CALLOUTS.forEach((calloutContainer) =>
PersistentUserCallout.factory(document.querySelector(calloutContainer)), PersistentUserCallout.factory(document.querySelector(calloutContainer)),
); );
}; };
......
...@@ -18,7 +18,7 @@ export const resolvers = { ...@@ -18,7 +18,7 @@ export const resolvers = {
valid: data.valid, valid: data.valid,
errors: data.errors, errors: data.errors,
warnings: data.warnings, warnings: data.warnings,
jobs: data.jobs.map(job => { jobs: data.jobs.map((job) => {
const only = job.only ? { refs: job.only.refs, __typename: 'CiLintJobOnlyPolicy' } : null; const only = job.only ? { refs: job.only.refs, __typename: 'CiLintJobOnlyPolicy' } : null;
return { return {
......
...@@ -121,12 +121,12 @@ export default { ...@@ -121,12 +121,12 @@ export default {
return this.searchTerm.toLowerCase(); return this.searchTerm.toLowerCase();
}, },
filteredBranches() { filteredBranches() {
return this.branches.filter(branch => return this.branches.filter((branch) =>
branch.shortName.toLowerCase().includes(this.lowerCasedSearchTerm), branch.shortName.toLowerCase().includes(this.lowerCasedSearchTerm),
); );
}, },
filteredTags() { filteredTags() {
return this.tags.filter(tag => return this.tags.filter((tag) =>
tag.shortName.toLowerCase().includes(this.lowerCasedSearchTerm), tag.shortName.toLowerCase().includes(this.lowerCasedSearchTerm),
); );
}, },
...@@ -187,7 +187,7 @@ export default { ...@@ -187,7 +187,7 @@ export default {
setVariable(refValue, type, key, value) { setVariable(refValue, type, key, value) {
const { variables } = this.form[refValue]; const { variables } = this.form[refValue];
const variable = variables.find(v => v.key === key); const variable = variables.find((v) => v.key === key);
if (variable) { if (variable) {
variable.type = type; variable.type = type;
variable.value = value; variable.value = value;
...@@ -270,11 +270,11 @@ export default { ...@@ -270,11 +270,11 @@ export default {
stop(data); stop(data);
} }
}) })
.catch(error => { .catch((error) => {
stop(error); stop(error);
}); });
}, CONFIG_VARIABLES_TIMEOUT) }, CONFIG_VARIABLES_TIMEOUT)
.then(data => { .then((data) => {
const params = {}; const params = {};
const descriptions = {}; const descriptions = {};
...@@ -287,7 +287,7 @@ export default { ...@@ -287,7 +287,7 @@ export default {
return { params, descriptions }; return { params, descriptions };
}) })
.catch(error => { .catch((error) => {
this.isLoading = false; this.isLoading = false;
Sentry.captureException(error); Sentry.captureException(error);
...@@ -314,7 +314,7 @@ export default { ...@@ -314,7 +314,7 @@ export default {
.then(({ data }) => { .then(({ data }) => {
redirectTo(`${this.pipelinesPath}/${data.id}`); redirectTo(`${this.pipelinesPath}/${data.id}`);
}) })
.catch(err => { .catch((err) => {
const { errors, warnings, total_warnings: totalWarnings } = err.response.data; const { errors, warnings, total_warnings: totalWarnings } = err.response.data;
const [error] = errors; const [error] = errors;
this.error = error; this.error = error;
......
...@@ -3,7 +3,7 @@ import { BRANCH_REF_TYPE, TAG_REF_TYPE } from '../constants'; ...@@ -3,7 +3,7 @@ import { BRANCH_REF_TYPE, TAG_REF_TYPE } from '../constants';
export default (refs, type) => { export default (refs, type) => {
let fullName; let fullName;
return refs.map(ref => { return refs.map((ref) => {
if (type === BRANCH_REF_TYPE) { if (type === BRANCH_REF_TYPE) {
fullName = `refs/heads/${ref}`; fullName = `refs/heads/${ref}`;
} else if (type === TAG_REF_TYPE) { } else if (type === TAG_REF_TYPE) {
......
...@@ -56,15 +56,15 @@ export default { ...@@ -56,15 +56,15 @@ export default {
const unwrappedGroups = stages const unwrappedGroups = stages
.map(({ name, groups: { nodes: groups } }) => { .map(({ name, groups: { nodes: groups } }) => {
return groups.map(group => { return groups.map((group) => {
return { category: name, ...group }; return { category: name, ...group };
}); });
}) })
.flat(2); .flat(2);
const nodes = unwrappedGroups.map(group => { const nodes = unwrappedGroups.map((group) => {
const jobs = group.jobs.nodes.map(({ name, needs }) => { const jobs = group.jobs.nodes.map(({ name, needs }) => {
return { name, needs: needs.nodes.map(need => need.name) }; return { name, needs: needs.nodes.map((need) => need.name) };
}); });
return { ...group, jobs }; return { ...group, jobs };
......
...@@ -173,7 +173,7 @@ export default { ...@@ -173,7 +173,7 @@ export default {
createClip(link) { createClip(link) {
return link return link
.append('clipPath') .append('clipPath')
.attr('id', d => { .attr('id', (d) => {
return this.createAndAssignId(d, 'clipId', 'dag-clip'); return this.createAndAssignId(d, 'clipId', 'dag-clip');
}) })
.append('path') .append('path')
...@@ -183,7 +183,7 @@ export default { ...@@ -183,7 +183,7 @@ export default {
createGradient(link) { createGradient(link) {
const gradient = link const gradient = link
.append('linearGradient') .append('linearGradient')
.attr('id', d => { .attr('id', (d) => {
return this.createAndAssignId(d, 'gradId', 'dag-grad'); return this.createAndAssignId(d, 'gradId', 'dag-grad');
}) })
.attr('gradientUnits', 'userSpaceOnUse') .attr('gradientUnits', 'userSpaceOnUse')
...@@ -251,7 +251,7 @@ export default { ...@@ -251,7 +251,7 @@ export default {
.data(linksData) .data(linksData)
.enter() .enter()
.append('g') .append('g')
.attr('id', d => { .attr('id', (d) => {
return this.createAndAssignId(d, 'uid', LINK_SELECTOR); return this.createAndAssignId(d, 'uid', LINK_SELECTOR);
}) })
.classed( .classed(
...@@ -273,10 +273,10 @@ export default { ...@@ -273,10 +273,10 @@ export default {
`${NODE_SELECTOR} gl-transition-property-stroke ${this.$options.viewOptions.hoverFadeClasses}`, `${NODE_SELECTOR} gl-transition-property-stroke ${this.$options.viewOptions.hoverFadeClasses}`,
true, true,
) )
.attr('id', d => { .attr('id', (d) => {
return this.createAndAssignId(d, 'uid', NODE_SELECTOR); return this.createAndAssignId(d, 'uid', NODE_SELECTOR);
}) })
.attr('stroke', d => { .attr('stroke', (d) => {
const color = this.color(d); const color = this.color(d);
/* eslint-disable-next-line no-param-reassign */ /* eslint-disable-next-line no-param-reassign */
d.color = color; d.color = color;
...@@ -284,10 +284,10 @@ export default { ...@@ -284,10 +284,10 @@ export default {
}) })
.attr('stroke-width', nodeWidth) .attr('stroke-width', nodeWidth)
.attr('stroke-linecap', 'round') .attr('stroke-linecap', 'round')
.attr('x1', d => Math.floor((d.x1 + d.x0) / 2)) .attr('x1', (d) => Math.floor((d.x1 + d.x0) / 2))
.attr('x2', d => Math.floor((d.x1 + d.x0) / 2)) .attr('x2', (d) => Math.floor((d.x1 + d.x0) / 2))
.attr('y1', d => d.y0 + 4) .attr('y1', (d) => d.y0 + 4)
.attr('y2', d => d.y1 - 4); .attr('y2', (d) => d.y1 - 4);
}, },
initColors() { initColors() {
......
...@@ -92,8 +92,8 @@ export const createSankey = ({ ...@@ -92,8 +92,8 @@ export const createSankey = ({
]); ]);
return ({ nodes, links }) => return ({ nodes, links }) =>
sankeyGenerator({ sankeyGenerator({
nodes: nodes.map(d => ({ ...d })), nodes: nodes.map((d) => ({ ...d })),
links: links.map(d => ({ ...d })), links: links.map((d) => ({ ...d })),
}); });
}; };
......
...@@ -13,22 +13,22 @@ export const getLiveLinksAsDict = () => { ...@@ -13,22 +13,22 @@ export const getLiveLinksAsDict = () => {
return Object.fromEntries( return Object.fromEntries(
getLiveLinks() getLiveLinks()
.data() .data()
.map(d => [d.uid, d]), .map((d) => [d.uid, d]),
); );
}; };
export const currentIsLive = (idx, collection) => export const currentIsLive = (idx, collection) =>
getCurrent(idx, collection).classed(IS_HIGHLIGHTED); getCurrent(idx, collection).classed(IS_HIGHLIGHTED);
const backgroundLinks = selection => selection.style('stroke-opacity', highlightOut); const backgroundLinks = (selection) => selection.style('stroke-opacity', highlightOut);
const backgroundNodes = selection => selection.attr('stroke', '#f2f2f2'); const backgroundNodes = (selection) => selection.attr('stroke', '#f2f2f2');
const foregroundLinks = selection => selection.style('stroke-opacity', highlightIn); const foregroundLinks = (selection) => selection.style('stroke-opacity', highlightIn);
const foregroundNodes = selection => selection.attr('stroke', d => d.color); const foregroundNodes = (selection) => selection.attr('stroke', (d) => d.color);
const renewLinks = (selection, baseOpacity) => selection.style('stroke-opacity', baseOpacity); const renewLinks = (selection, baseOpacity) => selection.style('stroke-opacity', baseOpacity);
const renewNodes = selection => selection.attr('stroke', d => d.color); const renewNodes = (selection) => selection.attr('stroke', (d) => d.color);
export const getAllLinkAncestors = node => { export const getAllLinkAncestors = (node) => {
if (node.targetLinks) { if (node.targetLinks) {
return node.targetLinks.flatMap(n => { return node.targetLinks.flatMap((n) => {
return [n, ...getAllLinkAncestors(n.source)]; return [n, ...getAllLinkAncestors(n.source)];
}); });
} }
...@@ -36,11 +36,11 @@ export const getAllLinkAncestors = node => { ...@@ -36,11 +36,11 @@ export const getAllLinkAncestors = node => {
return []; return [];
}; };
const getAllNodeAncestors = node => { const getAllNodeAncestors = (node) => {
let allNodes = []; let allNodes = [];
if (node.targetLinks) { if (node.targetLinks) {
allNodes = node.targetLinks.flatMap(n => { allNodes = node.targetLinks.flatMap((n) => {
return getAllNodeAncestors(n.source); return getAllNodeAncestors(n.source);
}); });
} }
...@@ -74,7 +74,7 @@ const highlightPath = (parentLinks, parentNodes) => { ...@@ -74,7 +74,7 @@ const highlightPath = (parentLinks, parentNodes) => {
}); });
/* highlight correct nodes */ /* highlight correct nodes */
parentNodes.forEach(id => { parentNodes.forEach((id) => {
foregroundNodes(d3.select(`#${id}`)).classed(IS_HIGHLIGHTED, true); foregroundNodes(d3.select(`#${id}`)).classed(IS_HIGHLIGHTED, true);
}); });
}; };
...@@ -86,7 +86,7 @@ const restoreNodes = () => { ...@@ -86,7 +86,7 @@ const restoreNodes = () => {
rehighlights their nodes. rehighlights their nodes.
*/ */
getLiveLinks().each(d => { getLiveLinks().each((d) => {
foregroundNodes(d3.select(`#${d.source.uid}`)).classed(IS_HIGHLIGHTED, true); foregroundNodes(d3.select(`#${d.source.uid}`)).classed(IS_HIGHLIGHTED, true);
foregroundNodes(d3.select(`#${d.target.uid}`)).classed(IS_HIGHLIGHTED, true); foregroundNodes(d3.select(`#${d.target.uid}`)).classed(IS_HIGHLIGHTED, true);
}); });
...@@ -97,7 +97,7 @@ const restorePath = (parentLinks, parentNodes, baseOpacity) => { ...@@ -97,7 +97,7 @@ const restorePath = (parentLinks, parentNodes, baseOpacity) => {
renewLinks(d3.select(`#${uid}`), baseOpacity).classed(IS_HIGHLIGHTED, false); renewLinks(d3.select(`#${uid}`), baseOpacity).classed(IS_HIGHLIGHTED, false);
}); });
parentNodes.forEach(id => { parentNodes.forEach((id) => {
d3.select(`#${id}`).classed(IS_HIGHLIGHTED, false); d3.select(`#${id}`).classed(IS_HIGHLIGHTED, false);
}); });
...@@ -112,7 +112,7 @@ const restorePath = (parentLinks, parentNodes, baseOpacity) => { ...@@ -112,7 +112,7 @@ const restorePath = (parentLinks, parentNodes, baseOpacity) => {
restoreNodes(); restoreNodes();
}; };
export const restoreLinks = baseOpacity => { export const restoreLinks = (baseOpacity) => {
/* /*
if there exist live links, reset to highlight out / pale if there exist live links, reset to highlight out / pale
otherwise, reset to base otherwise, reset to base
......
...@@ -78,11 +78,11 @@ export default { ...@@ -78,11 +78,11 @@ export default {
return ( return (
this.pipeline.triggered_by && this.pipeline.triggered_by &&
Array.isArray(this.pipeline.triggered_by) && Array.isArray(this.pipeline.triggered_by) &&
this.pipeline.triggered_by.find(el => el.isExpanded) this.pipeline.triggered_by.find((el) => el.isExpanded)
); );
}, },
expandedDownstream() { expandedDownstream() {
return this.pipeline.triggered && this.pipeline.triggered.find(el => el.isExpanded); return this.pipeline.triggered && this.pipeline.triggered.find((el) => el.isExpanded);
}, },
pipelineTypeUpstream() { pipelineTypeUpstream() {
return this.type !== this.$options.downstream && this.expandedUpstream; return this.type !== this.$options.downstream && this.expandedUpstream;
......
...@@ -9,7 +9,7 @@ const addMulti = (mainPipelineProjectPath, linkedPipeline) => { ...@@ -9,7 +9,7 @@ const addMulti = (mainPipelineProjectPath, linkedPipeline) => {
}; };
}; };
const transformId = linkedPipeline => { const transformId = (linkedPipeline) => {
return { ...linkedPipeline, id: getIdFromGraphQLId(linkedPipeline.id) }; return { ...linkedPipeline, id: getIdFromGraphQLId(linkedPipeline.id) };
}; };
...@@ -42,7 +42,7 @@ const unwrapPipelineData = (mainPipelineProjectPath, data) => { ...@@ -42,7 +42,7 @@ const unwrapPipelineData = (mainPipelineProjectPath, data) => {
}; };
const toggleQueryPollingByVisibility = (queryRef, interval = 10000) => { const toggleQueryPollingByVisibility = (queryRef, interval = 10000) => {
const stopStartQuery = query => { const stopStartQuery = (query) => {
if (!Visibility.hidden()) { if (!Visibility.hidden()) {
query.startPolling(interval); query.startPolling(interval);
} else { } else {
......
...@@ -54,7 +54,7 @@ export default { ...@@ -54,7 +54,7 @@ export default {
iid: this.pipelineIid, iid: this.pipelineIid,
}; };
}, },
update: data => data.project.pipeline, update: (data) => data.project.pipeline,
error() { error() {
this.reportFailure(LOAD_FAILURE); this.reportFailure(LOAD_FAILURE);
}, },
......
...@@ -33,15 +33,15 @@ import { uniqWith, isEqual } from 'lodash'; ...@@ -33,15 +33,15 @@ import { uniqWith, isEqual } from 'lodash';
10 -> value (constant) 10 -> value (constant)
*/ */
export const createNodeDict = nodes => { export const createNodeDict = (nodes) => {
return nodes.reduce((acc, node) => { return nodes.reduce((acc, node) => {
const newNode = { const newNode = {
...node, ...node,
needs: node.jobs.map(job => job.needs || []).flat(), needs: node.jobs.map((job) => job.needs || []).flat(),
}; };
if (node.size > 1) { if (node.size > 1) {
node.jobs.forEach(job => { node.jobs.forEach((job) => {
acc[job.name] = newNode; acc[job.name] = newNode;
}); });
} }
...@@ -54,13 +54,13 @@ export const createNodeDict = nodes => { ...@@ -54,13 +54,13 @@ export const createNodeDict = nodes => {
export const makeLinksFromNodes = (nodes, nodeDict) => { export const makeLinksFromNodes = (nodes, nodeDict) => {
const constantLinkValue = 10; // all links are the same weight const constantLinkValue = 10; // all links are the same weight
return nodes return nodes
.map(group => { .map((group) => {
return group.jobs.map(job => { return group.jobs.map((job) => {
if (!job.needs) { if (!job.needs) {
return []; return [];
} }
return job.needs.map(needed => { return job.needs.map((needed) => {
return { return {
source: nodeDict[needed]?.name, source: nodeDict[needed]?.name,
target: group.name, target: group.name,
...@@ -74,7 +74,7 @@ export const makeLinksFromNodes = (nodes, nodeDict) => { ...@@ -74,7 +74,7 @@ export const makeLinksFromNodes = (nodes, nodeDict) => {
export const getAllAncestors = (nodes, nodeDict) => { export const getAllAncestors = (nodes, nodeDict) => {
const needs = nodes const needs = nodes
.map(node => { .map((node) => {
return nodeDict[node].needs || ''; return nodeDict[node].needs || '';
}) })
.flat() .flat()
...@@ -102,13 +102,13 @@ export const filterByAncestors = (links, nodeDict) => ...@@ -102,13 +102,13 @@ export const filterByAncestors = (links, nodeDict) =>
*/ */
const targetNode = target; const targetNode = target;
const targetNodeNeeds = nodeDict[targetNode].needs; const targetNodeNeeds = nodeDict[targetNode].needs;
const targetNodeNeedsMinusSource = targetNodeNeeds.filter(need => need !== source); const targetNodeNeedsMinusSource = targetNodeNeeds.filter((need) => need !== source);
const allAncestors = getAllAncestors(targetNodeNeedsMinusSource, nodeDict); const allAncestors = getAllAncestors(targetNodeNeedsMinusSource, nodeDict);
return !allAncestors.includes(source); return !allAncestors.includes(source);
}); });
export const parseData = nodes => { export const parseData = (nodes) => {
const nodeDict = createNodeDict(nodes); const nodeDict = createNodeDict(nodes);
const allLinks = makeLinksFromNodes(nodes, nodeDict); const allLinks = makeLinksFromNodes(nodes, nodeDict);
const filteredLinks = filterByAncestors(allLinks, nodeDict); const filteredLinks = filterByAncestors(allLinks, nodeDict);
...@@ -121,7 +121,7 @@ export const parseData = nodes => { ...@@ -121,7 +121,7 @@ export const parseData = nodes => {
The number of nodes in the most populous generation drives the height of the graph. The number of nodes in the most populous generation drives the height of the graph.
*/ */
export const getMaxNodes = nodes => { export const getMaxNodes = (nodes) => {
const counts = nodes.reduce((acc, { layer }) => { const counts = nodes.reduce((acc, { layer }) => {
if (!acc[layer]) { if (!acc[layer]) {
acc[layer] = 0; acc[layer] = 0;
...@@ -141,6 +141,6 @@ export const getMaxNodes = nodes => { ...@@ -141,6 +141,6 @@ export const getMaxNodes = nodes => {
to find nodes that have no relations. to find nodes that have no relations.
*/ */
export const removeOrphanNodes = sankeyfiedNodes => { export const removeOrphanNodes = (sankeyfiedNodes) => {
return sankeyfiedNodes.filter(node => node.sourceLinks.length || node.targetLinks.length); return sankeyfiedNodes.filter((node) => node.sourceLinks.length || node.targetLinks.length);
}; };
...@@ -14,7 +14,7 @@ import { createUniqueLinkId } from '../../utils'; ...@@ -14,7 +14,7 @@ import { createUniqueLinkId } from '../../utils';
export const generateLinksData = ({ links }, containerID) => { export const generateLinksData = ({ links }, containerID) => {
const containerEl = document.getElementById(containerID); const containerEl = document.getElementById(containerID);
return links.map(link => { return links.map((link) => {
const path = d3.path(); const path = d3.path();
const sourceId = link.source; const sourceId = link.source;
......
...@@ -111,13 +111,13 @@ export default { ...@@ -111,13 +111,13 @@ export default {
// If you are hovering on a job, then the links we want to highlight are: // If you are hovering on a job, then the links we want to highlight are:
// All the links whose `source` and `target` are highlighted jobs. // All the links whose `source` and `target` are highlighted jobs.
if (this.hasHighlightedJob) { if (this.hasHighlightedJob) {
const filteredLinks = this.links.filter(link => { const filteredLinks = this.links.filter((link) => {
return ( return (
this.highlightedJobs.includes(link.source) && this.highlightedJobs.includes(link.target) this.highlightedJobs.includes(link.source) && this.highlightedJobs.includes(link.target)
); );
}); });
return filteredLinks.map(link => link.ref); return filteredLinks.map((link) => link.ref);
} }
return []; return [];
......
...@@ -246,7 +246,7 @@ export default { ...@@ -246,7 +246,7 @@ export default {
filterPipelines(filters) { filterPipelines(filters) {
this.resetRequestData(); this.resetRequestData();
filters.forEach(filter => { filters.forEach((filter) => {
// do not add Any for username query param, so we // do not add Any for username query param, so we
// can fetch all trigger authors // can fetch all trigger authors
if ( if (
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
}, },
computed: { computed: {
selectedTypes() { selectedTypes() {
return this.value.map(i => i.type); return this.value.map((i) => i.type);
}, },
tokens() { tokens() {
return [ return [
......
...@@ -124,7 +124,7 @@ export default { ...@@ -124,7 +124,7 @@ export default {
$( $(
'.js-builds-dropdown-list button, .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item', '.js-builds-dropdown-list button, .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item',
this.$el, this.$el,
).on('click', e => { ).on('click', (e) => {
e.stopPropagation(); e.stopPropagation();
}); });
}, },
......
...@@ -34,10 +34,10 @@ export default { ...@@ -34,10 +34,10 @@ export default {
fetchBranches(searchterm) { fetchBranches(searchterm) {
Api.branches(this.config.projectId, searchterm) Api.branches(this.config.projectId, searchterm)
.then(({ data }) => { .then(({ data }) => {
this.branches = data.map(branch => branch.name); this.branches = data.map((branch) => branch.name);
this.loading = false; this.loading = false;
}) })
.catch(err => { .catch((err) => {
createFlash(FETCH_BRANCH_ERROR_MESSAGE); createFlash(FETCH_BRANCH_ERROR_MESSAGE);
this.loading = false; this.loading = false;
throw err; throw err;
......
...@@ -72,7 +72,7 @@ export default { ...@@ -72,7 +72,7 @@ export default {
]; ];
}, },
findActiveStatus() { findActiveStatus() {
return this.statuses.find(status => status.value === this.value.data); return this.statuses.find((status) => status.value === this.value.data);
}, },
}, },
}; };
......
...@@ -34,10 +34,10 @@ export default { ...@@ -34,10 +34,10 @@ export default {
fetchTags(searchTerm) { fetchTags(searchTerm) {
Api.tags(this.config.projectId, searchTerm) Api.tags(this.config.projectId, searchTerm)
.then(({ data }) => { .then(({ data }) => {
this.tags = data.map(tag => tag.name); this.tags = data.map((tag) => tag.name);
this.loading = false; this.loading = false;
}) })
.catch(err => { .catch((err) => {
createFlash(FETCH_TAG_ERROR_MESSAGE); createFlash(FETCH_TAG_ERROR_MESSAGE);
this.loading = false; this.loading = false;
throw err; throw err;
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
return this.value.data.toLowerCase(); return this.value.data.toLowerCase();
}, },
activeUser() { activeUser() {
return this.users.find(user => { return this.users.find((user) => {
return user.username.toLowerCase() === this.currentValue; return user.username.toLowerCase() === this.currentValue;
}); });
}, },
...@@ -56,11 +56,11 @@ export default { ...@@ -56,11 +56,11 @@ export default {
methods: { methods: {
fetchProjectUsers(searchTerm) { fetchProjectUsers(searchTerm) {
Api.projectUsers(this.config.projectId, searchTerm) Api.projectUsers(this.config.projectId, searchTerm)
.then(users => { .then((users) => {
this.users = users; this.users = users;
this.loading = false; this.loading = false;
}) })
.catch(err => { .catch((err) => {
createFlash(FETCH_AUTHOR_ERROR_MESSAGE); createFlash(FETCH_AUTHOR_ERROR_MESSAGE);
this.loading = false; this.loading = false;
throw err; throw err;
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
export const unwrapArrayOfJobs = (stages = []) => { export const unwrapArrayOfJobs = (stages = []) => {
return stages return stages
.map(({ name, groups }) => { .map(({ name, groups }) => {
return groups.map(group => { return groups.map((group) => {
return { category: name, ...group }; return { category: name, ...group };
}); });
}) })
.flat(2); .flat(2);
}; };
const unwrapGroups = stages => { const unwrapGroups = (stages) => {
return stages.map(stage => { return stages.map((stage) => {
const { const {
groups: { nodes: groups }, groups: { nodes: groups },
} = stage; } = stage;
...@@ -25,21 +25,21 @@ const unwrapGroups = stages => { ...@@ -25,21 +25,21 @@ const unwrapGroups = stages => {
}; };
const unwrapNodesWithName = (jobArray, prop, field = 'name') => { const unwrapNodesWithName = (jobArray, prop, field = 'name') => {
return jobArray.map(job => { return jobArray.map((job) => {
return { ...job, [prop]: job[prop].nodes.map(item => item[field]) }; return { ...job, [prop]: job[prop].nodes.map((item) => item[field]) };
}); });
}; };
const unwrapJobWithNeeds = denodedJobArray => { const unwrapJobWithNeeds = (denodedJobArray) => {
return unwrapNodesWithName(denodedJobArray, 'needs'); return unwrapNodesWithName(denodedJobArray, 'needs');
}; };
const unwrapStagesWithNeeds = denodedStages => { const unwrapStagesWithNeeds = (denodedStages) => {
const unwrappedNestedGroups = unwrapGroups(denodedStages); const unwrappedNestedGroups = unwrapGroups(denodedStages);
const nodes = unwrappedNestedGroups.map(node => { const nodes = unwrappedNestedGroups.map((node) => {
const { groups } = node; const { groups } = node;
const groupsWithJobs = groups.map(group => { const groupsWithJobs = groups.map((group) => {
const jobs = unwrapJobWithNeeds(group.jobs.nodes); const jobs = unwrapJobWithNeeds(group.jobs.nodes);
return { ...group, jobs }; return { ...group, jobs };
}); });
......
...@@ -6,7 +6,7 @@ export default { ...@@ -6,7 +6,7 @@ export default {
getExpandedPipelines(pipeline) { getExpandedPipelines(pipeline) {
this.mediator.service this.mediator.service
.getPipeline(this.mediator.getExpandedParameters()) .getPipeline(this.mediator.getExpandedParameters())
.then(response => { .then((response) => {
this.mediator.store.toggleLoading(pipeline); this.mediator.store.toggleLoading(pipeline);
this.mediator.store.storePipeline(response.data); this.mediator.store.storePipeline(response.data);
this.mediator.poll.enable({ data: this.mediator.getExpandedParameters() }); this.mediator.poll.enable({ data: this.mediator.getExpandedParameters() });
......
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
// fetch new data // fetch new data
return this.service return this.service
.getPipelines(this.requestData) .getPipelines(this.requestData)
.then(response => { .then((response) => {
this.isLoading = false; this.isLoading = false;
this.successCallback(response); this.successCallback(response);
...@@ -124,8 +124,8 @@ export default { ...@@ -124,8 +124,8 @@ export default {
getPipelines() { getPipelines() {
return this.service return this.service
.getPipelines(this.requestData) .getPipelines(this.requestData)
.then(response => this.successCallback(response)) .then((response) => this.successCallback(response))
.catch(error => this.errorCallback(error)); .catch((error) => this.errorCallback(error));
}, },
setCommonData(pipelines) { setCommonData(pipelines) {
this.store.storePipelines(pipelines); this.store.storePipelines(pipelines);
......
...@@ -20,7 +20,7 @@ const SELECTORS = { ...@@ -20,7 +20,7 @@ const SELECTORS = {
PIPELINE_TESTS: '#js-pipeline-tests-detail', PIPELINE_TESTS: '#js-pipeline-tests-detail',
}; };
const createLegacyPipelinesDetailApp = mediator => { const createLegacyPipelinesDetailApp = (mediator) => {
if (!document.querySelector(SELECTORS.PIPELINE_GRAPH)) { if (!document.querySelector(SELECTORS.PIPELINE_GRAPH)) {
return; return;
} }
...@@ -47,15 +47,15 @@ const createLegacyPipelinesDetailApp = mediator => { ...@@ -47,15 +47,15 @@ const createLegacyPipelinesDetailApp = mediator => {
refreshPipelineGraph: this.requestRefreshPipelineGraph, refreshPipelineGraph: this.requestRefreshPipelineGraph,
onResetDownstream: (parentPipeline, pipeline) => onResetDownstream: (parentPipeline, pipeline) =>
this.resetDownstreamPipelines(parentPipeline, pipeline), this.resetDownstreamPipelines(parentPipeline, pipeline),
onClickUpstreamPipeline: pipeline => this.clickUpstreamPipeline(pipeline), onClickUpstreamPipeline: (pipeline) => this.clickUpstreamPipeline(pipeline),
onClickDownstreamPipeline: pipeline => this.clickDownstreamPipeline(pipeline), onClickDownstreamPipeline: (pipeline) => this.clickDownstreamPipeline(pipeline),
}, },
}); });
}, },
}); });
}; };
const createLegacyPipelineHeaderApp = mediator => { const createLegacyPipelineHeaderApp = (mediator) => {
if (!document.querySelector(SELECTORS.PIPELINE_HEADER)) { if (!document.querySelector(SELECTORS.PIPELINE_HEADER)) {
return; return;
} }
......
...@@ -9,7 +9,7 @@ const apolloProvider = new VueApollo({ ...@@ -9,7 +9,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(), defaultClient: createDefaultClient(),
}); });
export const createPipelineHeaderApp = elSelector => { export const createPipelineHeaderApp = (elSelector) => {
const el = document.querySelector(elSelector); const el = document.querySelector(elSelector);
if (!el) { if (!el) {
......
...@@ -55,7 +55,7 @@ export default class pipelinesMediator { ...@@ -55,7 +55,7 @@ export default class pipelinesMediator {
return this.service return this.service
.getPipeline() .getPipeline()
.then(response => this.successCallback(response)) .then((response) => this.successCallback(response))
.catch(() => this.errorCallback()) .catch(() => this.errorCallback())
.finally(() => .finally(() =>
this.poll.restart( this.poll.restart(
......
...@@ -29,11 +29,11 @@ export default class PipelineStore { ...@@ -29,11 +29,11 @@ export default class PipelineStore {
} }
if (pipelineCopy.triggered && pipelineCopy.triggered.length) { if (pipelineCopy.triggered && pipelineCopy.triggered.length) {
pipelineCopy.triggered.forEach(el => { pipelineCopy.triggered.forEach((el) => {
const oldPipeline = const oldPipeline =
this.state.pipeline && this.state.pipeline &&
this.state.pipeline.triggered && this.state.pipeline.triggered &&
this.state.pipeline.triggered.find(element => element.id === el.id); this.state.pipeline.triggered.find((element) => element.id === el.id);
this.parseTriggeredPipelines(oldPipeline, el); this.parseTriggeredPipelines(oldPipeline, el);
}); });
...@@ -67,8 +67,8 @@ export default class PipelineStore { ...@@ -67,8 +67,8 @@ export default class PipelineStore {
} }
if (newPipeline.triggered_by?.length > 0) { if (newPipeline.triggered_by?.length > 0) {
newPipeline.triggered_by.forEach(el => { newPipeline.triggered_by.forEach((el) => {
const oldTriggeredBy = oldPipeline.triggered_by?.find(element => element.id === el.id); const oldTriggeredBy = oldPipeline.triggered_by?.find((element) => element.id === el.id);
this.parseTriggeredPipelines(oldTriggeredBy, el); this.parseTriggeredPipelines(oldTriggeredBy, el);
}); });
} }
...@@ -88,9 +88,9 @@ export default class PipelineStore { ...@@ -88,9 +88,9 @@ export default class PipelineStore {
Vue.set(newPipeline, 'isLoading', false); Vue.set(newPipeline, 'isLoading', false);
if (newPipeline.triggered && newPipeline.triggered.length > 0) { if (newPipeline.triggered && newPipeline.triggered.length > 0) {
newPipeline.triggered.forEach(el => { newPipeline.triggered.forEach((el) => {
const oldTriggered = const oldTriggered =
oldPipeline.triggered && oldPipeline.triggered.find(element => element.id === el.id); oldPipeline.triggered && oldPipeline.triggered.find((element) => element.id === el.id);
this.parseTriggeredPipelines(oldTriggered, el); this.parseTriggeredPipelines(oldTriggered, el);
}); });
} }
...@@ -102,7 +102,7 @@ export default class PipelineStore { ...@@ -102,7 +102,7 @@ export default class PipelineStore {
* @param {Object} pipeline * @param {Object} pipeline
*/ */
resetTriggeredByPipeline(parentPipeline, pipeline) { resetTriggeredByPipeline(parentPipeline, pipeline) {
parentPipeline.triggered_by.forEach(el => this.closePipeline(el)); parentPipeline.triggered_by.forEach((el) => this.closePipeline(el));
if (pipeline.triggered_by && pipeline.triggered_by) { if (pipeline.triggered_by && pipeline.triggered_by) {
this.resetTriggeredByPipeline(pipeline, pipeline.triggered_by); this.resetTriggeredByPipeline(pipeline, pipeline.triggered_by);
...@@ -129,7 +129,7 @@ export default class PipelineStore { ...@@ -129,7 +129,7 @@ export default class PipelineStore {
this.closePipeline(pipeline); this.closePipeline(pipeline);
if (pipeline.triggered_by && pipeline.triggered_by.length) { if (pipeline.triggered_by && pipeline.triggered_by.length) {
pipeline.triggered_by.forEach(triggeredBy => this.closeTriggeredByPipeline(triggeredBy)); pipeline.triggered_by.forEach((triggeredBy) => this.closeTriggeredByPipeline(triggeredBy));
} }
} }
...@@ -139,10 +139,10 @@ export default class PipelineStore { ...@@ -139,10 +139,10 @@ export default class PipelineStore {
* @param {Object} pipeline * @param {Object} pipeline
*/ */
resetTriggeredPipelines(parentPipeline, pipeline) { resetTriggeredPipelines(parentPipeline, pipeline) {
parentPipeline.triggered.forEach(el => this.closePipeline(el)); parentPipeline.triggered.forEach((el) => this.closePipeline(el));
if (pipeline.triggered && pipeline.triggered.length) { if (pipeline.triggered && pipeline.triggered.length) {
pipeline.triggered.forEach(el => this.resetTriggeredPipelines(pipeline, el)); pipeline.triggered.forEach((el) => this.resetTriggeredPipelines(pipeline, el));
} }
} }
...@@ -165,7 +165,7 @@ export default class PipelineStore { ...@@ -165,7 +165,7 @@ export default class PipelineStore {
this.closePipeline(pipeline); this.closePipeline(pipeline);
if (pipeline.triggered && pipeline.triggered.length) { if (pipeline.triggered && pipeline.triggered.length) {
pipeline.triggered.forEach(triggered => this.closeTriggeredPipeline(triggered)); pipeline.triggered.forEach((triggered) => this.closeTriggeredPipeline(triggered));
} }
} }
...@@ -199,7 +199,7 @@ export default class PipelineStore { ...@@ -199,7 +199,7 @@ export default class PipelineStore {
removeExpandedPipelineToRequestData(id) { removeExpandedPipelineToRequestData(id) {
this.state.expandedPipelines.splice( this.state.expandedPipelines.splice(
this.state.expandedPipelines.findIndex(el => el === id), this.state.expandedPipelines.findIndex((el) => el === id),
1, 1,
); );
} }
......
import { addIconStatus, formattedTime } from './utils'; import { addIconStatus, formattedTime } from './utils';
export const getTestSuites = state => { export const getTestSuites = (state) => {
const { test_suites: testSuites = [] } = state.testReports; const { test_suites: testSuites = [] } = state.testReports;
return testSuites.map(suite => ({ return testSuites.map((suite) => ({
...suite, ...suite,
formattedTime: formattedTime(suite.total_time), formattedTime: formattedTime(suite.total_time),
})); }));
}; };
export const getSelectedSuite = state => export const getSelectedSuite = (state) =>
state.testReports?.test_suites?.[state.selectedSuiteIndex] || {}; state.testReports?.test_suites?.[state.selectedSuiteIndex] || {};
export const getSuiteTests = state => { export const getSuiteTests = (state) => {
const { test_cases: testCases = [] } = getSelectedSuite(state); const { test_cases: testCases = [] } = getSelectedSuite(state);
const { page, perPage } = state.pageInfo; const { page, perPage } = state.pageInfo;
const start = (page - 1) * perPage; const start = (page - 1) * perPage;
...@@ -20,4 +20,4 @@ export const getSuiteTests = state => { ...@@ -20,4 +20,4 @@ export const getSuiteTests = state => {
return testCases.map(addIconStatus).slice(start, start + perPage); return testCases.map(addIconStatus).slice(start, start + perPage);
}; };
export const getSuiteTestCount = state => getSelectedSuite(state)?.test_cases?.length || 0; export const getSuiteTestCount = (state) => getSelectedSuite(state)?.test_cases?.length || 0;
...@@ -7,7 +7,7 @@ import mutations from './mutations'; ...@@ -7,7 +7,7 @@ import mutations from './mutations';
Vue.use(Vuex); Vue.use(Vuex);
export default initialState => export default (initialState) =>
new Vuex.Store({ new Vuex.Store({
actions, actions,
getters, getters,
......
...@@ -25,7 +25,7 @@ export const formattedTime = (seconds = 0) => { ...@@ -25,7 +25,7 @@ export const formattedTime = (seconds = 0) => {
return sprintf(__('%{seconds}s'), { seconds: seconds.toFixed(2) }); return sprintf(__('%{seconds}s'), { seconds: seconds.toFixed(2) });
}; };
export const addIconStatus = testCase => ({ export const addIconStatus = (testCase) => ({
...testCase, ...testCase,
icon: iconForTestStatus(testCase.status), icon: iconForTestStatus(testCase.status),
formattedTime: formattedTime(testCase.execution_time), formattedTime: formattedTime(testCase.execution_time),
......
import { pickBy } from 'lodash'; import { pickBy } from 'lodash';
import { SUPPORTED_FILTER_PARAMETERS } from './constants'; import { SUPPORTED_FILTER_PARAMETERS } from './constants';
export const validateParams = params => { export const validateParams = (params) => {
return pickBy(params, (val, key) => SUPPORTED_FILTER_PARAMETERS.includes(key) && val); return pickBy(params, (val, key) => SUPPORTED_FILTER_PARAMETERS.includes(key) && val);
}; };
...@@ -17,10 +17,10 @@ export const createUniqueLinkId = (stageName, jobName) => `${stageName}-${jobNam ...@@ -17,10 +17,10 @@ export const createUniqueLinkId = (stageName, jobName) => `${stageName}-${jobNam
export const createJobsHash = (stages = []) => { export const createJobsHash = (stages = []) => {
const jobsHash = {}; const jobsHash = {};
stages.forEach(stage => { stages.forEach((stage) => {
if (stage.groups.length > 0) { if (stage.groups.length > 0) {
stage.groups.forEach(group => { stage.groups.forEach((group) => {
group.jobs.forEach(job => { group.jobs.forEach((job) => {
jobsHash[job.name] = job; jobsHash[job.name] = job;
}); });
}); });
...@@ -44,13 +44,13 @@ export const generateJobNeedsDict = (jobs = {}) => { ...@@ -44,13 +44,13 @@ export const generateJobNeedsDict = (jobs = {}) => {
const arrOfJobNames = Object.keys(jobs); const arrOfJobNames = Object.keys(jobs);
return arrOfJobNames.reduce((acc, value) => { return arrOfJobNames.reduce((acc, value) => {
const recursiveNeeds = jobName => { const recursiveNeeds = (jobName) => {
if (!jobs[jobName]?.needs) { if (!jobs[jobName]?.needs) {
return []; return [];
} }
return jobs[jobName].needs return jobs[jobName].needs
.map(job => { .map((job) => {
// If we already have the needs of a job in the accumulator, // If we already have the needs of a job in the accumulator,
// then we use the memoized data instead of the recursive call // then we use the memoized data instead of the recursive call
// to save some performance. // to save some performance.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import { GlPopover } from '@gitlab/ui'; import { GlPopover } from '@gitlab/ui';
import { sanitize } from '~/lib/dompurify'; import { sanitize } from '~/lib/dompurify';
const newPopover = element => { const newPopover = (element) => {
const { content, html, placement, title, triggers = 'focus' } = element.dataset; const { content, html, placement, title, triggers = 'focus' } = element.dataset;
return { return {
...@@ -30,8 +30,8 @@ export default { ...@@ -30,8 +30,8 @@ export default {
}; };
}, },
created() { created() {
this.observer = new MutationObserver(mutations => { this.observer = new MutationObserver((mutations) => {
mutations.forEach(mutation => { mutations.forEach((mutation) => {
mutation.removedNodes.forEach(this.dispose); mutation.removedNodes.forEach(this.dispose);
}); });
}); });
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
if (!target) { if (!target) {
this.popovers = []; this.popovers = [];
} else { } else {
const index = this.popovers.findIndex(popover => popover.target === target); const index = this.popovers.findIndex((popover) => popover.target === target);
if (index > -1) { if (index > -1) {
this.popovers.splice(index, 1); this.popovers.splice(index, 1);
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
} }
}, },
popoverExists(element) { popoverExists(element) {
return this.popovers.some(popover => popover.target === element); return this.popovers.some((popover) => popover.target === element);
}, },
getSafeHtml(html) { getSafeHtml(html) {
return sanitize(html); return sanitize(html);
......
...@@ -32,10 +32,10 @@ const handlePopoverEvent = (rootTarget, e, selector) => { ...@@ -32,10 +32,10 @@ const handlePopoverEvent = (rootTarget, e, selector) => {
}; };
export const initPopovers = () => { export const initPopovers = () => {
['mouseenter', 'focus', 'click'].forEach(event => { ['mouseenter', 'focus', 'click'].forEach((event) => {
document.addEventListener( document.addEventListener(
event, event,
e => handlePopoverEvent(document, e, '[data-toggle="popover"]'), (e) => handlePopoverEvent(document, e, '[data-toggle="popover"]'),
true, true,
); );
}); });
...@@ -43,7 +43,7 @@ export const initPopovers = () => { ...@@ -43,7 +43,7 @@ export const initPopovers = () => {
return getPopoversApp(); return getPopoversApp();
}; };
export const dispose = elements => toArray(elements).forEach(getPopoversApp().dispose); export const dispose = (elements) => toArray(elements).forEach(getPopoversApp().dispose);
export const destroy = () => { export const destroy = () => {
getPopoversApp().$destroy(); getPopoversApp().$destroy();
......
...@@ -84,12 +84,12 @@ Please update your Git repository remotes as soon as possible.`), ...@@ -84,12 +84,12 @@ Please update your Git repository remotes as soon as possible.`),
return axios return axios
.put(this.actionUrl, putData) .put(this.actionUrl, putData)
.then(result => { .then((result) => {
Flash(result.data.message, 'notice'); Flash(result.data.message, 'notice');
this.username = username; this.username = username;
this.isRequestPending = false; this.isRequestPending = false;
}) })
.catch(error => { .catch((error) => {
Flash(error.response.data.message); Flash(error.response.data.message);
this.isRequestPending = false; this.isRequestPending = false;
throw error; throw error;
......
...@@ -12,7 +12,7 @@ export default class AddSshKeyValidation { ...@@ -12,7 +12,7 @@ export default class AddSshKeyValidation {
} }
register() { register() {
this.form.addEventListener('submit', event => this.submit(event)); this.form.addEventListener('submit', (event) => this.submit(event));
this.confirmSubmitElement.addEventListener('click', () => { this.confirmSubmitElement.addEventListener('click', () => {
this.isValid = true; this.isValid = true;
......
...@@ -18,6 +18,6 @@ export default () => { ...@@ -18,6 +18,6 @@ export default () => {
el, el,
name: 'ProfilePreferencesApp', name: 'ProfilePreferencesApp',
provide, provide,
render: createElement => createElement(ProfilePreferences), render: (createElement) => createElement(ProfilePreferences),
}); });
}; };
...@@ -20,7 +20,7 @@ export default class Profile { ...@@ -20,7 +20,7 @@ export default class Profile {
this.timezoneDropdown = new TimezoneDropdown({ this.timezoneDropdown = new TimezoneDropdown({
$inputEl: this.$inputEl, $inputEl: this.$inputEl,
$dropdownEl: $('.js-timezone-dropdown'), $dropdownEl: $('.js-timezone-dropdown'),
displayFormat: selectedItem => formatTimezone(selectedItem), displayFormat: (selectedItem) => formatTimezone(selectedItem),
}); });
} }
...@@ -39,7 +39,7 @@ export default class Profile { ...@@ -39,7 +39,7 @@ export default class Profile {
bindEvents() { bindEvents() {
$('.js-preferences-form').on('change.preference', 'input[type=radio]', this.submitForm); $('.js-preferences-form').on('change.preference', 'input[type=radio]', this.submitForm);
$('.js-group-notification-email').on('change', this.submitForm); $('.js-group-notification-email').on('change', this.submitForm);
$('#user_notification_email').on('select2-selecting', event => { $('#user_notification_email').on('select2-selecting', (event) => {
setTimeout(this.submitForm.bind(event.currentTarget)); setTimeout(this.submitForm.bind(event.currentTarget));
}); });
$('#user_notified_of_own_activity').on('change', this.submitForm); $('#user_notified_of_own_activity').on('change', this.submitForm);
...@@ -89,7 +89,7 @@ export default class Profile { ...@@ -89,7 +89,7 @@ export default class Profile {
// Enable submit button after requests ends // Enable submit button after requests ends
self.form.find(':input[disabled]').enable(); self.form.find(':input[disabled]').enable();
}) })
.catch(error => flash(error.message)); .catch((error) => flash(error.message));
} }
updateHeaderAvatar() { updateHeaderAvatar() {
......
...@@ -57,7 +57,7 @@ export default class ProjectFindFile { ...@@ -57,7 +57,7 @@ export default class ProjectFindFile {
initEvent() { initEvent() {
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
this.inputElement.off('keyup'); this.inputElement.off('keyup');
this.inputElement.on('keyup', event => { this.inputElement.on('keyup', (event) => {
const target = $(event.target); const target = $(event.target);
const value = target.val(); const value = target.val();
const ref = target.data('oldValue'); const ref = target.data('oldValue');
......
...@@ -33,7 +33,7 @@ const projectSelect = () => { ...@@ -33,7 +33,7 @@ const projectSelect = () => {
$(select).select2({ $(select).select2({
placeholder, placeholder,
minimumInputLength: 0, minimumInputLength: 0,
query: query => { query: (query) => {
let projectsCallback; let projectsCallback;
const finalCallback = function (projects) { const finalCallback = function (projects) {
const data = { const data = {
......
...@@ -17,9 +17,9 @@ export default class ProjectSelectComboButton { ...@@ -17,9 +17,9 @@ export default class ProjectSelectComboButton {
bindEvents() { bindEvents() {
this.projectSelectInput this.projectSelectInput
.siblings('.new-project-item-select-button') .siblings('.new-project-item-select-button')
.on('click', e => this.openDropdown(e)); .on('click', (e) => this.openDropdown(e));
this.newItemBtn.on('click', e => { this.newItemBtn.on('click', (e) => {
if (!this.getProjectFromLocalStorage()) { if (!this.getProjectFromLocalStorage()) {
e.preventDefault(); e.preventDefault();
this.openDropdown(e); this.openDropdown(e);
......
...@@ -7,7 +7,7 @@ function setVisibilityOptions(namespaceSelector) { ...@@ -7,7 +7,7 @@ function setVisibilityOptions(namespaceSelector) {
const selectedNamespace = namespaceSelector.options[namespaceSelector.selectedIndex]; const selectedNamespace = namespaceSelector.options[namespaceSelector.selectedIndex];
const { name, visibility, visibilityLevel, showPath, editPath } = selectedNamespace.dataset; const { name, visibility, visibilityLevel, showPath, editPath } = selectedNamespace.dataset;
document.querySelectorAll('.visibility-level-setting .form-check').forEach(option => { document.querySelectorAll('.visibility-level-setting .form-check').forEach((option) => {
const optionInput = option.querySelector('input[type=radio]'); const optionInput = option.querySelector('input[type=radio]');
const optionValue = optionInput ? optionInput.value : 0; const optionValue = optionInput ? optionInput.value : 0;
const optionTitle = option.querySelector('.option-title'); const optionTitle = option.querySelector('.option-title');
......
...@@ -2,7 +2,7 @@ import axios from 'axios'; ...@@ -2,7 +2,7 @@ import axios from 'axios';
import { sanitize } from '~/lib/dompurify'; import { sanitize } from '~/lib/dompurify';
import { __ } from '~/locale'; import { __ } from '~/locale';
export const loadBranches = containerEl => { export const loadBranches = (containerEl) => {
if (!containerEl) { if (!containerEl) {
return; return;
} }
......
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
commitsSearchInput.addEventListener( commitsSearchInput.addEventListener(
'keyup', 'keyup',
debounce(event => this.setSearchParam(event.target.value), 500), // keyup & time is to match effect of "filter by commit message" debounce((event) => this.setSearchParam(event.target.value), 500), // keyup & time is to match effect of "filter by commit message"
); );
}, },
methods: { methods: {
......
...@@ -5,7 +5,7 @@ import store from './store'; ...@@ -5,7 +5,7 @@ import store from './store';
Vue.use(Vuex); Vue.use(Vuex);
export default el => { export default (el) => {
if (!el) { if (!el) {
return null; return null;
} }
......
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
}, },
}) })
.then(({ data }) => dispatch('receiveAuthorsSuccess', data)) .then(({ data }) => dispatch('receiveAuthorsSuccess', data))
.catch(error => { .catch((error) => {
Sentry.captureException(error); Sentry.captureException(error);
dispatch('receiveAuthorsError'); dispatch('receiveAuthorsError');
}); });
......
...@@ -83,11 +83,11 @@ export default { ...@@ -83,11 +83,11 @@ export default {
return PANELS; return PANELS;
} }
return PANELS.filter(p => p.name !== CI_CD_PANEL); return PANELS.filter((p) => p.name !== CI_CD_PANEL);
}, },
activePanel() { activePanel() {
return PANELS.find(p => p.name === this.activeTab); return PANELS.find((p) => p.name === this.activeTab);
}, },
breadcrumbs() { breadcrumbs() {
...@@ -113,7 +113,7 @@ export default { ...@@ -113,7 +113,7 @@ export default {
this.handleLocationHashChange(); this.handleLocationHashChange();
this.resetProjectErrors(); this.resetProjectErrors();
}); });
this.$root.$on('clicked::link', e => { this.$root.$on('clicked::link', (e) => {
window.location = e.target.href; window.location = e.target.href;
}); });
}, },
......
...@@ -252,7 +252,7 @@ export default { ...@@ -252,7 +252,7 @@ export default {
}, },
get chartTitles() { get chartTitles() {
const today = dateFormat(new Date(), CHART_DATE_FORMAT); const today = dateFormat(new Date(), CHART_DATE_FORMAT);
const pastDate = timeScale => const pastDate = (timeScale) =>
dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT); dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT);
return { return {
lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), { lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), {
......
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
}, },
get chartTitles() { get chartTitles() {
const today = dateFormat(new Date(), CHART_DATE_FORMAT); const today = dateFormat(new Date(), CHART_DATE_FORMAT);
const pastDate = timeScale => const pastDate = (timeScale) =>
dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT); dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT);
return { return {
lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), { lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), {
......
...@@ -10,7 +10,7 @@ const apolloProvider = new VueApollo({ ...@@ -10,7 +10,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(), defaultClient: createDefaultClient(),
}); });
const mountPipelineChartsApp = el => { const mountPipelineChartsApp = (el) => {
// Not all of the values will be defined since some them will be // Not all of the values will be defined since some them will be
// empty depending on the value of the graphql_pipeline_analytics // empty depending on the value of the graphql_pipeline_analytics
// feature flag, once the rollout of the feature flag is completed // feature flag, once the rollout of the feature flag is completed
...@@ -62,7 +62,7 @@ const mountPipelineChartsApp = el => { ...@@ -62,7 +62,7 @@ const mountPipelineChartsApp = el => {
provide: { provide: {
projectPath, projectPath,
}, },
render: createElement => createElement(ProjectPipelinesCharts, {}), render: (createElement) => createElement(ProjectPipelinesCharts, {}),
}); });
} }
...@@ -72,7 +72,7 @@ const mountPipelineChartsApp = el => { ...@@ -72,7 +72,7 @@ const mountPipelineChartsApp = el => {
components: { components: {
ProjectPipelinesChartsLegacy, ProjectPipelinesChartsLegacy,
}, },
render: createElement => render: (createElement) =>
createElement(ProjectPipelinesChartsLegacy, { createElement(ProjectPipelinesChartsLegacy, {
props: { props: {
counts: { counts: {
......
...@@ -39,7 +39,7 @@ const setProjectNamePathHandlers = ($projectNameInput, $projectPathInput) => { ...@@ -39,7 +39,7 @@ const setProjectNamePathHandlers = ($projectNameInput, $projectPathInput) => {
}); });
}; };
const deriveProjectPathFromUrl = $projectImportUrl => { const deriveProjectPathFromUrl = ($projectImportUrl) => {
const $currentProjectName = $projectImportUrl const $currentProjectName = $projectImportUrl
.parents('.toggle-import-form') .parents('.toggle-import-form')
.find('#project_name'); .find('#project_name');
...@@ -89,7 +89,7 @@ const bindEvents = () => { ...@@ -89,7 +89,7 @@ const bindEvents = () => {
return; return;
} }
$('.how_to_import_link').on('click', e => { $('.how_to_import_link').on('click', (e) => {
e.preventDefault(); e.preventDefault();
$(e.currentTarget).next('.modal').show(); $(e.currentTarget).next('.modal').show();
}); });
...@@ -112,7 +112,7 @@ const bindEvents = () => { ...@@ -112,7 +112,7 @@ const bindEvents = () => {
$pushNewProjectTipTrigger $pushNewProjectTipTrigger
.removeAttr('rel') .removeAttr('rel')
.removeAttr('target') .removeAttr('target')
.on('click', e => { .on('click', (e) => {
e.preventDefault(); e.preventDefault();
}) })
.popover({ .popover({
...@@ -122,7 +122,7 @@ const bindEvents = () => { ...@@ -122,7 +122,7 @@ const bindEvents = () => {
content: $('.push-new-project-tip-template').html(), content: $('.push-new-project-tip-template').html(),
}) })
.on('shown.bs.popover', () => { .on('shown.bs.popover', () => {
$(document).on('click.popover touchstart.popover', event => { $(document).on('click.popover touchstart.popover', (event) => {
if ($(event.target).closest('.popover').length === 0) { if ($(event.target).closest('.popover').length === 0) {
$pushNewProjectTipTrigger.trigger('click'); $pushNewProjectTipTrigger.trigger('click');
} }
......
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
this.isLoading = false; this.isLoading = false;
this.isSharedRunnerEnabled = !this.isSharedRunnerEnabled; this.isSharedRunnerEnabled = !this.isSharedRunnerEnabled;
}) })
.catch(error => { .catch((error) => {
this.isLoading = false; this.isLoading = false;
this.errorMessage = error.response?.data?.error || DEFAULT_ERROR_MESSAGE; this.errorMessage = error.response?.data?.error || DEFAULT_ERROR_MESSAGE;
}); });
......
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
this.updatedCustomEmail = data?.service_desk_address; this.updatedCustomEmail = data?.service_desk_address;
this.showAlert(__('Changes were successfully made.'), 'success'); this.showAlert(__('Changes were successfully made.'), 'success');
}) })
.catch(err => { .catch((err) => {
this.showAlert( this.showAlert(
sprintf(__('An error occured while making the changes: %{error}'), { sprintf(__('An error occured while making the changes: %{error}'), {
error: err?.response?.data?.message, error: err?.response?.data?.message,
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
this.poll = new Poll({ this.poll = new Poll({
resource: this.service, resource: this.service,
method: 'fetchData', method: 'fetchData',
successCallback: response => this.successCallback(response), successCallback: (response) => this.successCallback(response),
errorCallback: this.errorCallback, errorCallback: this.errorCallback,
}); });
......
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
resetKey() { resetKey() {
axios axios
.post(this.changeKeyUrl) .post(this.changeKeyUrl)
.then(res => { .then((res) => {
this.authorizationKey = res.data.token; this.authorizationKey = res.data.token;
}) })
.catch(() => { .catch(() => {
......
...@@ -65,12 +65,12 @@ export default class CustomMetrics extends PrometheusMetrics { ...@@ -65,12 +65,12 @@ export default class CustomMetrics extends PrometheusMetrics {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
setHidden(els) { setHidden(els) {
els.forEach(el => el.addClass('hidden')); els.forEach((el) => el.addClass('hidden'));
} }
setVisible(...els) { setVisible(...els) {
this.setHidden(this.$els.filter(el => !els.includes(el))); this.setHidden(this.$els.filter((el) => !els.includes(el)));
els.forEach(el => el.removeClass('hidden')); els.forEach((el) => el.removeClass('hidden'));
} }
showMonitoringCustomMetricsPanelState(stateName) { showMonitoringCustomMetricsPanelState(stateName) {
...@@ -98,14 +98,14 @@ export default class CustomMetrics extends PrometheusMetrics { ...@@ -98,14 +98,14 @@ export default class CustomMetrics extends PrometheusMetrics {
} }
populateCustomMetrics() { populateCustomMetrics() {
const capitalizeGroup = metric => ({ const capitalizeGroup = (metric) => ({
...metric, ...metric,
group: capitalizeFirstCharacter(metric.group), group: capitalizeFirstCharacter(metric.group),
}); });
const sortedMetrics = sortBy(this.customMetrics.map(capitalizeGroup), ['group', 'title']); const sortedMetrics = sortBy(this.customMetrics.map(capitalizeGroup), ['group', 'title']);
sortedMetrics.forEach(metric => { sortedMetrics.forEach((metric) => {
this.$monitoredCustomMetricsList.append(CustomMetrics.customMetricTemplate(metric)); this.$monitoredCustomMetricsList.append(CustomMetrics.customMetricTemplate(metric));
}); });
...@@ -145,7 +145,7 @@ export default class CustomMetrics extends PrometheusMetrics { ...@@ -145,7 +145,7 @@ export default class CustomMetrics extends PrometheusMetrics {
this.populateCustomMetrics(customMetrics.data.metrics); this.populateCustomMetrics(customMetrics.data.metrics);
} }
}) })
.catch(customMetricError => { .catch((customMetricError) => {
this.showFlashMessage(customMetricError); this.showFlashMessage(customMetricError);
this.showMonitoringCustomMetricsPanelState(PANEL_STATE.EMPTY); this.showMonitoringCustomMetricsPanelState(PANEL_STATE.EMPTY);
}); });
......
...@@ -26,8 +26,8 @@ export default class PrometheusMetrics { ...@@ -26,8 +26,8 @@ export default class PrometheusMetrics {
this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('activeMetrics'); this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('activeMetrics');
this.helpMetricsPath = this.$monitoredMetricsPanel.data('metrics-help-path'); this.helpMetricsPath = this.$monitoredMetricsPanel.data('metrics-help-path');
this.$panelToggleRight.on('click', e => this.handlePanelToggle(e)); this.$panelToggleRight.on('click', (e) => this.handlePanelToggle(e));
this.$panelToggleDown.on('click', e => this.handlePanelToggle(e)); this.$panelToggleDown.on('click', (e) => this.handlePanelToggle(e));
} }
init() { init() {
...@@ -72,7 +72,7 @@ export default class PrometheusMetrics { ...@@ -72,7 +72,7 @@ export default class PrometheusMetrics {
let totalMissingEnvVarMetrics = 0; let totalMissingEnvVarMetrics = 0;
let totalExporters = 0; let totalExporters = 0;
metrics.forEach(metric => { metrics.forEach((metric) => {
if (metric.active_metrics > 0) { if (metric.active_metrics > 0) {
totalExporters += 1; totalExporters += 1;
this.$monitoredMetricsList.append( this.$monitoredMetricsList.append(
...@@ -137,7 +137,7 @@ export default class PrometheusMetrics { ...@@ -137,7 +137,7 @@ export default class PrometheusMetrics {
}) })
.catch(stop); .catch(stop);
}) })
.then(res => { .then((res) => {
if (res && res.data && res.data.length) { if (res && res.data && res.data.length) {
this.populateActiveMetrics(res.data); this.populateActiveMetrics(res.data);
} else { } else {
......
...@@ -90,12 +90,12 @@ export default class ProtectedBranchCreate { ...@@ -90,12 +90,12 @@ export default class ProtectedBranchCreate {
}, },
}; };
Object.keys(ACCESS_LEVELS).forEach(level => { Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevel = ACCESS_LEVELS[level]; const accessLevel = ACCESS_LEVELS[level];
const selectedItems = this[`${accessLevel}_dropdown`].getSelectedItems(); const selectedItems = this[`${accessLevel}_dropdown`].getSelectedItems();
const levelAttributes = []; const levelAttributes = [];
selectedItems.forEach(item => { selectedItems.forEach((item) => {
if (item.type === LEVEL_TYPES.USER) { if (item.type === LEVEL_TYPES.USER) {
levelAttributes.push({ levelAttributes.push({
user_id: item.user_id, user_id: item.user_id,
......
...@@ -108,7 +108,7 @@ export default class ProtectedBranchEdit { ...@@ -108,7 +108,7 @@ export default class ProtectedBranchEdit {
.then(({ data }) => { .then(({ data }) => {
this.hasChanges = false; this.hasChanges = false;
Object.keys(ACCESS_LEVELS).forEach(level => { Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevelName = ACCESS_LEVELS[level]; const accessLevelName = ACCESS_LEVELS[level];
// The data coming from server will be the new persisted *state* for each dropdown // The data coming from server will be the new persisted *state* for each dropdown
...@@ -125,7 +125,7 @@ export default class ProtectedBranchEdit { ...@@ -125,7 +125,7 @@ export default class ProtectedBranchEdit {
} }
setSelectedItemsToDropdown(items = [], dropdownName) { setSelectedItemsToDropdown(items = [], dropdownName) {
const itemsToAdd = items.map(currentItem => { const itemsToAdd = items.map((currentItem) => {
if (currentItem.user_id) { if (currentItem.user_id) {
// Do this only for users for now // Do this only for users for now
// get the current data for selected items // get the current data for selected items
......
...@@ -22,7 +22,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger') ...@@ -22,7 +22,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger')
if (!triggerEls) return; if (!triggerEls) return;
triggerEls.forEach(triggerEl => { triggerEls.forEach((triggerEl) => {
const targetEl = triggerEl.previousElementSibling; const targetEl = triggerEl.previousElementSibling;
if (!targetEl) { if (!targetEl) {
...@@ -31,7 +31,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger') ...@@ -31,7 +31,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger')
triggerEl.addEventListener( triggerEl.addEventListener(
'click', 'click',
e => { (e) => {
targetEl.classList.add('is-expanded'); targetEl.classList.add('is-expanded');
e.target.remove(); e.target.remove();
}, },
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
items: { items: {
type: Array, type: Array,
required: true, required: true,
validator: items => Array.isArray(items) && items.every(item => item.name), validator: (items) => Array.isArray(items) && items.every((item) => item.name),
}, },
/** /**
......
...@@ -50,9 +50,9 @@ export default { ...@@ -50,9 +50,9 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
matches: state => state.matches, matches: (state) => state.matches,
lastQuery: state => state.query, lastQuery: (state) => state.query,
selectedRef: state => state.selectedRef, selectedRef: (state) => state.selectedRef,
}), }),
...mapGetters(['isLoading', 'isQueryPossiblyASha']), ...mapGetters(['isLoading', 'isQueryPossiblyASha']),
i18n() { i18n() {
......
...@@ -18,10 +18,10 @@ export const searchBranches = ({ commit, state }) => { ...@@ -18,10 +18,10 @@ export const searchBranches = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.branches(state.projectId, state.query) Api.branches(state.projectId, state.query)
.then(response => { .then((response) => {
commit(types.RECEIVE_BRANCHES_SUCCESS, response); commit(types.RECEIVE_BRANCHES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_BRANCHES_ERROR, error); commit(types.RECEIVE_BRANCHES_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -33,10 +33,10 @@ export const searchTags = ({ commit, state }) => { ...@@ -33,10 +33,10 @@ export const searchTags = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.tags(state.projectId, state.query) Api.tags(state.projectId, state.query)
.then(response => { .then((response) => {
commit(types.RECEIVE_TAGS_SUCCESS, response); commit(types.RECEIVE_TAGS_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_TAGS_ERROR, error); commit(types.RECEIVE_TAGS_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -50,10 +50,10 @@ export const searchCommits = ({ commit, state, getters }) => { ...@@ -50,10 +50,10 @@ export const searchCommits = ({ commit, state, getters }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.commit(state.projectId, state.query) Api.commit(state.projectId, state.query)
.then(response => { .then((response) => {
commit(types.RECEIVE_COMMITS_SUCCESS, response); commit(types.RECEIVE_COMMITS_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_COMMITS_ERROR, error); commit(types.RECEIVE_COMMITS_ERROR, error);
}) })
.finally(() => { .finally(() => {
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
[types.RECEIVE_BRANCHES_SUCCESS](state, response) { [types.RECEIVE_BRANCHES_SUCCESS](state, response) {
state.matches.branches = { state.matches.branches = {
list: convertObjectPropsToCamelCase(response.data).map(b => ({ list: convertObjectPropsToCamelCase(response.data).map((b) => ({
name: b.name, name: b.name,
default: b.default, default: b.default,
})), })),
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
[types.RECEIVE_TAGS_SUCCESS](state, response) { [types.RECEIVE_TAGS_SUCCESS](state, response) {
state.matches.tags = { state.matches.tags = {
list: convertObjectPropsToCamelCase(response.data).map(b => ({ list: convertObjectPropsToCamelCase(response.data).map((b) => ({
name: b.name, name: b.name,
})), })),
totalCount: parseInt(response.headers[X_TOTAL_HEADER], 10), totalCount: parseInt(response.headers[X_TOTAL_HEADER], 10),
......
...@@ -31,7 +31,7 @@ class RefSelectDropdown { ...@@ -31,7 +31,7 @@ class RefSelectDropdown {
const $fieldInput = $(`input[name="${$dropdownButton.data('fieldName')}"]`, $dropdownContainer); const $fieldInput = $(`input[name="${$dropdownButton.data('fieldName')}"]`, $dropdownContainer);
const $filterInput = $('input[type="search"]', $dropdownContainer); const $filterInput = $('input[type="search"]', $dropdownContainer);
$filterInput.on('keyup', e => { $filterInput.on('keyup', (e) => {
const keyCode = e.keyCode || e.which; const keyCode = e.keyCode || e.which;
if (keyCode !== 13) return; if (keyCode !== 13) return;
......
...@@ -31,10 +31,10 @@ export default { ...@@ -31,10 +31,10 @@ export default {
}, },
computed: { computed: {
hasSelectedItems() { hasSelectedItems() {
return this.tags.some(tag => this.selectedItems[tag.name]); return this.tags.some((tag) => this.selectedItems[tag.name]);
}, },
showMultiDeleteButton() { showMultiDeleteButton() {
return this.tags.some(tag => tag.canDelete) && !this.isMobile; return this.tags.some((tag) => tag.canDelete) && !this.isMobile;
}, },
}, },
methods: { methods: {
......
...@@ -14,10 +14,10 @@ export default { ...@@ -14,10 +14,10 @@ export default {
}, },
computed: { computed: {
parsedCrumbs() { parsedCrumbs() {
return this.crumbs.map(c => ({ ...c, innerHTML: sanitize(c.innerHTML) })); return this.crumbs.map((c) => ({ ...c, innerHTML: sanitize(c.innerHTML) }));
}, },
rootRoute() { rootRoute() {
return this.$router.options.routes.find(r => r.meta.root); return this.$router.options.routes.find((r) => r.meta.root);
}, },
isRootRoute() { isRootRoute() {
return this.$route.name === this.rootRoute.name; return this.$route.name === this.rootRoute.name;
......
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
}, },
methods: { methods: {
deleteTags(toBeDeleted) { deleteTags(toBeDeleted) {
this.itemsToBeDeleted = this.tags.filter(tag => toBeDeleted[tag.name]); this.itemsToBeDeleted = this.tags.filter((tag) => toBeDeleted[tag.name]);
this.track('click_button'); this.track('click_button');
this.$refs.deleteModal.show(); this.$refs.deleteModal.show();
}, },
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
mutation: deleteContainerRepositoryTagsMutation, mutation: deleteContainerRepositoryTagsMutation,
variables: { variables: {
id: this.queryVariables.id, id: this.queryVariables.id,
tagNames: itemsToBeDeleted.map(i => i.name), tagNames: itemsToBeDeleted.map((i) => i.name),
}, },
awaitRefetchQueries: true, awaitRefetchQueries: true,
refetchQueries: [ refetchQueries: [
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
projectPath: this.projectPath, projectPath: this.projectPath,
}; };
}, },
update: data => data.project?.containerExpirationPolicy, update: (data) => data.project?.containerExpirationPolicy,
result({ data }) { result({ data }) {
this.workingCopy = { ...get(data, 'project.containerExpirationPolicy', {}) }; this.workingCopy = { ...get(data, 'project.containerExpirationPolicy', {}) };
}, },
......
...@@ -96,7 +96,7 @@ export default { ...@@ -96,7 +96,7 @@ export default {
return this.isLoading || this.mutationLoading; return this.isLoading || this.mutationLoading;
}, },
fieldsAreValid() { fieldsAreValid() {
return Object.values(this.localErrors).every(error => error); return Object.values(this.localErrors).every((error) => error);
}, },
isSubmitButtonDisabled() { isSubmitButtonDisabled() {
return !this.fieldsAreValid || this.showLoadingIcon; return !this.fieldsAreValid || this.showLoadingIcon;
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
}, },
methods: { methods: {
findDefaultOption(option) { findDefaultOption(option) {
return this.value[option] || this.$options.formOptions[option].find(f => f.default)?.key; return this.value[option] || this.$options.formOptions[option].find((f) => f.default)?.key;
}, },
reset() { reset() {
this.track('reset_form'); this.track('reset_form');
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
}, },
setApiErrors(response) { setApiErrors(response) {
this.apiErrors = response.graphQLErrors.reduce((acc, curr) => { this.apiErrors = response.graphQLErrors.reduce((acc, curr) => {
curr.extensions.problems.forEach(item => { curr.extensions.problems.forEach((item) => {
acc[item.path[0]] = item.message; acc[item.path[0]] = item.message;
}); });
return acc; return acc;
...@@ -163,7 +163,7 @@ export default { ...@@ -163,7 +163,7 @@ export default {
this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE, { type: 'success' }); this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE, { type: 'success' });
} }
}) })
.catch(error => { .catch((error) => {
this.setApiErrors(error); this.setApiErrors(error);
this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE, { type: 'error' }); this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE, { type: 'error' });
}) })
......
import { produce } from 'immer'; import { produce } from 'immer';
import expirationPolicyQuery from '../queries/get_expiration_policy.query.graphql'; import expirationPolicyQuery from '../queries/get_expiration_policy.query.graphql';
export const updateContainerExpirationPolicy = projectPath => (client, { data: updatedData }) => { export const updateContainerExpirationPolicy = (projectPath) => (client, { data: updatedData }) => {
const queryAndParams = { const queryAndParams = {
query: expirationPolicyQuery, query: expirationPolicyQuery,
variables: { projectPath }, variables: { projectPath },
}; };
const sourceData = client.readQuery(queryAndParams); const sourceData = client.readQuery(queryAndParams);
const data = produce(sourceData, draftState => { const data = produce(sourceData, (draftState) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
draftState.project.containerExpirationPolicy = { draftState.project.containerExpirationPolicy = {
...updatedData.updateContainerExpirationPolicy.containerExpirationPolicy, ...updatedData.updateContainerExpirationPolicy.containerExpirationPolicy,
......
import { n__ } from '~/locale'; import { n__ } from '~/locale';
import { KEEP_N_OPTIONS, CADENCE_OPTIONS, OLDER_THAN_OPTIONS } from './constants'; import { KEEP_N_OPTIONS, CADENCE_OPTIONS, OLDER_THAN_OPTIONS } from './constants';
export const findDefaultOption = options => { export const findDefaultOption = (options) => {
const item = options.find(o => o.default); const item = options.find((o) => o.default);
return item ? item.key : null; return item ? item.key : null;
}; };
export const olderThanTranslationGenerator = variable => n__('%d day', '%d days', variable); export const olderThanTranslationGenerator = (variable) => n__('%d day', '%d days', variable);
export const keepNTranslationGenerator = variable => export const keepNTranslationGenerator = (variable) =>
n__('%d tag per image name', '%d tags per image name', variable); n__('%d tag per image name', '%d tags per image name', variable);
export const optionLabelGenerator = (collection, translationFn) => export const optionLabelGenerator = (collection, translationFn) =>
collection.map(option => ({ collection.map((option) => ({
...option, ...option,
label: translationFn(option.variable), label: translationFn(option.variable),
})); }));
......
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
let position = 0; let position = 0;
const untouchedRawRefs = rawRefs const untouchedRawRefs = rawRefs
.filter(ref => { .filter((ref) => {
let isTouched = false; let isTouched = false;
if (caretPos >= position && caretPos <= position + ref.length) { if (caretPos >= position && caretPos <= position + ref.length) {
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
return !isTouched; return !isTouched;
}) })
.filter(ref => ref.trim().length > 0); .filter((ref) => ref.trim().length > 0);
this.$emit('addIssuableFormInput', { this.$emit('addIssuableFormInput', {
newValue: value, newValue: value,
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
:path-id-separator="pathIdSeparator" :path-id-separator="pathIdSeparator"
event-namespace="pendingIssuable" event-namespace="pendingIssuable"
@pendingIssuableRemoveRequest=" @pendingIssuableRemoveRequest="
params => { (params) => {
$emit('pendingIssuableRemoveRequest', params); $emit('pendingIssuableRemoveRequest', params);
} }
" "
......
...@@ -90,11 +90,11 @@ export default { ...@@ -90,11 +90,11 @@ export default {
categorisedIssues() { categorisedIssues() {
if (this.showCategorizedIssues) { if (this.showCategorizedIssues) {
return Object.values(linkedIssueTypesMap) return Object.values(linkedIssueTypesMap)
.map(linkType => ({ .map((linkType) => ({
linkType, linkType,
issues: this.relatedIssues.filter(issue => issue.linkType === linkType), issues: this.relatedIssues.filter((issue) => issue.linkType === linkType),
})) }))
.filter(obj => obj.issues.length > 0); .filter((obj) => obj.issues.length > 0);
} }
return [{ issues: this.relatedIssues }]; return [{ issues: this.relatedIssues }];
......
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
}, },
methods: { methods: {
findRelatedIssueById(id) { findRelatedIssueById(id) {
return this.state.relatedIssues.find(issue => issue.id === id); return this.state.relatedIssues.find((issue) => issue.id === id);
}, },
onRelatedIssueRemoveRequest(idToRemove) { onRelatedIssueRemoveRequest(idToRemove) {
const issueToRemove = this.findRelatedIssueById(idToRemove); const issueToRemove = this.findRelatedIssueById(idToRemove);
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
.then(({ data }) => { .then(({ data }) => {
this.store.setRelatedIssues(data.issuables); this.store.setRelatedIssues(data.issuables);
}) })
.catch(res => { .catch((res) => {
if (res && res.status !== 404) { if (res && res.status !== 404) {
Flash(relatedIssuesRemoveErrorMap[this.issuableType]); Flash(relatedIssuesRemoveErrorMap[this.issuableType]);
} }
...@@ -219,7 +219,7 @@ export default { ...@@ -219,7 +219,7 @@ export default {
this.processAllReferences(newValue); this.processAllReferences(newValue);
}, },
processAllReferences(value = '') { processAllReferences(value = '') {
const rawReferences = value.split(/\s+/).filter(reference => reference.trim().length > 0); const rawReferences = value.split(/\s+/).filter((reference) => reference.trim().length > 0);
this.store.addPendingReferences(rawReferences); this.store.addPendingReferences(rawReferences);
this.inputValue = ''; this.inputValue = '';
......
...@@ -11,7 +11,7 @@ export default function initRelatedIssues() { ...@@ -11,7 +11,7 @@ export default function initRelatedIssues() {
components: { components: {
relatedIssuesRoot: RelatedIssuesRoot, relatedIssuesRoot: RelatedIssuesRoot,
}, },
render: createElement => render: (createElement) =>
createElement('related-issues-root', { createElement('related-issues-root', {
props: { props: {
endpoint: relatedIssuesRootElement.dataset.endpoint, endpoint: relatedIssuesRootElement.dataset.endpoint,
......
...@@ -19,7 +19,7 @@ class RelatedIssuesStore { ...@@ -19,7 +19,7 @@ class RelatedIssuesStore {
} }
removeRelatedIssue(issue) { removeRelatedIssue(issue) {
this.state.relatedIssues = this.state.relatedIssues.filter(x => x.id !== issue.id); this.state.relatedIssues = this.state.relatedIssues.filter((x) => x.id !== issue.id);
} }
updateIssueOrder(oldIndex, newIndex) { updateIssueOrder(oldIndex, newIndex) {
......
...@@ -15,7 +15,7 @@ export default function initRelatedMergeRequests() { ...@@ -15,7 +15,7 @@ export default function initRelatedMergeRequests() {
RelatedMergeRequests, RelatedMergeRequests,
}, },
store: createStore(), store: createStore(),
render: createElement => render: (createElement) =>
createElement('related-merge-requests', { createElement('related-merge-requests', {
props: { endpoint, projectNamespace, projectPath }, props: { endpoint, projectNamespace, projectPath },
}), }),
......
...@@ -21,7 +21,7 @@ export const fetchMergeRequests = ({ state, dispatch }) => { ...@@ -21,7 +21,7 @@ export const fetchMergeRequests = ({ state, dispatch }) => {
return axios return axios
.get(`${state.apiEndpoint}?per_page=${REQUEST_PAGE_COUNT}`) .get(`${state.apiEndpoint}?per_page=${REQUEST_PAGE_COUNT}`)
.then(res => { .then((res) => {
const { headers, data } = res; const { headers, data } = res;
const total = Number(normalizeHeaders(headers)['X-TOTAL']) || 0; const total = Number(normalizeHeaders(headers)['X-TOTAL']) || 0;
......
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
sections() { sections() {
return [ return [
{ {
links: get(this.assets, 'sources', []).map(s => ({ links: get(this.assets, 'sources', []).map((s) => ({
url: s.url, url: s.url,
name: sprintf(__('Source code (%{fileExtension})'), { fileExtension: s.format }), name: sprintf(__('Source code (%{fileExtension})'), { fileExtension: s.format }),
})), })),
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
links: this.otherLinks, links: this.otherLinks,
iconName: 'link', iconName: 'link',
}, },
].filter(section => section.links.length > 0); ].filter((section) => section.links.length > 0);
}, },
}, },
methods: { methods: {
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
this.isAssetsExpanded = !this.isAssetsExpanded; this.isAssetsExpanded = !this.isAssetsExpanded;
}, },
linksForType(type) { linksForType(type) {
return this.assets.links.filter(l => l.linkType === type); return this.assets.links.filter((l) => l.linkType === type);
}, },
}, },
externalLinkTooltipText: __('This link points to external content'), externalLinkTooltipText: __('This link points to external content'),
......
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
}, },
issueCounts() { issueCounts() {
return this.milestones return this.milestones
.map(m => m.issueStats || {}) .map((m) => m.issueStats || {})
.reduce( .reduce(
(acc, current) => { (acc, current) => {
acc.total += current.total || 0; acc.total += current.total || 0;
...@@ -79,11 +79,11 @@ export default { ...@@ -79,11 +79,11 @@ export default {
); );
}, },
showMergeRequestStats() { showMergeRequestStats() {
return this.milestones.some(m => m.mrStats); return this.milestones.some((m) => m.mrStats);
}, },
mergeRequestCounts() { mergeRequestCounts() {
return this.milestones return this.milestones
.map(m => m.mrStats || {}) .map((m) => m.mrStats || {})
.reduce( .reduce(
(acc, current) => { (acc, current) => {
acc.total += current.total || 0; acc.total += current.total || 0;
......
...@@ -11,14 +11,14 @@ export default { ...@@ -11,14 +11,14 @@ export default {
}, },
computed: { computed: {
...mapState('list', { ...mapState('list', {
orderBy: state => state.sorting.orderBy, orderBy: (state) => state.sorting.orderBy,
sort: state => state.sorting.sort, sort: (state) => state.sorting.sort,
}), }),
sortOptions() { sortOptions() {
return SORT_OPTIONS; return SORT_OPTIONS;
}, },
sortText() { sortText() {
const option = this.sortOptions.find(s => s.orderBy === this.orderBy); const option = this.sortOptions.find((s) => s.orderBy === this.orderBy);
return option.label; return option.label;
}, },
isSortAscending() { isSortAscending() {
......
...@@ -18,6 +18,6 @@ export default () => { ...@@ -18,6 +18,6 @@ export default () => {
return new Vue({ return new Vue({
el, el,
store, store,
render: h => h(ReleaseEditNewApp), render: (h) => h(ReleaseEditNewApp),
}); });
}; };
...@@ -21,6 +21,6 @@ export default () => { ...@@ -21,6 +21,6 @@ export default () => {
graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats), graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats),
}, },
}), }),
render: h => h(ReleaseListApp), render: (h) => h(ReleaseListApp),
}); });
}; };
...@@ -18,6 +18,6 @@ export default () => { ...@@ -18,6 +18,6 @@ export default () => {
return new Vue({ return new Vue({
el, el,
store, store,
render: h => h(ReleaseEditNewApp), render: (h) => h(ReleaseEditNewApp),
}); });
}; };
...@@ -21,6 +21,6 @@ export default () => { ...@@ -21,6 +21,6 @@ export default () => {
return new Vue({ return new Vue({
el, el,
store, store,
render: h => h(ReleaseShowApp), render: (h) => h(ReleaseShowApp),
}); });
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @returns {Boolean} `true` if all the feature flags * @returns {Boolean} `true` if all the feature flags
* required to enable the GraphQL endpoint are enabled * required to enable the GraphQL endpoint are enabled
*/ */
export const useGraphQLEndpoint = rootState => { export const useGraphQLEndpoint = (rootState) => {
return Boolean( return Boolean(
rootState.featureFlags.graphqlReleaseData && rootState.featureFlags.graphqlReleaseData &&
rootState.featureFlags.graphqlReleasesPage && rootState.featureFlags.graphqlReleasesPage &&
......
...@@ -36,12 +36,12 @@ export const fetchRelease = ({ commit, state, rootState }) => { ...@@ -36,12 +36,12 @@ export const fetchRelease = ({ commit, state, rootState }) => {
tagName: state.tagName, tagName: state.tagName,
}, },
}) })
.then(response => { .then((response) => {
const { data: release } = convertOneReleaseGraphQLResponse(response); const { data: release } = convertOneReleaseGraphQLResponse(response);
commit(types.RECEIVE_RELEASE_SUCCESS, release); commit(types.RECEIVE_RELEASE_SUCCESS, release);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_RELEASE_ERROR, error); commit(types.RECEIVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while getting the release details')); createFlash(s__('Release|Something went wrong while getting the release details'));
}); });
...@@ -52,7 +52,7 @@ export const fetchRelease = ({ commit, state, rootState }) => { ...@@ -52,7 +52,7 @@ export const fetchRelease = ({ commit, state, rootState }) => {
.then(({ data }) => { .then(({ data }) => {
commit(types.RECEIVE_RELEASE_SUCCESS, apiJsonToRelease(data)); commit(types.RECEIVE_RELEASE_SUCCESS, apiJsonToRelease(data));
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_RELEASE_ERROR, error); commit(types.RECEIVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while getting the release details')); createFlash(s__('Release|Something went wrong while getting the release details'));
}); });
...@@ -121,7 +121,7 @@ export const createRelease = ({ commit, dispatch, state, getters }) => { ...@@ -121,7 +121,7 @@ export const createRelease = ({ commit, dispatch, state, getters }) => {
.then(({ data }) => { .then(({ data }) => {
dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(data)); dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(data));
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_SAVE_RELEASE_ERROR, error); commit(types.RECEIVE_SAVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while creating a new release')); createFlash(s__('Release|Something went wrong while creating a new release'));
}); });
...@@ -163,7 +163,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => { ...@@ -163,7 +163,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
// Delete all links currently associated with this Release // Delete all links currently associated with this Release
return Promise.all( return Promise.all(
getters.releaseLinksToDelete.map(l => getters.releaseLinksToDelete.map((l) =>
api.deleteReleaseLink(state.projectId, state.release.tagName, l.id), api.deleteReleaseLink(state.projectId, state.release.tagName, l.id),
), ),
); );
...@@ -171,7 +171,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => { ...@@ -171,7 +171,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
.then(() => { .then(() => {
// Create a new link for each link in the form // Create a new link for each link in the form
return Promise.all( return Promise.all(
apiJson.assets.links.map(l => apiJson.assets.links.map((l) =>
api.createReleaseLink(state.projectId, state.release.tagName, l), api.createReleaseLink(state.projectId, state.release.tagName, l),
), ),
); );
...@@ -179,7 +179,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => { ...@@ -179,7 +179,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
.then(() => { .then(() => {
dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(updatedRelease)); dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(updatedRelease));
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_SAVE_RELEASE_ERROR, error); commit(types.RECEIVE_SAVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while saving the release details')); createFlash(s__('Release|Something went wrong while saving the release details'));
}) })
......
...@@ -5,7 +5,7 @@ import { hasContent } from '~/lib/utils/text_utility'; ...@@ -5,7 +5,7 @@ import { hasContent } from '~/lib/utils/text_utility';
* @returns {Boolean} `true` if the app is editing an existing release. * @returns {Boolean} `true` if the app is editing an existing release.
* `false` if the app is creating a new release. * `false` if the app is creating a new release.
*/ */
export const isExistingRelease = state => { export const isExistingRelease = (state) => {
return Boolean(state.tagName); return Boolean(state.tagName);
}; };
...@@ -15,19 +15,19 @@ export const isExistingRelease = state => { ...@@ -15,19 +15,19 @@ export const isExistingRelease = state => {
* empty (or whitespace-only) values for both `url` and `name`. * empty (or whitespace-only) values for both `url` and `name`.
* Otherwise, `false`. * Otherwise, `false`.
*/ */
const isEmptyReleaseLink = link => !hasContent(link.url) && !hasContent(link.name); const isEmptyReleaseLink = (link) => !hasContent(link.url) && !hasContent(link.name);
/** Returns all release links that aren't empty */ /** Returns all release links that aren't empty */
export const releaseLinksToCreate = state => { export const releaseLinksToCreate = (state) => {
if (!state.release) { if (!state.release) {
return []; return [];
} }
return state.release.assets.links.filter(l => !isEmptyReleaseLink(l)); return state.release.assets.links.filter((l) => !isEmptyReleaseLink(l));
}; };
/** Returns all release links that should be deleted */ /** Returns all release links that should be deleted */
export const releaseLinksToDelete = state => { export const releaseLinksToDelete = (state) => {
if (!state.originalRelease) { if (!state.originalRelease) {
return []; return [];
} }
...@@ -36,7 +36,7 @@ export const releaseLinksToDelete = state => { ...@@ -36,7 +36,7 @@ export const releaseLinksToDelete = state => {
}; };
/** Returns all validation errors on the release object */ /** Returns all validation errors on the release object */
export const validationErrors = state => { export const validationErrors = (state) => {
const errors = { const errors = {
assets: { assets: {
links: {}, links: {},
...@@ -56,7 +56,7 @@ export const validationErrors = state => { ...@@ -56,7 +56,7 @@ export const validationErrors = state => {
// This is used for detecting duplicate URLs. // This is used for detecting duplicate URLs.
const urlToLinksMap = new Map(); const urlToLinksMap = new Map();
state.release.assets.links.forEach(link => { state.release.assets.links.forEach((link) => {
errors.assets.links[link.id] = {}; errors.assets.links[link.id] = {};
// Only validate non-empty URLs // Only validate non-empty URLs
...@@ -81,7 +81,7 @@ export const validationErrors = state => { ...@@ -81,7 +81,7 @@ export const validationErrors = state => {
// add a validation error for each link that shares this URL // add a validation error for each link that shares this URL
const duplicates = urlToLinksMap.get(normalizedUrl); const duplicates = urlToLinksMap.get(normalizedUrl);
duplicates.push(link); duplicates.push(link);
duplicates.forEach(duplicateLink => { duplicates.forEach((duplicateLink) => {
errors.assets.links[duplicateLink.id].isDuplicate = true; errors.assets.links[duplicateLink.id].isDuplicate = true;
}); });
} else { } else {
......
...@@ -3,7 +3,7 @@ import * as getters from './getters'; ...@@ -3,7 +3,7 @@ import * as getters from './getters';
import mutations from './mutations'; import mutations from './mutations';
import createState from './state'; import createState from './state';
export default initialState => ({ export default (initialState) => ({
namespaced: true, namespaced: true,
actions, actions,
getters, getters,
......
...@@ -3,7 +3,7 @@ import * as types from './mutation_types'; ...@@ -3,7 +3,7 @@ import * as types from './mutation_types';
import { DEFAULT_ASSET_LINK_TYPE } from '../../../constants'; import { DEFAULT_ASSET_LINK_TYPE } from '../../../constants';
const findReleaseLink = (release, id) => { const findReleaseLink = (release, id) => {
return release.assets.links.find(l => l.id === id); return release.assets.links.find((l) => l.id === id);
}; };
export default { export default {
...@@ -93,6 +93,6 @@ export default { ...@@ -93,6 +93,6 @@ export default {
}, },
[types.REMOVE_ASSET_LINK](state, linkIdToRemove) { [types.REMOVE_ASSET_LINK](state, linkIdToRemove) {
state.release.assets.links = state.release.assets.links.filter(l => l.id !== linkIdToRemove); state.release.assets.links = state.release.assets.links.filter((l) => l.id !== linkIdToRemove);
}, },
}; };
...@@ -68,7 +68,7 @@ export const fetchReleasesGraphQl = ( ...@@ -68,7 +68,7 @@ export const fetchReleasesGraphQl = (
...paginationParams, ...paginationParams,
}, },
}) })
.then(response => { .then((response) => {
const { data, paginationInfo: graphQlPageInfo } = convertAllReleasesGraphQLResponse(response); const { data, paginationInfo: graphQlPageInfo } = convertAllReleasesGraphQLResponse(response);
commit(types.RECEIVE_RELEASES_SUCCESS, { commit(types.RECEIVE_RELEASES_SUCCESS, {
......
...@@ -2,7 +2,7 @@ import createState from './state'; ...@@ -2,7 +2,7 @@ import createState from './state';
import * as actions from './actions'; import * as actions from './actions';
import mutations from './mutations'; import mutations from './mutations';
export default initialState => ({ export default (initialState) => ({
namespaced: true, namespaced: true,
actions, actions,
mutations, mutations,
......
...@@ -17,7 +17,7 @@ export const releaseToApiJson = (release, createFrom = null) => { ...@@ -17,7 +17,7 @@ export const releaseToApiJson = (release, createFrom = null) => {
// Milestones may be either a list of milestone objects OR just a list // Milestones may be either a list of milestone objects OR just a list
// of milestone titles. The API requires only the titles be sent. // of milestone titles. The API requires only the titles be sent.
const milestones = (release.milestones || []).map(m => m.title || m); const milestones = (release.milestones || []).map((m) => m.title || m);
return convertObjectPropsToSnakeCase( return convertObjectPropsToSnakeCase(
{ {
...@@ -37,7 +37,7 @@ export const releaseToApiJson = (release, createFrom = null) => { ...@@ -37,7 +37,7 @@ export const releaseToApiJson = (release, createFrom = null) => {
* into the structure this Vue application can work with. * into the structure this Vue application can work with.
* @param {Object} json The JSON object received from the release API * @param {Object} json The JSON object received from the release API
*/ */
export const apiJsonToRelease = json => { export const apiJsonToRelease = (json) => {
const release = convertObjectPropsToCamelCase(json, { deep: true }); const release = convertObjectPropsToCamelCase(json, { deep: true });
release.milestones = release.milestones || []; release.milestones = release.milestones || [];
...@@ -47,7 +47,7 @@ export const apiJsonToRelease = json => { ...@@ -47,7 +47,7 @@ export const apiJsonToRelease = json => {
export const gqClient = createGqClient({}, { fetchPolicy: fetchPolicies.NO_CACHE }); export const gqClient = createGqClient({}, { fetchPolicy: fetchPolicies.NO_CACHE });
const convertScalarProperties = graphQLRelease => const convertScalarProperties = (graphQLRelease) =>
pick(graphQLRelease, [ pick(graphQLRelease, [
'name', 'name',
'tagName', 'tagName',
...@@ -57,29 +57,29 @@ const convertScalarProperties = graphQLRelease => ...@@ -57,29 +57,29 @@ const convertScalarProperties = graphQLRelease =>
'upcomingRelease', 'upcomingRelease',
]); ]);
const convertAssets = graphQLRelease => ({ const convertAssets = (graphQLRelease) => ({
assets: { assets: {
count: graphQLRelease.assets.count, count: graphQLRelease.assets.count,
sources: [...graphQLRelease.assets.sources.nodes], sources: [...graphQLRelease.assets.sources.nodes],
links: graphQLRelease.assets.links.nodes.map(l => ({ links: graphQLRelease.assets.links.nodes.map((l) => ({
...l, ...l,
linkType: l.linkType?.toLowerCase(), linkType: l.linkType?.toLowerCase(),
})), })),
}, },
}); });
const convertEvidences = graphQLRelease => ({ const convertEvidences = (graphQLRelease) => ({
evidences: graphQLRelease.evidences.nodes.map(e => e), evidences: graphQLRelease.evidences.nodes.map((e) => e),
}); });
const convertLinks = graphQLRelease => ({ const convertLinks = (graphQLRelease) => ({
_links: { _links: {
...graphQLRelease.links, ...graphQLRelease.links,
self: graphQLRelease.links?.selfUrl, self: graphQLRelease.links?.selfUrl,
}, },
}); });
const convertCommit = graphQLRelease => { const convertCommit = (graphQLRelease) => {
if (!graphQLRelease.commit) { if (!graphQLRelease.commit) {
return {}; return {};
} }
...@@ -93,10 +93,10 @@ const convertCommit = graphQLRelease => { ...@@ -93,10 +93,10 @@ const convertCommit = graphQLRelease => {
}; };
}; };
const convertAuthor = graphQLRelease => ({ author: graphQLRelease.author }); const convertAuthor = (graphQLRelease) => ({ author: graphQLRelease.author });
const convertMilestones = graphQLRelease => ({ const convertMilestones = (graphQLRelease) => ({
milestones: graphQLRelease.milestones.nodes.map(m => ({ milestones: graphQLRelease.milestones.nodes.map((m) => ({
...m, ...m,
webUrl: m.webPath, webUrl: m.webPath,
webPath: undefined, webPath: undefined,
...@@ -115,7 +115,7 @@ const convertMilestones = graphQLRelease => ({ ...@@ -115,7 +115,7 @@ const convertMilestones = graphQLRelease => ({
* *
* @param graphQLRelease The release object returned from a GraphQL query * @param graphQLRelease The release object returned from a GraphQL query
*/ */
export const convertGraphQLRelease = graphQLRelease => ({ export const convertGraphQLRelease = (graphQLRelease) => ({
...convertScalarProperties(graphQLRelease), ...convertScalarProperties(graphQLRelease),
...convertAssets(graphQLRelease), ...convertAssets(graphQLRelease),
...convertEvidences(graphQLRelease), ...convertEvidences(graphQLRelease),
...@@ -134,7 +134,7 @@ export const convertGraphQLRelease = graphQLRelease => ({ ...@@ -134,7 +134,7 @@ export const convertGraphQLRelease = graphQLRelease => ({
* *
* @param response The response received from the GraphQL endpoint * @param response The response received from the GraphQL endpoint
*/ */
export const convertAllReleasesGraphQLResponse = response => { export const convertAllReleasesGraphQLResponse = (response) => {
const releases = response.data.project.releases.nodes.map(convertGraphQLRelease); const releases = response.data.project.releases.nodes.map(convertGraphQLRelease);
const paginationInfo = { const paginationInfo = {
...@@ -153,7 +153,7 @@ export const convertAllReleasesGraphQLResponse = response => { ...@@ -153,7 +153,7 @@ export const convertAllReleasesGraphQLResponse = response => {
* *
* @param response The response received from the GraphQL endpoint * @param response The response received from the GraphQL endpoint
*/ */
export const convertOneReleaseGraphQLResponse = response => { export const convertOneReleaseGraphQLResponse = (response) => {
const release = convertGraphQLRelease(response.data.project.release); const release = convertGraphQLRelease(response.data.project.release);
return { data: release }; return { data: release };
......
import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../../constants'; import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../../constants';
import { s__, n__ } from '~/locale'; import { s__, n__ } from '~/locale';
export const groupedSummaryText = state => { export const groupedSummaryText = (state) => {
if (state.isLoading) { if (state.isLoading) {
return s__('Reports|Accessibility scanning results are being parsed'); return s__('Reports|Accessibility scanning results are being parsed');
} }
...@@ -22,7 +22,7 @@ export const groupedSummaryText = state => { ...@@ -22,7 +22,7 @@ export const groupedSummaryText = state => {
); );
}; };
export const summaryStatus = state => { export const summaryStatus = (state) => {
if (state.isLoading) { if (state.isLoading) {
return LOADING; return LOADING;
} }
...@@ -34,12 +34,12 @@ export const summaryStatus = state => { ...@@ -34,12 +34,12 @@ export const summaryStatus = state => {
return SUCCESS; return SUCCESS;
}; };
export const shouldRenderIssuesList = state => export const shouldRenderIssuesList = (state) =>
Object.values(state.report).some(x => Array.isArray(x) && x.length > 0); Object.values(state.report).some((x) => Array.isArray(x) && x.length > 0);
// We could just map state, but we're going to iterate in the future // We could just map state, but we're going to iterate in the future
// to add notes and warnings to these issue lists, so I'm going to // to add notes and warnings to these issue lists, so I'm going to
// keep these as getters // keep these as getters
export const unresolvedIssues = state => state.report.existing_errors; export const unresolvedIssues = (state) => state.report.existing_errors;
export const resolvedIssues = state => state.report.resolved_errors; export const resolvedIssues = (state) => state.report.resolved_errors;
export const newIssues = state => state.report.new_errors; export const newIssues = (state) => state.report.new_errors;
...@@ -7,11 +7,11 @@ import state from './state'; ...@@ -7,11 +7,11 @@ import state from './state';
Vue.use(Vuex); Vue.use(Vuex);
export const getStoreConfig = initialState => ({ export const getStoreConfig = (initialState) => ({
actions, actions,
getters, getters,
mutations, mutations,
state: state(initialState), state: state(initialState),
}); });
export default initialState => new Vuex.Store(getStoreConfig(initialState)); export default (initialState) => new Vuex.Store(getStoreConfig(initialState));
...@@ -11,13 +11,13 @@ export const fetchReports = ({ state, dispatch, commit }) => { ...@@ -11,13 +11,13 @@ export const fetchReports = ({ state, dispatch, commit }) => {
return dispatch('receiveReportsError'); return dispatch('receiveReportsError');
} }
return Promise.all([axios.get(state.headPath), axios.get(state.basePath)]) return Promise.all([axios.get(state.headPath), axios.get(state.basePath)])
.then(results => .then((results) =>
doCodeClimateComparison( doCodeClimateComparison(
parseCodeclimateMetrics(results[0].data, state.headBlobPath), parseCodeclimateMetrics(results[0].data, state.headBlobPath),
parseCodeclimateMetrics(results[1].data, state.baseBlobPath), parseCodeclimateMetrics(results[1].data, state.baseBlobPath),
), ),
) )
.then(data => dispatch('receiveReportsSuccess', data)) .then((data) => dispatch('receiveReportsSuccess', data))
.catch(() => dispatch('receiveReportsError')); .catch(() => dispatch('receiveReportsError'));
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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