diff --git a/.eslintrc.js b/.eslintrc.js index f7cdd0c04e..d385f0e8ed 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -30,6 +30,8 @@ module.exports = { // react/prop-types cannot handle generic props, so we need to disable it. // https://github.com/yannickcr/eslint-plugin-react/issues/2777#issuecomment-814968432 "react/prop-types": "off", + // Prevent fragments from being added that have only a single child. + "react/jsx-no-useless-fragment": "error" }, overrides: [ { diff --git a/src/PageHeader.tsx b/src/PageHeader.tsx index a235d816d9..d193c0d9ea 100644 --- a/src/PageHeader.tsx +++ b/src/PageHeader.tsx @@ -27,37 +27,27 @@ export const Header = () => { const adminClient = useAdminClient(); const { t } = useTranslation(); - const ManageAccountDropdownItem = () => { - return ( - <> - {adminClient.keycloak && ( - adminClient.keycloak?.accountManagement()} - > - {t("manageAccount")} - - )} - - ); - }; + const ManageAccountDropdownItem = () => + adminClient.keycloak ? ( + adminClient.keycloak?.accountManagement()} + > + {t("manageAccount")} + + ) : null; - const SignOutDropdownItem = () => { - return ( - <> - {adminClient.keycloak && ( - adminClient.keycloak?.logout({ redirectUri: "" })} - > - {t("signOut")} - - )} - - ); - }; + const SignOutDropdownItem = () => + adminClient.keycloak ? ( + adminClient.keycloak?.logout({ redirectUri: "" })} + > + {t("signOut")} + + ) : null; const ServerInfoDropdownItem = () => { const { realm } = useRealm(); diff --git a/src/client-scopes/ClientScopesSection.tsx b/src/client-scopes/ClientScopesSection.tsx index 8e0ff6a0eb..637251ddd3 100644 --- a/src/client-scopes/ClientScopesSection.tsx +++ b/src/client-scopes/ClientScopesSection.tsx @@ -107,22 +107,20 @@ export const ClientScopesSection = () => { }); const TypeSelector = (scope: ClientScopeDefaultOptionalType) => ( - <> - { - try { - await changeScope(adminClient, scope, value); - addAlert(t("clientScopeSuccess"), AlertVariant.success); - refresh(); - } catch (error) { - addError("client-scopes:clientScopeError", error); - } - }} - /> - + { + try { + await changeScope(adminClient, scope, value); + addAlert(t("clientScopeSuccess"), AlertVariant.success); + refresh(); + } catch (error) { + addError("client-scopes:clientScopeError", error); + } + }} + /> ); const ClientScopeDetailLink = ({ @@ -130,14 +128,12 @@ export const ClientScopesSection = () => { type, name, }: ClientScopeDefaultOptionalType) => ( - <> - - {name} - - + + {name} + ); return ( <> diff --git a/src/client-scopes/add/MapperDialog.tsx b/src/client-scopes/add/MapperDialog.tsx index f0e8b4dbd6..17c8eb08b8 100644 --- a/src/client-scopes/add/MapperDialog.tsx +++ b/src/client-scopes/add/MapperDialog.tsx @@ -128,10 +128,10 @@ export const AddMapperDialog = (props: AddMapperDialogProps) => { - <>{mapper.name} + {mapper.name} , - <>{mapper.helpText} + {mapper.helpText} , ]} /> diff --git a/src/client-scopes/details/MapperList.tsx b/src/client-scopes/details/MapperList.tsx index e7141ee709..66715979b6 100644 --- a/src/client-scopes/details/MapperList.tsx +++ b/src/client-scopes/details/MapperList.tsx @@ -99,11 +99,9 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => { ); const MapperLink = ({ id, name }: Row) => ( - <> - - {name} - - + + {name} + ); return ( diff --git a/src/client-scopes/details/MappingDetails.tsx b/src/client-scopes/details/MappingDetails.tsx index eeebda7958..8cd2b010bd 100644 --- a/src/client-scopes/details/MappingDetails.tsx +++ b/src/client-scopes/details/MappingDetails.tsx @@ -164,40 +164,36 @@ export const MappingDetails = () => { onSubmit={handleSubmit(save)} role="manage-clients" > - <> - {!mapperId.match(isGuid) && ( - - } - fieldId="name" - isRequired + {!mapperId.match(isGuid) && ( + + } + fieldId="name" + isRequired + validated={ + errors.name ? ValidatedOptions.error : ValidatedOptions.default + } + helperTextInvalid={t("common:required")} + > + - - - )} - + /> + + )} { ); return ( - <> - -
- - - - - - } - > - +
+ + + + + - - - } - > - - - - } - > - - - - } - > - - - - } - > - - - - - - } - fieldId="loginTheme" - > - ( - - )} - /> - - - ( - - )} - /> - - - ( - onChange("" + value)} - isDisabled={!consentRequired} - /> - )} - /> - - -