typescript/prefer-namespace-keyword Correctness
What it does
This rule reports when the module keyword is used instead of namespace. This rule does not report on the use of TypeScript module declarations to describe external APIs (declare module 'foo' {}).
WARNING
This rule is deprecated and will be removed in a future release.
In a future version of TypeScript and Oxlint, this will be a hard error produced by the parser.
See: https://github.com/microsoft/TypeScript/issues/54500, https://github.com/microsoft/TypeScript/issues/62211 and https://github.com/microsoft/TypeScript/pull/62876.
Why is this bad?
Namespaces are an outdated way to organize TypeScript code. ES2015 module syntax is now preferred (import/export). For projects still using custom modules / namespaces, it's preferred to refer to them as namespaces.
Examples
Examples of incorrect code for this rule:
module Example {}Examples of correct code for this rule:
namespace Example {}How to use
To enable this rule using the config file or in the CLI, you can use:
{
"rules": {
"typescript/prefer-namespace-keyword": "error"
}
}oxlint --deny typescript/prefer-namespace-keyword