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 {
}
static registerInterceptor(peekUrl, callback) {
PerformanceBarService.interceptor = response => {
PerformanceBarService.interceptor = (response) => {
const [fireCallback, requestId, requestUrl] = PerformanceBarService.callbackParams(
response,
peekUrl,
......
......@@ -20,7 +20,7 @@ export default class PerformanceBarStore {
}
findRequest(requestId) {
return this.requests.find(request => request.id === requestId);
return this.requests.find((request) => request.id === requestId);
}
addRequestDetails(requestId, requestDetails) {
......@@ -43,13 +43,13 @@ export default class PerformanceBarStore {
}
requestsWithDetails() {
return this.requests.filter(request => request.details);
return this.requests.filter((request) => request.details);
}
canTrackRequest(requestUrl) {
return (
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 {
}
handleCloseButtonCallout(closeButton) {
closeButton.addEventListener('click', event => this.dismiss(event));
closeButton.addEventListener('click', (event) => this.dismiss(event));
if (this.deferLinks) {
this.container.addEventListener('click', event => {
this.container.addEventListener('click', (event) => {
const isDeferredLink = event.target.classList.contains(DEFERRED_LINK_CLASS);
if (isDeferredLink) {
const { href, target } = event.target;
......@@ -43,7 +43,7 @@ export default class PersistentUserCallout {
}
handleFollowLinkCallout(followLink) {
followLink.addEventListener('click', event => this.registerCalloutWithLink(event));
followLink.addEventListener('click', (event) => this.registerCalloutWithLink(event));
}
dismiss(event, deferredLinkOptions = null) {
......
......@@ -11,7 +11,7 @@ const PERSISTENT_USER_CALLOUTS = [
];
const initCallouts = () => {
PERSISTENT_USER_CALLOUTS.forEach(calloutContainer =>
PERSISTENT_USER_CALLOUTS.forEach((calloutContainer) =>
PersistentUserCallout.factory(document.querySelector(calloutContainer)),
);
};
......
......@@ -18,7 +18,7 @@ export const resolvers = {
valid: data.valid,
errors: data.errors,
warnings: data.warnings,
jobs: data.jobs.map(job => {
jobs: data.jobs.map((job) => {
const only = job.only ? { refs: job.only.refs, __typename: 'CiLintJobOnlyPolicy' } : null;
return {
......
......@@ -121,12 +121,12 @@ export default {
return this.searchTerm.toLowerCase();
},
filteredBranches() {
return this.branches.filter(branch =>
return this.branches.filter((branch) =>
branch.shortName.toLowerCase().includes(this.lowerCasedSearchTerm),
);
},
filteredTags() {
return this.tags.filter(tag =>
return this.tags.filter((tag) =>
tag.shortName.toLowerCase().includes(this.lowerCasedSearchTerm),
);
},
......@@ -187,7 +187,7 @@ export default {
setVariable(refValue, type, key, value) {
const { variables } = this.form[refValue];
const variable = variables.find(v => v.key === key);
const variable = variables.find((v) => v.key === key);
if (variable) {
variable.type = type;
variable.value = value;
......@@ -270,11 +270,11 @@ export default {
stop(data);
}
})
.catch(error => {
.catch((error) => {
stop(error);
});
}, CONFIG_VARIABLES_TIMEOUT)
.then(data => {
.then((data) => {
const params = {};
const descriptions = {};
......@@ -287,7 +287,7 @@ export default {
return { params, descriptions };
})
.catch(error => {
.catch((error) => {
this.isLoading = false;
Sentry.captureException(error);
......@@ -314,7 +314,7 @@ export default {
.then(({ data }) => {
redirectTo(`${this.pipelinesPath}/${data.id}`);
})
.catch(err => {
.catch((err) => {
const { errors, warnings, total_warnings: totalWarnings } = err.response.data;
const [error] = errors;
this.error = error;
......
......@@ -3,7 +3,7 @@ import { BRANCH_REF_TYPE, TAG_REF_TYPE } from '../constants';
export default (refs, type) => {
let fullName;
return refs.map(ref => {
return refs.map((ref) => {
if (type === BRANCH_REF_TYPE) {
fullName = `refs/heads/${ref}`;
} else if (type === TAG_REF_TYPE) {
......
......@@ -56,15 +56,15 @@ export default {
const unwrappedGroups = stages
.map(({ name, groups: { nodes: groups } }) => {
return groups.map(group => {
return groups.map((group) => {
return { category: name, ...group };
});
})
.flat(2);
const nodes = unwrappedGroups.map(group => {
const nodes = unwrappedGroups.map((group) => {
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 };
......
......@@ -173,7 +173,7 @@ export default {
createClip(link) {
return link
.append('clipPath')
.attr('id', d => {
.attr('id', (d) => {
return this.createAndAssignId(d, 'clipId', 'dag-clip');
})
.append('path')
......@@ -183,7 +183,7 @@ export default {
createGradient(link) {
const gradient = link
.append('linearGradient')
.attr('id', d => {
.attr('id', (d) => {
return this.createAndAssignId(d, 'gradId', 'dag-grad');
})
.attr('gradientUnits', 'userSpaceOnUse')
......@@ -251,7 +251,7 @@ export default {
.data(linksData)
.enter()
.append('g')
.attr('id', d => {
.attr('id', (d) => {
return this.createAndAssignId(d, 'uid', LINK_SELECTOR);
})
.classed(
......@@ -273,10 +273,10 @@ export default {
`${NODE_SELECTOR} gl-transition-property-stroke ${this.$options.viewOptions.hoverFadeClasses}`,
true,
)
.attr('id', d => {
.attr('id', (d) => {
return this.createAndAssignId(d, 'uid', NODE_SELECTOR);
})
.attr('stroke', d => {
.attr('stroke', (d) => {
const color = this.color(d);
/* eslint-disable-next-line no-param-reassign */
d.color = color;
......@@ -284,10 +284,10 @@ export default {
})
.attr('stroke-width', nodeWidth)
.attr('stroke-linecap', 'round')
.attr('x1', 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('y2', d => d.y1 - 4);
.attr('x1', (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('y2', (d) => d.y1 - 4);
},
initColors() {
......
......@@ -92,8 +92,8 @@ export const createSankey = ({
]);
return ({ nodes, links }) =>
sankeyGenerator({
nodes: nodes.map(d => ({ ...d })),
links: links.map(d => ({ ...d })),
nodes: nodes.map((d) => ({ ...d })),
links: links.map((d) => ({ ...d })),
});
};
......
......@@ -13,22 +13,22 @@ export const getLiveLinksAsDict = () => {
return Object.fromEntries(
getLiveLinks()
.data()
.map(d => [d.uid, d]),
.map((d) => [d.uid, d]),
);
};
export const currentIsLive = (idx, collection) =>
getCurrent(idx, collection).classed(IS_HIGHLIGHTED);
const backgroundLinks = selection => selection.style('stroke-opacity', highlightOut);
const backgroundNodes = selection => selection.attr('stroke', '#f2f2f2');
const foregroundLinks = selection => selection.style('stroke-opacity', highlightIn);
const foregroundNodes = selection => selection.attr('stroke', d => d.color);
const backgroundLinks = (selection) => selection.style('stroke-opacity', highlightOut);
const backgroundNodes = (selection) => selection.attr('stroke', '#f2f2f2');
const foregroundLinks = (selection) => selection.style('stroke-opacity', highlightIn);
const foregroundNodes = (selection) => selection.attr('stroke', (d) => d.color);
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) {
return node.targetLinks.flatMap(n => {
return node.targetLinks.flatMap((n) => {
return [n, ...getAllLinkAncestors(n.source)];
});
}
......@@ -36,11 +36,11 @@ export const getAllLinkAncestors = node => {
return [];
};
const getAllNodeAncestors = node => {
const getAllNodeAncestors = (node) => {
let allNodes = [];
if (node.targetLinks) {
allNodes = node.targetLinks.flatMap(n => {
allNodes = node.targetLinks.flatMap((n) => {
return getAllNodeAncestors(n.source);
});
}
......@@ -74,7 +74,7 @@ const highlightPath = (parentLinks, parentNodes) => {
});
/* highlight correct nodes */
parentNodes.forEach(id => {
parentNodes.forEach((id) => {
foregroundNodes(d3.select(`#${id}`)).classed(IS_HIGHLIGHTED, true);
});
};
......@@ -86,7 +86,7 @@ const restoreNodes = () => {
rehighlights their nodes.
*/
getLiveLinks().each(d => {
getLiveLinks().each((d) => {
foregroundNodes(d3.select(`#${d.source.uid}`)).classed(IS_HIGHLIGHTED, true);
foregroundNodes(d3.select(`#${d.target.uid}`)).classed(IS_HIGHLIGHTED, true);
});
......@@ -97,7 +97,7 @@ const restorePath = (parentLinks, parentNodes, baseOpacity) => {
renewLinks(d3.select(`#${uid}`), baseOpacity).classed(IS_HIGHLIGHTED, false);
});
parentNodes.forEach(id => {
parentNodes.forEach((id) => {
d3.select(`#${id}`).classed(IS_HIGHLIGHTED, false);
});
......@@ -112,7 +112,7 @@ const restorePath = (parentLinks, parentNodes, baseOpacity) => {
restoreNodes();
};
export const restoreLinks = baseOpacity => {
export const restoreLinks = (baseOpacity) => {
/*
if there exist live links, reset to highlight out / pale
otherwise, reset to base
......
......@@ -78,11 +78,11 @@ export default {
return (
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() {
return this.pipeline.triggered && this.pipeline.triggered.find(el => el.isExpanded);
return this.pipeline.triggered && this.pipeline.triggered.find((el) => el.isExpanded);
},
pipelineTypeUpstream() {
return this.type !== this.$options.downstream && this.expandedUpstream;
......
......@@ -9,7 +9,7 @@ const addMulti = (mainPipelineProjectPath, linkedPipeline) => {
};
};
const transformId = linkedPipeline => {
const transformId = (linkedPipeline) => {
return { ...linkedPipeline, id: getIdFromGraphQLId(linkedPipeline.id) };
};
......@@ -42,7 +42,7 @@ const unwrapPipelineData = (mainPipelineProjectPath, data) => {
};
const toggleQueryPollingByVisibility = (queryRef, interval = 10000) => {
const stopStartQuery = query => {
const stopStartQuery = (query) => {
if (!Visibility.hidden()) {
query.startPolling(interval);
} else {
......
......@@ -54,7 +54,7 @@ export default {
iid: this.pipelineIid,
};
},
update: data => data.project.pipeline,
update: (data) => data.project.pipeline,
error() {
this.reportFailure(LOAD_FAILURE);
},
......
......@@ -33,15 +33,15 @@ import { uniqWith, isEqual } from 'lodash';
10 -> value (constant)
*/
export const createNodeDict = nodes => {
export const createNodeDict = (nodes) => {
return nodes.reduce((acc, node) => {
const newNode = {
...node,
needs: node.jobs.map(job => job.needs || []).flat(),
needs: node.jobs.map((job) => job.needs || []).flat(),
};
if (node.size > 1) {
node.jobs.forEach(job => {
node.jobs.forEach((job) => {
acc[job.name] = newNode;
});
}
......@@ -54,13 +54,13 @@ export const createNodeDict = nodes => {
export const makeLinksFromNodes = (nodes, nodeDict) => {
const constantLinkValue = 10; // all links are the same weight
return nodes
.map(group => {
return group.jobs.map(job => {
.map((group) => {
return group.jobs.map((job) => {
if (!job.needs) {
return [];
}
return job.needs.map(needed => {
return job.needs.map((needed) => {
return {
source: nodeDict[needed]?.name,
target: group.name,
......@@ -74,7 +74,7 @@ export const makeLinksFromNodes = (nodes, nodeDict) => {
export const getAllAncestors = (nodes, nodeDict) => {
const needs = nodes
.map(node => {
.map((node) => {
return nodeDict[node].needs || '';
})
.flat()
......@@ -102,13 +102,13 @@ export const filterByAncestors = (links, nodeDict) =>
*/
const targetNode = target;
const targetNodeNeeds = nodeDict[targetNode].needs;
const targetNodeNeedsMinusSource = targetNodeNeeds.filter(need => need !== source);
const targetNodeNeedsMinusSource = targetNodeNeeds.filter((need) => need !== source);
const allAncestors = getAllAncestors(targetNodeNeedsMinusSource, nodeDict);
return !allAncestors.includes(source);
});
export const parseData = nodes => {
export const parseData = (nodes) => {
const nodeDict = createNodeDict(nodes);
const allLinks = makeLinksFromNodes(nodes, nodeDict);
const filteredLinks = filterByAncestors(allLinks, nodeDict);
......@@ -121,7 +121,7 @@ export const parseData = nodes => {
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 }) => {
if (!acc[layer]) {
acc[layer] = 0;
......@@ -141,6 +141,6 @@ export const getMaxNodes = nodes => {
to find nodes that have no relations.
*/
export const removeOrphanNodes = sankeyfiedNodes => {
return sankeyfiedNodes.filter(node => node.sourceLinks.length || node.targetLinks.length);
export const removeOrphanNodes = (sankeyfiedNodes) => {
return sankeyfiedNodes.filter((node) => node.sourceLinks.length || node.targetLinks.length);
};
......@@ -14,7 +14,7 @@ import { createUniqueLinkId } from '../../utils';
export const generateLinksData = ({ links }, containerID) => {
const containerEl = document.getElementById(containerID);
return links.map(link => {
return links.map((link) => {
const path = d3.path();
const sourceId = link.source;
......
......@@ -111,13 +111,13 @@ export default {
// 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.
if (this.hasHighlightedJob) {
const filteredLinks = this.links.filter(link => {
const filteredLinks = this.links.filter((link) => {
return (
this.highlightedJobs.includes(link.source) && this.highlightedJobs.includes(link.target)
);
});
return filteredLinks.map(link => link.ref);
return filteredLinks.map((link) => link.ref);
}
return [];
......
......@@ -246,7 +246,7 @@ export default {
filterPipelines(filters) {
this.resetRequestData();
filters.forEach(filter => {
filters.forEach((filter) => {
// do not add Any for username query param, so we
// can fetch all trigger authors
if (
......
......@@ -33,7 +33,7 @@ export default {
},
computed: {
selectedTypes() {
return this.value.map(i => i.type);
return this.value.map((i) => i.type);
},
tokens() {
return [
......
......@@ -124,7 +124,7 @@ export default {
$(
'.js-builds-dropdown-list button, .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item',
this.$el,
).on('click', e => {
).on('click', (e) => {
e.stopPropagation();
});
},
......
......@@ -34,10 +34,10 @@ export default {
fetchBranches(searchterm) {
Api.branches(this.config.projectId, searchterm)
.then(({ data }) => {
this.branches = data.map(branch => branch.name);
this.branches = data.map((branch) => branch.name);
this.loading = false;
})
.catch(err => {
.catch((err) => {
createFlash(FETCH_BRANCH_ERROR_MESSAGE);
this.loading = false;
throw err;
......
......@@ -72,7 +72,7 @@ export default {
];
},
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 {
fetchTags(searchTerm) {
Api.tags(this.config.projectId, searchTerm)
.then(({ data }) => {
this.tags = data.map(tag => tag.name);
this.tags = data.map((tag) => tag.name);
this.loading = false;
})
.catch(err => {
.catch((err) => {
createFlash(FETCH_TAG_ERROR_MESSAGE);
this.loading = false;
throw err;
......
......@@ -45,7 +45,7 @@ export default {
return this.value.data.toLowerCase();
},
activeUser() {
return this.users.find(user => {
return this.users.find((user) => {
return user.username.toLowerCase() === this.currentValue;
});
},
......@@ -56,11 +56,11 @@ export default {
methods: {
fetchProjectUsers(searchTerm) {
Api.projectUsers(this.config.projectId, searchTerm)
.then(users => {
.then((users) => {
this.users = users;
this.loading = false;
})
.catch(err => {
.catch((err) => {
createFlash(FETCH_AUTHOR_ERROR_MESSAGE);
this.loading = false;
throw err;
......
......@@ -8,15 +8,15 @@
export const unwrapArrayOfJobs = (stages = []) => {
return stages
.map(({ name, groups }) => {
return groups.map(group => {
return groups.map((group) => {
return { category: name, ...group };
});
})
.flat(2);
};
const unwrapGroups = stages => {
return stages.map(stage => {
const unwrapGroups = (stages) => {
return stages.map((stage) => {
const {
groups: { nodes: groups },
} = stage;
......@@ -25,21 +25,21 @@ const unwrapGroups = stages => {
};
const unwrapNodesWithName = (jobArray, prop, field = 'name') => {
return jobArray.map(job => {
return { ...job, [prop]: job[prop].nodes.map(item => item[field]) };
return jobArray.map((job) => {
return { ...job, [prop]: job[prop].nodes.map((item) => item[field]) };
});
};
const unwrapJobWithNeeds = denodedJobArray => {
const unwrapJobWithNeeds = (denodedJobArray) => {
return unwrapNodesWithName(denodedJobArray, 'needs');
};
const unwrapStagesWithNeeds = denodedStages => {
const unwrapStagesWithNeeds = (denodedStages) => {
const unwrappedNestedGroups = unwrapGroups(denodedStages);
const nodes = unwrappedNestedGroups.map(node => {
const nodes = unwrappedNestedGroups.map((node) => {
const { groups } = node;
const groupsWithJobs = groups.map(group => {
const groupsWithJobs = groups.map((group) => {
const jobs = unwrapJobWithNeeds(group.jobs.nodes);
return { ...group, jobs };
});
......
......@@ -6,7 +6,7 @@ export default {
getExpandedPipelines(pipeline) {
this.mediator.service
.getPipeline(this.mediator.getExpandedParameters())
.then(response => {
.then((response) => {
this.mediator.store.toggleLoading(pipeline);
this.mediator.store.storePipeline(response.data);
this.mediator.poll.enable({ data: this.mediator.getExpandedParameters() });
......
......@@ -90,7 +90,7 @@ export default {
// fetch new data
return this.service
.getPipelines(this.requestData)
.then(response => {
.then((response) => {
this.isLoading = false;
this.successCallback(response);
......@@ -124,8 +124,8 @@ export default {
getPipelines() {
return this.service
.getPipelines(this.requestData)
.then(response => this.successCallback(response))
.catch(error => this.errorCallback(error));
.then((response) => this.successCallback(response))
.catch((error) => this.errorCallback(error));
},
setCommonData(pipelines) {
this.store.storePipelines(pipelines);
......
......@@ -20,7 +20,7 @@ const SELECTORS = {
PIPELINE_TESTS: '#js-pipeline-tests-detail',
};
const createLegacyPipelinesDetailApp = mediator => {
const createLegacyPipelinesDetailApp = (mediator) => {
if (!document.querySelector(SELECTORS.PIPELINE_GRAPH)) {
return;
}
......@@ -47,15 +47,15 @@ const createLegacyPipelinesDetailApp = mediator => {
refreshPipelineGraph: this.requestRefreshPipelineGraph,
onResetDownstream: (parentPipeline, pipeline) =>
this.resetDownstreamPipelines(parentPipeline, pipeline),
onClickUpstreamPipeline: pipeline => this.clickUpstreamPipeline(pipeline),
onClickDownstreamPipeline: pipeline => this.clickDownstreamPipeline(pipeline),
onClickUpstreamPipeline: (pipeline) => this.clickUpstreamPipeline(pipeline),
onClickDownstreamPipeline: (pipeline) => this.clickDownstreamPipeline(pipeline),
},
});
},
});
};
const createLegacyPipelineHeaderApp = mediator => {
const createLegacyPipelineHeaderApp = (mediator) => {
if (!document.querySelector(SELECTORS.PIPELINE_HEADER)) {
return;
}
......
......@@ -9,7 +9,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
export const createPipelineHeaderApp = elSelector => {
export const createPipelineHeaderApp = (elSelector) => {
const el = document.querySelector(elSelector);
if (!el) {
......
......@@ -55,7 +55,7 @@ export default class pipelinesMediator {
return this.service
.getPipeline()
.then(response => this.successCallback(response))
.then((response) => this.successCallback(response))
.catch(() => this.errorCallback())
.finally(() =>
this.poll.restart(
......
......@@ -29,11 +29,11 @@ export default class PipelineStore {
}
if (pipelineCopy.triggered && pipelineCopy.triggered.length) {
pipelineCopy.triggered.forEach(el => {
pipelineCopy.triggered.forEach((el) => {
const oldPipeline =
this.state.pipeline &&
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);
});
......@@ -67,8 +67,8 @@ export default class PipelineStore {
}
if (newPipeline.triggered_by?.length > 0) {
newPipeline.triggered_by.forEach(el => {
const oldTriggeredBy = oldPipeline.triggered_by?.find(element => element.id === el.id);
newPipeline.triggered_by.forEach((el) => {
const oldTriggeredBy = oldPipeline.triggered_by?.find((element) => element.id === el.id);
this.parseTriggeredPipelines(oldTriggeredBy, el);
});
}
......@@ -88,9 +88,9 @@ export default class PipelineStore {
Vue.set(newPipeline, 'isLoading', false);
if (newPipeline.triggered && newPipeline.triggered.length > 0) {
newPipeline.triggered.forEach(el => {
newPipeline.triggered.forEach((el) => {
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);
});
}
......@@ -102,7 +102,7 @@ export default class PipelineStore {
* @param {Object} 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) {
this.resetTriggeredByPipeline(pipeline, pipeline.triggered_by);
......@@ -129,7 +129,7 @@ export default class PipelineStore {
this.closePipeline(pipeline);
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 {
* @param {Object} pipeline
*/
resetTriggeredPipelines(parentPipeline, pipeline) {
parentPipeline.triggered.forEach(el => this.closePipeline(el));
parentPipeline.triggered.forEach((el) => this.closePipeline(el));
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 {
this.closePipeline(pipeline);
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 {
removeExpandedPipelineToRequestData(id) {
this.state.expandedPipelines.splice(
this.state.expandedPipelines.findIndex(el => el === id),
this.state.expandedPipelines.findIndex((el) => el === id),
1,
);
}
......
import { addIconStatus, formattedTime } from './utils';
export const getTestSuites = state => {
export const getTestSuites = (state) => {
const { test_suites: testSuites = [] } = state.testReports;
return testSuites.map(suite => ({
return testSuites.map((suite) => ({
...suite,
formattedTime: formattedTime(suite.total_time),
}));
};
export const getSelectedSuite = state =>
export const getSelectedSuite = (state) =>
state.testReports?.test_suites?.[state.selectedSuiteIndex] || {};
export const getSuiteTests = state => {
export const getSuiteTests = (state) => {
const { test_cases: testCases = [] } = getSelectedSuite(state);
const { page, perPage } = state.pageInfo;
const start = (page - 1) * perPage;
......@@ -20,4 +20,4 @@ export const getSuiteTests = state => {
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';
Vue.use(Vuex);
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
getters,
......
......@@ -25,7 +25,7 @@ export const formattedTime = (seconds = 0) => {
return sprintf(__('%{seconds}s'), { seconds: seconds.toFixed(2) });
};
export const addIconStatus = testCase => ({
export const addIconStatus = (testCase) => ({
...testCase,
icon: iconForTestStatus(testCase.status),
formattedTime: formattedTime(testCase.execution_time),
......
import { pickBy } from 'lodash';
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);
};
......@@ -17,10 +17,10 @@ export const createUniqueLinkId = (stageName, jobName) => `${stageName}-${jobNam
export const createJobsHash = (stages = []) => {
const jobsHash = {};
stages.forEach(stage => {
stages.forEach((stage) => {
if (stage.groups.length > 0) {
stage.groups.forEach(group => {
group.jobs.forEach(job => {
stage.groups.forEach((group) => {
group.jobs.forEach((job) => {
jobsHash[job.name] = job;
});
});
......@@ -44,13 +44,13 @@ export const generateJobNeedsDict = (jobs = {}) => {
const arrOfJobNames = Object.keys(jobs);
return arrOfJobNames.reduce((acc, value) => {
const recursiveNeeds = jobName => {
const recursiveNeeds = (jobName) => {
if (!jobs[jobName]?.needs) {
return [];
}
return jobs[jobName].needs
.map(job => {
.map((job) => {
// If we already have the needs of a job in the accumulator,
// then we use the memoized data instead of the recursive call
// to save some performance.
......
......@@ -7,7 +7,7 @@
import { GlPopover } from '@gitlab/ui';
import { sanitize } from '~/lib/dompurify';
const newPopover = element => {
const newPopover = (element) => {
const { content, html, placement, title, triggers = 'focus' } = element.dataset;
return {
......@@ -30,8 +30,8 @@ export default {
};
},
created() {
this.observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
this.observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.removedNodes.forEach(this.dispose);
});
});
......@@ -61,7 +61,7 @@ export default {
if (!target) {
this.popovers = [];
} else {
const index = this.popovers.findIndex(popover => popover.target === target);
const index = this.popovers.findIndex((popover) => popover.target === target);
if (index > -1) {
this.popovers.splice(index, 1);
......@@ -69,7 +69,7 @@ export default {
}
},
popoverExists(element) {
return this.popovers.some(popover => popover.target === element);
return this.popovers.some((popover) => popover.target === element);
},
getSafeHtml(html) {
return sanitize(html);
......
......@@ -32,10 +32,10 @@ const handlePopoverEvent = (rootTarget, e, selector) => {
};
export const initPopovers = () => {
['mouseenter', 'focus', 'click'].forEach(event => {
['mouseenter', 'focus', 'click'].forEach((event) => {
document.addEventListener(
event,
e => handlePopoverEvent(document, e, '[data-toggle="popover"]'),
(e) => handlePopoverEvent(document, e, '[data-toggle="popover"]'),
true,
);
});
......@@ -43,7 +43,7 @@ export const initPopovers = () => {
return getPopoversApp();
};
export const dispose = elements => toArray(elements).forEach(getPopoversApp().dispose);
export const dispose = (elements) => toArray(elements).forEach(getPopoversApp().dispose);
export const destroy = () => {
getPopoversApp().$destroy();
......
......@@ -84,12 +84,12 @@ Please update your Git repository remotes as soon as possible.`),
return axios
.put(this.actionUrl, putData)
.then(result => {
.then((result) => {
Flash(result.data.message, 'notice');
this.username = username;
this.isRequestPending = false;
})
.catch(error => {
.catch((error) => {
Flash(error.response.data.message);
this.isRequestPending = false;
throw error;
......
......@@ -12,7 +12,7 @@ export default class AddSshKeyValidation {
}
register() {
this.form.addEventListener('submit', event => this.submit(event));
this.form.addEventListener('submit', (event) => this.submit(event));
this.confirmSubmitElement.addEventListener('click', () => {
this.isValid = true;
......
......@@ -18,6 +18,6 @@ export default () => {
el,
name: 'ProfilePreferencesApp',
provide,
render: createElement => createElement(ProfilePreferences),
render: (createElement) => createElement(ProfilePreferences),
});
};
......@@ -20,7 +20,7 @@ export default class Profile {
this.timezoneDropdown = new TimezoneDropdown({
$inputEl: this.$inputEl,
$dropdownEl: $('.js-timezone-dropdown'),
displayFormat: selectedItem => formatTimezone(selectedItem),
displayFormat: (selectedItem) => formatTimezone(selectedItem),
});
}
......@@ -39,7 +39,7 @@ export default class Profile {
bindEvents() {
$('.js-preferences-form').on('change.preference', 'input[type=radio]', 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));
});
$('#user_notified_of_own_activity').on('change', this.submitForm);
......@@ -89,7 +89,7 @@ export default class Profile {
// Enable submit button after requests ends
self.form.find(':input[disabled]').enable();
})
.catch(error => flash(error.message));
.catch((error) => flash(error.message));
}
updateHeaderAvatar() {
......
......@@ -57,7 +57,7 @@ export default class ProjectFindFile {
initEvent() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.inputElement.off('keyup');
this.inputElement.on('keyup', event => {
this.inputElement.on('keyup', (event) => {
const target = $(event.target);
const value = target.val();
const ref = target.data('oldValue');
......
......@@ -33,7 +33,7 @@ const projectSelect = () => {
$(select).select2({
placeholder,
minimumInputLength: 0,
query: query => {
query: (query) => {
let projectsCallback;
const finalCallback = function (projects) {
const data = {
......
......@@ -17,9 +17,9 @@ export default class ProjectSelectComboButton {
bindEvents() {
this.projectSelectInput
.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()) {
e.preventDefault();
this.openDropdown(e);
......
......@@ -7,7 +7,7 @@ function setVisibilityOptions(namespaceSelector) {
const selectedNamespace = namespaceSelector.options[namespaceSelector.selectedIndex];
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 optionValue = optionInput ? optionInput.value : 0;
const optionTitle = option.querySelector('.option-title');
......
......@@ -2,7 +2,7 @@ import axios from 'axios';
import { sanitize } from '~/lib/dompurify';
import { __ } from '~/locale';
export const loadBranches = containerEl => {
export const loadBranches = (containerEl) => {
if (!containerEl) {
return;
}
......
......@@ -69,7 +69,7 @@ export default {
commitsSearchInput.addEventListener(
'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: {
......
......@@ -5,7 +5,7 @@ import store from './store';
Vue.use(Vuex);
export default el => {
export default (el) => {
if (!el) {
return null;
}
......
......@@ -26,7 +26,7 @@ export default {
},
})
.then(({ data }) => dispatch('receiveAuthorsSuccess', data))
.catch(error => {
.catch((error) => {
Sentry.captureException(error);
dispatch('receiveAuthorsError');
});
......
......@@ -83,11 +83,11 @@ export default {
return PANELS;
}
return PANELS.filter(p => p.name !== CI_CD_PANEL);
return PANELS.filter((p) => p.name !== CI_CD_PANEL);
},
activePanel() {
return PANELS.find(p => p.name === this.activeTab);
return PANELS.find((p) => p.name === this.activeTab);
},
breadcrumbs() {
......@@ -113,7 +113,7 @@ export default {
this.handleLocationHashChange();
this.resetProjectErrors();
});
this.$root.$on('clicked::link', e => {
this.$root.$on('clicked::link', (e) => {
window.location = e.target.href;
});
},
......
......@@ -252,7 +252,7 @@ export default {
},
get chartTitles() {
const today = dateFormat(new Date(), CHART_DATE_FORMAT);
const pastDate = timeScale =>
const pastDate = (timeScale) =>
dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT);
return {
lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), {
......
......@@ -98,7 +98,7 @@ export default {
},
get chartTitles() {
const today = dateFormat(new Date(), CHART_DATE_FORMAT);
const pastDate = timeScale =>
const pastDate = (timeScale) =>
dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT);
return {
lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), {
......
......@@ -10,7 +10,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
const mountPipelineChartsApp = el => {
const mountPipelineChartsApp = (el) => {
// Not all of the values will be defined since some them will be
// empty depending on the value of the graphql_pipeline_analytics
// feature flag, once the rollout of the feature flag is completed
......@@ -62,7 +62,7 @@ const mountPipelineChartsApp = el => {
provide: {
projectPath,
},
render: createElement => createElement(ProjectPipelinesCharts, {}),
render: (createElement) => createElement(ProjectPipelinesCharts, {}),
});
}
......@@ -72,7 +72,7 @@ const mountPipelineChartsApp = el => {
components: {
ProjectPipelinesChartsLegacy,
},
render: createElement =>
render: (createElement) =>
createElement(ProjectPipelinesChartsLegacy, {
props: {
counts: {
......
......@@ -39,7 +39,7 @@ const setProjectNamePathHandlers = ($projectNameInput, $projectPathInput) => {
});
};
const deriveProjectPathFromUrl = $projectImportUrl => {
const deriveProjectPathFromUrl = ($projectImportUrl) => {
const $currentProjectName = $projectImportUrl
.parents('.toggle-import-form')
.find('#project_name');
......@@ -89,7 +89,7 @@ const bindEvents = () => {
return;
}
$('.how_to_import_link').on('click', e => {
$('.how_to_import_link').on('click', (e) => {
e.preventDefault();
$(e.currentTarget).next('.modal').show();
});
......@@ -112,7 +112,7 @@ const bindEvents = () => {
$pushNewProjectTipTrigger
.removeAttr('rel')
.removeAttr('target')
.on('click', e => {
.on('click', (e) => {
e.preventDefault();
})
.popover({
......@@ -122,7 +122,7 @@ const bindEvents = () => {
content: $('.push-new-project-tip-template').html(),
})
.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) {
$pushNewProjectTipTrigger.trigger('click');
}
......
......@@ -46,7 +46,7 @@ export default {
this.isLoading = false;
this.isSharedRunnerEnabled = !this.isSharedRunnerEnabled;
})
.catch(error => {
.catch((error) => {
this.isLoading = false;
this.errorMessage = error.response?.data?.error || DEFAULT_ERROR_MESSAGE;
});
......
......@@ -110,7 +110,7 @@ export default {
this.updatedCustomEmail = data?.service_desk_address;
this.showAlert(__('Changes were successfully made.'), 'success');
})
.catch(err => {
.catch((err) => {
this.showAlert(
sprintf(__('An error occured while making the changes: %{error}'), {
error: err?.response?.data?.message,
......
......@@ -63,7 +63,7 @@ export default {
this.poll = new Poll({
resource: this.service,
method: 'fetchData',
successCallback: response => this.successCallback(response),
successCallback: (response) => this.successCallback(response),
errorCallback: this.errorCallback,
});
......
......@@ -61,7 +61,7 @@ export default {
resetKey() {
axios
.post(this.changeKeyUrl)
.then(res => {
.then((res) => {
this.authorizationKey = res.data.token;
})
.catch(() => {
......
......@@ -65,12 +65,12 @@ export default class CustomMetrics extends PrometheusMetrics {
// eslint-disable-next-line class-methods-use-this
setHidden(els) {
els.forEach(el => el.addClass('hidden'));
els.forEach((el) => el.addClass('hidden'));
}
setVisible(...els) {
this.setHidden(this.$els.filter(el => !els.includes(el)));
els.forEach(el => el.removeClass('hidden'));
this.setHidden(this.$els.filter((el) => !els.includes(el)));
els.forEach((el) => el.removeClass('hidden'));
}
showMonitoringCustomMetricsPanelState(stateName) {
......@@ -98,14 +98,14 @@ export default class CustomMetrics extends PrometheusMetrics {
}
populateCustomMetrics() {
const capitalizeGroup = metric => ({
const capitalizeGroup = (metric) => ({
...metric,
group: capitalizeFirstCharacter(metric.group),
});
const sortedMetrics = sortBy(this.customMetrics.map(capitalizeGroup), ['group', 'title']);
sortedMetrics.forEach(metric => {
sortedMetrics.forEach((metric) => {
this.$monitoredCustomMetricsList.append(CustomMetrics.customMetricTemplate(metric));
});
......@@ -145,7 +145,7 @@ export default class CustomMetrics extends PrometheusMetrics {
this.populateCustomMetrics(customMetrics.data.metrics);
}
})
.catch(customMetricError => {
.catch((customMetricError) => {
this.showFlashMessage(customMetricError);
this.showMonitoringCustomMetricsPanelState(PANEL_STATE.EMPTY);
});
......
......@@ -26,8 +26,8 @@ export default class PrometheusMetrics {
this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('activeMetrics');
this.helpMetricsPath = this.$monitoredMetricsPanel.data('metrics-help-path');
this.$panelToggleRight.on('click', e => this.handlePanelToggle(e));
this.$panelToggleDown.on('click', e => this.handlePanelToggle(e));
this.$panelToggleRight.on('click', (e) => this.handlePanelToggle(e));
this.$panelToggleDown.on('click', (e) => this.handlePanelToggle(e));
}
init() {
......@@ -72,7 +72,7 @@ export default class PrometheusMetrics {
let totalMissingEnvVarMetrics = 0;
let totalExporters = 0;
metrics.forEach(metric => {
metrics.forEach((metric) => {
if (metric.active_metrics > 0) {
totalExporters += 1;
this.$monitoredMetricsList.append(
......@@ -137,7 +137,7 @@ export default class PrometheusMetrics {
})
.catch(stop);
})
.then(res => {
.then((res) => {
if (res && res.data && res.data.length) {
this.populateActiveMetrics(res.data);
} else {
......
......@@ -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 selectedItems = this[`${accessLevel}_dropdown`].getSelectedItems();
const levelAttributes = [];
selectedItems.forEach(item => {
selectedItems.forEach((item) => {
if (item.type === LEVEL_TYPES.USER) {
levelAttributes.push({
user_id: item.user_id,
......
......@@ -108,7 +108,7 @@ export default class ProtectedBranchEdit {
.then(({ data }) => {
this.hasChanges = false;
Object.keys(ACCESS_LEVELS).forEach(level => {
Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevelName = ACCESS_LEVELS[level];
// The data coming from server will be the new persisted *state* for each dropdown
......@@ -125,7 +125,7 @@ export default class ProtectedBranchEdit {
}
setSelectedItemsToDropdown(items = [], dropdownName) {
const itemsToAdd = items.map(currentItem => {
const itemsToAdd = items.map((currentItem) => {
if (currentItem.user_id) {
// Do this only for users for now
// get the current data for selected items
......
......@@ -22,7 +22,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger')
if (!triggerEls) return;
triggerEls.forEach(triggerEl => {
triggerEls.forEach((triggerEl) => {
const targetEl = triggerEl.previousElementSibling;
if (!targetEl) {
......@@ -31,7 +31,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger')
triggerEl.addEventListener(
'click',
e => {
(e) => {
targetEl.classList.add('is-expanded');
e.target.remove();
},
......
......@@ -39,7 +39,7 @@ export default {
items: {
type: Array,
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 {
},
computed: {
...mapState({
matches: state => state.matches,
lastQuery: state => state.query,
selectedRef: state => state.selectedRef,
matches: (state) => state.matches,
lastQuery: (state) => state.query,
selectedRef: (state) => state.selectedRef,
}),
...mapGetters(['isLoading', 'isQueryPossiblyASha']),
i18n() {
......
......@@ -18,10 +18,10 @@ export const searchBranches = ({ commit, state }) => {
commit(types.REQUEST_START);
Api.branches(state.projectId, state.query)
.then(response => {
.then((response) => {
commit(types.RECEIVE_BRANCHES_SUCCESS, response);
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_BRANCHES_ERROR, error);
})
.finally(() => {
......@@ -33,10 +33,10 @@ export const searchTags = ({ commit, state }) => {
commit(types.REQUEST_START);
Api.tags(state.projectId, state.query)
.then(response => {
.then((response) => {
commit(types.RECEIVE_TAGS_SUCCESS, response);
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_TAGS_ERROR, error);
})
.finally(() => {
......@@ -50,10 +50,10 @@ export const searchCommits = ({ commit, state, getters }) => {
commit(types.REQUEST_START);
Api.commit(state.projectId, state.query)
.then(response => {
.then((response) => {
commit(types.RECEIVE_COMMITS_SUCCESS, response);
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_COMMITS_ERROR, error);
})
.finally(() => {
......
......@@ -23,7 +23,7 @@ export default {
[types.RECEIVE_BRANCHES_SUCCESS](state, response) {
state.matches.branches = {
list: convertObjectPropsToCamelCase(response.data).map(b => ({
list: convertObjectPropsToCamelCase(response.data).map((b) => ({
name: b.name,
default: b.default,
})),
......@@ -41,7 +41,7 @@ export default {
[types.RECEIVE_TAGS_SUCCESS](state, response) {
state.matches.tags = {
list: convertObjectPropsToCamelCase(response.data).map(b => ({
list: convertObjectPropsToCamelCase(response.data).map((b) => ({
name: b.name,
})),
totalCount: parseInt(response.headers[X_TOTAL_HEADER], 10),
......
......@@ -31,7 +31,7 @@ class RefSelectDropdown {
const $fieldInput = $(`input[name="${$dropdownButton.data('fieldName')}"]`, $dropdownContainer);
const $filterInput = $('input[type="search"]', $dropdownContainer);
$filterInput.on('keyup', e => {
$filterInput.on('keyup', (e) => {
const keyCode = e.keyCode || e.which;
if (keyCode !== 13) return;
......
......@@ -31,10 +31,10 @@ export default {
},
computed: {
hasSelectedItems() {
return this.tags.some(tag => this.selectedItems[tag.name]);
return this.tags.some((tag) => this.selectedItems[tag.name]);
},
showMultiDeleteButton() {
return this.tags.some(tag => tag.canDelete) && !this.isMobile;
return this.tags.some((tag) => tag.canDelete) && !this.isMobile;
},
},
methods: {
......
......@@ -14,10 +14,10 @@ export default {
},
computed: {
parsedCrumbs() {
return this.crumbs.map(c => ({ ...c, innerHTML: sanitize(c.innerHTML) }));
return this.crumbs.map((c) => ({ ...c, innerHTML: sanitize(c.innerHTML) }));
},
rootRoute() {
return this.$router.options.routes.find(r => r.meta.root);
return this.$router.options.routes.find((r) => r.meta.root);
},
isRootRoute() {
return this.$route.name === this.rootRoute.name;
......
......@@ -97,7 +97,7 @@ export default {
},
methods: {
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.$refs.deleteModal.show();
},
......@@ -111,7 +111,7 @@ export default {
mutation: deleteContainerRepositoryTagsMutation,
variables: {
id: this.queryVariables.id,
tagNames: itemsToBeDeleted.map(i => i.name),
tagNames: itemsToBeDeleted.map((i) => i.name),
},
awaitRefetchQueries: true,
refetchQueries: [
......
......@@ -33,7 +33,7 @@ export default {
projectPath: this.projectPath,
};
},
update: data => data.project?.containerExpirationPolicy,
update: (data) => data.project?.containerExpirationPolicy,
result({ data }) {
this.workingCopy = { ...get(data, 'project.containerExpirationPolicy', {}) };
},
......
......@@ -96,7 +96,7 @@ export default {
return this.isLoading || this.mutationLoading;
},
fieldsAreValid() {
return Object.values(this.localErrors).every(error => error);
return Object.values(this.localErrors).every((error) => error);
},
isSubmitButtonDisabled() {
return !this.fieldsAreValid || this.showLoadingIcon;
......@@ -121,7 +121,7 @@ export default {
},
methods: {
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() {
this.track('reset_form');
......@@ -131,7 +131,7 @@ export default {
},
setApiErrors(response) {
this.apiErrors = response.graphQLErrors.reduce((acc, curr) => {
curr.extensions.problems.forEach(item => {
curr.extensions.problems.forEach((item) => {
acc[item.path[0]] = item.message;
});
return acc;
......@@ -163,7 +163,7 @@ export default {
this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE, { type: 'success' });
}
})
.catch(error => {
.catch((error) => {
this.setApiErrors(error);
this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE, { type: 'error' });
})
......
import { produce } from 'immer';
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 = {
query: expirationPolicyQuery,
variables: { projectPath },
};
const sourceData = client.readQuery(queryAndParams);
const data = produce(sourceData, draftState => {
const data = produce(sourceData, (draftState) => {
// eslint-disable-next-line no-param-reassign
draftState.project.containerExpirationPolicy = {
...updatedData.updateContainerExpirationPolicy.containerExpirationPolicy,
......
import { n__ } from '~/locale';
import { KEEP_N_OPTIONS, CADENCE_OPTIONS, OLDER_THAN_OPTIONS } from './constants';
export const findDefaultOption = options => {
const item = options.find(o => o.default);
export const findDefaultOption = (options) => {
const item = options.find((o) => o.default);
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);
export const optionLabelGenerator = (collection, translationFn) =>
collection.map(option => ({
collection.map((option) => ({
...option,
label: translationFn(option.variable),
}));
......
......@@ -118,7 +118,7 @@ export default {
let position = 0;
const untouchedRawRefs = rawRefs
.filter(ref => {
.filter((ref) => {
let isTouched = false;
if (caretPos >= position && caretPos <= position + ref.length) {
......@@ -130,7 +130,7 @@ export default {
return !isTouched;
})
.filter(ref => ref.trim().length > 0);
.filter((ref) => ref.trim().length > 0);
this.$emit('addIssuableFormInput', {
newValue: value,
......@@ -208,7 +208,7 @@ export default {
:path-id-separator="pathIdSeparator"
event-namespace="pendingIssuable"
@pendingIssuableRemoveRequest="
params => {
(params) => {
$emit('pendingIssuableRemoveRequest', params);
}
"
......
......@@ -90,11 +90,11 @@ export default {
categorisedIssues() {
if (this.showCategorizedIssues) {
return Object.values(linkedIssueTypesMap)
.map(linkType => ({
.map((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 }];
......
......@@ -110,7 +110,7 @@ export default {
},
methods: {
findRelatedIssueById(id) {
return this.state.relatedIssues.find(issue => issue.id === id);
return this.state.relatedIssues.find((issue) => issue.id === id);
},
onRelatedIssueRemoveRequest(idToRemove) {
const issueToRemove = this.findRelatedIssueById(idToRemove);
......@@ -120,7 +120,7 @@ export default {
.then(({ data }) => {
this.store.setRelatedIssues(data.issuables);
})
.catch(res => {
.catch((res) => {
if (res && res.status !== 404) {
Flash(relatedIssuesRemoveErrorMap[this.issuableType]);
}
......@@ -219,7 +219,7 @@ export default {
this.processAllReferences(newValue);
},
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.inputValue = '';
......
......@@ -11,7 +11,7 @@ export default function initRelatedIssues() {
components: {
relatedIssuesRoot: RelatedIssuesRoot,
},
render: createElement =>
render: (createElement) =>
createElement('related-issues-root', {
props: {
endpoint: relatedIssuesRootElement.dataset.endpoint,
......
......@@ -19,7 +19,7 @@ class RelatedIssuesStore {
}
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) {
......
......@@ -15,7 +15,7 @@ export default function initRelatedMergeRequests() {
RelatedMergeRequests,
},
store: createStore(),
render: createElement =>
render: (createElement) =>
createElement('related-merge-requests', {
props: { endpoint, projectNamespace, projectPath },
}),
......
......@@ -21,7 +21,7 @@ export const fetchMergeRequests = ({ state, dispatch }) => {
return axios
.get(`${state.apiEndpoint}?per_page=${REQUEST_PAGE_COUNT}`)
.then(res => {
.then((res) => {
const { headers, data } = res;
const total = Number(normalizeHeaders(headers)['X-TOTAL']) || 0;
......
......@@ -47,7 +47,7 @@ export default {
sections() {
return [
{
links: get(this.assets, 'sources', []).map(s => ({
links: get(this.assets, 'sources', []).map((s) => ({
url: s.url,
name: sprintf(__('Source code (%{fileExtension})'), { fileExtension: s.format }),
})),
......@@ -73,7 +73,7 @@ export default {
links: this.otherLinks,
iconName: 'link',
},
].filter(section => section.links.length > 0);
].filter((section) => section.links.length > 0);
},
},
methods: {
......@@ -81,7 +81,7 @@ export default {
this.isAssetsExpanded = !this.isAssetsExpanded;
},
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'),
......
......@@ -64,7 +64,7 @@ export default {
},
issueCounts() {
return this.milestones
.map(m => m.issueStats || {})
.map((m) => m.issueStats || {})
.reduce(
(acc, current) => {
acc.total += current.total || 0;
......@@ -79,11 +79,11 @@ export default {
);
},
showMergeRequestStats() {
return this.milestones.some(m => m.mrStats);
return this.milestones.some((m) => m.mrStats);
},
mergeRequestCounts() {
return this.milestones
.map(m => m.mrStats || {})
.map((m) => m.mrStats || {})
.reduce(
(acc, current) => {
acc.total += current.total || 0;
......
......@@ -11,14 +11,14 @@ export default {
},
computed: {
...mapState('list', {
orderBy: state => state.sorting.orderBy,
sort: state => state.sorting.sort,
orderBy: (state) => state.sorting.orderBy,
sort: (state) => state.sorting.sort,
}),
sortOptions() {
return SORT_OPTIONS;
},
sortText() {
const option = this.sortOptions.find(s => s.orderBy === this.orderBy);
const option = this.sortOptions.find((s) => s.orderBy === this.orderBy);
return option.label;
},
isSortAscending() {
......
......@@ -18,6 +18,6 @@ export default () => {
return new Vue({
el,
store,
render: h => h(ReleaseEditNewApp),
render: (h) => h(ReleaseEditNewApp),
});
};
......@@ -21,6 +21,6 @@ export default () => {
graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats),
},
}),
render: h => h(ReleaseListApp),
render: (h) => h(ReleaseListApp),
});
};
......@@ -18,6 +18,6 @@ export default () => {
return new Vue({
el,
store,
render: h => h(ReleaseEditNewApp),
render: (h) => h(ReleaseEditNewApp),
});
};
......@@ -21,6 +21,6 @@ export default () => {
return new Vue({
el,
store,
render: h => h(ReleaseShowApp),
render: (h) => h(ReleaseShowApp),
});
};
......@@ -2,7 +2,7 @@
* @returns {Boolean} `true` if all the feature flags
* required to enable the GraphQL endpoint are enabled
*/
export const useGraphQLEndpoint = rootState => {
export const useGraphQLEndpoint = (rootState) => {
return Boolean(
rootState.featureFlags.graphqlReleaseData &&
rootState.featureFlags.graphqlReleasesPage &&
......
......@@ -36,12 +36,12 @@ export const fetchRelease = ({ commit, state, rootState }) => {
tagName: state.tagName,
},
})
.then(response => {
.then((response) => {
const { data: release } = convertOneReleaseGraphQLResponse(response);
commit(types.RECEIVE_RELEASE_SUCCESS, release);
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while getting the release details'));
});
......@@ -52,7 +52,7 @@ export const fetchRelease = ({ commit, state, rootState }) => {
.then(({ data }) => {
commit(types.RECEIVE_RELEASE_SUCCESS, apiJsonToRelease(data));
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while getting the release details'));
});
......@@ -121,7 +121,7 @@ export const createRelease = ({ commit, dispatch, state, getters }) => {
.then(({ data }) => {
dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(data));
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_SAVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while creating a new release'));
});
......@@ -163,7 +163,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
// Delete all links currently associated with this Release
return Promise.all(
getters.releaseLinksToDelete.map(l =>
getters.releaseLinksToDelete.map((l) =>
api.deleteReleaseLink(state.projectId, state.release.tagName, l.id),
),
);
......@@ -171,7 +171,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
.then(() => {
// Create a new link for each link in the form
return Promise.all(
apiJson.assets.links.map(l =>
apiJson.assets.links.map((l) =>
api.createReleaseLink(state.projectId, state.release.tagName, l),
),
);
......@@ -179,7 +179,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
.then(() => {
dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(updatedRelease));
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_SAVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while saving the release details'));
})
......
......@@ -5,7 +5,7 @@ import { hasContent } from '~/lib/utils/text_utility';
* @returns {Boolean} `true` if the app is editing an existing release.
* `false` if the app is creating a new release.
*/
export const isExistingRelease = state => {
export const isExistingRelease = (state) => {
return Boolean(state.tagName);
};
......@@ -15,19 +15,19 @@ export const isExistingRelease = state => {
* empty (or whitespace-only) values for both `url` and `name`.
* 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 */
export const releaseLinksToCreate = state => {
export const releaseLinksToCreate = (state) => {
if (!state.release) {
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 */
export const releaseLinksToDelete = state => {
export const releaseLinksToDelete = (state) => {
if (!state.originalRelease) {
return [];
}
......@@ -36,7 +36,7 @@ export const releaseLinksToDelete = state => {
};
/** Returns all validation errors on the release object */
export const validationErrors = state => {
export const validationErrors = (state) => {
const errors = {
assets: {
links: {},
......@@ -56,7 +56,7 @@ export const validationErrors = state => {
// This is used for detecting duplicate URLs.
const urlToLinksMap = new Map();
state.release.assets.links.forEach(link => {
state.release.assets.links.forEach((link) => {
errors.assets.links[link.id] = {};
// Only validate non-empty URLs
......@@ -81,7 +81,7 @@ export const validationErrors = state => {
// add a validation error for each link that shares this URL
const duplicates = urlToLinksMap.get(normalizedUrl);
duplicates.push(link);
duplicates.forEach(duplicateLink => {
duplicates.forEach((duplicateLink) => {
errors.assets.links[duplicateLink.id].isDuplicate = true;
});
} else {
......
......@@ -3,7 +3,7 @@ import * as getters from './getters';
import mutations from './mutations';
import createState from './state';
export default initialState => ({
export default (initialState) => ({
namespaced: true,
actions,
getters,
......
......@@ -3,7 +3,7 @@ import * as types from './mutation_types';
import { DEFAULT_ASSET_LINK_TYPE } from '../../../constants';
const findReleaseLink = (release, id) => {
return release.assets.links.find(l => l.id === id);
return release.assets.links.find((l) => l.id === id);
};
export default {
......@@ -93,6 +93,6 @@ export default {
},
[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 = (
...paginationParams,
},
})
.then(response => {
.then((response) => {
const { data, paginationInfo: graphQlPageInfo } = convertAllReleasesGraphQLResponse(response);
commit(types.RECEIVE_RELEASES_SUCCESS, {
......
......@@ -2,7 +2,7 @@ import createState from './state';
import * as actions from './actions';
import mutations from './mutations';
export default initialState => ({
export default (initialState) => ({
namespaced: true,
actions,
mutations,
......
......@@ -17,7 +17,7 @@ export const releaseToApiJson = (release, createFrom = null) => {
// Milestones may be either a list of milestone objects OR just a list
// 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(
{
......@@ -37,7 +37,7 @@ export const releaseToApiJson = (release, createFrom = null) => {
* into the structure this Vue application can work with.
* @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 });
release.milestones = release.milestones || [];
......@@ -47,7 +47,7 @@ export const apiJsonToRelease = json => {
export const gqClient = createGqClient({}, { fetchPolicy: fetchPolicies.NO_CACHE });
const convertScalarProperties = graphQLRelease =>
const convertScalarProperties = (graphQLRelease) =>
pick(graphQLRelease, [
'name',
'tagName',
......@@ -57,29 +57,29 @@ const convertScalarProperties = graphQLRelease =>
'upcomingRelease',
]);
const convertAssets = graphQLRelease => ({
const convertAssets = (graphQLRelease) => ({
assets: {
count: graphQLRelease.assets.count,
sources: [...graphQLRelease.assets.sources.nodes],
links: graphQLRelease.assets.links.nodes.map(l => ({
links: graphQLRelease.assets.links.nodes.map((l) => ({
...l,
linkType: l.linkType?.toLowerCase(),
})),
},
});
const convertEvidences = graphQLRelease => ({
evidences: graphQLRelease.evidences.nodes.map(e => e),
const convertEvidences = (graphQLRelease) => ({
evidences: graphQLRelease.evidences.nodes.map((e) => e),
});
const convertLinks = graphQLRelease => ({
const convertLinks = (graphQLRelease) => ({
_links: {
...graphQLRelease.links,
self: graphQLRelease.links?.selfUrl,
},
});
const convertCommit = graphQLRelease => {
const convertCommit = (graphQLRelease) => {
if (!graphQLRelease.commit) {
return {};
}
......@@ -93,10 +93,10 @@ const convertCommit = graphQLRelease => {
};
};
const convertAuthor = graphQLRelease => ({ author: graphQLRelease.author });
const convertAuthor = (graphQLRelease) => ({ author: graphQLRelease.author });
const convertMilestones = graphQLRelease => ({
milestones: graphQLRelease.milestones.nodes.map(m => ({
const convertMilestones = (graphQLRelease) => ({
milestones: graphQLRelease.milestones.nodes.map((m) => ({
...m,
webUrl: m.webPath,
webPath: undefined,
......@@ -115,7 +115,7 @@ const convertMilestones = graphQLRelease => ({
*
* @param graphQLRelease The release object returned from a GraphQL query
*/
export const convertGraphQLRelease = graphQLRelease => ({
export const convertGraphQLRelease = (graphQLRelease) => ({
...convertScalarProperties(graphQLRelease),
...convertAssets(graphQLRelease),
...convertEvidences(graphQLRelease),
......@@ -134,7 +134,7 @@ export const convertGraphQLRelease = graphQLRelease => ({
*
* @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 paginationInfo = {
......@@ -153,7 +153,7 @@ export const convertAllReleasesGraphQLResponse = response => {
*
* @param response The response received from the GraphQL endpoint
*/
export const convertOneReleaseGraphQLResponse = response => {
export const convertOneReleaseGraphQLResponse = (response) => {
const release = convertGraphQLRelease(response.data.project.release);
return { data: release };
......
import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../../constants';
import { s__, n__ } from '~/locale';
export const groupedSummaryText = state => {
export const groupedSummaryText = (state) => {
if (state.isLoading) {
return s__('Reports|Accessibility scanning results are being parsed');
}
......@@ -22,7 +22,7 @@ export const groupedSummaryText = state => {
);
};
export const summaryStatus = state => {
export const summaryStatus = (state) => {
if (state.isLoading) {
return LOADING;
}
......@@ -34,12 +34,12 @@ export const summaryStatus = state => {
return SUCCESS;
};
export const shouldRenderIssuesList = state =>
Object.values(state.report).some(x => Array.isArray(x) && x.length > 0);
export const shouldRenderIssuesList = (state) =>
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
// to add notes and warnings to these issue lists, so I'm going to
// keep these as getters
export const unresolvedIssues = state => state.report.existing_errors;
export const resolvedIssues = state => state.report.resolved_errors;
export const newIssues = state => state.report.new_errors;
export const unresolvedIssues = (state) => state.report.existing_errors;
export const resolvedIssues = (state) => state.report.resolved_errors;
export const newIssues = (state) => state.report.new_errors;
......@@ -7,11 +7,11 @@ import state from './state';
Vue.use(Vuex);
export const getStoreConfig = initialState => ({
export const getStoreConfig = (initialState) => ({
actions,
getters,
mutations,
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 }) => {
return dispatch('receiveReportsError');
}
return Promise.all([axios.get(state.headPath), axios.get(state.basePath)])
.then(results =>
.then((results) =>
doCodeClimateComparison(
parseCodeclimateMetrics(results[0].data, state.headBlobPath),
parseCodeclimateMetrics(results[1].data, state.baseBlobPath),
),
)
.then(data => dispatch('receiveReportsSuccess', data))
.then((data) => dispatch('receiveReportsSuccess', data))
.catch(() => dispatch('receiveReportsError'));
};
......
......@@ -2,10 +2,10 @@ import { LOADING, ERROR, SUCCESS } from '../../constants';
import { sprintf, __, s__, n__ } from '~/locale';
import { spriteIcon } from '~/lib/utils/common_utils';
export const hasCodequalityIssues = state =>
export const hasCodequalityIssues = (state) =>
Boolean(state.newIssues?.length || state.resolvedIssues?.length);
export const codequalityStatus = state => {
export const codequalityStatus = (state) => {
if (state.isLoading) {
return LOADING;
}
......@@ -16,7 +16,7 @@ export const codequalityStatus = state => {
return SUCCESS;
};
export const codequalityText = state => {
export const codequalityText = (state) => {
const { newIssues, resolvedIssues } = state;
const text = [];
......@@ -41,7 +41,7 @@ export const codequalityText = state => {
return text.join('');
};
export const codequalityPopover = state => {
export const codequalityPopover = (state) => {
if (state.headPath && !state.basePath) {
return {
title: s__('ciReport|Base pipeline codequality artifact not found'),
......
......@@ -7,11 +7,11 @@ import state from './state';
Vue.use(Vuex);
export const getStoreConfig = initialState => ({
export const getStoreConfig = (initialState) => ({
actions,
getters,
mutations,
state: state(initialState),
});
export default initialState => new Vuex.Store(getStoreConfig(initialState));
export default (initialState) => new Vuex.Store(getStoreConfig(initialState));
import CodeQualityComparisonWorker from '../../workers/codequality_comparison_worker';
export const parseCodeclimateMetrics = (issues = [], path = '') => {
return issues.map(issue => {
return issues.map((issue) => {
const parsedIssue = {
...issue,
name: issue.description,
......
......@@ -3,7 +3,7 @@ import { differenceBy } from 'lodash';
const KEY_TO_FILTER_BY = 'fingerprint';
// eslint-disable-next-line no-restricted-globals
self.addEventListener('message', e => {
self.addEventListener('message', (e) => {
const { data } = e;
if (data === undefined) {
......
......@@ -41,7 +41,7 @@ export default {
computed: {
groups() {
return this.$options.groups
.map(group => ({
.map((group) => ({
name: group,
issues: this[`${group}Issues`],
heading: this[`${group}Heading`],
......
......@@ -44,8 +44,8 @@ export default {
computed: {
...mapState(['reports', 'isLoading', 'hasError', 'summary']),
...mapState({
modalTitle: state => state.modal.title || '',
modalData: state => state.modal.data || {},
modalTitle: (state) => state.modal.title || '',
modalData: (state) => state.modal.data || {},
}),
...mapGetters(['summaryStatus']),
groupedSummaryText() {
......
......@@ -3,7 +3,7 @@ import ReportItem from '~/reports/components/report_item.vue';
import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constants';
import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue';
const wrapIssueWithState = (status, isNew = false) => issue => ({
const wrapIssueWithState = (status, isNew = false) => (issue) => ({
status: issue.status || status,
isNew,
issue,
......
......@@ -17,7 +17,7 @@ export default {
type: String,
required: false,
default: '',
validator: value => value === '' || Object.values(componentNames).includes(value),
validator: (value) => value === '' || Object.values(componentNames).includes(value),
},
// failed || success
status: {
......
import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../constants';
export const summaryStatus = state => {
export const summaryStatus = (state) => {
if (state.isLoading) {
return LOADING;
}
......
......@@ -9,7 +9,7 @@ export default {
state.isLoading = true;
},
[types.RECEIVE_REPORTS_SUCCESS](state, response) {
state.hasError = response.suites.some(suite => suite.status === 'error');
state.hasError = response.suites.some((suite) => suite.status === 'error');
state.isLoading = false;
......@@ -44,7 +44,7 @@ export default {
[types.SET_ISSUE_MODAL_DATA](state, payload) {
state.modal.title = payload.issue.name;
Object.keys(payload.issue).forEach(key => {
Object.keys(payload.issue).forEach((key) => {
if (Object.prototype.hasOwnProperty.call(state.modal.data, key)) {
state.modal.data[key] = {
...state.modal.data[key],
......
......@@ -7,7 +7,7 @@ import {
ICON_NOTFOUND,
} from '../constants';
const textBuilder = results => {
const textBuilder = (results) => {
const { failed, errored, resolved, total } = results;
const failedOrErrored = (failed || 0) + (errored || 0);
......@@ -70,18 +70,18 @@ export const recentFailuresTextBuilder = (summary = {}) => {
);
};
export const countRecentlyFailedTests = subject => {
export const countRecentlyFailedTests = (subject) => {
// handle either a single report or an array of reports
const reports = !subject.length ? [subject] : subject;
return reports
.map(report => {
.map((report) => {
return (
[report.new_failures, report.existing_failures, report.resolved_failures]
// only count tests which have failed more than once
.map(
failureArray =>
failureArray.filter(failure => failure.recent_failures?.count > 1).length,
(failureArray) =>
failureArray.filter((failure) => failure.recent_failures?.count > 1).length,
)
.reduce((total, count) => total + count, 0)
);
......@@ -89,7 +89,7 @@ export const countRecentlyFailedTests = subject => {
.reduce((total, count) => total + count, 0);
};
export const statusIcon = status => {
export const statusIcon = (status) => {
if (status === STATUS_FAILED) {
return ICON_WARNING;
}
......
......@@ -40,7 +40,7 @@ export default {
projectPath: this.projectPath,
};
},
update: data => data.project?.userPermissions,
update: (data) => data.project?.userPermissions,
error(error) {
throw error;
},
......@@ -105,7 +105,7 @@ export default {
pathLinks() {
return this.currentPath
.split('/')
.filter(p => p !== '')
.filter((p) => p !== '')
.reduce(
(acc, name, i) => {
const path = joinPaths(i > 0 ? acc[i].path : '', escapeFileUrl(name));
......
......@@ -18,7 +18,7 @@ export default {
},
computed: {
normalizedLinks() {
return this.links.map(link => ({
return this.links.map((link) => ({
text: link.text,
path: `${link.path}?path=${this.currentPath}`,
}));
......
......@@ -39,7 +39,7 @@ export default {
path: this.currentPath.replace(/^\//, ''),
};
},
update: data => {
update: (data) => {
const pipelines = data.project?.repository?.tree?.lastCommit?.pipelines?.edges;
return {
......
......@@ -25,7 +25,7 @@ export default {
const splitArray = this.path.split('/');
splitArray.pop();
return splitArray.map(p => encodeURIComponent(p)).join('/');
return splitArray.map((p) => encodeURIComponent(p)).join('/');
},
parentRoute() {
return { path: `/-/tree/${this.commitRef}/${this.parentPath}` };
......
......@@ -113,7 +113,7 @@ export default {
}
}
})
.catch(error => {
.catch((error) => {
createFlash(__('An error occurred while fetching folder content.'));
throw error;
});
......
......@@ -18,7 +18,7 @@ const defaultClient = createDefaultClient(
{
Query: {
commit(_, { path, fileName, type }) {
return new Promise(resolve => {
return new Promise((resolve) => {
fetchLogsTree(defaultClient, path, '0', {
resolve,
entry: {
......@@ -38,7 +38,7 @@ const defaultClient = createDefaultClient(
{
cacheConfig: {
fragmentMatcher,
dataIdFromObject: obj => {
dataIdFromObject: (obj) => {
/* eslint-disable @gitlab/require-i18n-strings */
// eslint-disable-next-line no-underscore-dangle
switch (obj.__typename) {
......
......@@ -10,7 +10,7 @@ Vue.use(VueRouter);
export default function createRouter(base, baseRef) {
const treePathRoute = {
component: TreePage,
props: route => ({
props: (route) => ({
path: route.params.path?.replace(/^\//, '') || '/',
}),
};
......
export function normalizeData(data, path, extra = () => {}) {
return data.map(d => ({
return data.map((d) => ({
sha: d.commit.id,
message: d.commit.message,
titleHtml: d.commit_title_html,
......
......@@ -18,14 +18,14 @@ const MARKUP_EXTENSIONS = [
'wiki',
];
const isRichReadme = file => {
const isRichReadme = (file) => {
const re = new RegExp(`^(${FILENAMES.join('|')})\\.(${MARKUP_EXTENSIONS.join('|')})$`, 'i');
return re.test(file.name);
};
const isPlainReadme = file => {
const isPlainReadme = (file) => {
const re = new RegExp(`^(${FILENAMES.join('|')})(\\.txt)?$`, 'i');
return re.test(file.name);
};
export const readmeFile = blobs => blobs.find(isRichReadme) || blobs.find(isPlainReadme);
export const readmeFile = (blobs) => blobs.find(isRichReadme) || blobs.find(isPlainReadme);
......@@ -4,9 +4,9 @@ export default () => {
const searchTerm = contentBody.querySelector('.js-search-input').value.toLowerCase();
const blobs = contentBody.querySelectorAll('.blob-result');
blobs.forEach(blob => {
blobs.forEach((blob) => {
const lines = blob.querySelectorAll('.line');
lines.forEach(line => {
lines.forEach((line) => {
if (line.textContent.toLowerCase().includes(searchTerm)) {
line.classList.add(highlightLineClass);
}
......
......@@ -4,7 +4,7 @@ import GlobalSearchSidebar from './components/app.vue';
Vue.use(Translate);
export const initSidebar = store => {
export const initSidebar = (store) => {
const el = document.getElementById('js-search-sidebar');
if (!el) return false;
......
......@@ -7,7 +7,7 @@ import * as types from './mutation_types';
export const fetchGroups = ({ commit }, search) => {
commit(types.REQUEST_GROUPS);
Api.groups(search)
.then(data => {
.then((data) => {
commit(types.RECEIVE_GROUPS_SUCCESS, data);
})
.catch(() => {
......@@ -19,7 +19,7 @@ export const fetchGroups = ({ commit }, search) => {
export const fetchProjects = ({ commit, state }, search) => {
commit(types.REQUEST_PROJECTS);
const groupId = state.query?.group_id;
const callback = data => {
const callback = (data) => {
if (data) {
commit(types.RECEIVE_PROJECTS_SUCCESS, data);
} else {
......
......@@ -12,5 +12,5 @@ export const getStoreConfig = ({ query }) => ({
state: createState({ query }),
});
const createStore = config => new Vuex.Store(getStoreConfig(config));
const createStore = (config) => new Vuex.Store(getStoreConfig(config));
export default createStore;
......@@ -40,5 +40,5 @@ const searchableDropdowns = [
},
];
export const initTopbar = store =>
searchableDropdowns.map(dropdown => mountSearchableDropdown(store, dropdown));
export const initTopbar = (store) =>
searchableDropdowns.map((dropdown) => mountSearchableDropdown(store, dropdown));
......@@ -172,7 +172,7 @@ export class SearchAutocomplete {
term,
},
})
.then(response => {
.then((response) => {
const options = this.scopedSearchOptions(term);
// List results
......@@ -345,7 +345,7 @@ export class SearchAutocomplete {
this.clearInput.on('click', this.onClearInputClick);
this.dropdownContent.on('scroll', throttle(this.setScrollFade, 250));
this.searchInput.on('click', e => {
this.searchInput.on('click', (e) => {
e.stopPropagation();
});
}
......
......@@ -9,7 +9,7 @@ const TWO_MINUTES = 120000;
function backOffRequest(makeRequestCallback) {
return backOff((next, stop) => {
makeRequestCallback()
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.ACCEPTED) {
next();
} else {
......@@ -30,24 +30,24 @@ export const requestCreateProject = ({ dispatch, state, commit }) => {
commit(types.SET_LOADING, true);
axios
.post(state.createProjectEndpoint)
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.ACCEPTED) {
dispatch('requestCreateProjectStatus', resp.data.job_id);
}
})
.catch(error => {
.catch((error) => {
dispatch('requestCreateProjectError', error);
});
};
export const requestCreateProjectStatus = ({ dispatch, state }, jobId) => {
backOffRequest(() => axios.get(state.createProjectStatusEndpoint, { params: { job_id: jobId } }))
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.OK) {
dispatch('requestCreateProjectSuccess', resp.data);
}
})
.catch(error => {
.catch((error) => {
dispatch('requestCreateProjectError', error);
});
};
......@@ -82,24 +82,24 @@ export const requestDeleteProject = ({ dispatch, state, commit }) => {
commit(types.SET_LOADING, true);
axios
.delete(state.deleteProjectEndpoint)
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.ACCEPTED) {
dispatch('requestDeleteProjectStatus', resp.data.job_id);
}
})
.catch(error => {
.catch((error) => {
dispatch('requestDeleteProjectError', error);
});
};
export const requestDeleteProjectStatus = ({ dispatch, state }, jobId) => {
backOffRequest(() => axios.get(state.deleteProjectStatusEndpoint, { params: { job_id: jobId } }))
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.OK) {
dispatch('requestDeleteProjectSuccess', resp.data);
}
})
.catch(error => {
.catch((error) => {
dispatch('requestDeleteProjectError', error);
});
};
......
......@@ -6,7 +6,7 @@ import mutations from './mutations';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
modules: {
selfMonitoring: {
......
......@@ -13,7 +13,7 @@ export default function initSentryErrorStacktrace() {
SentryErrorStackTrace,
},
store,
render: createElement =>
render: (createElement) =>
createElement('sentry-error-stack-trace', {
props: { issueStackTracePath },
}),
......
......@@ -39,13 +39,13 @@ export default {
}, {});
},
extractTimeData() {
return this.chartData.requests.map(data => data.time);
return this.chartData.requests.map((data) => data.time);
},
generateSeries() {
return {
name: __('Invocations'),
type: 'line',
data: this.chartData.requests.map(data => [data.time, data.value]),
data: this.chartData.requests.map((data) => [data.time, data.value]),
symbolSize: 0,
};
},
......@@ -69,7 +69,7 @@ export default {
name: 'time',
type: 'time',
axisLabel: {
formatter: date => dateFormat(date, 'h:MM TT'),
formatter: (date) => dateFormat(date, 'h:MM TT'),
},
data: this.extractTimeData,
nameTextStyle: {
......@@ -90,7 +90,7 @@ export default {
};
},
xAxisLabel() {
return this.graphData.queries.map(query => query.label).join(', ');
return this.graphData.queries.map((query) => query.label).join(', ');
},
yAxisLabel() {
const [query] = this.graphData.queries;
......
......@@ -30,7 +30,7 @@ export const receiveMetricsError = ({ commit }, error) =>
export const fetchFunctions = ({ dispatch }, { functionsPath }) => {
let retryCount = 0;
const functionsPartiallyFetched = data => {
const functionsPartiallyFetched = (data) => {
if (data.functions !== null && data.functions.length) {
dispatch('receiveFunctionsPartial', data);
}
......@@ -41,7 +41,7 @@ export const fetchFunctions = ({ dispatch }, { functionsPath }) => {
backOff((next, stop) => {
axios
.get(functionsPath)
.then(response => {
.then((response) => {
if (response.data.knative_installed === CHECKING_INSTALLED) {
retryCount += 1;
if (retryCount < MAX_REQUESTS) {
......@@ -56,7 +56,7 @@ export const fetchFunctions = ({ dispatch }, { functionsPath }) => {
})
.catch(stop);
})
.then(data => {
.then((data) => {
if (data === TIMEOUT) {
dispatch('receiveFunctionsTimeout');
createFlash(__('Loading functions timed out. Please reload the page to try again.'));
......@@ -66,7 +66,7 @@ export const fetchFunctions = ({ dispatch }, { functionsPath }) => {
dispatch('receiveFunctionsNoDataSuccess', data);
}
})
.catch(error => {
.catch((error) => {
dispatch('receiveFunctionsError', error);
createFlash(error);
});
......@@ -83,7 +83,7 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => {
backOff((next, stop) => {
axios
.get(metricsPath)
.then(response => {
.then((response) => {
if (response.status === statusCodes.NO_CONTENT) {
retryCount += 1;
if (retryCount < MAX_REQUESTS) {
......@@ -98,15 +98,15 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => {
})
.catch(stop);
})
.then(data => {
.then((data) => {
if (data === null) {
return;
}
const updatedMetric = data.metrics;
const queries = data.metrics.queries.map(query => ({
const queries = data.metrics.queries.map((query) => ({
...query,
result: query.result.map(result => ({
result: query.result.map((result) => ({
...result,
values: result.values.map(([timestamp, value]) => ({
time: new Date(timestamp * 1000).toISOString(),
......@@ -118,7 +118,7 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => {
updatedMetric.queries = queries;
dispatch('receiveMetricsSuccess', updatedMetric);
})
.catch(error => {
.catch((error) => {
dispatch('receiveMetricsError', error);
createFlash(error);
});
......
import { translate } from '../utils';
export const hasPrometheusMissingData = state => state.hasPrometheus && !state.hasPrometheusData;
export const hasPrometheusMissingData = (state) => state.hasPrometheus && !state.hasPrometheusData;
// Convert the function list into a k/v grouping based on the environment scope
export const getFunctions = state => translate(state.functions);
export const getFunctions = (state) => translate(state.functions);
// Validate that the object coming in has valid query details and results
export const validateGraphData = data =>
export const validateGraphData = (data) =>
data.queries &&
Array.isArray(data.queries) &&
data.queries.filter(query => {
data.queries.filter((query) => {
if (Array.isArray(query.result)) {
return query.result.filter(res => Array.isArray(res.values)).length === query.result.length;
return query.result.filter((res) => Array.isArray(res.values)).length === query.result.length;
}
return false;
}).length === data.queries.length;
export const translate = functions =>
export const translate = (functions) =>
functions.reduce(
(acc, func) =>
Object.assign(acc, {
......
......@@ -3,7 +3,7 @@ export const AVAILABILITY_STATUS = {
NOT_SET: 'not_set',
};
export const isUserBusy = status => status === AVAILABILITY_STATUS.BUSY;
export const isUserBusy = (status) => status === AVAILABILITY_STATUS.BUSY;
export const isValidAvailibility = availability =>
export const isValidAvailibility = (availability) =>
availability.length ? Object.values(AVAILABILITY_STATUS).includes(availability) : true;
......@@ -34,8 +34,8 @@ export default {
return !this.users.length;
},
sortedAssigness() {
const canMergeUsers = this.users.filter(user => user.can_merge);
const canNotMergeUsers = this.users.filter(user => !user.can_merge);
const canMergeUsers = this.users.filter((user) => user.can_merge);
const canNotMergeUsers = this.users.filter((user) => !user.can_merge);
return [...canMergeUsers, ...canNotMergeUsers];
},
......
......@@ -59,7 +59,7 @@ export default {
handleFetchResult({ data }) {
const { nodes } = data.project.issue.assignees;
const assignees = nodes.map(n => ({
const assignees = nodes.map((n) => ({
...n,
avatar_url: n.avatarUrl,
id: getIdFromGraphQLId(n.id),
......
......@@ -39,7 +39,7 @@ export default {
return this.users.length > 2;
},
allAssigneesCanMerge() {
return this.users.every(user => user.can_merge);
return this.users.every((user) => user.can_merge);
},
sidebarAvatarCounter() {
if (this.users.length > DEFAULT_MAX_COUNTER) {
......@@ -58,7 +58,7 @@ export default {
return '';
}
const mergeLength = this.users.filter(u => u.can_merge).length;
const mergeLength = this.users.filter((u) => u.can_merge).length;
if (mergeLength === this.users.length) {
return '';
......@@ -74,7 +74,7 @@ export default {
tooltipTitle() {
const maxRender = Math.min(DEFAULT_RENDER_COUNT, this.users.length);
const renderUsers = this.users.slice(0, maxRender);
const names = renderUsers.map(u => u.name);
const names = renderUsers.map((u) => u.name);
if (!this.users.length) {
return __('Assignee(s)');
......
......@@ -48,7 +48,7 @@ export default {
.then(() => {
eventHub.$emit('updateIssuableConfidentiality', confidential);
})
.catch(err => {
.catch((err) => {
Flash(
err || __('Something went wrong trying to change the confidentiality of this issue'),
);
......
......@@ -33,7 +33,7 @@ export default {
return this.users.length > 2;
},
allReviewersCanMerge() {
return this.users.every(user => user.can_merge);
return this.users.every((user) => user.can_merge);
},
sidebarAvatarCounter() {
if (this.users.length > DEFAULT_MAX_COUNTER) {
......@@ -48,7 +48,7 @@ export default {
return this.users.slice(0, collapsedLength);
},
tooltipTitleMergeStatus() {
const mergeLength = this.users.filter(u => u.can_merge).length;
const mergeLength = this.users.filter((u) => u.can_merge).length;
if (mergeLength === this.users.length) {
return '';
......@@ -64,7 +64,7 @@ export default {
tooltipTitle() {
const maxRender = Math.min(DEFAULT_RENDER_COUNT, this.users.length);
const renderUsers = this.users.slice(0, maxRender);
const names = renderUsers.map(u => u.name);
const names = renderUsers.map((u) => u.name);
if (!this.users.length) {
return __('Reviewer(s)');
......
......@@ -36,8 +36,8 @@ export default {
return !this.users.length;
},
sortedReviewers() {
const canMergeUsers = this.users.filter(user => user.can_merge);
const canNotMergeUsers = this.users.filter(user => !user.can_merge);
const canMergeUsers = this.users.filter((user) => user.can_merge);
const canNotMergeUsers = this.users.filter((user) => !user.can_merge);
return [...canMergeUsers, ...canNotMergeUsers];
},
......
......@@ -41,7 +41,7 @@ export default {
type: String,
required: false,
default: ISSUABLE_TYPES.INCIDENT,
validator: value => {
validator: (value) => {
// currently severity is supported only for incidents, but this list might be extended
return [ISSUABLE_TYPES.INCIDENT].includes(value);
},
......@@ -67,7 +67,7 @@ export default {
return this.isDropdownShowing ? 'show' : 'gl-display-none';
},
selectedItem() {
return this.severitiesList.find(severity => severity.value === this.severity);
return this.severitiesList.find((severity) => severity.value === this.severity);
},
},
mounted() {
......@@ -106,7 +106,7 @@ export default {
projectPath: this.projectPath,
},
})
.then(resp => {
.then((resp) => {
const {
data: {
issueSetSeverity: {
......
......@@ -27,7 +27,7 @@ export default {
listenForQuickActions() {
$(document).on('ajax:success', '.gfm-form', this.quickActionListened);
eventHub.$on('timeTrackingUpdated', data => {
eventHub.$on('timeTrackingUpdated', (data) => {
this.quickActionListened({ detail: [data] });
});
},
......
......@@ -46,14 +46,14 @@ class SidebarMoveIssue {
() => new window.Flash(__('An error occurred while fetching projects autocomplete.')),
);
},
renderRow: project => `
renderRow: (project) => `
<li>
<a href="#" class="js-move-issue-dropdown-item">
${escape(project.name_with_namespace)}
</a>
</li>
`,
clicked: options => {
clicked: (options) => {
const project = options.selectedObj;
const selectedProjectId = options.isMarking ? project.id : 0;
this.mediator.setMoveToProjectId(selectedProjectId);
......
......@@ -16,7 +16,7 @@ export default class SidebarMilestone {
components: {
timeTracker,
},
render: createElement =>
render: (createElement) =>
createElement('timeTracker', {
props: {
timeEstimate: parseInt(timeEstimate, 10),
......
......@@ -40,7 +40,7 @@ function mountAssigneesComponent(mediator) {
components: {
SidebarAssignees,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-assignees', {
props: {
mediator,
......@@ -70,7 +70,7 @@ function mountReviewersComponent(mediator) {
components: {
SidebarReviewers,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-reviewers', {
props: {
mediator,
......@@ -105,7 +105,7 @@ export function mountSidebarLabels() {
allowScopedLabels: parseBoolean(el.dataset.allowScopedLabels),
initiallySelectedLabels: JSON.parse(el.dataset.selectedLabels),
},
render: createElement => createElement(SidebarLabels),
render: (createElement) => createElement(SidebarLabels),
});
}
......@@ -128,7 +128,7 @@ function mountConfidentialComponent(mediator) {
components: {
ConfidentialIssueSidebar,
},
render: createElement =>
render: (createElement) =>
createElement('confidential-issue-sidebar', {
props: {
iid: String(iid),
......@@ -163,20 +163,20 @@ function mountLockComponent() {
);
} else {
importStore = import(/* webpackChunkName: 'mrNotesStore' */ '~/mr_notes/stores').then(
store => store.default,
(store) => store.default,
);
}
importStore
.then(
store =>
(store) =>
new Vue({
el,
store,
provide: {
fullPath,
},
render: createElement =>
render: (createElement) =>
createElement(IssuableLockForm, {
props: {
isEditable: initialData.is_editable,
......@@ -200,7 +200,7 @@ function mountParticipantsComponent(mediator) {
components: {
sidebarParticipants,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-participants', {
props: {
mediator,
......@@ -220,7 +220,7 @@ function mountSubscriptionsComponent(mediator) {
components: {
sidebarSubscriptions,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-subscriptions', {
props: {
mediator,
......@@ -240,7 +240,7 @@ function mountTimeTrackingComponent() {
components: {
SidebarTimeTracking,
},
render: createElement => createElement('sidebar-time-tracking', {}),
render: (createElement) => createElement('sidebar-time-tracking', {}),
});
}
......@@ -262,7 +262,7 @@ function mountSeverityComponent() {
components: {
SidebarSeverity,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-severity', {
props: {
projectPath: fullPath,
......
......@@ -30,7 +30,7 @@ export default class SidebarMediator {
}
saveAssignees(field) {
const selected = this.store.assignees.map(u => u.id);
const selected = this.store.assignees.map((u) => u.id);
// If there are no ids, that means we have to unassign (which is id = 0)
// And it only accepts an array, hence [0]
......@@ -41,7 +41,7 @@ export default class SidebarMediator {
}
saveReviewers(field) {
const selected = this.store.reviewers.map(u => u.id);
const selected = this.store.reviewers.map((u) => u.id);
// If there are no ids, that means we have to unassign (which is id = 0)
// And it only accepts an array, hence [0]
......@@ -80,7 +80,7 @@ export default class SidebarMediator {
this.store.setSubscribedState(!this.store.subscribed);
this.store.setFetchingState('subscriptions', false);
})
.catch(err => {
.catch((err) => {
this.store.setFetchingState('subscriptions', false);
throw err;
});
......
export const toLabelGid = id => `gid://gitlab/Label/${id}`;
export const toLabelGid = (id) => `gid://gitlab/Label/${id}`;
......@@ -39,7 +39,7 @@ export default class SingleFileDiff {
this.$chevronDownIcon.removeClass('gl-display-none');
}
$('.js-file-title, .click-to-expand', this.file).on('click', e => {
$('.js-file-title, .click-to-expand', this.file).on('click', (e) => {
this.toggleDiff($(e.target));
});
}
......
......@@ -119,7 +119,7 @@ export default class SmartInterval {
.then(() => {
this.isLoading = false;
})
.catch(err => {
.catch((err) => {
this.isLoading = false;
throw err;
});
......
const hide = el => el.classList.add('d-none');
const show = el => el.classList.remove('d-none');
const hide = (el) => el.classList.add('d-none');
const show = (el) => el.classList.remove('d-none');
const setupCollapsibleInput = el => {
const setupCollapsibleInput = (el) => {
const collapsedEl = el.querySelector('.js-collapsed');
const expandedEl = el.querySelector('.js-expanded');
const collapsedInputEl = collapsedEl.querySelector('textarea,input,select');
......@@ -21,7 +21,7 @@ const setupCollapsibleInput = el => {
// NOTE:
// We add focus listener to all form inputs so that we can collapse
// when something is focused that's not the expanded input.
formEl.addEventListener('focusin', e => {
formEl.addEventListener('focusin', (e) => {
if (e.target === collapsedInputEl) {
expand();
expandedInputEl.focus();
......
......@@ -73,7 +73,7 @@ export default {
return this.actions.length > 0;
},
hasValidBlobs() {
return this.actions.every(x => x.content);
return this.actions.every((x) => x.content);
},
updatePrevented() {
return this.snippet.title === '' || !this.hasValidBlobs || this.isUpdating;
......@@ -130,7 +130,7 @@ export default {
},
getAttachedFiles() {
const fileInputs = Array.from(this.$el.querySelectorAll('[name="files[]"]'));
return fileInputs.map(node => node.value);
return fileInputs.map((node) => node.value);
},
createMutation() {
return {
......@@ -166,7 +166,7 @@ export default {
redirectTo(baseObj.snippet.webUrl);
}
})
.catch(e => {
.catch((e) => {
this.flashAPIFailure(e);
});
},
......
......@@ -74,7 +74,7 @@ export default {
this.blobsOrig = blobsById;
this.blobs = cloneDeep(blobsById);
this.blobIds = blobs.map(x => x.id);
this.blobIds = blobs.map((x) => x.id);
// Show 1 empty blob if none exist
if (!this.blobIds.length) {
......@@ -108,7 +108,7 @@ export default {
this.blobIds.push(blob.id);
},
deleteBlob(id) {
this.blobIds = this.blobIds.filter(x => x !== id);
this.blobIds = this.blobIds.filter((x) => x !== id);
this.$delete(this.blobs, id);
},
updateBlob(id, args) {
......
......@@ -55,12 +55,12 @@ export default {
axios
.get(url, {
// This prevents axios from automatically JSON.parse response
transformResponse: [f => f],
transformResponse: [(f) => f],
})
.then(res => {
.then((res) => {
this.notifyAboutUpdates({ content: res.data });
})
.catch(e => this.flashAPIFailure(e));
.catch((e) => this.flashAPIFailure(e));
},
flashAPIFailure(err) {
Flash(sprintf(SNIPPET_BLOB_CONTENT_FETCH_ERROR, { err }));
......
......@@ -88,7 +88,7 @@ export default {
const {
blobs: { nodes: dataBlobs },
} = data.snippets.nodes[0];
const updatedBlobData = dataBlobs.find(blob => blob.path === blobPath);
const updatedBlobData = dataBlobs.find((blob) => blob.path === blobPath);
return updatedBlobData.richData || updatedBlobData.plainData;
},
},
......
......@@ -69,7 +69,7 @@ export default {
},
computed: {
snippetHasBinary() {
return Boolean(this.snippet.blobs.find(blob => blob.binary));
return Boolean(this.snippet.blobs.find((blob) => blob.binary));
},
authoredMessage() {
return this.snippet.author
......@@ -164,7 +164,7 @@ export default {
this.closeDeleteModal();
this.redirectToSnippets();
})
.catch(err => {
.catch((err) => {
this.isDeleting = false;
this.errorMessage = err.message;
});
......
......@@ -11,7 +11,7 @@ export const getSnippetMixin = {
ids: [this.snippetGid],
};
},
update: data => {
update: (data) => {
const res = data.snippets.nodes[0];
if (res) {
res.blobs = res.blobs.nodes;
......
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