{"record":{"id":"d09eadd836bf4f10","repo":"oxc-project/oxc","slug":"do-not-use-a-triple-slash-reference-for-ref-kind","errorCode":null,"errorMessage":"Do not use a triple slash reference for {ref_kind}, use `import` style instead.","messagePattern":"Do not use a triple slash reference for (.+?), use `import` style instead\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/typescript/triple_slash_reference.rs","lineNumber":16,"sourceCode":"use oxc_ast::ast::{Statement, TSModuleReference};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse rustc_hash::FxHashMap;\nuse schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    context::{ContextHost, LintContext},\n    rule::{DefaultRuleConfig, Rule},\n    utils::AlwaysNever,\n};\n\nfn triple_slash_reference_diagnostic(ref_kind: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Do not use a triple slash reference for {ref_kind}, use `import` style instead.\"))\n        .with_help(\"Use of triple-slash reference type directives is generally discouraged in favor of ECMAScript Module imports.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct TripleSlashReference(Box<TripleSlashReferenceConfig>);\n\n#[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct TripleSlashReferenceConfig {\n    /// What to enforce for `/// <reference lib=\"...\" />` references.\n    lib: AlwaysNever,\n    /// What to enforce for `/// <reference path=\"...\" />` references.\n    path: PathOption,\n    /// What to enforce for `/// <reference types=\"...\" />` references.\n    types: TypesOption,\n}\n","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/typescript/triple_slash_reference.rs#L1-L34","documentation":"Raised by typescript/triple-slash-reference when a triple-slash directive (/// <reference .../>) is used for the given kind (types, path, or lib) instead of an ES import. Triple-slash references bypass module resolution tooling.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/typescript/triple_slash_reference.rs:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace the triple-slash reference with an import statement (import type / import).","Use tsconfig types/lib options instead of /// <reference>."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}