Commit b282f7dd authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 5 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 81e82875
......@@ -10,39 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.scss
*.md
## interesting-kepler
app/assets/javascripts/add_context_commits_modal/utils.js
app/assets/javascripts/admin/application_settings/setup_metrics_and_profiling.js
app/assets/javascripts/admin/statistics_panel/store/actions.js
app/assets/javascripts/admin/statistics_panel/store/getters.js
app/assets/javascripts/admin/users/components/users_table.vue
app/assets/javascripts/admin/users/index.js
app/assets/javascripts/alert_handler.js
app/assets/javascripts/alert_management/components/alert_details.vue
app/assets/javascripts/alert_management/components/alert_management_table.vue
app/assets/javascripts/alert_management/components/alert_metrics.vue
app/assets/javascripts/alert_management/components/alert_status.vue
app/assets/javascripts/alert_management/components/sidebar/sidebar_assignees.vue
app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue
app/assets/javascripts/alert_management/details.js
app/assets/javascripts/alert_management/list.js
app/assets/javascripts/alerts_service_settings/components/alerts_service_form.vue
app/assets/javascripts/alerts_service_settings/index.js
app/assets/javascripts/alerts_settings/components/alert_mapping_builder.vue
app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue
app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue
app/assets/javascripts/alerts_settings/graphql.js
app/assets/javascripts/alerts_settings/index.js
app/assets/javascripts/alerts_settings/utils/cache_updates.js
app/assets/javascripts/analytics/instance_statistics/components/instance_statistics_count_chart.vue
app/assets/javascripts/analytics/instance_statistics/components/projects_and_groups_chart.vue
app/assets/javascripts/analytics/instance_statistics/components/users_chart.vue
app/assets/javascripts/analytics/instance_statistics/utils.js
app/assets/javascripts/analytics/product_analytics/activity_charts_bundle.js
app/assets/javascripts/api.js
app/assets/javascripts/authentication/u2f/authenticate.js
app/assets/javascripts/authentication/u2f/register.js
## reverent-lovelace
app/assets/javascripts/authentication/webauthn/authenticate.js
app/assets/javascripts/authentication/webauthn/register.js
......
export const findCommitIndex = (commits, commitShortId) => {
return commits.findIndex(commit => commit.short_id === commitShortId);
return commits.findIndex((commit) => commit.short_id === commitShortId);
};
export const setCommitStatus = (commits, commitIndex, selected) => {
......
import PayloadPreviewer from '~/pages/admin/application_settings/payload_previewer';
export default () => {
Array.from(document.querySelectorAll('.js-payload-preview-trigger')).forEach(trigger => {
Array.from(document.querySelectorAll('.js-payload-preview-trigger')).forEach((trigger) => {
new PayloadPreviewer(trigger).init();
});
};
......@@ -13,7 +13,7 @@ export const fetchStatistics = ({ dispatch }) => {
.then(({ data }) => {
dispatch('receiveStatisticsSuccess', convertObjectPropsToCamelCase(data, { deep: true }));
})
.catch(error => dispatch('receiveStatisticsError', error));
.catch((error) => dispatch('receiveStatisticsError', error));
};
export const receiveStatisticsSuccess = ({ commit }, statistics) =>
......
......@@ -3,8 +3,8 @@
* and returns an array of the following form:
* [{ key: "forks", label: "Forks", value: 50 }]
*/
export const getStatistics = state => labels =>
Object.keys(labels).map(key => {
export const getStatistics = (state) => (labels) =>
Object.keys(labels).map((key) => {
const result = {
key,
label: labels[key],
......
......@@ -4,7 +4,7 @@ import { __ } from '~/locale';
const DEFAULT_TH_CLASSES =
'gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!';
const thWidthClass = width => `gl-w-${width}p ${DEFAULT_TH_CLASSES}`;
const thWidthClass = (width) => `gl-w-${width}p ${DEFAULT_TH_CLASSES}`;
export default {
components: {
......
......@@ -11,7 +11,7 @@ export default function (el = document.querySelector('#js-admin-users-app')) {
return new Vue({
el,
render: createElement =>
render: (createElement) =>
createElement(AdminUsersApp, {
props: {
users: convertObjectPropsToCamelCase(JSON.parse(users), { deep: true }),
......
......@@ -8,9 +8,9 @@ export default function initAlertHandler() {
const DISMISS_LABEL = '[aria-label="Dismiss"]';
const DISMISS_CLASS = '.gl-alert-dismiss';
DISMISSIBLE_SELECTORS.forEach(selector => {
DISMISSIBLE_SELECTORS.forEach((selector) => {
const elements = document.querySelectorAll(selector);
elements.forEach(element => {
elements.forEach((element) => {
const button = element.querySelector(DISMISS_LABEL) || element.querySelector(DISMISS_CLASS);
if (!button) {
return;
......
......@@ -140,7 +140,7 @@ export default {
},
currentTabIndex: {
get() {
return this.$options.tabsConfig.findIndex(tab => tab.id === this.activeTab);
return this.$options.tabsConfig.findIndex((tab) => tab.id === this.activeTab);
},
set(tabIdx) {
const tabId = this.$options.tabsConfig[tabIdx].id;
......@@ -208,7 +208,7 @@ export default {
}
},
)
.catch(error => {
.catch((error) => {
this.createIncidentError = error;
this.incidentCreationInProgress = false;
});
......
......@@ -138,7 +138,7 @@ export default {
data.project || {};
const now = new Date();
const listWithData = list.map(alert => {
const listWithData = list.map((alert) => {
const then = new Date(alert.startedAt);
const diff = now - then;
......
......@@ -33,7 +33,7 @@ export default {
});
this.metricEmbedComponent = MetricEmbed;
})
.catch(e => Sentry.captureException(e));
.catch((e) => Sentry.captureException(e));
}
},
};
......
......@@ -57,7 +57,7 @@ export default {
projectPath: this.projectPath,
},
})
.then(resp => {
.then((resp) => {
this.trackStatusUpdate(status);
const errors = resp.data?.updateAlertStatus?.errors || [];
......
......@@ -92,7 +92,7 @@ export default {
},
sortedUsers() {
return this.users
.map(user => ({ ...user, active: this.isActive(user.username) }))
.map((user) => ({ ...user, active: this.isActive(user.username) }))
.sort((a, b) => (a.active === b.active ? 0 : a.active ? -1 : 1)); // eslint-disable-line no-nested-ternary
},
dropdownClass() {
......
......@@ -115,7 +115,7 @@ export default {
variables: this.getAlertQueryVariables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.alertManagementAlerts.nodes[0].todos.nodes = [];
});
......
......@@ -9,7 +9,7 @@ import createRouter from './router';
Vue.use(VueApollo);
export default selector => {
export default (selector) => {
const domEl = document.querySelector(selector);
const { alertId, projectPath, projectIssuesPath, projectId } = domEl.dataset;
const router = createRouter();
......@@ -18,7 +18,7 @@ export default selector => {
Mutation: {
toggleSidebarStatus: (_, __, { cache }) => {
const sourceData = cache.readQuery({ query: sidebarStatusQuery });
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.sidebarStatus = !draftData.sidebarStatus;
});
......@@ -30,7 +30,7 @@ export default selector => {
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(resolvers, {
cacheConfig: {
dataIdFromObject: object => {
dataIdFromObject: (object) => {
// eslint-disable-next-line no-underscore-dangle
if (object.__typename === 'AlertManagementAlert') {
return object.iid;
......
......@@ -30,7 +30,7 @@ export default () => {
{},
{
cacheConfig: {
dataIdFromObject: object => {
dataIdFromObject: (object) => {
// eslint-disable-next-line no-underscore-dangle
if (object.__typename === 'AlertManagementAlert') {
return object.iid;
......
......@@ -98,7 +98,7 @@ export default {
},
methods: {
updateIcon() {
return document.querySelectorAll('.js-service-active-status').forEach(icon => {
return document.querySelectorAll('.js-service-active-status').forEach((icon) => {
if (icon.dataset.value === this.activated.toString()) {
icon.classList.remove('d-none');
} else {
......@@ -109,7 +109,7 @@ export default {
resetKey() {
return axios
.put(this.formPath, { service: { token: '' } })
.then(res => {
.then((res) => {
this.authorizationKey = res.data.token;
})
.catch(() => {
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import AlertsServiceForm from './components/alerts_service_form.vue';
export default el => {
export default (el) => {
if (!el) {
return null;
}
......
......@@ -64,9 +64,9 @@ export default {
},
computed: {
mappingData() {
return this.gitlabFields.map(gitlabField => {
return this.gitlabFields.map((gitlabField) => {
const mappingFields = this.payloadFields.filter(({ type }) =>
type.some(t => gitlabField.compatibleTypes.includes(t)),
type.some((t) => gitlabField.compatibleTypes.includes(t)),
);
const foundMapping = this.mapping.find(
......@@ -88,26 +88,26 @@ export default {
},
methods: {
setMapping(gitlabKey, mappingKey, valueKey) {
const fieldIndex = this.gitlabFields.findIndex(field => field.name === gitlabKey);
const fieldIndex = this.gitlabFields.findIndex((field) => field.name === gitlabKey);
const updatedField = { ...this.gitlabFields[fieldIndex], ...{ [valueKey]: mappingKey } };
Vue.set(this.gitlabFields, fieldIndex, updatedField);
},
setSearchTerm(search = '', searchFieldKey, gitlabKey) {
const fieldIndex = this.gitlabFields.findIndex(field => field.name === gitlabKey);
const fieldIndex = this.gitlabFields.findIndex((field) => field.name === gitlabKey);
const updatedField = { ...this.gitlabFields[fieldIndex], ...{ [searchFieldKey]: search } };
Vue.set(this.gitlabFields, fieldIndex, updatedField);
},
filterFields(searchTerm = '', fields) {
const search = searchTerm.toLowerCase();
return fields.filter(field => field.label.toLowerCase().includes(search));
return fields.filter((field) => field.label.toLowerCase().includes(search));
},
isSelected(fieldValue, mapping) {
return fieldValue === mapping;
},
selectedValue(name) {
return (
this.payloadFields.find(item => item.name === name)?.label ||
this.payloadFields.find((item) => item.name === name)?.label ||
this.$options.i18n.makeSelection
);
},
......
......@@ -97,8 +97,8 @@ export default {
};
},
mounted() {
const callback = entries => {
const isVisible = entries.some(entry => entry.isIntersecting);
const callback = (entries) => {
const isVisible = entries.some((entry) => entry.isIntersecting);
if (isVisible) {
this.trackPageViews();
......
......@@ -197,7 +197,7 @@ export default {
return options;
},
options() {
return integrationTypesNew.map(el => ({
return integrationTypesNew.map((el) => ({
...el,
disabled: this.disabledIntegrations.includes(el.value),
}));
......@@ -390,10 +390,10 @@ export default {
// TODO: replace with real BE mutation when ready;
this.parsingPayload = true;
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => resolve(mockedCustomMapping), 1000);
})
.then(res => {
.then((res) => {
const mapping = { ...res };
delete mapping.storedMapping;
this.customMapping = res;
......@@ -408,7 +408,7 @@ export default {
},
getIntegrationMapping() {
// TODO: replace with real BE mutation when ready;
return Promise.resolve(mockedCustomMapping).then(res => {
return Promise.resolve(mockedCustomMapping).then((res) => {
this.customMapping = res;
this.integrationTestPayload.json = res?.samplePayload.body;
});
......
......@@ -14,7 +14,7 @@ const resolvers = {
{ cache },
) => {
const sourceData = cache.readQuery({ query: getCurrentIntegrationQuery });
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
if (id === null) {
// eslint-disable-next-line no-param-reassign
draftData.currentIntegration = null;
......
......@@ -11,7 +11,7 @@ apolloProvider.clients.defaultClient.cache.writeData({
});
Vue.use(GlToast);
export default el => {
export default (el) => {
if (!el) {
return null;
}
......
......@@ -14,7 +14,7 @@ const deleteIntegrationFromStore = (store, query, { httpIntegrationDestroy }, va
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.alertManagementIntegrations.nodes = draftData.project.alertManagementIntegrations.nodes.filter(
({ id }) => id !== integration.id,
......@@ -45,7 +45,7 @@ const addIntegrationToStore = (
variables,
});
const data = produce(sourceData, draftData => {
const data = produce(sourceData, (draftData) => {
// eslint-disable-next-line no-param-reassign
draftData.project.alertManagementIntegrations.nodes = [
integration,
......
......@@ -60,13 +60,13 @@ export default {
return Object.values(this.errors);
},
isLoading() {
return some(this.$apollo.queries, query => query?.loading);
return some(this.$apollo.queries, (query) => query?.loading);
},
allQueriesFailed() {
return every(this.errorMessages, message => message.length);
return every(this.errorMessages, (message) => message.length);
},
hasLoadingErrors() {
return some(this.errorMessages, message => message.length);
return some(this.errorMessages, (message) => message.length);
},
errorMessage() {
// show the generic loading message if all requests fail
......@@ -179,7 +179,7 @@ export default {
};
},
})
.catch(error => this.handleError({ identifier, error, message: errorMessage }));
.catch((error) => this.handleError({ identifier, error, message: errorMessage }));
},
},
};
......
......@@ -11,7 +11,7 @@ import latestGroupsQuery from '../graphql/queries/groups.query.graphql';
import latestProjectsQuery from '../graphql/queries/projects.query.graphql';
import { getAverageByMonth } from '../utils';
const sortByDate = data => sortBy(data, item => new Date(item[0]).getTime());
const sortByDate = (data) => sortBy(data, (item) => new Date(item[0]).getTime());
const averageAndSortData = (data = [], maxDataPoints) => {
const averaged = getAverageByMonth(
......@@ -148,7 +148,7 @@ export default {
name: this.$options.i18n.xAxisTitle,
type: 'category',
axisLabel: {
formatter: value => {
formatter: (value) => {
return formatDateAsMonth(value);
},
},
......@@ -189,7 +189,7 @@ export default {
.fetchMore({
variables: { first: this.totalDataPoints, after: pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => {
const results = produce(fetchMoreResult, newData => {
const results = produce(fetchMoreResult, (newData) => {
// eslint-disable-next-line no-param-reassign
newData[dataKey].nodes = [
...previousResult[dataKey].nodes,
......@@ -199,7 +199,7 @@ export default {
return results;
},
})
.catch(error => {
.catch((error) => {
this.handleError({ error, message: errorMessage, dataKey });
});
}
......
......@@ -10,7 +10,7 @@ import { formatDateAsMonth } from '~/lib/utils/datetime_utility';
import usersQuery from '../graphql/queries/users.query.graphql';
import { getAverageByMonth } from '../utils';
const sortByDate = data => sortBy(data, item => new Date(item[0]).getTime());
const sortByDate = (data) => sortBy(data, (item) => new Date(item[0]).getTime());
export default {
name: 'UsersChart',
......@@ -106,7 +106,7 @@ export default {
.fetchMore({
variables: { first: this.totalDataPoints, after: this.pageInfo.endCursor },
updateQuery: (previousResult, { fetchMoreResult }) => {
return produce(fetchMoreResult, newUsers => {
return produce(fetchMoreResult, (newUsers) => {
// eslint-disable-next-line no-param-reassign
newUsers.users.nodes = [...previousResult.users.nodes, ...newUsers.users.nodes];
});
......
......@@ -29,7 +29,7 @@ export function getAverageByMonth(items = [], options = {}) {
return { ...memo, [month]: { sum: count, recordCount: 1 } };
}, {});
return Object.keys(itemsMap).map(month => {
return Object.keys(itemsMap).map((month) => {
const { sum, recordCount } = itemsMap[month];
const avg = sum / recordCount;
if (shouldRound) {
......
......@@ -8,7 +8,7 @@ export default () => {
return false;
}
return containers.forEach(container => {
return containers.forEach((container) => {
const { chartData } = container.dataset;
const formattedData = JSON.parse(chartData);
......
......@@ -374,8 +374,8 @@ const Api = {
.post(url, {
label: data,
})
.then(res => callback(res.data))
.catch(e => callback(e.response.data));
.then((res) => callback(res.data))
.catch((e) => callback(e.response.data));
},
// Return group projects list. Filtered by query
......@@ -431,7 +431,7 @@ const Api = {
commitPipelines(projectId, sha) {
const encodedProjectId = projectId
.split('/')
.map(fragment => encodeURIComponent(fragment))
.map((fragment) => encodeURIComponent(fragment))
.join('/');
const url = Api.buildUrl(Api.commitPipelinesPath)
......@@ -455,7 +455,7 @@ const Api = {
.replace(':type', type)
.replace(':key', encodeURIComponent(key));
return axios.get(url, { params: options }).then(res => {
return axios.get(url, { params: options }).then((res) => {
if (callback) callback(res.data);
return res;
......@@ -467,7 +467,7 @@ const Api = {
.replace(':id', encodeURIComponent(id))
.replace(':type', type);
return axios.get(url, { params }).then(res => {
return axios.get(url, { params }).then((res) => {
if (callback) callback(res.data);
return res;
......
......@@ -37,7 +37,7 @@ export default class U2FAuthenticate {
// Note: The server library fixes this behaviour in (unreleased) version 1.0.0.
// This can be removed once we upgrade.
// https://github.com/castle/ruby-u2f/commit/103f428071a81cd3d5f80c2e77d522d5029946a4
this.signRequests = u2fParams.sign_requests.map(request => omit(request, 'challenge'));
this.signRequests = u2fParams.sign_requests.map((request) => omit(request, 'challenge'));
this.templates = {
inProgress: '#js-authenticate-token-2fa-in-progress',
......@@ -48,7 +48,7 @@ export default class U2FAuthenticate {
start() {
return importU2FLibrary()
.then(utils => {
.then((utils) => {
this.u2fUtils = utils;
this.renderInProgress();
})
......@@ -60,7 +60,7 @@ export default class U2FAuthenticate {
this.appId,
this.challenge,
this.signRequests,
response => {
(response) => {
if (response.errorCode) {
const error = new U2FError(response.errorCode, 'authenticate');
return this.renderError(error);
......
......@@ -34,7 +34,7 @@ export default class U2FRegister {
start() {
return importU2FLibrary()
.then(utils => {
.then((utils) => {
this.u2fUtils = utils;
this.renderSetup();
})
......@@ -46,7 +46,7 @@ export default class U2FRegister {
this.appId,
this.registerRequests,
this.signRequests,
response => {
(response) => {
if (response.errorCode) {
const error = new U2FError(response.errorCode, 'register');
return this.renderError(error);
......
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