Accessibility error by default
astro-doctor/no-missing-lang no-missing-lang
Require a lang attribute on the <html> element.
Why
Screen readers and search engines use the lang attribute to determine page language and apply the correct pronunciation rules or translation hints. A missing lang attribute is a WCAG 2.1 Level A failure (Success Criterion 3.1.1).
Examples
✗ Incorrect
Missing lang attribute
---
---
<html>
<head><title>My Astro Site</title></head>
<body>...</body>
</html> ✓ Correct
lang attribute set
---
---
<html lang="en">
<head><title>My Astro Site</title></head>
<body>...</body>
</html> Configuration
Override the default severity in your ESLint config:
// eslint.config.js
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'
export default [
astroDoctorPlugin.configs.recommended,
{
rules: {
'astro-doctor/no-missing-lang': 'error', // or 'warn' or 'off'
},
},
]
Or in your doctor.config.ts:
export default {
rules: {
'astro-doctor/no-missing-lang': 'error',
},
}
All rules
-
astro-doctor/no-client-load-overuse -
astro-doctor/use-astro-image -
astro-doctor/require-image-dimensions -
astro-doctor/no-missing-alt -
astro-doctor/no-set-html -
astro-doctor/no-public-secret-env -
astro-doctor/prefer-class-list -
astro-doctor/no-blocking-script -
astro-doctor/no-unprocessed-script-surprises -
astro-doctor/no-missing-lang(this page) -
astro-doctor/require-island-fallback -
astro-doctor/no-process-env -
astro-doctor/prefer-content-collections