{"record":{"id":"717cbf5c78630448","repo":"oxc-project/oxc","slug":"missing-jsdoc-yields-type","errorCode":null,"errorMessage":"Missing JSDoc `@yields` type.","messagePattern":"Missing JSDoc `@yields` type\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/jsdoc/require_yields_type.rs","lineNumber":12,"sourceCode":"use oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{\n    context::LintContext,\n    rule::Rule,\n    utils::{should_ignore_as_internal, should_ignore_as_private},\n};\n\nfn require_yields_type_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing JSDoc `@yields` type.\")\n        .with_help(\"Add {type} to `@yields` tag.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireYieldsType;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Requires a type on the `@yields` tag.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// A `@yields` tag should document the type yielded by the generator.\n    ///\n    /// ### Examples\n    ///","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsdoc/require_yields_type.rs#L1-L30","documentation":"This is the oxlint `jsdoc/require-yields-type` diagnostic. It fires when a `@yields` tag on a generator's JSDoc lacks the `{Type}` in curly brackets. Like `require-returns-type`, it makes the yielded value's type machine-readable.","triggerScenarios":"A documented function has `@yields Each row` — description without a `{Type}` part. Tag aliases (`@yield`) configured through `settings.jsdoc.tagName` are also matched.","commonSituations":"Hand-written generator docs that describe iteration in prose only; codebases adopting the jsdoc plugin rules wholesale.","solutions":["Add the type: `@yields {Row} Each parsed row.`","Disable the rule when TS signatures already carry yield types."],"exampleFix":"// before\n/**\n * @yields Each buffered line.\n */\nfunction* lines(buf) {}\n\n// after\n/**\n * @yields {string} Each buffered line.\n */\nfunction* lines(buf) {}","handlingStrategy":"validation","validationCode":"// Flag @yields tags without a {type} part\nconst src = require('fs').readFileSync(file, 'utf8');\nconst noType = /@yields?\\s+[^{\\s]/.exec(src);\nif (noType) console.error('jsdoc/require-yields-type will fire:', file);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a doc snippet that always includes the curly-bracket type on @yields.","Codemod old prose-only yield comments when enabling the rule.","CI-enforce the jsdoc rule set."],"tags":["jsdoc","generator","documentation","lint","oxlint"],"backgroundTag":"jsdoc-yields-tag-missing","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"}