Accessibility
lang-attribute
Require a valid lang attribute on the <html> element.
Verifies that the document root carries a valid BCP-47 language tag. Missing lang attributes break screen-reader pronunciation and translation tools — and AI agents that scaffold a fresh layout file omit it most of the time.
Behavior
- Fixable: Yes — adds lang="en" to the <html> tag.
- Suggestions: Yes.
- Maps to: WCAG 3.1.1 (Language of Page).
Examples
Bad:
<html>...</html>Good:
<html lang="en">...</html>Related rules
viewport-metaForbid disabling user scaling on the viewport meta tag.heading-hierarchyEnforce sequential heading levels and at most one <h1> per file.aria-validationForbid invalid ARIA roles and unknown aria-* attributes.
Use it
Enable lang-attribute in your eslint.config.js:
import deslint from '@deslint/eslint-plugin';
export default [
{
plugins: { deslint },
rules: {
'deslint/lang-attribute': 'error',
},
},
];Found a false positive? Report it on GitHub →