{"record":{"id":"4289902f057041de","repo":"oxc-project/oxc","slug":"value-must-be-set-for-boolean-attribute-attr","errorCode":null,"errorMessage":"Value must be set for boolean attribute {attr:?}","messagePattern":"Value must be set for boolean attribute (.+?)","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/jsx_boolean_value.rs","lineNumber":26,"sourceCode":"use oxc_str::CompactStr;\nuse rustc_hash::FxHashSet;\nuse schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    rule::{Rule, TupleRuleConfig},\n    utils::get_prop_value,\n};\n\nfn boolean_value_diagnostic(attr: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Value must be omitted for boolean attribute {attr:?}\"))\n        .with_label(span)\n}\n\nfn boolean_value_always_diagnostic(attr: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Value must be set for boolean attribute {attr:?}\"))\n        .with_label(span)\n}\n\nfn boolean_value_undefined_false_diagnostic(attr: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Value must be omitted for `false` attribute {attr:?}\"))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, JsonSchema, Deserialize, Serialize)]\n#[serde(rename_all = \"kebab-case\")]\npub enum EnforceBooleanAttribute {\n    /// All boolean attributes must have explicit values.\n    Always,\n    /// All boolean attributes must omit values that are set to `true`.\n    #[default]\n    Never,\n}\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/jsx_boolean_value.rs#L8-L44","documentation":"Raised by react/jsx_boolean_value when configured with `always` and a boolean JSX attribute is written without an explicit value (bare `<input disabled />`). At the throw site the rule's configured style requires the value to be spelled out (`disabled={true}`) so readers and tooling never rely on implicit presence semantics. boolean_value_always_diagnostic fires from run() for shorthand boolean attributes when the config selects the always-explicit style.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/jsx_boolean_value.rs:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the explicit value: <input disabled={true} />."],"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"}