{"record":{"id":"34636a05b8fb8380","repo":"oxc-project/oxc","slug":"value-must-be-omitted-for-boolean-attribute-attr","errorCode":null,"errorMessage":"Value must be omitted for boolean attribute {attr:?}","messagePattern":"Value must be omitted for boolean attribute (.+?)","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/jsx_boolean_value.rs","lineNumber":21,"sourceCode":"    ast::{Expression, JSXAttributeItem, JSXAttributeName, JSXAttributeValue},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse 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,","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/jsx_boolean_value.rs#L3-L39","documentation":"Raised by react/jsx_boolean_value (with `always` off / default `never`-style config) when a boolean-capable JSX attribute is given an explicit `{true}` or `\"true\"` value. At the throw site the explicit value is redundant — presence of the attribute already means true in JSX — and the rule enforces the terser `<input disabled />` form. boolean_value_diagnostic fires from run() for each attribute whose value is the boolean true literal or equivalent, unless the attribute is excluded by config.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/jsx_boolean_value.rs:21 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Omit the value: <input disabled /> instead of <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"}