{"record":{"id":"3865ef935f99c581","repo":"oxc-project/oxc","slug":"split-uninitialized-declarations-into-multipl","errorCode":null,"errorMessage":"Split uninitialized '{}' declarations into multiple statements.","messagePattern":"Split uninitialized '(.+?)' declarations into multiple statements\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/one_var.rs","lineNumber":21,"sourceCode":"\nuse oxc_ast::{\n    AstKind, AstType,\n    ast::{Expression, Statement, VariableDeclaration, VariableDeclarationKind},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse oxc_syntax::{node::NodeId, scope::ScopeId};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    fixer::Fix,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn one_var_diagnostic(span: Span, message: String) -> OxcDiagnostic {\n    OxcDiagnostic::warn(message).with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]\n#[serde(rename_all = \"lowercase\")]\n/// Controls how variable declarators are grouped into declarations.\nenum OneVarMode {\n    /// Requires one declaration per variable kind in each applicable scope.\n    #[default]\n    Always,\n    /// Requires each declarator to have its own declaration statement.\n    Never,\n    /// Requires adjacent declarations of the same kind to be combined.\n    Consecutive,\n}\n\n/// Options for configuring declaration grouping by kind or initialization state.\n///\n/// `initialized` and `uninitialized` take precedence over the per-kind option for the","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/one_var.rs#L3-L39","documentation":"Diagnostic from the oxlint `one-var` rule when the `uninitialized` option is `never`. A declaration statement with multiple uninitialized declarators, such as `let a, b;`, must be split so each uninitialized variable gets its own statement; initialized declarators follow the `initialized` option instead.","triggerScenarios":"Configure `\"one-var\": [{ \"uninitialized\": \"never\" }]` and lint `let a, b;` or `var x, y, z;`.","commonSituations":"Styles that forbid hoisted declaration groups; refactors that removed initializers leaving `let a, b;` behind; configs where teams want `let a;` per line but merged initialized declarations.","solutions":["Split the group: `let a, b;` becomes `let a; let b;` (auto-fixable).","Set `uninitialized` to `consecutive` or `always` if grouped hoists are acceptable.","Check that you really want the asymmetry — initialized and uninitialized are configured separately and override per-kind options.","Suppress inline where a grouped hoist is idiomatic (e.g. `let row, col;`)."],"exampleFix":"// before\nlet a, b;\n\n// after\nlet a;\nlet b;","handlingStrategy":"validation","validationCode":"// .oxlintrc.json — grouped hoists acceptable? use \"consecutive\"\n{ \"rules\": { \"one-var\": [\"warn\", { \"uninitialized\": \"consecutive\" }] } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid `let a, b;` groups if your config sets uninitialized to never.","Review diffs that remove initializers — they turn grouped declares into violations.","Use the auto-fixer in a hook to keep the tree clean."],"tags":["oxlint","eslint","style","variables","declaration"],"backgroundTag":"eslint-one-var","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"}