rxjs-tslint vs rxjs-tslint-rules packages
Asked Answered
M

1

12

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?

Maratha answered 14/5, 2018 at 15:56 Comment(0)
M
12

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.

Monzon answered 14/5, 2018 at 23:34 Comment(1)
Thank you for the detailed answer and insider information especially! It seems that rxjs-tslint would become an official TSLint rule set some time in the future and rxjs-tslint-rules would extend its rules set.Maratha

© 2022 - 2024 — McMap. All rights reserved.