prefer-namespace-keyword
NOTE: this rule is part of the
recommended rule set.Enable full set in
deno.json:{
"lint": {
"rules": {
"tags": ["recommended"]
}
}
}Enable full set using the Deno CLI:
deno lint --rules-tags=recommended
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the
include or exclude array in deno.json:{
"lint": {
"rules": {
"include": ["prefer-namespace-keyword"],
"exclude": ["prefer-namespace-keyword"]
}
}
}Recommends the use of namespace keyword over module keyword when declaring
TypeScript module.
TypeScript supports the module keyword for organizing code, but this wording
can lead to a confusion with the ECMAScript's module. Since TypeScript v1.5, it
has provided us with the alternative keyword namespace, encouraging us to
always use namespace instead whenever we write TypeScript these days. See
TypeScript v1.5 release note
for more details.
Invalid:
module modA {}
declare module modB {}
Valid:
namespace modA {}
// "ambient modules" are allowed
// https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules
declare module "modB";
declare module "modC" {}