Commit aa653d5a authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 37 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 96ed4677
......@@ -1020,40 +1020,6 @@ ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/type_of_work/actions.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
## stoic-einstein
ee/app/assets/javascripts/epic/store/actions.js
ee/app/assets/javascripts/epic/store/mutations.js
ee/app/assets/javascripts/epic/utils/epic_utils.js
ee/app/assets/javascripts/event_tracking/navbar.js
ee/app/assets/javascripts/filtered_search/dropdown_weight.js
ee/app/assets/javascripts/filtered_search/filtered_search_manager.js
ee/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
ee/app/assets/javascripts/geo_node_form/components/geo_node_form_capacities.vue
ee/app/assets/javascripts/geo_node_form/components/geo_node_form_namespaces.vue
ee/app/assets/javascripts/geo_node_form/components/geo_node_form_shards.vue
ee/app/assets/javascripts/geo_node_form/store/actions.js
ee/app/assets/javascripts/geo_node_form/store/getters.js
ee/app/assets/javascripts/geo_node_form/validations.js
ee/app/assets/javascripts/geo_nodes/components/app.vue
ee/app/assets/javascripts/geo_nodes/components/node_detail_sections/node_details_section_main.vue
ee/app/assets/javascripts/geo_nodes/store/geo_nodes_store.js
ee/app/assets/javascripts/geo_replicable/graphql/replicable_type_query_builder.js
ee/app/assets/javascripts/geo_replicable/store/actions.js
ee/app/assets/javascripts/geo_replicable/store/getters.js
ee/app/assets/javascripts/geo_replicable/store/index.js
ee/app/assets/javascripts/geo_settings/store/getters.js
ee/app/assets/javascripts/geo_settings/store/state.js
ee/app/assets/javascripts/geo_settings/validations.js
ee/app/assets/javascripts/gfm_auto_complete.js
ee/app/assets/javascripts/group_member_contributions/store/group_member_store.js
ee/app/assets/javascripts/groups/members/utils.js
ee/app/assets/javascripts/groups/settings/access_restriction_field/validate_ip_address.js
ee/app/assets/javascripts/groups/settings/compliance_frameworks/components/list.vue
ee/app/assets/javascripts/groups/settings/compliance_frameworks/init_list.js
ee/app/assets/javascripts/groups/settings/components/comma_separated_list_token_selector.vue
ee/app/assets/javascripts/insights/components/insights.vue
ee/app/assets/javascripts/insights/components/insights_chart.vue
## pedantic-noether
ee/app/assets/javascripts/insights/stores/modules/insights/actions.js
ee/app/assets/javascripts/insights/stores/modules/insights/helpers.js
......
......@@ -29,7 +29,7 @@ export const fetchEpicDetails = ({ state, dispatch }) => {
variables,
})
.then(({ data }) => {
const participants = data.group.epic.participants.edges.map(participant => ({
const participants = data.group.epic.participants.edges.map((participant) => ({
name: participant.node.name,
avatar_url: participant.node.avatarUrl,
web_url: participant.node.webUrl,
......@@ -218,7 +218,7 @@ export const updateConfidentialityOnIssuable = ({ state, commit }, { confidentia
throw errMsg;
}
})
.catch(error => {
.catch((error) => {
flash(error);
throw error;
});
......@@ -235,8 +235,8 @@ export const receiveEpicLabelsSelectFailure = ({ commit }) => {
flash(s__('Epics|An error occurred while updating labels.'));
};
export const updateEpicLabels = ({ dispatch, state }, labels) => {
const addLabelIds = labels.filter(label => label.set).map(label => label.id);
const removeLabelIds = labels.filter(label => !label.set).map(label => label.id);
const addLabelIds = labels.filter((label) => label.set).map((label) => label.id);
const removeLabelIds = labels.filter((label) => !label.set).map((label) => label.id);
const updateEpicInput = {
iid: `${state.epicIid}`,
groupPath: state.fullPath,
......
......@@ -110,9 +110,9 @@ export default {
state.epicLabelsSelectInProgress = true;
},
[types.RECEIVE_EPIC_LABELS_SELECT_SUCCESS](state, labels) {
const addedLabels = labels.filter(label => label.set);
const removeLabelIds = labels.filter(label => !label.set).map(label => label.id);
const updatedLabels = state.labels.filter(label => !removeLabelIds.includes(label.id));
const addedLabels = labels.filter((label) => label.set);
const removeLabelIds = labels.filter((label) => !label.set).map((label) => label.id);
const updatedLabels = state.labels.filter((label) => !removeLabelIds.includes(label.id));
updatedLabels.push(...addedLabels);
state.epicLabelsSelectInProgress = false;
......
......@@ -24,7 +24,7 @@ const bindDocumentEvent = (eventName, callback) => {
$(document).on(eventName, callback);
};
const toggleContainerClass = className => {
const toggleContainerClass = (className) => {
const containerEl = document.querySelector('.page-with-contextual-sidebar');
if (containerEl) {
......@@ -34,7 +34,7 @@ const toggleContainerClass = className => {
const getCollapsedGutter = () => parseBoolean(Cookies.get('collapsed_gutter'));
const setCollapsedGutter = value => Cookies.set('collapsed_gutter', value);
const setCollapsedGutter = (value) => Cookies.set('collapsed_gutter', value);
const getDateValidity = (startDateTime, dueDateTime) => {
// If both dates are defined
......
......@@ -9,7 +9,7 @@ const NAVSOURCE_VALUE = 'navbar';
* intercepts clicks on navbar links
* and adds the 'nav_source=navbar' query parameter
*/
const appendLinkParam = e => {
const appendLinkParam = (e) => {
const target = e.currentTarget;
// get closest link in case the target is a wrapping DOM node
......@@ -28,8 +28,8 @@ export default function trackNavbarEvents() {
if (!navbar) return;
// track search inputs within frequent-items component
navbar.querySelectorAll(`.frequent-items-dropdown-container input`).forEach(el => {
el.addEventListener('click', e => {
navbar.querySelectorAll(`.frequent-items-dropdown-container input`).forEach((el) => {
el.addEventListener('click', (e) => {
const parentDropdown = e.currentTarget.closest('li.dropdown');
Tracking.event(TRACKING_CATEGORY, 'activate_form_input', {
......
......@@ -16,7 +16,7 @@ export default class DropdownWeight extends FilteredSearchDropdown {
}
itemClicked(e) {
super.itemClicked(e, selected => {
super.itemClicked(e, (selected) => {
const title = selected.querySelector('.js-data-value').innerText.trim();
return `${DropdownUtils.getEscapedText(title)}`;
});
......@@ -25,7 +25,7 @@ export default class DropdownWeight extends FilteredSearchDropdown {
renderContent(forceShowList = false) {
this.droplab.changeHookList(this.hookId, this.dropdown, [CustomNumber], this.config);
const defaultDropdownOptions = this.defaultOptions.map(o => ({ id: o, title: o }));
const defaultDropdownOptions = this.defaultOptions.map((o) => ({ id: o, title: o }));
this.droplab.setData(defaultDropdownOptions);
super.renderContent(forceShowList);
......
......@@ -6,7 +6,7 @@ export default class extends FilteredSearchManager {
const { tokens, ...rest } = super.getSearchTokens();
const hasEqualsToEpicIdToken = tokens.some(
token =>
(token) =>
token?.key === epicTokenKey.key &&
token?.operator === '=' &&
!Number.isNaN(Number(token?.value)),
......
......@@ -120,7 +120,7 @@ export const iterationConditions = [
*/
class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys {
constructor() {
const milestoneTokenKeyIndex = tokenKeys.findIndex(tk => tk.key === 'milestone');
const milestoneTokenKeyIndex = tokenKeys.findIndex((tk) => tk.key === 'milestone');
tokenKeys.splice(milestoneTokenKeyIndex + 1, 0, iterationTokenKey);
super([...tokenKeys, epicTokenKey, weightTokenKey], alternativeTokenKeys, [
......@@ -135,7 +135,7 @@ class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys {
* Changes assignee token to accept multiple values.
*/
enableMultipleAssignees() {
const assigneeTokenKey = this.tokenKeys.find(tk => tk.key === 'assignee');
const assigneeTokenKey = this.tokenKeys.find((tk) => tk.key === 'assignee');
// Add the original as an alternative token key
this.tokenKeysWithAlternative.push({ ...assigneeTokenKey });
......@@ -153,7 +153,7 @@ class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys {
}
removeToken(tokenKey) {
const index = this.tokenKeys.findIndex(token => token.key === tokenKey.key);
const index = this.tokenKeys.findIndex((token) => token.key === tokenKey.key);
if (index >= 0) {
this.tokenKeys.splice(index, 1);
}
......
......@@ -57,7 +57,7 @@ export default {
computed: {
...mapState(['formErrors']),
visibleFormGroups() {
return this.formGroups.filter(group => {
return this.formGroups.filter((group) => {
if (group.conditional) {
return this.nodeData.primary
? group.conditional === 'primary'
......
......@@ -32,7 +32,7 @@ export default {
methods: {
...mapActions(['fetchSyncNamespaces']),
toggleNamespace(namespace) {
const index = this.selectedNamespaces.findIndex(id => id === namespace.id);
const index = this.selectedNamespaces.findIndex((id) => id === namespace.id);
if (index > -1) {
this.$emit('removeSyncOption', { key: SELECTIVE_SYNC_NAMESPACES, index });
} else {
......
......@@ -34,7 +34,7 @@ export default {
},
methods: {
toggleShard(shard) {
const index = this.selectedShards.findIndex(value => value === shard.value);
const index = this.selectedShards.findIndex((value) => value === shard.value);
if (index > -1) {
this.$emit('removeSyncOption', { key: SELECTIVE_SYNC_SHARDS, index });
} else {
......
......@@ -6,13 +6,13 @@ import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
import { __ } from '~/locale';
import * as types from './mutation_types';
const getSaveErrorMessageParts = messages => {
const getSaveErrorMessageParts = (messages) => {
return flatten(
Object.entries(messages || {}).map(([key, value]) => value.map(x => `${key} ${x}`)),
Object.entries(messages || {}).map(([key, value]) => value.map((x) => `${key} ${x}`)),
);
};
const getSaveErrorMessage = messages => {
const getSaveErrorMessage = (messages) => {
const parts = getSaveErrorMessageParts(messages);
return `${__('Errors:')} ${parts.join(', ')}`;
};
......@@ -29,7 +29,7 @@ export const fetchSyncNamespaces = ({ dispatch }, search) => {
dispatch('requestSyncNamespaces');
Api.groups(search)
.then(res => {
.then((res) => {
dispatch('receiveSyncNamespacesSuccess', res);
})
.catch(() => {
......
export const formHasError = state => Object.values(state.formErrors).some(val => Boolean(val));
export const formHasError = (state) => Object.values(state.formErrors).some((val) => Boolean(val));
import { sprintf, s__ } from '~/locale';
import { isSafeURL } from '~/lib/utils/url_utility';
export const validateName = data => {
export const validateName = (data) => {
if (!data) {
return s__("Geo|Node name can't be blank");
} else if (data.length > 255) {
......@@ -11,7 +11,7 @@ export const validateName = data => {
return '';
};
export const validateUrl = data => {
export const validateUrl = (data) => {
if (!data) {
return s__("Geo|URL can't be blank");
} else if (!isSafeURL(data)) {
......
......@@ -89,8 +89,8 @@ export default {
fetchGeoNodes() {
return this.service
.getGeoNodes()
.then(res => res.data)
.then(nodes => {
.then((res) => res.data)
.then((nodes) => {
this.store.setNodes(nodes);
this.isLoading = false;
})
......@@ -103,8 +103,8 @@ export default {
const nodeId = node.id;
return this.service
.getGeoNodeDetails(node)
.then(res => res.data)
.then(nodeDetails => {
.then((res) => res.data)
.then((nodeDetails) => {
const primaryNodeVersion = this.store.getPrimaryNodeVersion();
const updatedNodeDetails = Object.assign(nodeDetails, {
primaryVersion: primaryNodeVersion.version,
......@@ -113,7 +113,7 @@ export default {
this.store.setNodeDetails(nodeId, updatedNodeDetails);
eventHub.$emit('nodeDetailsLoaded', this.store.getNodeDetails(nodeId));
})
.catch(err => {
.catch((err) => {
this.store.setNodeDetails(nodeId, {
geo_node_id: nodeId,
health: err.message,
......@@ -142,8 +142,8 @@ export default {
this.setNodeActionStatus(targetNode, true);
return this.service
.toggleNode(targetNode)
.then(res => res.data)
.then(node => {
.then((res) => res.data)
.then((node) => {
Object.assign(targetNode, {
enabled: node.enabled,
nodeActionActive: false,
......
......@@ -61,7 +61,7 @@ export default {
if (selectiveSyncType === 'namespaces') {
return sprintf(__('Groups (%{groups})'), {
groups: this.nodeDetails.namespaces.map(n => n.full_path).join(', '),
groups: this.nodeDetails.namespaces.map((n) => n.full_path).join(', '),
});
}
......
......@@ -11,7 +11,7 @@ export default class GeoNodesStore {
}
setNodes(nodes) {
this.state.nodes = nodes.map(node => GeoNodesStore.formatNode(node));
this.state.nodes = nodes.map((node) => GeoNodesStore.formatNode(node));
}
getNodes() {
......@@ -67,7 +67,7 @@ export default class GeoNodesStore {
}
static formatNodeDetails(rawNodeDetails, replicableTypes) {
const syncStatuses = replicableTypes.map(replicable => {
const syncStatuses = replicableTypes.map((replicable) => {
return {
itemEnabled: rawNodeDetails[`${replicable.namePlural}_replication_enabled`],
itemTitle: replicable.titlePlural,
......@@ -87,7 +87,7 @@ export default class GeoNodesStore {
});
// Adds replicable to array as long as value is defined
const verificationStatuses = syncStatuses.filter(s =>
const verificationStatuses = syncStatuses.filter((s) =>
Boolean(
!isNil(s.itemValue.verificationSuccessCount) ||
!isNil(s.itemValue.verificationFailureCount),
......@@ -95,7 +95,7 @@ export default class GeoNodesStore {
);
// Adds replicable to array as long as value is defined
const checksumStatuses = syncStatuses.filter(s =>
const checksumStatuses = syncStatuses.filter((s) =>
Boolean(!isNil(s.itemValue.checksumSuccessCount) || !isNil(s.itemValue.checksumFailureCount)),
);
......
import gql from 'graphql-tag';
import PageInfo from '~/graphql_shared/fragments/pageInfo.fragment.graphql';
export default graphQlFieldName => {
export default (graphQlFieldName) => {
return gql`
query($first: Int, $last: Int, $before: String!, $after: String!) {
geoNode {
......
......@@ -54,7 +54,7 @@ export const fetchReplicableItemsGraphQl = ({ state, dispatch }, direction) => {
query: buildReplicableTypeQuery(state.graphqlFieldName),
variables: { first, last, before, after },
})
.then(res => {
.then((res) => {
if (!res.data.geoNode || !(state.graphqlFieldName in res.data.geoNode)) {
dispatch('receiveReplicableItemsSuccess', { data: [], pagination: null });
return;
......@@ -86,7 +86,7 @@ export const fetchReplicableItemsRestful = ({ state, dispatch }) => {
};
Api.getGeoReplicableItems(state.replicableType, query)
.then(res => {
.then((res) => {
const normalizedHeaders = normalizeHeaders(res.headers);
const pagination = parseIntPagination(normalizedHeaders);
const data = convertObjectPropsToCamelCase(res.data, { deep: true });
......
export const replicableTypeName = state => state.replicableType.split('_').join(' ');
export const replicableTypeName = (state) => state.replicableType.split('_').join(' ');
......@@ -14,5 +14,5 @@ export const getStoreConfig = ({ replicableType, graphqlFieldName }) => ({
state: createState({ replicableType, graphqlFieldName }),
});
const createStore = config => new Vuex.Store(getStoreConfig(config));
const createStore = (config) => new Vuex.Store(getStoreConfig(config));
export default createStore;
export const formHasError = state =>
export const formHasError = (state) =>
Object.keys(state.formErrors)
.map(key => state.formErrors[key])
.some(val => Boolean(val));
.map((key) => state.formErrors[key])
.some((val) => Boolean(val));
......@@ -5,6 +5,6 @@ export default () => ({
timeout: DEFAULT_TIMEOUT,
allowedIp: DEFAULT_ALLOWED_IP,
formErrors: Object.keys(FORM_VALIDATION_FIELDS)
.map(key => FORM_VALIDATION_FIELDS[key])
.map((key) => FORM_VALIDATION_FIELDS[key])
.reduce((acc, cur) => ({ ...acc, [cur]: '' }), {}),
});
import validateIpAddress from 'ee/validators/ip_address';
import { s__ } from '~/locale';
const validateIP = data => {
const validateIP = (data) => {
let addresses = data.replace(/\s/g, '').split(',');
addresses = addresses.map(address => validateIpAddress(address));
addresses = addresses.map((address) => validateIpAddress(address));
return !addresses.some(a => !a);
return !addresses.some((a) => !a);
};
export const validateTimeout = data => {
export const validateTimeout = (data) => {
if (!data && data !== 0) {
return s__("Geo|Connection timeout can't be blank");
} else if (data && Number.isNaN(Number(data))) {
......@@ -21,7 +21,7 @@ export const validateTimeout = data => {
return '';
};
export const validateAllowedIp = data => {
export const validateAllowedIp = (data) => {
if (!data) {
return s__("Geo|Allowed Geo IP can't be blank");
} else if (data.length > 255) {
......
......@@ -41,7 +41,7 @@ class GfmAutoCompleteEE extends GfmAutoComplete {
callbacks: {
...defaultCallbacks,
beforeSave(merges) {
return $.map(merges, m => {
return $.map(merges, (m) => {
if (m.title == null) {
return m;
}
......@@ -75,7 +75,7 @@ class GfmAutoCompleteEE extends GfmAutoComplete {
callbacks: {
...defaultCallbacks,
beforeSave(merges) {
return merges.map(m => {
return merges.map((m) => {
if (m.title == null) {
return m;
}
......
......@@ -37,7 +37,7 @@ export default class GroupMemberStore {
}
setMembers(rawMembers) {
this.state.members = rawMembers.map(rawMember => GroupMemberStore.formatMember(rawMember));
this.state.members = rawMembers.map((rawMember) => GroupMemberStore.formatMember(rawMember));
}
sortMembers(sortByColumn) {
......@@ -67,13 +67,13 @@ export default class GroupMemberStore {
fetchContributedMembers() {
return axios
.get(this.memberContributionsPath)
.then(res => res.data)
.then(members => {
.then((res) => res.data)
.then((members) => {
this.setColumns(COLUMNS);
this.setMembers(members);
this.state.isLoading = false;
})
.catch(e => {
.catch((e) => {
this.state.isLoading = false;
Flash(__('Something went wrong while fetching group member contributions'));
throw e;
......
import { parseDataAttributes as CEParseDataAttributes } from '~/groups/members/utils';
export const parseDataAttributes = el => {
export const parseDataAttributes = (el) => {
const { ldapOverridePath } = el.dataset;
return {
......
import validateIpAddress from 'ee/validators/ip_address';
import { __, sprintf } from '~/locale';
export default address => {
export default (address) => {
if (!validateIpAddress(address)) {
return sprintf(__('%{address} is an invalid IP address range'), { address });
}
......
......@@ -46,7 +46,7 @@ export default {
const nodes = data.namespace?.complianceFrameworks?.nodes;
return (
nodes?.map(framework => ({
nodes?.map((framework) => ({
...framework,
parsedId: getIdFromGraphQLId(framework.id),
})) || []
......
......@@ -10,7 +10,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
const createComplianceFrameworksListApp = el => {
const createComplianceFrameworksListApp = (el) => {
if (!el) {
return false;
}
......
......@@ -71,7 +71,7 @@ export default {
},
watch: {
selectedTokens(newValue) {
this.$options.hiddenInput.value = newValue.map(token => token.name).join(',');
this.$options.hiddenInput.value = newValue.map((token) => token.name).join(',');
// Dispatch `input` event so form submit button becomes active
this.$options.hiddenInput.dispatchEvent(
......
......@@ -44,11 +44,11 @@ export default {
};
},
hasAllChartsLoaded() {
const requestedChartKeys = this.activePage?.charts?.map(chart => chart.title) || [];
return requestedChartKeys.every(key => this.chartData[key]?.loaded);
const requestedChartKeys = this.activePage?.charts?.map((chart) => chart.title) || [];
return requestedChartKeys.every((key) => this.chartData[key]?.loaded);
},
hasChartsError() {
return Object.values(this.chartData).some(data => data.error);
return Object.values(this.chartData).some((data) => data.error);
},
pageLoading() {
return !this.hasChartsError && !this.hasAllChartsLoaded;
......@@ -71,7 +71,7 @@ export default {
}
}
return Object.keys(configData).map(key => ({
return Object.keys(configData).map((key) => ({
name: configData[key].title,
scope: key,
isActive: this.activeTab === key,
......
......@@ -100,12 +100,12 @@ export default {
methods: {
setSvg(name) {
return getSvgIconPathContent(name)
.then(path => {
.then((path) => {
if (path) {
this.$set(this.svgs, name, `path://${path}`);
}
})
.catch(e => {
.catch((e) => {
// eslint-disable-next-line no-console, @gitlab/require-i18n-strings
console.error('SVG could not be rendered correctly: ', e);
});
......
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