refactor: convert function expressions to declarations (#4926)

This commit is contained in:
Vladislav Shkodin
2021-02-08 20:01:21 +02:00
committed by GitHub
parent c0236536dd
commit 141a2eba56
241 changed files with 3444 additions and 2933 deletions

View File

@ -171,14 +171,14 @@ type GitLabCommit = {
message: string;
};
export const getMaxAccess = (groups: { group_access_level: number }[]) => {
export function getMaxAccess(groups: { group_access_level: number }[]) {
return groups.reduce((previous, current) => {
if (current.group_access_level > previous.group_access_level) {
return current;
}
return previous;
}, groups[0]);
};
}
export default class API {
apiRoot: string;

View File

@ -8,7 +8,7 @@ import AuthenticationPage from '../AuthenticationPage';
const { Backend, LocalStorageAuthStore } = jest.requireActual('netlify-cms-core/src/backend');
const generateEntries = (path, length) => {
function generateEntries(path, length) {
const entries = Array.from({ length }, (val, idx) => {
const count = idx + 1;
const id = `00${count}`.slice(-3);
@ -37,7 +37,7 @@ const generateEntries = (path, length) => {
{},
),
};
};
}
const manyEntries = generateEntries('many-entries', 500);
@ -222,8 +222,10 @@ describe('gitlab backend', () => {
const pageNum = parseInt(page, 10);
const pageCountNum = parseInt(pageCount, 10);
const url = `${backend.implementation.apiRoot}${basePath}`;
const link = linkPage =>
`<${url}?id=${expectedRepo}&page=${linkPage}&path=${path}&per_page=${perPage}&recursive=false>`;
function link(linkPage) {
return `<${url}?id=${expectedRepo}&page=${linkPage}&path=${path}&per_page=${perPage}&recursive=false>`;
}
const linkHeader = oneLine`
${link(1)}; rel="first",