Skip to main content

no-import-prefix

NOTE: this rule is part of the workspace rule set.
Enable full set in deno.json:
{
  "lint": {
    "rules": {
      "tags": ["workspace"]
    }
  }
}
Enable full set using the Deno CLI:
deno lint --rules-tags=workspace
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": ["no-import-prefix"],
      "exclude": ["no-import-prefix"]
    }
  }
}

确保所有依赖项都在 deno.jsonpackage.json 中声明。

这有助于更好地管理依赖项,并更容易跟踪和更新依赖项。当移除依赖项时,这也有助于 Deno 清理锁定文件。

无效示例: Jump to heading

import foo from "https://deno.land/std/path/mod.ts";
import foo from "jsr:@std/path@1";
import foo from "npm:preact@10";

有效示例: Jump to heading

import foo from "@std/path";

deno.jsonpackage.json 文件中有相应的条目:

deno.json
{
  "imports": {
    "@std/path": "jsr:@std/path@1"
  }
}

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

编辑此页面
隐私政策