Expected 'undefined' and instead saw 'void'
29 return (
30 <form
31 onSubmit={form.onSubmit((v) => {
32 void innerProps.onSuccess({33 ...innerProps.category,34 name: v.name,35 });36 actions.closeModal();
37 })}
38 >
Expected 'undefined' and instead saw 'void'
52 <Stack gap="xl">
53 <form
54 onSubmit={form.onSubmit(
55 (v) => void handleSubmit(v),56 (err) => console.log(err),
57 )}
58 >
Expected 'undefined' and instead saw 'void'
54
55 return (
56 <Stack gap="xl">
57 <form onSubmit={form.onSubmit((v) => void handleSubmit(v))}>58 <Stack gap="lg">
59 <TextInput
60 label={t("field.username.label")}
Expected 'undefined' and instead saw 'void'
44 throw response?.error;
45 }
46
47 void router.push("/");48 })
49 .catch((error: Error | string) => {
50 setIsLoading(false);
Expected 'undefined' and instead saw 'void'
83 };
84
85 return (
86 <form onSubmit={form.onSubmit((value) => void handleSubmit(value))}> 87 <Stack>
88 <TestConnectionNoticeAlert />
89
Expected 'undefined' and instead saw 'void'
68 title: t("integration.page.create.notification.success.title"),
69 message: t("integration.page.create.notification.success.message"),
70 });
71 void revalidatePathAction("/integrations").then(() => 72 router.push("/integrations"), 73 ); 74 },
75 onError: () => {
76 showErrorNotification({
Expected 'undefined' and instead saw 'void'
93 };
94
95 return (
96 <form onSubmit={form.onSubmit((v) => void handleSubmit(v))}> 97 <Stack>
98 <TestConnectionNoticeAlert />
99
Expected 'undefined' and instead saw 'void'
78 title: t("integration.page.edit.notification.success.title"),
79 message: t("integration.page.edit.notification.success.message"),
80 });
81 void revalidatePathAction("/integrations").then(() => 82 router.push("/integrations"), 83 ); 84 },
85 onError: () => {
86 showErrorNotification({
Expected 'undefined' and instead saw 'void'
47 if (count === 1) {
48 router.replace("/integrations");
49 }
50 void revalidatePathAction("/integrations");51 },
52 onError: () => {
53 showErrorNotification({
Expected 'undefined' and instead saw 'void'
36 title: t("title"),
37 children: t("message", integration),
38 onConfirm: () => {
39 void mutateAsync(40 { id: integration.id },41 {42 onSuccess: () => {43 showSuccessNotification({44 title: t("notification.success.title"),45 message: t("notification.success.message"),46 });47 if (count === 1) {48 router.replace("/integrations");49 }50 void revalidatePathAction("/integrations");51 },52 onError: () => {53 showErrorNotification({54 title: t("notification.error.title"),55 message: t("notification.error.message"),56 });57 },58 },59 );60 },
61 });
62 }}
Description
A return;
statement with nothing after it is redundant, and has no effect on the runtime behavior of a function.
This can be confusing, so it's better to disallow these redundant statements.
Bad Practice
function foo() { return; }
function foo() {
doSomething();
return;
}
function foo() {
if (condition) {
bar();
return;
} else {
baz();
}
}
function foo() {
switch (bar) {
case 1:
doSomething();
default:
doSomethingElse();
return;
}
}
Recommended
function foo() { return 5; }
function foo() {
return doSomething();
}
function foo() {
if (condition) {
bar();
return;
} else {
baz();
}
qux();
}
function foo() {
switch (bar) {
case 1:
doSomething();
return;
default:
doSomethingElse();
}
}
function foo() {
for (const foo of bar) {
return;
}
}