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

Run prettier on 32 files - 26 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 66da0984
...@@ -22,7 +22,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger') ...@@ -22,7 +22,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger')
if (!triggerEls) return; if (!triggerEls) return;
triggerEls.forEach(triggerEl => { triggerEls.forEach((triggerEl) => {
const targetEl = triggerEl.previousElementSibling; const targetEl = triggerEl.previousElementSibling;
if (!targetEl) { if (!targetEl) {
...@@ -31,7 +31,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger') ...@@ -31,7 +31,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger')
triggerEl.addEventListener( triggerEl.addEventListener(
'click', 'click',
e => { (e) => {
targetEl.classList.add('is-expanded'); targetEl.classList.add('is-expanded');
e.target.remove(); e.target.remove();
}, },
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
items: { items: {
type: Array, type: Array,
required: true, required: true,
validator: items => Array.isArray(items) && items.every(item => item.name), validator: (items) => Array.isArray(items) && items.every((item) => item.name),
}, },
/** /**
......
...@@ -50,9 +50,9 @@ export default { ...@@ -50,9 +50,9 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
matches: state => state.matches, matches: (state) => state.matches,
lastQuery: state => state.query, lastQuery: (state) => state.query,
selectedRef: state => state.selectedRef, selectedRef: (state) => state.selectedRef,
}), }),
...mapGetters(['isLoading', 'isQueryPossiblyASha']), ...mapGetters(['isLoading', 'isQueryPossiblyASha']),
i18n() { i18n() {
......
...@@ -18,10 +18,10 @@ export const searchBranches = ({ commit, state }) => { ...@@ -18,10 +18,10 @@ export const searchBranches = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.branches(state.projectId, state.query) Api.branches(state.projectId, state.query)
.then(response => { .then((response) => {
commit(types.RECEIVE_BRANCHES_SUCCESS, response); commit(types.RECEIVE_BRANCHES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_BRANCHES_ERROR, error); commit(types.RECEIVE_BRANCHES_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -33,10 +33,10 @@ export const searchTags = ({ commit, state }) => { ...@@ -33,10 +33,10 @@ export const searchTags = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.tags(state.projectId, state.query) Api.tags(state.projectId, state.query)
.then(response => { .then((response) => {
commit(types.RECEIVE_TAGS_SUCCESS, response); commit(types.RECEIVE_TAGS_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_TAGS_ERROR, error); commit(types.RECEIVE_TAGS_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -50,10 +50,10 @@ export const searchCommits = ({ commit, state, getters }) => { ...@@ -50,10 +50,10 @@ export const searchCommits = ({ commit, state, getters }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.commit(state.projectId, state.query) Api.commit(state.projectId, state.query)
.then(response => { .then((response) => {
commit(types.RECEIVE_COMMITS_SUCCESS, response); commit(types.RECEIVE_COMMITS_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_COMMITS_ERROR, error); commit(types.RECEIVE_COMMITS_ERROR, error);
}) })
.finally(() => { .finally(() => {
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
[types.RECEIVE_BRANCHES_SUCCESS](state, response) { [types.RECEIVE_BRANCHES_SUCCESS](state, response) {
state.matches.branches = { state.matches.branches = {
list: convertObjectPropsToCamelCase(response.data).map(b => ({ list: convertObjectPropsToCamelCase(response.data).map((b) => ({
name: b.name, name: b.name,
default: b.default, default: b.default,
})), })),
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
[types.RECEIVE_TAGS_SUCCESS](state, response) { [types.RECEIVE_TAGS_SUCCESS](state, response) {
state.matches.tags = { state.matches.tags = {
list: convertObjectPropsToCamelCase(response.data).map(b => ({ list: convertObjectPropsToCamelCase(response.data).map((b) => ({
name: b.name, name: b.name,
})), })),
totalCount: parseInt(response.headers[X_TOTAL_HEADER], 10), totalCount: parseInt(response.headers[X_TOTAL_HEADER], 10),
......
...@@ -31,7 +31,7 @@ class RefSelectDropdown { ...@@ -31,7 +31,7 @@ class RefSelectDropdown {
const $fieldInput = $(`input[name="${$dropdownButton.data('fieldName')}"]`, $dropdownContainer); const $fieldInput = $(`input[name="${$dropdownButton.data('fieldName')}"]`, $dropdownContainer);
const $filterInput = $('input[type="search"]', $dropdownContainer); const $filterInput = $('input[type="search"]', $dropdownContainer);
$filterInput.on('keyup', e => { $filterInput.on('keyup', (e) => {
const keyCode = e.keyCode || e.which; const keyCode = e.keyCode || e.which;
if (keyCode !== 13) return; if (keyCode !== 13) return;
......
...@@ -31,10 +31,10 @@ export default { ...@@ -31,10 +31,10 @@ export default {
}, },
computed: { computed: {
hasSelectedItems() { hasSelectedItems() {
return this.tags.some(tag => this.selectedItems[tag.name]); return this.tags.some((tag) => this.selectedItems[tag.name]);
}, },
showMultiDeleteButton() { showMultiDeleteButton() {
return this.tags.some(tag => tag.canDelete) && !this.isMobile; return this.tags.some((tag) => tag.canDelete) && !this.isMobile;
}, },
}, },
methods: { methods: {
......
...@@ -14,10 +14,10 @@ export default { ...@@ -14,10 +14,10 @@ export default {
}, },
computed: { computed: {
parsedCrumbs() { parsedCrumbs() {
return this.crumbs.map(c => ({ ...c, innerHTML: sanitize(c.innerHTML) })); return this.crumbs.map((c) => ({ ...c, innerHTML: sanitize(c.innerHTML) }));
}, },
rootRoute() { rootRoute() {
return this.$router.options.routes.find(r => r.meta.root); return this.$router.options.routes.find((r) => r.meta.root);
}, },
isRootRoute() { isRootRoute() {
return this.$route.name === this.rootRoute.name; return this.$route.name === this.rootRoute.name;
......
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
}, },
methods: { methods: {
deleteTags(toBeDeleted) { deleteTags(toBeDeleted) {
this.itemsToBeDeleted = this.tags.filter(tag => toBeDeleted[tag.name]); this.itemsToBeDeleted = this.tags.filter((tag) => toBeDeleted[tag.name]);
this.track('click_button'); this.track('click_button');
this.$refs.deleteModal.show(); this.$refs.deleteModal.show();
}, },
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
mutation: deleteContainerRepositoryTagsMutation, mutation: deleteContainerRepositoryTagsMutation,
variables: { variables: {
id: this.queryVariables.id, id: this.queryVariables.id,
tagNames: itemsToBeDeleted.map(i => i.name), tagNames: itemsToBeDeleted.map((i) => i.name),
}, },
awaitRefetchQueries: true, awaitRefetchQueries: true,
refetchQueries: [ refetchQueries: [
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
projectPath: this.projectPath, projectPath: this.projectPath,
}; };
}, },
update: data => data.project?.containerExpirationPolicy, update: (data) => data.project?.containerExpirationPolicy,
result({ data }) { result({ data }) {
this.workingCopy = { ...get(data, 'project.containerExpirationPolicy', {}) }; this.workingCopy = { ...get(data, 'project.containerExpirationPolicy', {}) };
}, },
......
...@@ -96,7 +96,7 @@ export default { ...@@ -96,7 +96,7 @@ export default {
return this.isLoading || this.mutationLoading; return this.isLoading || this.mutationLoading;
}, },
fieldsAreValid() { fieldsAreValid() {
return Object.values(this.localErrors).every(error => error); return Object.values(this.localErrors).every((error) => error);
}, },
isSubmitButtonDisabled() { isSubmitButtonDisabled() {
return !this.fieldsAreValid || this.showLoadingIcon; return !this.fieldsAreValid || this.showLoadingIcon;
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
}, },
methods: { methods: {
findDefaultOption(option) { findDefaultOption(option) {
return this.value[option] || this.$options.formOptions[option].find(f => f.default)?.key; return this.value[option] || this.$options.formOptions[option].find((f) => f.default)?.key;
}, },
reset() { reset() {
this.track('reset_form'); this.track('reset_form');
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
}, },
setApiErrors(response) { setApiErrors(response) {
this.apiErrors = response.graphQLErrors.reduce((acc, curr) => { this.apiErrors = response.graphQLErrors.reduce((acc, curr) => {
curr.extensions.problems.forEach(item => { curr.extensions.problems.forEach((item) => {
acc[item.path[0]] = item.message; acc[item.path[0]] = item.message;
}); });
return acc; return acc;
...@@ -163,7 +163,7 @@ export default { ...@@ -163,7 +163,7 @@ export default {
this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE, { type: 'success' }); this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE, { type: 'success' });
} }
}) })
.catch(error => { .catch((error) => {
this.setApiErrors(error); this.setApiErrors(error);
this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE, { type: 'error' }); this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE, { type: 'error' });
}) })
......
import { produce } from 'immer'; import { produce } from 'immer';
import expirationPolicyQuery from '../queries/get_expiration_policy.query.graphql'; import expirationPolicyQuery from '../queries/get_expiration_policy.query.graphql';
export const updateContainerExpirationPolicy = projectPath => (client, { data: updatedData }) => { export const updateContainerExpirationPolicy = (projectPath) => (client, { data: updatedData }) => {
const queryAndParams = { const queryAndParams = {
query: expirationPolicyQuery, query: expirationPolicyQuery,
variables: { projectPath }, variables: { projectPath },
}; };
const sourceData = client.readQuery(queryAndParams); const sourceData = client.readQuery(queryAndParams);
const data = produce(sourceData, draftState => { const data = produce(sourceData, (draftState) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
draftState.project.containerExpirationPolicy = { draftState.project.containerExpirationPolicy = {
...updatedData.updateContainerExpirationPolicy.containerExpirationPolicy, ...updatedData.updateContainerExpirationPolicy.containerExpirationPolicy,
......
import { n__ } from '~/locale'; import { n__ } from '~/locale';
import { KEEP_N_OPTIONS, CADENCE_OPTIONS, OLDER_THAN_OPTIONS } from './constants'; import { KEEP_N_OPTIONS, CADENCE_OPTIONS, OLDER_THAN_OPTIONS } from './constants';
export const findDefaultOption = options => { export const findDefaultOption = (options) => {
const item = options.find(o => o.default); const item = options.find((o) => o.default);
return item ? item.key : null; return item ? item.key : null;
}; };
export const olderThanTranslationGenerator = variable => n__('%d day', '%d days', variable); export const olderThanTranslationGenerator = (variable) => n__('%d day', '%d days', variable);
export const keepNTranslationGenerator = variable => export const keepNTranslationGenerator = (variable) =>
n__('%d tag per image name', '%d tags per image name', variable); n__('%d tag per image name', '%d tags per image name', variable);
export const optionLabelGenerator = (collection, translationFn) => export const optionLabelGenerator = (collection, translationFn) =>
collection.map(option => ({ collection.map((option) => ({
...option, ...option,
label: translationFn(option.variable), label: translationFn(option.variable),
})); }));
......
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
let position = 0; let position = 0;
const untouchedRawRefs = rawRefs const untouchedRawRefs = rawRefs
.filter(ref => { .filter((ref) => {
let isTouched = false; let isTouched = false;
if (caretPos >= position && caretPos <= position + ref.length) { if (caretPos >= position && caretPos <= position + ref.length) {
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
return !isTouched; return !isTouched;
}) })
.filter(ref => ref.trim().length > 0); .filter((ref) => ref.trim().length > 0);
this.$emit('addIssuableFormInput', { this.$emit('addIssuableFormInput', {
newValue: value, newValue: value,
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
:path-id-separator="pathIdSeparator" :path-id-separator="pathIdSeparator"
event-namespace="pendingIssuable" event-namespace="pendingIssuable"
@pendingIssuableRemoveRequest=" @pendingIssuableRemoveRequest="
params => { (params) => {
$emit('pendingIssuableRemoveRequest', params); $emit('pendingIssuableRemoveRequest', params);
} }
" "
......
...@@ -90,11 +90,11 @@ export default { ...@@ -90,11 +90,11 @@ export default {
categorisedIssues() { categorisedIssues() {
if (this.showCategorizedIssues) { if (this.showCategorizedIssues) {
return Object.values(linkedIssueTypesMap) return Object.values(linkedIssueTypesMap)
.map(linkType => ({ .map((linkType) => ({
linkType, linkType,
issues: this.relatedIssues.filter(issue => issue.linkType === linkType), issues: this.relatedIssues.filter((issue) => issue.linkType === linkType),
})) }))
.filter(obj => obj.issues.length > 0); .filter((obj) => obj.issues.length > 0);
} }
return [{ issues: this.relatedIssues }]; return [{ issues: this.relatedIssues }];
......
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
}, },
methods: { methods: {
findRelatedIssueById(id) { findRelatedIssueById(id) {
return this.state.relatedIssues.find(issue => issue.id === id); return this.state.relatedIssues.find((issue) => issue.id === id);
}, },
onRelatedIssueRemoveRequest(idToRemove) { onRelatedIssueRemoveRequest(idToRemove) {
const issueToRemove = this.findRelatedIssueById(idToRemove); const issueToRemove = this.findRelatedIssueById(idToRemove);
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
.then(({ data }) => { .then(({ data }) => {
this.store.setRelatedIssues(data.issuables); this.store.setRelatedIssues(data.issuables);
}) })
.catch(res => { .catch((res) => {
if (res && res.status !== 404) { if (res && res.status !== 404) {
Flash(relatedIssuesRemoveErrorMap[this.issuableType]); Flash(relatedIssuesRemoveErrorMap[this.issuableType]);
} }
...@@ -219,7 +219,7 @@ export default { ...@@ -219,7 +219,7 @@ export default {
this.processAllReferences(newValue); this.processAllReferences(newValue);
}, },
processAllReferences(value = '') { processAllReferences(value = '') {
const rawReferences = value.split(/\s+/).filter(reference => reference.trim().length > 0); const rawReferences = value.split(/\s+/).filter((reference) => reference.trim().length > 0);
this.store.addPendingReferences(rawReferences); this.store.addPendingReferences(rawReferences);
this.inputValue = ''; this.inputValue = '';
......
...@@ -11,7 +11,7 @@ export default function initRelatedIssues() { ...@@ -11,7 +11,7 @@ export default function initRelatedIssues() {
components: { components: {
relatedIssuesRoot: RelatedIssuesRoot, relatedIssuesRoot: RelatedIssuesRoot,
}, },
render: createElement => render: (createElement) =>
createElement('related-issues-root', { createElement('related-issues-root', {
props: { props: {
endpoint: relatedIssuesRootElement.dataset.endpoint, endpoint: relatedIssuesRootElement.dataset.endpoint,
......
...@@ -19,7 +19,7 @@ class RelatedIssuesStore { ...@@ -19,7 +19,7 @@ class RelatedIssuesStore {
} }
removeRelatedIssue(issue) { removeRelatedIssue(issue) {
this.state.relatedIssues = this.state.relatedIssues.filter(x => x.id !== issue.id); this.state.relatedIssues = this.state.relatedIssues.filter((x) => x.id !== issue.id);
} }
updateIssueOrder(oldIndex, newIndex) { updateIssueOrder(oldIndex, newIndex) {
......
...@@ -15,7 +15,7 @@ export default function initRelatedMergeRequests() { ...@@ -15,7 +15,7 @@ export default function initRelatedMergeRequests() {
RelatedMergeRequests, RelatedMergeRequests,
}, },
store: createStore(), store: createStore(),
render: createElement => render: (createElement) =>
createElement('related-merge-requests', { createElement('related-merge-requests', {
props: { endpoint, projectNamespace, projectPath }, props: { endpoint, projectNamespace, projectPath },
}), }),
......
...@@ -21,7 +21,7 @@ export const fetchMergeRequests = ({ state, dispatch }) => { ...@@ -21,7 +21,7 @@ export const fetchMergeRequests = ({ state, dispatch }) => {
return axios return axios
.get(`${state.apiEndpoint}?per_page=${REQUEST_PAGE_COUNT}`) .get(`${state.apiEndpoint}?per_page=${REQUEST_PAGE_COUNT}`)
.then(res => { .then((res) => {
const { headers, data } = res; const { headers, data } = res;
const total = Number(normalizeHeaders(headers)['X-TOTAL']) || 0; const total = Number(normalizeHeaders(headers)['X-TOTAL']) || 0;
......
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
sections() { sections() {
return [ return [
{ {
links: get(this.assets, 'sources', []).map(s => ({ links: get(this.assets, 'sources', []).map((s) => ({
url: s.url, url: s.url,
name: sprintf(__('Source code (%{fileExtension})'), { fileExtension: s.format }), name: sprintf(__('Source code (%{fileExtension})'), { fileExtension: s.format }),
})), })),
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
links: this.otherLinks, links: this.otherLinks,
iconName: 'link', iconName: 'link',
}, },
].filter(section => section.links.length > 0); ].filter((section) => section.links.length > 0);
}, },
}, },
methods: { methods: {
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
this.isAssetsExpanded = !this.isAssetsExpanded; this.isAssetsExpanded = !this.isAssetsExpanded;
}, },
linksForType(type) { linksForType(type) {
return this.assets.links.filter(l => l.linkType === type); return this.assets.links.filter((l) => l.linkType === type);
}, },
}, },
externalLinkTooltipText: __('This link points to external content'), externalLinkTooltipText: __('This link points to external content'),
......
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
}, },
issueCounts() { issueCounts() {
return this.milestones return this.milestones
.map(m => m.issueStats || {}) .map((m) => m.issueStats || {})
.reduce( .reduce(
(acc, current) => { (acc, current) => {
acc.total += current.total || 0; acc.total += current.total || 0;
...@@ -79,11 +79,11 @@ export default { ...@@ -79,11 +79,11 @@ export default {
); );
}, },
showMergeRequestStats() { showMergeRequestStats() {
return this.milestones.some(m => m.mrStats); return this.milestones.some((m) => m.mrStats);
}, },
mergeRequestCounts() { mergeRequestCounts() {
return this.milestones return this.milestones
.map(m => m.mrStats || {}) .map((m) => m.mrStats || {})
.reduce( .reduce(
(acc, current) => { (acc, current) => {
acc.total += current.total || 0; acc.total += current.total || 0;
......
...@@ -11,14 +11,14 @@ export default { ...@@ -11,14 +11,14 @@ export default {
}, },
computed: { computed: {
...mapState('list', { ...mapState('list', {
orderBy: state => state.sorting.orderBy, orderBy: (state) => state.sorting.orderBy,
sort: state => state.sorting.sort, sort: (state) => state.sorting.sort,
}), }),
sortOptions() { sortOptions() {
return SORT_OPTIONS; return SORT_OPTIONS;
}, },
sortText() { sortText() {
const option = this.sortOptions.find(s => s.orderBy === this.orderBy); const option = this.sortOptions.find((s) => s.orderBy === this.orderBy);
return option.label; return option.label;
}, },
isSortAscending() { isSortAscending() {
......
...@@ -18,6 +18,6 @@ export default () => { ...@@ -18,6 +18,6 @@ export default () => {
return new Vue({ return new Vue({
el, el,
store, store,
render: h => h(ReleaseEditNewApp), render: (h) => h(ReleaseEditNewApp),
}); });
}; };
...@@ -21,6 +21,6 @@ export default () => { ...@@ -21,6 +21,6 @@ export default () => {
graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats), graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats),
}, },
}), }),
render: h => h(ReleaseListApp), render: (h) => h(ReleaseListApp),
}); });
}; };
...@@ -18,6 +18,6 @@ export default () => { ...@@ -18,6 +18,6 @@ export default () => {
return new Vue({ return new Vue({
el, el,
store, store,
render: h => h(ReleaseEditNewApp), render: (h) => h(ReleaseEditNewApp),
}); });
}; };
...@@ -21,6 +21,6 @@ export default () => { ...@@ -21,6 +21,6 @@ export default () => {
return new Vue({ return new Vue({
el, el,
store, store,
render: h => h(ReleaseShowApp), render: (h) => h(ReleaseShowApp),
}); });
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @returns {Boolean} `true` if all the feature flags * @returns {Boolean} `true` if all the feature flags
* required to enable the GraphQL endpoint are enabled * required to enable the GraphQL endpoint are enabled
*/ */
export const useGraphQLEndpoint = rootState => { export const useGraphQLEndpoint = (rootState) => {
return Boolean( return Boolean(
rootState.featureFlags.graphqlReleaseData && rootState.featureFlags.graphqlReleaseData &&
rootState.featureFlags.graphqlReleasesPage && rootState.featureFlags.graphqlReleasesPage &&
......
...@@ -36,12 +36,12 @@ export const fetchRelease = ({ commit, state, rootState }) => { ...@@ -36,12 +36,12 @@ export const fetchRelease = ({ commit, state, rootState }) => {
tagName: state.tagName, tagName: state.tagName,
}, },
}) })
.then(response => { .then((response) => {
const { data: release } = convertOneReleaseGraphQLResponse(response); const { data: release } = convertOneReleaseGraphQLResponse(response);
commit(types.RECEIVE_RELEASE_SUCCESS, release); commit(types.RECEIVE_RELEASE_SUCCESS, release);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_RELEASE_ERROR, error); commit(types.RECEIVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while getting the release details')); createFlash(s__('Release|Something went wrong while getting the release details'));
}); });
...@@ -52,7 +52,7 @@ export const fetchRelease = ({ commit, state, rootState }) => { ...@@ -52,7 +52,7 @@ export const fetchRelease = ({ commit, state, rootState }) => {
.then(({ data }) => { .then(({ data }) => {
commit(types.RECEIVE_RELEASE_SUCCESS, apiJsonToRelease(data)); commit(types.RECEIVE_RELEASE_SUCCESS, apiJsonToRelease(data));
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_RELEASE_ERROR, error); commit(types.RECEIVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while getting the release details')); createFlash(s__('Release|Something went wrong while getting the release details'));
}); });
...@@ -121,7 +121,7 @@ export const createRelease = ({ commit, dispatch, state, getters }) => { ...@@ -121,7 +121,7 @@ export const createRelease = ({ commit, dispatch, state, getters }) => {
.then(({ data }) => { .then(({ data }) => {
dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(data)); dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(data));
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_SAVE_RELEASE_ERROR, error); commit(types.RECEIVE_SAVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while creating a new release')); createFlash(s__('Release|Something went wrong while creating a new release'));
}); });
...@@ -163,7 +163,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => { ...@@ -163,7 +163,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
// Delete all links currently associated with this Release // Delete all links currently associated with this Release
return Promise.all( return Promise.all(
getters.releaseLinksToDelete.map(l => getters.releaseLinksToDelete.map((l) =>
api.deleteReleaseLink(state.projectId, state.release.tagName, l.id), api.deleteReleaseLink(state.projectId, state.release.tagName, l.id),
), ),
); );
...@@ -171,7 +171,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => { ...@@ -171,7 +171,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
.then(() => { .then(() => {
// Create a new link for each link in the form // Create a new link for each link in the form
return Promise.all( return Promise.all(
apiJson.assets.links.map(l => apiJson.assets.links.map((l) =>
api.createReleaseLink(state.projectId, state.release.tagName, l), api.createReleaseLink(state.projectId, state.release.tagName, l),
), ),
); );
...@@ -179,7 +179,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => { ...@@ -179,7 +179,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
.then(() => { .then(() => {
dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(updatedRelease)); dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(updatedRelease));
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_SAVE_RELEASE_ERROR, error); commit(types.RECEIVE_SAVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while saving the release details')); createFlash(s__('Release|Something went wrong while saving the release details'));
}) })
......
...@@ -5,7 +5,7 @@ import { hasContent } from '~/lib/utils/text_utility'; ...@@ -5,7 +5,7 @@ import { hasContent } from '~/lib/utils/text_utility';
* @returns {Boolean} `true` if the app is editing an existing release. * @returns {Boolean} `true` if the app is editing an existing release.
* `false` if the app is creating a new release. * `false` if the app is creating a new release.
*/ */
export const isExistingRelease = state => { export const isExistingRelease = (state) => {
return Boolean(state.tagName); return Boolean(state.tagName);
}; };
...@@ -15,19 +15,19 @@ export const isExistingRelease = state => { ...@@ -15,19 +15,19 @@ export const isExistingRelease = state => {
* empty (or whitespace-only) values for both `url` and `name`. * empty (or whitespace-only) values for both `url` and `name`.
* Otherwise, `false`. * Otherwise, `false`.
*/ */
const isEmptyReleaseLink = link => !hasContent(link.url) && !hasContent(link.name); const isEmptyReleaseLink = (link) => !hasContent(link.url) && !hasContent(link.name);
/** Returns all release links that aren't empty */ /** Returns all release links that aren't empty */
export const releaseLinksToCreate = state => { export const releaseLinksToCreate = (state) => {
if (!state.release) { if (!state.release) {
return []; return [];
} }
return state.release.assets.links.filter(l => !isEmptyReleaseLink(l)); return state.release.assets.links.filter((l) => !isEmptyReleaseLink(l));
}; };
/** Returns all release links that should be deleted */ /** Returns all release links that should be deleted */
export const releaseLinksToDelete = state => { export const releaseLinksToDelete = (state) => {
if (!state.originalRelease) { if (!state.originalRelease) {
return []; return [];
} }
...@@ -36,7 +36,7 @@ export const releaseLinksToDelete = state => { ...@@ -36,7 +36,7 @@ export const releaseLinksToDelete = state => {
}; };
/** Returns all validation errors on the release object */ /** Returns all validation errors on the release object */
export const validationErrors = state => { export const validationErrors = (state) => {
const errors = { const errors = {
assets: { assets: {
links: {}, links: {},
...@@ -56,7 +56,7 @@ export const validationErrors = state => { ...@@ -56,7 +56,7 @@ export const validationErrors = state => {
// This is used for detecting duplicate URLs. // This is used for detecting duplicate URLs.
const urlToLinksMap = new Map(); const urlToLinksMap = new Map();
state.release.assets.links.forEach(link => { state.release.assets.links.forEach((link) => {
errors.assets.links[link.id] = {}; errors.assets.links[link.id] = {};
// Only validate non-empty URLs // Only validate non-empty URLs
...@@ -81,7 +81,7 @@ export const validationErrors = state => { ...@@ -81,7 +81,7 @@ export const validationErrors = state => {
// add a validation error for each link that shares this URL // add a validation error for each link that shares this URL
const duplicates = urlToLinksMap.get(normalizedUrl); const duplicates = urlToLinksMap.get(normalizedUrl);
duplicates.push(link); duplicates.push(link);
duplicates.forEach(duplicateLink => { duplicates.forEach((duplicateLink) => {
errors.assets.links[duplicateLink.id].isDuplicate = true; errors.assets.links[duplicateLink.id].isDuplicate = true;
}); });
} else { } else {
......
...@@ -3,7 +3,7 @@ import * as getters from './getters'; ...@@ -3,7 +3,7 @@ import * as getters from './getters';
import mutations from './mutations'; import mutations from './mutations';
import createState from './state'; import createState from './state';
export default initialState => ({ export default (initialState) => ({
namespaced: true, namespaced: true,
actions, actions,
getters, getters,
......
...@@ -3,7 +3,7 @@ import * as types from './mutation_types'; ...@@ -3,7 +3,7 @@ import * as types from './mutation_types';
import { DEFAULT_ASSET_LINK_TYPE } from '../../../constants'; import { DEFAULT_ASSET_LINK_TYPE } from '../../../constants';
const findReleaseLink = (release, id) => { const findReleaseLink = (release, id) => {
return release.assets.links.find(l => l.id === id); return release.assets.links.find((l) => l.id === id);
}; };
export default { export default {
...@@ -93,6 +93,6 @@ export default { ...@@ -93,6 +93,6 @@ export default {
}, },
[types.REMOVE_ASSET_LINK](state, linkIdToRemove) { [types.REMOVE_ASSET_LINK](state, linkIdToRemove) {
state.release.assets.links = state.release.assets.links.filter(l => l.id !== linkIdToRemove); state.release.assets.links = state.release.assets.links.filter((l) => l.id !== linkIdToRemove);
}, },
}; };
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