apply eslint and prettier rules

This commit is contained in:
Sebastian Sdorra
2019-10-21 10:57:56 +02:00
parent 85773186db
commit 4bb8e6153b
227 changed files with 1147 additions and 4076 deletions

View File

@@ -15,45 +15,28 @@ class RepositoryEntry extends React.Component<Props> {
renderBranchesLink = (repository: Repository, repositoryLink: string) => {
if (repository._links["branches"]) {
return (
<RepositoryEntryLink
icon="code-branch"
to={repositoryLink + "/branches"}
/>
);
return <RepositoryEntryLink icon="code-branch" to={repositoryLink + "/branches"} />;
}
return null;
};
renderChangesetsLink = (repository: Repository, repositoryLink: string) => {
if (repository._links["changesets"]) {
return (
<RepositoryEntryLink
icon="exchange-alt"
to={repositoryLink + "/changesets"}
/>
);
return <RepositoryEntryLink icon="exchange-alt" to={repositoryLink + "/changesets"} />;
}
return null;
};
renderSourcesLink = (repository: Repository, repositoryLink: string) => {
if (repository._links["sources"]) {
return (
<RepositoryEntryLink icon="code" to={repositoryLink + "/sources"} />
);
return <RepositoryEntryLink icon="code" to={repositoryLink + "/sources"} />;
}
return null;
};
renderModifyLink = (repository: Repository, repositoryLink: string) => {
if (repository._links["update"]) {
return (
<RepositoryEntryLink
icon="cog"
to={repositoryLink + "/settings/general"}
/>
);
return <RepositoryEntryLink icon="cog" to={repositoryLink + "/settings/general"} />;
}
return null;
};

View File

@@ -53,11 +53,7 @@ it("should group the repositories by their namespace", () => {
const expected = [
{
name: "hitchhiker",
repositories: [
hitchhikerHeartOfGold,
hitchhikerPuzzle42,
hitchhikerRestand
]
repositories: [hitchhikerHeartOfGold, hitchhikerPuzzle42, hitchhikerRestand]
},
{
name: "slarti",

View File

@@ -1,10 +1,8 @@
import { Repository, RepositoryGroup } from "@scm-manager/ui-types";
export default function groupByNamespace(
repositories: Repository[]
): RepositoryGroup[] {
let groups = {};
for (let repository of repositories) {
export default function groupByNamespace(repositories: Repository[]): RepositoryGroup[] {
const groups = {};
for (const repository of repositories) {
const groupName = repository.namespace;
let group = groups[groupName];
@@ -18,8 +16,8 @@ export default function groupByNamespace(
group.repositories.push(repository);
}
let groupArray = [];
for (let groupName in groups) {
const groupArray = [];
for (const groupName in groups) {
const group = groups[groupName];
group.repositories.sort(sortByName);
groupArray.push(groups[groupName]);