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.

The rule reports named createMiddleware imports from hono/factory, including aliases and unused imports. It also reports namespace-member calls to that function. Use your own wrapper to centralize execution, dependencies and error handling. This plugin does not supply a wrapper.

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 provides no automatic fix. Rewrite the code to preserve its intended behavior.

For a boundary exception, use oxlint-disable-next-line rules/no-raw-hono-create-middleware -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the Effect preset.

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