Commit 2f8dbd48 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 17 of 73

Part of our prettier migration; changing the arrow-parens style.
parent e7d50054
......@@ -7,7 +7,7 @@ export default () => {
const renderCommentBadge = true;
const diffFileEls = document.querySelectorAll('.timeline-content .diff-file.js-image-file');
[...diffFileEls].forEach(diffFileEl =>
[...diffFileEls].forEach((diffFileEl) =>
initImageDiffHelper.initImageDiff(diffFileEl, canCreateNote, renderCommentBadge),
);
};
......@@ -26,7 +26,7 @@ export default class ReplacedImageDiff extends ImageDiff {
this.imageEls = {};
const viewTypeNames = Object.getOwnPropertyNames(viewTypes);
viewTypeNames.forEach(viewType => {
viewTypeNames.forEach((viewType) => {
this.imageEls[viewType] = this.imageFrameEls[viewType].querySelector('img');
});
}
......@@ -62,7 +62,7 @@ export default class ReplacedImageDiff extends ImageDiff {
// Clear existing badges on new view
const existingBadges = this.imageFrameEl.querySelectorAll('.badge');
[...existingBadges].map(badge => badge.remove());
[...existingBadges].map((badge) => badge.remove());
// Remove existing references to old view image badges
this.imageBadges = [];
......
......@@ -5,5 +5,5 @@ export const viewTypes = {
};
export function isValidViewType(validate) {
return Boolean(Object.getOwnPropertyNames(viewTypes).find(viewType => viewType === validate));
return Boolean(Object.getOwnPropertyNames(viewTypes).find((viewType) => viewType === validate));
}
......@@ -7,7 +7,7 @@ import setNewNameMutation from '../graphql/mutations/set_new_name.mutation.graph
import importGroupMutation from '../graphql/mutations/import_group.mutation.graphql';
import ImportTableRow from './import_table_row.vue';
const mapApolloMutations = mutations =>
const mapApolloMutations = (mutations) =>
Object.fromEntries(
Object.entries(mutations).map(([key, mutation]) => [
key,
......
......@@ -35,7 +35,7 @@ export default {
select2Options() {
return {
data: this.availableNamespaces.map(namespace => ({
data: this.availableNamespaces.map((namespace) => ({
id: namespace.full_path,
text: namespace.full_path,
})),
......
......@@ -23,7 +23,7 @@ export function createResolvers({ endpoints }) {
} = await client.query({ query: availableNamespacesQuery });
return axios.get(endpoints.status).then(({ data }) => {
return data.importable_data.map(group => ({
return data.importable_data.map((group) => ({
__typename: clientTypenames.BulkImportSourceGroup,
...group,
status: STATUSES.NONE,
......@@ -37,7 +37,7 @@ export function createResolvers({ endpoints }) {
availableNamespaces: () =>
axios.get(endpoints.availableNamespaces).then(({ data }) =>
data.map(namespace => ({
data.map((namespace) => ({
__typename: clientTypenames.AvailableNamespace,
...namespace,
})),
......@@ -45,14 +45,14 @@ export function createResolvers({ endpoints }) {
},
Mutation: {
setTargetNamespace(_, { targetNamespace, sourceGroupId }, { client }) {
new SourceGroupsManager({ client }).updateById(sourceGroupId, sourceGroup => {
new SourceGroupsManager({ client }).updateById(sourceGroupId, (sourceGroup) => {
// eslint-disable-next-line no-param-reassign
sourceGroup.import_target.target_namespace = targetNamespace;
});
},
setNewName(_, { newName, sourceGroupId }, { client }) {
new SourceGroupsManager({ client }).updateById(sourceGroupId, sourceGroup => {
new SourceGroupsManager({ client }).updateById(sourceGroupId, (sourceGroup) => {
// eslint-disable-next-line no-param-reassign
sourceGroup.import_target.new_name = newName;
});
......
......@@ -37,7 +37,7 @@ export class SourceGroupsManager {
}
setImportStatus(group, status) {
this.update(group, sourceGroup => {
this.update(group, (sourceGroup) => {
// eslint-disable-next-line no-param-reassign
sourceGroup.status = status;
});
......
......@@ -5,7 +5,7 @@ import bulkImportSourceGroupsQuery from '../queries/bulk_import_source_groups.qu
import { STATUSES } from '../../../constants';
import { SourceGroupsManager } from './source_groups_manager';
const groupId = i => `group${i}`;
const groupId = (i) => `group${i}`;
function generateGroupsQuery(groups) {
return gql`{
......@@ -46,14 +46,14 @@ export class StatusPoller {
const { bulkImportSourceGroups } = this.client.readQuery({
query: bulkImportSourceGroupsQuery,
});
const groupsInProgress = bulkImportSourceGroups.filter(g => g.status === STATUSES.STARTED);
const groupsInProgress = bulkImportSourceGroups.filter((g) => g.status === STATUSES.STARTED);
if (groupsInProgress.length) {
const { data: results } = await this.client.query({
query: generateGroupsQuery(groupsInProgress),
fetchPolicy: 'no-cache',
});
const completedGroups = groupsInProgress.filter((_, idx) => Boolean(results[groupId(idx)]));
completedGroups.forEach(group => {
completedGroups.forEach((group) => {
this.groupManager.setImportStatus(group, STATUSES.FINISHED);
});
}
......
......@@ -12,9 +12,9 @@ import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
let eTagPoll;
const hasRedirectInError = e => e?.response?.data?.error?.redirect;
const redirectToUrlInError = e => visitUrl(e.response.data.error.redirect);
const tooManyRequests = e => e.response.status === httpStatusCodes.TOO_MANY_REQUESTS;
const hasRedirectInError = (e) => e?.response?.data?.error?.redirect;
const redirectToUrlInError = (e) => visitUrl(e.response.data.error.redirect);
const tooManyRequests = (e) => e.response.status === httpStatusCodes.TOO_MANY_REQUESTS;
const pathWithParams = ({ path, ...params }) => {
const filteredParams = Object.fromEntries(
Object.entries(params).filter(([, value]) => value !== ''),
......@@ -47,7 +47,7 @@ const importAll = ({ state, dispatch }) => {
return Promise.all(
state.repositories
.filter(isProjectImportable)
.map(r => dispatch('fetchImport', r.importSource.id)),
.map((r) => dispatch('fetchImport', r.importSource.id)),
);
};
......@@ -69,7 +69,7 @@ const fetchReposFactory = ({ reposPath = isRequired() }) => ({ state, commit })
.then(({ data }) => {
commit(types.RECEIVE_REPOS_SUCCESS, convertObjectPropsToCamelCase(data, { deep: true }));
})
.catch(e => {
.catch((e) => {
commit(types.SET_PAGE, nextPage - 1);
if (hasRedirectInError(e)) {
......@@ -114,7 +114,7 @@ const fetchImportFactory = (importPath = isRequired()) => ({ state, commit, gett
repoId,
});
})
.catch(e => {
.catch((e) => {
const serverErrorMessage = e?.response?.data?.errors;
const flashMessage = serverErrorMessage
? sprintf(
......@@ -145,7 +145,7 @@ export const fetchJobsFactory = (jobsPath = isRequired()) => ({ state, commit, d
method: 'fetchJobs',
successCallback: ({ data }) =>
commit(types.RECEIVE_JOBS_SUCCESS, convertObjectPropsToCamelCase(data, { deep: true })),
errorCallback: e => {
errorCallback: (e) => {
if (hasRedirectInError(e)) {
redirectToUrlInError(e);
} else {
......
import { STATUSES } from '../../constants';
import { isProjectImportable, isIncompatible } from '../utils';
export const isLoading = state => state.isLoadingRepos || state.isLoadingNamespaces;
export const isLoading = (state) => state.isLoadingRepos || state.isLoadingNamespaces;
export const isImportingAnyRepo = state =>
state.repositories.some(repo =>
export const isImportingAnyRepo = (state) =>
state.repositories.some((repo) =>
[STATUSES.SCHEDULING, STATUSES.SCHEDULED, STATUSES.STARTED].includes(
repo.importedProject?.importStatus,
),
);
export const hasIncompatibleRepos = state => state.repositories.some(isIncompatible);
export const hasIncompatibleRepos = (state) => state.repositories.some(isIncompatible);
export const hasImportableRepos = state => state.repositories.some(isProjectImportable);
export const hasImportableRepos = (state) => state.repositories.some(isProjectImportable);
export const importAllCount = state => state.repositories.filter(isProjectImportable).length;
export const importAllCount = (state) => state.repositories.filter(isProjectImportable).length;
export const getImportTarget = state => repoId => {
export const getImportTarget = (state) => (repoId) => {
if (state.customImportTargets[repoId]) {
return state.customImportTargets[repoId];
}
const repo = state.repositories.find(r => r.importSource.id === repoId);
const repo = state.repositories.find((r) => r.importSource.id === repoId);
return {
newName: repo.importSource.sanitizedName,
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import * as types from './mutation_types';
import { STATUSES } from '../../constants';
const makeNewImportedProject = importedProject => ({
const makeNewImportedProject = (importedProject) => ({
importSource: {
id: importedProject.id,
fullName: importedProject.importSource,
......@@ -12,15 +12,15 @@ const makeNewImportedProject = importedProject => ({
importedProject,
});
const makeNewIncompatibleProject = project => ({
const makeNewIncompatibleProject = (project) => ({
importSource: { ...project, incompatible: true },
importedProject: null,
});
const processLegacyEntries = ({ newRepositories, existingRepositories, factory }) => {
const newEntries = [];
newRepositories.forEach(project => {
const existingProject = existingRepositories.find(p => p.importSource.id === project.id);
newRepositories.forEach((project) => {
const existingProject = existingRepositories.find((p) => p.importSource.id === project.id);
const importedProjectShape = factory(project);
if (existingProject) {
......@@ -66,7 +66,7 @@ export default {
state.repositories = [
...newImportedProjects,
...state.repositories,
...repositories.providerRepos.map(project => ({
...repositories.providerRepos.map((project) => ({
importSource: project,
importedProject: null,
})),
......@@ -91,7 +91,7 @@ export default {
},
[types.REQUEST_IMPORT](state, { repoId, importTarget }) {
const existingRepo = state.repositories.find(r => r.importSource.id === repoId);
const existingRepo = state.repositories.find((r) => r.importSource.id === repoId);
existingRepo.importedProject = {
importStatus: STATUSES.SCHEDULING,
fullPath: `/${importTarget.targetNamespace}/${importTarget.newName}`,
......@@ -99,18 +99,18 @@ export default {
},
[types.RECEIVE_IMPORT_SUCCESS](state, { importedProject, repoId }) {
const existingRepo = state.repositories.find(r => r.importSource.id === repoId);
const existingRepo = state.repositories.find((r) => r.importSource.id === repoId);
existingRepo.importedProject = importedProject;
},
[types.RECEIVE_IMPORT_ERROR](state, repoId) {
const existingRepo = state.repositories.find(r => r.importSource.id === repoId);
const existingRepo = state.repositories.find((r) => r.importSource.id === repoId);
existingRepo.importedProject = null;
},
[types.RECEIVE_JOBS_SUCCESS](state, updatedProjects) {
updatedProjects.forEach(updatedProject => {
const repo = state.repositories.find(p => p.importedProject?.id === updatedProject.id);
updatedProjects.forEach((updatedProject) => {
const repo = state.repositories.find((p) => p.importedProject?.id === updatedProject.id);
if (repo?.importedProject) {
repo.importedProject.importStatus = updatedProject.importStatus;
}
......@@ -131,7 +131,7 @@ export default {
},
[types.SET_IMPORT_TARGET](state, { repoId, importTarget }) {
const existingRepo = state.repositories.find(r => r.importSource.id === repoId);
const existingRepo = state.repositories.find((r) => r.importSource.id === repoId);
if (
importTarget.targetNamespace === state.defaultTargetNamespace &&
......
......@@ -2,7 +2,7 @@ import $ from 'jquery';
import { stickyMonitor } from './lib/utils/sticky';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
export default stickyTop => {
export default (stickyTop) => {
stickyMonitor(document.querySelector('.js-diff-files-changed'), stickyTop);
initDeprecatedJQueryDropdown($('.js-diff-stats-dropdown'), {
......
......@@ -92,7 +92,7 @@ export default {
return isEmpty(this.value) && this.required;
},
options() {
return this.choices.map(choice => {
return this.choices.map((choice) => {
return {
value: choice[1],
text: choice[0],
......
......@@ -40,7 +40,7 @@ export default {
},
data() {
return {
selected: dropdownOptions.find(x => x.value === this.override),
selected: dropdownOptions.find((x) => x.value === this.override),
};
},
computed: {
......
export const isInheriting = state => (state.defaultState === null ? false : !state.override);
export const isInheriting = (state) => (state.defaultState === null ? false : !state.override);
export const isDisabled = state => state.isSaving || state.isTesting || state.isResetting;
export const isDisabled = (state) => state.isSaving || state.isTesting || state.isResetting;
export const propsSource = (state, getters) =>
getters.isInheriting ? state.defaultState : state.customState;
......
......@@ -23,7 +23,7 @@ export default class IntegrationSettingsForm {
document.querySelector('.js-vue-integration-settings'),
document.querySelector('.js-vue-default-integration-settings'),
);
eventHub.$on('toggle', active => {
eventHub.$on('toggle', (active) => {
this.formActive = active;
this.toggleServiceState();
});
......
......@@ -16,6 +16,6 @@ export default function initInviteMembersModal() {
return new Vue({
el,
provide: { membersPath },
render: createElement => createElement(InviteMemberModal),
render: (createElement) => createElement(InviteMemberModal),
});
}
......@@ -11,6 +11,6 @@ export default function initInviteMembersTrigger() {
return new Vue({
el,
provide: { ...el.dataset },
render: createElement => createElement(InviteMemberTrigger),
render: (createElement) => createElement(InviteMemberTrigger),
});
}
......@@ -93,7 +93,7 @@ export default {
},
selectedRoleName() {
return Object.keys(this.accessLevels).find(
key => this.accessLevels[key] === Number(this.selectedAccessLevel),
(key) => this.accessLevels[key] === Number(this.selectedAccessLevel),
);
},
},
......
......@@ -34,7 +34,7 @@ export default {
computed: {
newUsersToInvite() {
return this.selectedTokens
.map(obj => {
.map((obj) => {
return obj.id;
})
.join(',');
......@@ -55,8 +55,8 @@ export default {
},
retrieveUsers: debounce(function debouncedRetrieveUsers() {
return Api.users(this.query, this.$options.queryOptions)
.then(response => {
this.users = response.data.map(token => ({
.then((response) => {
this.users = response.data.map((token) => ({
id: token.id,
name: token.name,
username: token.username,
......
......@@ -13,7 +13,7 @@ export default function initInviteMembersModal() {
return new Vue({
el,
render: createElement =>
render: (createElement) =>
createElement(InviteMembersModal, {
props: {
...el.dataset,
......
......@@ -10,7 +10,7 @@ export default function initInviteMembersTrigger() {
return new Vue({
el,
render: createElement =>
render: (createElement) =>
createElement(InviteMembersTrigger, {
props: {
...el.dataset,
......
......@@ -101,7 +101,7 @@ export default {
// Collect unique label IDs for all checked issues
this.getElement('.selected-issuable:checked').each((i, el) => {
issuableLabels = this.getElement(`#${this.prefixId}${el.dataset.id}`).data('labels');
issuableLabels.forEach(labelId => {
issuableLabels.forEach((labelId) => {
// Store unique IDs
if (uniqueIds.indexOf(labelId) === -1) {
uniqueIds.push(labelId);
......@@ -113,7 +113,7 @@ export default {
// Add uniqueIds to add it as argument for _.intersection
labelIds.unshift(uniqueIds);
// Return IDs that are present but not in all selected issueables
return uniqueIds.filter(x => !intersection.apply(this, labelIds).includes(x));
return uniqueIds.filter((x) => !intersection.apply(this, labelIds).includes(x));
},
getElement(selector) {
......
......@@ -39,9 +39,9 @@ export default class IssuableBulkUpdateSidebar {
}
bindEvents() {
this.$bulkUpdateEnableBtn.on('click', e => this.toggleBulkEdit(e, true));
this.$bulkEditCancelBtn.on('click', e => this.toggleBulkEdit(e, false));
this.$checkAllContainer.on('click', e => this.selectAll(e));
this.$bulkUpdateEnableBtn.on('click', (e) => this.toggleBulkEdit(e, true));
this.$bulkEditCancelBtn.on('click', (e) => this.toggleBulkEdit(e, false));
this.$checkAllContainer.on('click', (e) => this.selectAll(e));
this.$issuesList.on('change', () => this.updateFormState());
this.$bulkEditSubmitBtn.on('click', () => this.prepForSubmit());
this.$checkAllContainer.on('click', () => this.updateFormState());
......@@ -159,7 +159,7 @@ export default class IssuableBulkUpdateSidebar {
const $checkedIssues = $('.selected-issuable:checked');
if ($checkedIssues.length > 0) {
return $.map($checkedIssues, value => $(value).data('id'));
return $.map($checkedIssues, (value) => $(value).data('id'));
}
return [];
......
......@@ -31,7 +31,7 @@ export default class IssuableContext {
});
$(document)
.off('click', '.issuable-sidebar .dropdown-content a')
.on('click', '.issuable-sidebar .dropdown-content a', e => e.preventDefault());
.on('click', '.issuable-sidebar .dropdown-content a', (e) => e.preventDefault());
$(document)
.off('click', '.edit-link')
......
......@@ -89,9 +89,9 @@ export default class IssuableForm {
theme: 'gitlab-theme animate-picker',
format: 'yyyy-mm-dd',
container: $issuableDueDate.parent().get(0),
parse: dateString => parsePikadayDate(dateString),
toString: date => pikadayToString(date),
onSelect: dateText => $issuableDueDate.val(calendar.toString(dateText)),
parse: (dateString) => parsePikadayDate(dateString),
toString: (date) => pikadayToString(date),
onSelect: (dateText) => $issuableDueDate.val(calendar.toString(dateText)),
firstDay: gon.first_day_of_week,
});
calendar.setDate(parsePikadayDate($issuableDueDate.val()));
......@@ -202,7 +202,7 @@ export default class IssuableForm {
results(data) {
return {
// `data` keys are translated so we can't just access them with a string based key
results: data[Object.keys(data)[0]].map(name => ({
results: data[Object.keys(data)[0]].map((name) => ({
id: name,
text: name,
})),
......
......@@ -13,7 +13,7 @@ export default class IssuableIndex {
static resetIncomingEmailToken() {
const $resetToken = $('.incoming-email-token-reset');
$resetToken.on('click', e => {
$resetToken.on('click', (e) => {
e.preventDefault();
$resetToken.text(s__('EmailToken|resetting...'));
......
......@@ -200,7 +200,7 @@ export default {
this.checkedIssuables[this.issuableId(issuable)].checked = value;
},
handleAllIssuablesCheckedInput(value) {
Object.keys(this.checkedIssuables).forEach(issuableId => {
Object.keys(this.checkedIssuables).forEach((issuableId) => {
this.checkedIssuables[issuableId].checked = value;
});
},
......
......@@ -29,7 +29,7 @@ export default {
skip() {
return this.isSearchEmpty;
},
update: data => data.project.issues.edges.map(({ node }) => node),
update: (data) => data.project.issues.edges.map(({ node }) => node),
variables() {
return {
fullPath: this.projectPath,
......
......@@ -23,7 +23,7 @@ export default class Issue {
}
// Listen to state changes in the Vue app
document.addEventListener('issuable_vue_app:change', event => {
document.addEventListener('issuable_vue_app:change', (event) => {
this.updateTopState(event.detail.isClosed, event.detail.data);
});
}
......@@ -80,7 +80,7 @@ export default class Issue {
alertMovedFromServiceDeskWarning.show();
}
alertMovedFromServiceDeskWarning.on('click', '.js-close', e => {
alertMovedFromServiceDeskWarning.on('click', '.js-close', (e) => {
e.preventDefault();
e.stopImmediatePropagation();
alertMovedFromServiceDeskWarning.remove();
......
......@@ -250,7 +250,7 @@ export default {
this.poll = new Poll({
resource: this.service,
method: 'getData',
successCallback: res => this.store.updateState(res.data),
successCallback: (res) => this.store.updateState(res.data),
errorCallback(err) {
throw new Error(err);
},
......@@ -294,8 +294,8 @@ export default {
updateStoreState() {
return this.service
.getData()
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
this.store.updateState(data);
})
.catch(() => {
......@@ -320,7 +320,7 @@ export default {
requestTemplatesAndShowForm() {
return this.service
.loadTemplates(this.issuableTemplateNamesPath)
.then(res => {
.then((res) => {
this.updateAndShowForm(res.data);
})
.catch(() => {
......@@ -345,9 +345,9 @@ export default {
updateIssuable() {
return this.service
.updateIssuable(this.store.formState)
.then(res => res.data)
.then(data => this.checkForSpam(data))
.then(data => {
.then((res) => res.data)
.then((data) => this.checkForSpam(data))
.then((data) => {
if (!window.location.pathname.includes(data.web_url)) {
visitUrl(data.web_url);
}
......@@ -384,8 +384,8 @@ export default {
deleteIssuable(payload) {
return this.service
.deleteIssuable(payload)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
// Stop the poll so we don't get 404's with the issuable not existing
this.poll.stop();
......
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