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