{"record":{"id":"862d36c9bd7f5593","repo":"oxc-project/oxc","slug":"file-has-too-many-dependencies-maximum-allow","errorCode":null,"errorMessage":"File has too many dependencies ({}). Maximum allowed is {}.","messagePattern":"File has too many dependencies \\((.+?)\\)\\. Maximum allowed is (.+?)\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/import/max_dependencies.rs","lineNumber":150,"sourceCode":"\n            if dependency_sources.insert(entry.module_request.name()) {\n                module_count += 1;\n                if module_count > self.max && first_exceeding_span.is_none() {\n                    first_exceeding_span = Some(entry.module_request.span);\n                }\n            }\n        }\n\n        if module_count <= self.max {\n            return;\n        }\n\n        let Some(span) = first_exceeding_span else {\n            return;\n        };\n\n        let error = format!(\n            \"File has too many dependencies ({}). Maximum allowed is {}.\",\n            module_count, self.max,\n        );\n        ctx.diagnostic(max_dependencies_diagnostic(error, span));\n    }\n}\n\n#[test]\nfn test() {\n    use serde_json::json;\n\n    use crate::tester::Tester;\n\n    let pass = vec![\n        (\n            r\"\n            import './foo.js';\n            \",\n            None,","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/import/max_dependencies.rs#L132-L168","documentation":"Raised by import/max_dependencies after run_once counts unique imported module specifiers and the count exceeds the configured max. The span labeled is the first import that pushed the count over the limit, and the message reports both the actual and allowed counts.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/import/max_dependencies.rs:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split the module into smaller units with fewer imports","Remove unused dependencies","Raise or disable the `max` option if the high count is justified"],"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"}