feat: fix some comma dangle

This commit is contained in:
qianxi0410 2022-08-07 00:17:27 +08:00
parent 9bca6bb72e
commit c428de6e42
23 changed files with 81 additions and 75 deletions

View File

@ -53,7 +53,13 @@
"space-infix-ops": "error",
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
"comma-style": ["error", "last"],
"comma-dangle": ["error", "always-multiline"],
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "never",
"exports": "never",
"functions": "never"
}],
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],

View File

@ -360,7 +360,7 @@ class App extends Component {
<Link to="/">
{i18next.t("general:Home")}
</Link>
</Menu.Item>,
</Menu.Item>
);
if (Setting.isAdminUser(this.state.account)) {
@ -369,49 +369,49 @@ class App extends Component {
<Link to="/organizations">
{i18next.t("general:Organizations")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/users">
<Link to="/users">
{i18next.t("general:Users")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/roles">
<Link to="/roles">
{i18next.t("general:Roles")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/permissions">
<Link to="/permissions">
{i18next.t("general:Permissions")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/models">
<Link to="/models">
{i18next.t("general:Models")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/providers">
<Link to="/providers">
{i18next.t("general:Providers")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/applications">
<Link to="/applications">
{i18next.t("general:Applications")}
</Link>
</Menu.Item>,
</Menu.Item>
);
}
@ -421,42 +421,42 @@ class App extends Component {
<Link to="/resources">
{i18next.t("general:Resources")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/tokens">
<Link to="/tokens">
{i18next.t("general:Tokens")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/records">
<Link to="/records">
{i18next.t("general:Records")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/webhooks">
<Link to="/webhooks">
{i18next.t("general:Webhooks")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/syncers">
<Link to="/syncers">
{i18next.t("general:Syncers")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/certs">
<Link to="/certs">
{i18next.t("general:Certs")}
</Link>
</Menu.Item>,
</Menu.Item>
);
if (Conf.EnableExtraPages) {
@ -465,14 +465,14 @@ class App extends Component {
<Link to="/products">
{i18next.t("general:Products")}
</Link>
</Menu.Item>,
</Menu.Item>
);
res.push(
<Menu.Item key="/payments">
<Link to="/payments">
{i18next.t("general:Payments")}
</Link>
</Menu.Item>,
</Menu.Item>
);
}
@ -481,7 +481,7 @@ class App extends Component {
<a target="_blank" rel="noreferrer" href={Setting.isLocalhost() ? `${Setting.ServerUrl}/swagger` : "/swagger"}>
{i18next.t("general:Swagger")}
</a>
</Menu.Item>,
</Menu.Item>
);
}

View File

@ -61,7 +61,7 @@ class ApplicationListPage extends BaseListPage {
ApplicationBackend.addApplication(newApplication)
.then((res) => {
this.props.history.push({pathname: `/applications/${newApplication.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Application failed to add: ${error}`);
@ -76,7 +76,7 @@ class ApplicationListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Application failed to delete: ${error}`);

View File

@ -44,7 +44,7 @@ class CertListPage extends BaseListPage {
CertBackend.addCert(newCert)
.then((res) => {
this.props.history.push({pathname: `/certs/${newCert.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Cert failed to add: ${error}`);
@ -59,7 +59,7 @@ class CertListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Cert failed to delete: ${error}`);

View File

@ -66,7 +66,7 @@ class LdapTable extends React.Component {
} else {
Setting.showMessage("error", res.msg);
}
},
}
)
.catch(error => {
Setting.showMessage("error", `Add LDAP server failed: ${error}`);
@ -83,7 +83,7 @@ class LdapTable extends React.Component {
} else {
Setting.showMessage("error", res.msg);
}
},
}
)
.catch(error => {
Setting.showMessage("error", `Delete LDAP server failed: ${error}`);

View File

@ -39,7 +39,7 @@ class ModelListPage extends BaseListPage {
ModelBackend.addModel(newModel)
.then((res) => {
this.props.history.push({pathname: `/models/${newModel.owner}/${newModel.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Model failed to add: ${error}`);
@ -54,7 +54,7 @@ class ModelListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Model failed to delete: ${error}`);

View File

@ -74,7 +74,7 @@ class OrganizationListPage extends BaseListPage {
OrganizationBackend.addOrganization(newOrganization)
.then((res) => {
this.props.history.push({pathname: `/organizations/${newOrganization.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Organization failed to add: ${error}`);
@ -89,7 +89,7 @@ class OrganizationListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Organization failed to delete: ${error}`);

View File

@ -52,7 +52,7 @@ class PaymentListPage extends BaseListPage {
PaymentBackend.addPayment(newPayment)
.then((res) => {
this.props.history.push({pathname: `/payments/${newPayment.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Payment failed to add: ${error}`);
@ -67,7 +67,7 @@ class PaymentListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Payment failed to delete: ${error}`);

View File

@ -44,7 +44,7 @@ class PermissionListPage extends BaseListPage {
PermissionBackend.addPermission(newPermission)
.then((res) => {
this.props.history.push({pathname: `/permissions/${newPermission.owner}/${newPermission.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Permission failed to add: ${error}`);
@ -59,7 +59,7 @@ class PermissionListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Permission failed to delete: ${error}`);

View File

@ -46,7 +46,7 @@ class ProductListPage extends BaseListPage {
ProductBackend.addProduct(newProduct)
.then((res) => {
this.props.history.push({pathname: `/products/${newProduct.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Product failed to add: ${error}`);
@ -61,7 +61,7 @@ class ProductListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Product failed to delete: ${error}`);

View File

@ -47,7 +47,7 @@ class ProviderListPage extends BaseListPage {
ProviderBackend.addProvider(newProvider)
.then((res) => {
this.props.history.push({pathname: `/providers/${newProvider.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Provider failed to add: ${error}`);
@ -62,7 +62,7 @@ class ProviderListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Provider failed to delete: ${error}`);

View File

@ -48,7 +48,7 @@ class ResourceListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Resource failed to delete: ${error}`);

View File

@ -40,7 +40,7 @@ class RoleListPage extends BaseListPage {
RoleBackend.addRole(newRole)
.then((res) => {
this.props.history.push({pathname: `/roles/${newRole.owner}/${newRole.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Role failed to add: ${error}`);
@ -55,7 +55,7 @@ class RoleListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Role failed to delete: ${error}`);

View File

@ -808,7 +808,7 @@ export function getTags(tags) {
res.push(
<Tag color={getTagColor(tag)}>
{tag}
</Tag>,
</Tag>
);
});
return res;

View File

@ -50,7 +50,7 @@ class SyncerListPage extends BaseListPage {
SyncerBackend.addSyncer(newSyncer)
.then((res) => {
this.props.history.push({pathname: `/syncers/${newSyncer.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Syncer failed to add: ${error}`);
@ -65,7 +65,7 @@ class SyncerListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Syncer failed to delete: ${error}`);
@ -78,7 +78,7 @@ class SyncerListPage extends BaseListPage {
.then((res) => {
this.setState({loading: false});
Setting.showMessage("success", "Syncer sync users successfully");
},
}
)
.catch(error => {
this.setState({loading: false});

View File

@ -43,7 +43,7 @@ class TokenListPage extends BaseListPage {
TokenBackend.addToken(newToken)
.then((res) => {
this.props.history.push({pathname: `/tokens/${newToken.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Token failed to add: ${error}`);
@ -58,7 +58,7 @@ class TokenListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Token failed to delete: ${error}`);

View File

@ -469,7 +469,7 @@ class UserEditPage extends React.Component {
<OAuthWidget key={providerItem.name} labelSpan={(Setting.isMobile()) ? 10 : 3} user={this.state.user} application={this.state.application} providerItem={providerItem} account={this.props.account} onUnlinked={() => {return this.unlinked();}} />
) : (
<SamlWidget key={providerItem.name} labelSpan={(Setting.isMobile()) ? 10 : 3} user={this.state.user} application={this.state.application} providerItem={providerItem} onUnlinked={() => {return this.unlinked();}} />
),
)
)
)
}

View File

@ -70,7 +70,7 @@ class UserListPage extends BaseListPage {
UserBackend.addUser(newUser)
.then((res) => {
this.props.history.push({pathname: `/users/${newUser.owner}/${newUser.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `User failed to add: ${error}`);
@ -85,7 +85,7 @@ class UserListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `User failed to delete: ${error}`);

View File

@ -43,7 +43,7 @@ class WebhookListPage extends BaseListPage {
WebhookBackend.addWebhook(newWebhook)
.then((res) => {
this.props.history.push({pathname: `/webhooks/${newWebhook.name}`, mode: "add"});
},
}
)
.catch(error => {
Setting.showMessage("error", `Webhook failed to add: ${error}`);
@ -58,7 +58,7 @@ class WebhookListPage extends BaseListPage {
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
});
},
}
)
.catch(error => {
Setting.showMessage("error", `Webhook failed to delete: ${error}`);

View File

@ -62,7 +62,7 @@ class ForgetPage extends React.Component {
} else {
Util.showMessage(
"error",
i18next.t("forget:Unknown forget type: ") + this.state.type,
i18next.t("forget:Unknown forget type: ") + this.state.type
);
}
}
@ -77,7 +77,7 @@ class ForgetPage extends React.Component {
this.setState({
application: application,
});
},
}
);
}
@ -182,7 +182,7 @@ class ForgetPage extends React.Component {
options.push(
<Option key={"phone"} value={"phone"}>
&nbsp;&nbsp;{this.state.phone}
</Option>,
</Option>
);
}
@ -190,7 +190,7 @@ class ForgetPage extends React.Component {
options.push(
<Option key={"email"} value={"email"}>
&nbsp;&nbsp;{this.state.email}
</Option>,
</Option>
);
}
@ -222,7 +222,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your application!",
"forget:Please input your application!"
),
},
]}
@ -234,7 +234,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your organization!",
"forget:Please input your organization!"
),
},
]}
@ -245,7 +245,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your username!",
"forget:Please input your username!"
),
whitespace: true,
},
@ -278,7 +278,7 @@ class ForgetPage extends React.Component {
this.onFinishFailed(
errorInfo.values,
errorInfo.errorFields,
errorInfo.outOfDate,
errorInfo.outOfDate
)
}
initialValues={{
@ -295,7 +295,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your application!",
"forget:Please input your application!"
),
},
]}
@ -307,7 +307,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your organization!",
"forget:Please input your organization!"
),
},
]}
@ -343,7 +343,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"code:Please input your verification code!",
"code:Please input your verification code!"
),
},
]}
@ -382,7 +382,7 @@ class ForgetPage extends React.Component {
this.onFinishFailed(
errorInfo.values,
errorInfo.errorFields,
errorInfo.outOfDate,
errorInfo.outOfDate
)
}
initialValues={{
@ -399,7 +399,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your application!",
"forget:Please input your application!"
),
},
]}
@ -411,7 +411,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your organization!",
"forget:Please input your organization!"
),
},
]}
@ -423,7 +423,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your password!",
"forget:Please input your password!"
),
},
]}
@ -443,7 +443,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please confirm your password!",
"forget:Please confirm your password!"
),
},
({getFieldValue}) => ({
@ -453,8 +453,8 @@ class ForgetPage extends React.Component {
}
return Promise.reject(
i18next.t(
"forget:Your confirmed password is inconsistent with the password!",
),
"forget:Your confirmed password is inconsistent with the password!"
)
);
},
}),

View File

@ -107,7 +107,7 @@ class LoginPage extends React.Component {
this.setState({
application: application,
});
},
}
);
}

View File

@ -26,7 +26,7 @@ ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById("root"),
document.getElementById("root")
);
// If you want your app to work offline and load faster, you can change

View File

@ -30,8 +30,8 @@ const isLocalhost = Boolean(
window.location.hostname === "[::1]" ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,
),
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
export function register(config) {
@ -57,7 +57,7 @@ export function register(config) {
navigator.serviceWorker.ready.then(() => {
console.log(
"This web app is being served cache-first by a service " +
"worker. To learn more, visit https://bit.ly/CRA-PWA",
"worker. To learn more, visit https://bit.ly/CRA-PWA"
);
});
} else {
@ -85,7 +85,7 @@ function registerValidSW(swUrl, config) {
// content until all client tabs are closed.
console.log(
"New content is available and will be used when all " +
"tabs for this page are closed. See https://bit.ly/CRA-PWA.",
"tabs for this page are closed. See https://bit.ly/CRA-PWA."
);
// Execute callback
@ -137,7 +137,7 @@ function checkValidServiceWorker(swUrl, config) {
})
.catch(() => {
console.log(
"No internet connection found. App is running in offline mode.",
"No internet connection found. App is running in offline mode."
);
});
}