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

@@ -91,24 +91,13 @@ class ConfigForm extends React.Component<Props, State> {
};
render() {
const {
loading,
t,
namespaceStrategies,
configReadPermission,
configUpdatePermission
} = this.props;
const { loading, t, namespaceStrategies, configReadPermission, configUpdatePermission } = this.props;
const config = this.state.config;
let noPermissionNotification = null;
if (!configReadPermission) {
return (
<Notification
type={"danger"}
children={t("config.form.no-read-permission-notification")}
/>
);
return <Notification type={"danger"} children={t("config.form.no-read-permission-notification")} />;
}
if (this.state.showNotification) {
@@ -135,27 +124,21 @@ class ConfigForm extends React.Component<Props, State> {
pluginUrl={config.pluginUrl}
enabledXsrfProtection={config.enabledXsrfProtection}
namespaceStrategy={config.namespaceStrategy}
onChange={(isValid, changedValue, name) =>
this.onChange(isValid, changedValue, name)
}
onChange={(isValid, changedValue, name) => this.onChange(isValid, changedValue, name)}
hasUpdatePermission={configUpdatePermission}
/>
<hr />
<LoginAttempt
loginAttemptLimit={config.loginAttemptLimit}
loginAttemptLimitTimeout={config.loginAttemptLimitTimeout}
onChange={(isValid, changedValue, name) =>
this.onChange(isValid, changedValue, name)
}
onChange={(isValid, changedValue, name) => this.onChange(isValid, changedValue, name)}
hasUpdatePermission={configUpdatePermission}
/>
<hr />
<BaseUrlSettings
baseUrl={config.baseUrl}
forceBaseUrl={config.forceBaseUrl}
onChange={(isValid, changedValue, name) =>
this.onChange(isValid, changedValue, name)
}
onChange={(isValid, changedValue, name) => this.onChange(isValid, changedValue, name)}
hasUpdatePermission={configUpdatePermission}
/>
<hr />
@@ -166,18 +149,14 @@ class ConfigForm extends React.Component<Props, State> {
proxyUser={config.proxyUser ? config.proxyUser : ""}
enableProxy={config.enableProxy}
proxyExcludes={config.proxyExcludes}
onChange={(isValid, changedValue, name) =>
this.onChange(isValid, changedValue, name)
}
onChange={(isValid, changedValue, name) => this.onChange(isValid, changedValue, name)}
hasUpdatePermission={configUpdatePermission}
/>
<hr />
<SubmitButton
loading={loading}
label={t("config.form.submit")}
disabled={
!configUpdatePermission || this.hasError() || !this.state.changed
}
disabled={!configUpdatePermission || this.hasError() || !this.state.changed}
/>
</form>
);
@@ -199,10 +178,7 @@ class ConfigForm extends React.Component<Props, State> {
};
hasError = () => {
return (
this.state.error.loginAttemptLimit ||
this.state.error.loginAttemptLimitTimeout
);
return this.state.error.loginAttemptLimit || this.state.error.loginAttemptLimitTimeout;
};
onClose = () => {

View File

@@ -1,10 +1,6 @@
import React from "react";
import { translate } from "react-i18next";
import {
InputField,
Subtitle,
validation as validator
} from "@scm-manager/ui-components";
import { InputField, Subtitle, validation as validator } from "@scm-manager/ui-components";
type Props = {
loginAttemptLimit: number;
@@ -29,12 +25,7 @@ class LoginAttempt extends React.Component<Props, State> {
};
}
render() {
const {
t,
loginAttemptLimit,
loginAttemptLimitTimeout,
hasUpdatePermission
} = this.props;
const { t, loginAttemptLimit, loginAttemptLimitTimeout, hasUpdatePermission } = this.props;
return (
<div>
@@ -73,11 +64,7 @@ class LoginAttempt extends React.Component<Props, State> {
...this.state,
loginAttemptLimitError: !validator.isNumberValid(value)
});
this.props.onChange(
validator.isNumberValid(value),
value,
"loginAttemptLimit"
);
this.props.onChange(validator.isNumberValid(value), value, "loginAttemptLimit");
};
handleLoginAttemptLimitTimeoutChange = (value: string) => {
@@ -85,11 +72,7 @@ class LoginAttempt extends React.Component<Props, State> {
...this.state,
loginAttemptLimitTimeoutError: !validator.isNumberValid(value)
});
this.props.onChange(
validator.isNumberValid(value),
value,
"loginAttemptLimitTimeout"
);
this.props.onChange(validator.isNumberValid(value), value, "loginAttemptLimitTimeout");
};
}

View File

@@ -37,11 +37,7 @@ class NamespaceStrategySelect extends React.Component<Props> {
findSelected = () => {
const { namespaceStrategies, value } = this.props;
if (
!namespaceStrategies ||
!namespaceStrategies.available ||
namespaceStrategies.available.indexOf(value) < 0
) {
if (!namespaceStrategies || !namespaceStrategies.available || namespaceStrategies.available.indexOf(value) < 0) {
return namespaceStrategies.current;
}
return value;

View File

@@ -1,11 +1,6 @@
import React from "react";
import { translate } from "react-i18next";
import {
Checkbox,
InputField,
Subtitle,
AddEntryToTableField
} from "@scm-manager/ui-components";
import { Checkbox, InputField, Subtitle, AddEntryToTableField } from "@scm-manager/ui-components";
import ProxyExcludesTable from "../table/ProxyExcludesTable";
type Props = {
@@ -92,9 +87,7 @@ class ProxySettings extends React.Component<Props> {
<div className="column is-full">
<ProxyExcludesTable
proxyExcludes={proxyExcludes}
onChange={(isValid, changedValue, name) =>
this.props.onChange(isValid, changedValue, name)
}
onChange={(isValid, changedValue, name) => this.props.onChange(isValid, changedValue, name)}
disabled={!enableProxy || !hasUpdatePermission}
/>
<AddEntryToTableField
@@ -130,11 +123,7 @@ class ProxySettings extends React.Component<Props> {
if (this.isProxyExcludeMember(proxyExcludeName)) {
return;
}
this.props.onChange(
true,
[...this.props.proxyExcludes, proxyExcludeName],
"proxyExcludes"
);
this.props.onChange(true, [...this.props.proxyExcludes, proxyExcludeName], "proxyExcludes");
};
isProxyExcludeMember = (proxyExcludeName: string) => {

View File

@@ -1,8 +1,5 @@
import React from "react";
import {
RemoveEntryOfTableButton,
LabelWithHelpIcon
} from "@scm-manager/ui-components";
import { RemoveEntryOfTableButton, LabelWithHelpIcon } from "@scm-manager/ui-components";
type Props = {
items: string[];