简中文档

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"]
    }
  }
}

检查命名是否正确,适用于命名的 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() {}

你找到了你需要的东西吗?

编辑此页面
隐私政策