A TypeScript namespace groups code that modules could hold

tx0/ts:namespace-declarationstrictwarningstyle

What it finds

TypeScript namespaces predate ES modules, which now group code by file with imports and exports that every tool understands. A namespace in a module adds a second, older way of grouping, compiles to an object built at run time and is not supported by compilers that only strip types.

Reported are namespace and module declarations with a body, except ambient ones marked declare, declare global and modules named by a string, which describe code elsewhere, and namespaces nested in such declarations.

From the rule's source, namespace_declaration.rs.

Example from the rule's tests
export namespace Geometry {tx0 reports: this namespace groups code  export const unit = 1;  export namespace Inner {    export const two = 2;  }}declare namespace Ambient {  const x: number;}declare global {  interface Window {    flag: boolean;  }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:namespace-declaration" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:namespace-declaration] reason="..."

tx0 explain tx0/ts:namespace-declaration shows the same in the terminal. Found a false positive? Report it.