Commit d53974df authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 38 files - 40 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 81853752
...@@ -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);
} }
......
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