简体   繁体   English

rxjs-tslint 与 rxjs-tslint-rules 包

[英]rxjs-tslint vs rxjs-tslint-rules packages

I used to use rxjs-tslint-rules package to be aware of RxJS-related issues in my projects.我曾经使用rxjs-tslint-rules包来了解我的项目中与 RxJS 相关的问题。 It was added to devDependencies section of my projects' package.json files.它被添加到我项目的package.json文件的devDependencies部分。

Now, there is rxjs-tslint package which adds a few more rules specific to RxJS 6 and rxjs-5-to-6-migrate tool.现在,有rxjs-tslint包,它添加了一些特定于 RxJS 6 和rxjs-5-to-6-migrate工具的规则。

After migration, if I still want those迁移后,如果我还想要那些

  • rxjs-collapse-imports
  • rxjs-pipeable-operators-only
  • rxjs-no-static-observable-methods
  • rxjs-proper-imports

rules to be checked by TSLint, do I need to add them to my tslint.json and rxjs-tslint package to my devDependencies ? TSLint 要检查的规则,我是否需要将它们添加到我的tslint.jsonrxjs-tslint包到我的devDependencies Or rxjs-tslint package is intended to be a one time migration assistant and rules it currently provides are covered by the bigger rxjs-tslint-rules package?或者rxjs-tslint包旨在成为一次性迁移助手,它当前提供的规则被更大的rxjs-tslint-rules包覆盖?

At the moment, rxjs-tslint is intended to be used as one-time migration mechanism to upgrade a RxJS v5 codebase to v6.目前, rxjs-tslint旨在用作一次性迁移机制,将 RxJS v5 代码库升级到 v6。 Its distribution installs some scripts into node_modules/.bin to facilitate this.它的发行版将一些脚本安装到node_modules/.bin以促进这一点。

However, there is nothing to stop you from installing rxjs-tslint as a devDependency .但是,没有什么可以阻止您将rxjs-tslint安装为devDependency If you do, you would also reference it from your tslint.json file, just as you would with rxjs-tslint-rules .如果这样做,您也可以从tslint.json文件中引用它,就像使用rxjs-tslint-rules Like this:像这样:

{
  "extends": [
    "rxjs-tslint",
    "rxjs-tslint-rules"
  ],
  "rules": {
  }
}

Like rxjs-tslint-rules , rxjs-tslint is unopinionated and no rules are enabled by default.rxjs-tslint-rulesrxjs-tslint没有意见的,默认情况下没有启用任何规则。 So if you want the rules listed in your question to be enabled, you will need to configure them in the file's rules setting.因此,如果您希望启用问题中列出的规则,则需要在文件的rules设置中配置它们。

I'm the author of rxjs-tslint-rules and I've had some conversations with the developers of the rxjs-tslint package.我是rxjs-tslint-rules的作者,我与rxjs-tslint包的开发人员进行了一些对话。 It's likely that, sometime soon, some of the rules from my package will be included in rxjs-tslint - to represent what's considered to be best practice.很可能很快,我包中的一些规则将包含在rxjs-tslint - 代表什么被认为是最佳实践。 Until then - and perhaps afterwards - you can use rules from both packages.在那之前 - 也许之后 - 您可以使用来自两个包的规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM