Commit 232790a7 authored by Mike Greiling's avatar Mike Greiling

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

Format files with prettier arrowParens [9/15]

See merge request gitlab-org/gitlab!50536
parents 1ce67085 468cb9f0
......@@ -13,7 +13,7 @@ const addScheduleToStore = (store, query, { oncallSchedule: schedule }, variable
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
draftData.project.incidentManagementOncallSchedules.nodes.push(schedule);
});
......@@ -35,7 +35,7 @@ const deleteScheduleFromStore = (store, query, { oncallScheduleDestroy }, variab
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.incidentManagementOncallSchedules.nodes = draftData.project.incidentManagementOncallSchedules.nodes.filter(
({ id }) => id !== schedule.id,
......@@ -60,7 +60,7 @@ const updateScheduleFromStore = (store, query, { oncallScheduleUpdate }, variabl
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.incidentManagementOncallSchedules.nodes = [
...draftData.project.incidentManagementOncallSchedules.nodes,
......
......@@ -11,7 +11,7 @@ import { getDateInFuture } from '~/lib/utils/datetime_utility';
*
* @returns {String}
*/
export const getFormattedTimezone = tz => {
export const getFormattedTimezone = (tz) => {
return sprintf(__('(UTC %{offset}) %{timezone}'), {
offset: tz.formatted_offset,
timezone: `${tz.abbr} ${tz.name}`,
......
......@@ -16,12 +16,12 @@ export default class CiTemplate {
selectable: true,
filterable: true,
allowClear: true,
toggleLabel: item => item.name,
toggleLabel: (item) => item.name,
search: {
fields: ['name'],
},
clicked: clickEvent => this.updateInputValue(clickEvent),
text: item => item.name,
clicked: (clickEvent) => this.updateInputValue(clickEvent),
text: (item) => item.name,
});
this.setDropdownToggle();
......
......@@ -29,7 +29,7 @@ const getDropdownConfig = (placeholder, apiPath, textProp) => ({
},
results(data) {
return {
results: data.map(entity => ({
results: data.map((entity) => ({
id: entity.id,
text: entity[textProp],
})),
......@@ -45,7 +45,7 @@ const $container = $('#js-elasticsearch-settings');
$container
.find('.js-limit-checkbox')
.on('change', e =>
.on('change', (e) =>
onLimitCheckboxChange(
e.currentTarget.checked,
$container.find('.js-limit-namespaces'),
......
......@@ -27,7 +27,7 @@ const getDropdownConfig = (placeholder, url) => ({
},
results(data) {
return {
results: data.map(entity => ({
results: data.map((entity) => ({
id: entity.source_id,
text: entity.path,
})),
......@@ -44,7 +44,7 @@ const $container = $('#js-elasticsearch-settings');
$container
.find('.js-limit-checkbox')
.on('change', e =>
.on('change', (e) =>
onLimitCheckboxChange(
e.currentTarget.checked,
$container.find('.js-limit-namespaces'),
......
......@@ -4,7 +4,7 @@ import { sprintf, __ } from '~/locale';
import { sanitizeItem } from '~/frequent_items/utils';
import { loadCSSFile } from '~/lib/utils/css_utils';
const formatResult = selectedItem => {
const formatResult = (selectedItem) => {
if (selectedItem.path_with_namespace) {
return `<div class='project-result'> <div class='project-name'>${selectedItem.name}</div> <div class='project-path'>${selectedItem.path_with_namespace}</div> </div>`;
} else if (selectedItem.path) {
......@@ -15,7 +15,7 @@ const formatResult = selectedItem => {
)}</div> <div class='group-path'>${__('All groups and projects')}</div> </div>`;
};
const formatSelection = selectedItem => {
const formatSelection = (selectedItem) => {
if (selectedItem.path_with_namespace) {
return sprintf(__('Project: %{name}'), { name: selectedItem.name });
} else if (selectedItem.path) {
......@@ -24,7 +24,7 @@ const formatSelection = selectedItem => {
return __('All groups and projects');
};
const QueryAdmin = query => {
const QueryAdmin = (query) => {
const groupsFetch = Api.groups(query.term, {});
const projectsFetch = Api.projects(query.term, {
order_by: 'id',
......
......@@ -6,4 +6,4 @@ initVueAlerts();
initConfirmModal();
const toasts = document.querySelectorAll('.js-toast-message');
toasts.forEach(toast => showToast(toast.dataset.message));
toasts.forEach((toast) => showToast(toast.dataset.message));
......@@ -15,6 +15,6 @@ const toggleUploadLicenseButton = () => {
uploadLicenseBtn.toggleAttribute('disabled', !acceptEULACheckBox.checked);
};
licenseType.forEach(el => el.addEventListener('change', showLicenseType));
licenseType.forEach((el) => el.addEventListener('change', showLicenseType));
acceptEULACheckBox.addEventListener('change', toggleUploadLicenseButton);
showLicenseType();
......@@ -17,7 +17,7 @@ export default {
resetPipelineMinutes() {
axios
.post(this.resetMinutesPath)
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.OK) {
this.$toast.show(__('User pipeline minutes were successfully reset.'));
}
......
......@@ -10,7 +10,7 @@ export function fetchPage({ commit, state }, newPage) {
page: newPage || state.pageInfo.page,
per_page: state.pageInfo.perPage,
})
.then(response => {
.then((response) => {
const { headers, data } = response;
const pageInfo = parseIntPagination(normalizeHeaders(headers));
commit(types.RECEIVE_SAML_MEMBERS_SUCCESS, {
......
......@@ -7,7 +7,7 @@ import state from './state';
Vue.use(Vuex);
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -21,7 +21,7 @@ export default () => {
if (isCodequalityTabActive) {
store.dispatch(fetchReportAction);
} else {
const tabClickHandler = e => {
const tabClickHandler = (e) => {
if (e.target.className === 'codequality-tab') {
store.dispatch(fetchReportAction);
tabsElement.removeEventListener('click', tabClickHandler);
......@@ -38,7 +38,7 @@ export default () => {
CodequalityReportApp,
},
store,
render: createElement => createElement('codequality-report-app'),
render: (createElement) => createElement('codequality-report-app'),
});
}
};
......@@ -34,7 +34,7 @@ export default () => {
reportSectionClass: 'split-report-section',
},
on: {
updateBadgeCount: count => {
updateBadgeCount: (count) => {
updateBadgeCount('.js-licenses-counter', count);
},
},
......
......@@ -27,7 +27,7 @@ if (el?.dataset?.apiUrl) {
});
}
toasts.forEach(toast => showToast(toast.dataset.message));
toasts.forEach((toast) => showToast(toast.dataset.message));
// eslint-disable-next-line no-new
new ProtectedEnvironmentCreate();
......
......@@ -37,7 +37,7 @@ export default class EEMirrorRepos extends MirrorRepos {
}
hideForm() {
return new Promise(resolve => {
return new Promise((resolve) => {
if (!this.$insertionPoint.html()) return resolve();
this.$insertionPoint.one('hidden.bs.collapse', () => {
......@@ -48,7 +48,7 @@ export default class EEMirrorRepos extends MirrorRepos {
}
showForm() {
return new Promise(resolve => {
return new Promise((resolve) => {
this.$insertionPoint.one('shown.bs.collapse', () => {
resolve();
});
......
......@@ -4,7 +4,7 @@ import { __ } from '~/locale';
import axios from '~/lib/utils/axios_utils';
export default function initPathLocks(url, path) {
$('a.path-lock').on('click', e => {
$('a.path-lock').on('click', (e) => {
e.preventDefault();
axios
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import BlockingMrInput from 'ee/projects/merge_requests/blocking_mr_input_root.vue';
import { n__ } from '~/locale';
export default el => {
export default (el) => {
if (!el) {
return null;
}
......
......@@ -59,7 +59,7 @@ export default class ProtectedEnvironmentCreate {
.get(gon.search_unprotected_environments_url, { params: { query: term } })
.then(({ data }) => {
const environments = [].concat(data);
const results = environments.map(environment => ({
const results = environments.map((environment) => ({
id: environment,
text: environment,
title: environment,
......@@ -80,12 +80,12 @@ export default class ProtectedEnvironmentCreate {
},
};
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,
......
......@@ -60,7 +60,7 @@ export default class ProtectedEnvironmentEdit {
.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
......@@ -75,7 +75,7 @@ export default class ProtectedEnvironmentEdit {
}
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
......
......@@ -64,12 +64,12 @@ export default class ProtectedTagCreate {
},
};
Object.keys(ACCESS_LEVELS).forEach(level => {
Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevel = ACCESS_LEVELS[level];
const selectedItems = this[`${ACCESS_LEVELS.CREATE}_dropdown`].getSelectedItems();
const levelAttributes = [];
selectedItems.forEach(item => {
selectedItems.forEach((item) => {
if (item.type === LEVEL_TYPES.USER) {
levelAttributes.push({
user_id: item.user_id,
......
......@@ -60,7 +60,7 @@ export default class ProtectedTagEdit {
.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
......@@ -74,7 +74,7 @@ export default class ProtectedTagEdit {
}
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
......
......@@ -32,7 +32,7 @@ function toggleTrialForm(trial) {
}
form.classList.toggle('hidden', !trial);
fields.forEach(f => {
fields.forEach((f) => {
f.disabled = !trial; // eslint-disable-line no-param-reassign
});
......@@ -54,7 +54,7 @@ function mountTrialToggle() {
return createElement(RegistrationTrialToggle, {
props: { active },
on: {
changed: event => toggleTrialForm(event.trial),
changed: (event) => toggleTrialForm(event.trial),
},
});
},
......
......@@ -117,7 +117,7 @@ export default {
'fetchProjects',
]),
getRawRefs(value) {
return value.split(/\s+/).filter(ref => ref.trim().length > 0);
return value.split(/\s+/).filter((ref) => ref.trim().length > 0);
},
handlePendingItemRemove(index) {
this.removePendingReference(index);
......
......@@ -69,6 +69,6 @@ export default () => {
methods: {
...Vuex.mapActions(['setInitialParentItem', 'setInitialConfig']),
},
render: createElement => createElement('related-items-tree-app'),
render: (createElement) => createElement('related-items-tree-app'),
});
};
......@@ -269,7 +269,7 @@ export const setItemInputValue = ({ commit }, data) => commit(types.SET_ITEM_INP
export const requestAddItem = ({ commit }) => commit(types.REQUEST_ADD_ITEM);
export const receiveAddItemSuccess = ({ dispatch, commit, getters }, { rawItems }) => {
const items = rawItems.map(item => {
const items = rawItems.map((item) => {
// This is needed since Rails API to add Epic/Issue
// doesn't return global ID string.
// We can remove this change once add epic/issue
......@@ -300,7 +300,7 @@ export const receiveAddItemSuccess = ({ dispatch, commit, getters }, { rawItems
items,
});
items.forEach(item => {
items.forEach((item) => {
dispatch('updateChildrenCount', { item });
});
......@@ -332,7 +332,7 @@ export const addItem = ({ state, dispatch, getters }) => {
rawItems: data.issuables.slice(0, state.pendingReferences.length),
});
})
.catch(data => {
.catch((data) => {
const { response } = data;
if (response.status === httpStatusCodes.NOT_FOUND) {
dispatch('receiveAddItemFailure', { itemAddFailureType: itemAddFailureTypesMap.NOT_FOUND });
......@@ -557,7 +557,7 @@ export const createNewIssue = ({ state, dispatch }, { issuesEndpoint, title }) =
parentItem,
});
})
.catch(e => {
.catch((e) => {
dispatch('receiveCreateIssueFailure');
throw e;
});
......
......@@ -3,10 +3,10 @@ import { processIssueTypeIssueSources } from '../utils/epic_utils';
export const autoCompleteSources = () => gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources;
export const directChildren = state => state.children[state.parentItem.reference] || [];
export const directChildren = (state) => state.children[state.parentItem.reference] || [];
export const anyParentHasChildren = (state, getters) =>
getters.directChildren.some(item => item.hasChildren || item.hasIssues);
getters.directChildren.some((item) => item.hasChildren || item.hasIssues);
export const itemAutoCompleteSources = (state, getters) => {
if (getters.isEpic) {
......@@ -26,4 +26,4 @@ export const itemAutoCompleteSources = (state, getters) => {
export const itemPathIdSeparator = (state, getters) =>
getters.isEpic ? PathIdSeparator.Epic : PathIdSeparator.Issue;
export const isEpic = state => state.issuableType === issuableTypesMap.EPIC;
export const isEpic = (state) => state.issuableType === issuableTypesMap.EPIC;
......@@ -42,14 +42,14 @@ export const sortByState = (a, b) => stateOrder.indexOf(a.state) - stateOrder.in
*
* @param {Array} items
*/
export const applySorts = array => array.sort(sortChildren).sort(sortByState);
export const applySorts = (array) => array.sort(sortChildren).sort(sortByState);
/**
* Returns formatted child item to include additional
* flags and properties to use while rendering tree.
* @param {Object} item
*/
export const formatChildItem = item => ({ ...item, pathIdSeparator: PathIdSeparator[item.type] });
export const formatChildItem = (item) => ({ ...item, pathIdSeparator: PathIdSeparator[item.type] });
/**
* Returns formatted array of Epics that doesn't contain
......@@ -57,7 +57,7 @@ export const formatChildItem = item => ({ ...item, pathIdSeparator: PathIdSepara
*
* @param {Array} children
*/
export const extractChildEpics = children =>
export const extractChildEpics = (children) =>
children.edges.map(({ node, epicNode = node }) =>
formatChildItem({
...epicNode,
......@@ -72,8 +72,8 @@ export const extractChildEpics = children =>
*
* @param {Array} assignees
*/
export const extractIssueAssignees = assignees =>
assignees.edges.map(assigneeNode => ({
export const extractIssueAssignees = (assignees) =>
assignees.edges.map((assigneeNode) => ({
...assigneeNode.node,
}));
......@@ -83,7 +83,7 @@ export const extractIssueAssignees = assignees =>
*
* @param {Array} issues
*/
export const extractChildIssues = issues =>
export const extractChildIssues = (issues) =>
issues.edges.map(({ node, issueNode = node }) =>
formatChildItem({
...issueNode,
......
......@@ -11,7 +11,7 @@ export default () => {
if (!toggleBtn) return;
toggleBtn.addEventListener('click', e => {
toggleBtn.addEventListener('click', (e) => {
e.preventDefault();
toggleBtn.setAttribute('disabled', 'disabled');
......
import { normalizeData as normalizeDataFOSS } from '~/repository/utils/commit';
export function normalizeData(data, path) {
return normalizeDataFOSS(data, path, d => ({
return normalizeDataFOSS(data, path, (d) => ({
lockLabel: d.lock_label || false,
}));
}
......@@ -23,7 +23,7 @@ export default {
requirement: {
type: Object,
required: true,
validator: value =>
validator: (value) =>
[
'iid',
'state',
......@@ -33,7 +33,7 @@ export default {
'updatedAt',
'author',
'testReports',
].every(prop => value[prop]),
].every((prop) => value[prop]),
},
stateChangeRequestActive: {
type: Boolean,
......
......@@ -74,8 +74,8 @@ export default {
initialRequirementsCount: {
type: Object,
required: true,
validator: value =>
['OPENED', 'ARCHIVED', 'ALL'].every(prop => typeof value[prop] === 'number'),
validator: (value) =>
['OPENED', 'ARCHIVED', 'ALL'].every((prop) => typeof value[prop] === 'number'),
},
page: {
type: Number,
......@@ -150,7 +150,7 @@ export default {
update(data) {
const requirementsRoot = data.project?.requirements;
const list = requirementsRoot?.nodes.map(node => {
const list = requirementsRoot?.nodes.map((node) => {
return {
...node,
satisfied: node.lastTestReportState === TestReportStatus.Passed,
......@@ -278,7 +278,7 @@ export default {
];
},
getFilteredSearchValue() {
const value = this.authorUsernames.map(author => ({
const value = this.authorUsernames.map((author) => ({
type: 'author_username',
value: { data: author },
}));
......@@ -378,7 +378,7 @@ export default {
updateRequirementInput,
},
})
.catch(e => {
.catch((e) => {
createFlash({
message: errorFlashMessage,
parent: flashMessageContainer,
......@@ -399,7 +399,7 @@ export default {
.then(({ data }) => {
createFlash({ message: data?.message, type: FLASH_TYPES.NOTICE });
})
.catch(err => {
.catch((err) => {
const { data: { message = __('Something went wrong') } = {} } = err.response;
createFlash({ message });
});
......@@ -445,7 +445,7 @@ export default {
},
},
})
.then(res => {
.then((res) => {
const createReqMutation = res?.data?.createRequirement || {};
if (createReqMutation.errors?.length === 0) {
......@@ -461,7 +461,7 @@ export default {
throw new Error(`Error creating a requirement ${res.message}`);
}
})
.catch(e => {
.catch((e) => {
createFlash({
message: __('Something went wrong while creating a requirement.'),
parent: this.$el,
......@@ -485,7 +485,7 @@ export default {
errorFlashMessage: __('Something went wrong while updating a requirement.'),
flashMessageContainer: this.$el,
})
.then(res => {
.then((res) => {
const updateReqMutation = res?.data?.updateRequirement || {};
if (updateReqMutation.errors?.length === 0) {
......@@ -512,7 +512,7 @@ export default {
? __('Something went wrong while reopening a requirement.')
: __('Something went wrong while archiving a requirement.'),
})
.then(res => {
.then((res) => {
const updateReqMutation = res?.data?.updateRequirement || {};
if (updateReqMutation.errors?.length === 0) {
......@@ -546,7 +546,7 @@ export default {
const authors = [];
let textSearch = '';
filters.forEach(filter => {
filters.forEach((filter) => {
if (typeof filter === 'string') {
textSearch = filter;
} else if (filter.value.data !== DEFAULT_LABEL_ANY.value) {
......
......@@ -24,7 +24,7 @@ export default () => {
{},
{
cacheConfig: {
dataIdFromObject: object =>
dataIdFromObject: (object) =>
// eslint-disable-next-line no-underscore-dangle, @gitlab/require-i18n-strings
object.__typename === 'Requirement' ? object.iid : defaultDataIdFromObject(object),
},
......
......@@ -68,7 +68,7 @@ export default {
},
epicsWithAssociatedParents() {
return this.epics.filter(
epic => !epic.hasParent || (epic.hasParent && this.epicIds.indexOf(epic.parent.id) < 0),
(epic) => !epic.hasParent || (epic.hasParent && this.epicIds.indexOf(epic.parent.id) < 0),
);
},
displayedEpics() {
......
......@@ -125,7 +125,7 @@ export default {
// b) Milestones Public API supports including child projects' milestones.
if (search) {
return {
data: data.filter(m => m.title.toLowerCase().includes(search.toLowerCase())),
data: data.filter((m) => m.title.toLowerCase().includes(search.toLowerCase())),
};
}
return { data };
......@@ -154,7 +154,7 @@ export default {
if (labelName?.length) {
filteredSearchValue.push(
...labelName.map(label => ({
...labelName.map((label) => ({
type: 'label_name',
value: { data: label },
})),
......@@ -217,7 +217,7 @@ export default {
const filterParams = filters.length ? {} : null;
const labels = [];
filters.forEach(filter => {
filters.forEach((filter) => {
if (typeof filter === 'object') {
switch (filter.type) {
case 'author_username':
......
......@@ -34,7 +34,7 @@ export default () => {
// This event handler is to be removed in 11.1 once
// we allow user to save selected preset in db
if (presetButtonsContainer) {
presetButtonsContainer.addEventListener('click', e => {
presetButtonsContainer.addEventListener('click', (e) => {
const presetType = e.target.querySelector('input[name="presetType"]').value;
visitUrl(mergeUrlParams({ layout: presetType }, window.location.href));
......
......@@ -155,7 +155,7 @@ export const fetchEpics = ({ state, commit, dispatch }) => {
commit(types.REQUEST_EPICS);
fetchGroupEpics(state)
.then(rawEpics => {
.then((rawEpics) => {
dispatch('receiveEpicsSuccess', { rawEpics });
})
.catch(() => dispatch('receiveEpicsFailure'));
......@@ -165,7 +165,7 @@ export const fetchEpicsForTimeframe = ({ state, commit, dispatch }, { timeframe
commit(types.REQUEST_EPICS_FOR_TIMEFRAME);
return fetchGroupEpics(state, timeframe)
.then(rawEpics => {
.then((rawEpics) => {
dispatch('receiveEpicsSuccess', {
rawEpics,
newEpic: true,
......@@ -210,7 +210,7 @@ export const toggleEpic = ({ state, dispatch }, { parentItem }) => {
if (!state.childrenEpics[parentItemId]) {
dispatch('requestChildrenEpics', { parentItemId });
fetchChildrenEpics(state, { parentItem })
.then(rawChildren => {
.then((rawChildren) => {
dispatch('receiveChildrenSuccess', {
parentItemId,
rawChildren,
......@@ -234,10 +234,10 @@ export const toggleEpic = ({ state, dispatch }, { parentItem }) => {
* so that the epic bars get longer to appear infinitely scrolling.
*/
export const refreshEpicDates = ({ commit, state, getters }) => {
const epics = state.epics.map(epic => {
const epics = state.epics.map((epic) => {
// Update child epic dates too
if (epic.children?.edges?.length > 0) {
epic.children.edges.map(childEpic =>
epic.children.edges.map((childEpic) =>
roadmapItemUtils.processRoadmapItemDates(
childEpic,
getters.timeframeStartDate,
......@@ -291,7 +291,7 @@ export const fetchMilestones = ({ state, dispatch }) => {
dispatch('requestMilestones');
return fetchGroupMilestones(state)
.then(rawMilestones => {
.then((rawMilestones) => {
dispatch('receiveMilestonesSuccess', { rawMilestones });
})
.catch(() => dispatch('receiveMilestonesFailure'));
......@@ -333,7 +333,7 @@ export const receiveMilestonesFailure = ({ commit }) => {
};
export const refreshMilestoneDates = ({ commit, state, getters }) => {
const milestones = state.milestones.map(milestone =>
const milestones = state.milestones.map((milestone) =>
roadmapItemUtils.processRoadmapItemDates(
milestone,
getters.timeframeStartDate,
......
......@@ -7,14 +7,14 @@ import { PRESET_TYPES, DAYS_IN_WEEK } from '../constants';
*
* @param {Object} state
*/
export const lastTimeframeIndex = state => state.timeframe.length - 1;
export const lastTimeframeIndex = (state) => state.timeframe.length - 1;
/**
* Returns first item of the timeframe array from state
*
* @param {Object} state
*/
export const timeframeStartDate = state => {
export const timeframeStartDate = (state) => {
if (state.presetType === PRESET_TYPES.QUARTERS) {
return state.timeframe[0].range[0];
}
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import * as types from './mutation_types';
const resetEpics = state => {
const resetEpics = (state) => {
state.epics = [];
state.childrenFlags = {};
state.epicIds = [];
......@@ -44,7 +44,7 @@ export default {
state.epicsFetchInProgress = false;
state.epicsFetchForTimeframeInProgress = false;
state.epicsFetchFailure = true;
Object.keys(state.childrenEpics).forEach(id => {
Object.keys(state.childrenEpics).forEach((id) => {
Vue.set(state.childrenFlags, id, {
itemChildrenFetchInProgress: false,
});
......@@ -60,7 +60,7 @@ export default {
},
[types.INIT_EPIC_CHILDREN_FLAGS](state, { epics }) {
epics.forEach(item => {
epics.forEach((item) => {
Vue.set(state.childrenFlags, item.id, {
itemExpanded: false,
itemChildrenFetchInProgress: false,
......
......@@ -22,8 +22,8 @@ export const flattenGroupProperty = ({ node: epicNode }) => ({
*
* @param {Object} edges
*/
export const extractGroupEpics = edges => edges.map(flattenGroupProperty);
export const extractGroupEpics = (edges) => edges.map(flattenGroupProperty);
export const addIsChildEpicTrueProperty = obj => ({ ...obj, isChildEpic: true });
export const addIsChildEpicTrueProperty = (obj) => ({ ...obj, isChildEpic: true });
export const generateKey = epic => `${epic.isChildEpic ? 'child-epic-' : 'epic-'}${epic.id}`;
export const generateKey = (epic) => `${epic.isChildEpic ? 'child-epic-' : 'epic-'}${epic.id}`;
......@@ -105,7 +105,7 @@ export const formatRoadmapItemDetails = (rawRoadmapItem, timeframeStartDate, tim
*
* @param {Object} group
*/
export const extractGroupMilestones = edges =>
export const extractGroupMilestones = (edges) =>
edges.map(({ node, milestoneNode = node }) => ({
...milestoneNode,
}));
......@@ -5,19 +5,19 @@ export default class DirtyFormChecker {
this.isDirty = false;
this.editableInputs = Array.from(this.form.querySelectorAll('input[name]')).filter(
el =>
(el) =>
(el.type !== 'submit' && el.type !== 'hidden') ||
el.classList.contains('js-project-feature-toggle-input'),
);
this.startingStates = {};
this.editableInputs.forEach(input => {
this.editableInputs.forEach((input) => {
this.startingStates[input.name] = input.value;
});
}
init() {
this.form.addEventListener('input', event => {
this.form.addEventListener('input', (event) => {
if (event.target.matches('input[name]')) {
this.recalculate();
}
......@@ -26,7 +26,7 @@ export default class DirtyFormChecker {
recalculate() {
const wasDirty = this.isDirty;
this.isDirty = this.editableInputs.some(input => {
this.isDirty = this.editableInputs.some((input) => {
const currentValue = input.value;
const startValue = this.startingStates[input.name];
......
......@@ -45,8 +45,8 @@ export default class SamlSettingsForm {
dependsOn: 'enforced-group-managed-accounts',
},
]
.filter(s => s.el)
.map(setting => ({
.filter((s) => s.el)
.map((setting) => ({
...setting,
toggle: getToggle(setting.el),
helperText: getHelperText(setting.el),
......@@ -60,7 +60,7 @@ export default class SamlSettingsForm {
}
findSetting(name) {
return this.settings.find(s => s.name === name);
return this.settings.find((s) => s.name === name);
}
getValueWithDeps(name) {
......@@ -92,7 +92,7 @@ export default class SamlSettingsForm {
}
updateSAMLSettings() {
this.settings = this.settings.map(setting => ({
this.settings = this.settings.map((setting) => ({
...setting,
value: parseBoolean(setting.el.querySelector('input').value),
}));
......@@ -112,8 +112,8 @@ export default class SamlSettingsForm {
updateToggles() {
this.settings
.filter(setting => setting.dependsOn)
.forEach(setting => {
.filter((setting) => setting.dependsOn)
.forEach((setting) => {
const { helperText, callout, toggle } = setting;
const isRelatedToggleOn = this.getValueWithDeps(setting.dependsOn);
if (helperText) {
......
......@@ -68,10 +68,10 @@ export default class SCIMTokenToggleArea {
this.toggleLoading();
return this.fetchNewToken()
.then(response => {
.then((response) => {
this.setTokenAndToggleSCIMForm(response.data);
})
.catch(error => {
.catch((error) => {
createFlash(error);
this.toggleLoading();
this.toggleFormVisibility(container);
......
......@@ -9,7 +9,7 @@ export default () => {
setHighlightClass();
// Supports Advanced (backed by Elasticsearch) Search highlighting
blobs.forEach(blob => {
blobs.forEach((blob) => {
const lines = blob.querySelectorAll('.line');
const dataHighlightLine = blob.querySelector('[data-highlight-line]');
if (dataHighlightLine) {
......
......@@ -49,7 +49,7 @@ export default {
// In this first iteration, the auto-fix settings is toggled for all features at once via a
// single checkbox. The line below is a temporary workaround to initialize the setting's state
// until we have distinct checkboxes for each auto-fixable feature.
const autoFixEnabled = Object.values(this.autoFixEnabled).some(enabled => enabled);
const autoFixEnabled = Object.values(this.autoFixEnabled).some((enabled) => enabled);
return {
autoFixEnabledLocal: autoFixEnabled,
isChecked: autoFixEnabled,
......@@ -75,7 +75,7 @@ export default {
this.autoFixEnabledLocal = enabled;
this.isChecked = enabled;
})
.catch(e => {
.catch((e) => {
Sentry.captureException(e);
createFlash(
__('Something went wrong while toggling auto-fix settings, please try again later.'),
......
......@@ -55,7 +55,7 @@ export default {
redirectTo(filePath);
})
.catch(error => {
.catch((error) => {
this.isCreatingMergeRequest = false;
createFlash(
s__('SecurityConfiguration|An error occurred while creating the merge request.'),
......
......@@ -141,7 +141,7 @@ export default {
variables: { after: pageInfo.endCursor },
updateQuery: cacheUtils.appendToPreviousResult(profileType),
})
.catch(error => {
.catch((error) => {
this.handleError({
profileType,
exception: error,
......@@ -199,7 +199,7 @@ export default {
},
optimisticResponse: deletion.optimisticResponse,
})
.catch(error => {
.catch((error) => {
this.handleError({
profileType,
exception: error,
......
......@@ -88,7 +88,7 @@ export default {
},
tableFields() {
const defaultClasses = ['gl-word-break-all'];
const dataFields = this.fields.map(key => ({ key, class: defaultClasses }));
const dataFields = this.fields.map((key) => ({ key, class: defaultClasses }));
const staticFields = [{ key: 'actions' }];
return [...dataFields, ...staticFields];
......
......@@ -9,7 +9,7 @@ import dastSiteProfilesQuery from 'ee/security_configuration/dast_profiles/graph
* @param {*} profileType
* @returns {function(*, {fetchMoreResult: *}): *}
*/
export const appendToPreviousResult = profileType => (previousResult, { fetchMoreResult }) => {
export const appendToPreviousResult = (profileType) => (previousResult, { fetchMoreResult }) => {
const newResult = { ...fetchMoreResult };
const previousEdges = previousResult.project[profileType].edges;
const newEdges = newResult.project[profileType].edges;
......@@ -30,7 +30,7 @@ export const appendToPreviousResult = profileType => (previousResult, { fetchMor
export const removeProfile = ({ profileId, profileType, store, queryBody }) => {
const sourceData = store.readQuery(queryBody);
const data = produce(sourceData, draftState => {
const data = produce(sourceData, (draftState) => {
// eslint-disable-next-line no-param-reassign
draftState.project[profileType].edges = draftState.project[profileType].edges.filter(
({ node }) => {
......
......@@ -201,7 +201,7 @@ export default {
}
},
)
.catch(e => {
.catch((e) => {
Sentry.captureException(e);
this.showErrors();
this.loading = false;
......
......@@ -157,7 +157,7 @@ export default {
}
},
)
.catch(exception => {
.catch((exception) => {
this.showErrors({ message: errorMessage });
this.captureException(exception);
this.isLoading = false;
......
......@@ -12,11 +12,11 @@ export const fetchSecurityConfiguration = ({ commit, state }) => {
method: 'GET',
url: state.securityConfigurationPath,
})
.then(response => {
.then((response) => {
const { data } = response;
commit(types.RECEIVE_SECURITY_CONFIGURATION_SUCCESS, data);
})
.catch(error => {
.catch((error) => {
Sentry.captureException(error);
commit(types.RECEIVE_SECURITY_CONFIGURATION_ERROR);
});
......
......@@ -87,7 +87,7 @@ export default {
redirectTo(successPath);
})
.catch(error => {
.catch((error) => {
this.isSubmitting = false;
this.hasSubmissionError = true;
Sentry.captureException(error);
......@@ -101,7 +101,7 @@ export default {
};
},
onAnalyzerChange(name, updatedAnalyzer) {
const index = this.analyzersConfiguration.findIndex(analyzer => analyzer.name === name);
const index = this.analyzersConfiguration.findIndex((analyzer) => analyzer.name === name);
if (index === -1) {
return;
}
......
......@@ -16,7 +16,7 @@ export default {
entities: {
type: Array,
required: true,
validator: value => value.every(isValidConfigurationEntity),
validator: (value) => value.every(isValidConfigurationEntity),
},
disabled: {
type: Boolean,
......
......@@ -35,7 +35,7 @@ export default {
type: String,
required: false,
default: LARGE,
validator: size => Object.keys(SCHEMA_TO_PROP_SIZE_MAP).includes(size),
validator: (size) => Object.keys(SCHEMA_TO_PROP_SIZE_MAP).includes(size),
},
label: {
type: String,
......
const isString = value => typeof value === 'string';
const isBoolean = value => typeof value === 'boolean';
const isString = (value) => typeof value === 'string';
const isBoolean = (value) => typeof value === 'boolean';
export const isValidConfigurationEntity = object => {
export const isValidConfigurationEntity = (object) => {
if (object == null) {
return false;
}
......@@ -18,7 +18,7 @@ export const isValidConfigurationEntity = object => {
);
};
export const isValidAnalyzerEntity = object => {
export const isValidAnalyzerEntity = (object) => {
if (object == null) {
return false;
}
......
......@@ -34,14 +34,14 @@ export default {
},
queryObject() {
// This is the object used to update the querystring.
return { [this.filter.id]: this.selectedOptionsOrAll.map(x => x.id) };
return { [this.filter.id]: this.selectedOptionsOrAll.map((x) => x.id) };
},
filterObject() {
// This is the object used by the GraphQL query.
return { [this.filter.id]: this.selectedOptions.map(x => x.id) };
return { [this.filter.id]: this.selectedOptions.map((x) => x.id) };
},
filteredOptions() {
return this.filter.options.filter(option =>
return this.filter.options.filter((option) =>
option.name.toLowerCase().includes(this.searchTerm.toLowerCase()),
);
},
......@@ -50,7 +50,7 @@ export default {
return Array.isArray(ids) ? ids : [ids];
},
routeQueryOptions() {
const options = this.filter.options.filter(x => this.routeQueryIds.includes(x.id));
const options = this.filter.options.filter((x) => this.routeQueryIds.includes(x.id));
const hasAllId = this.routeQueryIds.includes(this.filter.allOption.id);
if (options.length && !hasAllId) {
......
......@@ -73,7 +73,7 @@ export default {
this.$apollo.queries.vulnerabilities.fetchMore({
variables: { after: this.pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => {
const results = produce(fetchMoreResult, draftData => {
const results = produce(fetchMoreResult, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.group.vulnerabilities.nodes = [
...previousResult.group.vulnerabilities.nodes,
......
......@@ -69,7 +69,7 @@ export default {
this.$apollo.queries.vulnerabilities.fetchMore({
variables: { after: this.pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => {
const results = produce(fetchMoreResult, draftData => {
const results = produce(fetchMoreResult, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.vulnerabilities.nodes = [
...previousResult.vulnerabilities.nodes,
......
......@@ -60,7 +60,7 @@ export default {
const isProjectSelected = this.selectedProjects.some(({ id }) => id === project.id);
if (isProjectSelected) {
this.selectedProjects = this.selectedProjects.filter(p => p.id !== project.id);
this.selectedProjects = this.selectedProjects.filter((p) => p.id !== project.id);
} else {
this.selectedProjects.push(project);
}
......@@ -68,7 +68,7 @@ export default {
addProjects() {
this.$emit('handleProjectManipulation', true);
const addProjectsPromises = this.selectedProjects.map(project => {
const addProjectsPromises = this.selectedProjects.map((project) => {
return this.$apollo
.mutate({
mutation: addProjectToSecurityDashboard,
......@@ -81,7 +81,7 @@ export default {
const sourceData = store.readQuery({ query: projectsQuery });
const newProject = results.addProjectToSecurityDashboard.project;
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.instanceSecurityDashboard.projects.nodes = [
...draftData.instanceSecurityDashboard.projects.nodes,
......@@ -112,8 +112,8 @@ export default {
});
return Promise.all(addProjectsPromises)
.then(response => {
const invalidProjects = response.filter(value => value.error);
.then((response) => {
const invalidProjects = response.filter((value) => value.error);
this.$emit('handleProjectManipulation', false);
if (invalidProjects.length) {
......@@ -156,10 +156,10 @@ export default {
update(store) {
const sourceData = store.readQuery({ query: projectsQuery });
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.instanceSecurityDashboard.projects.nodes = draftData.instanceSecurityDashboard.projects.nodes.filter(
curr => curr.id !== id,
(curr) => curr.id !== id,
);
});
......@@ -188,7 +188,7 @@ export default {
}
return this.searchProjects(this.searchQuery, this.pageInfo)
.then(payload => {
.then((payload) => {
const {
data: {
projects: { nodes, pageInfo },
......
......@@ -53,7 +53,7 @@ export default {
SEVERITY_LEVELS.high,
SEVERITY_LEVELS.medium,
SEVERITY_LEVELS.low,
].map(l => l.toLowerCase()),
].map((l) => l.toLowerCase()),
apollo: {
vulnerabilitiesHistory: {
query() {
......@@ -87,7 +87,7 @@ export default {
charts() {
const { severityLevels } = this.$options;
return severityLevels.map(severityLevel => {
return severityLevels.map((severityLevel) => {
const history = Object.entries(this.vulnerabilitiesHistory[severityLevel] || {});
const chartData = history.length ? history : this.emptyDataSet;
const [pastCount, currentCount] = firstAndLastY(chartData);
......@@ -135,7 +135,7 @@ export default {
const vulnerabilitiesData = vulnerabilitiesCountByDay.nodes.reduce(
(acc, v) => {
const { date, ...severities } = v;
Object.keys(severities).forEach(severity => {
Object.keys(severities).forEach((severity) => {
acc[severity] = acc[severity] || {};
acc[severity][date] = v[severity];
}, {});
......@@ -150,7 +150,7 @@ export default {
acc[severity] = {};
Object.keys(vulnerabilitiesData[severity])
.sort()
.forEach(day => {
.forEach((day) => {
acc[severity][day] = vulnerabilitiesData[severity][day];
}, {});
......
......@@ -74,7 +74,7 @@ export default {
},
computed: {
severityGroups() {
return SEVERITY_GROUPS.map(group => ({
return SEVERITY_GROUPS.map((group) => ({
...group,
projects: this.findProjectsForGroup(group),
}));
......@@ -86,7 +86,7 @@ export default {
return [];
}
return this.vulnerabilityGrades[group.type].map(project => ({
return this.vulnerabilityGrades[group.type].map((project) => ({
...project,
mostSevereVulnerability: this.findMostSevereVulnerabilityForGroup(project, group),
}));
......@@ -94,7 +94,7 @@ export default {
findMostSevereVulnerabilityForGroup(project, group) {
const mostSevereVulnerability = {};
SEVERITY_LEVELS_ORDERED_BY_SEVERITY.some(level => {
SEVERITY_LEVELS_ORDERED_BY_SEVERITY.some((level) => {
if (!group.severityLevels.includes(level)) {
return false;
}
......
......@@ -27,7 +27,7 @@ export default {
errorCode: {
type: Number,
required: true,
validator: value => Object.values(ERROR_CODES).includes(value),
validator: (value) => Object.values(ERROR_CODES).includes(value),
},
illustrations: {
type: Object,
......
......@@ -90,11 +90,11 @@ export default {
},
}));
this.trendsByDay.forEach(trend => {
this.trendsByDay.forEach((trend) => {
const { date, ...severities } = trend;
SEVERITIES.forEach(({ key }) => {
series.find(s => s.key === key).data.push([date, severities[key]]);
series.find((s) => s.key === key).data.push([date, severities[key]]);
});
});
......
......@@ -51,7 +51,7 @@ export default {
let fulfilledCount = 0;
let rejectedCount = 0;
const promises = this.selectedVulnerabilities.map(vulnerability =>
const promises = this.selectedVulnerabilities.map((vulnerability) =>
this.$apollo
.mutate({
mutation: vulnerabilityDismiss,
......
......@@ -19,7 +19,7 @@ export default {
},
computed: {
buttonContent() {
return days => n__('1 Day', '%d Days', days);
return (days) => n__('1 Day', '%d Days', days);
},
},
methods: {
......
......@@ -12,7 +12,7 @@ export default {
scope: {
type: String,
required: true,
validator: value => Object.values(vulnerabilitiesSeverityCountScopes).includes(value),
validator: (value) => Object.values(vulnerabilitiesSeverityCountScopes).includes(value),
},
fullPath: {
type: String,
......
......@@ -31,7 +31,7 @@ export default {
},
computed: {
counts() {
return SEVERITIES.map(severity => ({
return SEVERITIES.map((severity) => ({
severity,
count: this.vulnerabilitiesCount[severity] || 0,
}));
......
......@@ -97,7 +97,7 @@ export default {
// through the bulk update feature, but no longer matches the filters. For more details:
// https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43468#note_420050017
filteredVulnerabilities() {
return this.vulnerabilities.filter(x =>
return this.vulnerabilities.filter((x) =>
this.filters.state?.length ? this.filters.state.includes(x.state) : true,
);
},
......@@ -106,7 +106,7 @@ export default {
},
hasAnyScannersOtherThanGitLab() {
return this.filteredVulnerabilities.some(
v => v.scanner?.vendor !== 'GitLab' && v.scanner?.vendor !== '',
(v) => v.scanner?.vendor !== 'GitLab' && v.scanner?.vendor !== '',
);
},
notEnabledSecurityScanners() {
......@@ -192,7 +192,7 @@ export default {
}
// Apply gl-bg-white! to every header.
baseFields.forEach(field => {
baseFields.forEach((field) => {
field.thClass = [field.thClass, 'gl-bg-white!']; // eslint-disable-line no-param-reassign
});
......@@ -204,9 +204,9 @@ export default {
this.selectedVulnerabilities = {};
},
filteredVulnerabilities() {
const ids = new Set(this.filteredVulnerabilities.map(v => v.id));
const ids = new Set(this.filteredVulnerabilities.map((v) => v.id));
Object.keys(this.selectedVulnerabilities).forEach(vulnerabilityId => {
Object.keys(this.selectedVulnerabilities).forEach((vulnerabilityId) => {
if (!ids.has(vulnerabilityId)) {
this.$delete(this.selectedVulnerabilities, vulnerabilityId);
}
......
......@@ -5,14 +5,14 @@ import { VULNERABILITY_STATES } from 'ee/vulnerabilities/constants';
import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
import { s__, __ } from '~/locale';
const parseOptions = obj =>
const parseOptions = (obj) =>
Object.entries(obj).map(([id, name]) => ({ id: id.toUpperCase(), name }));
export const mapProjects = projects =>
projects.map(p => ({ id: p.id.split('/').pop(), name: p.name }));
export const mapProjects = (projects) =>
projects.map((p) => ({ id: p.id.split('/').pop(), name: p.name }));
const stateOptions = parseOptions(VULNERABILITY_STATES);
const defaultStateOptions = stateOptions.filter(x => ['DETECTED', 'CONFIRMED'].includes(x.id));
const defaultStateOptions = stateOptions.filter((x) => ['DETECTED', 'CONFIRMED'].includes(x.id));
export const stateFilter = {
name: s__('SecurityReports|Status'),
......@@ -38,7 +38,7 @@ export const scannerFilter = {
defaultOptions: [],
};
export const getProjectFilter = projects => {
export const getProjectFilter = (projects) => {
return {
name: s__('SecurityReports|Project'),
id: 'projectId',
......@@ -92,7 +92,7 @@ export const getFormattedSummary = (rawSummary = {}) => {
return name ? [name, scanSummary] : null;
});
// Filter out keys that could not be matched with any translation and are thus considered invalid
return formattedEntries.filter(entry => entry !== null);
return formattedEntries.filter((entry) => entry !== null);
};
/**
......@@ -103,7 +103,7 @@ export const getFormattedSummary = (rawSummary = {}) => {
* @param {Object} pageInfo
* @returns {Object}
*/
export const preparePageInfo = pageInfo => {
export const preparePageInfo = (pageInfo) => {
return { ...pageInfo, hasNextPage: Boolean(pageInfo?.endCursor) };
};
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import apolloProvider from './graphql/provider';
import InstanceSecurityDashboardSettings from './components/first_class_instance_security_dashboard_settings.vue';
export default el => {
export default (el) => {
if (!el) {
return null;
}
......
......@@ -7,8 +7,8 @@ import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
export const setFilter = ({ commit }, filter) => {
// Convert the filter key to snake case and the selected option IDs to lower case. The API
// endpoint needs them to be in this format.
const convertedFilter = mapValues(convertObjectPropsToSnakeCase(filter), array =>
array.map(element => element.toLowerCase()),
const convertedFilter = mapValues(convertObjectPropsToSnakeCase(filter), (array) =>
array.map((element) => element.toLowerCase()),
);
commit(SET_FILTER, convertedFilter);
......
......@@ -29,11 +29,11 @@ export const fetchPipelineJobs = ({ commit, state }) => {
}
return requestPromise
.then(response => {
.then((response) => {
const { data } = response;
commit(types.RECEIVE_PIPELINE_JOBS_SUCCESS, data);
})
.catch(error => {
.catch((error) => {
Sentry.captureException(error);
commit(types.RECEIVE_PIPELINE_JOBS_ERROR);
});
......
import { FUZZING_STAGE } from './constants';
export const hasFuzzingArtifacts = state => {
return state.pipelineJobs.some(job => {
export const hasFuzzingArtifacts = (state) => {
return state.pipelineJobs.some((job) => {
return job.stage === FUZZING_STAGE && job.artifacts.length > 0;
});
};
export const fuzzingJobsWithArtifact = state => {
return state.pipelineJobs.filter(job => {
export const fuzzingJobsWithArtifact = (state) => {
return state.pipelineJobs.filter((job) => {
return job.stage === FUZZING_STAGE && job.artifacts.length > 0;
});
};
......@@ -37,9 +37,9 @@ export const addProjects = ({ state, dispatch }) => {
return axios
.post(state.projectEndpoints.add, {
project_ids: state.selectedProjects.map(p => p.id),
project_ids: state.selectedProjects.map((p) => p.id),
})
.then(response => dispatch('receiveAddProjectsSuccess', response.data))
.then((response) => dispatch('receiveAddProjectsSuccess', response.data))
.catch(() => dispatch('receiveAddProjectsError'))
.finally(() => dispatch('clearSearchResults'));
};
......@@ -55,8 +55,8 @@ export const receiveAddProjectsSuccess = ({ commit, 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,
......@@ -154,7 +154,7 @@ export const fetchSearchResults = ({ state, dispatch, commit }) => {
}
return searchProjects(searchQuery)
.then(payload => commit(types.RECEIVE_SEARCH_RESULTS_SUCCESS, payload))
.then((payload) => commit(types.RECEIVE_SEARCH_RESULTS_SUCCESS, payload))
.catch(() => dispatch('receiveSearchResultsError'));
};
......
......@@ -9,12 +9,12 @@ export default {
state.searchQuery = query;
},
[types.SELECT_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.DESELECT_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_ADD_PROJECTS](state) {
state.isAddingProjects = true;
......
......@@ -18,7 +18,7 @@ const groupPageInfo = ({ page, nextPage, total, totalPages }) => ({
* @param {{headers}} res
* @returns {*}
*/
const getHeaders = res => res.headers;
const getHeaders = (res) => res.headers;
/**
* Takes an XHR-response object and returns an object containing pagination related
......@@ -36,6 +36,6 @@ const pageInfo = flow(getHeaders, normalizeHeaders, parseIntPagination, groupPag
* @param {Object} res
* @return {Object}
*/
const addPageInfo = res => (res?.headers ? { ...res, ...pageInfo(res) } : res);
const addPageInfo = (res) => (res?.headers ? { ...res, ...pageInfo(res) } : res);
export default addPageInfo;
......@@ -35,7 +35,7 @@ export const fetchProjects = ({ state, dispatch }) => {
dispatch('requestProjects');
getAllProjects(state.projectsEndpoint)
.then(projects => {
.then((projects) => {
dispatch('receiveProjectsSuccess', { projects });
})
.catch(() => {
......
......@@ -14,7 +14,7 @@ export const fetchUnscannedProjects = ({ dispatch }, endpoint) => {
return axios
.get(endpoint)
.then(({ data }) => data.map(convertObjectPropsToCamelCase))
.then(data => {
.then((data) => {
dispatch('receiveUnscannedProjectsSuccess', data);
})
.catch(() => {
......
......@@ -9,7 +9,7 @@ export const untestedProjectsCount = (state, getters) => getters.untestedProject
export const outdatedProjects = ({ projects }) =>
groupByDateRanges({
ranges: UNSCANNED_PROJECTS_DATE_RANGES,
dateFn: x => x.securityTestsLastSuccessfulRun,
dateFn: (x) => x.securityTestsLastSuccessfulRun,
projects,
});
......
......@@ -6,7 +6,7 @@ import { getDayDifference, isValidDate } from '~/lib/utils/datetime_utility';
* @param daysInPast {number}
* @returns {function({fromDay: Number, toDay: Number}): boolean}
*/
const isWithinDateRange = daysInPast => ({ fromDay, toDay }) =>
const isWithinDateRange = (daysInPast) => ({ fromDay, toDay }) =>
daysInPast >= fromDay && daysInPast < toDay;
/**
......@@ -15,7 +15,7 @@ const isWithinDateRange = daysInPast => ({ fromDay, toDay }) =>
* @param ranges {*}[]
* @returns {{projects: []}}[]
*/
const withEmptyProjectsArray = ranges => ranges.map(range => ({ ...range, projects: [] }));
const withEmptyProjectsArray = (ranges) => ranges.map((range) => ({ ...range, projects: [] }));
/**
* Checks if a given group-object has any projects
......@@ -23,7 +23,7 @@ const withEmptyProjectsArray = ranges => ranges.map(range => ({ ...range, projec
* @param group {{ projects: [] }}
* @returns {boolean}
*/
const hasProjects = group => group.projects.length > 0;
const hasProjects = (group) => group.projects.length > 0;
/**
* Takes an array of objects and groups them based on the given ranges
......
......@@ -47,11 +47,11 @@ export const fetchVulnerabilities = ({ state, dispatch }, params = {}) => {
url: state.vulnerabilitiesEndpoint,
params,
})
.then(response => {
.then((response) => {
const { headers, data } = response;
dispatch('receiveVulnerabilitiesSuccess', { headers, data });
})
.catch(error => {
.catch((error) => {
dispatch('receiveVulnerabilitiesError', error?.response?.status);
});
};
......@@ -65,7 +65,7 @@ export const receiveVulnerabilitiesSuccess = ({ commit }, { headers, data }) =>
const pageInfo = parseIntPagination(normalizedHeaders);
// Vulnerabilities on pipelines don't have IDs.
// We need to add dummy IDs here to avoid rendering issues.
const vulnerabilities = data.map(vulnerability => ({
const vulnerabilities = data.map((vulnerability) => ({
...vulnerability,
id: vulnerability.id || _.uniqueId('client_'),
}));
......@@ -147,7 +147,7 @@ export const dismissSelectedVulnerabilities = ({ dispatch, state }, { comment }
dispatch('requestDismissSelectedVulnerabilities');
const promises = dismissableVulnerabilties.map(vulnerability =>
const promises = dismissableVulnerabilties.map((vulnerability) =>
axios.post(vulnerability.create_vulnerability_feedback_dismissal_path, {
vulnerability_feedback: {
category: vulnerability.report_type,
......
import { LOADING_VULNERABILITIES_ERROR_CODES } from './constants';
export const dashboardError = state =>
export const dashboardError = (state) =>
state.errorLoadingVulnerabilities && state.errorLoadingVulnerabilitiesCount;
export const dashboardListError = state =>
export const dashboardListError = (state) =>
state.errorLoadingVulnerabilities && !state.errorLoadingVulnerabilitiesCount;
export const dashboardCountError = state =>
export const dashboardCountError = (state) =>
!state.errorLoadingVulnerabilities && state.errorLoadingVulnerabilitiesCount;
export const loadingVulnerabilitiesFailedWithRecognizedErrorCode = state =>
export const loadingVulnerabilitiesFailedWithRecognizedErrorCode = (state) =>
state.errorLoadingVulnerabilities &&
Object.values(LOADING_VULNERABILITIES_ERROR_CODES).includes(
state.loadingVulnerabilitiesErrorCode,
);
export const selectedVulnerabilitiesCount = state =>
export const selectedVulnerabilitiesCount = (state) =>
Object.keys(state.selectedVulnerabilities).length;
export const isSelectingVulnerabilities = (state, getters) =>
......
......@@ -76,7 +76,7 @@ export default {
Vue.set(state.modal, 'error', null);
},
[types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](state, payload) {
const vulnerability = state.vulnerabilities.find(vuln =>
const vulnerability = state.vulnerabilities.find((vuln) =>
isSameVulnerability(vuln, payload.vulnerability),
);
vulnerability.dismissal_feedback = payload.data;
......@@ -125,7 +125,7 @@ export default {
Vue.set(state.modal, 'error', null);
},
[types.RECEIVE_ADD_DISMISSAL_COMMENT_SUCCESS](state, payload) {
const vulnerability = state.vulnerabilities.find(vuln =>
const vulnerability = state.vulnerabilities.find((vuln) =>
isSameVulnerability(vuln, payload.vulnerability),
);
if (vulnerability) {
......@@ -143,7 +143,7 @@ export default {
Vue.set(state.modal, 'error', null);
},
[types.RECEIVE_DELETE_DISMISSAL_COMMENT_SUCCESS](state, payload) {
const vulnerability = state.vulnerabilities.find(vuln => vuln.id === payload.id);
const vulnerability = state.vulnerabilities.find((vuln) => vuln.id === payload.id);
if (vulnerability) {
vulnerability.dismissal_feedback = payload.data;
state.isDismissingVulnerability = false;
......@@ -159,7 +159,7 @@ export default {
Vue.set(state.modal, 'error', null);
},
[types.RECEIVE_REVERT_DISMISSAL_SUCCESS](state, payload) {
const vulnerability = state.vulnerabilities.find(vuln =>
const vulnerability = state.vulnerabilities.find((vuln) =>
isSameVulnerability(vuln, payload.vulnerability),
);
vulnerability.dismissal_feedback = null;
......
import { isEqual } from 'lodash';
const isVulnerabilityLike = object =>
const isVulnerabilityLike = (object) =>
Boolean(object && object.location && object.identifiers && object.identifiers[0]);
/**
......
......@@ -15,7 +15,7 @@ export const fetchProjects = ({ dispatch }, endpoint) => {
return axios
.get(endpoint)
.then(({ data }) => data.map(convertObjectPropsToCamelCase))
.then(data => {
.then((data) => {
dispatch('receiveProjectsSuccess', data);
})
.catch(() => {
......
......@@ -8,7 +8,7 @@ export const severityGroups = ({ projects }) => {
);
// return an array of severity groups, each containing an array of projects match the groups criteria
return SEVERITY_GROUPS.map(severityGroup => ({
return SEVERITY_GROUPS.map((severityGroup) => ({
...severityGroup,
projects: projectsForSeverityGroup(projectsWithSeverityInformation, severityGroup),
}));
......
......@@ -16,7 +16,7 @@ export const vulnerabilityCount = (project, severityLevel) =>
* @param project
* @returns {function(*=): boolean}
*/
export const hasVulnerabilityWithSeverityLevel = project => severityLevel =>
export const hasVulnerabilityWithSeverityLevel = (project) => (severityLevel) =>
vulnerabilityCount(project, severityLevel) > 0;
/**
......@@ -45,7 +45,7 @@ export const mostSevereVulnerability = (severityLevelsOrderedBySeverity, project
* @param severityLevelsInOrder
* @returns {function(*=): {mostSevereVulnerability: *}}
*/
export const addMostSevereVulnerabilityInformation = severityLevelsInOrder => project => ({
export const addMostSevereVulnerabilityInformation = (severityLevelsInOrder) => (project) => ({
...project,
mostSevereVulnerability: mostSevereVulnerability(severityLevelsInOrder, project),
});
......
......@@ -2,8 +2,8 @@ import { SET_FILTER, SET_HIDE_DISMISSED } from '../modules/filters/mutation_type
const refreshTypes = [`filters/${SET_FILTER}`, `filters/${SET_HIDE_DISMISSED}`];
export default store => {
const refreshVulnerabilities = payload => {
export default (store) => {
const refreshVulnerabilities = (payload) => {
store.dispatch('vulnerabilities/fetchVulnerabilities', payload);
};
......
......@@ -7,8 +7,8 @@ import { s__, sprintf } from '~/locale';
* @param {Array} invalidProjects all the projects that failed to be added
* @returns {String} the invalid projects formated in a user-friendly way
*/
export const createInvalidProjectMessage = invalidProjects => {
const [firstProject, secondProject, ...rest] = invalidProjects.map(project => project.name);
export const createInvalidProjectMessage = (invalidProjects) => {
const [firstProject, secondProject, ...rest] = invalidProjects.map((project) => project.name);
const translationValues = {
firstProject,
secondProject,
......
......@@ -36,7 +36,7 @@ export default {
return {
isDropdownShowing: false,
selectedStatus: this.status,
statusOptions: Object.keys(healthStatusTextMap).map(key => ({
statusOptions: Object.keys(healthStatusTextMap).map((key) => ({
key,
value: healthStatusTextMap[key],
})),
......
......@@ -46,7 +46,7 @@ export default {
return {
isDropdownShowing: false,
selectedStatus: this.status,
statusOptions: Object.keys(healthStatusTextMap).map(key => ({
statusOptions: Object.keys(healthStatusTextMap).map((key) => ({
key,
value: healthStatusTextMap[key],
})),
......
......@@ -12,7 +12,7 @@ import { store } from '~/notes/stores';
Vue.use(VueApollo);
const mountWeightComponent = mediator => {
const mountWeightComponent = (mediator) => {
const el = document.querySelector('.js-sidebar-weight-entry-point');
if (!el) return false;
......@@ -22,7 +22,7 @@ const mountWeightComponent = mediator => {
components: {
SidebarWeight,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-weight', {
props: {
mediator,
......@@ -31,7 +31,7 @@ const mountWeightComponent = mediator => {
});
};
const mountStatusComponent = mediator => {
const mountStatusComponent = (mediator) => {
const el = document.querySelector('.js-sidebar-status-entry-point');
if (!el) {
......@@ -44,7 +44,7 @@ const mountStatusComponent = mediator => {
components: {
SidebarStatus,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-status', {
props: {
mediator,
......@@ -66,7 +66,7 @@ const mountEpicsSelect = () => {
components: {
SidebarItemEpicsSelect,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-item-epics-select', {
props: {
sidebarStore,
......@@ -97,7 +97,7 @@ function mountIterationSelect() {
components: {
IterationSelect,
},
render: createElement =>
render: (createElement) =>
createElement('iteration-select', {
props: {
groupPath,
......
......@@ -23,7 +23,7 @@ export default class SidebarMediator extends CESidebarMediator {
this.store.setWeight(data.weight);
this.store.setLoadingState('weight', false);
})
.catch(err => {
.catch((err) => {
this.store.setLoadingState('weight', false);
throw err;
});
......@@ -39,7 +39,7 @@ export default class SidebarMediator extends CESidebarMediator {
}
this.store.setStatus(data?.updateIssue?.issue?.healthStatus);
})
.catch(error => {
.catch((error) => {
throw error;
})
.finally(() => this.store.setFetchingState('status', false));
......
......@@ -34,7 +34,7 @@ export const updateStatusPageSettings = ({ state, dispatch, commit }) => {
},
})
.then(() => dispatch('receiveStatusPageSettingsUpdateSuccess'))
.catch(error => dispatch('receiveStatusPageSettingsUpdateError', error))
.catch((error) => dispatch('receiveStatusPageSettingsUpdateError', error))
.finally(() => commit(mutationTypes.LOADING, false));
};
......
......@@ -6,7 +6,7 @@ import mutations from './mutations';
Vue.use(Vuex);
export default initialState =>
export default (initialState) =>
new Vuex.Store({
state: createState(initialState),
actions,
......
......@@ -64,7 +64,7 @@ export default {
<gl-search-box-by-type
:placeholder="__('Search by name')"
:debounce="$options.searchDebounceValue"
@input="input => this.$emit('search', input)"
@input="(input) => this.$emit('search', input)"
/>
</div>
</template>
......
......@@ -84,7 +84,7 @@ export default {
size: uploadsSize,
},
]
.filter(data => data.size !== 0)
.filter((data) => data.size !== 0)
.sort((a, b) => b.size - a.size);
},
},
......
......@@ -5,7 +5,7 @@ import { STORAGE_USAGE_THRESHOLDS } from './constants';
export function usageRatioToThresholdLevel(currentUsageRatio) {
let currentLevel = Object.keys(STORAGE_USAGE_THRESHOLDS)[0];
Object.keys(STORAGE_USAGE_THRESHOLDS).forEach(thresholdLevel => {
Object.keys(STORAGE_USAGE_THRESHOLDS).forEach((thresholdLevel) => {
if (currentUsageRatio >= STORAGE_USAGE_THRESHOLDS[thresholdLevel])
currentLevel = thresholdLevel;
});
......@@ -23,7 +23,7 @@ export function usageRatioToThresholdLevel(currentUsageRatio) {
* @param {Number} size size in bytes
* @returns {String}
*/
export const formatUsageSize = size => {
export const formatUsageSize = (size) => {
const formatDecimalBytes = getFormatter(SUPPORTED_FORMATS.kibibytes);
return formatDecimalBytes(bytesToKiB(size), 1);
};
......@@ -86,7 +86,7 @@ export const parseProjects = ({
additionalPurchasedStorageSize - totalRepositorySizeExcess,
);
return projects.nodes.map(project =>
return projects.nodes.map((project) =>
calculateUsedAndRemStorage(project, purchasedStorageRemaining),
);
};
......@@ -103,7 +103,7 @@ export const parseProjects = ({
* @param {Object} data graphql result
* @returns {Object}
*/
export const parseGetStorageResults = data => {
export const parseGetStorageResults = (data) => {
const {
namespace: {
projects,
......
......@@ -49,7 +49,7 @@ export const fetchCountries = ({ dispatch }) =>
.catch(() => dispatch('fetchCountriesError'));
export const fetchCountriesSuccess = ({ commit }, data = []) => {
const countries = data.map(country => ({ text: country[0], value: country[1] }));
const countries = data.map((country) => ({ text: country[0], value: country[1] }));
commit(types.UPDATE_COUNTRY_OPTIONS, countries);
};
......@@ -71,7 +71,7 @@ export const fetchStates = ({ state, dispatch }) => {
};
export const fetchStatesSuccess = ({ commit }, data = {}) => {
const states = Object.keys(data).map(state => ({ text: state, value: data[state] }));
const states = Object.keys(data).map((state) => ({ text: state, value: data[state] }));
commit(types.UPDATE_STATE_OPTIONS, states);
};
......
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