Skip to content

Latest commit

 

History

History
96 lines (72 loc) · 9.19 KB

File metadata and controls

96 lines (72 loc) · 9.19 KB

@angular-eslint/eslint-plugin-template

Please see https://github.com/angular-eslint/angular-eslint for full usage instructions and guidance.

Premade configs

Rules

Possible problems

Key

  • ✅ = recommended
  • 🔧 = fixable
  • 💡 = has suggestions
  • :accessibility: = included in accessibility preset
Rule Description 🔧 💡 :accessibility:
no-duplicate-attributes Ensures that there are no duplicate input properties or output event listeners 💡

Suggestions

Key

  • ✅ = recommended
  • 🔧 = fixable
  • 💡 = has suggestions
  • :accessibility: = included in accessibility preset
Rule Description 🔧 💡 :accessibility:
alt-text [Accessibility] Enforces alternate text for elements which require the alt, aria-label, aria-labelledby attributes. :accessibility:
banana-in-box Ensures that the two-way data binding syntax is correct 🔧
button-has-type Ensures that a button has a valid type specified
click-events-have-key-events [Accessibility] Ensures that the click event is accompanied with at least one key event keyup, keydown or keypress. :accessibility:
conditional-complexity The conditional complexity should not exceed a rational limit
cyclomatic-complexity Checks cyclomatic complexity against a specified limit. It is a quantitative measure of the number of linearly independent paths through a program's source code
elements-content [Accessibility] Ensures that the heading, anchor and button elements have content in it :accessibility:
eqeqeq Requires === and !== in place of == and != 🔧 💡
i18n Ensures following best practices for i18n. Checks for missing i18n attributes on elements and attributes containing texts. Can also check for texts without i18n attribute, elements that do not use custom ID (@@) feature and duplicate custom IDs 🔧 💡
interactive-supports-focus [Accessibility] Ensures that elements with interactive handlers like (click) are focusable. :accessibility:
label-has-associated-control [Accessibility] Ensures that a label element/component is associated with a form element :accessibility:
mouse-events-have-key-events [Accessibility] Ensures that the mouse events mouseout and mouseover are accompanied by focus and blur events respectively. Coding for the keyboard is important for users with physical disabilities who cannot use a mouse, AT compatibility, and screenreader users. See more at https://www.w3.org/WAI/WCAG21/Understanding/keyboard :accessibility:
no-any The use of "$any" nullifies the compile-time benefits of Angular's type system 💡
no-autofocus [Accessibility] Ensures that the autofocus attribute is not used 🔧 :accessibility:
no-call-expression Disallows calling expressions in templates, except for output handlers
no-distracting-elements [Accessibility] Enforces that no distracting elements are used 🔧 :accessibility:
no-inline-styles Disallows the use of inline styles in HTML templates
no-interpolation-in-attributes Ensures that property-binding is used instead of interpolation in attributes.
no-negated-async Ensures that async pipe results, as well as values used with the async pipe, are not negated 💡
no-positive-tabindex Ensures that the tabindex attribute is not positive 💡
prefer-control-flow Ensures that the built-in control flow is used.
prefer-ngsrc Ensures ngSrc is used instead of src for img elements
role-has-required-aria [Accessibility] Ensures elements with ARIA roles have all required properties for that role. 💡 :accessibility:
table-scope [Accessibility] Ensures that the scope attribute is only used on the <th> element 🔧 :accessibility:
use-track-by-function Ensures trackBy function is used
valid-aria [Accessibility] Ensures that correct ARIA attributes and respective values are used 💡 :accessibility:

Layout

Key

  • ✅ = recommended
  • 🔧 = fixable
  • 💡 = has suggestions
  • :accessibility: = included in accessibility preset
Rule Description 🔧 💡 :accessibility:
attributes-order Ensures that HTML attributes and Angular bindings are sorted based on an expected order 🔧
prefer-self-closing-tags Ensures that self-closing tags are used for elements with a closing tag but no content. 🔧