Giter Club home page Giter Club logo

rxjs-tslint's Introduction

RxJS TSLint

TSLint rules for rxjs.

Rules

This repository provides the following rules:

Rule name Configuration Description
rxjs-collapse-imports none Collapses multiple imports from rxjs to a single one
rxjs-pipeable-operators-only none Migrates side-effect operators to pipeables
rxjs-no-static-observable-methods none Migrates static Observable method calls
rxjs-proper-imports none Updates RxJS 5.x.x imports to RxJS 6.0

Migration to RxJS 6

Using the current set of rules allows you to automatically migrate your project which uses RxJS 5 to RxJS 6. Here's how you can perform the automatic migration:

npm i -g rxjs-tslint
rxjs-5-to-6-migrate -p [PATH_TO_TSCONFIG]

For an Angular CLI project the invocation of rxjs-5-to-6-migrate will be:

rxjs-5-to-6-migrate -p src/tsconfig.app.json

Use rules

To use the exported rules without rxjs-5-to-6-migrate, use the rulesDirectory configuration property of tslint.json:

{
  "rulesDirectory": [
    "node_modules/rxjs-tslint"
  ],
  "rules": {
    "rxjs-collapse-imports": true,
    "rxjs-pipeable-operators-only": true,
    "rxjs-no-static-observable-methods": true,
    "rxjs-proper-imports": true
  }
}

To lint your project use:

./node_modules/.bin/tslint -c tslint.json -p tsconfig.json

Notes

  • Once you run all the migrations check the diff and make sure that everything looks as expected. These fixers cover almost all cases we know of, but it's possible that some manual fixes can be required.
  • Although the migration will format your source code, it's likely that that the style is not consistent with the rest of your project. To make sure that everything is properly following your project's style guide, we recommend you apply a formatter such as prettier or clang-format after the edits are made.

License

MIT

rxjs-tslint's People

Contributors

mgechev avatar benlesh avatar alexeagle avatar bowenni avatar cedricss avatar jamesjansson avatar nagrock avatar shairez avatar timdeschryver avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.