deno.com

Fresh 处理器导出

注意:此规则是 fresh 规则集的一部分。
deno.json 中启用完整集合
{
  "lint": {
    "rules": {
      "tags": ["fresh"]
    }
  }
}
使用 Deno CLI 启用完整集合
deno lint --rules-tags=fresh
此规则可以通过将其添加到 deno.json 中的 includeexclude 数组中,显式地包含或排除在当前标签中存在的规则之外。
{
  "lint": {
    "rules": {
      "include": ["fresh-handler-export"],
      "exclude": ["fresh-handler-export"]
    }
  }
}

检查命名的 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() {}

您找到所需内容了吗?

隐私政策