no-import-assertions
注意: 此规则是
recommended
规则集的一部分。在
deno.json
中启用完整规则集:{ "lint": { "rules": { "tags": ["recommended"] } } }
使用 Deno CLI 启用完整规则集:
deno lint --rules-tags=recommended
禁止在导入属性中使用 assert
关键字。
ES 导入属性(之前称为导入断言)已更改为使用 with
关键字。仍支持使用 assert
的旧语法,但已弃用。
无效:
import obj from "./obj.json" assert { type: "json" };
import("./obj2.json", { assert: { type: "json" } });
有效:
import obj from "./obj.json" with { type: "json" };
import("./obj2.json", { with: { type: "json" } });