Skip to content

Commit db08634

Browse files
author
Sirius
committed
refactor(core): remove no-confusing-void-expression suppressions in defineMiddleware
Remove 3 eslint-disable comments for @typescript-eslint/no-confusing-void-expression in defineMiddleware.ts. The next() function returns Promise<void>, so capturing or returning the void result was unnecessary. Now we simply await next() without capturing the result. Kaizen: daily tech debt reduction
1 parent 45ec721 commit db08634

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

packages/core/src/middleware/defineMiddleware.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,13 @@ export function defineMiddleware(definition: MiddlewareDefinition): Middleware {
191191
await before(context);
192192
}
193193

194-
// Call next and capture result (guaranteed!)
195-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
196-
const result = await next();
194+
// Call next (guaranteed!)
195+
await next();
197196

198197
// Run after hook
199198
if (after) {
200199
await after(context);
201200
}
202-
203-
// Pass through result for MiddlewareChain compatibility
204-
return result;
205201
}) as Middleware;
206202
}
207203

@@ -220,8 +216,7 @@ export function defineMiddleware(definition: MiddlewareDefinition): Middleware {
220216
defineMiddleware.before = (hook: BeforeHook): Middleware => {
221217
return (async (context, next) => {
222218
await hook(context);
223-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
224-
return await next();
219+
await next();
225220
}) as Middleware;
226221
};
227222

@@ -239,10 +234,8 @@ defineMiddleware.before = (hook: BeforeHook): Middleware => {
239234
*/
240235
defineMiddleware.after = (hook: AfterHook): Middleware => {
241236
return (async (context, next) => {
242-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
243-
const result = await next();
237+
await next();
244238
await hook(context);
245-
return result;
246239
}) as Middleware;
247240
};
248241

0 commit comments

Comments
 (0)