verbatim-module-syntax
NOTE: this rule is part of the
jsr
rule set.Enable full set in
deno.json
:{ "lint": { "rules": { "tags": ["jsr"] } } }
Enable full set using the Deno CLI:
deno lint --rules-tags=jsr
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": ["verbatim-module-syntax"], "exclude": ["verbatim-module-syntax"] } } }
Enforces type imports to be declared as type imports.
This rule ensures that the code works when the verbatimModuleSyntax
TypeScript
compiler option is enabled. This is useful in libraries distributing TypeScript
code in order to work in more scenarios.
Invalid:
import { Person } from "./person.ts";
const person: Person = {
name: "David",
};
console.log(person);
import { output, Person } from "./person.ts";
const person: Person = {
name: "David",
};
output(person);
Valid:
import type { Person } from "./person.ts";
const person: Person = {
name: "David",
};
console.log(person);
import { output, type Person } from "./person.ts";
const person: Person = {
name: "David",
};
output(person);