Diego Gago
Diego Gago

Reputation: 299

Why is tslint:recommended not allowing modules?

We are using typescript v2.3.2 and TSLint v4.5.1 with VS Code to create a SPA. Codebase is growing and we need to modularize it someway.

I tried to do the modularization using typescript modules but found the following lint error when transpiling the app.

[tslint] 'namespace' and 'module' are disallowed (no-namespace)

I'm using this configuration for the linter:

{
  "extends": "tslint:recommended",
  "rules": {
    "no-var-requires": false,
    "no-console": ["error", false],
    "max-line-length": [false]
  }
}

The recommended rules file at line 89 shows this rule:

"no-namespace": true,

I wonder if there is something wrong and what would be the best way to modularize a SPA, following good practices that are not obsolete soon.

Examples of code will be welcomed. Thank you very much.

Upvotes: 27

Views: 11582

Answers (1)

basarat
basarat

Reputation: 276085

[tslint] 'namespace' and 'module' are disallowed (no-namespace)

Because the are not standard JavaScript syntax.

More

Upvotes: 10

Related Questions