triple-slash-reference
What it does
Section titled “What it does”Reports a /// <reference path="x" /> or /// <reference types="x" /> before the first statement of the file; for types only when the file also imports that module. A directive after the first statement is not reported.
Why it matters
Section titled “Why it matters”Triple-slash references are the older way to include files and types before modules. An import states the dependency where it is used, is followed by bundlers and other tools, and does not depend on the order of directives.
To fix, replace the reference with an import (an import type where only types are needed).
Example
Section titled “Example”/// <reference path="a.d.ts" />/// <reference types="b" />/// <reference types="c" />/// <reference lib="es2020" />import "b";Configuration
Section titled “Configuration”js: lint: rules: triple-slash-reference: warn # off (default), warn, errorEnabled by the presets: js/typescript-eslint-recommended, js/oxlint.
Suppress one line with sudsy-disable-next-line triple-slash-reference in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| typescript-eslint | triple-slash-reference |
partial | the options (lib, path, types) keep their defaults |