Enable 'no-empty-function' ESlint rule (#917)

This commit is contained in:
Jon Koops 2021-07-27 22:56:16 +02:00 committed by GitHub
parent 209a562774
commit 12d2471c3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 21 deletions

View file

@ -18,6 +18,16 @@ module.exports = {
}, },
rules: { rules: {
"no-unused-vars": "off", "no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"], "@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-empty-function": "error",
}, },
overrides: [
{
files: ["*.test.*"],
rules: {
// For tests it can make sense to pass empty functions as mocks.
"@typescript-eslint/no-empty-function": "off",
},
},
],
}; };

View file

@ -221,7 +221,6 @@ export const ClientScopesSection = () => {
actions={[ actions={[
{ {
title: t("common:export"), title: t("common:export"),
onRowClick: () => {},
}, },
{ {
title: t("common:delete"), title: t("common:delete"),

View file

@ -54,11 +54,11 @@ export const NewClientForm = () => {
} }
}; };
const forward = async (onNext: () => void) => { const forward = async (onNext?: () => void) => {
if (await methods.trigger()) { if (await methods.trigger()) {
setClient({ ...client, ...methods.getValues() }); setClient({ ...client, ...methods.getValues() });
setShowCapabilityConfig(true); setShowCapabilityConfig(true);
onNext(); onNext?.();
} }
}; };
@ -71,7 +71,7 @@ export const NewClientForm = () => {
if (newStep.id === "generalSettings") { if (newStep.id === "generalSettings") {
back(); back();
} else { } else {
forward(() => {}); forward();
} }
}; };

View file

@ -279,7 +279,6 @@ export const ClientScopes = ({ clientId, protocol }: ClientScopesProps) => {
</ToolbarItem> </ToolbarItem>
<ToolbarItem> <ToolbarItem>
<Dropdown <Dropdown
onSelect={() => {}}
toggle={ toggle={
<KebabToggle onToggle={() => setKebabOpen(!kebabOpen)} /> <KebabToggle onToggle={() => setKebabOpen(!kebabOpen)} />
} }

View file

@ -24,13 +24,13 @@ const truncatePath = (path?: string) => {
export const GroupPath = ({ export const GroupPath = ({
group: { path }, group: { path },
onMouseEnter: onMouseEnterProp = () => {}, onMouseEnter: onMouseEnterProp,
...props ...props
}: GroupPathProps) => { }: GroupPathProps) => {
const [tooltip, setTooltip] = React.useState(""); const [tooltip, setTooltip] = React.useState("");
const onMouseEnter = (event: any) => { const onMouseEnter = (event: any) => {
setTooltip(path!); setTooltip(path!);
onMouseEnterProp(event); onMouseEnterProp?.(event);
}; };
const text = ( const text = (
<span onMouseEnter={onMouseEnter} {...props}> <span onMouseEnter={onMouseEnter} {...props}>

View file

@ -196,7 +196,6 @@ export const IdentityProvidersSection = () => {
<ToolbarItem> <ToolbarItem>
<Dropdown <Dropdown
data-testid="addProviderDropdown" data-testid="addProviderDropdown"
onSelect={() => {}}
toggle={ toggle={
<DropdownToggle <DropdownToggle
onToggle={() => setAddProviderOpen(!addProviderOpen)} onToggle={() => setAddProviderOpen(!addProviderOpen)}

View file

@ -117,7 +117,7 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
messageKey: publicKey, messageKey: publicKey,
continueButtonLabel: "common:close", continueButtonLabel: "common:close",
continueButtonVariant: ButtonVariant.primary, continueButtonVariant: ButtonVariant.primary,
onConfirm: async () => {}, onConfirm: () => Promise.resolve(),
}); });
const [toggleCertificateDialog, CertificateDialog] = useConfirmDialog({ const [toggleCertificateDialog, CertificateDialog] = useConfirmDialog({
@ -125,7 +125,7 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
messageKey: certificate, messageKey: certificate,
continueButtonLabel: "common:close", continueButtonLabel: "common:close",
continueButtonVariant: ButtonVariant.primary, continueButtonVariant: ButtonVariant.primary,
onConfirm: async () => {}, onConfirm: () => Promise.resolve(),
}); });
const goToCreate = () => history.push(`${url}/add-role`); const goToCreate = () => history.push(`${url}/add-role`);

View file

@ -144,11 +144,8 @@ export const UserFederationLdapWizard = () => {
else if (activeStep.id === "ldapAdvancedSettingsStep") { else if (activeStep.id === "ldapAdvancedSettingsStep") {
return ( return (
<> <>
<Button {/* TODO: close the wizard and finish */}
onClick={() => {}} //TODO: close the wizard and finish <Button>{t("common:finish")}</Button>
>
{t("common:finish")}
</Button>
<Button variant="secondary" onClick={onBack}> <Button variant="secondary" onClick={onBack}>
{t("common:back")} {t("common:back")}
</Button> </Button>
@ -165,10 +162,8 @@ export const UserFederationLdapWizard = () => {
<Button variant="secondary" onClick={onBack}> <Button variant="secondary" onClick={onBack}>
Back Back
</Button> </Button>
<Button {/* TODO: validate last step and finish */}
variant="link" <Button variant="link">
onClick={() => {}} //TODO: validate last step and finish
>
{t("common:skipCustomizationAndFinish")} {t("common:skipCustomizationAndFinish")}
</Button> </Button>
<Button variant="link" onClick={onClose}> <Button variant="link" onClick={onClose}>

View file

@ -144,7 +144,6 @@ export const UserConsents = () => {
icon={CubesIcon} icon={CubesIcon}
message={t("users:noConsents")} message={t("users:noConsents")}
instructions={t("users:noConsentsText")} instructions={t("users:noConsentsText")}
onPrimaryAction={() => {}}
/> />
} }
/> />