typescript/triple-slash-reference Correctness
What it does
Disallow certain triple slash directives in favor of ES6-style import declarations.
Why is this bad?
Use of triple-slash reference type directives is generally discouraged in favor of ECMAScript Module imports.
Examples
Examples of incorrect code for this rule:
ts
/// <reference lib="code" />
globalThis.value;Configuration
This rule accepts a configuration object with the following properties:
lib
type: "always" | "never"
default: "always"
What to enforce for /// <reference lib="..." /> references.
path
type: "always" | "never"
default: "never"
What to enforce for /// <reference path="..." /> references.
types
type: "always" | "never" | "prefer-import"
default: "prefer-import"
What to enforce for /// <reference types="..." /> references.
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny typescript/triple-slash-referencejson
{
"rules": {
"typescript/triple-slash-reference": "error"
}
}