fresh-handler-export
注意: 此规则是
fresh
规则集的一部分。在
deno.json
中启用完整规则集{ "lint": { "tags": ["fresh"] } }
使用 Deno CLI 启用完整规则集
deno lint --tags=fresh
检查命名的 fresh 中间件导出是否命名正确。
routes/
文件夹中的文件可以导出在任何渲染发生之前运行的中间件。 它们应作为名为 handler
的命名导出提供。 此规则检查导出是否错误地命名为 handlers
而不是 handler
。
无效
export const handlers = {
GET() {},
POST() {},
};
export function handlers() {}
export async function handlers() {}
有效
export const handler = {
GET() {},
POST() {},
};
export function handler() {}
export async function handler() {}