{"record":{"id":"c87948e5b12e06c6","repo":"oxc-project/oxc","slug":"missing-value-for-lang-attribute","errorCode":null,"errorMessage":"Missing value for `lang` attribute","messagePattern":"Missing value for `lang` attribute","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs","lineNumber":23,"sourceCode":"use 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    ///\n    /// ### Why is this bad?\n    ///\n    /// If the language of a webpage is not specified,\n    /// the screen reader assumes the default language set by the user.\n    /// Language settings become an issue for users who speak multiple languages\n    /// and access website in more than one language.","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs#L5-L41","documentation":"Raised by jsx-a11y/html-has-lang when the <html> element has a lang attribute whose value is missing or empty (e.g. lang=\"\" or a lang attribute with no value). An empty language tag conveys no language information to assistive technology.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set lang to a valid non-empty BCP-47 language tag such as lang=\"en\" or lang=\"pt-BR\".","If the value comes from a variable, ensure it is a defined string at render time."],"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"}