【问题标题】:Exclude node_modules from TSLint in Ionic 2 app从 Ionic 2 应用程序中的 TSLint 中排除 node_modules
【发布时间】:2017-07-24 19:03:25
【问题描述】:

我正在做一个 Ionic 2 项目,我在linter 上遇到了一些麻烦,我希望有人可以帮助甚至澄清。

我在项目中使用ng2-image-cropper,似乎没有通过linter:

问题是,每当我运行ionic_app_scripts serve 时,终端都会收到垃圾邮件,即使它明确指定它应该排除所有node_modules 时也会出现linting 错误。

tsconfig.json 看起来像这样:

...
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],

在运行ionic_app_scripts serve 时有什么方法可以禁用 TSLint 还是让tslint知道我不关心node_modules中的代码?

github 上已经存在问题,但似乎尚未解决,因此可能无法解决,但任何 hack 都会很好

【问题讨论】:

  • 我认为特定设置在 tsconfig.json 而不是 tslint.json..
  • @suraj 我的错,它在 tsconfig.json 中
  • 我的 Ionic lint 任务不会返回任何 linter 错误,无论我播种了多少。我必须设置自己的 lint 任务。它看起来类似于@iRaS 的答案。

标签: typescript ionic2 tslint


【解决方案1】:

就像 suraj 说的,把这个配置放到 tslint.json 中。

我不知道 ionic2 是什么,但你也可以从命令行排除文件:

tslint -c tslint.json --exclude="**/*.d.ts" --exclude="node_modules/**/*.ts" "**/*.ts"

【讨论】:

    猜你喜欢
    • 2023-04-03
    • 2020-03-20
    • 2017-12-29
    • 1970-01-01
    • 2018-08-16
    • 2018-07-31
    • 1970-01-01
    • 2017-01-16
    • 2016-12-22
    相关资源
    最近更新 更多