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