{"record":{"id":"8a91bd6dd2239ae1","repo":"oxc-project/oxc","slug":"use-namespace-instead-of-module-to-declare-cus","errorCode":null,"errorMessage":"Use `namespace` instead of `module` to declare custom TypeScript modules.","messagePattern":"Use `namespace` instead of `module` to declare custom TypeScript modules\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/typescript/prefer_namespace_keyword.rs","lineNumber":13,"sourceCode":"use oxc_ast::{AstKind, ast::TSNamespaceDeclarationKind};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    rule::Rule,\n};\n\nfn prefer_namespace_keyword_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Use `namespace` instead of `module` to declare custom TypeScript modules.\")\n        .with_help(\"Replace `module` with `namespace` for internal declarations.\")\n        .with_note(\n            \"`module` for internal declarations is no longer supported: treat it as a hard \\\n             error. Expect it to become a parse error in a future version of TypeScript and Oxlint. See: \\\n             https://github.com/microsoft/TypeScript/issues/54500, \\\n             https://github.com/microsoft/TypeScript/issues/62211, \\\n             https://github.com/microsoft/TypeScript/pull/62876.\",\n        )\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct PreferNamespaceKeyword;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule reports when the module keyword is used instead of namespace.","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/typescript/prefer_namespace_keyword.rs#L1-L31","documentation":"Raised by typescript/prefer-namespace-keyword when a custom TypeScript module is declared with the `module` keyword (module Foo {}). Since ES modules took the `module` meaning, internal declarations must use `namespace`.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/typescript/prefer_namespace_keyword.rs:13 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace `module` with `namespace` in the declaration."],"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"}