deno.com

fresh-handler-export

注意: 此规则是 fresh 规则集的一部分。
deno.json 中启用完整规则集:
{
  "lint": {
    "rules": {
      "tags": ["fresh"]
    }
  }
}
使用 Deno CLI 启用完整规则集:
deno lint --rules-tags=fresh

检查命名正确的 fresh middleware 导出。

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() {}

你找到需要的内容了吗?

隐私政策