@rdlabo/eslint-plugin-rules

0.4.0 • Public • Published

@rdlabo/eslint-plugin-rules

This is a public version of the eslint rules I use in the app I created with Ionic Angular.

Installation

npm install @rdlabo/eslint-plugin-rules --save-dev

If your project does not install @angular-eslint packages, please do so: https://github.com/angular-eslint/angular-eslint

Configuration (legacy: .eslintrc*)

Recommend settings is here:

  {
    ...
+   "plugins": ["@rdlabo/rules"],
    "overrides": [
      {
        "files": [
          "*.ts"
        ],
      ...
        "rules": {
+         "@rdlabo/rules/deny-constructor-di": "error",
+         "@rdlabo/rules/import-inject-object": "error",
+         "@rdlabo/rules/deny-import-from-ionic-module": "error",
+         "@rdlabo/rules/implements-ionic-lifecycle": "error",
+         "@rdlabo/rules/deny-soft-private-modifier": "error",
        }
      },
      {
        "files": [
          "*.html"
        ],
        "rules": {
+         "@rdlabo/rules/deny-element": [
+           "error",
+           {
+             "elements": [
+               "ion-modal",
+               "ion-popover",
+               "ion-toast",
+               "ion-alert",
+               "ion-loading",
+               "ion-picker",
+               "ion-action-sheet"
+             ]
+           }
+         ]
          ]
        }
      }
    ]
  }

List of supported rules

rule description auto fix
@rdlabo/rules/deny-constructor-di This plugin disallows Dependency Injection within the constructor.
@rdlabo/rules/import-inject-object This plugin automatically imports when inject is used but not imported.
@rdlabo/rules/deny-element This plugin disallows the use of certain HTML tags.
@rdlabo/rules/deny-import-from-ionic-module This plugin disallows import from @ionic/angular
@rdlabo/rules/implements-ionic-lifecycle This plugin checks the implementation of the Ionic lifecycle.
@rdlabo/rules/deny-soft-private-modifier This plugin disallows the use of soft private modifier.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.4.0
    221
    • latest

Version History

Package Sidebar

Install

npm i @rdlabo/eslint-plugin-rules

Weekly Downloads

474

Version

0.4.0

License

MIT

Unpacked Size

25.8 kB

Total Files

11

Last publish

Collaborators

  • rdlabo