{"record":{"id":"826664ef1678b0e5","repo":"oxc-project/oxc","slug":"missing-lang-attribute","errorCode":null,"errorMessage":"Missing lang attribute.","messagePattern":"Missing lang attribute\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs","lineNumber":17,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{JSXAttributeItem, JSXAttributeValue, JSXExpression},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::Rule,\n    utils::{get_element_type, get_prop_value, has_jsx_prop_ignore_case},\n};\n\nfn missing_lang_prop(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing lang attribute.\")\n        .with_help(\"Add a `lang` attribute to the `html` element whose value represents the primary language of document.\")\n        .with_label(span)\n}\n\nfn missing_lang_value(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing value for `lang` attribute\")\n        .with_help(\"Must have meaningful value for `lang` prop.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct HtmlHasLang;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Ensures that every HTML document has a lang attribute.\n    ///","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs#L1-L35","documentation":"Raised by the jsx-a11y/html-has-lang rule when a JSX <html> element has no lang attribute. Screen readers use the lang attribute to determine pronunciation and translation of content; without it the document language is unknown to assistive technology.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs:17 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add lang=\"en\" (or the appropriate BCP-47 language code) to the <html> element.","If rendering multiple locales, set lang dynamically from the active locale."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}