fresh-handler-export
NOTE: this rule is part of the
fresh
rule set.Enable full set in
deno.json
:{ "lint": { "tags": ["fresh"] } }
Enable full set using the Deno CLI:
deno lint --tags=fresh
Checks correct naming for named fresh middleware export.
Files inside the routes/
folder can export middlewares that run before any
rendering happens. They are expected to be available as a named export called
handler
. This rule checks for when the export was incorrectly named handlers
instead of handler
.
Invalid:
export const handlers = {
GET() {},
POST() {},
};
export function handlers() {}
export async function handlers() {}
Valid:
export const handler = {
GET() {},
POST() {},
};
export function handler() {}
export async function handler() {}