{"record":{"id":"0b38bbbfbb050907","repo":"oxc-project/oxc","slug":"implements-used-on-a-non-constructor-function","errorCode":null,"errorMessage":"`@implements` used on a non-constructor function","messagePattern":"`@implements` used on a non-constructor function","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/jsdoc/implements_on_classes.rs","lineNumber":14,"sourceCode":"use oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::Rule,\n    utils::{get_function_nearest_jsdoc_node, should_ignore_as_internal, should_ignore_as_private},\n};\n\nfn implements_on_classes_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`@implements` used on a non-constructor function\")\n        .with_help(\"Add `@class` tag or use class syntax.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct ImplementsOnClasses;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Reports an issue with any non-constructor function using `@implements`.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Constructor functions should be\n    /// whether marked with `@class`, `@constructs`, or being a class constructor.\n    ///\n    /// ### Examples","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsdoc/implements_on_classes.rs#L1-L32","documentation":"Fires from jsdoc/implements-on-classes when an @implements tag is attached to a plain function rather than a class or constructor. The run visitor checks the node nearest the JSDoc comment; the helper's advice is to add @class or use class syntax.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/jsdoc/implements_on_classes.rs:14 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert the function to a class since @implements describes class contracts","Add a `@class` tag if the function genuinely acts as a class","Remove the `@implements` tag"],"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"}