contracts/scripts/utils/env.ts
'namespace' and 'module' are disallowed Open
Open
namespace env {
export const require = (key: string): string => {
const value = process.env[key];
if (value === undefined) {
throw new Error(`Environment variable ${key} is undefined`);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-namespace
Disallows use of internal module
s and namespace
s.
This rule still allows the use of declare module ... {}
Rationale
ES6-style external modules are the standard way to modularize code.
Using module {}
and namespace {}
are outdated ways to organize TypeScript code.
Notes
- TypeScript Only
Config
One argument may be optionally provided:
-
allow-declarations
allowsdeclare namespace ... {}
to describe external APIs.
Examples
"no-namespace": true
"no-namespace": true,allow-declarations
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"allow-declarations"
]
},
"minLength": 0,
"maxLength": 1
}
For more information see this page.