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
noAccessKeyDisallow the accesskey attribute.
noAmbiguousAnchorTextDisallow ambiguous anchor descriptions.
noAriaHiddenOnFocusableEnforce that aria-hidden=“true” is not set on focusable elements.
noAriaUnsupportedElementsDisallow ARIA attributes on elements that cannot use them.
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.
noNoninteractiveTabindexRequire a negative integer tabindex on non-interactive elements.
noPositiveTabindexDisallow positive values for the 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.
noStaticElementInteractionsRequire an appropriate role when a non-interactive element has event handlers.
noSvgWithoutTitleRequire a supported labeling pattern for non-decorative SVG elements.
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.
useButtonTypeRequire an explicit, valid type on every <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
useHtmlLangRequire a lang attribute on the <html> element.
useIframeTitleRequire a title on every <iframe>.
useKeyWithClickEventsEnforce elements with a click event handler to also have at least one keyboard event handler.
useKeyWithMouseEventsRequire keyboard equivalents for mouse hover events.
useMediaCaptionEnforces that audio and video elements must have a track for captions.
useSemanticElementsEnforces using semantic DOM elements over the ARIA role property.
useValidAnchorRequire anchors to provide a real navigation destination.
useValidAriaPropsDisallow unknown aria-* attributes.
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.
useValidLangRequire a supported language tag on the <html> element.
Rule nameDescriptionProperties
noDuplicateAttributesDisallow duplication of attributes.
noRestrictedElementsDisallow the use of configured elements.
noVueVIfWithVForDisallow using v-if and v-for directives on the same element.
noVueVOnNumberValuesDisallow deprecated number modifiers on Vue v-on directives.
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.
useVueValidVForEnforces valid v-for directives in Vue templates.
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.
Rule nameDescriptionProperties
noAstroConflictingSetDirectivesDisallow conflicting content sources on Astro elements.
noAstroSetHtmlDirectiveDisallow the use of Astro’s set:html directive.
noInvalidFileInputAcceptDisallow invalid accept values on file inputs.
noMisplacedListElementsRequire <li> elements with an HTML element parent to be children of <ul>, <ol>, or <menu>.
noNonScalableViewportDisallow disabling zoom with user-scalable=no in the <meta name="viewport"> element.
noObsoleteTagsDisallow obsolete HTML elements.
noSvelteAtDebugTagsDisallow the use of Svelte’s {@debug} tag.
noSvelteAtHtmlTagsDisallow the use of Svelte’s {@html} tag.
noSvelteClassDirectiveDisallow Svelte’s class: directive.
noSvelteLegacyConstDisallow legacy Svelte {@const} tags.
noTailwindArbitraryValueDisallow arbitrary values in Tailwind CSS utility classes.
noTailwindLegacyUtilitiesDisallow Tailwind CSS utility classes that Tailwind CSS only keeps for backward compatibility.
noTailwindRawColorsDisallow Tailwind CSS utility classes that use raw palette colors.
noTailwindRestyledComponentsDisallow Tailwind utilities that override the appearance of components.
noUndeclaredClassesReports CSS class names in HTML class attributes that are not defined
noUndeclaredCustomPropertiesDisallow undeclared CSS custom properties in inline styles.
noUnsafeIframeSandboxDisallow allow-scripts together with allow-same-origin in an iframe sandbox.
noVueRootVIfDisallow v-if on the root element of a Vue component template.
noVueUndeclaredDirectivesDisallow custom Vue directives that are not declared.
noVueVHtmlDisallow the use of Vue’s v-html directive.
noVueVTextDisallow the use of Vue’s v-text directive.
useAstroClientOnlyDirectiveValueRequire a value for Astro’s client:only directive.
useConsistentBlockLangEnforce which languages the top-level blocks of Vue and Svelte components use.
useControlLabelEnforce that interactive control elements have an accessible label.
useSvelteKitResolveRequire internal navigation in SvelteKit apps to use paths built with resolve().
useSvelteRequireEachKeyRequire keyed {#each} blocks in Svelte templates.
useSvelteShorthandDirectiveEnforce the shorthand syntax for Svelte bind:, class:, and style: directives.
useTailwindShorthandClassesEnforce using fewer Tailwind utilities instead of multiple utilities that are functionally the same.
useTailwindSortedClassesEnforce the sorting of Tailwind CSS classes.
useTailwindStaticClassStringsRequire complete, statically written class names.
useVueConsistentEventHyphenationEnforce a consistent hyphenation style for event names in v-on directives on custom components.
Rule nameDescriptionProperties
noSyncScriptsDisallow external scripts that block HTML parsing.
useVueVaporEnforce opting in to Vue Vapor mode in <script setup> blocks.
Rule nameDescriptionProperties
noScriptUrlDisallow javascript: URLs in HTML.
useIframeSandboxRequire the sandbox attribute on <iframe> elements.
Rule nameDescriptionProperties
noExcessiveLinesPerFileRestrict the number of lines in a file.
noInlineStylesDisallow the use of inline styles.
useVueConsistentVBindStyleEnforce a consistent style for v-bind in Vue templates.
useVueConsistentVOnStyleEnforce a consistent style for v-on in Vue templates.
useVueHyphenatedAttributesDisallow uppercase letters in Vue template attribute names.
Rule nameDescriptionProperties
useScopedStylesKeep component styles scoped in Vue and Astro files.

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