Commit 468cb9f0 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 37 files - 43 of 73

Part of our prettier migration; changing the arrow-parens style.
parent a536349d
......@@ -31,13 +31,13 @@ function getApprovalRuleNamesLeft(data) {
return [];
}
const rulesLeft = groupBy(data.approval_rules_left, x => x.rule_type);
const rulesLeft = groupBy(data.approval_rules_left, (x) => x.rule_type);
// Filter out empty names (fallback rule has no name) because the empties would look weird.
const regularRules = (rulesLeft[RULE_TYPE_REGULAR] || []).map(x => x.name).filter(x => x);
const regularRules = (rulesLeft[RULE_TYPE_REGULAR] || []).map((x) => x.name).filter((x) => x);
// Report Approvals
const reportApprovalRules = (rulesLeft[RULE_TYPE_REPORT_APPROVER] || []).map(x => x.name);
const reportApprovalRules = (rulesLeft[RULE_TYPE_REPORT_APPROVER] || []).map((x) => x.name);
// If there are code owners that need to approve, only mention that once.
// As the names of code owner rules are patterns that don't mean much out of context.
......@@ -50,7 +50,7 @@ function getApprovalRuleNamesLeft(data) {
* Map the approval rules response for use by the MR widget
*/
export function mapApprovalRulesResponse(rules, settings) {
return rules.map(x => mapApprovalRule(x, settings));
return rules.map((x) => mapApprovalRule(x, settings));
}
/**
......
......@@ -55,7 +55,7 @@ export default {
},
degradedBrowserPerformanceTotalScore() {
return this.mr?.browserPerformanceMetrics?.degraded.find(
metric => metric.name === __('Total Score'),
(metric) => metric.name === __('Total Score'),
);
},
hasBrowserPerformanceDegradation() {
......@@ -92,7 +92,7 @@ export default {
return (
this.mr.canReadVulnerabilities &&
enabledReports &&
this.$options.securityReportTypes.some(reportType => enabledReports[reportType])
this.$options.securityReportTypes.some((reportType) => enabledReports[reportType])
);
},
......@@ -191,7 +191,7 @@ export default {
this.isLoadingBrowserPerformance = true;
Promise.all([this.service.fetchReport(head_path), this.service.fetchReport(base_path)])
.then(values => {
.then((values) => {
this.mr.compareBrowserPerformanceMetrics(values[0], values[1]);
})
.catch(() => {
......@@ -208,7 +208,7 @@ export default {
this.isLoadingLoadPerformance = true;
Promise.all([this.service.fetchReport(head_path), this.service.fetchReport(base_path)])
.then(values => {
.then((values) => {
this.mr.compareLoadPerformanceMetrics(values[0], values[1]);
})
.catch(() => {
......
......@@ -11,15 +11,15 @@ export default class MRWidgetService extends CEWidgetService {
approveMergeRequestWithAuth(approvalPassword) {
return axios
.post(this.apiApprovePath, { approval_password: approvalPassword })
.then(res => res.data);
.then((res) => res.data);
}
fetchApprovalSettings() {
return axios.get(this.apiApprovalSettingsPath).then(res => res.data);
return axios.get(this.apiApprovalSettingsPath).then((res) => res.data);
}
// eslint-disable-next-line class-methods-use-this
fetchReport(endpoint) {
return axios.get(endpoint).then(res => res.data);
return axios.get(endpoint).then((res) => res.data);
}
}
......@@ -112,9 +112,9 @@ export default class MergeRequestStore extends CEMergeRequestStore {
const degraded = [];
const same = [];
Object.keys(headMetricsIndexed).forEach(subject => {
Object.keys(headMetricsIndexed).forEach((subject) => {
const subjectMetrics = headMetricsIndexed[subject];
Object.keys(subjectMetrics).forEach(metric => {
Object.keys(subjectMetrics).forEach((metric) => {
const headMetricData = subjectMetrics[metric];
if (baseMetricsIndexed[subject] && baseMetricsIndexed[subject][metric]) {
......@@ -168,7 +168,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
const degraded = [];
const same = [];
Object.keys(headMetricsIndexed).forEach(metric => {
Object.keys(headMetricsIndexed).forEach((metric) => {
const headMetricData = headMetricsIndexed[metric];
if (metric in baseMetricsIndexed) {
const baseMetricData = baseMetricsIndexed[metric];
......@@ -204,7 +204,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
const { metrics } = loadPerformanceData;
const indexedMetrics = {};
Object.keys(loadPerformanceData.metrics).forEach(metric => {
Object.keys(loadPerformanceData.metrics).forEach((metric) => {
switch (metric) {
case 'http_reqs':
indexedMetrics[s__('ciReport|RPS')] = metrics.http_reqs.rate;
......
......@@ -4,7 +4,7 @@ import { GlSkeletonLoader, GlIcon } from '@gitlab/ui';
import accordionEventBus from './accordion_event_bus';
const accordionItemUniqueId = name => uniqueId(`gl-accordion-item-${name}-`);
const accordionItemUniqueId = (name) => uniqueId(`gl-accordion-item-${name}-`);
export default {
components: {
......
......@@ -16,7 +16,7 @@ export const tributeConfig = {
config: {
trigger: '&',
fillAttr: 'iid',
lookup: value => `${value.iid}${value.title}`,
lookup: (value) => `${value.iid}${value.title}`,
menuItemTemplate: ({ original }) =>
`<small>${original.iid}</small> ${escape(original.title)}`,
},
......
......@@ -24,7 +24,7 @@ export const setSelectedEpicIssueId = ({ commit }, selectedEpicIssueId) =>
export const requestEpics = ({ commit }) => commit(types.REQUEST_EPICS);
export const receiveEpicsSuccess = ({ commit }, data) => {
const epics = data.map(rawEpic =>
const epics = data.map((rawEpic) =>
convertObjectPropsToCamelCase(
{ ...rawEpic, url: rawEpic.web_edit_url },
{
......
......@@ -11,9 +11,9 @@ import { DropdownVariant } from '../constants';
*
* @param {object} state
*/
export const groupEpics = state => {
export const groupEpics = (state) => {
if (state.searchQuery) {
return state.epics.filter(epic => {
return state.epics.filter((epic) => {
const { title, reference, url, iid } = epic;
// In case user has just pasted ID
......@@ -37,11 +37,11 @@ export const groupEpics = state => {
* is `sidebar`
* @param {object} state
*/
export const isDropdownVariantSidebar = state => state.variant === DropdownVariant.Sidebar;
export const isDropdownVariantSidebar = (state) => state.variant === DropdownVariant.Sidebar;
/**
* Returns boolean representing whether dropdown variant
* is `standalone`
* @param {object} state
*/
export const isDropdownVariantStandalone = state => state.variant === DropdownVariant.Standalone;
export const isDropdownVariantStandalone = (state) => state.variant === DropdownVariant.Standalone;
......@@ -40,7 +40,7 @@ export default {
return (
this.downstreamPipelines &&
this.downstreamPipelines.some(
pipeline =>
(pipeline) =>
pipeline.details &&
pipeline.details.status &&
pipeline.details.status.group === STATUS_FAILED,
......
......@@ -27,9 +27,9 @@ export const forceProjectsRequest = () => {
export const addProjectsToDashboard = ({ state, dispatch }) =>
axios
.post(state.projectEndpoints.add, {
project_ids: state.selectedProjects.map(p => p.id),
project_ids: state.selectedProjects.map((p) => p.id),
})
.then(response => dispatch('receiveAddProjectsToDashboardSuccess', response.data))
.then((response) => dispatch('receiveAddProjectsToDashboardSuccess', response.data))
.catch(() => dispatch('receiveAddProjectsToDashboardError'));
export const toggleSelectedProject = ({ commit, state }, project) => {
......@@ -49,8 +49,8 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data)
if (invalid.length) {
const [firstProject, secondProject, ...rest] = state.selectedProjects
.filter(project => invalid.includes(project.id))
.map(project => project.name);
.filter((project) => invalid.includes(project.id))
.map((project) => project.name);
const translationValues = {
firstProject,
secondProject,
......@@ -105,7 +105,7 @@ export const fetchProjects = ({ state, dispatch, commit }, page) => {
fetchProjects: () => axios.get(state.projectEndpoints.list, { params: { page } }),
},
method: 'fetchProjects',
successCallback: response => {
successCallback: (response) => {
const {
data: { projects },
headers,
......@@ -160,7 +160,7 @@ export const fetchSearchResults = ({ state, dispatch }) => {
dispatch('minimumQueryMessage');
} else {
Api.projects(searchQuery, {})
.then(results => dispatch('receiveSearchResultsSuccess', results))
.then((results) => dispatch('receiveSearchResultsSuccess', results))
.catch(() => dispatch('receiveSearchResultsError'));
}
};
......@@ -170,7 +170,7 @@ export const fetchNextPage = ({ state, dispatch }) => {
return;
}
Api.projects(state.searchQuery, { page: state.pageInfo.nextPage })
.then(results => dispatch('receiveNextPageSuccess', results))
.then((results) => dispatch('receiveNextPageSuccess', results))
.catch(() => dispatch('receiveSearchResultsError'));
};
......
......@@ -26,7 +26,7 @@ export default {
if (AccessorUtilities.isLocalStorageAccessSafe()) {
localStorage.setItem(
state.projectEndpoints.list,
state.projects.map(p => p.id),
state.projects.map((p) => p.id),
);
} else {
createFlash(
......@@ -44,12 +44,12 @@ export default {
},
[types.ADD_SELECTED_PROJECT](state, project) {
if (!state.selectedProjects.some(p => p.id === project.id)) {
if (!state.selectedProjects.some((p) => p.id === project.id)) {
state.selectedProjects.push(project);
}
},
[types.REMOVE_SELECTED_PROJECT](state, project) {
state.selectedProjects = state.selectedProjects.filter(p => p.id !== project.id);
state.selectedProjects = state.selectedProjects.filter((p) => p.id !== project.id);
},
[types.REQUEST_PROJECTS](state) {
......@@ -68,7 +68,7 @@ export default {
if (AccessorUtilities.isLocalStorageAccessSafe()) {
localStorage.setItem(
state.projectEndpoints.list,
state.projects.map(p => p.id),
state.projects.map((p) => p.id),
);
}
......
......@@ -30,14 +30,14 @@ export default {
.select2({
allowClear: true,
placeholder: this.placeholder,
createSearchChoice: term => ({ id: term, text: term }),
createSearchChoice: (term) => ({ id: term, text: term }),
createSearchChoicePosition: 'bottom',
data: this.knownLicenses.map(license => ({
data: this.knownLicenses.map((license) => ({
id: license,
text: license,
})),
})
.on('change', e => {
.on('change', (e) => {
this.$emit('input', e.target.value);
});
})
......
......@@ -38,7 +38,7 @@ export default {
license: {
type: Object,
required: true,
validator: license =>
validator: (license) =>
Boolean(license.name) &&
Object.values(LICENSE_APPROVAL_STATUS).includes(license.approvalStatus),
},
......
......@@ -47,7 +47,7 @@ export const deleteLicense = ({ dispatch, state }) => {
.then(() => {
dispatch('receiveDeleteLicense', licenseId);
})
.catch(error => {
.catch((error) => {
dispatch('receiveDeleteLicenseError', error);
dispatch('removePendingLicense', licenseId);
});
......@@ -72,7 +72,7 @@ export const fetchManagedLicenses = ({ dispatch, state }) => {
.then(({ data }) => {
dispatch('receiveManagedLicensesSuccess', data);
})
.catch(error => {
.catch((error) => {
dispatch('receiveManagedLicensesError', error);
});
};
......@@ -95,7 +95,7 @@ export const fetchParsedLicenseReport = ({ dispatch, state }) => {
const existingLicenses = (data.existing_licenses || []).map(convertToOldReportFormat);
dispatch('receiveParsedLicenseReportSuccess', { newLicenses, existingLicenses });
})
.catch(error => {
.catch((error) => {
dispatch('receiveParsedLicenseReportError', error);
});
};
......@@ -139,13 +139,13 @@ export const fetchLicenseCheckApprovalRule = ({ dispatch, state }) => {
return axios
.get(state.approvalsApiPath)
.then(({ data }) => {
const hasLicenseCheckApprovalRule = data.approval_rules_left.some(rule => {
const hasLicenseCheckApprovalRule = data.approval_rules_left.some((rule) => {
return rule.name === LICENSE_CHECK_NAME;
});
dispatch('receiveLicenseCheckApprovalRuleSuccess', { hasLicenseCheckApprovalRule });
})
.catch(error => {
.catch((error) => {
dispatch('receiveLicenseCheckApprovalRuleError', error);
});
};
......@@ -196,7 +196,7 @@ export const setLicenseApproval = ({ dispatch, state }, payload) => {
.then(() => {
dispatch('receiveSetLicenseApproval', id);
})
.catch(error => {
.catch((error) => {
dispatch('receiveSetLicenseApprovalError', error);
dispatch('removePendingLicense', id);
});
......
......@@ -2,20 +2,20 @@ import { n__, s__, sprintf } from '~/locale';
import { addLicensesMatchingReportGroupStatus, reportGroupHasAtLeastOneLicense } from './utils';
import { LICENSE_APPROVAL_STATUS, REPORT_GROUPS } from '../constants';
export const isLoading = state =>
export const isLoading = (state) =>
state.isLoadingManagedLicenses ||
state.isLoadingLicenseReport ||
state.isLoadingLicenseCheckApprovalRule;
export const isLicenseBeingUpdated = state => (id = null) => state.pendingLicenses.includes(id);
export const isLicenseBeingUpdated = (state) => (id = null) => state.pendingLicenses.includes(id);
export const isAddingNewLicense = (_, getters) => getters.isLicenseBeingUpdated();
export const hasPendingLicenses = state => state.pendingLicenses.length > 0;
export const hasPendingLicenses = (state) => state.pendingLicenses.length > 0;
export const licenseReport = state => state.newLicenses;
export const licenseReport = (state) => state.newLicenses;
export const licenseReportGroups = state =>
export const licenseReportGroups = (state) =>
REPORT_GROUPS.map(addLicensesMatchingReportGroupStatus(state.newLicenses)).filter(
reportGroupHasAtLeastOneLicense,
);
......@@ -24,7 +24,7 @@ export const hasReportItems = (_, getters) => {
return Boolean(getters.licenseReportLength);
};
export const baseReportHasLicenses = state => {
export const baseReportHasLicenses = (state) => {
return Boolean(state.existingLicenses.length);
};
......@@ -118,5 +118,5 @@ export const summaryTextWithoutLicenseCheck = (_, getters) => {
export const reportContainsBlacklistedLicense = (_, getters) =>
(getters.licenseReport || []).some(
license => license.approvalStatus === LICENSE_APPROVAL_STATUS.DENIED,
(license) => license.approvalStatus === LICENSE_APPROVAL_STATUS.DENIED,
);
......@@ -121,6 +121,6 @@ export default {
state.pendingLicenses.push(id);
},
[types.REMOVE_PENDING_LICENSE](state, id) {
state.pendingLicenses = state.pendingLicenses.filter(pendingLicense => pendingLicense !== id);
state.pendingLicenses = state.pendingLicenses.filter((pendingLicense) => pendingLicense !== id);
},
};
......@@ -11,7 +11,7 @@ import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constan
* @returns {Object}
*
*/
export const normalizeLicense = license => {
export const normalizeLicense = (license) => {
const { approval_status: approvalStatus, ...rest } = license;
return {
...rest,
......@@ -19,7 +19,7 @@ export const normalizeLicense = license => {
};
};
export const getStatusTranslationsFromLicenseStatus = approvalStatus => {
export const getStatusTranslationsFromLicenseStatus = (approvalStatus) => {
if (approvalStatus === LICENSE_APPROVAL_STATUS.ALLOWED) {
return s__('LicenseCompliance|Allowed');
} else if (approvalStatus === LICENSE_APPROVAL_STATUS.DENIED) {
......@@ -28,7 +28,7 @@ export const getStatusTranslationsFromLicenseStatus = approvalStatus => {
return '';
};
export const getIssueStatusFromLicenseStatus = approvalStatus => {
export const getIssueStatusFromLicenseStatus = (approvalStatus) => {
if (approvalStatus === LICENSE_APPROVAL_STATUS.ALLOWED) {
return STATUS_SUCCESS;
} else if (approvalStatus === LICENSE_APPROVAL_STATUS.DENIED) {
......@@ -55,13 +55,13 @@ export const getPackagesString = (packages, truncate, maxPackages) => {
// and truncate is true.
packagesString = packages
.slice(0, maxPackages)
.map(packageItem => packageItem.name)
.map((packageItem) => packageItem.name)
.join(', ');
} else {
// Return all package names separated by comma with proper grammar
packagesString = packages
.slice(0, packages.length - 1)
.map(packageItem => packageItem.name)
.map((packageItem) => packageItem.name)
.join(', ');
lastPackage = packages[packages.length - 1].name;
}
......@@ -83,7 +83,7 @@ export const getPackagesString = (packages, truncate, maxPackages) => {
* @returns {Object} The converted license;
*/
export const convertToOldReportFormat = license => {
export const convertToOldReportFormat = (license) => {
const approvalStatus = license.classification.approval_status;
return {
......@@ -104,10 +104,10 @@ export const convertToOldReportFormat = license => {
* @param {Array} licenses
* @returns {function(*): {licenses: (*|*[])}}
*/
export const addLicensesMatchingReportGroupStatus = licenses => {
export const addLicensesMatchingReportGroupStatus = (licenses) => {
const licensesGroupedByStatus = groupBy(licenses, 'status');
return reportGroup => ({
return (reportGroup) => ({
...reportGroup,
licenses: licensesGroupedByStatus[reportGroup.status] || [],
});
......
import { LOADING, ERROR, SUCCESS } from '../constants';
export const summaryStatus = state => {
export const summaryStatus = (state) => {
if (state.isLoading) {
return LOADING;
}
......@@ -12,8 +12,8 @@ export const summaryStatus = state => {
return SUCCESS;
};
export const metrics = state => [
...state.newMetrics.map(metric => ({ ...metric, isNew: true })),
export const metrics = (state) => [
...state.newMetrics.map((metric) => ({ ...metric, isNew: true })),
...state.existingMetrics,
...state.removedMetrics.map(metric => ({ ...metric, wasRemoved: true })),
...state.removedMetrics.map((metric) => ({ ...metric, wasRemoved: true })),
];
......@@ -17,7 +17,7 @@ export default {
state.removedMetrics = response.removed_metrics || [];
state.numberOfChanges =
state.existingMetrics.filter(metric => metric.previous_value !== undefined).length +
state.existingMetrics.filter((metric) => metric.previous_value !== undefined).length +
state.newMetrics.length +
state.removedMetrics.length;
},
......
......@@ -66,7 +66,7 @@ export default {
},
recordedMessage() {
return this.vulnerability.supporting_messages?.find(
msg => msg.name === SUPPORTING_MESSAGE_TYPES.RECORDED,
(msg) => msg.name === SUPPORTING_MESSAGE_TYPES.RECORDED,
)?.response;
},
constructedRequest() {
......
......@@ -67,7 +67,7 @@ export const fetchContainerScanningDiff = ({ state, dispatch }) => {
dispatch('requestContainerScanningDiff');
return fetchDiffData(state, state.containerScanning.paths.diffEndpoint, 'container_scanning')
.then(data => {
.then((data) => {
dispatch('receiveContainerScanningDiffSuccess', data);
})
.catch(() => {
......@@ -96,7 +96,7 @@ export const fetchDastDiff = ({ state, dispatch }) => {
dispatch('requestDastDiff');
return fetchDiffData(state, state.dast.paths.diffEndpoint, 'dast')
.then(data => {
.then((data) => {
dispatch('receiveDastDiffSuccess', data);
})
.catch(() => {
......@@ -124,7 +124,7 @@ export const fetchDependencyScanningDiff = ({ state, dispatch }) => {
dispatch('requestDependencyScanningDiff');
return fetchDiffData(state, state.dependencyScanning.paths.diffEndpoint, 'dependency_scanning')
.then(data => {
.then((data) => {
dispatch('receiveDependencyScanningDiffSuccess', data);
})
.catch(() => {
......@@ -161,7 +161,7 @@ export const fetchCoverageFuzzingDiff = ({ state, dispatch }) => {
},
}),
])
.then(values => {
.then((values) => {
dispatch('receiveCoverageFuzzingDiffSuccess', {
diff: values[0].data,
enrichData: values[1].data,
......@@ -371,7 +371,7 @@ export const createNewIssue = ({ state, dispatch }) => {
vulnerability_data: state.modal.vulnerability,
},
})
.then(response => {
.then((response) => {
dispatch('receiveCreateIssue');
// redirect the user to the created issue
visitUrl(response.data.issue_url);
......
......@@ -59,13 +59,13 @@ export const dependencyScanningStatusIcon = ({ dependencyScanning }) =>
export const coverageFuzzingStatusIcon = ({ coverageFuzzing }) =>
statusIcon(coverageFuzzing.isLoading, coverageFuzzing.hasError, coverageFuzzing.newIssues.length);
export const isBaseSecurityReportOutOfDate = state =>
state.reportTypes.some(reportType => state[reportType].baseReportOutofDate);
export const isBaseSecurityReportOutOfDate = (state) =>
state.reportTypes.some((reportType) => state[reportType].baseReportOutofDate);
export const canCreateIssue = state => Boolean(state.createVulnerabilityFeedbackIssuePath);
export const canCreateIssue = (state) => Boolean(state.createVulnerabilityFeedbackIssuePath);
export const canCreateMergeRequest = state =>
export const canCreateMergeRequest = (state) =>
Boolean(state.createVulnerabilityFeedbackMergeRequestPath);
export const canDismissVulnerability = state =>
export const canDismissVulnerability = (state) =>
Boolean(state.createVulnerabilityFeedbackDismissalPath);
......@@ -15,7 +15,7 @@ export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestDiff');
return fetchDiffData(rootState, state.paths.diffEndpoint, 'api_fuzzing')
.then(data => {
.then((data) => {
dispatch('receiveDiffSuccess', data);
})
.catch(() => {
......
import { statusIcon, groupedReportText } from '../../utils';
import messages from '../../messages';
export const groupedApiFuzzingText = state =>
export const groupedApiFuzzingText = (state) =>
groupedReportText(
state,
messages.API_FUZZING,
......
import { statusIcon, groupedReportText } from '../../utils';
import messages from '../../messages';
export const groupedSastText = state =>
export const groupedSastText = (state) =>
groupedReportText(state, messages.SAST, messages.SAST_HAS_ERROR, messages.SAST_IS_LOADING);
export const sastStatusIcon = ({ isLoading, hasError, newIssues }) =>
......
import { statusIcon, groupedReportText } from '../../utils';
import messages from '../../messages';
export const groupedSecretDetectionText = state =>
export const groupedSecretDetectionText = (state) =>
groupedReportText(
state,
messages.SECRET_SCANNING,
......
......@@ -11,7 +11,7 @@ export { groupedTextBuilder, countVulnerabilities };
* @param {Object} issue
*/
export const findIssueIndex = (issues, issue) =>
issues.findIndex(el => el.project_fingerprint === issue.project_fingerprint);
issues.findIndex((el) => el.project_fingerprint === issue.project_fingerprint);
export const statusIcon = (loading = false, failed = false, newIssues = 0, neutralIssues = 0) => {
if (loading) {
......
......@@ -6,7 +6,7 @@ import { humanize } from '~/lib/utils/text_utility';
* @param {string} reportType that is not human-readable
* @returns {string} a human-readable version of the report type
*/
const convertReportType = reportType => {
const convertReportType = (reportType) => {
if (!reportType) return '';
const lowerCaseType = reportType.toLowerCase();
return REPORT_TYPES[lowerCaseType] || humanize(lowerCaseType);
......
......@@ -6,7 +6,7 @@ import { PRIMARY_IDENTIFIER_TYPE } from 'ee/security_dashboard/store/constants';
* @returns {String} the primary identifier's name
*/
const getPrimaryIdentifier = (identifiers = [], property) => {
const identifier = identifiers.find(value => value[property] === PRIMARY_IDENTIFIER_TYPE);
const identifier = identifiers.find((value) => value[property] === PRIMARY_IDENTIFIER_TYPE);
return identifier?.name || identifiers[0]?.name || '';
};
......
......@@ -62,7 +62,7 @@ export default {
},
recordedMessage() {
return this.vulnerability?.supportingMessages?.find(
msg => msg.name === SUPPORTING_MESSAGE_TYPES.RECORDED,
(msg) => msg.name === SUPPORTING_MESSAGE_TYPES.RECORDED,
)?.response;
},
constructedRequest() {
......@@ -85,7 +85,7 @@ export default {
content: this.constructedRequest,
isCode: true,
},
].filter(x => x.content);
].filter((x) => x.content);
},
responseData() {
if (!this.vulnerability.response) {
......@@ -98,7 +98,7 @@ export default {
content: this.constructedResponse,
isCode: true,
},
].filter(x => x.content);
].filter((x) => x.content);
},
recordedResponseData() {
if (!this.recordedMessage) {
......@@ -111,7 +111,7 @@ export default {
content: this.constructedRecordedResponse,
isCode: true,
},
].filter(x => x.content);
].filter((x) => x.content);
},
shouldShowLocation() {
return (
......
......@@ -43,7 +43,7 @@ export default {
},
noteDictionary() {
return this.discussions
.flatMap(x => x.notes)
.flatMap((x) => x.notes)
.reduce((acc, note) => {
acc[note.id] = note;
return acc;
......@@ -156,11 +156,11 @@ export default {
updateNotes(notes) {
let isVulnerabilityStateChanged = false;
notes.forEach(note => {
notes.forEach((note) => {
// If the note exists, update it.
if (this.noteDictionary[note.id]) {
const updatedDiscussion = { ...this.discussionsDictionary[note.discussionId] };
updatedDiscussion.notes = updatedDiscussion.notes.map(curr =>
updatedDiscussion.notes = updatedDiscussion.notes.map((curr) =>
curr.id === note.id ? note : curr,
);
this.discussionsDictionary[note.discussionId] = updatedDiscussion;
......
......@@ -116,7 +116,7 @@ export default {
this.isLoadingUser = true;
UsersCache.retrieveById(id)
.then(userData => {
.then((userData) => {
this.user = userData;
})
.catch(() => {
......@@ -221,7 +221,7 @@ export default {
.then(({ data }) => {
Object.assign(this.vulnerability, data);
})
.catch(e => {
.catch((e) => {
// Don't show an error message if the request was cancelled through the cancel token.
if (!axios.isCancel(e)) {
createFlash(
......
......@@ -21,10 +21,10 @@ export default {
},
computed: {
systemNote() {
return this.notes.find(x => x.system === true);
return this.notes.find((x) => x.system === true);
},
comments() {
return this.notes.filter(x => x !== this.systemNote);
return this.notes.filter((x) => x !== this.systemNote);
},
},
watch: {
......
......@@ -54,7 +54,7 @@ export default {
return this.projectPath.replace(/^\//, ''); // Remove the leading slash, i.e. '/root/test' -> 'root/test'.
},
isIssueAlreadyCreated() {
return Boolean(this.state.relatedIssues.find(i => i.lockIssueRemoval));
return Boolean(this.state.relatedIssues.find((i) => i.lockIssueRemoval));
},
canCreateIssue() {
return !this.isIssueAlreadyCreated && !this.isFetching && Boolean(this.newIssueUrl);
......@@ -102,7 +102,7 @@ export default {
const errors = [];
// The endpoint can only accept one issue, so we need to do a separate call for each pending reference.
const requests = this.state.pendingReferences.map(reference => {
const requests = this.state.pendingReferences.map((reference) => {
return axios
.post(
this.endpoint,
......@@ -132,7 +132,7 @@ export default {
this.isFormVisible = hasErrors;
if (hasErrors) {
const messages = errors.map(error => sprintf(RELATED_ISSUES_ERRORS.LINK_ERROR, error));
const messages = errors.map((error) => sprintf(RELATED_ISSUES_ERRORS.LINK_ERROR, error));
createFlash(messages.join(' '));
}
});
......@@ -157,7 +157,7 @@ export default {
.then(({ data }) => {
const issues = data.map(getFormattedIssue);
this.store.setRelatedIssues(
issues.map(i => {
issues.map((i) => {
const lockIssueRemoval = i.vulnerability_link_type === 'created';
return {
......@@ -185,7 +185,7 @@ export default {
this.store.removePendingRelatedIssue(indexToRemove);
},
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.addPendingReferences({ untouchedRawReferences: rawReferences });
},
},
......
......@@ -41,7 +41,7 @@ export default {
}
},
isAlreadyDismissed() {
return this.alreadyDismissedVulnerabilities().some(id => id === this.vulnerabilityId);
return this.alreadyDismissedVulnerabilities().some((id) => id === this.vulnerabilityId);
},
dismiss() {
const dismissed = this.alreadyDismissedVulnerabilities().concat(this.vulnerabilityId);
......
......@@ -2,7 +2,7 @@ import { isAbsolute, isSafeURL } from '~/lib/utils/url_utility';
import { REGEXES } from './constants';
// Get the issue in the format expected by the descendant components of related_issues_block.vue.
export const getFormattedIssue = issue => ({
export const getFormattedIssue = (issue) => ({
...issue,
reference: `#${issue.iid}`,
path: issue.web_url,
......
......@@ -3,7 +3,7 @@ import App from 'ee/vulnerabilities/components/vulnerability.vue';
import apolloProvider from 'ee/security_dashboard/graphql/provider';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
export default el => {
export default (el) => {
if (!el) {
return null;
}
......@@ -23,7 +23,7 @@ export default el => {
issueTrackingHelpPath: vulnerability.issueTrackingHelpPath,
permissionsHelpPath: vulnerability.permissionsHelpPath,
},
render: h =>
render: (h) =>
h(App, {
props: { vulnerability },
}),
......
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