Skip to content
rdlabo.dev

deny-element

This plugin disallows the use of certain HTML tags.

  • ⭐️ This rule is included in plugin:@rdlabo/rules/recommended preset.

This rule is particularly useful for Ionic applications where you want to enforce the use of Controller-based modals and action sheets instead of inline components.

Rule Details

❌ Incorrect: Using disallowed elements in templates

<ion-modal></ion-modal>
<!-- error -->

✅ Correct: Configure the rule in .eslintrc.json to specify which elements to disallow

Rule Settings

{
  "rules": {
    "@rdlabo/rules/deny-element": [
      "error",
      {
        "elements": ["ion-modal"]
      }
    ]
  }
}

Options

const options: {
  elements: string[]; // Array of element names to disallow
};

Implementation