Commit 16d4df3c authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 9 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
......@@ -162,39 +162,6 @@ app/assets/javascripts/ci_variable_list/ci_variable_list.js
app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue
app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue
## relaxed-kilby
app/assets/javascripts/ci_variable_list/store/actions.js
app/assets/javascripts/ci_variable_list/store/getters.js
app/assets/javascripts/ci_variable_list/store/utils.js
app/assets/javascripts/clone_panel.js
app/assets/javascripts/clusters/clusters_bundle.js
app/assets/javascripts/clusters/components/fluentd_output_settings.vue
app/assets/javascripts/clusters/forms/stores/index.js
app/assets/javascripts/clusters/stores/clusters_store.js
app/assets/javascripts/clusters/stores/new_cluster/index.js
app/assets/javascripts/clusters_list/components/clusters.vue
app/assets/javascripts/clusters_list/load_clusters.js
app/assets/javascripts/clusters_list/store/actions.js
app/assets/javascripts/clusters_list/store/index.js
app/assets/javascripts/code_navigation/index.js
app/assets/javascripts/code_navigation/store/actions.js
app/assets/javascripts/code_navigation/utils/index.js
app/assets/javascripts/commit/image_file.js
app/assets/javascripts/commit/pipelines/pipelines_bundle.js
app/assets/javascripts/commit_merge_requests.js
app/assets/javascripts/commons/nav/user_merge_requests.js
app/assets/javascripts/compare_autocomplete.js
app/assets/javascripts/confidential_merge_request/components/project_form_group.vue
app/assets/javascripts/confirm_danger_modal.js
app/assets/javascripts/confirm_modal.js
app/assets/javascripts/contributors/components/contributors.vue
app/assets/javascripts/contributors/stores/actions.js
app/assets/javascripts/contributors/stores/getters.js
app/assets/javascripts/contributors/utils.js
app/assets/javascripts/create_cluster/components/cluster_form_dropdown.vue
app/assets/javascripts/create_cluster/eks_cluster/index.js
app/assets/javascripts/create_cluster/eks_cluster/services/aws_services_facade.js
## lucid-lederberg
app/assets/javascripts/create_cluster/eks_cluster/store/actions.js
app/assets/javascripts/create_cluster/eks_cluster/store/state.js
......
......@@ -47,7 +47,7 @@ export const addVariable = ({ state, dispatch }) => {
dispatch('receiveAddVariableSuccess');
dispatch('fetchVariables');
})
.catch(error => {
.catch((error) => {
createFlash(error.response.data[0]);
dispatch('receiveAddVariableError', error);
});
......@@ -77,7 +77,7 @@ export const updateVariable = ({ state, dispatch }) => {
dispatch('receiveUpdateVariableSuccess');
dispatch('fetchVariables');
})
.catch(error => {
.catch((error) => {
createFlash(error.response.data[0]);
dispatch('receiveUpdateVariableError', error);
});
......@@ -132,7 +132,7 @@ export const deleteVariable = ({ dispatch, state }) => {
dispatch('receiveDeleteVariableSuccess');
dispatch('fetchVariables');
})
.catch(error => {
.catch((error) => {
createFlash(error.response.data[0]);
dispatch('receiveDeleteVariableError', error);
});
......@@ -150,7 +150,7 @@ export const fetchEnvironments = ({ dispatch, state }) => {
dispatch('requestEnvironments');
return Api.environments(state.projectId)
.then(res => {
.then((res) => {
dispatch('receiveEnvironmentsSuccess', prepareEnvironments(res.data));
})
.catch(() => {
......
import { uniq } from 'lodash';
export const joinedEnvironments = state => {
const scopesFromVariables = (state.variables || []).map(variable => variable.environment_scope);
export const joinedEnvironments = (state) => {
const scopesFromVariables = (state.variables || []).map((variable) => variable.environment_scope);
return uniq(state.environments.concat(scopesFromVariables)).sort();
};
import { cloneDeep } from 'lodash';
import { displayText, types } from '../constants';
const variableTypeHandler = type =>
const variableTypeHandler = (type) =>
type === displayText.variableText ? types.variableType : types.fileType;
export const prepareDataForDisplay = variables => {
export const prepareDataForDisplay = (variables) => {
const variablesToDisplay = [];
variables.forEach(variable => {
variables.forEach((variable) => {
const variableCopy = variable;
if (variableCopy.variable_type === types.variableType) {
variableCopy.variable_type = displayText.variableText;
......@@ -42,4 +42,4 @@ export const prepareDataForApi = (variable, destroy = false) => {
return variableCopy;
};
export const prepareEnvironments = environments => environments.map(e => e.name);
export const prepareEnvironments = (environments) => environments.map((e) => e.name);
......@@ -14,7 +14,7 @@ export default function initClonePanel() {
$(`a:contains('${selectedCloneOption}')`, $cloneOptions).addClass('is-active');
}
$('a', $cloneOptions).on('click', e => {
$('a', $cloneOptions).on('click', (e) => {
e.preventDefault();
const $this = $(e.currentTarget);
const url = $this.attr('href');
......
......@@ -128,7 +128,7 @@ export default class Clusters {
this.initPolling(
'fetchClusterEnvironments',
data => this.handleClusterEnvironmentsSuccess(data),
(data) => this.handleClusterEnvironmentsSuccess(data),
() => this.handleEnvironmentsPollError(),
);
}
......@@ -139,7 +139,7 @@ export default class Clusters {
if (statusPath && !this.environments) {
this.initPolling(
'fetchClusterStatus',
data => this.handleClusterStatusSuccess(data),
(data) => this.handleClusterStatusSuccess(data),
() => this.handlePollError(),
);
}
......@@ -248,15 +248,15 @@ export default class Clusters {
addListeners() {
eventHub.$on('installApplication', this.installApplication);
eventHub.$on('updateApplication', data => this.updateApplication(data));
eventHub.$on('saveKnativeDomain', data => this.saveKnativeDomain(data));
eventHub.$on('setKnativeDomain', data => this.setKnativeDomain(data));
eventHub.$on('uninstallApplication', data => this.uninstallApplication(data));
eventHub.$on('setCrossplaneProviderStack', data => this.setCrossplaneProviderStack(data));
eventHub.$on('setIngressModSecurityEnabled', data => this.setIngressModSecurityEnabled(data));
eventHub.$on('setIngressModSecurityMode', data => this.setIngressModSecurityMode(data));
eventHub.$on('resetIngressModSecurityChanges', id => this.resetIngressModSecurityChanges(id));
eventHub.$on('setFluentdSettings', data => this.setFluentdSettings(data));
eventHub.$on('updateApplication', (data) => this.updateApplication(data));
eventHub.$on('saveKnativeDomain', (data) => this.saveKnativeDomain(data));
eventHub.$on('setKnativeDomain', (data) => this.setKnativeDomain(data));
eventHub.$on('uninstallApplication', (data) => this.uninstallApplication(data));
eventHub.$on('setCrossplaneProviderStack', (data) => this.setCrossplaneProviderStack(data));
eventHub.$on('setIngressModSecurityEnabled', (data) => this.setIngressModSecurityEnabled(data));
eventHub.$on('setIngressModSecurityMode', (data) => this.setIngressModSecurityMode(data));
eventHub.$on('resetIngressModSecurityChanges', (id) => this.resetIngressModSecurityChanges(id));
eventHub.$on('setFluentdSettings', (data) => this.setFluentdSettings(data));
// Add event listener to all the banner close buttons
this.addBannerCloseHandler(this.unreachableContainer, 'unreachable');
this.addBannerCloseHandler(this.authenticationFailureContainer, 'authentication_failure');
......@@ -343,12 +343,12 @@ export default class Clusters {
checkForNewInstalls(prevApplicationMap, newApplicationMap) {
const appTitles = Object.keys(newApplicationMap)
.filter(
appId =>
(appId) =>
newApplicationMap[appId].status === APPLICATION_STATUS.INSTALLED &&
prevApplicationMap[appId].status !== APPLICATION_STATUS.INSTALLED &&
prevApplicationMap[appId].status !== null,
)
.map(appId => newApplicationMap[appId].title);
.map((appId) => newApplicationMap[appId].title);
if (appTitles.length > 0) {
const text = sprintf(
......@@ -450,7 +450,7 @@ export default class Clusters {
);
});
})
.catch(error => this.store.updateAppProperty(appId, 'validationError', error));
.catch((error) => this.store.updateAppProperty(appId, 'validationError', error));
}
static validateInstallation(appId, params) {
......
......@@ -127,7 +127,7 @@ export default {
});
},
updateCurrentServerSideSettings(settings) {
Object.keys(settings).forEach(key => {
Object.keys(settings).forEach((key) => {
if (this.currentServerSideSettings[key] === null) {
this.currentServerSideSettings[key] = this[key];
}
......
......@@ -4,7 +4,7 @@ import state from './state';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
state: state(initialState),
});
......
......@@ -17,7 +17,7 @@ import {
} from '../constants';
import transitionApplicationState from '../services/application_state_machine';
const isApplicationInstalled = appStatus => APPLICATION_INSTALLED_STATUSES.includes(appStatus);
const isApplicationInstalled = (appStatus) => APPLICATION_INSTALLED_STATUSES.includes(appStatus);
const applicationInitialState = {
status: null,
......@@ -195,7 +195,7 @@ export default class ClusterStore {
this.state.status = serverState.status;
this.state.statusReason = serverState.status_reason;
serverState.applications.forEach(serverAppEntry => {
serverState.applications.forEach((serverAppEntry) => {
const {
name: appId,
status,
......@@ -284,7 +284,7 @@ export default class ClusterStore {
}
updateEnvironments(environments = []) {
this.state.environments = environments.map(environment => ({
this.state.environments = environments.map((environment) => ({
name: environment.name,
project: environment.project,
environmentPath: environment.environment_path,
......
......@@ -4,7 +4,7 @@ import state from './state';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
state: state(initialState),
});
......
......@@ -79,7 +79,7 @@ export default {
{
key: 'cluster_type',
label: __('Cluster level'),
formatter: value => CLUSTER_TYPES[value],
formatter: (value) => CLUSTER_TYPES[value],
},
];
},
......
import Clusters from './components/clusters.vue';
import { createStore } from './store';
export default Vue => {
export default (Vue) => {
const el = document.querySelector('#js-clusters-list-app');
if (!el) {
......
......@@ -13,11 +13,11 @@ const allNodesPresent = (clusters, retryCount) => {
They may fail for reasons GitLab cannot control.
MAX_REQUESTS will ensure this poll stops at some point.
*/
return retryCount > MAX_REQUESTS || clusters.every(cluster => cluster.nodes != null);
return retryCount > MAX_REQUESTS || clusters.every((cluster) => cluster.nodes != null);
};
export const reportSentryError = (_store, { error, tag }) => {
Sentry.withScope(scope => {
Sentry.withScope((scope) => {
scope.setTag('javascript_clusters_list', tag);
Sentry.captureException(error);
});
......@@ -30,7 +30,7 @@ export const fetchClusters = ({ state, commit, dispatch }) => {
const poll = new Poll({
resource: {
fetchClusters: paginatedEndPoint => axios.get(paginatedEndPoint),
fetchClusters: (paginatedEndPoint) => axios.get(paginatedEndPoint),
},
data: `${state.endpoint}?page=${state.page}`,
method: 'fetchClusters',
......@@ -59,7 +59,7 @@ export const fetchClusters = ({ state, commit, dispatch }) => {
dispatch('reportSentryError', { error, tag: 'fetchClustersSuccessCallback' });
}
},
errorCallback: response => {
errorCallback: (response) => {
poll.stop();
commit(types.SET_LOADING_CLUSTERS, false);
......
......@@ -6,7 +6,7 @@ import * as actions from './actions';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -3,7 +3,7 @@ import Vuex from 'vuex';
import createStore from './store';
import App from './components/app.vue';
export default initialData => {
export default (initialData) => {
const el = document.getElementById('js-code-navigation');
if (!el) return null;
......
......@@ -34,7 +34,7 @@ export default {
},
showBlobInteractionZones({ state }, path) {
if (state.data && state.data[path]) {
Object.values(state.data[path]).forEach(d => addInteractionClass(path, d));
Object.values(state.data[path]).forEach((d) => addInteractionClass(path, d));
}
},
showDefinition({ commit, state }, { target: el }) {
......
export const cachedData = new Map();
export const getCurrentHoverElement = () => cachedData.get('current');
export const setCurrentHoverElement = el => cachedData.set('current', el);
export const setCurrentHoverElement = (el) => cachedData.set('current', el);
export const addInteractionClass = (path, d) => {
const lineNumber = d.start_line + 1;
......@@ -10,7 +10,7 @@ export const addInteractionClass = (path, d) => {
.querySelectorAll(`.blob-content #LC${lineNumber}, .line_content:not(.old) #LC${lineNumber}`);
if (!lines?.length) return;
lines.forEach(line => {
lines.forEach((line) => {
let charCount = 0;
const el = [...line.childNodes].find(({ textContent }) => {
if (charCount === d.start_char) return true;
......
......@@ -28,7 +28,7 @@ export default class ImageFile {
initViewModes() {
const viewMode = viewModes[0];
$('.view-modes', this.file).removeClass('gl-display-none');
$('.view-modes-menu', this.file).on('click', 'li', event => {
$('.view-modes-menu', this.file).on('click', 'li', (event) => {
if (!$(event.currentTarget).hasClass('active')) {
return this.activateViewMode(event.currentTarget.className);
}
......
......@@ -21,7 +21,7 @@ export default () => {
if (pipelineTableViewEl) {
// Update MR and Commits tabs
pipelineTableViewEl.addEventListener('update-pipelines-count', event => {
pipelineTableViewEl.addEventListener('update-pipelines-count', (event) => {
if (
event.detail.pipelines &&
event.detail.pipelines.count &&
......
......@@ -50,7 +50,7 @@ export function createContent(mergeRequests) {
if (mergeRequests.length === 0) {
$content.text(s__('Commits|No related merge requests found'));
} else {
mergeRequests.forEach(mergeRequest => {
mergeRequests.forEach((mergeRequest) => {
const $header = createHeader($content.children().length, mergeRequests.length);
const $item = createItem(mergeRequest);
$content.append($header);
......@@ -66,7 +66,7 @@ export function fetchCommitMergeRequests() {
axios
.get($container.data('projectCommitPath'))
.then(response => {
.then((response) => {
const $content = createContent(response.data);
$container.html($content);
......
......@@ -27,7 +27,7 @@ export function refreshUserMergeRequestCounts() {
updateUserMergeRequestCounts(count);
broadcastCount(count);
})
.catch(ex => {
.catch((ex) => {
console.error(ex); // eslint-disable-line no-console
});
}
......@@ -59,7 +59,7 @@ export function openUserCountsBroadcast() {
const currentUserId = typeof gon !== 'undefined' && gon && gon.current_user_id;
if (currentUserId) {
channel = new BroadcastChannel(`mr_count_channel_${currentUserId}`);
channel.onmessage = ev => {
channel.onmessage = (ev) => {
updateUserMergeRequestCounts(ev.data);
};
}
......
......@@ -63,7 +63,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
},
clicked: () => clickHandler($dropdown),
});
$filterInput.on('keyup', e => {
$filterInput.on('keyup', (e) => {
const keyCode = e.keyCode || e.which;
if (keyCode !== 13) return;
const text = $filterInput.val();
......@@ -72,7 +72,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
$dropdownContainer.removeClass('open');
});
$dropdownContainer.on('click', '.dropdown-content a', e => {
$dropdownContainer.on('click', '.dropdown-content a', (e) => {
$dropdown.prop('title', e.target.text.replace(/_+?/g, '-'));
if ($dropdown.hasClass('has-tooltip')) {
fixTitle($dropdown);
......
......@@ -61,7 +61,7 @@ export default {
}
},
normalizeProjectData(data) {
return data.map(p => ({
return data.map((p) => ({
id: p.id,
name: p.name_with_namespace,
pathWithNamespace: p.path_with_namespace,
......@@ -78,7 +78,7 @@ export default {
this.projects = this.normalizeProjectData(data);
this.selectProject(this.projects[0]);
})
.catch(e => {
.catch((e) => {
createFlash(__('Error fetching forked projects. Please try again.'));
throw e;
});
......
......@@ -47,7 +47,7 @@ function getModal($btn) {
}
export default function initConfirmDangerModal() {
$(document).on('click', '.js-confirm-danger', e => {
$(document).on('click', '.js-confirm-danger', (e) => {
const $btn = $(e.target);
const checkFieldName = $btn.data('checkFieldName');
const checkFieldCompareValue = $btn.data('checkCompareValue');
......
import Vue from 'vue';
import ConfirmModal from '~/vue_shared/components/confirm_modal.vue';
const mountConfirmModal = optionalProps =>
const mountConfirmModal = (optionalProps) =>
new Vue({
render(h) {
return h(ConfirmModal, {
......
......@@ -39,7 +39,7 @@ export default {
...mapGetters(['showChart', 'parsedData']),
masterChartData() {
const data = {};
this.xAxisRange.forEach(date => {
this.xAxisRange.forEach((date) => {
data[date] = this.parsedData.total[date] || 0;
});
return [
......@@ -67,7 +67,7 @@ export default {
const maxNumberOfIndividualContributorsCharts = 100;
return Object.keys(this.parsedData.byAuthorEmail)
.map(email => {
.map((email) => {
const author = this.parsedData.byAuthorEmail[email];
return {
name: author.name,
......@@ -76,7 +76,7 @@ export default {
dates: [
{
name: __('Commits'),
data: this.xAxisRange.map(date => [date, author.dates[date] || 0]),
data: this.xAxisRange.map((date) => [date, author.dates[date] || 0]),
},
],
};
......@@ -101,7 +101,7 @@ export default {
},
individualChartYAxisMax() {
return this.individualChartsData.reduce((acc, item) => {
const values = item.dates[0].data.map(value => value[1]);
const values = item.dates[0].data.map((value) => value[1]);
return Math.max(acc, ...values);
}, 0);
},
......@@ -150,7 +150,7 @@ export default {
},
setSvg(name) {
return getSvgIconPathContent(name)
.then(path => {
.then((path) => {
if (path) {
this.$set(this.svgs, name, `path://${path}`);
}
......@@ -177,7 +177,7 @@ export default {
this.individualCharts.push(chart);
},
setIndividualChartsZoom(options) {
this.charts.forEach(chart =>
this.charts.forEach((chart) =>
chart.setOption(
{
dataZoom: {
......
......@@ -8,8 +8,8 @@ export const fetchChartData = ({ commit }, endpoint) => {
return service
.fetchChartData(endpoint)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
commit(types.SET_CHART_DATA, data);
commit(types.SET_LOADING_STATE, false);
})
......
export const showChart = state => Boolean(!state.loading && state.chartData);
export const showChart = (state) => Boolean(!state.loading && state.chartData);
export const parsedData = state => {
export const parsedData = (state) => {
const byAuthorEmail = {};
const total = {};
......
......@@ -9,7 +9,7 @@ import { getMonthNames } from '~/lib/utils/datetime_utility';
* xAxisLabelFormatter('02-12-2019') will return 'Feb'
* xAxisLabelFormatter('07-12-2019') will return 'Jul'
*/
export const xAxisLabelFormatter = val => {
export const xAxisLabelFormatter = (val) => {
const date = new Date(val);
const month = date.getUTCMonth();
const year = date.getUTCFullYear();
......@@ -21,7 +21,7 @@ export const xAxisLabelFormatter = val => {
* @param {Date}
* @returns {String} - formatted value
*/
export const dateFormatter = date => {
export const dateFormatter = (date) => {
const year = date.getUTCFullYear();
const month = date.getUTCMonth();
const day = date.getUTCDate();
......
......@@ -6,9 +6,9 @@ import DropdownSearchInput from '~/vue_shared/components/dropdown/dropdown_searc
import DropdownHiddenInput from '~/vue_shared/components/dropdown/dropdown_hidden_input.vue';
import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue';
const toArray = value => (isNil(value) ? [] : [].concat(value));
const itemsProp = (items, prop) => items.map(item => item[prop]);
const defaultSearchFn = (searchQuery, labelProp) => item =>
const toArray = (value) => (isNil(value) ? [] : [].concat(value));
const itemsProp = (items, prop) => items.map((item) => item[prop]);
const defaultSearchFn = (searchQuery, labelProp) => (item) =>
item[labelProp].toLowerCase().indexOf(searchQuery) > -1;
export default {
......@@ -135,7 +135,7 @@ export default {
const valueList = toArray(this.value);
const items = this.getItemsOrEmptyList();
return items.filter(item => valueList.some(value => item[valueProp] === value));
return items.filter((item) => valueList.some((value) => item[valueProp] === value));
},
selectedItemsLabels() {
return itemsProp(this.selectedItems, this.labelProperty).join(', ');
......
......@@ -6,7 +6,7 @@ import createStore from './store';
Vue.use(Vuex);
export default el => {
export default (el) => {
const {
gitlabManagedClusterHelpPath,
namespacePerEnvironmentHelpPath,
......
......@@ -37,7 +37,7 @@ export const fetchVpcs = ({ region }) => {
.describeVpcs()
.promise()
.then(({ Vpcs: vpcs }) =>
vpcs.map(vpc => ({
vpcs.map((vpc) => ({
value: vpc.VpcId,
name: lookupVpcName(vpc),
})),
......
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