@rdlabo/eslint-plugin-rules

0.6.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

eslint@8

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

Configuration (legacy: .eslintrc*)

Recommend settings is here:

module.exports = tseslint.config(
      {
        "files": [
          "*.ts"
        ],

+       "plugins": {
+         '@rdlabo/rules': rdlabo,
+       },
        "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",
+         "@rdlabo/rules/signal-use-as-signal": "error",
        }
      },
      {
        "files": [
          "*.html"
        ],
+       "plugins": {
+         '@rdlabo/rules': rdlabo,
+       },
        "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.
@rdlabo/rules/signal-use-as-signal This plugin check to valid signal use as signal.

Recommend rules with this plugin

@typescript-eslint/explicit-member-accessibility

Control to allow / disallow placing explicit public, protected, and private accessibility modifiers in front of class members.

  "rules": {
+   "@typescript-eslint/explicit-member-accessibility": ["error", { "accessibility": "no-public" }],

Package Sidebar

Install

npm i @rdlabo/eslint-plugin-rules

Weekly Downloads

280

Version

0.6.0

License

MIT

Unpacked Size

29.5 kB

Total Files

12

Last publish

Collaborators

  • rdlabo