@rdlabo/eslint-plugin-rules
v0.6.0
Published
This is a public version of the eslint rules I use in the app I created with Ionic Angular.
Downloads
1,660
Maintainers
Readme
@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/[email protected] --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" }],