【问题标题】:Why is tslint:recommended not allowing modules?为什么 tslint:recommended 不允许模块?
【发布时间】:2017-10-27 09:23:04
【问题描述】:

我们正在使用带有 VS Code 的 typescript v2.3.2 和 TSLint v4.5.1 来创建 SPA。代码库正在增长,我们需要以某种方式对其进行模块化。

我尝试使用 typescript 模块进行模块化,但在编译应用程序时发现以下 lint 错误。

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

我正在为 linter 使用这个配置:

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

第 89 行的The recommended rules file 显示了此规则:

"no-namespace": true,

我想知道是否有什么问题,以及遵循不会很快过时的良好做法来模块化 SPA 的最佳方法是什么。

欢迎提供代码示例。非常感谢。

【问题讨论】:

标签: typescript module tslint


【解决方案1】:

[tslint] 'namespace' 和 'module' 是不允许的(无命名空间)

因为不是标准的 JavaScript 语法

更多

【讨论】:

猜你喜欢
  • 2012-08-31
  • 1970-01-01
  • 2011-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多