eslint-plugin-ngx-eslint
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Custom ESLint rules for Angular projects

What's this?

This is a repository containing custom ESLint rules for Angular projects

Rules included

  • destroy-service-provider: When using DestroyService to automatically unsubscribe from an observable, this service MUST be provided in Component/Directive class providers in order for the Service to work properly. This rule ensures the DestroyService is always provided in the providers array of the Component or Directive.

Usage

Install the package

npm install --save-dev eslint-plugin-ngx-eslint

Config rule destroy-service-provider

Edit your .eslintrc config file as follow

{
  "plugins": ["ngx-eslint"],
  "rules": {
    "ngx-eslint/destroy-service-provider": "error"
  }
}

If your destroy service class name is different than DestroyService, the configuration would be like this

{
  "plugins": ["ngx-eslint"],
  "rules": {
    "ngx-eslint/destroy-service-provider": [
      "error",
      {
        "destroyServiceName": "MyDestroyService"
      }
    ]
  }
}

Result

ngx-eslint-destroy-service-provider rule

LICENSE

MIT

Dependencies (0)

    Dev Dependencies (13)

    Package Sidebar

    Install

    npm i eslint-plugin-ngx-eslint

    Weekly Downloads

    84

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    26.4 kB

    Total Files

    19

    Last publish

    Collaborators

    • hienpham