{"record":{"id":"392cc5d4c96082d6","repo":"oxc-project/oxc","slug":"unexpected-duplicate-super","errorCode":null,"errorMessage":"Unexpected duplicate `super()`.","messagePattern":"Unexpected duplicate `super\\(\\)`\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/constructor_super.rs","lineNumber":33,"sourceCode":"use 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}\n\nfn bad_super(span: Span, super_class_context: Option<SuperClassContext>) -> OxcDiagnostic {\n    let mut labels = vec![span.primary_label(\"This `super()` call is invalid here.\")];\n    if let Some(context) = super_class_context {\n        labels.push(context.span.label(context.label));\n    }","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/constructor_super.rs#L15-L51","documentation":"The duplicate_super variant of constructor-super (crates/oxc_linter/src/rules/eslint/constructor_super.rs:32). It reports a second super() call reachable after an earlier one on the same execution path; the engine itself rejects this with 'Super constructor may only be called once'. The diagnostic carries two labels: the duplicate site ('This path may call super() after it was already called.') and the span of the first call ('`super()` was first called here.').","triggerScenarios":"super() appearing twice sequentially, or an unconditional super() followed by another reachable super() (e.g. inside an if or loop) in a derived-class constructor.","commonSituations":"Copy-paste merges of two constructors each containing super(); refactoring that moves super() into a branch while leaving the original call.","solutions":["Delete the later duplicate super() call.","Keep exactly one super() as the first statement and pass all required arguments to it."],"exampleFix":"// before\nconstructor() {\n  super();\n  if (cond) super();\n}\n\n// after\nconstructor() {\n  super();\n}","handlingStrategy":"validation","validationCode":"// .oxlintrc.json\n{\n  \"rules\": {\n    \"constructor-super\": \"error\"\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep exactly one super() call per derived constructor.","Review constructor merges from copy-paste for duplicated super() calls.","Remember the engine itself throws on a second super() — the lint is the early warning."],"tags":["eslint","oxlint","class","super","duplicate-call"],"backgroundTag":"duplicate-super-constructor-call","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"}