verbatim-module-syntax
NOTE: this rule is part of the
jsr
rule set.Enable full set in
deno.json
:{ "lint": { "tags": ["jsr"] } }
Enable full set using the Deno CLI:
deno lint --tags=jsr
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);