Rules

no-raw-hono-create-middleware

Keep Hono middleware creation behind an Effect-aware wrapper.

Purpose and behavior

Keep Hono middleware creation behind an Effect-aware wrapper.

Tracks createMiddleware imported directly or with an alias from hono/factory, and namespace-member calls from that module. Use an application-owned wrapper to centralize runtime execution, dependencies and error handling. No wrapper package is supplied by this plugin.

Options

No configurable options. Enable with "rules/no-raw-hono-create-middleware": "error".

Invalid example

import { createMiddleware } from 'hono/factory'
const middleware = createMiddleware((c, next) => next())

Valid example

import { createEffectMiddleware } from './middleware.ts'
const middleware = createEffectMiddleware(handler)

Fixes and exceptions

This rule reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.

For a genuine boundary exception, use an oxlint-disable-next-line rules/no-raw-hono-create-middleware -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.

Source and tests

Enabled by the Effect preset.

no-raw-hono-create-middleware.ts · Tests