no-sloppy-imports
NOTE: this rule is part of the
推荐 rule set.Enable full set in
deno.json:{
"lint": {
"rules": {
"tags": ["推荐"]
}
}
}Enable full set using the Deno CLI:
deno lint --rules-tags=推荐
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-sloppy-imports"],
"exclude": ["no-sloppy-imports"]
}
}
}强制在模块说明符中指定显式路径引用。
非显式说明符是模糊的,需要在每次运行时查找正确的文件路径,这会带来性能开销。
注意:此 lint 规则仅在使用 --unstable-sloppy-imports 时激活。
无效示例: Jump to heading
import { add } from "./math/add";
import { ConsoleLogger } from "./loggers";
有效示例: Jump to heading
import { add } from "./math/add.ts";
import { ConsoleLogger } from "./loggers/index.ts";