Skip to content

langValidity

Reports invalid lang attribute values.

✅ This rule is included in the jsx logical and logicalStrict presets.

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.

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

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

Made with ❤️‍🔥 around the world by the Flint team and contributors.