Skip to content

HTML Rules

Below the list of rules supported by Biome, divided by group. Here’s a legend of the emojis:

  • The icon indicates that the rule is part of the recommended rules.
  • The icon indicates that the rule provides a code action (fix) that is safe to apply.
  • The icon indicates that the rule provides a code action (fix) that is unsafe to apply.
  • The icon indicates that the rule has been implemented and scheduled for the next release.
Rule nameDescriptionProperties
noAccessKeyEnforce that the accesskey attribute is not used on any HTML element.
noAriaHiddenOnFocusableEnforce that aria-hidden=“true” is not set on focusable elements.
noAriaUnsupportedElementsEnforce that elements that do not support ARIA roles, states, and properties do not have those attributes.
noAutofocusEnforce that the autofocus attribute is not used on elements.
noDistractingElementsEnforces that no distracting elements are used.
noHeaderScopeThe scope prop should be used only on <th> elements.
noInteractiveElementToNoninteractiveRoleEnforce that non-interactive ARIA roles are not assigned to interactive HTML elements.
noLabelWithoutControlEnforce that a label element or component has a text label and an associated input.
noNoninteractiveElementInteractionsDisallow use event handlers on non-interactive elements.
noNoninteractiveElementToInteractiveRoleEnforce that interactive ARIA roles are not assigned to non-interactive HTML elements.
noNoninteractiveTabindexEnforce that tabindex is not assigned to non-interactive HTML elements.
noPositiveTabindexPrevent the usage of positive integers on tabindex attribute.
noRedundantAltEnforce img alt prop does not contain the word “image”, “picture”, or “photo”.
noRedundantRolesEnforce explicit role property is not the same as implicit/default role property on an element.
noStaticElementInteractionsEnforce that static, visible elements (such as <div>) that have click handlers use the valid role attribute.
noSvgWithoutTitleEnforces the usage of the title element for the svg element.
useAltTextEnforce that all elements that require alternative text have meaningful information to relay back to the end user.
useAnchorContentEnforce that anchors have content and that the content is accessible to screen readers.
useAriaActivedescendantWithTabindexEnforce that tabindex is assigned to non-interactive HTML elements with aria-activedescendant.
useAriaPropsForRoleEnforce that elements with ARIA roles must have all required ARIA attributes for that role.
useAriaPropsSupportedByRoleEnforce that ARIA properties are valid for the roles that are supported by the element.
useButtonTypeEnforces the usage and validity of the attribute type for the element button
useFocusableInteractiveElements with an interactive role and interaction handlers must be focusable.
useHeadingContentEnforce that heading elements (h1, h2, etc.) have content and that the content is
useHtmlLangEnforce that html element has lang attribute.
useIframeTitleEnforces the usage of the attribute title for the element iframe.
useKeyWithClickEventsEnforce elements with a click event handler to also have at least one keyboard event handler.
useKeyWithMouseEventsEnforce that onmouseover is accompanied by onfocus and onmouseout by onblur.
useMediaCaptionEnforces that audio and video elements must have a track for captions.
useSemanticElementsEnforces using semantic DOM elements over the ARIA role property.
useValidAnchorEnforce that all anchors are valid, and they are navigable elements.
useValidAriaPropsEnsures that ARIA properties aria-* are all valid.
useValidAriaRoleElements with ARIA roles must use a valid, non-abstract ARIA role.
useValidAriaValuesEnforce that ARIA state and property values are valid.
useValidAutocompleteUse valid values for the autocomplete attribute on input elements.
useValidLangEnsure that the attribute passed to the lang attribute is a correct ISO language and/or country.
Rule nameDescriptionProperties
noAmbiguousAnchorTextDisallow ambiguous anchor descriptions.
noDuplicateAttributesDisallow duplication of attributes.
noExcessiveLinesPerFileRestrict the number of lines in a file.
noInlineStylesDisallow the use of inline styles.
noScriptUrlDisallow javascript: URLs in HTML.
noSyncScriptsPrevent the usage of synchronous scripts.
noUndeclaredClassesReports CSS class names in HTML class attributes that are not defined
noVueVIfWithVForDisallow using v-if and v-for directives on the same element.
useIframeSandboxEnforce the ‘sandbox’ attribute for ‘iframe’ elements.
useScopedStylesEnforce that <style> blocks in Vue SFCs have the scoped attribute and that <style> blocks in Astro components do not have the is:global directive.
useVueConsistentVBindStyleEnforce a consistent style for v-bind in Vue templates.
useVueConsistentVOnStyleEnforce a consistent style for v-on in Vue templates.
useVueHyphenatedAttributesEnforce hyphenated (kebab-case) attribute names in Vue templates.
useVueVForKeyEnforce that elements using v-for also specify a unique key.
useVueValidTemplateRootEnforce valid Vue <template> root usage.
useVueValidVBindForbids v-bind directives with missing values or invalid modifiers.
useVueValidVCloakEnforce valid v-cloak Vue directives.
useVueValidVElseEnforce valid usage of v-else.
useVueValidVElseIfEnforce valid v-else-if directives.
useVueValidVHtmlEnforce valid v-html directives.
useVueValidVIfEnforces valid v-if usage for Vue templates.
useVueValidVOnEnforce valid v-on directives with proper arguments, modifiers, and handlers.
useVueValidVOnceEnforce valid v-once Vue directives.
useVueValidVPreEnforce valid v-pre Vue directives.
useVueValidVTextEnforce valid v-text Vue directives.
useVueVaporEnforce opting in to Vue Vapor mode in <script setup> blocks.

Missing a rule? Help us by contributing to the analyzer or create a rule suggestion here.