Commit 9f4b4de2 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 30 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 0a8f575e
......@@ -848,40 +848,6 @@ app/assets/javascripts/snippets/components/snippet_blob_view.vue
app/assets/javascripts/snippets/components/snippet_header.vue
app/assets/javascripts/snippets/mixins/snippets.js
## nostalgic-morse
app/assets/javascripts/user_lists/store/show/actions.js
app/assets/javascripts/user_lists/store/show/index.js
app/assets/javascripts/user_lists/store/show/mutations.js
app/assets/javascripts/user_popovers.js
app/assets/javascripts/users_select/index.js
app/assets/javascripts/vue_alerts.js
app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals.vue
app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_actions.vue
app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_view_button.vue
app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue
app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue
app/assets/javascripts/vue_merge_request_widget/components/extensions/container.js
app/assets/javascripts/vue_merge_request_widget/components/extensions/index.js
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_alert_message.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue
app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue
app/assets/javascripts/vue_merge_request_widget/extensions/issues.js
app/assets/javascripts/vue_merge_request_widget/mixins/approvals.js
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue
app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
app/assets/javascripts/vue_merge_request_widget/stores/artifacts_list/getters.js
app/assets/javascripts/vue_shared/components/actions_button.vue
app/assets/javascripts/vue_shared/components/awards_list.vue
app/assets/javascripts/vue_shared/components/commit.vue
app/assets/javascripts/vue_shared/components/confirm_modal.vue
## thirsty-mccarthy
app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker.vue
app/assets/javascripts/vue_shared/components/date_time_picker/date_time_picker_input.vue
......
......@@ -5,7 +5,7 @@ import * as types from './mutation_types';
export const fetchUserList = ({ commit, state }) => {
commit(types.REQUEST_USER_LIST);
return Api.fetchFeatureFlagUserList(state.projectId, state.userListIid)
.then(response => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data))
.then((response) => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data))
.catch(() => commit(types.RECEIVE_USER_LIST_ERROR));
};
......@@ -27,6 +27,6 @@ export const updateUserList = ({ commit, state }) => {
...state.userList,
user_xids: stringifyUserIds(state.userIds),
})
.then(response => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data))
.then((response) => commit(types.RECEIVE_USER_LIST_SUCCESS, response.data))
.catch(() => commit(types.RECEIVE_USER_LIST_ERROR));
};
......@@ -3,7 +3,7 @@ import createState from './state';
import * as actions from './actions';
import mutations from './mutations';
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
mutations,
......
......@@ -20,10 +20,10 @@ export default {
[types.ADD_USER_IDS](state, ids) {
state.userIds = [
...state.userIds,
...parseUserIds(ids).filter(id => id && !state.userIds.includes(id)),
...parseUserIds(ids).filter((id) => id && !state.userIds.includes(id)),
];
},
[types.REMOVE_USER_ID](state, id) {
state.userIds = state.userIds.filter(uid => uid !== id);
state.userIds = state.userIds.filter((uid) => uid !== id);
},
};
......@@ -5,14 +5,14 @@ import { sanitize } from '~/lib/dompurify';
import UsersCache from './lib/utils/users_cache';
import UserPopover from './vue_shared/components/user_popover/user_popover.vue';
const removeTitle = el => {
const removeTitle = (el) => {
// Removing titles so its not showing tooltips also
el.dataset.originalTitle = '';
el.setAttribute('title', '');
};
const getPreloadedUserInfo = dataset => {
const getPreloadedUserInfo = (dataset) => {
const userId = dataset.user || dataset.userId;
const { username, name, avatarUrl } = dataset;
......@@ -28,7 +28,7 @@ const getPreloadedUserInfo = dataset => {
* Adds a UserPopover component to the body, hands over as much data as the target element has in data attributes.
* loads based on data-user-id more data about a user from the API and sets it on the popover
*/
const populateUserInfo = user => {
const populateUserInfo = (user) => {
const { userId } = user;
return Promise.all([UsersCache.retrieveById(userId), UsersCache.retrieveStatusById(userId)]).then(
......@@ -66,7 +66,7 @@ export default (elements = document.querySelectorAll('.js-user-link')) => {
return userLinks
.filter(({ dataset }) => dataset.user || dataset.userId)
.map(el => {
.map((el) => {
if (initializedPopovers.has(el)) {
return initializedPopovers.get(el);
}
......
......@@ -145,14 +145,14 @@ function UsersSelect(currentUser, els, options = {}) {
};
const getMultiSelectDropdownTitle = function (selectedUser, isSelected) {
const selectedUsers = getSelected().filter(u => u !== 0);
const selectedUsers = getSelected().filter((u) => u !== 0);
const firstUser = getSelectedUserInputs()
.map((index, input) => ({
name: input.dataset.meta,
value: parseInt(input.value, 10),
}))
.filter(u => u.id !== 0)
.filter((u) => u.id !== 0)
.get(0);
if (selectedUsers.length === 0) {
......@@ -160,7 +160,7 @@ function UsersSelect(currentUser, els, options = {}) {
} else if (selectedUsers.length === 1) {
return firstUser.name;
} else if (isSelected) {
const otherSelected = selectedUsers.filter(s => s !== selectedUser.id);
const otherSelected = selectedUsers.filter((s) => s !== selectedUser.id);
return sprintf(s__('UsersSelect|%{name} + %{length} more'), {
name: selectedUser.name,
length: otherSelected.length,
......@@ -172,7 +172,7 @@ function UsersSelect(currentUser, els, options = {}) {
});
};
$assignToMeLink.on('click', e => {
$assignToMeLink.on('click', (e) => {
e.preventDefault();
$(e.currentTarget).hide();
......@@ -196,7 +196,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
});
$block.on('click', '.js-assign-yourself', e => {
$block.on('click', '.js-assign-yourself', (e) => {
e.preventDefault();
return assignTo(userSelect.currentUser.id);
});
......@@ -250,7 +250,7 @@ function UsersSelect(currentUser, els, options = {}) {
return initDeprecatedJQueryDropdown($dropdown, {
showMenuAbove,
data(term, callback) {
return userSelect.users(term, options, users => {
return userSelect.users(term, options, (users) => {
// GitLabDropdownFilter returns this.instance
// GitLabDropdownRemote returns this.options.instance
const deprecatedJQueryDropdown = this.instance || this.options.instance;
......@@ -266,14 +266,14 @@ function UsersSelect(currentUser, els, options = {}) {
// Potential duplicate entries when dealing with issue board
// because issue board is also managed by vue
const selectedUsers = uniqBy(selectedInputs, a => a.value)
.filter(input => {
const selectedUsers = uniqBy(selectedInputs, (a) => a.value)
.filter((input) => {
const userId = parseInt(input.value, 10);
const inUsersArray = users.find(u => u.id === userId);
const inUsersArray = users.find((u) => u.id === userId);
return !inUsersArray && userId !== 0;
})
.map(input => {
.map((input) => {
const userId = parseInt(input.value, 10);
const { avatarUrl, avatar_url, name, username, canMerge } = input.dataset;
return {
......@@ -334,7 +334,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
if ($dropdown.hasClass('js-multiselect')) {
const selected = getSelected().filter(i => i !== 0);
const selected = getSelected().filter((i) => i !== 0);
if (selected.length > 0) {
if ($dropdown.data('dropdownHeader')) {
......@@ -346,12 +346,12 @@ function UsersSelect(currentUser, els, options = {}) {
}
const selectedUsers = users
.filter(u => selected.indexOf(u.id) !== -1)
.filter((u) => selected.indexOf(u.id) !== -1)
.sort((a, b) => a.name > b.name);
users = users.filter(u => selected.indexOf(u.id) === -1);
users = users.filter((u) => selected.indexOf(u.id) === -1);
selectedUsers.forEach(selectedUser => {
selectedUsers.forEach((selectedUser) => {
showDivider += 1;
users.splice(showDivider, 0, selectedUser);
});
......@@ -477,7 +477,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
}
if (getSelected().find(u => u === gon.current_user_id)) {
if (getSelected().find((u) => u === gon.current_user_id)) {
$assignToMeLink.hide();
} else {
$assignToMeLink.show();
......@@ -544,7 +544,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
if (selected.length > 0) {
getSelected().forEach(selectedId => highlightSelected(selectedId));
getSelected().forEach((selectedId) => highlightSelected(selectedId));
} else if ($dropdown.hasClass('js-issue-board-sidebar')) {
highlightSelected(0);
} else {
......@@ -559,7 +559,7 @@ function UsersSelect(currentUser, els, options = {}) {
let selected = false;
if (this.multiSelect) {
selected = getSelected().find(u => user.id === u);
selected = getSelected().find((u) => user.id === u);
const { fieldName } = this;
const field = $dropdown
......@@ -613,7 +613,7 @@ function UsersSelect(currentUser, els, options = {}) {
multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0,
query(query) {
return userSelect.users(query.term, options, users => {
return userSelect.users(query.term, options, (users) => {
let name;
const data = {
results: users,
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import DismissibleAlert from '~/vue_shared/components/dismissible_alert.vue';
const mountVueAlert = el => {
const mountVueAlert = (el) => {
const props = {
html: el.innerHTML,
};
......
......@@ -74,7 +74,7 @@ export default {
return this.mr.approvals || {};
},
approvedBy() {
return this.approvals.approved_by ? this.approvals.approved_by.map(x => x.user) : [];
return this.approvals.approved_by ? this.approvals.approved_by.map((x) => x.user) : [];
},
userHasApproved() {
return Boolean(this.approvals.user_has_approved);
......@@ -136,7 +136,7 @@ export default {
approveWithAuth(data) {
this.updateApproval(
() => this.service.approveMergeRequestWithAuth(data),
error => {
(error) => {
if (error && error.response && error.response.status === 401) {
this.hasApprovalAuthError = true;
return;
......@@ -155,7 +155,7 @@ export default {
this.isApproving = true;
this.clearError();
return serviceFn()
.then(data => {
.then((data) => {
this.mr.setApprovals(data);
eventHub.$emit('MRWidgetUpdateRequested');
this.$emit('updated');
......
......@@ -121,7 +121,7 @@ export default {
this.actionInProgress = actionName;
MRWidgetService.executeInlineAction(endpoint)
.then(resp => {
.then((resp) => {
const redirectUrl = resp?.data?.redirect_url;
if (redirectUrl) {
visitUrl(redirectUrl);
......
......@@ -57,7 +57,7 @@ export default {
return this.deployment.changes && this.deployment.changes.length > 1;
},
filteredChanges() {
return this.deployment?.changes?.filter(change => change.path.includes(this.searchTerm));
return this.deployment?.changes?.filter((change) => change.path.includes(this.searchTerm));
},
},
};
......
......@@ -102,7 +102,7 @@ export default {
loadMetrics() {
backOff((next, stop) => {
MRWidgetService.fetchMetrics(this.metricsUrl)
.then(res => {
.then((res) => {
if (res.status === statusCodes.NO_CONTENT) {
this.backOffRequestCounter += 1;
/* eslint-disable no-unused-expressions */
......@@ -113,14 +113,14 @@ export default {
})
.catch(stop);
})
.then(res => {
.then((res) => {
if (res.status === statusCodes.NO_CONTENT) {
return res;
}
return res.data;
})
.then(data => {
.then((data) => {
this.computeGraphData(data.metrics, data.deployment_time);
return data;
})
......
......@@ -67,11 +67,11 @@ export default {
},
mounted() {
this.fetchCollapsedData(this.$props)
.then(data => {
.then((data) => {
this.collapsedData = data;
this.loadingState = null;
})
.catch(e => {
.catch((e) => {
this.loadingState = LOADING_STATES.collapsedError;
throw e;
});
......@@ -86,11 +86,11 @@ export default {
this.loadingState = LOADING_STATES.expandedLoading;
this.fetchFullData(this.$props)
.then(data => {
.then((data) => {
this.loadingState = null;
this.fullData = data;
})
.catch(e => {
.catch((e) => {
this.loadingState = null;
throw e;
});
......
......@@ -11,7 +11,7 @@ export default {
return h(
'div',
{},
extensions.map(extension =>
extensions.map((extension) =>
h(extension, {
props: extensions[0].props.reduce(
(acc, key) => ({
......
......@@ -3,7 +3,7 @@ import ExtensionBase from './base.vue';
// Holds all the currently registered extensions
export const extensions = [];
export const registerExtension = extension => {
export const registerExtension = (extension) => {
// Pushes into the extenions array a dynamically created Vue component
// that gets exteneded from `base.vue`
extensions.push({
......
......@@ -13,7 +13,7 @@ export default {
type: String,
required: false,
default: DANGER,
validator: value => [WARNING, DANGER].includes(value),
validator: (value) => [WARNING, DANGER].includes(value),
},
helpPath: {
type: String,
......
......@@ -51,8 +51,8 @@ export default {
this.isCancellingAutoMerge = true;
this.service
.cancelAutomaticMerge()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
eventHub.$emit('UpdateWidgetData', data);
})
.catch(() => {
......@@ -70,8 +70,8 @@ export default {
this.isRemovingSourceBranch = true;
this.service
.merge(options)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
if (AUTO_MERGE_STRATEGIES.includes(data.status)) {
eventHub.$emit('MRWidgetUpdateRequested');
}
......
......@@ -30,7 +30,7 @@ export default {
variables() {
return this.mergeRequestQueryVariables;
},
update: data => data.project.mergeRequest.userPermissions,
update: (data) => data.project.mergeRequest.userPermissions,
},
stateData: {
query: conflictsStateQuery,
......@@ -40,7 +40,7 @@ export default {
variables() {
return this.mergeRequestQueryVariables;
},
update: data => data.project.mergeRequest,
update: (data) => data.project.mergeRequest,
},
},
props: {
......
......@@ -83,8 +83,8 @@ export default {
this.service
.removeSourceBranch()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
// False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26
// eslint-disable-next-line @gitlab/require-i18n-strings
if (data.message === 'Branch was deleted') {
......
......@@ -25,7 +25,7 @@ export default {
variables() {
return this.mergeRequestQueryVariables;
},
update: data => data.project.mergeRequest,
update: (data) => data.project.mergeRequest,
},
},
props: {
......
......@@ -65,7 +65,7 @@ export default {
.then(() => {
simplePoll(this.checkRebaseStatus);
})
.catch(error => {
.catch((error) => {
this.isMakingRequest = false;
if (error.response && error.response.data && error.response.data.merge_error) {
......@@ -78,8 +78,8 @@ export default {
checkRebaseStatus(continuePolling, stopPolling) {
this.service
.poll()
.then(res => res.data)
.then(res => {
.then((res) => res.data)
.then((res) => {
if (res.rebase_in_progress) {
continuePolling();
} else {
......
......@@ -188,8 +188,8 @@ export default {
this.isMakingRequest = true;
this.service
.merge(options)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
const hasError =
data.status === MERGE_FAILED_STATUS ||
data.status === MERGE_HOOK_VALIDATION_ERROR_STATUS;
......@@ -228,8 +228,8 @@ export default {
handleMergePolling(continuePolling, stopPolling) {
this.service
.poll()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
if (data.state === 'merged') {
// If state is merged we should update the widget and stop the polling
eventHub.$emit('MRWidgetUpdateRequested');
......@@ -270,8 +270,8 @@ export default {
handleRemoveBranchPolling(continuePolling, stopPolling) {
this.service
.poll()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
// If source branch exists then we should continue polling
// because removing a source branch is a background task and takes time
if (data.source_branch_exists) {
......
......@@ -46,7 +46,7 @@ export default {
name="squash"
class="qa-squash-checkbox js-squash-checkbox gl-mb-0 gl-mr-2"
:title="tooltipTitle"
@change="checked => $emit('input', checked)"
@change="(checked) => $emit('input', checked)"
>
{{ $options.i18n.checkboxLabel }}
</gl-form-checkbox>
......
......@@ -29,7 +29,7 @@ export default {
variables() {
return this.mergeRequestQueryVariables;
},
update: data => data.project.mergeRequest.userPermissions,
update: (data) => data.project.mergeRequest.userPermissions,
},
},
props: {
......@@ -86,7 +86,7 @@ export default {
variables: mergeRequestQueryVariables,
});
const data = produce(sourceData, draftState => {
const data = produce(sourceData, (draftState) => {
// eslint-disable-next-line no-param-reassign
draftState.project.mergeRequest.workInProgress = workInProgress;
// eslint-disable-next-line no-param-reassign
......@@ -137,8 +137,8 @@ export default {
this.isMakingRequest = true;
this.service
.removeWIP()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
eventHub.$emit('UpdateWidgetData', data);
MergeRequest.toggleDraftStatus(this.mr.title, true);
})
......
......@@ -40,7 +40,7 @@ export default {
);
},
numberOfInvalidPlans() {
return Object.values(this.plansObject).filter(plan => plan.tf_report_error).length;
return Object.values(this.plansObject).filter((plan) => plan.tf_report_error).length;
},
numberOfPlans() {
return Object.keys(this.plansObject).length;
......
......@@ -38,7 +38,7 @@ export default {
.query({ query: issuesQuery, variables: { projectPath: targetProjectFullPath } })
.then(({ data }) => {
// Return some transformed data to be rendered in the expanded state
return data.project.issues.nodes.map(issue => ({
return data.project.issues.nodes.map((issue) => ({
id: issue.id, // Required: The ID of the object
text: issue.title, // Required: The text to get used on each row
// Icon to get rendered on the side of each row
......
......@@ -11,7 +11,7 @@ export default {
}
},
refreshApprovals() {
return this.service.fetchApprovals().then(data => {
return this.service.fetchApprovals().then((data) => {
this.mr.setApprovals(data);
});
},
......
......@@ -358,7 +358,7 @@ export default {
fetchActionsContent() {
this.service
.fetchMergeActionsContent()
.then(res => {
.then((res) => {
if (res.data) {
const el = document.createElement('div');
el.innerHTML = res.data;
......@@ -388,26 +388,26 @@ export default {
this.pollingInterval.stopTimer();
},
bindEventHubListeners() {
eventHub.$on('MRWidgetUpdateRequested', cb => {
eventHub.$on('MRWidgetUpdateRequested', (cb) => {
this.checkStatus(cb);
});
eventHub.$on('MRWidgetRebaseSuccess', cb => {
eventHub.$on('MRWidgetRebaseSuccess', (cb) => {
this.checkStatus(cb, true);
});
// `params` should be an Array contains a Boolean, like `[true]`
// Passing parameter as Boolean didn't work.
eventHub.$on('SetBranchRemoveFlag', params => {
eventHub.$on('SetBranchRemoveFlag', (params) => {
[this.mr.isRemovingSourceBranch] = params;
});
eventHub.$on('FailedToMerge', mergeError => {
eventHub.$on('FailedToMerge', (mergeError) => {
this.mr.state = 'failedToMerge';
this.mr.mergeError = mergeError;
});
eventHub.$on('UpdateWidgetData', data => {
eventHub.$on('UpdateWidgetData', (data) => {
this.mr.setData(data);
});
......
......@@ -60,15 +60,15 @@ export default class MRWidgetService {
}
fetchApprovals() {
return axios.get(this.apiApprovalsPath).then(res => res.data);
return axios.get(this.apiApprovalsPath).then((res) => res.data);
}
approveMergeRequest() {
return axios.post(this.apiApprovePath).then(res => res.data);
return axios.post(this.apiApprovePath).then((res) => res.data);
}
unapproveMergeRequest() {
return axios.post(this.apiUnapprovePath).then(res => res.data);
return axios.post(this.apiUnapprovePath).then((res) => res.data);
}
static executeInlineAction(url) {
......
import { s__, n__ } from '~/locale';
export const title = state => {
export const title = (state) => {
if (state.isLoading) {
return s__('BuildArtifacts|Loading artifacts');
}
......
......@@ -43,7 +43,7 @@ export default {
return this.actions.length > 1;
},
selectedAction() {
return this.actions.find(x => x.key === this.selectedKey) || this.actions[0];
return this.actions.find((x) => x.key === this.selectedKey) || this.actions[0];
},
},
methods: {
......
......@@ -48,7 +48,7 @@ export default {
groupedAwards() {
const { thumbsup, thumbsdown, ...rest } = {
...this.groupedDefaultAwards,
...groupBy(this.awards, x => x.name),
...groupBy(this.awards, (x) => x.name),
};
return [
......@@ -73,7 +73,7 @@ export default {
return false;
}
return awardList.some(award => award.user.id === this.currentUserId);
return awardList.some((award) => award.user.id === this.currentUserId);
},
createAwardList(name, list) {
return {
......@@ -95,11 +95,11 @@ export default {
// Filter myself from list if I am awarded.
if (hasReactionByCurrentUser) {
awardList = awardList.filter(award => award.user.id !== this.currentUserId);
awardList = awardList.filter((award) => award.user.id !== this.currentUserId);
}
// Get only 9-10 usernames to show in tooltip text.
const namesToShow = awardList.slice(0, TOOLTIP_NAME_COUNT).map(award => award.user.name);
const namesToShow = awardList.slice(0, TOOLTIP_NAME_COUNT).map((award) => award.user.name);
// Get the remaining list to use in `and x more` text.
const remainingAwardList = awardList.slice(TOOLTIP_NAME_COUNT, awardList.length);
......
......@@ -54,7 +54,7 @@ export default {
type: Object,
required: false,
default: undefined,
validator: ref =>
validator: (ref) =>
ref === undefined || (Number.isFinite(ref.iid) && isString(ref.path) && !isEmpty(ref.path)),
},
......
......@@ -30,8 +30,8 @@ export default {
};
},
mounted() {
document.querySelectorAll(this.selector).forEach(button => {
button.addEventListener('click', e => {
document.querySelectorAll(this.selector).forEach((button) => {
button.addEventListener('click', (e) => {
e.preventDefault();
this.path = button.dataset.path;
......
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