Commit b48e14b8 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 34 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
......@@ -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
## frosty-sammet
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/index.js
ee/app/assets/javascripts/analytics/merge_request_analytics/components/filter_bar.vue
ee/app/assets/javascripts/analytics/merge_request_analytics/components/throughput_chart.vue
ee/app/assets/javascripts/analytics/merge_request_analytics/components/throughput_table.vue
ee/app/assets/javascripts/analytics/merge_request_analytics/graphql/throughput_chart_query_builder.js
ee/app/assets/javascripts/analytics/merge_request_analytics/index.js
ee/app/assets/javascripts/analytics/merge_request_analytics/utils.js
ee/app/assets/javascripts/analytics/productivity_analytics/components/app.vue
ee/app/assets/javascripts/analytics/productivity_analytics/components/metric_chart.vue
ee/app/assets/javascripts/analytics/productivity_analytics/components/mr_table.vue
ee/app/assets/javascripts/analytics/productivity_analytics/filtered_search_productivity_analytics.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/getters.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/charts/actions.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/charts/getters.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/filters/getters.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/table/actions.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/table/getters.js
ee/app/assets/javascripts/analytics/productivity_analytics/utils.js
ee/app/assets/javascripts/analytics/repository_analytics/components/download_test_coverage.vue
ee/app/assets/javascripts/analytics/repository_analytics/components/test_coverage_table.vue
ee/app/assets/javascripts/analytics/shared/components/groups_dropdown_filter.vue
ee/app/assets/javascripts/analytics/shared/components/projects_dropdown_filter.vue
ee/app/assets/javascripts/analytics/shared/components/scatterplot.vue
ee/app/assets/javascripts/analytics/shared/utils.js
ee/app/assets/javascripts/approvals/components/app.vue
ee/app/assets/javascripts/approvals/components/approvers_select.vue
ee/app/assets/javascripts/approvals/components/branches_select.vue
ee/app/assets/javascripts/approvals/components/license_compliance/index.vue
ee/app/assets/javascripts/approvals/components/mr_edit/app.vue
ee/app/assets/javascripts/approvals/components/mr_edit/mr_rules.vue
ee/app/assets/javascripts/approvals/components/mr_edit/mr_rules_hidden_inputs.vue
ee/app/assets/javascripts/approvals/components/mr_edit/rule_input.vue
## strange-shirley
ee/app/assets/javascripts/approvals/components/project_settings/project_rules.vue
ee/app/assets/javascripts/approvals/components/rule_form.vue
......
......@@ -8,6 +8,6 @@ export default () => {
return new Vue({
el,
render: createElement => createElement(CiCdAnalyticsApp),
render: (createElement) => createElement(CiCdAnalyticsApp),
});
};
......@@ -26,17 +26,17 @@ export default {
inject: ['fullPath', 'type'],
computed: {
...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected,
selectedAuthor: state => state.authors.selected,
selectedAssignee: state => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList,
milestonesData: state => state.milestones.data,
labelsData: state => state.labels.data,
assigneesData: state => state.assignees.data,
authorsData: state => state.authors.data,
branchesData: state => state.branches.data,
selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: (state) => state.authors.selected,
selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: (state) => state.labels.selectedList,
milestonesData: (state) => state.milestones.data,
labelsData: (state) => state.labels.data,
assigneesData: (state) => state.assignees.data,
authorsData: (state) => state.authors.data,
branchesData: (state) => state.branches.data,
}),
tokens() {
return [
......
......@@ -62,12 +62,12 @@ export default {
},
computed: {
...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected,
selectedAuthor: state => state.authors.selected,
selectedAssignee: state => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList,
selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: (state) => state.authors.selected,
selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: (state) => state.labels.selectedList,
}),
chartOptions() {
return {
......@@ -75,7 +75,7 @@ export default {
name: THROUGHPUT_CHART_STRINGS.X_AXIS_TITLE,
type: 'category',
axisLabel: {
formatter: value => {
formatter: (value) => {
return value.split(' ')[0]; // Aug 2020 => Aug
},
},
......@@ -92,7 +92,7 @@ export default {
return !this.hasError && this.$apollo.queries.throughputChartData.loading;
},
chartDataAvailable() {
return this.formattedThroughputChartData[0]?.data?.some(entry => Boolean(entry[1]));
return this.formattedThroughputChartData[0]?.data?.some((entry) => Boolean(entry[1]));
},
alertDetails() {
return {
......
......@@ -155,12 +155,12 @@ export default {
},
computed: {
...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected,
selectedAuthor: state => state.authors.selected,
selectedAssignee: state => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList,
selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: (state) => state.authors.selected,
selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: (state) => state.labels.selectedList,
}),
options() {
return filterToQueryObject({
......
......@@ -16,7 +16,7 @@ export default (startDate = null, endDate = null) => {
if (!monthData.length) return '';
const computedMonthData = monthData.map(value => {
const computedMonthData = monthData.map((value) => {
const { year, month, mergedAfter, mergedBefore } = value;
// first: 0 is an optimization which makes sure we don't load merge request objects into memory (backend).
......
......@@ -58,7 +58,7 @@ export default () => {
fullPath,
type,
},
render: createElement =>
render: (createElement) =>
createElement(MergeRequestAnalyticsApp, {
props: {
startDate: startDateParam.length
......
......@@ -53,12 +53,12 @@ export const computeMonthRangeData = (startDate, endDate, format = dateFormats.i
*
* @return {Array} the formatted chart data
*/
export const formatThroughputChartData = chartData => {
export const formatThroughputChartData = (chartData) => {
if (!chartData) return [];
const data = Object.keys(chartData)
.slice(0, -1) // Remove the __typeName key
.map(value => [value.split('_').join(' '), chartData[value].count]); // key: Aug_2020 => Aug 2020
.map((value) => [value.split('_').join(' '), chartData[value].count]); // key: Aug_2020 => Aug 2020
return [
{
......
......@@ -141,7 +141,7 @@ export default {
return {
yAxis: {
axisLabel: {
formatter: value => value,
formatter: (value) => value,
},
minInterval: 1,
},
......@@ -227,7 +227,7 @@ export default {
:chart-data="getScatterPlotMainData"
:selected-metric="getSelectedMetric(chartKeys.scatterplot)"
@metricTypeChange="
metric => setMetricType({ metricType: metric, chartKey: chartKeys.scatterplot })
(metric) => setMetricType({ metricType: metric, chartKey: chartKeys.scatterplot })
"
>
<scatterplot
......@@ -252,7 +252,7 @@ export default {
:selected-metric="getSelectedMetric(chartKeys.timeBasedHistogram)"
:chart-data="getColumnChartData(chartKeys.timeBasedHistogram)"
@metricTypeChange="
metric =>
(metric) =>
setMetricType({ metricType: metric, chartKey: chartKeys.timeBasedHistogram })
"
>
......@@ -278,7 +278,7 @@ export default {
:selected-metric="getSelectedMetric(chartKeys.commitBasedHistogram)"
:chart-data="getColumnChartData(chartKeys.commitBasedHistogram)"
@metricTypeChange="
metric =>
(metric) =>
setMetricType({ metricType: metric, chartKey: chartKeys.commitBasedHistogram })
"
>
......
......@@ -55,7 +55,7 @@ export default {
return this.metricTypes.length;
},
metricDropdownLabel() {
const foundMetric = this.metricTypes.find(m => m.key === this.selectedMetric);
const foundMetric = this.metricTypes.find((m) => m.key === this.selectedMetric);
return foundMetric ? foundMetric.label : s__('MetricChart|Please select a metric');
},
isServerError() {
......
......@@ -35,7 +35,7 @@ export default {
},
computed: {
metricDropdownLabel() {
return this.columnOptions.find(option => option.key === this.metricType).label;
return this.columnOptions.find((option) => option.key === this.metricType).label;
},
showPagination() {
return this.pageInfo && this.pageInfo.total;
......
......@@ -22,7 +22,7 @@ export default class FilteredSearchProductivityAnalytics extends FilteredSearchM
/**
* Updates filters in productivity analytics store
*/
updateObject = path => {
updateObject = (path) => {
const filters = urlParamsToObject(path);
store.dispatch('filters/setFilters', filters);
};
......
export const getMetricTypes = state => chartKey =>
state.metricTypes.filter(m => m.charts.indexOf(chartKey) !== -1);
export const getMetricTypes = (state) => (chartKey) =>
state.metricTypes.filter((m) => m.charts.indexOf(chartKey) !== -1);
......@@ -8,7 +8,7 @@ import { transformScatterData } from '../../../utils';
* Fetches data for all charts except for the main chart
*/
export const fetchSecondaryChartData = ({ state, dispatch }) => {
Object.keys(state.charts).forEach(chartKey => {
Object.keys(state.charts).forEach((chartKey) => {
if (chartKey !== chartKeys.main) {
dispatch('fetchChartData', chartKey);
}
......@@ -27,7 +27,7 @@ export const fetchChartData = ({ dispatch, getters, state, rootState }, chartKey
axios
.get(rootState.endpoint, { params })
.then(response => {
.then((response) => {
const { data } = response;
if (chartKey === chartKeys.scatterplot) {
......@@ -42,7 +42,7 @@ export const fetchChartData = ({ dispatch, getters, state, rootState }, chartKey
dispatch('receiveChartDataSuccess', { chartKey, data });
}
})
.catch(error => dispatch('receiveChartDataError', { chartKey, error }));
.catch((error) => dispatch('receiveChartDataError', { chartKey, error }));
}
};
......
......@@ -13,9 +13,9 @@ import {
} from '../../../constants';
import { getScatterPlotData, getMedianLineData } from '../../../utils';
export const chartLoading = state => chartKey => state.charts[chartKey].isLoading;
export const chartLoading = (state) => (chartKey) => state.charts[chartKey].isLoading;
export const chartErrorCode = state => chartKey => state.charts[chartKey].errorCode;
export const chartErrorCode = (state) => (chartKey) => state.charts[chartKey].errorCode;
/**
* Creates a series object for the column chart with the given chartKey.
......@@ -36,8 +36,8 @@ export const chartErrorCode = state => chartKey => state.charts[chartKey].errorC
* the itemStyle will be set accordingly in order to highlight the relevant bar.
*
*/
export const getColumnChartData = state => chartKey => {
const dataWithSelected = Object.keys(state.charts[chartKey].data).map(key => {
export const getColumnChartData = (state) => (chartKey) => {
const dataWithSelected = Object.keys(state.charts[chartKey].data).map((key) => {
const dataArr = [key, state.charts[chartKey].data[key]];
let itemStyle = {};
......@@ -54,7 +54,7 @@ export const getColumnChartData = state => chartKey => {
return dataWithSelected;
};
export const chartHasData = state => chartKey => !isEmpty(state.charts[chartKey].data);
export const chartHasData = (state) => (chartKey) => !isEmpty(state.charts[chartKey].data);
export const getScatterPlotMainData = (state, getters, rootState) =>
getScatterPlotData(
......@@ -77,10 +77,10 @@ export const getScatterPlotMedianData = (state, getters, rootState) =>
scatterPlotAddonQueryDays,
);
export const getMetricLabel = state => chartKey =>
metricTypes.find(m => m.key === state.charts[chartKey].params.metricType).label;
export const getMetricLabel = (state) => (chartKey) =>
metricTypes.find((m) => m.key === state.charts[chartKey].params.metricType).label;
export const getFilterParams = (state, getters, rootState, rootGetters) => chartKey => {
export const getFilterParams = (state, getters, rootState, rootGetters) => (chartKey) => {
const { params: chartParams = {} } = state.charts[chartKey];
// common filter params
......@@ -109,7 +109,7 @@ export const getFilterParams = (state, getters, rootState, rootGetters) => chart
* it will return an empty dataZoom property.
*
*/
export const getColumnChartDatazoomOption = state => chartKey => {
export const getColumnChartDatazoomOption = (state) => (chartKey) => {
const { data } = state.charts[chartKey];
const totalItems = Object.keys(data).length;
const MAX_ITEMS_PER_PAGE = maxColumnChartItemsPerPage[chartKey]
......@@ -123,7 +123,7 @@ export const getColumnChartDatazoomOption = state => chartKey => {
const intervalEnd = Math.ceil((MAX_ITEMS_PER_PAGE / totalItems) * 100);
return {
dataZoom: dataZoomOptions.map(item => {
dataZoom: dataZoomOptions.map((item) => {
const result = {
...item,
end: intervalEnd,
......@@ -134,7 +134,7 @@ export const getColumnChartDatazoomOption = state => chartKey => {
};
};
export const getSelectedMetric = state => chartKey => state.charts[chartKey].params.metricType;
export const getSelectedMetric = (state) => (chartKey) => state.charts[chartKey].params.metricType;
/**
* Returns the y axis label for the scatterplot.
......@@ -143,16 +143,16 @@ export const getSelectedMetric = state => chartKey => state.charts[chartKey].par
export const scatterplotYaxisLabel = (_state, getters, rootState) => {
const selectedMetric = getters.getSelectedMetric(chartKeys.scatterplot);
const metricTypesInHours = rootState.metricTypes
.filter(metric => metric.charts.indexOf(chartKeys.timeBasedHistogram) !== -1)
.map(metric => metric.key);
.filter((metric) => metric.charts.indexOf(chartKeys.timeBasedHistogram) !== -1)
.map((metric) => metric.key);
if (selectedMetric === daysToMergeMetric.key) return s__('ProductivityAnalytics|Days');
if (metricTypesInHours.indexOf(selectedMetric) !== -1) return s__('ProductivityAnalytics|Hours');
return getters.getMetricLabel(chartKeys.scatterplot);
};
export const hasNoAccessError = state =>
export const hasNoAccessError = (state) =>
state.charts[chartKeys.main].errorCode === httpStatus.FORBIDDEN;
export const isChartEnabled = state => chartKey => state.charts[chartKey].enabled;
export const isChartEnabled = (state) => (chartKey) => state.charts[chartKey].enabled;
export const isFilteringByDaysToMerge = state => state.charts[chartKeys.main].selected.length > 0;
export const isFilteringByDaysToMerge = (state) => state.charts[chartKeys.main].selected.length > 0;
......@@ -19,7 +19,7 @@ import { dateFormats } from '../../../../shared/constants';
* }
*
*/
export const getCommonFilterParams = (state, getters) => chartKey => {
export const getCommonFilterParams = (state, getters) => (chartKey) => {
const {
groupNamespace,
projectPath,
......@@ -55,7 +55,7 @@ export const getCommonFilterParams = (state, getters) => chartKey => {
* When a minDate exists and the minDate is after the computed dateInPast,
* the minDate is returned. Otherwise the computed dateInPast is returned.
*/
export const scatterplotStartDate = state => {
export const scatterplotStartDate = (state) => {
const { startDate, minDate } = state;
const dateInPast = getDateInPast(startDate, scatterPlotAddonQueryDays);
......
......@@ -17,11 +17,11 @@ export const fetchMergeRequests = ({ dispatch, state, rootState, rootGetters })
return axios
.get(rootState.endpoint, { params })
.then(response => {
.then((response) => {
const { headers, data } = response;
dispatch('receiveMergeRequestsSuccess', { headers, data });
})
.catch(err => dispatch('receiveMergeRequestsError', err));
.catch((err) => dispatch('receiveMergeRequestsError', err));
};
export const requestMergeRequests = ({ commit }) => commit(types.REQUEST_MERGE_REQUESTS);
......
import { chartKeys, tableSortOrder, daysToMergeMetric } from '../../../constants';
export const sortIcon = state => tableSortOrder[state.sortOrder].icon;
export const sortIcon = (state) => tableSortOrder[state.sortOrder].icon;
export const sortTooltipTitle = state => tableSortOrder[state.sortOrder].title;
export const sortTooltipTitle = (state) => tableSortOrder[state.sortOrder].title;
export const sortFieldDropdownLabel = (state, _, rootState) =>
rootState.metricTypes.find(metric => metric.key === state.sortField).label;
rootState.metricTypes.find((metric) => metric.key === state.sortField).label;
export const tableSortOptions = (_state, _getters, _rootState, rootGetters) => [
daysToMergeMetric,
......@@ -15,6 +15,6 @@ export const tableSortOptions = (_state, _getters, _rootState, rootGetters) => [
export const columnMetricLabel = (state, _getters, _rootState, rootGetters) =>
rootGetters
.getMetricTypes(chartKeys.timeBasedHistogram)
.find(metric => metric.key === state.columnMetric).label;
.find((metric) => metric.key === state.columnMetric).label;
export const isSelectedSortField = state => sortField => state.sortField === sortField;
export const isSelectedSortField = (state) => (sortField) => state.sortField === sortField;
......@@ -91,7 +91,7 @@ export const transformScatterData = (data, startDate, endDate) => {
const result = initDateArray(startDate, endDate);
const totalItems = result.length;
Object.keys(data).forEach(id => {
Object.keys(data).forEach((id) => {
const mergedAtDate = new Date(data[id].merged_at);
const dayDiff = getDayDifference(mergedAtDate, endDate);
......@@ -134,7 +134,7 @@ export const getScatterPlotData = (data, startDate, endDate) => {
const visibleData = data.slice(startIndex);
// group by date
const result = flatten(visibleData).map(item => [
const result = flatten(visibleData).map((item) => [
dateFormat(item.merged_at, dateFormats.isoDate),
item.metric,
item.merged_at,
......@@ -162,7 +162,7 @@ export const getScatterPlotData = (data, startDate, endDate) => {
export const getMedianLineData = (data, startDate, endDate, daysOffset) => {
const result = [];
const dayDiff = getDayDifference(startDate, endDate);
const transformedData = data.map(arr => arr.map(x => x.metric));
const transformedData = data.map((arr) => arr.map((x) => x.metric));
const len = data.length;
let i = len - dayDiff;
......
......@@ -60,7 +60,7 @@ export default {
// not including a project_ids param is the same as selecting all the projects
if (!this.allProjectsSelected) {
this.selectedProjectIds.forEach(id => queryParams.append('project_ids[]', id));
this.selectedProjectIds.forEach((id) => queryParams.append('project_ids[]', id));
}
return `${this.groupAnalyticsCoverageReportsPath}&${queryParams.toString()}`;
......
......@@ -36,7 +36,7 @@ export default {
// Remove the projects that don't have any code coverage
...data.projects.nodes
.filter(({ codeCoverageSummary }) => Boolean(codeCoverageSummary))
.map(project => ({
.map((project) => ({
...project,
codeCoveragePath: joinPaths(
gon.relative_url_root || '',
......@@ -76,7 +76,7 @@ export default {
selectedProjectIds() {
// Get the IDs of the projects that we haven't requested yet
return Object.keys(this.projectIds).filter(
id => !this.allCoverageData.some(project => project.id === id),
(id) => !this.allCoverageData.some((project) => project.id === id),
);
},
selectedCoverageData() {
......
......@@ -87,7 +87,7 @@ export default {
},
fetchData() {
this.loading = true;
return Api.groups(this.searchTerm, this.queryParams).then(groups => {
return Api.groups(this.searchTerm, this.queryParams).then((groups) => {
this.loading = false;
this.groups = groups;
});
......
......@@ -85,7 +85,7 @@ export default {
return this.selectedProjects.length === 1;
},
selectedProjectIds() {
return this.selectedProjects.map(p => p.id);
return this.selectedProjects.map((p) => p.id);
},
availableProjects() {
return filterBySearchTerm(this.projects, this.searchTerm);
......@@ -110,7 +110,7 @@ export default {
getSelectedProjects(selectedProject, isMarking) {
return isMarking
? this.selectedProjects.concat([selectedProject])
: this.selectedProjects.filter(project => project.id !== selectedProject.id);
: this.selectedProjects.filter((project) => project.id !== selectedProject.id);
},
singleSelectedProject(selectedObj, isMarking) {
return isMarking ? [selectedObj] : [];
......@@ -136,7 +136,7 @@ export default {
...this.queryParams,
},
})
.then(response => {
.then((response) => {
const {
data: {
group: {
......
......@@ -39,7 +39,7 @@ export default {
xAxis: {
type: 'time',
axisLabel: {
formatter: date => dateFormat(date, dateFormats.defaultDate),
formatter: (date) => dateFormat(date, dateFormats.defaultDate),
},
},
dataZoom: [
......
......@@ -2,13 +2,13 @@ import dateFormat from 'dateformat';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { dateFormats } from './constants';
export const toYmd = date => dateFormat(date, dateFormats.isoDate);
export const toYmd = (date) => dateFormat(date, dateFormats.isoDate);
export default {
toYmd,
};
export const formattedDate = d => dateFormat(d, dateFormats.defaultDate);
export const formattedDate = (d) => dateFormat(d, dateFormats.defaultDate);
/**
* Creates a value stream object from a dataset. Returns null if no valueStreamId is present.
......@@ -16,7 +16,7 @@ export const formattedDate = d => dateFormat(d, dateFormats.defaultDate);
* @param {Object} dataset - The raw value stream object
* @returns {Object} - A value stream object
*/
export const buildValueStreamFromJson = valueStream => {
export const buildValueStreamFromJson = (valueStream) => {
const { id, name, is_custom: isCustom } = valueStream ? JSON.parse(valueStream) : {};
return id ? { id, name, isCustom } : null;
};
......@@ -27,7 +27,7 @@ export const buildValueStreamFromJson = valueStream => {
* @param {Object} dataset - The container's dataset
* @returns {Object} - A group object
*/
export const buildGroupFromDataset = dataset => {
export const buildGroupFromDataset = (dataset) => {
const { groupId, groupName, groupFullPath, groupAvatarUrl, groupParentId } = dataset;
if (groupId) {
......@@ -49,7 +49,7 @@ export const buildGroupFromDataset = dataset => {
* @param {Object} dataset - The container's dataset
* @returns {Object} - A project object
*/
export const buildProjectFromDataset = dataset => {
export const buildProjectFromDataset = (dataset) => {
const { projectGid, projectName, projectPathWithNamespace, projectAvatarUrl } = dataset;
if (projectGid) {
......@@ -117,5 +117,5 @@ export const buildCycleAnalyticsInitialData = ({
export const filterBySearchTerm = (data = [], searchTerm = '', filterByKey = 'name') => {
if (!searchTerm?.length) return data;
return data.filter(item => item[filterByKey].toLowerCase().includes(searchTerm.toLowerCase()));
return data.filter((item) => item[filterByKey].toLowerCase().includes(searchTerm.toLowerCase()));
};
......@@ -23,9 +23,9 @@ export default {
computed: {
...mapState({
settings: 'settings',
isLoading: state => state.approvals.isLoading,
hasLoaded: state => state.approvals.hasLoaded,
targetBranch: state => state.approvals.targetBranch,
isLoading: (state) => state.approvals.isLoading,
hasLoaded: (state) => state.approvals.hasLoaded,
targetBranch: (state) => state.approvals.targetBranch,
}),
createModalId() {
return `${this.settings.prefix}-approvals-create-modal`;
......
......@@ -8,7 +8,7 @@ import { renderAvatar } from '~/helpers/avatar_helper';
import { loadCSSFile } from '~/lib/utils/css_utils';
function addType(type) {
return items => items.map(obj => Object.assign(obj, { type }));
return (items) => items.map((obj) => Object.assign(obj, { type }));
}
function formatSelection(group) {
......@@ -116,7 +116,7 @@ export default {
}, 250),
id: ({ type, id }) => `${type}${id}`,
})
.on('change', e => this.onChange(e));
.on('change', (e) => this.onChange(e));
})
.catch(() => {});
})
......@@ -132,7 +132,7 @@ export default {
return Promise.all([groupsAsync, usersAsync])
.then(([groups, users]) => groups.concat(users))
.then(results => ({ results }));
.then((results) => ({ results }));
},
fetchGroups(term) {
// Don't includeAll when search is empty. Otherwise, the user could get a lot of garbage choices.
......
......@@ -73,7 +73,7 @@ export default {
}, 250),
id: ({ type, id }) => `${type}${id}`,
})
.on('change', e => this.onChange(e))
.on('change', (e) => this.onChange(e))
.on('select2-open', () => {
// https://stackoverflow.com/questions/18487056/select2-doesnt-work-when-embedded-in-a-bootstrap-modal
// Ensure search feature works in modal
......@@ -92,7 +92,7 @@ export default {
methods: {
fetchBranches(term) {
const excludeAnyBranch = term && !term.toLowerCase().includes('any');
return Api.projectProtectedBranches(this.projectId, term).then(results => ({
return Api.projectProtectedBranches(this.projectId, term).then((results) => ({
results: excludeAnyBranch ? results : [anyBranch, ...results],
}));
},
......
......@@ -22,8 +22,8 @@ export default {
},
computed: {
...mapState({
isLoading: state => state[APPROVALS].isLoading,
rules: state => state[APPROVALS].rules,
isLoading: (state) => state[APPROVALS].isLoading,
rules: (state) => state[APPROVALS].rules,
documentationPath: ({ settings }) => settings.approvalsDocumentationPath,
licenseCheckRuleName: ({ settings }) => settings.lockedApprovalsRuleName,
}),
......
......@@ -36,8 +36,8 @@ export default {
},
computed: {
...mapState({
rules: state => state.approvals.rules,
canOverride: state => state.settings.canOverride,
rules: (state) => state.approvals.rules,
canOverride: (state) => state.settings.canOverride,
}),
toggleIcon() {
return this.isCollapsed ? 'chevron-down' : 'chevron-right';
......@@ -46,7 +46,7 @@ export default {
return this.glFeatures.mergeRequestReviewers && this.glFeatures.mrCollapsedApprovalRules;
},
hasOptionalRules() {
return this.rules.every(r => r.approvalsRequired === 0);
return this.rules.every((r) => r.approvalsRequired === 0);
},
requiredRules() {
return this.rules.reduce((acc, rule) => {
......
......@@ -21,12 +21,12 @@ export default {
computed: {
...mapState(['settings']),
...mapState({
rules: state => state.approvals.rules,
targetBranch: state => state.approvals.targetBranch,
rules: (state) => state.approvals.rules,
targetBranch: (state) => state.approvals.targetBranch,
}),
hasNamedRule() {
if (this.settings.allowMultiRule) {
return this.rules.some(rule => rule.ruleType !== RULE_TYPE_ANY_APPROVER);
return this.rules.some((rule) => rule.ruleType !== RULE_TYPE_ANY_APPROVER);
}
const [rule] = this.rules;
......@@ -49,7 +49,7 @@ export default {
}
if (
this.settings.allowMultiRule &&
!newValue.some(rule => rule.ruleType === RULE_TYPE_ANY_APPROVER)
!newValue.some((rule) => rule.ruleType === RULE_TYPE_ANY_APPROVER)
) {
this.addEmptyRule();
}
......
......@@ -17,10 +17,10 @@ export default {
computed: {
...mapState(['settings']),
...mapState({
resetToDefault: state => state.approvals.resetToDefault,
rules: state => state.approvals.rules,
rulesToDelete: state => state.approvals.rulesToDelete,
fallbackApprovalsRequired: state => state.approvals.fallbackApprovalsRequired,
resetToDefault: (state) => state.approvals.resetToDefault,
rules: (state) => state.approvals.rules,
rulesToDelete: (state) => state.approvals.rulesToDelete,
fallbackApprovalsRequired: (state) => state.approvals.fallbackApprovalsRequired,
}),
},
INPUT_ID,
......
......@@ -21,7 +21,7 @@ export default {
...mapState(['settings']),
},
created() {
this.onInputChangeDebounced = debounce(event => {
this.onInputChangeDebounced = debounce((event) => {
this.onInputChange(event);
}, 1000);
},
......
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