A /// <reference path> comment includes another file instead of an import

tx0/ts:triple-slash-referencestrictwarningstyle

What it finds

/// <reference path="./other.ts" /> pulls another file into the compilation behind the back of the module system. An import says the same in a way that bundlers, editors and readers follow.

Reported are /// <reference path=...> comments outside declaration files. References to types and libraries, types= and lib=, and everything in .d.ts files, where references are the way to declare dependencies, are left alone.

From the rule's source, triple_slash_reference.rs.

Example from the rule's tests
/// <reference path="./globals.ts" />tx0 reports: this reference includes a file/// <reference types="node" />export const x = 1;
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:triple-slash-reference" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:triple-slash-reference] reason="..."

tx0 explain tx0/ts:triple-slash-reference shows the same in the terminal. Found a false positive? Report it.