{"record":{"id":"a0bb1cbf89f640f9","repo":"oxc-project/oxc","slug":"lacked-a-call-of-super-in-some-code-paths","errorCode":null,"errorMessage":"Lacked a call of `super()` in some code paths.","messagePattern":"Lacked a call of `super\\(\\)` in some code paths\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/constructor_super.rs","lineNumber":27,"sourceCode":"        Direction,\n        visit::{EdgeRef, neighbors_filtered_by_edge_weight},\n    },\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::NodeId;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn missing_super_all(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected to call `super()`.\")\n        .with_help(\"Add a `super()` call to the constructor\")\n        .with_label(span)\n}\n\nfn missing_super_some(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Lacked a call of `super()` in some code paths.\")\n        .with_help(\"Ensure `super()` is called in all code paths\")\n        .with_label(span)\n}\n\nfn duplicate_super(span: Span, first_super_span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected duplicate `super()`.\")\n        .with_help(\"Remove the duplicate `super()` call\")\n        .with_labels([\n            span.primary_label(\"This path may call `super()` after it was already called.\"),\n            first_super_span.label(\"`super()` was first called here.\"),\n        ])\n}\n\n#[derive(Clone, Copy)]\nstruct SuperClassContext {\n    span: Span,\n    label: &'static str,\n}","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/constructor_super.rs#L9-L45","documentation":"The missing_super_some variant of constructor-super (crates/oxc_linter/src/rules/eslint/constructor_super.rs:26). It fires when super() is called on at least one path but the control-flow graph still shows a path from constructor entry to exit with no super() call. Typical shape: super() only inside an `if` without a covering `else`, or inside a loop/try that may skip it; the missing call makes `this` (and instantiation) fail on that path.","triggerScenarios":"A constructor like `constructor(x) { if (x) super(); this.x = 1; }` — any conditional, early-return, or wrapping control flow that leaves a path without super().","commonSituations":"Calling super conditionally after argument validation; refactoring constructors around feature flags; moving super() inside a try/catch for error handling.","solutions":["Hoist a single unconditional `super()` to the top of the constructor, before any branching.","Restructure so all conditional logic runs after the one super() call.","Pass conditional arguments instead of branching the call: `super(x ?? defaults)`."],"exampleFix":"// before\nconstructor(enabled) {\n  if (enabled) super();\n  this.enabled = enabled;\n}\n\n// after\nconstructor(enabled) {\n  super();\n  this.enabled = enabled;\n}","handlingStrategy":"validation","validationCode":"// .oxlintrc.json\n{\n  \"rules\": {\n    \"constructor-super\": \"error\"\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always place one unconditional super() as the first statement of derived constructors.","Keep argument validation after super(), not around it.","Pass conditional values (`super(x ?? d)`) instead of branching the call itself."],"tags":["eslint","oxlint","class","super","constructor","control-flow"],"backgroundTag":"missing-super-constructor-call","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"}