Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter: oxc(no-async-endpoint-handlers) reports Fastify endpoints #9802

Open
mootoday opened this issue Mar 16, 2025 · 1 comment
Open

linter: oxc(no-async-endpoint-handlers) reports Fastify endpoints #9802

mootoday opened this issue Mar 16, 2025 · 1 comment
Labels
A-linter Area - Linter

Comments

@mootoday
Copy link

What version of Oxlint are you using?

0.16.0

What command did you run?

pnpm dlx oxlint@latest -D suspicious .

What does your .oxlintrc.json config file look like?

None

What happened?

Fastify (https://fastify.dev/) async endpoints are considered Express async endpoints.

This is what a Fastify server looks like:

import Fastify from 'fastify'

const fastify = Fastify({
  logger: true
})

fastify.get('/', async (request, reply) => {
  return { hello: 'world' }
})

const start = async () => {
  try {
    await fastify.listen({ port: 3000 })
  } catch (err) {
    fastify.log.error(err)
    process.exit(1)
  }
}
start()

Not a blocking issue as I can disable the oxc(no-async-endpoint-handlers) rule.

@mootoday mootoday added the A-linter Area - Linter label Mar 16, 2025
@nrayburn-tech
Copy link
Collaborator

nrayburn-tech commented Mar 16, 2025

Looking at the code for the rule, it seems pretty specific to Express < version 5. Other frameworks like Fastify, Koa, etc. may not have the same limitations.

Probably the best resolution for this is to rename the rule to be Express specific. Users would still need to enable/disable it based on which version of Express they are using. However, it would avoid flagging for other frameworks like Express that do support async handlers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter
Projects
None yet
Development

No branches or pull requests

2 participants