apply prettier, removed flow related config and added tsconfig

This commit is contained in:
Sebastian Sdorra
2019-10-20 18:02:52 +02:00
parent 0e017dcadd
commit 490418d06e
231 changed files with 5771 additions and 30386 deletions

View File

@@ -1,30 +1,30 @@
import React, { Component } from 'react';
import Main from './Main';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { withRouter } from 'react-router-dom';
import React, { Component } from "react";
import Main from "./Main";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { withRouter } from "react-router-dom";
import {
fetchMe,
getFetchMeFailure,
getMe,
isAuthenticated,
isFetchMePending,
} from '../modules/auth';
isFetchMePending
} from "../modules/auth";
import {
ErrorPage,
Footer,
Header,
Loading,
PrimaryNavigation,
} from '@scm-manager/ui-components';
import { Links, Me } from '@scm-manager/ui-types';
PrimaryNavigation
} from "@scm-manager/ui-components";
import { Links, Me } from "@scm-manager/ui-types";
import {
getFetchIndexResourcesFailure,
getLinks,
getMeLink,
isFetchIndexResourcesPending,
} from '../modules/indexResource';
isFetchIndexResourcesPending
} from "../modules/indexResource";
type Props = {
me: Me;
@@ -52,15 +52,15 @@ class App extends Component<Props> {
const { me, loading, error, authenticated, links, t } = this.props;
let content;
const navigation = authenticated ? <PrimaryNavigation links={links} /> : '';
const navigation = authenticated ? <PrimaryNavigation links={links} /> : "";
if (loading) {
content = <Loading />;
} else if (error) {
content = (
<ErrorPage
title={t('app.error.title')}
subtitle={t('app.error.subtitle')}
title={t("app.error.title")}
subtitle={t("app.error.subtitle")}
error={error}
/>
);
@@ -79,7 +79,7 @@ class App extends Component<Props> {
const mapDispatchToProps = (dispatch: any) => {
return {
fetchMe: (link: string) => dispatch(fetchMe(link)),
fetchMe: (link: string) => dispatch(fetchMe(link))
};
};
@@ -98,13 +98,13 @@ const mapStateToProps = state => {
loading,
error,
links,
meLink,
meLink
};
};
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps,
)(translate('commons')(App)),
mapDispatchToProps
)(translate("commons")(App))
);

View File

@@ -1,14 +1,14 @@
import React from 'react';
import React from "react";
import {
ErrorNotification,
InputField,
Notification,
PasswordConfirmation,
SubmitButton,
} from '@scm-manager/ui-components';
import { translate } from 'react-i18next';
import { Me } from '@scm-manager/ui-types';
import { changePassword } from '../modules/changePassword';
SubmitButton
} from "@scm-manager/ui-components";
import { translate } from "react-i18next";
import { Me } from "@scm-manager/ui-types";
import { changePassword } from "../modules/changePassword";
type Props = {
me: Me;
@@ -29,21 +29,21 @@ class ChangeUserPassword extends React.Component<Props, State> {
super(props);
this.state = {
oldPassword: '',
password: '',
oldPassword: "",
password: "",
loading: false,
passwordConfirmationError: false,
validatePasswordError: false,
validatePassword: '',
validatePassword: "",
passwordChanged: false,
passwordValid: false,
passwordValid: false
};
}
setLoadingState = () => {
this.setState({
...this.state,
loading: true,
loading: true
});
};
@@ -51,7 +51,7 @@ class ChangeUserPassword extends React.Component<Props, State> {
this.setState({
...this.state,
error: error,
loading: false,
loading: false
});
};
@@ -60,8 +60,8 @@ class ChangeUserPassword extends React.Component<Props, State> {
...this.state,
loading: false,
passwordChanged: true,
oldPassword: '',
password: '',
oldPassword: "",
password: ""
});
};
@@ -97,8 +97,8 @@ class ChangeUserPassword extends React.Component<Props, State> {
if (passwordChanged) {
message = (
<Notification
type={'success'}
children={t('password.changedSuccessfully')}
type={"success"}
children={t("password.changedSuccessfully")}
onClose={() => this.onClose()}
/>
);
@@ -112,29 +112,29 @@ class ChangeUserPassword extends React.Component<Props, State> {
<div className="columns">
<div className="column">
<InputField
label={t('password.currentPassword')}
label={t("password.currentPassword")}
type="password"
onChange={oldPassword =>
this.setState({
...this.state,
oldPassword,
oldPassword
})
}
value={this.state.oldPassword ? this.state.oldPassword : ''}
helpText={t('password.currentPasswordHelpText')}
value={this.state.oldPassword ? this.state.oldPassword : ""}
helpText={t("password.currentPasswordHelpText")}
/>
</div>
</div>
<PasswordConfirmation
passwordChanged={this.passwordChanged}
key={this.state.passwordChanged ? 'changed' : 'unchanged'}
key={this.state.passwordChanged ? "changed" : "unchanged"}
/>
<div className="columns">
<div className="column">
<SubmitButton
disabled={!this.isValid()}
loading={loading}
label={t('password.submit')}
label={t("password.submit")}
/>
</div>
</div>
@@ -146,16 +146,16 @@ class ChangeUserPassword extends React.Component<Props, State> {
this.setState({
...this.state,
password,
passwordValid: !!password && passwordValid,
passwordValid: !!password && passwordValid
});
};
onClose = () => {
this.setState({
...this.state,
passwordChanged: false,
passwordChanged: false
});
};
}
export default translate('commons')(ChangeUserPassword);
export default translate("commons")(ChangeUserPassword);

View File

@@ -1,20 +1,20 @@
import React, { Component } from 'react';
import App from './App';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { withRouter } from 'react-router-dom';
import React, { Component } from "react";
import App from "./App";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { withRouter } from "react-router-dom";
import { Loading, ErrorBoundary } from '@scm-manager/ui-components';
import { Loading, ErrorBoundary } from "@scm-manager/ui-components";
import {
fetchIndexResources,
getFetchIndexResourcesFailure,
getLinks,
isFetchIndexResourcesPending,
} from '../modules/indexResource';
import PluginLoader from './PluginLoader';
import { IndexResources } from '@scm-manager/ui-types';
import ScrollToTop from './ScrollToTop';
import IndexErrorPage from './IndexErrorPage';
isFetchIndexResourcesPending
} from "../modules/indexResource";
import PluginLoader from "./PluginLoader";
import { IndexResources } from "@scm-manager/ui-types";
import ScrollToTop from "./ScrollToTop";
import IndexErrorPage from "./IndexErrorPage";
type Props = {
error: Error;
@@ -36,7 +36,7 @@ class Index extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
pluginsLoaded: false,
pluginsLoaded: false
};
}
@@ -46,7 +46,7 @@ class Index extends Component<Props, State> {
pluginLoaderCallback = () => {
this.setState({
pluginsLoaded: true,
pluginsLoaded: true
});
};
@@ -77,7 +77,7 @@ class Index extends Component<Props, State> {
const mapDispatchToProps = (dispatch: any) => {
return {
fetchIndexResources: () => dispatch(fetchIndexResources()),
fetchIndexResources: () => dispatch(fetchIndexResources())
};
};
@@ -88,13 +88,13 @@ const mapStateToProps = state => {
return {
loading,
error,
indexResources,
indexResources
};
};
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps,
)(translate('commons')(Index)),
mapDispatchToProps
)(translate("commons")(Index))
);

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { translate, TFunction } from 'react-i18next';
import { ErrorPage } from '@scm-manager/ui-components';
import React from "react";
import { translate, TFunction } from "react-i18next";
import { ErrorPage } from "@scm-manager/ui-components";
type Props = {
error: Error;
@@ -12,12 +12,12 @@ class IndexErrorPage extends React.Component<Props> {
const { error, t } = this.props;
return (
<ErrorPage
title={t('app.error.title')}
subtitle={t('app.error.subtitle')}
title={t("app.error.title")}
subtitle={t("app.error.subtitle")}
error={error}
/>
);
}
}
export default translate('commons')(IndexErrorPage);
export default translate("commons")(IndexErrorPage);

View File

@@ -1,17 +1,17 @@
import React from 'react';
import { connect } from 'react-redux';
import { Redirect, withRouter } from 'react-router-dom';
import { compose } from 'redux';
import { translate } from 'react-i18next';
import styled from 'styled-components';
import React from "react";
import { connect } from "react-redux";
import { Redirect, withRouter } from "react-router-dom";
import { compose } from "redux";
import { translate } from "react-i18next";
import styled from "styled-components";
import {
getLoginFailure,
isAuthenticated,
isLoginPending,
login,
} from '../modules/auth';
import { getLoginInfoLink, getLoginLink } from '../modules/indexResource';
import LoginInfo from '../components/LoginInfo';
login
} from "../modules/auth";
import { getLoginInfoLink, getLoginLink } from "../modules/indexResource";
import LoginInfo from "../components/LoginInfo";
type Props = {
authenticated: boolean;
@@ -42,8 +42,8 @@ class Login extends React.Component<Props> {
renderRedirect = () => {
const { from } = this.props.location.state || {
from: {
pathname: '/',
},
pathname: "/"
}
};
return <Redirect to={from} />;
};
@@ -80,14 +80,14 @@ const mapStateToProps = state => {
loading,
error,
link,
loginInfoLink,
loginInfoLink
};
};
const mapDispatchToProps = dispatch => {
return {
login: (loginLink: string, username: string, password: string) =>
dispatch(login(loginLink, username, password)),
dispatch(login(loginLink, username, password))
};
};
@@ -95,6 +95,6 @@ export default compose(
withRouter,
connect(
mapStateToProps,
mapDispatchToProps,
),
mapDispatchToProps
)
)(Login);

View File

@@ -1,17 +1,17 @@
import React from 'react';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { Redirect } from 'react-router-dom';
import React from "react";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { Redirect } from "react-router-dom";
import {
logout,
isAuthenticated,
isLogoutPending,
getLogoutFailure,
isRedirecting,
} from '../modules/auth';
import { Loading, ErrorPage } from '@scm-manager/ui-components';
import { getLogoutLink } from '../modules/indexResource';
isRedirecting
} from "../modules/auth";
import { Loading, ErrorPage } from "@scm-manager/ui-components";
import { getLogoutLink } from "../modules/indexResource";
type Props = {
authenticated: boolean;
@@ -37,8 +37,8 @@ class Logout extends React.Component<Props> {
if (error) {
return (
<ErrorPage
title={t('logout.error.title')}
subtitle={t('logout.error.subtitle')}
title={t("logout.error.title")}
subtitle={t("logout.error.subtitle")}
error={error}
/>
);
@@ -61,17 +61,17 @@ const mapStateToProps = state => {
loading,
redirecting,
error,
logoutLink,
logoutLink
};
};
const mapDispatchToProps = dispatch => {
return {
logout: (link: string) => dispatch(logout(link)),
logout: (link: string) => dispatch(logout(link))
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(translate('commons')(Logout));
mapDispatchToProps
)(translate("commons")(Logout));

View File

@@ -1,28 +1,28 @@
import React from 'react';
import React from "react";
import { Redirect, Route, Switch, withRouter } from 'react-router-dom';
import { Links } from '@scm-manager/ui-types';
import { Redirect, Route, Switch, withRouter } from "react-router-dom";
import { Links } from "@scm-manager/ui-types";
import Overview from '../repos/containers/Overview';
import Users from '../users/containers/Users';
import Login from '../containers/Login';
import Logout from '../containers/Logout';
import Overview from "../repos/containers/Overview";
import Users from "../users/containers/Users";
import Login from "../containers/Login";
import Logout from "../containers/Logout";
import { ProtectedRoute } from '@scm-manager/ui-components';
import { binder, ExtensionPoint } from '@scm-manager/ui-extensions';
import { ProtectedRoute } from "@scm-manager/ui-components";
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
import CreateUser from '../users/containers/CreateUser';
import SingleUser from '../users/containers/SingleUser';
import RepositoryRoot from '../repos/containers/RepositoryRoot';
import Create from '../repos/containers/Create';
import CreateUser from "../users/containers/CreateUser";
import SingleUser from "../users/containers/SingleUser";
import RepositoryRoot from "../repos/containers/RepositoryRoot";
import Create from "../repos/containers/Create";
import Groups from '../groups/containers/Groups';
import SingleGroup from '../groups/containers/SingleGroup';
import CreateGroup from '../groups/containers/CreateGroup';
import Groups from "../groups/containers/Groups";
import SingleGroup from "../groups/containers/SingleGroup";
import CreateGroup from "../groups/containers/CreateGroup";
import Admin from '../admin/containers/Admin';
import Admin from "../admin/containers/Admin";
import Profile from './Profile';
import Profile from "./Profile";
type Props = {
authenticated?: boolean;
@@ -32,8 +32,8 @@ type Props = {
class Main extends React.Component<Props> {
render() {
const { authenticated, links } = this.props;
const redirectUrlFactory = binder.getExtension('main.redirect', this.props);
let url = '/repos/';
const redirectUrlFactory = binder.getExtension("main.redirect", this.props);
let url = "/repos/";
if (redirectUrlFactory) {
url = redirectUrlFactory(this.props);
}
@@ -128,7 +128,7 @@ class Main extends React.Component<Props> {
renderAll={true}
props={{
authenticated,
links,
links
}}
/>
</Switch>

View File

@@ -1,8 +1,8 @@
import * as React from 'react';
import { apiClient, Loading } from '@scm-manager/ui-components';
import { getUiPluginsLink } from '../modules/indexResource';
import { connect } from 'react-redux';
import loadBundle from './loadBundle';
import * as React from "react";
import { apiClient, Loading } from "@scm-manager/ui-components";
import { getUiPluginsLink } from "../modules/indexResource";
import { connect } from "react-redux";
import loadBundle from "./loadBundle";
type Props = {
loaded: boolean;
@@ -24,7 +24,7 @@ class PluginLoader extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
message: 'booting',
message: "booting"
};
}
@@ -32,7 +32,7 @@ class PluginLoader extends React.Component<Props, State> {
const { loaded } = this.props;
if (!loaded) {
this.setState({
message: 'loading plugin information',
message: "loading plugin information"
});
this.getPlugins(this.props.link);
@@ -51,7 +51,7 @@ class PluginLoader extends React.Component<Props, State> {
loadPlugins = (plugins: Plugin[]) => {
this.setState({
message: 'loading plugins',
message: "loading plugins"
});
const promises = [];
@@ -68,7 +68,7 @@ class PluginLoader extends React.Component<Props, State> {
loadPlugin = (plugin: Plugin) => {
this.setState({
message: `loading ${plugin.name}`,
message: `loading ${plugin.name}`
});
const promises = [];
@@ -99,7 +99,7 @@ const comparePluginsByName = (a: Plugin, b: Plugin) => {
const mapStateToProps = state => {
const link = getUiPluginsLink(state);
return {
link,
link
};
};

View File

@@ -1,22 +1,22 @@
import React from 'react';
import React from "react";
import { Route, withRouter } from 'react-router-dom';
import { getMe } from '../modules/auth';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { Me } from '@scm-manager/ui-types';
import { Route, withRouter } from "react-router-dom";
import { getMe } from "../modules/auth";
import { compose } from "redux";
import { connect } from "react-redux";
import { translate } from "react-i18next";
import { Me } from "@scm-manager/ui-types";
import {
ErrorPage,
Page,
Navigation,
SubNavigation,
Section,
NavLink,
} from '@scm-manager/ui-components';
import ChangeUserPassword from './ChangeUserPassword';
import ProfileInfo from './ProfileInfo';
import { ExtensionPoint } from '@scm-manager/ui-extensions';
NavLink
} from "@scm-manager/ui-components";
import ChangeUserPassword from "./ChangeUserPassword";
import ProfileInfo from "./ProfileInfo";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
type Props = {
me: Me;
@@ -29,7 +29,7 @@ type State = {};
class Profile extends React.Component<Props, State> {
stripEndingSlash = (url: string) => {
if (url.endsWith('/')) {
if (url.endsWith("/")) {
return url.substring(0, url.length - 2);
}
return url;
@@ -47,11 +47,11 @@ class Profile extends React.Component<Props, State> {
if (!me) {
return (
<ErrorPage
title={t('profile.error-title')}
subtitle={t('profile.error-subtitle')}
title={t("profile.error-title")}
subtitle={t("profile.error-subtitle")}
error={{
name: t('profile.error'),
message: t('profile.error-message'),
name: t("profile.error"),
message: t("profile.error-message")
}}
/>
);
@@ -59,7 +59,7 @@ class Profile extends React.Component<Props, State> {
const extensionProps = {
me,
url,
url
};
return (
@@ -79,19 +79,19 @@ class Profile extends React.Component<Props, State> {
</div>
<div className="column">
<Navigation>
<Section label={t('profile.navigationLabel')}>
<Section label={t("profile.navigationLabel")}>
<NavLink
to={`${url}`}
icon="fas fa-info-circle"
label={t('profile.informationNavLink')}
label={t("profile.informationNavLink")}
/>
<SubNavigation
to={`${url}/settings/password`}
label={t('profile.settingsNavLink')}
label={t("profile.settingsNavLink")}
>
<NavLink
to={`${url}/settings/password`}
label={t('profile.changePasswordNavLink')}
label={t("profile.changePasswordNavLink")}
/>
<ExtensionPoint
name="profile.setting"
@@ -110,12 +110,12 @@ class Profile extends React.Component<Props, State> {
const mapStateToProps = state => {
return {
me: getMe(state),
me: getMe(state)
};
};
export default compose(
translate('commons'),
translate("commons"),
connect(mapStateToProps),
withRouter,
withRouter
)(Profile);

View File

@@ -1,11 +1,11 @@
import React from 'react';
import { translate } from 'react-i18next';
import { Me } from '@scm-manager/ui-types';
import React from "react";
import { translate } from "react-i18next";
import { Me } from "@scm-manager/ui-types";
import {
MailLink,
AvatarWrapper,
AvatarImage,
} from '@scm-manager/ui-components';
AvatarImage
} from "@scm-manager/ui-components";
type Props = {
me: Me;
@@ -30,15 +30,15 @@ class ProfileInfo extends React.Component<Props> {
<table className="table content">
<tbody>
<tr>
<th>{t('profile.username')}</th>
<th>{t("profile.username")}</th>
<td>{me.name}</td>
</tr>
<tr>
<th>{t('profile.displayName')}</th>
<th>{t("profile.displayName")}</th>
<td>{me.displayName}</td>
</tr>
<tr>
<th>{t('profile.mail')}</th>
<th>{t("profile.mail")}</th>
<td>
<MailLink address={me.mail} />
</td>
@@ -58,7 +58,7 @@ class ProfileInfo extends React.Component<Props> {
if (me.groups.length > 0) {
groups = (
<tr>
<th>{t('profile.groups')}</th>
<th>{t("profile.groups")}</th>
<td className="is-paddingless">
<ul>
{me.groups.map(group => {
@@ -73,4 +73,4 @@ class ProfileInfo extends React.Component<Props> {
}
}
export default translate('commons')(ProfileInfo);
export default translate("commons")(ProfileInfo);

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { withRouter } from 'react-router-dom';
import React from "react";
import { withRouter } from "react-router-dom";
type Props = {
location: any;

View File

@@ -1,33 +1,33 @@
/* global SystemJS */
// eslint-disable-next-line import/no-webpack-loader-syntax
import 'script-loader!../../../../node_modules/systemjs/dist/system.js';
import "script-loader!../../../../node_modules/systemjs/dist/system.js";
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactRouterDom from 'react-router-dom';
import * as Redux from 'redux';
import * as ReactRedux from 'react-redux';
import SytleComponentsDefault from 'styled-components';
import * as SytleComponents from 'styled-components';
import * as ReactI18Next from 'react-i18next';
import ClassNamesDefault from 'classnames';
import * as ClassNames from 'classnames';
import QueryStringDefault from 'query-string';
import * as QueryString from 'query-string';
import * as UIExtensions from '@scm-manager/ui-extensions';
import * as UIComponents from '@scm-manager/ui-components';
import { urls } from '@scm-manager/ui-components';
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as ReactRouterDom from "react-router-dom";
import * as Redux from "redux";
import * as ReactRedux from "react-redux";
import SytleComponentsDefault from "styled-components";
import * as SytleComponents from "styled-components";
import * as ReactI18Next from "react-i18next";
import ClassNamesDefault from "classnames";
import * as ClassNames from "classnames";
import QueryStringDefault from "query-string";
import * as QueryString from "query-string";
import * as UIExtensions from "@scm-manager/ui-extensions";
import * as UIComponents from "@scm-manager/ui-components";
import { urls } from "@scm-manager/ui-components";
// TODO add headers "Cache": "no-cache", "X-Requested-With": "XMLHttpRequest"
SystemJS.config({
baseURL: urls.withContextPath('/assets'),
baseURL: urls.withContextPath("/assets"),
meta: {
'/*': {
"/*": {
esModule: true,
authorization: true,
},
},
authorization: true
}
}
});
const expose = (name, cmp, defaultCmp) => {
@@ -37,22 +37,22 @@ const expose = (name, cmp, defaultCmp) => {
// https://github.com/systemjs/systemjs/issues/1749
mod = {
...cmp,
__useDefault: defaultCmp,
__useDefault: defaultCmp
};
}
SystemJS.set(name, SystemJS.newModule(mod));
};
expose('react', React);
expose('react-dom', ReactDOM);
expose('react-router-dom', ReactRouterDom);
expose('styled-components', SytleComponents, SytleComponentsDefault);
expose('redux', Redux);
expose('react-redux', ReactRedux);
expose('react-i18next', ReactI18Next);
expose('classnames', ClassNames, ClassNamesDefault);
expose('query-string', QueryString, QueryStringDefault);
expose('@scm-manager/ui-extensions', UIExtensions);
expose('@scm-manager/ui-components', UIComponents);
expose("react", React);
expose("react-dom", ReactDOM);
expose("react-router-dom", ReactRouterDom);
expose("styled-components", SytleComponents, SytleComponentsDefault);
expose("redux", Redux);
expose("react-redux", ReactRedux);
expose("react-i18next", ReactI18Next);
expose("classnames", ClassNames, ClassNamesDefault);
expose("query-string", QueryString, QueryStringDefault);
expose("@scm-manager/ui-extensions", UIExtensions);
expose("@scm-manager/ui-components", UIComponents);
export default plugin => SystemJS.import(plugin);