Commit 81853752 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 39 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
......@@ -13,7 +13,7 @@ const addScheduleToStore = (store, query, { oncallSchedule: schedule }, variable
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
draftData.project.incidentManagementOncallSchedules.nodes.push(schedule);
});
......@@ -35,7 +35,7 @@ const deleteScheduleFromStore = (store, query, { oncallScheduleDestroy }, variab
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.incidentManagementOncallSchedules.nodes = draftData.project.incidentManagementOncallSchedules.nodes.filter(
({ id }) => id !== schedule.id,
......@@ -60,7 +60,7 @@ const updateScheduleFromStore = (store, query, { oncallScheduleUpdate }, variabl
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.incidentManagementOncallSchedules.nodes = [
...draftData.project.incidentManagementOncallSchedules.nodes,
......
......@@ -11,7 +11,7 @@ import { getDateInFuture } from '~/lib/utils/datetime_utility';
*
* @returns {String}
*/
export const getFormattedTimezone = tz => {
export const getFormattedTimezone = (tz) => {
return sprintf(__('(UTC %{offset}) %{timezone}'), {
offset: tz.formatted_offset,
timezone: `${tz.abbr} ${tz.name}`,
......
......@@ -16,12 +16,12 @@ export default class CiTemplate {
selectable: true,
filterable: true,
allowClear: true,
toggleLabel: item => item.name,
toggleLabel: (item) => item.name,
search: {
fields: ['name'],
},
clicked: clickEvent => this.updateInputValue(clickEvent),
text: item => item.name,
clicked: (clickEvent) => this.updateInputValue(clickEvent),
text: (item) => item.name,
});
this.setDropdownToggle();
......
......@@ -29,7 +29,7 @@ const getDropdownConfig = (placeholder, apiPath, textProp) => ({
},
results(data) {
return {
results: data.map(entity => ({
results: data.map((entity) => ({
id: entity.id,
text: entity[textProp],
})),
......@@ -45,7 +45,7 @@ const $container = $('#js-elasticsearch-settings');
$container
.find('.js-limit-checkbox')
.on('change', e =>
.on('change', (e) =>
onLimitCheckboxChange(
e.currentTarget.checked,
$container.find('.js-limit-namespaces'),
......
......@@ -27,7 +27,7 @@ const getDropdownConfig = (placeholder, url) => ({
},
results(data) {
return {
results: data.map(entity => ({
results: data.map((entity) => ({
id: entity.source_id,
text: entity.path,
})),
......@@ -44,7 +44,7 @@ const $container = $('#js-elasticsearch-settings');
$container
.find('.js-limit-checkbox')
.on('change', e =>
.on('change', (e) =>
onLimitCheckboxChange(
e.currentTarget.checked,
$container.find('.js-limit-namespaces'),
......
......@@ -4,7 +4,7 @@ import { sprintf, __ } from '~/locale';
import { sanitizeItem } from '~/frequent_items/utils';
import { loadCSSFile } from '~/lib/utils/css_utils';
const formatResult = selectedItem => {
const formatResult = (selectedItem) => {
if (selectedItem.path_with_namespace) {
return `<div class='project-result'> <div class='project-name'>${selectedItem.name}</div> <div class='project-path'>${selectedItem.path_with_namespace}</div> </div>`;
} else if (selectedItem.path) {
......@@ -15,7 +15,7 @@ const formatResult = selectedItem => {
)}</div> <div class='group-path'>${__('All groups and projects')}</div> </div>`;
};
const formatSelection = selectedItem => {
const formatSelection = (selectedItem) => {
if (selectedItem.path_with_namespace) {
return sprintf(__('Project: %{name}'), { name: selectedItem.name });
} else if (selectedItem.path) {
......@@ -24,7 +24,7 @@ const formatSelection = selectedItem => {
return __('All groups and projects');
};
const QueryAdmin = query => {
const QueryAdmin = (query) => {
const groupsFetch = Api.groups(query.term, {});
const projectsFetch = Api.projects(query.term, {
order_by: 'id',
......
......@@ -6,4 +6,4 @@ initVueAlerts();
initConfirmModal();
const toasts = document.querySelectorAll('.js-toast-message');
toasts.forEach(toast => showToast(toast.dataset.message));
toasts.forEach((toast) => showToast(toast.dataset.message));
......@@ -15,6 +15,6 @@ const toggleUploadLicenseButton = () => {
uploadLicenseBtn.toggleAttribute('disabled', !acceptEULACheckBox.checked);
};
licenseType.forEach(el => el.addEventListener('change', showLicenseType));
licenseType.forEach((el) => el.addEventListener('change', showLicenseType));
acceptEULACheckBox.addEventListener('change', toggleUploadLicenseButton);
showLicenseType();
......@@ -17,7 +17,7 @@ export default {
resetPipelineMinutes() {
axios
.post(this.resetMinutesPath)
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.OK) {
this.$toast.show(__('User pipeline minutes were successfully reset.'));
}
......
......@@ -10,7 +10,7 @@ export function fetchPage({ commit, state }, newPage) {
page: newPage || state.pageInfo.page,
per_page: state.pageInfo.perPage,
})
.then(response => {
.then((response) => {
const { headers, data } = response;
const pageInfo = parseIntPagination(normalizeHeaders(headers));
commit(types.RECEIVE_SAML_MEMBERS_SUCCESS, {
......
......@@ -7,7 +7,7 @@ import state from './state';
Vue.use(Vuex);
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -21,7 +21,7 @@ export default () => {
if (isCodequalityTabActive) {
store.dispatch(fetchReportAction);
} else {
const tabClickHandler = e => {
const tabClickHandler = (e) => {
if (e.target.className === 'codequality-tab') {
store.dispatch(fetchReportAction);
tabsElement.removeEventListener('click', tabClickHandler);
......@@ -38,7 +38,7 @@ export default () => {
CodequalityReportApp,
},
store,
render: createElement => createElement('codequality-report-app'),
render: (createElement) => createElement('codequality-report-app'),
});
}
};
......@@ -34,7 +34,7 @@ export default () => {
reportSectionClass: 'split-report-section',
},
on: {
updateBadgeCount: count => {
updateBadgeCount: (count) => {
updateBadgeCount('.js-licenses-counter', count);
},
},
......
......@@ -27,7 +27,7 @@ if (el?.dataset?.apiUrl) {
});
}
toasts.forEach(toast => showToast(toast.dataset.message));
toasts.forEach((toast) => showToast(toast.dataset.message));
// eslint-disable-next-line no-new
new ProtectedEnvironmentCreate();
......
......@@ -37,7 +37,7 @@ export default class EEMirrorRepos extends MirrorRepos {
}
hideForm() {
return new Promise(resolve => {
return new Promise((resolve) => {
if (!this.$insertionPoint.html()) return resolve();
this.$insertionPoint.one('hidden.bs.collapse', () => {
......@@ -48,7 +48,7 @@ export default class EEMirrorRepos extends MirrorRepos {
}
showForm() {
return new Promise(resolve => {
return new Promise((resolve) => {
this.$insertionPoint.one('shown.bs.collapse', () => {
resolve();
});
......
......@@ -4,7 +4,7 @@ import { __ } from '~/locale';
import axios from '~/lib/utils/axios_utils';
export default function initPathLocks(url, path) {
$('a.path-lock').on('click', e => {
$('a.path-lock').on('click', (e) => {
e.preventDefault();
axios
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import BlockingMrInput from 'ee/projects/merge_requests/blocking_mr_input_root.vue';
import { n__ } from '~/locale';
export default el => {
export default (el) => {
if (!el) {
return null;
}
......
......@@ -59,7 +59,7 @@ export default class ProtectedEnvironmentCreate {
.get(gon.search_unprotected_environments_url, { params: { query: term } })
.then(({ data }) => {
const environments = [].concat(data);
const results = environments.map(environment => ({
const results = environments.map((environment) => ({
id: environment,
text: environment,
title: environment,
......@@ -80,12 +80,12 @@ export default class ProtectedEnvironmentCreate {
},
};
Object.keys(ACCESS_LEVELS).forEach(level => {
Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevel = ACCESS_LEVELS[level];
const selectedItems = this[`${accessLevel}_dropdown`].getSelectedItems();
const levelAttributes = [];
selectedItems.forEach(item => {
selectedItems.forEach((item) => {
if (item.type === LEVEL_TYPES.USER) {
levelAttributes.push({
user_id: item.user_id,
......
......@@ -60,7 +60,7 @@ export default class ProtectedEnvironmentEdit {
.then(({ data }) => {
this.hasChanges = false;
Object.keys(ACCESS_LEVELS).forEach(level => {
Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevelName = ACCESS_LEVELS[level];
// The data coming from server will be the new persisted *state* for each dropdown
......@@ -75,7 +75,7 @@ export default class ProtectedEnvironmentEdit {
}
setSelectedItemsToDropdown(items = [], dropdownName) {
const itemsToAdd = items.map(currentItem => {
const itemsToAdd = items.map((currentItem) => {
if (currentItem.user_id) {
// Do this only for users for now
// get the current data for selected items
......
......@@ -64,12 +64,12 @@ export default class ProtectedTagCreate {
},
};
Object.keys(ACCESS_LEVELS).forEach(level => {
Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevel = ACCESS_LEVELS[level];
const selectedItems = this[`${ACCESS_LEVELS.CREATE}_dropdown`].getSelectedItems();
const levelAttributes = [];
selectedItems.forEach(item => {
selectedItems.forEach((item) => {
if (item.type === LEVEL_TYPES.USER) {
levelAttributes.push({
user_id: item.user_id,
......
......@@ -60,7 +60,7 @@ export default class ProtectedTagEdit {
.then(({ data }) => {
this.hasChanges = false;
Object.keys(ACCESS_LEVELS).forEach(level => {
Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevelName = ACCESS_LEVELS[level];
// The data coming from server will be the new persisted *state* for each dropdown
......@@ -74,7 +74,7 @@ export default class ProtectedTagEdit {
}
setSelectedItemsToDropdown(items = [], dropdownName) {
const itemsToAdd = items.map(currentItem => {
const itemsToAdd = items.map((currentItem) => {
if (currentItem.user_id) {
// Do this only for users for now
// get the current data for selected items
......
......@@ -32,7 +32,7 @@ function toggleTrialForm(trial) {
}
form.classList.toggle('hidden', !trial);
fields.forEach(f => {
fields.forEach((f) => {
f.disabled = !trial; // eslint-disable-line no-param-reassign
});
......@@ -54,7 +54,7 @@ function mountTrialToggle() {
return createElement(RegistrationTrialToggle, {
props: { active },
on: {
changed: event => toggleTrialForm(event.trial),
changed: (event) => toggleTrialForm(event.trial),
},
});
},
......
......@@ -117,7 +117,7 @@ export default {
'fetchProjects',
]),
getRawRefs(value) {
return value.split(/\s+/).filter(ref => ref.trim().length > 0);
return value.split(/\s+/).filter((ref) => ref.trim().length > 0);
},
handlePendingItemRemove(index) {
this.removePendingReference(index);
......
......@@ -69,6 +69,6 @@ export default () => {
methods: {
...Vuex.mapActions(['setInitialParentItem', 'setInitialConfig']),
},
render: createElement => createElement('related-items-tree-app'),
render: (createElement) => createElement('related-items-tree-app'),
});
};
......@@ -269,7 +269,7 @@ export const setItemInputValue = ({ commit }, data) => commit(types.SET_ITEM_INP
export const requestAddItem = ({ commit }) => commit(types.REQUEST_ADD_ITEM);
export const receiveAddItemSuccess = ({ dispatch, commit, getters }, { rawItems }) => {
const items = rawItems.map(item => {
const items = rawItems.map((item) => {
// This is needed since Rails API to add Epic/Issue
// doesn't return global ID string.
// We can remove this change once add epic/issue
......@@ -300,7 +300,7 @@ export const receiveAddItemSuccess = ({ dispatch, commit, getters }, { rawItems
items,
});
items.forEach(item => {
items.forEach((item) => {
dispatch('updateChildrenCount', { item });
});
......@@ -332,7 +332,7 @@ export const addItem = ({ state, dispatch, getters }) => {
rawItems: data.issuables.slice(0, state.pendingReferences.length),
});
})
.catch(data => {
.catch((data) => {
const { response } = data;
if (response.status === httpStatusCodes.NOT_FOUND) {
dispatch('receiveAddItemFailure', { itemAddFailureType: itemAddFailureTypesMap.NOT_FOUND });
......@@ -557,7 +557,7 @@ export const createNewIssue = ({ state, dispatch }, { issuesEndpoint, title }) =
parentItem,
});
})
.catch(e => {
.catch((e) => {
dispatch('receiveCreateIssueFailure');
throw e;
});
......
......@@ -3,10 +3,10 @@ import { processIssueTypeIssueSources } from '../utils/epic_utils';
export const autoCompleteSources = () => gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources;
export const directChildren = state => state.children[state.parentItem.reference] || [];
export const directChildren = (state) => state.children[state.parentItem.reference] || [];
export const anyParentHasChildren = (state, getters) =>
getters.directChildren.some(item => item.hasChildren || item.hasIssues);
getters.directChildren.some((item) => item.hasChildren || item.hasIssues);
export const itemAutoCompleteSources = (state, getters) => {
if (getters.isEpic) {
......@@ -26,4 +26,4 @@ export const itemAutoCompleteSources = (state, getters) => {
export const itemPathIdSeparator = (state, getters) =>
getters.isEpic ? PathIdSeparator.Epic : PathIdSeparator.Issue;
export const isEpic = state => state.issuableType === issuableTypesMap.EPIC;
export const isEpic = (state) => state.issuableType === issuableTypesMap.EPIC;
......@@ -42,14 +42,14 @@ export const sortByState = (a, b) => stateOrder.indexOf(a.state) - stateOrder.in
*
* @param {Array} items
*/
export const applySorts = array => array.sort(sortChildren).sort(sortByState);
export const applySorts = (array) => array.sort(sortChildren).sort(sortByState);
/**
* Returns formatted child item to include additional
* flags and properties to use while rendering tree.
* @param {Object} item
*/
export const formatChildItem = item => ({ ...item, pathIdSeparator: PathIdSeparator[item.type] });
export const formatChildItem = (item) => ({ ...item, pathIdSeparator: PathIdSeparator[item.type] });
/**
* Returns formatted array of Epics that doesn't contain
......@@ -57,7 +57,7 @@ export const formatChildItem = item => ({ ...item, pathIdSeparator: PathIdSepara
*
* @param {Array} children
*/
export const extractChildEpics = children =>
export const extractChildEpics = (children) =>
children.edges.map(({ node, epicNode = node }) =>
formatChildItem({
...epicNode,
......@@ -72,8 +72,8 @@ export const extractChildEpics = children =>
*
* @param {Array} assignees
*/
export const extractIssueAssignees = assignees =>
assignees.edges.map(assigneeNode => ({
export const extractIssueAssignees = (assignees) =>
assignees.edges.map((assigneeNode) => ({
...assigneeNode.node,
}));
......@@ -83,7 +83,7 @@ export const extractIssueAssignees = assignees =>
*
* @param {Array} issues
*/
export const extractChildIssues = issues =>
export const extractChildIssues = (issues) =>
issues.edges.map(({ node, issueNode = node }) =>
formatChildItem({
...issueNode,
......
......@@ -11,7 +11,7 @@ export default () => {
if (!toggleBtn) return;
toggleBtn.addEventListener('click', e => {
toggleBtn.addEventListener('click', (e) => {
e.preventDefault();
toggleBtn.setAttribute('disabled', 'disabled');
......
import { normalizeData as normalizeDataFOSS } from '~/repository/utils/commit';
export function normalizeData(data, path) {
return normalizeDataFOSS(data, path, d => ({
return normalizeDataFOSS(data, path, (d) => ({
lockLabel: d.lock_label || false,
}));
}
......@@ -23,7 +23,7 @@ export default {
requirement: {
type: Object,
required: true,
validator: value =>
validator: (value) =>
[
'iid',
'state',
......@@ -33,7 +33,7 @@ export default {
'updatedAt',
'author',
'testReports',
].every(prop => value[prop]),
].every((prop) => value[prop]),
},
stateChangeRequestActive: {
type: Boolean,
......
......@@ -74,8 +74,8 @@ export default {
initialRequirementsCount: {
type: Object,
required: true,
validator: value =>
['OPENED', 'ARCHIVED', 'ALL'].every(prop => typeof value[prop] === 'number'),
validator: (value) =>
['OPENED', 'ARCHIVED', 'ALL'].every((prop) => typeof value[prop] === 'number'),
},
page: {
type: Number,
......@@ -150,7 +150,7 @@ export default {
update(data) {
const requirementsRoot = data.project?.requirements;
const list = requirementsRoot?.nodes.map(node => {
const list = requirementsRoot?.nodes.map((node) => {
return {
...node,
satisfied: node.lastTestReportState === TestReportStatus.Passed,
......@@ -278,7 +278,7 @@ export default {
];
},
getFilteredSearchValue() {
const value = this.authorUsernames.map(author => ({
const value = this.authorUsernames.map((author) => ({
type: 'author_username',
value: { data: author },
}));
......@@ -378,7 +378,7 @@ export default {
updateRequirementInput,
},
})
.catch(e => {
.catch((e) => {
createFlash({
message: errorFlashMessage,
parent: flashMessageContainer,
......@@ -399,7 +399,7 @@ export default {
.then(({ data }) => {
createFlash({ message: data?.message, type: FLASH_TYPES.NOTICE });
})
.catch(err => {
.catch((err) => {
const { data: { message = __('Something went wrong') } = {} } = err.response;
createFlash({ message });
});
......@@ -445,7 +445,7 @@ export default {
},
},
})
.then(res => {
.then((res) => {
const createReqMutation = res?.data?.createRequirement || {};
if (createReqMutation.errors?.length === 0) {
......@@ -461,7 +461,7 @@ export default {
throw new Error(`Error creating a requirement ${res.message}`);
}
})
.catch(e => {
.catch((e) => {
createFlash({
message: __('Something went wrong while creating a requirement.'),
parent: this.$el,
......@@ -485,7 +485,7 @@ export default {
errorFlashMessage: __('Something went wrong while updating a requirement.'),
flashMessageContainer: this.$el,
})
.then(res => {
.then((res) => {
const updateReqMutation = res?.data?.updateRequirement || {};
if (updateReqMutation.errors?.length === 0) {
......@@ -512,7 +512,7 @@ export default {
? __('Something went wrong while reopening a requirement.')
: __('Something went wrong while archiving a requirement.'),
})
.then(res => {
.then((res) => {
const updateReqMutation = res?.data?.updateRequirement || {};
if (updateReqMutation.errors?.length === 0) {
......@@ -546,7 +546,7 @@ export default {
const authors = [];
let textSearch = '';
filters.forEach(filter => {
filters.forEach((filter) => {
if (typeof filter === 'string') {
textSearch = filter;
} else if (filter.value.data !== DEFAULT_LABEL_ANY.value) {
......
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