{"record":{"id":"457cd34b7d94419f","repo":"oxc-project/oxc","slug":"duplicate-yields-tags","errorCode":null,"errorMessage":"Duplicate `@yields` tags.","messagePattern":"Duplicate `@yields` tags\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/jsdoc/require_yields.rs","lineNumber":29,"sourceCode":"use crate::{\n    AstNode,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n    utils::{\n        get_function_nearest_jsdoc_node, is_duplicated_special_tag, is_missing_special_tag,\n        should_ignore_as_avoid, should_ignore_as_custom_skip, should_ignore_as_internal,\n        should_ignore_as_private,\n    },\n};\n\nfn missing_yields(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing JSDoc `@yields` declaration for generator function.\")\n        .with_help(\"Add `@yields` tag to the JSDoc comment.\")\n        .with_label(span)\n}\n\nfn duplicate_yields(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Duplicate `@yields` tags.\")\n        .with_help(\"Remove redundant `@yields` tag.\")\n        .with_label(span)\n}\n\nfn missing_yields_with_generator(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`@yields` tag is required when using `@generator` tag.\")\n        .with_help(\"Add `@yields` tag to the JSDoc comment.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct RequireYields(Box<RequireYieldsConfig>);\n\nimpl Deref for RequireYields {\n    type Target = RequireYieldsConfig;\n\n    fn deref(&self) -> &Self::Target {\n        &self.0","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/oxc-project/oxc/blob/1f902a69625cd14e6d8dc58feca94da099d2d251/crates/oxc_linter/src/rules/jsdoc/require_yields.rs#L11-L47","documentation":"This is the oxlint `jsdoc/require-yields` diagnostic (duplicate case). The same rule also reports JSDoc blocks that contain more than one `@yields` tag, because a generator has exactly one yield signature and duplicated tags confuse doc generators.","triggerScenarios":"A generator function's JSDoc block contains two or more `@yields` tags, e.g. `@yields {undefined}` followed by `@yields {void}` (the rule's own documented bad example).","commonSituations":"Copy-pasted doc blocks; merge artifacts where a union type was expressed as two tags instead of one `{A|B}` type; editing `@returns` to `@yields` without deleting the old tag.","solutions":["Keep a single `@yields` tag and express unions in the type: `@yields {Row|Separator}`.","Delete the stale duplicate left over from edits or merges."],"exampleFix":"// before\n/**\n * @yields {undefined}\n * @yields {void}\n */\nfunction* quux(foo) {}\n\n// after\n/**\n * @yields {void} Nothing per iteration.\n */\nfunction* quux(foo) {}","handlingStrategy":"validation","validationCode":"// Flag JSDoc blocks containing more than one @yields tag\nconst src = require('fs').readFileSync(file, 'utf8');\nfor (const block of src.matchAll(/\\/\\*\\*[\\s\\S]*?\\*\\//g)) {\n  const n = (block[0].match(/@yields?\\b/g) || []).length;\n  if (n > 1) console.error('duplicate @yields will fire');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Express multiple yielded shapes as a union type inside one tag: `@yields {A|B}`.","Review doc edits on generator functions for leftover duplicate tags.","Run oxlint on save in the editor to catch duplicates immediately."],"tags":["jsdoc","generator","documentation","lint","oxlint"],"backgroundTag":"jsdoc-yields-tag-missing","analyzedSha":"1f902a69625cd14e6d8dc58feca94da099d2d251","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}