Commit a536349d authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 42 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 6f0bd2d8
......@@ -37,7 +37,7 @@ export default {
projectPath: this.projectFullPath,
title: issuableTitle,
description: issuableDescription,
labelIds: selectedLabels.map(label => label.id),
labelIds: selectedLabels.map((label) => label.id),
},
},
})
......@@ -48,7 +48,7 @@ export default {
}
redirectTo(this.projectTestCasesPath);
})
.catch(error => {
.catch((error) => {
createFlash({
message: s__('TestCases|Something went wrong while creating a test case.'),
captureError: true,
......
......@@ -24,6 +24,6 @@ export function initTestCaseCreate({ mountPointSelector }) {
provide: {
...mountPointEl.dataset,
},
render: createElement => createElement(TestCaseCreateApp),
render: (createElement) => createElement(TestCaseCreateApp),
});
}
......@@ -252,7 +252,7 @@ export default {
if (labelName?.length) {
filteredSearchValue.push(
...labelName.map(label => ({
...labelName.map((label) => ({
type: 'label_name',
value: { data: label },
})),
......@@ -290,7 +290,7 @@ export default {
const labels = [];
const plainText = [];
filters.forEach(filter => {
filters.forEach((filter) => {
switch (filter.type) {
case 'author_username':
filterParams.authorUsername = filter.value.data;
......
......@@ -52,7 +52,7 @@ const initTestCaseList = ({ mountPointSelector }) => {
initialState,
initialSortBy,
},
render: createElement =>
render: (createElement) =>
createElement(TestCaseListApp, {
props: {
initialFilterParams,
......
......@@ -76,7 +76,7 @@ export default {
return todos.length ? todos[0] : null;
},
selectedLabels() {
return this.testCase.labels.nodes.map(label => ({
return this.testCase.labels.nodes.map((label) => ({
...label,
id: getIdFromGraphQLId(label.id),
}));
......@@ -91,7 +91,7 @@ export default {
},
errorMessage: s__('TestCases|Something went wrong while updating the test case.'),
})
.then(updatedTestCase => {
.then((updatedTestCase) => {
this.testCase = updatedTestCase;
})
.finally(() => {
......@@ -110,7 +110,7 @@ export default {
},
errorMessage: s__('TestCases|Something went wrong while updating the test case.'),
})
.then(updatedTestCase => {
.then((updatedTestCase) => {
this.testCase = updatedTestCase;
this.editTestCaseFormVisible = false;
IssuableEventHub.$emit('update.issuable');
......
......@@ -130,9 +130,9 @@ export default {
// either selected or removed aren't leading to same selection
// as current one, as then we don't want to make network call
// since nothing has changed.
const anyLabelUpdated = labels.some(label => {
const anyLabelUpdated = labels.some((label) => {
// Find this label in existing selection.
const existingLabel = this.selectedLabels.find(l => l.id === label.id);
const existingLabel = this.selectedLabels.find((l) => l.id === label.id);
// Check either of the two following conditions;
// 1. A label that's not currently applied is being applied.
......@@ -146,12 +146,12 @@ export default {
return this.updateTestCase({
variables: {
addLabelIds: labels.filter(label => label.set).map(label => label.id),
removeLabelIds: labels.filter(label => !label.set).map(label => label.id),
addLabelIds: labels.filter((label) => label.set).map((label) => label.id),
removeLabelIds: labels.filter((label) => !label.set).map((label) => label.id),
},
errorMessage: s__('TestCases|Something went wrong while updating the test case labels.'),
})
.then(updatedTestCase => {
.then((updatedTestCase) => {
this.$emit('test-case-updated', updatedTestCase);
})
.finally(() => {
......
......@@ -63,7 +63,7 @@ export default {
}
return data.updateIssue?.issue;
})
.catch(error => {
.catch((error) => {
createFlash({
message: errorMessage,
captureError: true,
......@@ -81,7 +81,7 @@ export default {
.then(() => {
this.$apollo.queries.testCase.refetch();
})
.catch(error => {
.catch((error) => {
createFlash({
message: s__('TestCases|Something went wrong while adding test case to Todo.'),
captureError: true,
......@@ -110,7 +110,7 @@ export default {
}
this.$apollo.queries.testCase.refetch();
})
.catch(error => {
.catch((error) => {
createFlash({
message: s__('TestCases|Something went wrong while marking test case todo as done.'),
captureError: true,
......@@ -143,7 +143,7 @@ export default {
}
visitUrl(data.issueMove?.issue.webUrl);
})
.catch(error => {
.catch((error) => {
this.testCaseMoveInProgress = false;
createFlash({
message: s__('TestCases|Something went wrong while moving test case.'),
......
......@@ -29,6 +29,6 @@ export default function initTestCaseShow({ mountPointSelector }) {
projectsFetchPath: sidebarOptions.projectsAutocompleteEndpoint,
canEditTestCase: parseBoolean(el.dataset.canEditTestCase),
},
render: createElement => createElement(TestCaseShowApp),
render: (createElement) => createElement(TestCaseShowApp),
});
}
......@@ -99,7 +99,7 @@ export default {
this.$apollo.queries.alerts.fetchMore({
variables: { nextPageCursor: this.pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => {
const results = produce(fetchMoreResult, draftData => {
const results = produce(fetchMoreResult, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.alertManagementAlerts.nodes = [
...previousResult.project.alertManagementAlerts.nodes,
......
......@@ -58,7 +58,7 @@ export default {
selectedPolicy() {
if (!this.hasSelectedPolicy) return null;
return this.policiesWithDefaults.find(policy => policy.name === this.selectedPolicyName);
return this.policiesWithDefaults.find((policy) => policy.name === this.selectedPolicyName);
},
hasPolicyChanges() {
if (!this.hasSelectedPolicy) return false;
......@@ -69,7 +69,7 @@ export default {
);
},
hasAutoDevopsPolicy() {
return this.policiesWithDefaults.some(policy => policy.isAutodevops);
return this.policiesWithDefaults.some((policy) => policy.isAutodevops);
},
hasCiliumSelectedPolicy() {
return this.hasSelectedPolicy
......
......@@ -27,7 +27,7 @@ function ruleTypeEndpointFunc(items) {
const labels = items
.reduce(
(acc, { matchLabels }) =>
acc.concat(Object.keys(matchLabels).map(key => `${key}:${matchLabels[key]}`)),
acc.concat(Object.keys(matchLabels).map((key) => `${key}:${matchLabels[key]}`)),
[],
)
.join(' ');
......@@ -125,10 +125,10 @@ export default function fromYaml(manifest) {
const rules = []
.concat(
ingress.map(item => parseRule(item, RuleDirectionInbound)),
egress.map(item => parseRule(item, RuleDirectionOutbound)),
ingress.map((item) => parseRule(item, RuleDirectionInbound)),
egress.map((item) => parseRule(item, RuleDirectionOutbound)),
)
.filter(rule => Boolean(rule));
.filter((rule) => Boolean(rule));
return {
name,
......
......@@ -37,7 +37,7 @@ function humanizeNetworkPolicyRulePorts(rule) {
function humanizeNetworkPolicyRuleEndpoint({ matchLabels }) {
const matchSelector = labelSelector(matchLabels);
const labels = Object.keys(matchSelector)
.map(key => `${key}: ${matchSelector[key]}`)
.map((key) => `${key}: ${matchSelector[key]}`)
.join(', ');
return labels.length === 0
? sprintf(s__('NetworkPolicies|%{strongOpen}all%{strongClose} pods'), strongArgs, false)
......@@ -104,7 +104,7 @@ function humanizeEndpointSelector({ endpointMatchMode, endpointLabels }) {
const selector = labelSelector(endpointLabels);
const pods = Object.keys(selector)
.map(key => `${key}: ${selector[key]}`)
.map((key) => `${key}: ${selector[key]}`)
.join(', ');
return sprintf(
s__('NetworkPolicies|pods %{pods}'),
......@@ -124,7 +124,7 @@ export default function humanizeNetworkPolicy(policy) {
const selector = humanizeEndpointSelector(policy);
const humanizedRules = rules.map(rule => {
const humanizedRules = rules.map((rule) => {
const { direction } = rule;
const template =
direction === RuleDirectionInbound
......
......@@ -67,7 +67,7 @@ function ruleFQDNSpec({ direction, fqdn }) {
if (fqdnList.length === 0) return {};
return {
toFQDNs: fqdnList.map(item => ({ matchName: item })),
toFQDNs: fqdnList.map((item) => ({ matchName: item })),
};
}
......
......@@ -12,7 +12,7 @@ function spec({ rules, isEnabled, endpointMatchMode, endpointLabels }) {
const policySpec = {};
policySpec.endpointSelector = Object.keys(matchLabels).length > 0 ? { matchLabels } : {};
rules.forEach(rule => {
rules.forEach((rule) => {
const { direction } = rule;
if (!policySpec[direction]) policySpec[direction] = [];
......
......@@ -36,5 +36,5 @@ export function portSelectors({ portMatchMode, ports }) {
Expects items in format "0.0.0.0/24 1.1.1.1/32"
*/
export function splitItems(items) {
return items.split(/\s/).filter(item => item.length > 0);
return items.split(/\s/).filter((item) => item.length > 0);
}
......@@ -40,7 +40,7 @@ export default {
const { value } = this;
let entitiesList = [];
if (value.includes(entity)) {
entitiesList = value.filter(e => e !== entity);
entitiesList = value.filter((e) => e !== entity);
} else {
entitiesList = [...value, entity];
}
......@@ -61,7 +61,7 @@ export default {
return value.includes(entity);
},
},
entities: Object.keys(EntityTypes).map(type => ({
entities: Object.keys(EntityTypes).map((type) => ({
value: EntityTypes[type],
text: EntityTypes[type],
})),
......
......@@ -67,7 +67,7 @@ export default {
name: TIME,
type: 'time',
axisLabel: {
formatter: value => dateFormat(value, DATE_FORMATS.defaultDate),
formatter: (value) => dateFormat(value, DATE_FORMATS.defaultDate),
},
min: from,
max: to,
......
......@@ -11,11 +11,11 @@ export default () =>
new Vuex.Store({
modules: {
threatMonitoring: threatMonitoring(),
threatMonitoringWaf: threatMonitoringStatistics(payload => {
threatMonitoringWaf: threatMonitoringStatistics((payload) => {
const { totalTraffic, anomalousTraffic, history } = convertObjectPropsToCamelCase(payload);
return { total: totalTraffic, anomalous: anomalousTraffic, history };
}),
threatMonitoringNetworkPolicy: threatMonitoringStatistics(payload => {
threatMonitoringNetworkPolicy: threatMonitoringStatistics((payload) => {
const {
opsRate,
opsTotal: { total, drops },
......
......@@ -59,7 +59,7 @@ export const createPolicy = ({ state, commit }, { environmentId, policy }) => {
FLASH_TYPES.SUCCESS,
);
})
.catch(error =>
.catch((error) =>
commitPolicyError(commit, types.RECEIVE_CREATE_POLICY_ERROR, error?.response?.data),
);
};
......@@ -89,7 +89,7 @@ export const updatePolicy = ({ state, commit }, { environmentId, policy }) => {
FLASH_TYPES.SUCCESS,
);
})
.catch(error =>
.catch((error) =>
commitPolicyError(commit, types.RECEIVE_UPDATE_POLICY_ERROR, error?.response?.data),
);
};
......@@ -113,7 +113,7 @@ export const deletePolicy = ({ state, commit }, { environmentId, policy }) => {
policy,
});
})
.catch(error =>
.catch((error) =>
commitPolicyError(commit, types.RECEIVE_DELETE_POLICY_ERROR, error?.response?.data),
);
};
......@@ -6,7 +6,7 @@ export const policiesWithDefaults = ({ policies }) => {
// filter out enabled predefined policies and only append the ones
// that are not present in a cluster.
const predefined = PREDEFINED_NETWORK_POLICIES.filter(
({ name }) => !policies.some(policy => name === policy.name),
({ name }) => !policies.some((policy) => name === policy.name),
);
return [...policies, ...predefined];
};
......@@ -2,7 +2,7 @@ import * as types from './mutation_types';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
const setPolicies = (state, policies) => {
state.policies = policies.map(policy => convertObjectPropsToCamelCase(policy));
state.policies = policies.map((policy) => convertObjectPropsToCamelCase(policy));
};
export default {
......@@ -43,7 +43,7 @@ export default {
},
[types.RECEIVE_UPDATE_POLICY_SUCCESS](state, { policy, updatedPolicy }) {
const newPolicy = convertObjectPropsToCamelCase(updatedPolicy);
state.policies = state.policies.map(pol => (pol.name === policy.name ? newPolicy : pol));
state.policies = state.policies.map((pol) => (pol.name === policy.name ? newPolicy : pol));
state.isUpdatingPolicy = false;
state.errorUpdatingPolicy = false;
},
......
......@@ -35,7 +35,7 @@ const getAllEnvironments = (url, page = 1) =>
const nextPage = headers && headers['x-next-page'];
return nextPage
? // eslint-disable-next-line promise/no-nesting
getAllEnvironments(url, nextPage).then(environments => [
getAllEnvironments(url, nextPage).then((environments) => [
...data.environments,
...environments,
])
......@@ -50,7 +50,7 @@ export const fetchEnvironments = ({ state, dispatch }) => {
dispatch('requestEnvironments');
return getAllEnvironments(state.environmentsEndpoint)
.then(environments => dispatch('receiveEnvironmentsSuccess', environments))
.then((environments) => dispatch('receiveEnvironmentsSuccess', environments))
.catch(() => dispatch('receiveEnvironmentsError'));
};
......
......@@ -33,7 +33,7 @@ export const fetchStatistics = ({ state, dispatch, rootState }) => {
},
})
.then(({ data }) => dispatch('receiveStatisticsSuccess', data))
.catch(error => {
.catch((error) => {
// A NOT_FOUND response from the endpoint means that there is no data for
// the given parameters. There are various reasons *why* there could be
// no data, but we can't distinguish between them, yet. So, just render
......
......@@ -3,7 +3,7 @@ import * as getters from './getters';
import mutations from './mutations';
import state from './state';
export default transformFunc => ({
export default (transformFunc) => ({
namespaced: true,
actions,
getters,
......
import * as types from './mutation_types';
import createState from './state';
export default transformFunc => ({
export default (transformFunc) => ({
[types.SET_ENDPOINT](state, endpoint) {
state.statisticsEndpoint = endpoint;
},
......
import { pick } from 'lodash';
import { getTimeWindow, defaultTimeRange } from '~/vue_shared/constants';
export const getTimeWindowConfig = timeWindow => {
export const getTimeWindowConfig = (timeWindow) => {
const timeWindowObj = pick(getTimeWindow(timeWindow) || defaultTimeRange, 'duration', 'interval');
return {
durationInMilliseconds: timeWindowObj.duration.seconds * 1000,
......
import ipaddr from 'ipaddr.js';
export default address => {
export default (address) => {
// Reject IP addresses that are only integers to match Ruby IPAddr
// https://github.com/whitequark/ipaddr.js/issues/7#issuecomment-158545695
if (/^\d+$/.exec(address)) {
......
......@@ -39,7 +39,7 @@ export default {
return this.mr.approvals || {};
},
approvedBy() {
return this.approvals.approved_by ? this.approvals.approved_by.map(x => x.user) : [];
return this.approvals.approved_by ? this.approvals.approved_by.map((x) => x.user) : [];
},
approvalsRequired() {
return (!this.isBasic && this.approvals.approvals_required) || 0;
......@@ -76,7 +76,7 @@ export default {
this.isLoadingRules = true;
return this.service.fetchApprovalSettings().then(settings => {
return this.service.fetchApprovalSettings().then((settings) => {
this.mr.setApprovalRules(settings);
this.isLoadingRules = false;
});
......
......@@ -38,20 +38,20 @@ export default {
{
id: uniqueId(),
title: '',
rules: this.approvalRules.filter(rule => rule.rule_type !== RULE_TYPE_CODE_OWNER),
rules: this.approvalRules.filter((rule) => rule.rule_type !== RULE_TYPE_CODE_OWNER),
},
{
id: uniqueId(),
title: __('Code Owners'),
rules: orderBy(
this.approvalRules
.filter(rule => rule.rule_type === RULE_TYPE_CODE_OWNER)
.map(rule => ({ ...rule, nameClass: 'gl-font-monospace gl-word-break-all' })),
[o => o.section === 'codeowners', 'name', 'section'],
.filter((rule) => rule.rule_type === RULE_TYPE_CODE_OWNER)
.map((rule) => ({ ...rule, nameClass: 'gl-font-monospace gl-word-break-all' })),
[(o) => o.section === 'codeowners', 'name', 'section'],
['desc', 'asc', 'asc'],
),
},
].filter(x => x.rules.length);
].filter((x) => x.rules.length);
},
},
methods: {
......
......@@ -35,7 +35,7 @@ export default {
},
unmergedBlockingMergeRequests() {
return Object.keys(this.visibleMergeRequests)
.filter(state => state !== 'merged')
.filter((state) => state !== 'merged')
.reduce(
(unmergedBlockingMRs, state) =>
state === 'closed'
......
......@@ -77,7 +77,7 @@ export default {
/* eslint-enable no-useless-escape */
},
filteredChanges() {
return this.changes.filter(change => change.path.includes(this.changesSearchTerm));
return this.changes.filter((change) => change.path.includes(this.changesSearchTerm));
},
instructionText() {
return {
......
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