Commit bcbbcb2e authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 28 of 73

Part of our prettier migration; changing the arrow-parens style.
parent a4c662da
......@@ -172,7 +172,7 @@ export class SearchAutocomplete {
term,
},
})
.then(response => {
.then((response) => {
const options = this.scopedSearchOptions(term);
// List results
......@@ -345,7 +345,7 @@ export class SearchAutocomplete {
this.clearInput.on('click', this.onClearInputClick);
this.dropdownContent.on('scroll', throttle(this.setScrollFade, 250));
this.searchInput.on('click', e => {
this.searchInput.on('click', (e) => {
e.stopPropagation();
});
}
......
......@@ -9,7 +9,7 @@ const TWO_MINUTES = 120000;
function backOffRequest(makeRequestCallback) {
return backOff((next, stop) => {
makeRequestCallback()
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.ACCEPTED) {
next();
} else {
......@@ -30,24 +30,24 @@ export const requestCreateProject = ({ dispatch, state, commit }) => {
commit(types.SET_LOADING, true);
axios
.post(state.createProjectEndpoint)
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.ACCEPTED) {
dispatch('requestCreateProjectStatus', resp.data.job_id);
}
})
.catch(error => {
.catch((error) => {
dispatch('requestCreateProjectError', error);
});
};
export const requestCreateProjectStatus = ({ dispatch, state }, jobId) => {
backOffRequest(() => axios.get(state.createProjectStatusEndpoint, { params: { job_id: jobId } }))
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.OK) {
dispatch('requestCreateProjectSuccess', resp.data);
}
})
.catch(error => {
.catch((error) => {
dispatch('requestCreateProjectError', error);
});
};
......@@ -82,24 +82,24 @@ export const requestDeleteProject = ({ dispatch, state, commit }) => {
commit(types.SET_LOADING, true);
axios
.delete(state.deleteProjectEndpoint)
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.ACCEPTED) {
dispatch('requestDeleteProjectStatus', resp.data.job_id);
}
})
.catch(error => {
.catch((error) => {
dispatch('requestDeleteProjectError', error);
});
};
export const requestDeleteProjectStatus = ({ dispatch, state }, jobId) => {
backOffRequest(() => axios.get(state.deleteProjectStatusEndpoint, { params: { job_id: jobId } }))
.then(resp => {
.then((resp) => {
if (resp.status === statusCodes.OK) {
dispatch('requestDeleteProjectSuccess', resp.data);
}
})
.catch(error => {
.catch((error) => {
dispatch('requestDeleteProjectError', error);
});
};
......
......@@ -6,7 +6,7 @@ import mutations from './mutations';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
modules: {
selfMonitoring: {
......
......@@ -13,7 +13,7 @@ export default function initSentryErrorStacktrace() {
SentryErrorStackTrace,
},
store,
render: createElement =>
render: (createElement) =>
createElement('sentry-error-stack-trace', {
props: { issueStackTracePath },
}),
......
......@@ -39,13 +39,13 @@ export default {
}, {});
},
extractTimeData() {
return this.chartData.requests.map(data => data.time);
return this.chartData.requests.map((data) => data.time);
},
generateSeries() {
return {
name: __('Invocations'),
type: 'line',
data: this.chartData.requests.map(data => [data.time, data.value]),
data: this.chartData.requests.map((data) => [data.time, data.value]),
symbolSize: 0,
};
},
......@@ -69,7 +69,7 @@ export default {
name: 'time',
type: 'time',
axisLabel: {
formatter: date => dateFormat(date, 'h:MM TT'),
formatter: (date) => dateFormat(date, 'h:MM TT'),
},
data: this.extractTimeData,
nameTextStyle: {
......@@ -90,7 +90,7 @@ export default {
};
},
xAxisLabel() {
return this.graphData.queries.map(query => query.label).join(', ');
return this.graphData.queries.map((query) => query.label).join(', ');
},
yAxisLabel() {
const [query] = this.graphData.queries;
......
......@@ -30,7 +30,7 @@ export const receiveMetricsError = ({ commit }, error) =>
export const fetchFunctions = ({ dispatch }, { functionsPath }) => {
let retryCount = 0;
const functionsPartiallyFetched = data => {
const functionsPartiallyFetched = (data) => {
if (data.functions !== null && data.functions.length) {
dispatch('receiveFunctionsPartial', data);
}
......@@ -41,7 +41,7 @@ export const fetchFunctions = ({ dispatch }, { functionsPath }) => {
backOff((next, stop) => {
axios
.get(functionsPath)
.then(response => {
.then((response) => {
if (response.data.knative_installed === CHECKING_INSTALLED) {
retryCount += 1;
if (retryCount < MAX_REQUESTS) {
......@@ -56,7 +56,7 @@ export const fetchFunctions = ({ dispatch }, { functionsPath }) => {
})
.catch(stop);
})
.then(data => {
.then((data) => {
if (data === TIMEOUT) {
dispatch('receiveFunctionsTimeout');
createFlash(__('Loading functions timed out. Please reload the page to try again.'));
......@@ -66,7 +66,7 @@ export const fetchFunctions = ({ dispatch }, { functionsPath }) => {
dispatch('receiveFunctionsNoDataSuccess', data);
}
})
.catch(error => {
.catch((error) => {
dispatch('receiveFunctionsError', error);
createFlash(error);
});
......@@ -83,7 +83,7 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => {
backOff((next, stop) => {
axios
.get(metricsPath)
.then(response => {
.then((response) => {
if (response.status === statusCodes.NO_CONTENT) {
retryCount += 1;
if (retryCount < MAX_REQUESTS) {
......@@ -98,15 +98,15 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => {
})
.catch(stop);
})
.then(data => {
.then((data) => {
if (data === null) {
return;
}
const updatedMetric = data.metrics;
const queries = data.metrics.queries.map(query => ({
const queries = data.metrics.queries.map((query) => ({
...query,
result: query.result.map(result => ({
result: query.result.map((result) => ({
...result,
values: result.values.map(([timestamp, value]) => ({
time: new Date(timestamp * 1000).toISOString(),
......@@ -118,7 +118,7 @@ export const fetchMetrics = ({ dispatch }, { metricsPath, hasPrometheus }) => {
updatedMetric.queries = queries;
dispatch('receiveMetricsSuccess', updatedMetric);
})
.catch(error => {
.catch((error) => {
dispatch('receiveMetricsError', error);
createFlash(error);
});
......
import { translate } from '../utils';
export const hasPrometheusMissingData = state => state.hasPrometheus && !state.hasPrometheusData;
export const hasPrometheusMissingData = (state) => state.hasPrometheus && !state.hasPrometheusData;
// Convert the function list into a k/v grouping based on the environment scope
export const getFunctions = state => translate(state.functions);
export const getFunctions = (state) => translate(state.functions);
// Validate that the object coming in has valid query details and results
export const validateGraphData = data =>
export const validateGraphData = (data) =>
data.queries &&
Array.isArray(data.queries) &&
data.queries.filter(query => {
data.queries.filter((query) => {
if (Array.isArray(query.result)) {
return query.result.filter(res => Array.isArray(res.values)).length === query.result.length;
return query.result.filter((res) => Array.isArray(res.values)).length === query.result.length;
}
return false;
}).length === data.queries.length;
export const translate = functions =>
export const translate = (functions) =>
functions.reduce(
(acc, func) =>
Object.assign(acc, {
......
......@@ -3,7 +3,7 @@ export const AVAILABILITY_STATUS = {
NOT_SET: 'not_set',
};
export const isUserBusy = status => status === AVAILABILITY_STATUS.BUSY;
export const isUserBusy = (status) => status === AVAILABILITY_STATUS.BUSY;
export const isValidAvailibility = availability =>
export const isValidAvailibility = (availability) =>
availability.length ? Object.values(AVAILABILITY_STATUS).includes(availability) : true;
......@@ -34,8 +34,8 @@ export default {
return !this.users.length;
},
sortedAssigness() {
const canMergeUsers = this.users.filter(user => user.can_merge);
const canNotMergeUsers = this.users.filter(user => !user.can_merge);
const canMergeUsers = this.users.filter((user) => user.can_merge);
const canNotMergeUsers = this.users.filter((user) => !user.can_merge);
return [...canMergeUsers, ...canNotMergeUsers];
},
......
......@@ -59,7 +59,7 @@ export default {
handleFetchResult({ data }) {
const { nodes } = data.project.issue.assignees;
const assignees = nodes.map(n => ({
const assignees = nodes.map((n) => ({
...n,
avatar_url: n.avatarUrl,
id: getIdFromGraphQLId(n.id),
......
......@@ -39,7 +39,7 @@ export default {
return this.users.length > 2;
},
allAssigneesCanMerge() {
return this.users.every(user => user.can_merge);
return this.users.every((user) => user.can_merge);
},
sidebarAvatarCounter() {
if (this.users.length > DEFAULT_MAX_COUNTER) {
......@@ -58,7 +58,7 @@ export default {
return '';
}
const mergeLength = this.users.filter(u => u.can_merge).length;
const mergeLength = this.users.filter((u) => u.can_merge).length;
if (mergeLength === this.users.length) {
return '';
......@@ -74,7 +74,7 @@ export default {
tooltipTitle() {
const maxRender = Math.min(DEFAULT_RENDER_COUNT, this.users.length);
const renderUsers = this.users.slice(0, maxRender);
const names = renderUsers.map(u => u.name);
const names = renderUsers.map((u) => u.name);
if (!this.users.length) {
return __('Assignee(s)');
......
......@@ -48,7 +48,7 @@ export default {
.then(() => {
eventHub.$emit('updateIssuableConfidentiality', confidential);
})
.catch(err => {
.catch((err) => {
Flash(
err || __('Something went wrong trying to change the confidentiality of this issue'),
);
......
......@@ -33,7 +33,7 @@ export default {
return this.users.length > 2;
},
allReviewersCanMerge() {
return this.users.every(user => user.can_merge);
return this.users.every((user) => user.can_merge);
},
sidebarAvatarCounter() {
if (this.users.length > DEFAULT_MAX_COUNTER) {
......@@ -48,7 +48,7 @@ export default {
return this.users.slice(0, collapsedLength);
},
tooltipTitleMergeStatus() {
const mergeLength = this.users.filter(u => u.can_merge).length;
const mergeLength = this.users.filter((u) => u.can_merge).length;
if (mergeLength === this.users.length) {
return '';
......@@ -64,7 +64,7 @@ export default {
tooltipTitle() {
const maxRender = Math.min(DEFAULT_RENDER_COUNT, this.users.length);
const renderUsers = this.users.slice(0, maxRender);
const names = renderUsers.map(u => u.name);
const names = renderUsers.map((u) => u.name);
if (!this.users.length) {
return __('Reviewer(s)');
......
......@@ -36,8 +36,8 @@ export default {
return !this.users.length;
},
sortedReviewers() {
const canMergeUsers = this.users.filter(user => user.can_merge);
const canNotMergeUsers = this.users.filter(user => !user.can_merge);
const canMergeUsers = this.users.filter((user) => user.can_merge);
const canNotMergeUsers = this.users.filter((user) => !user.can_merge);
return [...canMergeUsers, ...canNotMergeUsers];
},
......
......@@ -41,7 +41,7 @@ export default {
type: String,
required: false,
default: ISSUABLE_TYPES.INCIDENT,
validator: value => {
validator: (value) => {
// currently severity is supported only for incidents, but this list might be extended
return [ISSUABLE_TYPES.INCIDENT].includes(value);
},
......@@ -67,7 +67,7 @@ export default {
return this.isDropdownShowing ? 'show' : 'gl-display-none';
},
selectedItem() {
return this.severitiesList.find(severity => severity.value === this.severity);
return this.severitiesList.find((severity) => severity.value === this.severity);
},
},
mounted() {
......@@ -106,7 +106,7 @@ export default {
projectPath: this.projectPath,
},
})
.then(resp => {
.then((resp) => {
const {
data: {
issueSetSeverity: {
......
......@@ -27,7 +27,7 @@ export default {
listenForQuickActions() {
$(document).on('ajax:success', '.gfm-form', this.quickActionListened);
eventHub.$on('timeTrackingUpdated', data => {
eventHub.$on('timeTrackingUpdated', (data) => {
this.quickActionListened({ detail: [data] });
});
},
......
......@@ -46,14 +46,14 @@ class SidebarMoveIssue {
() => new window.Flash(__('An error occurred while fetching projects autocomplete.')),
);
},
renderRow: project => `
renderRow: (project) => `
<li>
<a href="#" class="js-move-issue-dropdown-item">
${escape(project.name_with_namespace)}
</a>
</li>
`,
clicked: options => {
clicked: (options) => {
const project = options.selectedObj;
const selectedProjectId = options.isMarking ? project.id : 0;
this.mediator.setMoveToProjectId(selectedProjectId);
......
......@@ -16,7 +16,7 @@ export default class SidebarMilestone {
components: {
timeTracker,
},
render: createElement =>
render: (createElement) =>
createElement('timeTracker', {
props: {
timeEstimate: parseInt(timeEstimate, 10),
......
......@@ -40,7 +40,7 @@ function mountAssigneesComponent(mediator) {
components: {
SidebarAssignees,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-assignees', {
props: {
mediator,
......@@ -70,7 +70,7 @@ function mountReviewersComponent(mediator) {
components: {
SidebarReviewers,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-reviewers', {
props: {
mediator,
......@@ -105,7 +105,7 @@ export function mountSidebarLabels() {
allowScopedLabels: parseBoolean(el.dataset.allowScopedLabels),
initiallySelectedLabels: JSON.parse(el.dataset.selectedLabels),
},
render: createElement => createElement(SidebarLabels),
render: (createElement) => createElement(SidebarLabels),
});
}
......@@ -128,7 +128,7 @@ function mountConfidentialComponent(mediator) {
components: {
ConfidentialIssueSidebar,
},
render: createElement =>
render: (createElement) =>
createElement('confidential-issue-sidebar', {
props: {
iid: String(iid),
......@@ -163,20 +163,20 @@ function mountLockComponent() {
);
} else {
importStore = import(/* webpackChunkName: 'mrNotesStore' */ '~/mr_notes/stores').then(
store => store.default,
(store) => store.default,
);
}
importStore
.then(
store =>
(store) =>
new Vue({
el,
store,
provide: {
fullPath,
},
render: createElement =>
render: (createElement) =>
createElement(IssuableLockForm, {
props: {
isEditable: initialData.is_editable,
......@@ -200,7 +200,7 @@ function mountParticipantsComponent(mediator) {
components: {
sidebarParticipants,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-participants', {
props: {
mediator,
......@@ -220,7 +220,7 @@ function mountSubscriptionsComponent(mediator) {
components: {
sidebarSubscriptions,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-subscriptions', {
props: {
mediator,
......@@ -240,7 +240,7 @@ function mountTimeTrackingComponent() {
components: {
SidebarTimeTracking,
},
render: createElement => createElement('sidebar-time-tracking', {}),
render: (createElement) => createElement('sidebar-time-tracking', {}),
});
}
......@@ -262,7 +262,7 @@ function mountSeverityComponent() {
components: {
SidebarSeverity,
},
render: createElement =>
render: (createElement) =>
createElement('sidebar-severity', {
props: {
projectPath: fullPath,
......
......@@ -30,7 +30,7 @@ export default class SidebarMediator {
}
saveAssignees(field) {
const selected = this.store.assignees.map(u => u.id);
const selected = this.store.assignees.map((u) => u.id);
// If there are no ids, that means we have to unassign (which is id = 0)
// And it only accepts an array, hence [0]
......@@ -41,7 +41,7 @@ export default class SidebarMediator {
}
saveReviewers(field) {
const selected = this.store.reviewers.map(u => u.id);
const selected = this.store.reviewers.map((u) => u.id);
// If there are no ids, that means we have to unassign (which is id = 0)
// And it only accepts an array, hence [0]
......@@ -80,7 +80,7 @@ export default class SidebarMediator {
this.store.setSubscribedState(!this.store.subscribed);
this.store.setFetchingState('subscriptions', false);
})
.catch(err => {
.catch((err) => {
this.store.setFetchingState('subscriptions', false);
throw err;
});
......
export const toLabelGid = id => `gid://gitlab/Label/${id}`;
export const toLabelGid = (id) => `gid://gitlab/Label/${id}`;
......@@ -39,7 +39,7 @@ export default class SingleFileDiff {
this.$chevronDownIcon.removeClass('gl-display-none');
}
$('.js-file-title, .click-to-expand', this.file).on('click', e => {
$('.js-file-title, .click-to-expand', this.file).on('click', (e) => {
this.toggleDiff($(e.target));
});
}
......
......@@ -119,7 +119,7 @@ export default class SmartInterval {
.then(() => {
this.isLoading = false;
})
.catch(err => {
.catch((err) => {
this.isLoading = false;
throw err;
});
......
const hide = el => el.classList.add('d-none');
const show = el => el.classList.remove('d-none');
const hide = (el) => el.classList.add('d-none');
const show = (el) => el.classList.remove('d-none');
const setupCollapsibleInput = el => {
const setupCollapsibleInput = (el) => {
const collapsedEl = el.querySelector('.js-collapsed');
const expandedEl = el.querySelector('.js-expanded');
const collapsedInputEl = collapsedEl.querySelector('textarea,input,select');
......@@ -21,7 +21,7 @@ const setupCollapsibleInput = el => {
// NOTE:
// We add focus listener to all form inputs so that we can collapse
// when something is focused that's not the expanded input.
formEl.addEventListener('focusin', e => {
formEl.addEventListener('focusin', (e) => {
if (e.target === collapsedInputEl) {
expand();
expandedInputEl.focus();
......
......@@ -73,7 +73,7 @@ export default {
return this.actions.length > 0;
},
hasValidBlobs() {
return this.actions.every(x => x.content);
return this.actions.every((x) => x.content);
},
updatePrevented() {
return this.snippet.title === '' || !this.hasValidBlobs || this.isUpdating;
......@@ -130,7 +130,7 @@ export default {
},
getAttachedFiles() {
const fileInputs = Array.from(this.$el.querySelectorAll('[name="files[]"]'));
return fileInputs.map(node => node.value);
return fileInputs.map((node) => node.value);
},
createMutation() {
return {
......@@ -166,7 +166,7 @@ export default {
redirectTo(baseObj.snippet.webUrl);
}
})
.catch(e => {
.catch((e) => {
this.flashAPIFailure(e);
});
},
......
......@@ -74,7 +74,7 @@ export default {
this.blobsOrig = blobsById;
this.blobs = cloneDeep(blobsById);
this.blobIds = blobs.map(x => x.id);
this.blobIds = blobs.map((x) => x.id);
// Show 1 empty blob if none exist
if (!this.blobIds.length) {
......@@ -108,7 +108,7 @@ export default {
this.blobIds.push(blob.id);
},
deleteBlob(id) {
this.blobIds = this.blobIds.filter(x => x !== id);
this.blobIds = this.blobIds.filter((x) => x !== id);
this.$delete(this.blobs, id);
},
updateBlob(id, args) {
......
......@@ -55,12 +55,12 @@ export default {
axios
.get(url, {
// This prevents axios from automatically JSON.parse response
transformResponse: [f => f],
transformResponse: [(f) => f],
})
.then(res => {
.then((res) => {
this.notifyAboutUpdates({ content: res.data });
})
.catch(e => this.flashAPIFailure(e));
.catch((e) => this.flashAPIFailure(e));
},
flashAPIFailure(err) {
Flash(sprintf(SNIPPET_BLOB_CONTENT_FETCH_ERROR, { err }));
......
......@@ -88,7 +88,7 @@ export default {
const {
blobs: { nodes: dataBlobs },
} = data.snippets.nodes[0];
const updatedBlobData = dataBlobs.find(blob => blob.path === blobPath);
const updatedBlobData = dataBlobs.find((blob) => blob.path === blobPath);
return updatedBlobData.richData || updatedBlobData.plainData;
},
},
......
......@@ -69,7 +69,7 @@ export default {
},
computed: {
snippetHasBinary() {
return Boolean(this.snippet.blobs.find(blob => blob.binary));
return Boolean(this.snippet.blobs.find((blob) => blob.binary));
},
authoredMessage() {
return this.snippet.author
......@@ -164,7 +164,7 @@ export default {
this.closeDeleteModal();
this.redirectToSnippets();
})
.catch(err => {
.catch((err) => {
this.isDeleting = false;
this.errorMessage = err.message;
});
......
......@@ -11,7 +11,7 @@ export const getSnippetMixin = {
ids: [this.snippetGid],
};
},
update: data => {
update: (data) => {
const res = data.snippets.nodes[0];
if (res) {
res.blobs = res.blobs.nodes;
......
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