Skip to content

langValidity

Reports invalid lang attribute values.

✅ This rule is included in the jsx logical preset.

The lang attribute must contain a valid BCP 47 language tag to properly identify the language of content for screen readers and assistive technologies. Invalid language tags can cause confusion for users who rely on assistive technologies.

Valid BCP 47 language tags consist of a primary language subtag (2-3 letters) optionally followed by script, region, and variant subtags.

This is required for WCAG 3.1.2 compliance.

<div lang="">Content</div>
<div lang="e">Content</div>
<div lang="123">Content</div>
<html lang="en-">Content</html>

If you’re using a framework that manages language attributes automatically, you may want to disable this rule.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.