Skip to contentView the source on GitHub

no-missing-lang

Require a lang attribute on the <html> element.

Accessibilityerror by default ESLint rule

astro-doctor/no-missing-lang

Why it matters

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).

See the difference

Incorrect

Missing lang attribute

astroIncorrect example
---
---
<html>
  <head><title>My Astro Site</title></head>
  <body>...</body>
</html>

Correct

lang attribute set

astroCorrect example
---
---
<html lang="en">
  <head><title>My Astro Site</title></head>
  <body>...</body>
</html>

Configure this check

Override the default severity in your ESLint config:

javascripteslint.config.js
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'

export default [
  astroDoctorPlugin.configs.recommended,
  {
    rules: {
      'astro-doctor/no-missing-lang': 'error',
    },
  },
]

Or set the severity for CLI scans in doctor.config.ts:

typescriptdoctor.config.ts
export default {
  rules: {
    'astro-doctor/no-missing-lang': 'error',
  },
}

Use 'error', 'warn', or 'off'. The configuration guide covers presets and per-file overrides.

Keep exploring accessibility

Browse every rule and project audit