use === instead of == and unused imports (#431)

This commit is contained in:
Erik Jan de Wit 2021-03-12 07:42:54 +01:00 committed by GitHub
parent 28f1fdfda4
commit ab857938cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 18 deletions

View file

@ -1,5 +1,5 @@
import React, { useEffect } from "react";
import { useFieldArray, useFormContext, UseFormMethods } from "react-hook-form";
import { useFieldArray, useFormContext } from "react-hook-form";
import {
TextInput,
Split,

View file

@ -59,9 +59,6 @@ export const PaginatingTableToolbar = ({
/>
);
if (count === 0) {
<>{children}</>;
}
return (
<TableToolbar
searchTypeComponent={searchTypeComponent}

View file

@ -25,7 +25,7 @@ export type AssociatedRolesModalProps = {
};
const attributesToArray = (attributes: { [key: string]: string }): any => {
if (!attributes || Object.keys(attributes).length == 0) {
if (!attributes || Object.keys(attributes).length === 0) {
return [
{
key: "",
@ -138,7 +138,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
})();
}, []);
const setupForm = (role: RoleRepresentation) => {
const setupForm = (role: RoleRepresentation) =>
Object.entries(role).map((entry) => {
if (entry[0] === "attributes") {
form.setValue(entry[0], attributesToArray(entry[1]));
@ -146,17 +146,16 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
form.setValue(entry[0], entry[1]);
}
});
};
const onFilterDropdownToggle = () => {
setIsFilterDropdownOpen(!isFilterDropdownOpen);
};
const onFilterDropdownSelect = (filterType: string) => {
if (filterType == "roles") {
if (filterType === "roles") {
setFilterType("clients");
}
if (filterType == "clients") {
if (filterType === "clients") {
setFilterType("roles");
}
setIsFilterDropdownOpen(!isFilterDropdownOpen);
@ -194,7 +193,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
>
<KeycloakDataTable
key={key}
loader={filterType == "roles" ? loader : clientRolesLoader}
loader={filterType === "roles" ? loader : clientRolesLoader}
ariaLabelKey="roles:roleList"
searchPlaceholderKey="roles:searchFor"
searchTypeComponent={
@ -217,7 +216,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
data-testid="filter-type-dropdown-item"
key="filter-type"
>
{filterType == "roles"
{filterType === "roles"
? t("filterByClients")
: t("filterByRoles")}{" "}
</DropdownItem>,

View file

@ -210,7 +210,7 @@ export const AssociatedRolesTab = ({
</Button>
<Button
variant="link"
isDisabled={selectedRows.length == 0}
isDisabled={selectedRows.length === 0}
key="remove-role-button"
onClick={() => {
toggleDeleteAssociatedRolesDialog();

View file

@ -36,7 +36,7 @@ const arrayToAttributes = (attributeArray: KeyValueType[]) => {
const attributesToArray = (attributes?: {
[key: string]: string[];
}): KeyValueType[] => {
if (!attributes || Object.keys(attributes).length == 0) {
if (!attributes || Object.keys(attributes).length === 0) {
return [];
}
return Object.keys(attributes).map((key) => ({

View file

@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next";
import {
PageSection,
FormGroup,
Form,
TextInput,
Switch,
ActionGroup,

View file

@ -102,7 +102,7 @@ export const UserFederationLdapWizard = () => {
<WizardContextConsumer>
{({ activeStep, onNext, onBack, onClose }) => {
// First step buttons
if (activeStep.id == "ldapRequiredSettingsStep") {
if (activeStep.id === "ldapRequiredSettingsStep") {
return (
<>
<Button variant="primary" type="submit" onClick={onNext}>
@ -123,8 +123,8 @@ export const UserFederationLdapWizard = () => {
}
// Other required step buttons
else if (
activeStep.id == "ldapConnectionSettingsStep" ||
activeStep.id == "ldapSearchingSettingsStep"
activeStep.id === "ldapConnectionSettingsStep" ||
activeStep.id === "ldapSearchingSettingsStep"
) {
return (
<>
@ -141,7 +141,7 @@ export const UserFederationLdapWizard = () => {
);
}
// Last step buttons
else if (activeStep.id == "ldapAdvancedSettingsStep") {
else if (activeStep.id === "ldapAdvancedSettingsStep") {
return (
<>
<Button