fresh-handler-export
NOTE: this rule is part of the
fresh rule set.Enable full set in
deno.json:{
"lint": {
"rules": {
"tags": ["fresh"]
}
}
}Enable full set using the Deno CLI:
deno lint --rules-tags=fresh
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the
include or exclude array in deno.json:{
"lint": {
"rules": {
"include": ["fresh-handler-export"],
"exclude": ["fresh-handler-export"]
}
}
}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() {}