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

Ensure that all dependencies are declared in either deno.json or package.json.

This promotes better dependency management and makes it easier to track and update dependencies. It also helps Deno purge the lockfile when removing a dependency.

Invalid: 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";

Valid: Jump to heading

import foo from "@std/path";

With a corresponding entry in the deno.json or package.json file:

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

Did you find what you needed?

Privacy policy