Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. It was added to devDependencies section of my projects' package.json files.

Now, there is rxjs-tslint package which adds a few more rules specific to RxJS 6 and rxjs-5-to-6-migrate tool.

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? 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?

like image 409
Alexander Abakumov Avatar asked May 14 '18 15:05

Alexander Abakumov


1 Answers

At the moment, rxjs-tslint is intended to be used as one-time migration mechanism to upgrade a RxJS v5 codebase to v6. Its distribution installs some scripts into node_modules/.bin to facilitate this.

However, there is nothing to stop you from installing rxjs-tslint as a devDependency. If you do, you would also reference it from your tslint.json file, just as you would with 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. 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.

I'm the author of rxjs-tslint-rules and I've had some conversations with the developers of the rxjs-tslint package. 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. Until then - and perhaps afterwards - you can use rules from both packages.

like image 126
cartant Avatar answered Nov 02 '22 04:11

cartant