{"record":{"id":"fef12397197d3bf9","repo":"oxc-project/oxc","slug":"react-hook-hook-name-was-passed-a-dependency-lis","errorCode":null,"errorMessage":"React Hook {hook_name} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.","messagePattern":"React Hook (.+?) was passed a dependency list that is not an array literal\\. This means we can't statically verify whether you've passed the correct dependencies\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/exhaustive_deps.rs","lineNumber":137,"sourceCode":"            \". Mutable values like '{dep}' aren't valid dependencies because mutating them doesn't re-render the component.\"\n        );\n    }\n\n    OxcDiagnostic::warn(message)\n        .with_labels(labels)\n        .with_help(\"Either include it or remove the dependency array.\")\n        .with_error_code_scope(SCOPE)\n}\n\nfn unnecessary_dependency_diagnostic(hook_name: &str, dep_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"React Hook {hook_name} has unnecessary dependency: {dep_name}\"))\n        .with_label(span)\n        .with_help(\"Either include it or remove the dependency array.\")\n        .with_error_code_scope(SCOPE)\n}\n\nfn dependency_array_not_array_literal_diagnostic(hook_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"React Hook {hook_name} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.\"\n    ))\n    .with_label(span)\n    .with_help(\"Use an array literal as the second argument.\")\n    .with_error_code_scope(SCOPE)\n}\n\nfn literal_in_dependency_array_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"The literal is not a valid dependency because it never changes.\")\n        .with_label(span)\n        .with_help(\"Remove the literal from the array.\")\n        .with_error_code_scope(SCOPE)\n}\n\nfn duplicate_dependency_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"This dependency is specified more than once in the dependency array.\")\n        .with_label(span)\n        .with_help(\"Remove the duplicate dependency from the array.\")","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/exhaustive_deps.rs#L119-L155","documentation":"Error \"React Hook {hook_name} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.\" thrown in oxc-project/oxc.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/exhaustive_deps.rs:137 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a static array literal as the second argument to the hook, e.g. useEffect(fn, [dep1, dep2]).","If deps must be computed dynamically, spread a memoized stable array instead of a variable reference."],"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-14T00:17:10.932Z"}