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

@@ -3,12 +3,7 @@ import BranchView from "../components/BranchView";
import { connect } from "react-redux";
import { Redirect, Route, Switch, withRouter } from "react-router-dom";
import { Repository, Branch } from "@scm-manager/ui-types";
import {
fetchBranch,
getBranch,
getFetchBranchFailure,
isFetchBranchPending
} from "../modules/branches";
import { fetchBranch, getBranch, getFetchBranchFailure, isFetchBranchPending } from "../modules/branches";
import { ErrorNotification, Loading } from "@scm-manager/ui-components";
import { History } from "history";
import { NotFoundError } from "@scm-manager/ui-components";
@@ -54,10 +49,7 @@ class BranchRoot extends React.Component<Props> {
const url = this.matchedUrl();
if (error) {
if (
error instanceof NotFoundError &&
queryString.parse(location.search).create === "true"
) {
if (error instanceof NotFoundError && queryString.parse(location.search).create === "true") {
return (
<Redirect
to={`/repo/${repository.namespace}/${repository.name}/branches/create?name=${match.params.branch}`}
@@ -75,12 +67,7 @@ class BranchRoot extends React.Component<Props> {
return (
<Switch>
<Redirect exact from={url} to={`${url}/info`} />
<Route
path={`${url}/info`}
component={() => (
<BranchView repository={repository} branch={branch} />
)}
/>
<Route path={`${url}/info`} component={() => <BranchView repository={repository} branch={branch} />} />
</Switch>
);
}

View File

@@ -12,13 +12,7 @@ import { Branch, Repository } from "@scm-manager/ui-types";
import { compose } from "redux";
import { translate } from "react-i18next";
import { withRouter } from "react-router-dom";
import {
CreateButton,
ErrorNotification,
Loading,
Notification,
Subtitle
} from "@scm-manager/ui-components";
import { CreateButton, ErrorNotification, Loading, Notification, Subtitle } from "@scm-manager/ui-components";
import BranchTable from "../components/BranchTable";
type Props = {
@@ -70,22 +64,13 @@ class BranchesOverview extends React.Component<Props> {
orderBranches(branches);
return <BranchTable baseUrl={baseUrl} branches={branches} />;
}
return (
<Notification type="info">
{t("branches.overview.noBranches")}
</Notification>
);
return <Notification type="info">{t("branches.overview.noBranches")}</Notification>;
}
renderCreateButton() {
const { showCreateButton, t } = this.props;
if (showCreateButton) {
return (
<CreateButton
label={t("branches.overview.createButton")}
link="./create"
/>
);
return <CreateButton label={t("branches.overview.createButton")} link="./create" />;
}
return null;
}

View File

@@ -1,9 +1,5 @@
import React from "react";
import {
ErrorNotification,
Loading,
Subtitle
} from "@scm-manager/ui-components";
import { ErrorNotification, Loading, Subtitle } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
import BranchForm from "../components/BranchForm";
import { Repository, Branch, BranchRequest } from "@scm-manager/ui-types";
@@ -56,19 +52,12 @@ class CreateBranch extends React.Component<Props> {
branchCreated = (branch: Branch) => {
const { history, repository } = this.props;
history.push(
`/repo/${repository.namespace}/${
repository.name
}/branch/${encodeURIComponent(branch.name)}/info`
);
history.push(`/repo/${repository.namespace}/${repository.name}/branch/${encodeURIComponent(branch.name)}/info`);
};
createBranch = (branch: BranchRequest) => {
this.props.createBranch(
this.props.createBranchesLink,
this.props.repository,
branch,
newBranch => this.branchCreated(newBranch)
this.props.createBranch(this.props.createBranchesLink, this.props.repository, branch, newBranch =>
this.branchCreated(newBranch)
);
};
@@ -78,15 +67,7 @@ class CreateBranch extends React.Component<Props> {
};
render() {
const {
t,
loading,
error,
repository,
branches,
createBranchesLink,
location
} = this.props;
const { t, loading, error, repository, branches, createBranchesLink, location } = this.props;
if (error) {
return <ErrorNotification error={error} />;
@@ -133,11 +114,8 @@ const mapDispatchToProps = dispatch => {
const mapStateToProps = (state, ownProps) => {
const { repository } = ownProps;
const loading =
isFetchBranchesPending(state, repository) ||
isCreateBranchPending(state, repository);
const error =
getFetchBranchesFailure(state, repository) || getCreateBranchFailure(state);
const loading = isFetchBranchesPending(state, repository) || isCreateBranchPending(state, repository);
const error = getFetchBranchesFailure(state, repository) || getCreateBranchFailure(state);
const branches = getBranches(state, repository);
const createBranchesLink = getBranchCreateLink(state, repository);
return {