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: {
"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={[
{
title: t("common:export"),
onRowClick: () => {},
},
{
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()) {
setClient({ ...client, ...methods.getValues() });
setShowCapabilityConfig(true);
onNext();
onNext?.();
}
};
@ -71,7 +71,7 @@ export const NewClientForm = () => {
if (newStep.id === "generalSettings") {
back();
} else {
forward(() => {});
forward();
}
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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