Commit a4c662da authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 27 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 9aa1f620
......@@ -68,7 +68,7 @@ export const fetchReleasesGraphQl = (
...paginationParams,
},
})
.then(response => {
.then((response) => {
const { data, paginationInfo: graphQlPageInfo } = convertAllReleasesGraphQLResponse(response);
commit(types.RECEIVE_RELEASES_SUCCESS, {
......
......@@ -2,7 +2,7 @@ import createState from './state';
import * as actions from './actions';
import mutations from './mutations';
export default initialState => ({
export default (initialState) => ({
namespaced: true,
actions,
mutations,
......
......@@ -17,7 +17,7 @@ export const releaseToApiJson = (release, createFrom = null) => {
// Milestones may be either a list of milestone objects OR just a list
// of milestone titles. The API requires only the titles be sent.
const milestones = (release.milestones || []).map(m => m.title || m);
const milestones = (release.milestones || []).map((m) => m.title || m);
return convertObjectPropsToSnakeCase(
{
......@@ -37,7 +37,7 @@ export const releaseToApiJson = (release, createFrom = null) => {
* into the structure this Vue application can work with.
* @param {Object} json The JSON object received from the release API
*/
export const apiJsonToRelease = json => {
export const apiJsonToRelease = (json) => {
const release = convertObjectPropsToCamelCase(json, { deep: true });
release.milestones = release.milestones || [];
......@@ -47,7 +47,7 @@ export const apiJsonToRelease = json => {
export const gqClient = createGqClient({}, { fetchPolicy: fetchPolicies.NO_CACHE });
const convertScalarProperties = graphQLRelease =>
const convertScalarProperties = (graphQLRelease) =>
pick(graphQLRelease, [
'name',
'tagName',
......@@ -57,29 +57,29 @@ const convertScalarProperties = graphQLRelease =>
'upcomingRelease',
]);
const convertAssets = graphQLRelease => ({
const convertAssets = (graphQLRelease) => ({
assets: {
count: graphQLRelease.assets.count,
sources: [...graphQLRelease.assets.sources.nodes],
links: graphQLRelease.assets.links.nodes.map(l => ({
links: graphQLRelease.assets.links.nodes.map((l) => ({
...l,
linkType: l.linkType?.toLowerCase(),
})),
},
});
const convertEvidences = graphQLRelease => ({
evidences: graphQLRelease.evidences.nodes.map(e => e),
const convertEvidences = (graphQLRelease) => ({
evidences: graphQLRelease.evidences.nodes.map((e) => e),
});
const convertLinks = graphQLRelease => ({
const convertLinks = (graphQLRelease) => ({
_links: {
...graphQLRelease.links,
self: graphQLRelease.links?.selfUrl,
},
});
const convertCommit = graphQLRelease => {
const convertCommit = (graphQLRelease) => {
if (!graphQLRelease.commit) {
return {};
}
......@@ -93,10 +93,10 @@ const convertCommit = graphQLRelease => {
};
};
const convertAuthor = graphQLRelease => ({ author: graphQLRelease.author });
const convertAuthor = (graphQLRelease) => ({ author: graphQLRelease.author });
const convertMilestones = graphQLRelease => ({
milestones: graphQLRelease.milestones.nodes.map(m => ({
const convertMilestones = (graphQLRelease) => ({
milestones: graphQLRelease.milestones.nodes.map((m) => ({
...m,
webUrl: m.webPath,
webPath: undefined,
......@@ -115,7 +115,7 @@ const convertMilestones = graphQLRelease => ({
*
* @param graphQLRelease The release object returned from a GraphQL query
*/
export const convertGraphQLRelease = graphQLRelease => ({
export const convertGraphQLRelease = (graphQLRelease) => ({
...convertScalarProperties(graphQLRelease),
...convertAssets(graphQLRelease),
...convertEvidences(graphQLRelease),
......@@ -134,7 +134,7 @@ export const convertGraphQLRelease = graphQLRelease => ({
*
* @param response The response received from the GraphQL endpoint
*/
export const convertAllReleasesGraphQLResponse = response => {
export const convertAllReleasesGraphQLResponse = (response) => {
const releases = response.data.project.releases.nodes.map(convertGraphQLRelease);
const paginationInfo = {
......@@ -153,7 +153,7 @@ export const convertAllReleasesGraphQLResponse = response => {
*
* @param response The response received from the GraphQL endpoint
*/
export const convertOneReleaseGraphQLResponse = response => {
export const convertOneReleaseGraphQLResponse = (response) => {
const release = convertGraphQLRelease(response.data.project.release);
return { data: release };
......
import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../../constants';
import { s__, n__ } from '~/locale';
export const groupedSummaryText = state => {
export const groupedSummaryText = (state) => {
if (state.isLoading) {
return s__('Reports|Accessibility scanning results are being parsed');
}
......@@ -22,7 +22,7 @@ export const groupedSummaryText = state => {
);
};
export const summaryStatus = state => {
export const summaryStatus = (state) => {
if (state.isLoading) {
return LOADING;
}
......@@ -34,12 +34,12 @@ export const summaryStatus = state => {
return SUCCESS;
};
export const shouldRenderIssuesList = state =>
Object.values(state.report).some(x => Array.isArray(x) && x.length > 0);
export const shouldRenderIssuesList = (state) =>
Object.values(state.report).some((x) => Array.isArray(x) && x.length > 0);
// We could just map state, but we're going to iterate in the future
// to add notes and warnings to these issue lists, so I'm going to
// keep these as getters
export const unresolvedIssues = state => state.report.existing_errors;
export const resolvedIssues = state => state.report.resolved_errors;
export const newIssues = state => state.report.new_errors;
export const unresolvedIssues = (state) => state.report.existing_errors;
export const resolvedIssues = (state) => state.report.resolved_errors;
export const newIssues = (state) => state.report.new_errors;
......@@ -7,11 +7,11 @@ import state from './state';
Vue.use(Vuex);
export const getStoreConfig = initialState => ({
export const getStoreConfig = (initialState) => ({
actions,
getters,
mutations,
state: state(initialState),
});
export default initialState => new Vuex.Store(getStoreConfig(initialState));
export default (initialState) => new Vuex.Store(getStoreConfig(initialState));
......@@ -11,13 +11,13 @@ export const fetchReports = ({ state, dispatch, commit }) => {
return dispatch('receiveReportsError');
}
return Promise.all([axios.get(state.headPath), axios.get(state.basePath)])
.then(results =>
.then((results) =>
doCodeClimateComparison(
parseCodeclimateMetrics(results[0].data, state.headBlobPath),
parseCodeclimateMetrics(results[1].data, state.baseBlobPath),
),
)
.then(data => dispatch('receiveReportsSuccess', data))
.then((data) => dispatch('receiveReportsSuccess', data))
.catch(() => dispatch('receiveReportsError'));
};
......
......@@ -2,10 +2,10 @@ import { LOADING, ERROR, SUCCESS } from '../../constants';
import { sprintf, __, s__, n__ } from '~/locale';
import { spriteIcon } from '~/lib/utils/common_utils';
export const hasCodequalityIssues = state =>
export const hasCodequalityIssues = (state) =>
Boolean(state.newIssues?.length || state.resolvedIssues?.length);
export const codequalityStatus = state => {
export const codequalityStatus = (state) => {
if (state.isLoading) {
return LOADING;
}
......@@ -16,7 +16,7 @@ export const codequalityStatus = state => {
return SUCCESS;
};
export const codequalityText = state => {
export const codequalityText = (state) => {
const { newIssues, resolvedIssues } = state;
const text = [];
......@@ -41,7 +41,7 @@ export const codequalityText = state => {
return text.join('');
};
export const codequalityPopover = state => {
export const codequalityPopover = (state) => {
if (state.headPath && !state.basePath) {
return {
title: s__('ciReport|Base pipeline codequality artifact not found'),
......
......@@ -7,11 +7,11 @@ import state from './state';
Vue.use(Vuex);
export const getStoreConfig = initialState => ({
export const getStoreConfig = (initialState) => ({
actions,
getters,
mutations,
state: state(initialState),
});
export default initialState => new Vuex.Store(getStoreConfig(initialState));
export default (initialState) => new Vuex.Store(getStoreConfig(initialState));
import CodeQualityComparisonWorker from '../../workers/codequality_comparison_worker';
export const parseCodeclimateMetrics = (issues = [], path = '') => {
return issues.map(issue => {
return issues.map((issue) => {
const parsedIssue = {
...issue,
name: issue.description,
......
......@@ -3,7 +3,7 @@ import { differenceBy } from 'lodash';
const KEY_TO_FILTER_BY = 'fingerprint';
// eslint-disable-next-line no-restricted-globals
self.addEventListener('message', e => {
self.addEventListener('message', (e) => {
const { data } = e;
if (data === undefined) {
......
......@@ -41,7 +41,7 @@ export default {
computed: {
groups() {
return this.$options.groups
.map(group => ({
.map((group) => ({
name: group,
issues: this[`${group}Issues`],
heading: this[`${group}Heading`],
......
......@@ -44,8 +44,8 @@ export default {
computed: {
...mapState(['reports', 'isLoading', 'hasError', 'summary']),
...mapState({
modalTitle: state => state.modal.title || '',
modalData: state => state.modal.data || {},
modalTitle: (state) => state.modal.title || '',
modalData: (state) => state.modal.data || {},
}),
...mapGetters(['summaryStatus']),
groupedSummaryText() {
......
......@@ -3,7 +3,7 @@ import ReportItem from '~/reports/components/report_item.vue';
import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constants';
import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue';
const wrapIssueWithState = (status, isNew = false) => issue => ({
const wrapIssueWithState = (status, isNew = false) => (issue) => ({
status: issue.status || status,
isNew,
issue,
......
......@@ -17,7 +17,7 @@ export default {
type: String,
required: false,
default: '',
validator: value => value === '' || Object.values(componentNames).includes(value),
validator: (value) => value === '' || Object.values(componentNames).includes(value),
},
// failed || success
status: {
......
import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../constants';
export const summaryStatus = state => {
export const summaryStatus = (state) => {
if (state.isLoading) {
return LOADING;
}
......
......@@ -9,7 +9,7 @@ export default {
state.isLoading = true;
},
[types.RECEIVE_REPORTS_SUCCESS](state, response) {
state.hasError = response.suites.some(suite => suite.status === 'error');
state.hasError = response.suites.some((suite) => suite.status === 'error');
state.isLoading = false;
......@@ -44,7 +44,7 @@ export default {
[types.SET_ISSUE_MODAL_DATA](state, payload) {
state.modal.title = payload.issue.name;
Object.keys(payload.issue).forEach(key => {
Object.keys(payload.issue).forEach((key) => {
if (Object.prototype.hasOwnProperty.call(state.modal.data, key)) {
state.modal.data[key] = {
...state.modal.data[key],
......
......@@ -7,7 +7,7 @@ import {
ICON_NOTFOUND,
} from '../constants';
const textBuilder = results => {
const textBuilder = (results) => {
const { failed, errored, resolved, total } = results;
const failedOrErrored = (failed || 0) + (errored || 0);
......@@ -70,18 +70,18 @@ export const recentFailuresTextBuilder = (summary = {}) => {
);
};
export const countRecentlyFailedTests = subject => {
export const countRecentlyFailedTests = (subject) => {
// handle either a single report or an array of reports
const reports = !subject.length ? [subject] : subject;
return reports
.map(report => {
.map((report) => {
return (
[report.new_failures, report.existing_failures, report.resolved_failures]
// only count tests which have failed more than once
.map(
failureArray =>
failureArray.filter(failure => failure.recent_failures?.count > 1).length,
(failureArray) =>
failureArray.filter((failure) => failure.recent_failures?.count > 1).length,
)
.reduce((total, count) => total + count, 0)
);
......@@ -89,7 +89,7 @@ export const countRecentlyFailedTests = subject => {
.reduce((total, count) => total + count, 0);
};
export const statusIcon = status => {
export const statusIcon = (status) => {
if (status === STATUS_FAILED) {
return ICON_WARNING;
}
......
......@@ -40,7 +40,7 @@ export default {
projectPath: this.projectPath,
};
},
update: data => data.project?.userPermissions,
update: (data) => data.project?.userPermissions,
error(error) {
throw error;
},
......@@ -105,7 +105,7 @@ export default {
pathLinks() {
return this.currentPath
.split('/')
.filter(p => p !== '')
.filter((p) => p !== '')
.reduce(
(acc, name, i) => {
const path = joinPaths(i > 0 ? acc[i].path : '', escapeFileUrl(name));
......
......@@ -18,7 +18,7 @@ export default {
},
computed: {
normalizedLinks() {
return this.links.map(link => ({
return this.links.map((link) => ({
text: link.text,
path: `${link.path}?path=${this.currentPath}`,
}));
......
......@@ -39,7 +39,7 @@ export default {
path: this.currentPath.replace(/^\//, ''),
};
},
update: data => {
update: (data) => {
const pipelines = data.project?.repository?.tree?.lastCommit?.pipelines?.edges;
return {
......
......@@ -25,7 +25,7 @@ export default {
const splitArray = this.path.split('/');
splitArray.pop();
return splitArray.map(p => encodeURIComponent(p)).join('/');
return splitArray.map((p) => encodeURIComponent(p)).join('/');
},
parentRoute() {
return { path: `/-/tree/${this.commitRef}/${this.parentPath}` };
......
......@@ -113,7 +113,7 @@ export default {
}
}
})
.catch(error => {
.catch((error) => {
createFlash(__('An error occurred while fetching folder content.'));
throw error;
});
......
......@@ -18,7 +18,7 @@ const defaultClient = createDefaultClient(
{
Query: {
commit(_, { path, fileName, type }) {
return new Promise(resolve => {
return new Promise((resolve) => {
fetchLogsTree(defaultClient, path, '0', {
resolve,
entry: {
......@@ -38,7 +38,7 @@ const defaultClient = createDefaultClient(
{
cacheConfig: {
fragmentMatcher,
dataIdFromObject: obj => {
dataIdFromObject: (obj) => {
/* eslint-disable @gitlab/require-i18n-strings */
// eslint-disable-next-line no-underscore-dangle
switch (obj.__typename) {
......
......@@ -10,7 +10,7 @@ Vue.use(VueRouter);
export default function createRouter(base, baseRef) {
const treePathRoute = {
component: TreePage,
props: route => ({
props: (route) => ({
path: route.params.path?.replace(/^\//, '') || '/',
}),
};
......
export function normalizeData(data, path, extra = () => {}) {
return data.map(d => ({
return data.map((d) => ({
sha: d.commit.id,
message: d.commit.message,
titleHtml: d.commit_title_html,
......
......@@ -18,14 +18,14 @@ const MARKUP_EXTENSIONS = [
'wiki',
];
const isRichReadme = file => {
const isRichReadme = (file) => {
const re = new RegExp(`^(${FILENAMES.join('|')})\\.(${MARKUP_EXTENSIONS.join('|')})$`, 'i');
return re.test(file.name);
};
const isPlainReadme = file => {
const isPlainReadme = (file) => {
const re = new RegExp(`^(${FILENAMES.join('|')})(\\.txt)?$`, 'i');
return re.test(file.name);
};
export const readmeFile = blobs => blobs.find(isRichReadme) || blobs.find(isPlainReadme);
export const readmeFile = (blobs) => blobs.find(isRichReadme) || blobs.find(isPlainReadme);
......@@ -4,9 +4,9 @@ export default () => {
const searchTerm = contentBody.querySelector('.js-search-input').value.toLowerCase();
const blobs = contentBody.querySelectorAll('.blob-result');
blobs.forEach(blob => {
blobs.forEach((blob) => {
const lines = blob.querySelectorAll('.line');
lines.forEach(line => {
lines.forEach((line) => {
if (line.textContent.toLowerCase().includes(searchTerm)) {
line.classList.add(highlightLineClass);
}
......
......@@ -4,7 +4,7 @@ import GlobalSearchSidebar from './components/app.vue';
Vue.use(Translate);
export const initSidebar = store => {
export const initSidebar = (store) => {
const el = document.getElementById('js-search-sidebar');
if (!el) return false;
......
......@@ -7,7 +7,7 @@ import * as types from './mutation_types';
export const fetchGroups = ({ commit }, search) => {
commit(types.REQUEST_GROUPS);
Api.groups(search)
.then(data => {
.then((data) => {
commit(types.RECEIVE_GROUPS_SUCCESS, data);
})
.catch(() => {
......@@ -19,7 +19,7 @@ export const fetchGroups = ({ commit }, search) => {
export const fetchProjects = ({ commit, state }, search) => {
commit(types.REQUEST_PROJECTS);
const groupId = state.query?.group_id;
const callback = data => {
const callback = (data) => {
if (data) {
commit(types.RECEIVE_PROJECTS_SUCCESS, data);
} else {
......
......@@ -12,5 +12,5 @@ export const getStoreConfig = ({ query }) => ({
state: createState({ query }),
});
const createStore = config => new Vuex.Store(getStoreConfig(config));
const createStore = (config) => new Vuex.Store(getStoreConfig(config));
export default createStore;
......@@ -40,5 +40,5 @@ const searchableDropdowns = [
},
];
export const initTopbar = store =>
searchableDropdowns.map(dropdown => mountSearchableDropdown(store, dropdown));
export const initTopbar = (store) =>
searchableDropdowns.map((dropdown) => mountSearchableDropdown(store, dropdown));
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