{"record":{"id":"5c26139649aefba9","repo":"oxc-project/oxc","slug":"passing-1-as-the-depth-argument-is-unnecessary","errorCode":null,"errorMessage":"Passing `1` as the `depth` argument is unnecessary.","messagePattern":"Passing `1` as the `depth` argument is unnecessary\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/no_unnecessary_array_flat_depth.rs","lineNumber":11,"sourceCode":"use oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode, ast_util::is_method_call, context::LintContext, fixer::RuleFixer, rule::Rule,\n};\n\nfn no_unnecessary_array_flat_depth_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Passing `1` as the `depth` argument is unnecessary.\")\n        .with_help(\"Remove the argument\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoUnnecessaryArrayFlatDepth;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallows passing `1` to `Array.prototype.flat`.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Passing `1` is unnecessary.\n    ///\n    /// ### Examples\n    ///","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/no_unnecessary_array_flat_depth.rs#L1-L29","documentation":"Raised by unicorn/no-unnecessary-array-flat-depth when `Array#flat` is called with `1` as the depth argument, since 1 is the default depth. The faulting input is the explicit `1` argument at the labeled span; the fix removes it.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/no_unnecessary_array_flat_depth.rs:11 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the `1` argument: `array.flat()`","Pass the actually intended depth if deeper flattening was meant"],"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"}