ITADN

eslint no-misused-promise in notFoundHandler

#355Closedmindrunner 创建于 2024-01-03
buggood first issue
M
mindrunnercommented
### Prerequisites - [X] I have written a descriptive issue title - [X] I have searched existing issues to ensure the bug has not already been reported ### Fastify version 4.25.2 ### Plugin version 9.0.1 ### Node.js version 20.10.0 ### Operating system Linux ### Operating system version (i.e. 20.04, 11.3, 10) - ### Description I am rate limiting 404 errors as documented here: https://github.com/fastify/fastify-rate-limit#preventing-guessing-of-urls-through-404s `notFoundHandler` expects a `preValidationHookHandler`, but `fastify.rateLimit()` is a `preHandlerAsyncHookHandler` ### Steps to Reproduce Use ``` fastify.setNotFoundHandler({ preHandler: fastify.rateLimit() }, function (request, reply) { reply.code(404).send({ hello: 'world' }) }) ``` - Enable `no-misused-promise` eslint rule ### Expected Behavior No erorrs / warnings thrown
关闭于 2024-01-09 16 条评论