no-import-assertions
NOTE: this rule is part of the
recommended rule set.Enable full set in
deno.json:{
"lint": {
"rules": {
"tags": ["recommended"]
}
}
}Enable full set using the Deno CLI:
deno lint --rules-tags=recommended
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-assertions"],
"exclude": ["no-import-assertions"]
}
}
}Disallows the assert keyword for import attributes.
ES import attributes (previously called import assertions) has been changed to
use the with keyword. The old syntax using assert is still supported, but
deprecated.
Invalid:
import obj from "./obj.json" assert { type: "json" };
import("./obj2.json", { assert: { type: "json" } });
Valid:
import obj from "./obj.json" with { type: "json" };
import("./obj2.json", { with: { type: "json" } });