{"record":{"id":"a5e0c0bc29842b16","repo":"oxc-project/oxc","slug":"combine-this-with-the-previous-statement-with-a5e0c0","errorCode":null,"errorMessage":"Combine this with the previous '{}' statement with uninitialized variables.","messagePattern":"Combine this with the previous '(.+?)' statement with uninitialized variables\\.","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 `consecutive`. Two adjacent declarations of the same kind that both contain uninitialized declarators (e.g. `let a; let b;`) must be merged (one_var.rs:184-198). The `{}` placeholder is the declaration keyword.","triggerScenarios":"Configure `\"one-var\": [{ \"uninitialized\": \"consecutive\" }]` and write `let a;` immediately followed by `let b;` in the same scope.","commonSituations":"Style guides that hoist declarations (`let a, b;`) then assign later; splitting declarations during refactoring and forgetting to re-merge; configs copied from another team with different initialized/uninitialized preferences.","solutions":["Merge the uninitialized declarations: `let a; let b;` becomes `let a, b;` (auto-fixable).","Insert a non-declaration statement between them if separation is intentional, since only consecutive declarations are joined.","Rebalance options: set `uninitialized` to `never` if you want one-per-statement, or `always` for scope-wide joining.","Disable the rule inline for grouped style exceptions."],"exampleFix":"// before\nlet a;\nlet b;\n\n// after\nlet a, b;","handlingStrategy":"validation","validationCode":"// .oxlintrc.json — \"never\" if hoisted groups should be split instead\n{ \"rules\": { \"one-var\": [\"warn\", { \"uninitialized\": \"never\" }] } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write hoisted declarations grouped (`let a, b;`) when uninitialized is consecutive.","Insert a statement between declarations you want kept apart — only consecutive ones are joined.","Re-run oxlint after splitting/merging refactors."],"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"}