eslint-plugin-jsdoc 60.5.0 → 60.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/jsdocUtils.d.ts +1 -0
  3. package/dist/cjs/rules/escapeInlineTags.d.ts +2 -0
  4. package/dist/generateDocs.cjs +5 -6
  5. package/dist/generateDocs.cjs.map +1 -1
  6. package/dist/index-cjs.cjs +4 -1
  7. package/dist/index-cjs.cjs.map +1 -1
  8. package/dist/index.cjs +4 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/jsdocUtils.cjs +3 -2
  11. package/dist/jsdocUtils.cjs.map +1 -1
  12. package/dist/jsdocUtils.d.ts +1 -0
  13. package/dist/rules/checkLineAlignment.cjs +1 -2
  14. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  15. package/dist/rules/checkTypes.cjs +2 -3
  16. package/dist/rules/checkTypes.cjs.map +1 -1
  17. package/dist/rules/convertToJsdocComments.cjs +2 -4
  18. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  19. package/dist/rules/emptyTags.cjs +1 -2
  20. package/dist/rules/emptyTags.cjs.map +1 -1
  21. package/dist/rules/escapeInlineTags.cjs +149 -0
  22. package/dist/rules/escapeInlineTags.cjs.map +1 -0
  23. package/dist/rules/escapeInlineTags.d.ts +3 -0
  24. package/dist/rules/informativeDocs.cjs +3 -6
  25. package/dist/rules/informativeDocs.cjs.map +1 -1
  26. package/dist/rules/linesBeforeBlock.cjs +4 -8
  27. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  28. package/dist/rules/matchDescription.cjs +2 -4
  29. package/dist/rules/matchDescription.cjs.map +1 -1
  30. package/dist/rules/matchName.cjs +1 -2
  31. package/dist/rules/matchName.cjs.map +1 -1
  32. package/dist/rules/multilineBlocks.cjs +3 -6
  33. package/dist/rules/multilineBlocks.cjs.map +1 -1
  34. package/dist/rules/noBadBlocks.cjs +1 -2
  35. package/dist/rules/noBadBlocks.cjs.map +1 -1
  36. package/dist/rules/noTypes.cjs +1 -2
  37. package/dist/rules/noTypes.cjs.map +1 -1
  38. package/dist/rules/preferImportTag.cjs +6 -2
  39. package/dist/rules/preferImportTag.cjs.map +1 -1
  40. package/dist/rules/requireAsteriskPrefix.cjs +1 -2
  41. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  42. package/dist/rules/requireDescriptionCompleteSentence.cjs +1 -2
  43. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  44. package/dist/rules/requireFileOverview.cjs +1 -3
  45. package/dist/rules/requireFileOverview.cjs.map +1 -1
  46. package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -2
  47. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  48. package/dist/rules/requireJsdoc.cjs +3 -6
  49. package/dist/rules/requireJsdoc.cjs.map +1 -1
  50. package/dist/rules/requireParam.cjs +6 -12
  51. package/dist/rules/requireParam.cjs.map +1 -1
  52. package/dist/rules/requireParamName.cjs +1 -2
  53. package/dist/rules/requireParamName.cjs.map +1 -1
  54. package/dist/rules/requireReturns.cjs +1 -2
  55. package/dist/rules/requireReturns.cjs.map +1 -1
  56. package/dist/rules/requireReturnsCheck.cjs +13 -1
  57. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  58. package/dist/rules/requireTemplate.cjs +1 -2
  59. package/dist/rules/requireTemplate.cjs.map +1 -1
  60. package/dist/rules/sortTags.cjs +1 -2
  61. package/dist/rules/sortTags.cjs.map +1 -1
  62. package/dist/rules.d.ts +30 -37
  63. package/package.json +9 -9
  64. package/src/index-cjs.js +4 -0
  65. package/src/index.js +4 -0
  66. package/src/jsdocUtils.js +17 -1
  67. package/src/rules/checkLineAlignment.js +1 -2
  68. package/src/rules/checkTypes.js +3 -15
  69. package/src/rules/convertToJsdocComments.js +2 -4
  70. package/src/rules/emptyTags.js +1 -2
  71. package/src/rules/escapeInlineTags.js +189 -0
  72. package/src/rules/informativeDocs.js +3 -6
  73. package/src/rules/linesBeforeBlock.js +4 -8
  74. package/src/rules/matchDescription.js +2 -4
  75. package/src/rules/matchName.js +1 -2
  76. package/src/rules/multilineBlocks.js +3 -6
  77. package/src/rules/noBadBlocks.js +1 -2
  78. package/src/rules/noTypes.js +1 -2
  79. package/src/rules/preferImportTag.js +8 -3
  80. package/src/rules/requireAsteriskPrefix.js +1 -2
  81. package/src/rules/requireDescriptionCompleteSentence.js +1 -2
  82. package/src/rules/requireFileOverview.js +1 -3
  83. package/src/rules/requireHyphenBeforeParamDescription.js +1 -2
  84. package/src/rules/requireJsdoc.js +3 -6
  85. package/src/rules/requireParam.js +6 -12
  86. package/src/rules/requireParamName.js +1 -2
  87. package/src/rules/requireReturns.js +1 -2
  88. package/src/rules/requireReturnsCheck.js +16 -1
  89. package/src/rules/requireTemplate.js +1 -2
  90. package/src/rules/sortTags.js +1 -2
  91. package/src/rules.d.ts +30 -37
@@ -471,15 +471,13 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
471
471
  autoIncrementBase: {
472
472
  default: 0,
473
473
  description: `Numeric to indicate the number at which to begin auto-incrementing roots.
474
- Defaults to \`0\`.
475
- `,
474
+ Defaults to \`0\`.`,
476
475
  type: 'integer'
477
476
  },
478
477
  checkConstructors: {
479
478
  default: true,
480
479
  description: `A value indicating whether \`constructor\`s should be checked. Defaults to
481
- \`true\`.
482
- `,
480
+ \`true\`.`,
483
481
  type: 'boolean'
484
482
  },
485
483
  checkDestructured: {
@@ -497,8 +495,7 @@ the \`{a, b}\` object parameter).
497
495
  If \`checkDestructuredRoots\` is \`false\`, \`checkDestructured\` will also be
498
496
  implied to be \`false\` (i.e., the inside of the roots will not be checked
499
497
  either, e.g., it will also not complain if \`a\` or \`b\` do not have their own
500
- documentation). Defaults to \`true\`.
501
- `,
498
+ documentation). Defaults to \`true\`.`,
502
499
  type: 'boolean'
503
500
  },
504
501
  checkGetters: {
@@ -557,8 +554,7 @@ Nor will this:
557
554
  */
558
555
  function quux ({num, ...extra}) {
559
556
  }
560
- \`\`\`
561
- `,
557
+ \`\`\``,
562
558
  type: 'boolean'
563
559
  },
564
560
  checkSetters: {
@@ -612,8 +608,7 @@ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclarati
612
608
  which are checked.
613
609
 
614
610
  See the ["AST and Selectors"](../#advanced-ast-and-selectors)
615
- section of our Advanced docs for more on the expected format.
616
- `,
611
+ section of our Advanced docs for more on the expected format.`,
617
612
  items: {
618
613
  anyOf: [{
619
614
  type: 'string'
@@ -669,8 +664,7 @@ function baar ([a, ...extra]) {
669
664
  Note that the type \`any\` is included since we don't know of any specific
670
665
  type to use.
671
666
 
672
- Defaults to \`true\`.
673
- `,
667
+ Defaults to \`true\`.`,
674
668
  type: 'boolean'
675
669
  },
676
670
  enableRootFixer: {
@@ -1 +1 @@
1
- {"version":3,"file":"requireParam.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","rootNamer","desiredRoots","currentIndex","name","idx","incremented","length","base","suffix","shift","_default","exports","iterateJsdoc","context","jsdoc","node","utils","avoidDocs","hasTag","autoIncrementBase","checkDestructured","checkDestructuredRoots","checkRestProperty","checkTypesPattern","enableFixer","enableRestElementFixer","enableRootFixer","ignoreWhenAllParamsMissing","interfaceExemptsParamsCheck","unnamedRootBase","useDefaultObjectProperties","options","params","type","typeAnnotation","parent","id","preferredTagName","getPreferredTagName","tagName","functionParameterNames","getFunctionParameterNames","jsdocParameterNames","getJsdocTagsDeep","shallowJsdocParameterNames","filter","tag","includes","map","checkTypesRegex","getRegexFromString","missingTags","flattenedRoots","flattenRoots","names","paramIndex","hasParamIndex","cur","dropPathSegmentQuotes","String","getParamIndex","setParamIndex","entries","findExpectedIndex","jsdocTags","indexAtFunctionParams","remainingRoots","slice","foundIndex","findIndex","newAdd","some","remainingRoot","Array","isArray","tags","tagLineCount","source","tokens","end","nextRootName","namer","thisOffset","functionParameterIdx","functionParameterName","inc","matchedJsdoc","rootName","search","hasPropertyRest","hasRestElement","rests","notCheckingNames","paramName","find","fpn","emptyParamIdx","push","remove","fullParamName","notCheckingName","paramType","comparePaths","undefined","startsWith","funcParamName","restElement","fix","createTokens","tagIndex","sourceIndex","spliceCount","number","delimiter","description","lineEnd","postDelimiter","postName","postTag","postType","start","splice","inlineTags","optional","problems","firstNumber","src","offset","expectedIdx","firstParamLine","baseOffset","fixer","missingTag","makeMultiline","reportJSDoc","contextDefaults","meta","docs","url","fixable","schema","additionalProperties","properties","checkConstructors","checkGetters","checkSetters","contexts","items","anyOf","comment","exemptedBy","noTracking","module"],"sources":["../../src/rules/requireParam.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {[string, boolean, () => RootNamerReturn]} RootNamerReturn\n */\n\n/**\n * @param {string[]} desiredRoots\n * @param {number} currentIndex\n * @returns {RootNamerReturn}\n */\nconst rootNamer = (desiredRoots, currentIndex) => {\n /** @type {string} */\n let name;\n let idx = currentIndex;\n const incremented = desiredRoots.length <= 1;\n if (incremented) {\n const base = desiredRoots[0];\n const suffix = idx++;\n name = `${base}${suffix}`;\n } else {\n name = /** @type {string} */ (desiredRoots.shift());\n }\n\n return [\n name,\n incremented,\n () => {\n return rootNamer(desiredRoots, idx);\n },\n ];\n};\n\n/* eslint-disable complexity -- Temporary */\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n utils,\n}) => {\n /* eslint-enable complexity -- Temporary */\n if (utils.avoidDocs()) {\n return;\n }\n\n // Param type is specified by type in @type\n if (utils.hasTag('type')) {\n return;\n }\n\n const {\n autoIncrementBase = 0,\n checkDestructured = true,\n checkDestructuredRoots = true,\n checkRestProperty = false,\n checkTypesPattern = '/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/',\n enableFixer = true,\n enableRestElementFixer = true,\n enableRootFixer = true,\n ignoreWhenAllParamsMissing = false,\n interfaceExemptsParamsCheck = false,\n unnamedRootBase = [\n 'root',\n ],\n useDefaultObjectProperties = false,\n } = context.options[0] || {};\n\n if (interfaceExemptsParamsCheck) {\n if (node && 'params' in node && node.params.length === 1 &&\n node.params?.[0] && typeof node.params[0] === 'object' &&\n node.params[0].type === 'ObjectPattern' &&\n 'typeAnnotation' in node.params[0] && node.params[0].typeAnnotation\n ) {\n return;\n }\n\n if (node && node.parent.type === 'VariableDeclarator' &&\n 'typeAnnotation' in node.parent.id && node.parent.id.typeAnnotation) {\n return;\n }\n }\n\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n if (!preferredTagName) {\n return;\n }\n\n const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties);\n if (!functionParameterNames.length) {\n return;\n }\n\n const jsdocParameterNames =\n /**\n * @type {{\n * idx: import('../iterateJsdoc.js').Integer;\n * name: string;\n * type: string;\n * }[]}\n */ (utils.getJsdocTagsDeep(preferredTagName));\n\n if (ignoreWhenAllParamsMissing && !jsdocParameterNames.length) {\n return;\n }\n\n const shallowJsdocParameterNames = jsdocParameterNames.filter((tag) => {\n return !tag.name.includes('.');\n }).map((tag, idx) => {\n return {\n ...tag,\n idx,\n };\n });\n\n const checkTypesRegex = utils.getRegexFromString(checkTypesPattern);\n\n /**\n * @type {{\n * functionParameterIdx: import('../iterateJsdoc.js').Integer,\n * functionParameterName: string,\n * inc: boolean|undefined,\n * remove?: true,\n * type?: string|undefined\n * }[]}\n */\n const missingTags = [];\n const flattenedRoots = utils.flattenRoots(functionParameterNames).names;\n\n /**\n * @type {{\n * [key: string]: import('../iterateJsdoc.js').Integer\n * }}\n */\n const paramIndex = {};\n\n /**\n * @param {string} cur\n * @returns {boolean}\n */\n const hasParamIndex = (cur) => {\n return utils.dropPathSegmentQuotes(String(cur)) in paramIndex;\n };\n\n /**\n *\n * @param {string|number|undefined} cur\n * @returns {import('../iterateJsdoc.js').Integer}\n */\n const getParamIndex = (cur) => {\n return paramIndex[utils.dropPathSegmentQuotes(String(cur))];\n };\n\n /**\n *\n * @param {string} cur\n * @param {import('../iterateJsdoc.js').Integer} idx\n * @returns {void}\n */\n const setParamIndex = (cur, idx) => {\n paramIndex[utils.dropPathSegmentQuotes(String(cur))] = idx;\n };\n\n for (const [\n idx,\n cur,\n ] of flattenedRoots.entries()) {\n setParamIndex(cur, idx);\n }\n\n /**\n *\n * @param {(import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * newAdd?: boolean\n * })[]} jsdocTags\n * @param {import('../iterateJsdoc.js').Integer} indexAtFunctionParams\n * @returns {{\n * foundIndex: import('../iterateJsdoc.js').Integer,\n * tagLineCount: import('../iterateJsdoc.js').Integer,\n * }}\n */\n const findExpectedIndex = (jsdocTags, indexAtFunctionParams) => {\n const remainingRoots = functionParameterNames.slice(indexAtFunctionParams || 0);\n const foundIndex = jsdocTags.findIndex(({\n name,\n newAdd,\n }) => {\n return !newAdd && remainingRoots.some((remainingRoot) => {\n if (Array.isArray(remainingRoot)) {\n return (\n /**\n * @type {import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string|undefined;\n * }}\n */ (remainingRoot[1]).names.includes(name)\n );\n }\n\n if (typeof remainingRoot === 'object') {\n return name === remainingRoot.name;\n }\n\n return name === remainingRoot;\n });\n });\n\n const tags = foundIndex > -1 ?\n jsdocTags.slice(0, foundIndex) :\n jsdocTags.filter(({\n tag,\n }) => {\n return tag === preferredTagName;\n });\n\n let tagLineCount = 0;\n for (const {\n source,\n } of tags) {\n for (const {\n tokens: {\n end,\n },\n } of source) {\n if (!end) {\n tagLineCount++;\n }\n }\n }\n\n return {\n foundIndex,\n tagLineCount,\n };\n };\n\n let [\n nextRootName,\n incremented,\n namer,\n ] = rootNamer([\n ...unnamedRootBase,\n ], autoIncrementBase);\n\n const thisOffset = functionParameterNames[0] === 'this' ? 1 : 0;\n\n for (const [\n functionParameterIdx,\n functionParameterName,\n ] of functionParameterNames.entries()) {\n let inc;\n if (Array.isArray(functionParameterName)) {\n const matchedJsdoc = shallowJsdocParameterNames[functionParameterIdx - thisOffset];\n\n /** @type {string} */\n let rootName;\n if (functionParameterName[0]) {\n rootName = functionParameterName[0];\n } else if (matchedJsdoc && matchedJsdoc.name) {\n rootName = matchedJsdoc.name;\n if (matchedJsdoc.type && matchedJsdoc.type.search(checkTypesRegex) === -1) {\n continue;\n }\n } else {\n rootName = nextRootName;\n inc = incremented;\n }\n\n [\n nextRootName,\n incremented,\n namer,\n ] = namer();\n\n const {\n hasPropertyRest,\n hasRestElement,\n names,\n rests,\n } = /**\n * @type {import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string | undefined;\n * }}\n */ (functionParameterName[1]);\n const notCheckingNames = [];\n if (!enableRestElementFixer && hasRestElement) {\n continue;\n }\n\n if (!checkDestructuredRoots) {\n continue;\n }\n\n for (const [\n idx,\n paramName,\n ] of names.entries()) {\n // Add root if the root name is not in the docs (and is not already\n // in the tags to be fixed)\n if (!jsdocParameterNames.find(({\n name,\n }) => {\n return name === rootName;\n }) && !missingTags.find(({\n functionParameterName: fpn,\n }) => {\n return fpn === rootName;\n })) {\n const emptyParamIdx = jsdocParameterNames.findIndex(({\n name,\n }) => {\n return !name;\n });\n\n if (emptyParamIdx > -1) {\n missingTags.push({\n functionParameterIdx: emptyParamIdx,\n functionParameterName: rootName,\n inc,\n remove: true,\n });\n } else {\n missingTags.push({\n functionParameterIdx: hasParamIndex(rootName) ?\n getParamIndex(rootName) :\n getParamIndex(paramName),\n functionParameterName: rootName,\n inc,\n });\n }\n }\n\n if (!checkDestructured) {\n continue;\n }\n\n if (!checkRestProperty && rests[idx]) {\n continue;\n }\n\n const fullParamName = `${rootName}.${paramName}`;\n\n const notCheckingName = jsdocParameterNames.find(({\n name,\n type: paramType,\n }) => {\n return utils.comparePaths(name)(fullParamName) && paramType.search(checkTypesRegex) === -1 && paramType !== '';\n });\n\n if (notCheckingName !== undefined) {\n notCheckingNames.push(notCheckingName.name);\n }\n\n if (notCheckingNames.find((name) => {\n return fullParamName.startsWith(name);\n })) {\n continue;\n }\n\n if (jsdocParameterNames && !jsdocParameterNames.find(({\n name,\n }) => {\n return utils.comparePaths(name)(fullParamName);\n })) {\n missingTags.push({\n functionParameterIdx: getParamIndex(\n functionParameterName[0] ? fullParamName : paramName,\n ),\n functionParameterName: fullParamName,\n inc,\n type: hasRestElement && !hasPropertyRest ? '{...any}' : undefined,\n });\n }\n }\n\n continue;\n }\n\n /** @type {string} */\n let funcParamName;\n let type;\n if (typeof functionParameterName === 'object') {\n if (!enableRestElementFixer && functionParameterName.restElement) {\n continue;\n }\n\n funcParamName = /** @type {string} */ (functionParameterName.name);\n type = '{...any}';\n } else {\n funcParamName = /** @type {string} */ (functionParameterName);\n }\n\n if (jsdocParameterNames && !jsdocParameterNames.find(({\n name,\n }) => {\n return name === funcParamName;\n }) && funcParamName !== 'this') {\n missingTags.push({\n functionParameterIdx: getParamIndex(funcParamName),\n functionParameterName: funcParamName,\n inc,\n type,\n });\n }\n }\n\n /**\n *\n * @param {{\n * functionParameterIdx: import('../iterateJsdoc.js').Integer,\n * functionParameterName: string,\n * remove?: true,\n * inc?: boolean,\n * type?: string\n * }} cfg\n */\n const fix = ({\n functionParameterIdx,\n functionParameterName,\n inc,\n remove,\n type,\n }) => {\n if (inc && !enableRootFixer) {\n return;\n }\n\n /**\n *\n * @param {import('../iterateJsdoc.js').Integer} tagIndex\n * @param {import('../iterateJsdoc.js').Integer} sourceIndex\n * @param {import('../iterateJsdoc.js').Integer} spliceCount\n * @returns {void}\n */\n const createTokens = (tagIndex, sourceIndex, spliceCount) => {\n // console.log(sourceIndex, tagIndex, jsdoc.tags, jsdoc.source);\n const tokens = {\n number: sourceIndex + 1,\n source: '',\n tokens: {\n delimiter: '*',\n description: '',\n end: '',\n lineEnd: '',\n name: functionParameterName,\n newAdd: true,\n postDelimiter: ' ',\n postName: '',\n postTag: ' ',\n postType: type ? ' ' : '',\n start: jsdoc.source[sourceIndex].tokens.start,\n tag: `@${preferredTagName}`,\n type: type ?? '',\n },\n };\n\n /**\n * @type {(import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * newAdd?: true\n * })[]}\n */ (jsdoc.tags).splice(tagIndex, spliceCount, {\n description: '',\n inlineTags: [],\n name: functionParameterName,\n newAdd: true,\n optional: false,\n problems: [],\n source: [\n tokens,\n ],\n tag: preferredTagName,\n type: type ?? '',\n });\n const firstNumber = jsdoc.source[0].number;\n jsdoc.source.splice(sourceIndex, spliceCount, tokens);\n for (const [\n idx,\n src,\n ] of jsdoc.source.slice(sourceIndex).entries()) {\n src.number = firstNumber + sourceIndex + idx;\n }\n };\n\n const offset = jsdoc.source.findIndex(({\n tokens: {\n end,\n tag,\n },\n }) => {\n return tag || end;\n });\n if (remove) {\n createTokens(functionParameterIdx, offset + functionParameterIdx, 1);\n } else {\n const {\n foundIndex,\n tagLineCount: expectedIdx,\n } =\n findExpectedIndex(jsdoc.tags, functionParameterIdx);\n\n const firstParamLine = jsdoc.source.findIndex(({\n tokens,\n }) => {\n return tokens.tag === `@${preferredTagName}`;\n });\n const baseOffset = foundIndex > -1 || firstParamLine === -1 ?\n offset :\n firstParamLine;\n\n createTokens(expectedIdx, baseOffset + expectedIdx, 0);\n }\n };\n\n /**\n * @returns {void}\n */\n const fixer = () => {\n for (const missingTag of missingTags) {\n fix(missingTag);\n }\n };\n\n if (missingTags.length && jsdoc.source.length === 1) {\n utils.makeMultiline();\n }\n\n for (const {\n functionParameterName,\n } of missingTags) {\n utils.reportJSDoc(\n `Missing JSDoc @${preferredTagName} \"${functionParameterName}\" declaration.`,\n null,\n enableFixer ? fixer : null,\n );\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that all function parameters are documented with a `@param` tag.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n autoIncrementBase: {\n default: 0,\n description: `Numeric to indicate the number at which to begin auto-incrementing roots.\nDefaults to \\`0\\`.\n`,\n type: 'integer',\n },\n checkConstructors: {\n default: true,\n description: `A value indicating whether \\`constructor\\`s should be checked. Defaults to\n\\`true\\`.\n`,\n type: 'boolean',\n },\n checkDestructured: {\n default: true,\n description: 'Whether to require destructured properties. Defaults to `true`.',\n type: 'boolean',\n },\n checkDestructuredRoots: {\n default: true,\n description: `Whether to check the existence of a corresponding \\`@param\\` for root objects\nof destructured properties (e.g., that for \\`function ({a, b}) {}\\`, that there\nis something like \\`@param myRootObj\\` defined that can correspond to\nthe \\`{a, b}\\` object parameter).\n\nIf \\`checkDestructuredRoots\\` is \\`false\\`, \\`checkDestructured\\` will also be\nimplied to be \\`false\\` (i.e., the inside of the roots will not be checked\neither, e.g., it will also not complain if \\`a\\` or \\`b\\` do not have their own\ndocumentation). Defaults to \\`true\\`.\n`,\n type: 'boolean',\n },\n checkGetters: {\n default: false,\n description: 'A value indicating whether getters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkRestProperty: {\n default: false,\n description: `If set to \\`true\\`, will report (and add fixer insertions) for missing rest\nproperties. Defaults to \\`false\\`.\n\nIf set to \\`true\\`, note that you can still document the subproperties of the\nrest property using other jsdoc features, e.g., \\`@typedef\\`:\n\n\\`\\`\\`js\n/**\n * @typedef ExtraOptions\n * @property innerProp1\n * @property innerProp2\n */\n\n/**\n * @param cfg\n * @param cfg.num\n * @param {ExtraOptions} extra\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n\nSetting this option to \\`false\\` (the default) may be useful in cases where\nyou already have separate \\`@param\\` definitions for each of the properties\nwithin the rest property.\n\nFor example, with the option disabled, this will not give an error despite\n\\`extra\\` not having any definition:\n\n\\`\\`\\`js\n/**\n * @param cfg\n * @param cfg.num\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n\nNor will this:\n\n\\`\\`\\`js\n/**\n * @param cfg\n * @param cfg.num\n * @param cfg.innerProp1\n * @param cfg.innerProp2\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n`,\n type: 'boolean',\n },\n checkSetters: {\n default: false,\n description: 'A value indicating whether setters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkTypesPattern: {\n description: `When one specifies a type, unless it is of a generic type, like \\`object\\`\nor \\`array\\`, it may be considered unnecessary to have that object's\ndestructured components required, especially where generated docs will\nlink back to the specified type. For example:\n\n\\`\\`\\`js\n/**\n * @param {SVGRect} bbox - a SVGRect\n */\nexport const bboxToObj = function ({x, y, width, height}) {\n return {x, y, width, height};\n};\n\\`\\`\\`\n\nBy default \\`checkTypesPattern\\` is set to\n\\`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\\`,\nmeaning that destructuring will be required only if the type of the \\`@param\\`\n(the text between curly brackets) is a match for \"Object\" or \"Array\" (with or\nwithout initial caps), \"PlainObject\", or \"GenericObject\", \"GenericArray\" (or\nif no type is present). So in the above example, the lack of a match will\nmean that no complaint will be given about the undocumented destructured\nparameters.\n\nNote that the \\`/\\` delimiters are optional, but necessary to add flags.\n\nDefaults to using (only) the \\`v\\` flag, so to add your own flags, encapsulate\nyour expression as a string, but like a literal, e.g., \\`/^object$/vi\\`.\n\nYou could set this regular expression to a more expansive list, or you\ncould restrict it such that even types matching those strings would not\nneed destructuring.`,\n type: 'string',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). May be useful for adding such as\n\\`TSMethodSignature\\` in TypeScript or restricting the contexts\nwhich are checked.\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.\n`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Whether to enable the fixer. Defaults to `true`.',\n type: 'boolean',\n },\n enableRestElementFixer: {\n description: `Whether to enable the rest element fixer.\n\nThe fixer will automatically report/insert\n[JSDoc repeatable parameters](https://jsdoc.app/tags-param.html#multiple-types-and-repeatable-parameters)\nif missing.\n\n\\`\\`\\`js\n/**\n * @param {GenericArray} cfg\n * @param {number} cfg.\"0\"\n */\nfunction baar ([a, ...extra]) {\n //\n}\n\\`\\`\\`\n\n...becomes:\n\n\\`\\`\\`js\n/**\n * @param {GenericArray} cfg\n * @param {number} cfg.\"0\"\n * @param {...any} cfg.\"1\"\n */\nfunction baar ([a, ...extra]) {\n //\n}\n\\`\\`\\`\n\nNote that the type \\`any\\` is included since we don't know of any specific\ntype to use.\n\nDefaults to \\`true\\`.\n`,\n type: 'boolean',\n },\n enableRootFixer: {\n description: `Whether to enable the auto-adding of incrementing roots.\n\nThe default behavior of \\`true\\` is for \"root\" to be auto-inserted for missing\nroots, followed by a 0-based auto-incrementing number.\n\nSo for:\n\n\\`\\`\\`js\nfunction quux ({foo}, {bar}, {baz}) {\n}\n\\`\\`\\`\n\n...the default JSDoc that would be added if the fixer is enabled would be:\n\n\\`\\`\\`js\n/**\n* @param root0\n* @param root0.foo\n* @param root1\n* @param root1.bar\n* @param root2\n* @param root2.baz\n*/\n\\`\\`\\`\n\nHas no effect if \\`enableFixer\\` is set to \\`false\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document block\navoids the need for a \\`@param\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreWhenAllParamsMissing: {\n description: `Set to \\`true\\` to ignore reporting when all params are missing. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n interfaceExemptsParamsCheck: {\n description: `Set if you wish TypeScript interfaces to exempt checks for the existence of\n\\`@param\\`'s.\n\nWill check for a type defining the function itself (on a variable\ndeclaration) or if there is a single destructured object with a type.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n unnamedRootBase: {\n description: `An array of root names to use in the fixer when roots are missing. Defaults\nto \\`['root']\\`. Note that only when all items in the array besides the last\nare exhausted will auto-incrementing occur. So, with\n\\`unnamedRootBase: ['arg', 'config']\\`, the following:\n\n\\`\\`\\`js\nfunction quux ({foo}, [bar], {baz}) {\n}\n\\`\\`\\`\n\n...will get the following JSDoc block added:\n\n\\`\\`\\`js\n/**\n* @param arg\n* @param arg.foo\n* @param config0\n* @param config0.\"0\" (\\`bar\\`)\n* @param config1\n* @param config1.baz\n*/\n\\`\\`\\``,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n useDefaultObjectProperties: {\n description: `Set to \\`true\\` if you wish to expect documentation of properties on objects\nsupplied as default values. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n\n // We cannot cache comment nodes as the contexts may recur with the\n // same comment node but a different JS node, and we may need the different\n // JS node to ensure we iterate its context\n noTracking: true,\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMG,SAAS,GAAGA,CAACC,YAAY,EAAEC,YAAY,KAAK;EAChD;EACA,IAAIC,IAAI;EACR,IAAIC,GAAG,GAAGF,YAAY;EACtB,MAAMG,WAAW,GAAGJ,YAAY,CAACK,MAAM,IAAI,CAAC;EAC5C,IAAID,WAAW,EAAE;IACf,MAAME,IAAI,GAAGN,YAAY,CAAC,CAAC,CAAC;IAC5B,MAAMO,MAAM,GAAGJ,GAAG,EAA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mH,WAAW,EAAE,4EAA4E;UACzFjF,IAAI,EAAE;QACR,CAAC;QACDX,iBAAiB,EAAE;UACjBvB,OAAO,EAAE,KAAK;UACdmH,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWjF,IAAI,EAAE;QACR,CAAC;QACDgH,YAAY,EAAE;UACZlJ,OAAO,EAAE,KAAK;UACdmH,WAAW,EAAE,4EAA4E;UACzFjF,IAAI,EAAE;QACR,CAAC;QACDV,iBAAiB,EAAE;UACjB2F,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;UACRjF,IAAI,EAAE;QACR,CAAC;QACDiH,QAAQ,EAAE;UACRhC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWiC,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEnH,IAAI,EAAE;YACR,CAAC,EACD;cACE4G,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVO,OAAO,EAAE;kBACPpH,IAAI,EAAE;gBACR,CAAC;gBACDpB,OAAO,EAAE;kBACPoB,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDT,WAAW,EAAE;UACX0F,WAAW,EAAE,kDAAkD;UAC/DjF,IAAI,EAAE;QACR,CAAC;QACDR,sBAAsB,EAAE;UACtByF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWjF,IAAI,EAAE;QACR,CAAC;QACDP,eAAe,EAAE;UACfwF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;UAC1CjF,IAAI,EAAE;QACR,CAAC;QACDqH,UAAU,EAAE;UACVpC,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXiC,KAAK,EAAE;YACLlH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDN,0BAA0B,EAAE;UAC1BuF,WAAW,EAAE;AACzB,WAAW;UACCjF,IAAI,EAAE;QACR,CAAC;QACDL,2BAA2B,EAAE;UAC3BsF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,uBAAuB;UACXjF,IAAI,EAAE;QACR,CAAC;QACDJ,eAAe,EAAE;UACfqF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,KAAK,EAAE;YACLlH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDH,0BAA0B,EAAE;UAC1BoF,WAAW,EAAE;AACzB,mDAAmD;UACvCjF,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR,CAAC;EAED;EACA;EACA;EACAsH,UAAU,EAAE;AACd,CAAC,CAAC;AAAAC,MAAA,CAAA7I,OAAA,GAAAA,OAAA,CAAAZ,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"requireParam.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","rootNamer","desiredRoots","currentIndex","name","idx","incremented","length","base","suffix","shift","_default","exports","iterateJsdoc","context","jsdoc","node","utils","avoidDocs","hasTag","autoIncrementBase","checkDestructured","checkDestructuredRoots","checkRestProperty","checkTypesPattern","enableFixer","enableRestElementFixer","enableRootFixer","ignoreWhenAllParamsMissing","interfaceExemptsParamsCheck","unnamedRootBase","useDefaultObjectProperties","options","params","type","typeAnnotation","parent","id","preferredTagName","getPreferredTagName","tagName","functionParameterNames","getFunctionParameterNames","jsdocParameterNames","getJsdocTagsDeep","shallowJsdocParameterNames","filter","tag","includes","map","checkTypesRegex","getRegexFromString","missingTags","flattenedRoots","flattenRoots","names","paramIndex","hasParamIndex","cur","dropPathSegmentQuotes","String","getParamIndex","setParamIndex","entries","findExpectedIndex","jsdocTags","indexAtFunctionParams","remainingRoots","slice","foundIndex","findIndex","newAdd","some","remainingRoot","Array","isArray","tags","tagLineCount","source","tokens","end","nextRootName","namer","thisOffset","functionParameterIdx","functionParameterName","inc","matchedJsdoc","rootName","search","hasPropertyRest","hasRestElement","rests","notCheckingNames","paramName","find","fpn","emptyParamIdx","push","remove","fullParamName","notCheckingName","paramType","comparePaths","undefined","startsWith","funcParamName","restElement","fix","createTokens","tagIndex","sourceIndex","spliceCount","number","delimiter","description","lineEnd","postDelimiter","postName","postTag","postType","start","splice","inlineTags","optional","problems","firstNumber","src","offset","expectedIdx","firstParamLine","baseOffset","fixer","missingTag","makeMultiline","reportJSDoc","contextDefaults","meta","docs","url","fixable","schema","additionalProperties","properties","checkConstructors","checkGetters","checkSetters","contexts","items","anyOf","comment","exemptedBy","noTracking","module"],"sources":["../../src/rules/requireParam.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {[string, boolean, () => RootNamerReturn]} RootNamerReturn\n */\n\n/**\n * @param {string[]} desiredRoots\n * @param {number} currentIndex\n * @returns {RootNamerReturn}\n */\nconst rootNamer = (desiredRoots, currentIndex) => {\n /** @type {string} */\n let name;\n let idx = currentIndex;\n const incremented = desiredRoots.length <= 1;\n if (incremented) {\n const base = desiredRoots[0];\n const suffix = idx++;\n name = `${base}${suffix}`;\n } else {\n name = /** @type {string} */ (desiredRoots.shift());\n }\n\n return [\n name,\n incremented,\n () => {\n return rootNamer(desiredRoots, idx);\n },\n ];\n};\n\n/* eslint-disable complexity -- Temporary */\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n utils,\n}) => {\n /* eslint-enable complexity -- Temporary */\n if (utils.avoidDocs()) {\n return;\n }\n\n // Param type is specified by type in @type\n if (utils.hasTag('type')) {\n return;\n }\n\n const {\n autoIncrementBase = 0,\n checkDestructured = true,\n checkDestructuredRoots = true,\n checkRestProperty = false,\n checkTypesPattern = '/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/',\n enableFixer = true,\n enableRestElementFixer = true,\n enableRootFixer = true,\n ignoreWhenAllParamsMissing = false,\n interfaceExemptsParamsCheck = false,\n unnamedRootBase = [\n 'root',\n ],\n useDefaultObjectProperties = false,\n } = context.options[0] || {};\n\n if (interfaceExemptsParamsCheck) {\n if (node && 'params' in node && node.params.length === 1 &&\n node.params?.[0] && typeof node.params[0] === 'object' &&\n node.params[0].type === 'ObjectPattern' &&\n 'typeAnnotation' in node.params[0] && node.params[0].typeAnnotation\n ) {\n return;\n }\n\n if (node && node.parent.type === 'VariableDeclarator' &&\n 'typeAnnotation' in node.parent.id && node.parent.id.typeAnnotation) {\n return;\n }\n }\n\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n if (!preferredTagName) {\n return;\n }\n\n const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties);\n if (!functionParameterNames.length) {\n return;\n }\n\n const jsdocParameterNames =\n /**\n * @type {{\n * idx: import('../iterateJsdoc.js').Integer;\n * name: string;\n * type: string;\n * }[]}\n */ (utils.getJsdocTagsDeep(preferredTagName));\n\n if (ignoreWhenAllParamsMissing && !jsdocParameterNames.length) {\n return;\n }\n\n const shallowJsdocParameterNames = jsdocParameterNames.filter((tag) => {\n return !tag.name.includes('.');\n }).map((tag, idx) => {\n return {\n ...tag,\n idx,\n };\n });\n\n const checkTypesRegex = utils.getRegexFromString(checkTypesPattern);\n\n /**\n * @type {{\n * functionParameterIdx: import('../iterateJsdoc.js').Integer,\n * functionParameterName: string,\n * inc: boolean|undefined,\n * remove?: true,\n * type?: string|undefined\n * }[]}\n */\n const missingTags = [];\n const flattenedRoots = utils.flattenRoots(functionParameterNames).names;\n\n /**\n * @type {{\n * [key: string]: import('../iterateJsdoc.js').Integer\n * }}\n */\n const paramIndex = {};\n\n /**\n * @param {string} cur\n * @returns {boolean}\n */\n const hasParamIndex = (cur) => {\n return utils.dropPathSegmentQuotes(String(cur)) in paramIndex;\n };\n\n /**\n *\n * @param {string|number|undefined} cur\n * @returns {import('../iterateJsdoc.js').Integer}\n */\n const getParamIndex = (cur) => {\n return paramIndex[utils.dropPathSegmentQuotes(String(cur))];\n };\n\n /**\n *\n * @param {string} cur\n * @param {import('../iterateJsdoc.js').Integer} idx\n * @returns {void}\n */\n const setParamIndex = (cur, idx) => {\n paramIndex[utils.dropPathSegmentQuotes(String(cur))] = idx;\n };\n\n for (const [\n idx,\n cur,\n ] of flattenedRoots.entries()) {\n setParamIndex(cur, idx);\n }\n\n /**\n *\n * @param {(import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * newAdd?: boolean\n * })[]} jsdocTags\n * @param {import('../iterateJsdoc.js').Integer} indexAtFunctionParams\n * @returns {{\n * foundIndex: import('../iterateJsdoc.js').Integer,\n * tagLineCount: import('../iterateJsdoc.js').Integer,\n * }}\n */\n const findExpectedIndex = (jsdocTags, indexAtFunctionParams) => {\n const remainingRoots = functionParameterNames.slice(indexAtFunctionParams || 0);\n const foundIndex = jsdocTags.findIndex(({\n name,\n newAdd,\n }) => {\n return !newAdd && remainingRoots.some((remainingRoot) => {\n if (Array.isArray(remainingRoot)) {\n return (\n /**\n * @type {import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string|undefined;\n * }}\n */ (remainingRoot[1]).names.includes(name)\n );\n }\n\n if (typeof remainingRoot === 'object') {\n return name === remainingRoot.name;\n }\n\n return name === remainingRoot;\n });\n });\n\n const tags = foundIndex > -1 ?\n jsdocTags.slice(0, foundIndex) :\n jsdocTags.filter(({\n tag,\n }) => {\n return tag === preferredTagName;\n });\n\n let tagLineCount = 0;\n for (const {\n source,\n } of tags) {\n for (const {\n tokens: {\n end,\n },\n } of source) {\n if (!end) {\n tagLineCount++;\n }\n }\n }\n\n return {\n foundIndex,\n tagLineCount,\n };\n };\n\n let [\n nextRootName,\n incremented,\n namer,\n ] = rootNamer([\n ...unnamedRootBase,\n ], autoIncrementBase);\n\n const thisOffset = functionParameterNames[0] === 'this' ? 1 : 0;\n\n for (const [\n functionParameterIdx,\n functionParameterName,\n ] of functionParameterNames.entries()) {\n let inc;\n if (Array.isArray(functionParameterName)) {\n const matchedJsdoc = shallowJsdocParameterNames[functionParameterIdx - thisOffset];\n\n /** @type {string} */\n let rootName;\n if (functionParameterName[0]) {\n rootName = functionParameterName[0];\n } else if (matchedJsdoc && matchedJsdoc.name) {\n rootName = matchedJsdoc.name;\n if (matchedJsdoc.type && matchedJsdoc.type.search(checkTypesRegex) === -1) {\n continue;\n }\n } else {\n rootName = nextRootName;\n inc = incremented;\n }\n\n [\n nextRootName,\n incremented,\n namer,\n ] = namer();\n\n const {\n hasPropertyRest,\n hasRestElement,\n names,\n rests,\n } = /**\n * @type {import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string | undefined;\n * }}\n */ (functionParameterName[1]);\n const notCheckingNames = [];\n if (!enableRestElementFixer && hasRestElement) {\n continue;\n }\n\n if (!checkDestructuredRoots) {\n continue;\n }\n\n for (const [\n idx,\n paramName,\n ] of names.entries()) {\n // Add root if the root name is not in the docs (and is not already\n // in the tags to be fixed)\n if (!jsdocParameterNames.find(({\n name,\n }) => {\n return name === rootName;\n }) && !missingTags.find(({\n functionParameterName: fpn,\n }) => {\n return fpn === rootName;\n })) {\n const emptyParamIdx = jsdocParameterNames.findIndex(({\n name,\n }) => {\n return !name;\n });\n\n if (emptyParamIdx > -1) {\n missingTags.push({\n functionParameterIdx: emptyParamIdx,\n functionParameterName: rootName,\n inc,\n remove: true,\n });\n } else {\n missingTags.push({\n functionParameterIdx: hasParamIndex(rootName) ?\n getParamIndex(rootName) :\n getParamIndex(paramName),\n functionParameterName: rootName,\n inc,\n });\n }\n }\n\n if (!checkDestructured) {\n continue;\n }\n\n if (!checkRestProperty && rests[idx]) {\n continue;\n }\n\n const fullParamName = `${rootName}.${paramName}`;\n\n const notCheckingName = jsdocParameterNames.find(({\n name,\n type: paramType,\n }) => {\n return utils.comparePaths(name)(fullParamName) && paramType.search(checkTypesRegex) === -1 && paramType !== '';\n });\n\n if (notCheckingName !== undefined) {\n notCheckingNames.push(notCheckingName.name);\n }\n\n if (notCheckingNames.find((name) => {\n return fullParamName.startsWith(name);\n })) {\n continue;\n }\n\n if (jsdocParameterNames && !jsdocParameterNames.find(({\n name,\n }) => {\n return utils.comparePaths(name)(fullParamName);\n })) {\n missingTags.push({\n functionParameterIdx: getParamIndex(\n functionParameterName[0] ? fullParamName : paramName,\n ),\n functionParameterName: fullParamName,\n inc,\n type: hasRestElement && !hasPropertyRest ? '{...any}' : undefined,\n });\n }\n }\n\n continue;\n }\n\n /** @type {string} */\n let funcParamName;\n let type;\n if (typeof functionParameterName === 'object') {\n if (!enableRestElementFixer && functionParameterName.restElement) {\n continue;\n }\n\n funcParamName = /** @type {string} */ (functionParameterName.name);\n type = '{...any}';\n } else {\n funcParamName = /** @type {string} */ (functionParameterName);\n }\n\n if (jsdocParameterNames && !jsdocParameterNames.find(({\n name,\n }) => {\n return name === funcParamName;\n }) && funcParamName !== 'this') {\n missingTags.push({\n functionParameterIdx: getParamIndex(funcParamName),\n functionParameterName: funcParamName,\n inc,\n type,\n });\n }\n }\n\n /**\n *\n * @param {{\n * functionParameterIdx: import('../iterateJsdoc.js').Integer,\n * functionParameterName: string,\n * remove?: true,\n * inc?: boolean,\n * type?: string\n * }} cfg\n */\n const fix = ({\n functionParameterIdx,\n functionParameterName,\n inc,\n remove,\n type,\n }) => {\n if (inc && !enableRootFixer) {\n return;\n }\n\n /**\n *\n * @param {import('../iterateJsdoc.js').Integer} tagIndex\n * @param {import('../iterateJsdoc.js').Integer} sourceIndex\n * @param {import('../iterateJsdoc.js').Integer} spliceCount\n * @returns {void}\n */\n const createTokens = (tagIndex, sourceIndex, spliceCount) => {\n // console.log(sourceIndex, tagIndex, jsdoc.tags, jsdoc.source);\n const tokens = {\n number: sourceIndex + 1,\n source: '',\n tokens: {\n delimiter: '*',\n description: '',\n end: '',\n lineEnd: '',\n name: functionParameterName,\n newAdd: true,\n postDelimiter: ' ',\n postName: '',\n postTag: ' ',\n postType: type ? ' ' : '',\n start: jsdoc.source[sourceIndex].tokens.start,\n tag: `@${preferredTagName}`,\n type: type ?? '',\n },\n };\n\n /**\n * @type {(import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * newAdd?: true\n * })[]}\n */ (jsdoc.tags).splice(tagIndex, spliceCount, {\n description: '',\n inlineTags: [],\n name: functionParameterName,\n newAdd: true,\n optional: false,\n problems: [],\n source: [\n tokens,\n ],\n tag: preferredTagName,\n type: type ?? '',\n });\n const firstNumber = jsdoc.source[0].number;\n jsdoc.source.splice(sourceIndex, spliceCount, tokens);\n for (const [\n idx,\n src,\n ] of jsdoc.source.slice(sourceIndex).entries()) {\n src.number = firstNumber + sourceIndex + idx;\n }\n };\n\n const offset = jsdoc.source.findIndex(({\n tokens: {\n end,\n tag,\n },\n }) => {\n return tag || end;\n });\n if (remove) {\n createTokens(functionParameterIdx, offset + functionParameterIdx, 1);\n } else {\n const {\n foundIndex,\n tagLineCount: expectedIdx,\n } =\n findExpectedIndex(jsdoc.tags, functionParameterIdx);\n\n const firstParamLine = jsdoc.source.findIndex(({\n tokens,\n }) => {\n return tokens.tag === `@${preferredTagName}`;\n });\n const baseOffset = foundIndex > -1 || firstParamLine === -1 ?\n offset :\n firstParamLine;\n\n createTokens(expectedIdx, baseOffset + expectedIdx, 0);\n }\n };\n\n /**\n * @returns {void}\n */\n const fixer = () => {\n for (const missingTag of missingTags) {\n fix(missingTag);\n }\n };\n\n if (missingTags.length && jsdoc.source.length === 1) {\n utils.makeMultiline();\n }\n\n for (const {\n functionParameterName,\n } of missingTags) {\n utils.reportJSDoc(\n `Missing JSDoc @${preferredTagName} \"${functionParameterName}\" declaration.`,\n null,\n enableFixer ? fixer : null,\n );\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that all function parameters are documented with a `@param` tag.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n autoIncrementBase: {\n default: 0,\n description: `Numeric to indicate the number at which to begin auto-incrementing roots.\nDefaults to \\`0\\`.`,\n type: 'integer',\n },\n checkConstructors: {\n default: true,\n description: `A value indicating whether \\`constructor\\`s should be checked. Defaults to\n\\`true\\`.`,\n type: 'boolean',\n },\n checkDestructured: {\n default: true,\n description: 'Whether to require destructured properties. Defaults to `true`.',\n type: 'boolean',\n },\n checkDestructuredRoots: {\n default: true,\n description: `Whether to check the existence of a corresponding \\`@param\\` for root objects\nof destructured properties (e.g., that for \\`function ({a, b}) {}\\`, that there\nis something like \\`@param myRootObj\\` defined that can correspond to\nthe \\`{a, b}\\` object parameter).\n\nIf \\`checkDestructuredRoots\\` is \\`false\\`, \\`checkDestructured\\` will also be\nimplied to be \\`false\\` (i.e., the inside of the roots will not be checked\neither, e.g., it will also not complain if \\`a\\` or \\`b\\` do not have their own\ndocumentation). Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n checkGetters: {\n default: false,\n description: 'A value indicating whether getters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkRestProperty: {\n default: false,\n description: `If set to \\`true\\`, will report (and add fixer insertions) for missing rest\nproperties. Defaults to \\`false\\`.\n\nIf set to \\`true\\`, note that you can still document the subproperties of the\nrest property using other jsdoc features, e.g., \\`@typedef\\`:\n\n\\`\\`\\`js\n/**\n * @typedef ExtraOptions\n * @property innerProp1\n * @property innerProp2\n */\n\n/**\n * @param cfg\n * @param cfg.num\n * @param {ExtraOptions} extra\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n\nSetting this option to \\`false\\` (the default) may be useful in cases where\nyou already have separate \\`@param\\` definitions for each of the properties\nwithin the rest property.\n\nFor example, with the option disabled, this will not give an error despite\n\\`extra\\` not having any definition:\n\n\\`\\`\\`js\n/**\n * @param cfg\n * @param cfg.num\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n\nNor will this:\n\n\\`\\`\\`js\n/**\n * @param cfg\n * @param cfg.num\n * @param cfg.innerProp1\n * @param cfg.innerProp2\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\``,\n type: 'boolean',\n },\n checkSetters: {\n default: false,\n description: 'A value indicating whether setters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkTypesPattern: {\n description: `When one specifies a type, unless it is of a generic type, like \\`object\\`\nor \\`array\\`, it may be considered unnecessary to have that object's\ndestructured components required, especially where generated docs will\nlink back to the specified type. For example:\n\n\\`\\`\\`js\n/**\n * @param {SVGRect} bbox - a SVGRect\n */\nexport const bboxToObj = function ({x, y, width, height}) {\n return {x, y, width, height};\n};\n\\`\\`\\`\n\nBy default \\`checkTypesPattern\\` is set to\n\\`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\\`,\nmeaning that destructuring will be required only if the type of the \\`@param\\`\n(the text between curly brackets) is a match for \"Object\" or \"Array\" (with or\nwithout initial caps), \"PlainObject\", or \"GenericObject\", \"GenericArray\" (or\nif no type is present). So in the above example, the lack of a match will\nmean that no complaint will be given about the undocumented destructured\nparameters.\n\nNote that the \\`/\\` delimiters are optional, but necessary to add flags.\n\nDefaults to using (only) the \\`v\\` flag, so to add your own flags, encapsulate\nyour expression as a string, but like a literal, e.g., \\`/^object$/vi\\`.\n\nYou could set this regular expression to a more expansive list, or you\ncould restrict it such that even types matching those strings would not\nneed destructuring.`,\n type: 'string',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). May be useful for adding such as\n\\`TSMethodSignature\\` in TypeScript or restricting the contexts\nwhich are checked.\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Whether to enable the fixer. Defaults to `true`.',\n type: 'boolean',\n },\n enableRestElementFixer: {\n description: `Whether to enable the rest element fixer.\n\nThe fixer will automatically report/insert\n[JSDoc repeatable parameters](https://jsdoc.app/tags-param.html#multiple-types-and-repeatable-parameters)\nif missing.\n\n\\`\\`\\`js\n/**\n * @param {GenericArray} cfg\n * @param {number} cfg.\"0\"\n */\nfunction baar ([a, ...extra]) {\n //\n}\n\\`\\`\\`\n\n...becomes:\n\n\\`\\`\\`js\n/**\n * @param {GenericArray} cfg\n * @param {number} cfg.\"0\"\n * @param {...any} cfg.\"1\"\n */\nfunction baar ([a, ...extra]) {\n //\n}\n\\`\\`\\`\n\nNote that the type \\`any\\` is included since we don't know of any specific\ntype to use.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n enableRootFixer: {\n description: `Whether to enable the auto-adding of incrementing roots.\n\nThe default behavior of \\`true\\` is for \"root\" to be auto-inserted for missing\nroots, followed by a 0-based auto-incrementing number.\n\nSo for:\n\n\\`\\`\\`js\nfunction quux ({foo}, {bar}, {baz}) {\n}\n\\`\\`\\`\n\n...the default JSDoc that would be added if the fixer is enabled would be:\n\n\\`\\`\\`js\n/**\n* @param root0\n* @param root0.foo\n* @param root1\n* @param root1.bar\n* @param root2\n* @param root2.baz\n*/\n\\`\\`\\`\n\nHas no effect if \\`enableFixer\\` is set to \\`false\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document block\navoids the need for a \\`@param\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreWhenAllParamsMissing: {\n description: `Set to \\`true\\` to ignore reporting when all params are missing. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n interfaceExemptsParamsCheck: {\n description: `Set if you wish TypeScript interfaces to exempt checks for the existence of\n\\`@param\\`'s.\n\nWill check for a type defining the function itself (on a variable\ndeclaration) or if there is a single destructured object with a type.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n unnamedRootBase: {\n description: `An array of root names to use in the fixer when roots are missing. Defaults\nto \\`['root']\\`. Note that only when all items in the array besides the last\nare exhausted will auto-incrementing occur. So, with\n\\`unnamedRootBase: ['arg', 'config']\\`, the following:\n\n\\`\\`\\`js\nfunction quux ({foo}, [bar], {baz}) {\n}\n\\`\\`\\`\n\n...will get the following JSDoc block added:\n\n\\`\\`\\`js\n/**\n* @param arg\n* @param arg.foo\n* @param config0\n* @param config0.\"0\" (\\`bar\\`)\n* @param config1\n* @param config1.baz\n*/\n\\`\\`\\``,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n useDefaultObjectProperties: {\n description: `Set to \\`true\\` if you wish to expect documentation of properties on objects\nsupplied as default values. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n\n // We cannot cache comment nodes as the contexts may recur with the\n // same comment node but a different JS node, and we may need the different\n // JS node to ensure we iterate its context\n noTracking: true,\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMG,SAAS,GAAGA,CAACC,YAAY,EAAEC,YAAY,KAAK;EAChD;EACA,IAAIC,IAAI;EACR,IAAIC,GAAG,GAAGF,YAAY;EACtB,MAAMG,WAAW,GAAGJ,YAAY,CAACK,MAAM,IAAI,CAAC;EAC5C,IAAID,WAAW,EAAE;IACf,MAAME,IAAI,GAAGN,YAAY,CAAC,CAAC,CAAC;IAC5B,MAAMO,MAAM,GAAGJ,GAAG,EAAE;IACpBD,IAAI,GAAG,GAAGI,IAAI,GAAGC,MAAM,EAAE;EAC3B,CAAC,MAAM;IACLL,IAAI,GAAG,qBAAuBF,YAAY,CAACQ,KAAK,CAAC,CAAE;EACrD;EAEA,OAAO,CACLN,IAAI,EACJE,WAAW,EACX,MAAM;IACJ,OAAOL,SAAS,CAACC,YAAY,EAAEG,GAAG,CAAC;EACrC,CAAC,CACF;AACH,CAAC;;AAED;AAAA,IAAAM,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GACe,IAAAa,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,IAAI;EACJC;AACF,CAAC,KAAK;EACJ;EACA,IAAIA,KAAK,CAACC,SAAS,CAAC,CAAC,EAAE;IACrB;EACF;;EAEA;EACA,IAAID,KAAK,CAACE,MAAM,CAAC,MAAM,CA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W,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;UACRjF,IAAI,EAAE;QACR,CAAC;QACDiH,QAAQ,EAAE;UACRhC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClDiC,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEnH,IAAI,EAAE;YACR,CAAC,EACD;cACE4G,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVO,OAAO,EAAE;kBACPpH,IAAI,EAAE;gBACR,CAAC;gBACDpB,OAAO,EAAE;kBACPoB,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDT,WAAW,EAAE;UACX0F,WAAW,EAAE,kDAAkD;UAC/DjF,IAAI,EAAE;QACR,CAAC;QACDR,sBAAsB,EAAE;UACtByF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACVjF,IAAI,EAAE;QACR,CAAC;QACDP,eAAe,EAAE;UACfwF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;UAC1CjF,IAAI,EAAE;QACR,CAAC;QACDqH,UAAU,EAAE;UACVpC,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXiC,KAAK,EAAE;YACLlH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDN,0BAA0B,EAAE;UAC1BuF,WAAW,EAAE;AACzB,WAAW;UACCjF,IAAI,EAAE;QACR,CAAC;QACDL,2BAA2B,EAAE;UAC3BsF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,uBAAuB;UACXjF,IAAI,EAAE;QACR,CAAC;QACDJ,eAAe,EAAE;UACfqF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,KAAK,EAAE;YACLlH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDH,0BAA0B,EAAE;UAC1BoF,WAAW,EAAE;AACzB,mDAAmD;UACvCjF,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR,CAAC;EAED;EACA;EACA;EACAsH,UAAU,EAAE;AACd,CAAC,CAAC;AAAAC,MAAA,CAAA7I,OAAA,GAAAA,OAAA,CAAAZ,OAAA","ignoreList":[]}
@@ -39,8 +39,7 @@ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
39
39
  \`@method\`) (including those associated with an \`@interface\`).
40
40
 
41
41
  See the ["AST and Selectors"](../#advanced-ast-and-selectors)
42
- section of our Advanced docs for more on the expected format.
43
- `,
42
+ section of our Advanced docs for more on the expected format.`,
44
43
  items: {
45
44
  anyOf: [{
46
45
  type: 'string'
@@ -1 +1 @@
1
- {"version":3,"file":"requireParamName.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","report","utils","forEachPreferredTag","jsdocParameter","targetTagName","tag","name","type","contextDefaults","meta","docs","description","url","schema","additionalProperties","properties","contexts","items","anyOf","comment","context","module"],"sources":["../../src/rules/requireParamName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n utils.forEachPreferredTag('param', (jsdocParameter, targetTagName) => {\n if (jsdocParameter.tag && jsdocParameter.name === '') {\n report(\n `There must be an identifier after @${targetTagName} ${jsdocParameter.type === '' ? 'type' : 'tag'}.`,\n null,\n jsdocParameter,\n );\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that all `@param` tags have names.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-name.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.\n`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,MAAM;EACNC;AACF,CAAC,KAAK;EACJA,KAAK,CAACC,mBAAmB,CAAC,OAAO,EAAE,CAACC,cAAc,EAAEC,aAAa,KAAK;IACpE,IAAID,cAAc,CAACE,GAAG,IAAIF,cAAc,CAACG,IAAI,KAAK,EAAE,EAAE;MACpDN,MAAM,CACJ,sCAAsCI,aAAa,IAAID,cAAc,CAACI,IAAI,KAAK,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,EACrG,IAAI,EACJJ,cACF,CAAC;IACH;EACF,CAAC,CAAC;AACJ,CAAC,EAAE;EACDK,eAAe,EAAE,IAAI;EACrBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,6CAA6C;MAC1DC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,QAAQ,EAAE;UACRL,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWM,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEX,IAAI,EAAE;YACR,CAAC,EACD;cACEO,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVI,OAAO,EAAE;kBACPZ,IAAI,EAAE;gBACR,CAAC;gBACDa,OAAO,EAAE;kBACPb,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAc,MAAA,CAAAvB,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"requireParamName.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","report","utils","forEachPreferredTag","jsdocParameter","targetTagName","tag","name","type","contextDefaults","meta","docs","description","url","schema","additionalProperties","properties","contexts","items","anyOf","comment","context","module"],"sources":["../../src/rules/requireParamName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n utils.forEachPreferredTag('param', (jsdocParameter, targetTagName) => {\n if (jsdocParameter.tag && jsdocParameter.name === '') {\n report(\n `There must be an identifier after @${targetTagName} ${jsdocParameter.type === '' ? 'type' : 'tag'}.`,\n null,\n jsdocParameter,\n );\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that all `@param` tags have names.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-name.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,C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@ -227,8 +227,7 @@ otherwise noted):
227
227
  - \`ancestorsOnly\` - Optimization to only check node ancestors to check if node is exported
228
228
  - \`esm\` - ESM exports are checked for \`@returns\` JSDoc comments (Defaults to \`true\`)
229
229
  - \`cjs\` - CommonJS exports are checked for \`@returns\` JSDoc comments (Defaults to \`true\`)
230
- - \`window\` - Window global exports are checked for \`@returns\` JSDoc comments
231
- `,
230
+ - \`window\` - Window global exports are checked for \`@returns\` JSDoc comments`,
232
231
  oneOf: [{
233
232
  default: false,
234
233
  type: 'boolean'
@@ -1 +1 @@
1
- {"version":3,"file":"requireReturns.cjs","names":["_exportParser","_interopRequireDefault","require","_iterateJsdoc","e","__esModule","default","canSkip","utils","hasATag","avoidDocs","_default","exports","iterateJsdoc","context","info","comment","node","report","settings","contexts","enableFixer","forceRequireReturn","forceReturnsWithAsync","publicOnly","options","forceRequireReturnContext","foundContext","findContext","tagName","getPreferredTagName","tags","getTags","length","iteratingFunction","isIteratingFunction","tag","missingReturnTag","shouldReport","opt","ancestorsOnly","Boolean","esm","initModuleExports","cjs","initWindow","window","sourceCode","getSourceCode","exported","exportParser","isUncommentedExport","isVirtualFunction","isAsync","hasTag","hasValueOrExecutorHasNonEmptyResolveValue","reportJSDoc","addTag","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","checkConstructors","type","checkGetters","items","anyOf","exemptedBy","oneOf","module"],"sources":["../../src/rules/requireReturns.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * We can skip checking for a return value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n *\n * In either of these cases the return value is optional or not defined.\n * @param {import('../iterateJsdoc.js').Utils} utils\n * a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean}\n * true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not an error if it declares a return value but does not implement it.\n 'abstract',\n 'virtual',\n\n // Constructors do not have a return value by definition (https://jsdoc.app/tags-class.html)\n // So we can bail out here, too.\n 'class',\n 'constructor',\n\n // Return type is specified by type in @type\n 'type',\n\n // This seems to imply a class as well\n 'interface',\n ]) ||\n utils.avoidDocs();\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n contexts,\n enableFixer = false,\n forceRequireReturn = false,\n forceReturnsWithAsync = false,\n publicOnly = false,\n } = context.options[0] || {};\n\n // A preflight check. We do not need to run a deep check\n // in case the @returns comment is optional or undefined.\n if (canSkip(utils)) {\n return;\n }\n\n /** @type {boolean|undefined} */\n let forceRequireReturnContext;\n if (contexts) {\n const {\n foundContext,\n } = utils.findContext(contexts, comment);\n if (typeof foundContext === 'object') {\n forceRequireReturnContext = foundContext.forceRequireReturn;\n }\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n }\n\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingReturnTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingReturnTag) {\n return false;\n }\n\n if (publicOnly) {\n /** @type {import('./requireJsdoc.js').RequireJsdocOpts} */\n const opt = {\n ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),\n esm: Boolean(publicOnly?.esm ?? true),\n initModuleExports: Boolean(publicOnly?.cjs ?? true),\n initWindow: Boolean(publicOnly?.window ?? false),\n };\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const exported = exportParser.isUncommentedExport(\n /** @type {import('eslint').Rule.Node} */ (node), sourceCode, opt, settings,\n );\n\n if (!exported) {\n return false;\n }\n }\n\n if ((forceRequireReturn || forceRequireReturnContext) && (\n iteratingFunction || utils.isVirtualFunction()\n )) {\n return true;\n }\n\n const isAsync = !iteratingFunction && utils.hasTag('async') ||\n iteratingFunction && utils.isAsync();\n\n if (forceReturnsWithAsync && isAsync) {\n return true;\n }\n\n return iteratingFunction && utils.hasValueOrExecutorHasNonEmptyResolveValue(\n forceReturnsWithAsync,\n );\n };\n\n if (shouldReport()) {\n utils.reportJSDoc(`Missing JSDoc @${tagName} declaration.`, null, enableFixer ? () => {\n utils.addTag(tagName);\n } : null);\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that returns are documented with `@returns`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: false,\n description: `A value indicating whether \\`constructor\\`s should\nbe checked for \\`@returns\\` tags. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n checkGetters: {\n default: true,\n description: `Boolean to determine whether getter methods should\nbe checked for \\`@returns\\` tags. Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`). This\nrule will only apply on non-default contexts when there is such a tag\npresent and the \\`forceRequireReturn\\` option is set or if the\n\\`forceReturnsWithAsync\\` option is set with a present \\`@async\\` tag\n(since we are not checking against the actual \\`return\\` values in these\ncases).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n forceRequireReturn: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: `Whether to enable the fixer to add a blank \\`@returns\\`.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the\ndocument block avoids the need for a \\`@returns\\`. Defaults to an array\nwith \\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n forceRequireReturn: {\n default: false,\n description: `Set to \\`true\\` to always insist on\n\\`@returns\\` documentation regardless of implicit or explicit \\`return\\`'s\nin the function. May be desired to flag that a project is aware of an\n\\`undefined\\`/\\`void\\` return. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n forceReturnsWithAsync: {\n default: false,\n description: `By default \\`async\\` functions that do not explicitly\nreturn a value pass this rule as an \\`async\\` function will always return a\n\\`Promise\\`, even if the \\`Promise\\` resolves to void. You can force all\n\\`async\\` functions (including ones with an explicit \\`Promise\\` but no\ndetected non-\\`undefined\\` \\`resolve\\` value) to require \\`@return\\`\ndocumentation by setting \\`forceReturnsWithAsync\\` to \\`true\\` on the options\nobject. This may be useful for flagging that there has been consideration\nof return type. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n publicOnly: {\n description: `This option will insist that missing \\`@returns\\` are only reported for\nfunction bodies / class declarations that are exported from the module.\nMay be a boolean or object. If set to \\`true\\`, the defaults below will be\nused. If unset, \\`@returns\\` reporting will not be limited to exports.\n\nThis object supports the following optional boolean keys (\\`false\\` unless\notherwise noted):\n\n- \\`ancestorsOnly\\` - Optimization to only check node ancestors to check if node is exported\n- \\`esm\\` - ESM exports are checked for \\`@returns\\` JSDoc comments (Defaults to \\`true\\`)\n- \\`cjs\\` - CommonJS exports are checked for \\`@returns\\` JSDoc comments (Defaults to \\`true\\`)\n- \\`window\\` - Window global exports are checked for \\`@returns\\` JSDoc comments\n`,\n oneOf: [\n {\n default: false,\n type: 'boolean',\n },\n {\n additionalProperties: false,\n default: {},\n properties: {\n ancestorsOnly: {\n type: 'boolean',\n },\n cjs: {\n type: 'boolean',\n },\n esm: {\n type: 'boolean',\n },\n window: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAIC,KAAK,IAAK;EACzB,OAAOA,KAAK,CAACC,OAAO,CAAC;EACnB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,aAAa;EAEb;EACA,MAAM;EAEN;EACA,WAAW,CACZ,CAAC,IACAD,KAAK,CAACE,SAAS,CAAC,CAAC;AACrB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEa,IAAAO,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI,EAAE;IACJC;EACF,CAAC;EACDC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRX;AACF,CAAC,KAAK;EACJ,MAAM;IACJY,QAAQ;IACRC,WAAW,GAAG,KAAK;IACnBC,kBAAkB,GAAG,KAAK;IAC1BC,qBAAqB,GAAG,KAAK;IAC7BC,UAAU,GAAG;EACf,CAAC,GAAGV,OAA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWY,KAAK,EAAE,CACL;YACEnE,OAAO,EAAE,KAAK;YACd8D,IAAI,EAAE;UACR,CAAC,EACD;YACEH,oBAAoB,EAAE,KAAK;YAC3B3D,OAAO,EAAE,CAAC,CAAC;YACX4D,UAAU,EAAE;cACV1B,aAAa,EAAE;gBACb4B,IAAI,EAAE;cACR,CAAC;cACDxB,GAAG,EAAE;gBACHwB,IAAI,EAAE;cACR,CAAC;cACD1B,GAAG,EAAE;gBACH0B,IAAI,EAAE;cACR,CAAC;cACDtB,MAAM,EAAE;gBACNsB,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAA9D,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"requireReturns.cjs","names":["_exportParser","_interopRequireDefault","require","_iterateJsdoc","e","__esModule","default","canSkip","utils","hasATag","avoidDocs","_default","exports","iterateJsdoc","context","info","comment","node","report","settings","contexts","enableFixer","forceRequireReturn","forceReturnsWithAsync","publicOnly","options","forceRequireReturnContext","foundContext","findContext","tagName","getPreferredTagName","tags","getTags","length","iteratingFunction","isIteratingFunction","tag","missingReturnTag","shouldReport","opt","ancestorsOnly","Boolean","esm","initModuleExports","cjs","initWindow","window","sourceCode","getSourceCode","exported","exportParser","isUncommentedExport","isVirtualFunction","isAsync","hasTag","hasValueOrExecutorHasNonEmptyResolveValue","reportJSDoc","addTag","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","checkConstructors","type","checkGetters","items","anyOf","exemptedBy","oneOf","module"],"sources":["../../src/rules/requireReturns.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * We can skip checking for a return value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n *\n * In either of these cases the return value is optional or not defined.\n * @param {import('../iterateJsdoc.js').Utils} utils\n * a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean}\n * true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not an error if it declares a return value but does not implement it.\n 'abstract',\n 'virtual',\n\n // Constructors do not have a return value by definition (https://jsdoc.app/tags-class.html)\n // So we can bail out here, too.\n 'class',\n 'constructor',\n\n // Return type is specified by type in @type\n 'type',\n\n // This seems to imply a class as well\n 'interface',\n ]) ||\n utils.avoidDocs();\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n contexts,\n enableFixer = false,\n forceRequireReturn = false,\n forceReturnsWithAsync = false,\n publicOnly = false,\n } = context.options[0] || {};\n\n // A preflight check. We do not need to run a deep check\n // in case the @returns comment is optional or undefined.\n if (canSkip(utils)) {\n return;\n }\n\n /** @type {boolean|undefined} */\n let forceRequireReturnContext;\n if (contexts) {\n const {\n foundContext,\n } = utils.findContext(contexts, comment);\n if (typeof foundContext === 'object') {\n forceRequireReturnContext = foundContext.forceRequireReturn;\n }\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n }\n\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingReturnTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingReturnTag) {\n return false;\n }\n\n if (publicOnly) {\n /** @type {import('./requireJsdoc.js').RequireJsdocOpts} */\n const opt = {\n ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),\n esm: Boolean(publicOnly?.esm ?? true),\n initModuleExports: Boolean(publicOnly?.cjs ?? true),\n initWindow: Boolean(publicOnly?.window ?? false),\n };\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const exported = exportParser.isUncommentedExport(\n /** @type {import('eslint').Rule.Node} */ (node), sourceCode, opt, settings,\n );\n\n if (!exported) {\n return false;\n }\n }\n\n if ((forceRequireReturn || forceRequireReturnContext) && (\n iteratingFunction || utils.isVirtualFunction()\n )) {\n return true;\n }\n\n const isAsync = !iteratingFunction && utils.hasTag('async') ||\n iteratingFunction && utils.isAsync();\n\n if (forceReturnsWithAsync && isAsync) {\n return true;\n }\n\n return iteratingFunction && utils.hasValueOrExecutorHasNonEmptyResolveValue(\n forceReturnsWithAsync,\n );\n };\n\n if (shouldReport()) {\n utils.reportJSDoc(`Missing JSDoc @${tagName} declaration.`, null, enableFixer ? () => {\n utils.addTag(tagName);\n } : null);\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that returns are documented with `@returns`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: false,\n description: `A value indicating whether \\`constructor\\`s should\nbe checked for \\`@returns\\` tags. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n checkGetters: {\n default: true,\n description: `Boolean to determine whether getter methods should\nbe checked for \\`@returns\\` tags. Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`). This\nrule will only apply on non-default contexts when there is such a tag\npresent and the \\`forceRequireReturn\\` option is set or if the\n\\`forceReturnsWithAsync\\` option is set with a present \\`@async\\` tag\n(since we are not checking against the actual \\`return\\` values in these\ncases).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n forceRequireReturn: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: `Whether to enable the fixer to add a blank \\`@returns\\`.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the\ndocument block avoids the need for a \\`@returns\\`. Defaults to an array\nwith \\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n forceRequireReturn: {\n default: false,\n description: `Set to \\`true\\` to always insist on\n\\`@returns\\` documentation regardless of implicit or explicit \\`return\\`'s\nin the function. May be desired to flag that a project is aware of an\n\\`undefined\\`/\\`void\\` return. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n forceReturnsWithAsync: {\n default: false,\n description: `By default \\`async\\` functions that do not explicitly\nreturn a value pass this rule as an \\`async\\` function will always return a\n\\`Promise\\`, even if the \\`Promise\\` resolves to void. You can force all\n\\`async\\` functions (including ones with an explicit \\`Promise\\` but no\ndetected non-\\`undefined\\` \\`resolve\\` value) to require \\`@return\\`\ndocumentation by setting \\`forceReturnsWithAsync\\` to \\`true\\` on the options\nobject. This may be useful for flagging that there has been consideration\nof return type. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n publicOnly: {\n description: `This option will insist that missing \\`@returns\\` are only reported for\nfunction bodies / class declarations that are exported from the module.\nMay be a boolean or object. If set to \\`true\\`, the defaults below will be\nused. If unset, \\`@returns\\` reporting will not be limited to exports.\n\nThis object supports the following optional boolean keys (\\`false\\` unless\notherwise noted):\n\n- \\`ancestorsOnly\\` - Optimization to only check node ancestors to check if node is exported\n- \\`esm\\` - ESM exports are checked for \\`@returns\\` JSDoc comments (Defaults to \\`true\\`)\n- \\`cjs\\` - CommonJS exports are checked for \\`@returns\\` JSDoc comments (Defaults to \\`true\\`)\n- \\`window\\` - Window global exports are checked for \\`@returns\\` JSDoc comments`,\n oneOf: [\n {\n default: false,\n type: 'boolean',\n },\n {\n additionalProperties: false,\n default: {},\n properties: {\n ancestorsOnly: {\n type: 'boolean',\n },\n cjs: {\n type: 'boolean',\n },\n esm: {\n type: 'boolean',\n },\n window: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAIC,KAAK,IAAK;EACzB,OAAOA,KAAK,CAACC,OAAO,CAAC;EACnB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,aAAa;EAEb;EACA,MAAM;EAEN;EACA,WAAW,CACZ,CAAC,IACAD,KAAK,CAACE,SAAS,CAAC,CAAC;AACrB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEa,IAAAO,qBAAY,EAAC,CAAC;EA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AAE;AACzB;AACA;AACA,sDAAsD;UAC1CO,IAAI,EAAE;QACR,CAAC;QACD7C,qBAAqB,EAAE;UACrBjB,OAAO,EAAE,KAAK;UACduD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3BO,IAAI,EAAE;QACR,CAAC;QACD5C,UAAU,EAAE;UACVqC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;UACrEY,KAAK,EAAE,CACL;YACEnE,OAAO,EAAE,KAAK;YACd8D,IAAI,EAAE;UACR,CAAC,EACD;YACEH,oBAAoB,EAAE,KAAK;YAC3B3D,OAAO,EAAE,CAAC,CAAC;YACX4D,UAAU,EAAE;cACV1B,aAAa,EAAE;gBACb4B,IAAI,EAAE;cACR,CAAC;cACDxB,GAAG,EAAE;gBACHwB,IAAI,EAAE;cACR,CAAC;cACD1B,GAAG,EAAE;gBACH0B,IAAI,EAAE;cACR,CAAC;cACDtB,MAAM,EAAE;gBACNsB,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAA9D,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ var _jsdocUtils = require("../jsdocUtils.cjs");
8
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
10
  /**
10
11
  * @param {import('../iterateJsdoc.js').Utils} utils
@@ -38,12 +39,14 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
38
39
  const {
39
40
  exemptAsync = true,
40
41
  exemptGenerators = settings.mode === 'typescript',
42
+ noNativeTypes = true,
41
43
  reportMissingReturnForUndefinedTypes = false
42
44
  } = context.options[0] || {};
43
45
  if (canSkip(utils, settings)) {
44
46
  return;
45
47
  }
46
- if (exemptAsync && utils.isAsync()) {
48
+ const isAsync = utils.isAsync();
49
+ if (exemptAsync && isAsync) {
47
50
  return;
48
51
  }
49
52
  const tagName = /** @type {string} */utils.getPreferredTagName({
@@ -72,6 +75,10 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
72
75
  report(`JSDoc @${tagName} declaration set with "never" but return expression is present in function.`);
73
76
  return;
74
77
  }
78
+ if (noNativeTypes && isAsync && _jsdocUtils.strictNativeTypes.includes(type)) {
79
+ report('Function is async or otherwise returns a Promise but the return type is a native type.');
80
+ return;
81
+ }
75
82
 
76
83
  // In case a return value is declared in JSDoc, we also expect one in the code.
77
84
  if (!returnNever && (reportMissingReturnForUndefinedTypes || !utils.mayBeUndefinedTypeTag(tag)) && (tag.type === '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(exemptAsync) || tag.type !== '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(exemptAsync, true)) && Boolean(!exemptGenerators || !node || !('generator' in (/** @type {import('../iterateJsdoc.js').Node} */node)) || !(/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */node).generator)) {
@@ -109,6 +116,11 @@ one might be more likely to take advantage of \`@yields\`). Set it to \`false\`
109
116
  if you wish for a missing \`return\` to be flagged regardless.`,
110
117
  type: 'boolean'
111
118
  },
119
+ noNativeTypes: {
120
+ description: `Whether to check that async functions do not
121
+ indicate they return non-native types. Defaults to \`true\`.`,
122
+ type: 'boolean'
123
+ },
112
124
  reportMissingReturnForUndefinedTypes: {
113
125
  default: false,
114
126
  description: `If \`true\` and no return or
@@ -1 +1 @@
1
- {"version":3,"file":"requireReturnsCheck.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","canSkip","utils","settings","voidingTags","mode","push","hasATag","isConstructor","classHasTag","_default","exports","iterateJsdoc","context","node","report","exemptAsync","exemptGenerators","reportMissingReturnForUndefinedTypes","options","isAsync","tagName","getPreferredTagName","tags","getTags","length","tag","type","trim","test","returnNever","hasValueOrExecutorHasNonEmptyResolveValue","mayBeUndefinedTypeTag","Boolean","generator","meta","docs","description","url","schema","additionalProperties","properties","module"],"sources":["../../src/rules/requireReturnsCheck.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {boolean}\n */\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a return is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing return.\n 'abstract',\n 'virtual',\n\n // A constructor function returns `this` by default, so may be `@returns`\n // tag indicating this but no explicit return\n 'class',\n 'constructor',\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n exemptAsync = true,\n exemptGenerators = settings.mode === 'typescript',\n reportMissingReturnForUndefinedTypes = false,\n } = context.options[0] || {};\n\n if (canSkip(utils, settings)) {\n return;\n }\n\n if (exemptAsync && utils.isAsync()) {\n return;\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length === 0) {\n return;\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n\n return;\n }\n\n const [\n tag,\n ] = tags;\n\n const type = tag.type.trim();\n\n // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions\n if (/asserts\\s/v.test(type)) {\n return;\n }\n\n const returnNever = type === 'never';\n\n if (returnNever && utils.hasValueOrExecutorHasNonEmptyResolveValue(false)) {\n report(`JSDoc @${tagName} declaration set with \"never\" but return expression is present in function.`);\n\n return;\n }\n\n // In case a return value is declared in JSDoc, we also expect one in the code.\n if (\n !returnNever &&\n (\n reportMissingReturnForUndefinedTypes ||\n !utils.mayBeUndefinedTypeTag(tag)\n ) &&\n (tag.type === '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(\n exemptAsync,\n ) ||\n tag.type !== '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(\n exemptAsync,\n true,\n )) &&\n Boolean(\n !exemptGenerators || !node ||\n !('generator' in /** @type {import('../iterateJsdoc.js').Node} */ (node)) ||\n !(/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */ (node)).generator,\n )\n ) {\n report(`JSDoc @${tagName} declaration present but return expression not available in function.`);\n }\n}, {\n meta: {\n docs: {\n description: 'Requires a return statement in function body if a `@returns` tag is specified in JSDoc comment(and reports if multiple `@returns` tags are present).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-check.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptAsync: {\n default: true,\n description: `By default, functions which return a \\`Promise\\` that are not\ndetected as resolving with a non-\\`undefined\\` value and \\`async\\` functions\n(even ones that do not explicitly return a value, as these are returning a\n\\`Promise\\` implicitly) will be exempted from reporting by this rule.\nIf you wish to insist that only \\`Promise\\`'s which resolve to\nnon-\\`undefined\\` values or \\`async\\` functions with explicit \\`return\\`'s will\nbe exempted from reporting (i.e., that \\`async\\` functions can be reported\nif they lack an explicit (non-\\`undefined\\`) \\`return\\` when a \\`@returns\\` is\npresent), you can set \\`exemptAsync\\` to \\`false\\` on the options object.`,\n type: 'boolean',\n },\n exemptGenerators: {\n description: `Because a generator might be labeled as having a\n\\`IterableIterator\\` \\`@returns\\` value (along with an iterator type\ncorresponding to the type of any \\`yield\\` statements), projects might wish to\nleverage \\`@returns\\` in generators even without a \\`return\\` statement. This\noption is therefore \\`true\\` by default in \\`typescript\\` mode (in \"jsdoc\" mode,\none might be more likely to take advantage of \\`@yields\\`). Set it to \\`false\\`\nif you wish for a missing \\`return\\` to be flagged regardless.`,\n type: 'boolean',\n },\n reportMissingReturnForUndefinedTypes: {\n default: false,\n description: `If \\`true\\` and no return or\nresolve value is found, this setting will even insist that reporting occur\nwith \\`void\\` or \\`undefined\\` (including as an indicated \\`Promise\\` type).\nUnlike \\`require-returns\\`, with this option in the rule, one can\n*discourage* the labeling of \\`undefined\\` types. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAGA,CAACC,KAAK,EAAEC,QAAQ,KAAK;EACnC,MAAMC,WAAW,GAAG;EAClB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,aAAa,EACb,WAAW,CACZ;EAED,IAAID,QAAQ,CAACE,IAAI,KAAK,SAAS,EAAE;IAC/B;IACAD,WAAW,CAACE,IAAI,CAAC,QAAQ,CAAC;EAC5B;EAEA,OAAOJ,KAAK,CAACK,OAAO,CAACH,WAAW,CAAC,IAC/BF,KAAK,CAACM,aAAa,CAAC,CAAC,IACrBN,KAAK,CAACO,WAAW,CAAC,WAAW,CAAC,IAC9BN,QAAQ,CAACE,IAAI,KAAK,SAAS,IAAIH,KAAK,CAACO,WAAW,CAAC,QAAQ,CAAC;AAC9D,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEa,IAAAY,qBA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B,qBAAqB,CAACN,GAAG,CAAC,CAClC,KACAA,GAAG,CAACC,IAAI,KAAK,EAAE,IAAI,CAACzB,KAAK,CAAC6B,yCAAyC,CAClEf,WACF,CAAC,IACDU,GAAG,CAACC,IAAI,KAAK,EAAE,IAAI,CAACzB,KAAK,CAAC6B,yCAAyC,CACjEf,WAAW,EACX,IACF,CAAC,CAAC,IACFiB,OAAO,CACL,CAAChB,gBAAgB,IAAI,CAACH,IAAI,IAC1B,EAAE,WAAW,KAAI,gDAAkDA,IAAI,CAAC,CAAC,IACzE,CAAC,CAAC,8EAAgFA,IAAI,EAAGoB,SAC3F,CAAC,EACD;IACAnB,MAAM,CAAC,UAAUM,OAAO,uEAAuE,CAAC;EAClG;AACF,CAAC,EAAE;EACDc,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,sJAAsJ;MACnKC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVzB,WAAW,EAAE;UACXhB,OAAO,EAAE,IAAI;UACbqC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;UAC9DV,IAAI,EAAE;QACR,CAAC;QACDV,gBAAgB,EAAE;UAChBoB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,+DAA+D;UACnDV,IAAI,EAAE;QACR,CAAC;QACDT,oCAAoC,EAAE;UACpClB,OAAO,EAAE,KAAK;UACdqC,WAAW,EAAE;AACzB;AACA;AACA;AACA,yEAAyE;UAC7DV,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAe,MAAA,CAAA/B,OAAA,GAAAA,OAAA,CAAAX,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"requireReturnsCheck.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdocUtils","e","__esModule","default","canSkip","utils","settings","voidingTags","mode","push","hasATag","isConstructor","classHasTag","_default","exports","iterateJsdoc","context","node","report","exemptAsync","exemptGenerators","noNativeTypes","reportMissingReturnForUndefinedTypes","options","isAsync","tagName","getPreferredTagName","tags","getTags","length","tag","type","trim","test","returnNever","hasValueOrExecutorHasNonEmptyResolveValue","strictNativeTypes","includes","mayBeUndefinedTypeTag","Boolean","generator","meta","docs","description","url","schema","additionalProperties","properties","module"],"sources":["../../src/rules/requireReturnsCheck.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n strictNativeTypes,\n} from '../jsdocUtils.js';\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {boolean}\n */\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a return is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing return.\n 'abstract',\n 'virtual',\n\n // A constructor function returns `this` by default, so may be `@returns`\n // tag indicating this but no explicit return\n 'class',\n 'constructor',\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n exemptAsync = true,\n exemptGenerators = settings.mode === 'typescript',\n noNativeTypes = true,\n reportMissingReturnForUndefinedTypes = false,\n } = context.options[0] || {};\n\n if (canSkip(utils, settings)) {\n return;\n }\n\n const isAsync = utils.isAsync();\n if (exemptAsync && isAsync) {\n return;\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length === 0) {\n return;\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n\n return;\n }\n\n const [\n tag,\n ] = tags;\n\n const type = tag.type.trim();\n\n // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions\n if (/asserts\\s/v.test(type)) {\n return;\n }\n\n const returnNever = type === 'never';\n\n if (returnNever && utils.hasValueOrExecutorHasNonEmptyResolveValue(false)) {\n report(`JSDoc @${tagName} declaration set with \"never\" but return expression is present in function.`);\n\n return;\n }\n\n if (noNativeTypes && isAsync && strictNativeTypes.includes(type)) {\n report('Function is async or otherwise returns a Promise but the return type is a native type.');\n return;\n }\n\n // In case a return value is declared in JSDoc, we also expect one in the code.\n if (\n !returnNever &&\n (\n reportMissingReturnForUndefinedTypes ||\n !utils.mayBeUndefinedTypeTag(tag)\n ) &&\n (tag.type === '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(\n exemptAsync,\n ) ||\n tag.type !== '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(\n exemptAsync,\n true,\n )) &&\n Boolean(\n !exemptGenerators || !node ||\n !('generator' in /** @type {import('../iterateJsdoc.js').Node} */ (node)) ||\n !(/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */ (node)).generator,\n )\n ) {\n report(`JSDoc @${tagName} declaration present but return expression not available in function.`);\n }\n}, {\n meta: {\n docs: {\n description: 'Requires a return statement in function body if a `@returns` tag is specified in JSDoc comment(and reports if multiple `@returns` tags are present).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-check.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptAsync: {\n default: true,\n description: `By default, functions which return a \\`Promise\\` that are not\ndetected as resolving with a non-\\`undefined\\` value and \\`async\\` functions\n(even ones that do not explicitly return a value, as these are returning a\n\\`Promise\\` implicitly) will be exempted from reporting by this rule.\nIf you wish to insist that only \\`Promise\\`'s which resolve to\nnon-\\`undefined\\` values or \\`async\\` functions with explicit \\`return\\`'s will\nbe exempted from reporting (i.e., that \\`async\\` functions can be reported\nif they lack an explicit (non-\\`undefined\\`) \\`return\\` when a \\`@returns\\` is\npresent), you can set \\`exemptAsync\\` to \\`false\\` on the options object.`,\n type: 'boolean',\n },\n exemptGenerators: {\n description: `Because a generator might be labeled as having a\n\\`IterableIterator\\` \\`@returns\\` value (along with an iterator type\ncorresponding to the type of any \\`yield\\` statements), projects might wish to\nleverage \\`@returns\\` in generators even without a \\`return\\` statement. This\noption is therefore \\`true\\` by default in \\`typescript\\` mode (in \"jsdoc\" mode,\none might be more likely to take advantage of \\`@yields\\`). Set it to \\`false\\`\nif you wish for a missing \\`return\\` to be flagged regardless.`,\n type: 'boolean',\n },\n noNativeTypes: {\n description: `Whether to check that async functions do not\nindicate they return non-native types. Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n reportMissingReturnForUndefinedTypes: {\n default: false,\n description: `If \\`true\\` and no return or\nresolve value is found, this setting will even insist that reporting occur\nwith \\`void\\` or \\`undefined\\` (including as an indicated \\`Promise\\` type).\nUnlike \\`require-returns\\`, with this option in the rule, one can\n*discourage* the labeling of \\`undefined\\` types. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAE0B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1B;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAGA,CAACC,KAAK,EAAEC,QAAQ,KAAK;EACnC,MAAMC,WAAW,GAAG;EAClB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,aAAa,EACb,WAAW,CACZ;EAED,IAAID,QAAQ,CAACE,IAAI,KA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E,IAAI;UACbwC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;UAC9DZ,IAAI,EAAE;QACR,CAAC;QACDX,gBAAgB,EAAE;UAChBuB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,+DAA+D;UACnDZ,IAAI,EAAE;QACR,CAAC;QACDV,aAAa,EAAE;UACbsB,WAAW,EAAE;AACzB,6DAA6D;UACjDZ,IAAI,EAAE;QACR,CAAC;QACDT,oCAAoC,EAAE;UACpCnB,OAAO,EAAE,KAAK;UACdwC,WAAW,EAAE;AACzB;AACA;AACA;AACA,yEAAyE;UAC7DZ,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAiB,MAAA,CAAAlC,OAAA,GAAAA,OAAA,CAAAX,OAAA","ignoreList":[]}
@@ -193,8 +193,7 @@ templates of this format:
193
193
  */
194
194
  \`\`\`
195
195
 
196
- Defaults to \`false\`.
197
- `,
196
+ Defaults to \`false\`.`,
198
197
  type: 'boolean'
199
198
  }
200
199
  },
@@ -1 +1 @@
1
- {"version":3,"file":"requireTemplate.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","node","report","settings","utils","avoidDocs","requireSeparateTemplates","options","mode","usedNames","Set","templateTags","getTags","templateNames","flatMap","tag","parseClosureTemplateTag","names","length","checkTypeParams","aliasDeclaration","params","typeParameters","name","add","usedName","includes","handleTypes","nde","type","declaration","usedNameToTag","Map","checkForUsedTypes","potentialTag","parsedType","tryParseType","parseType","traverse","value","test","has","set","checkTagsAndTemplates","tagNames","tagName","preferredTagName","getPreferredTagName","matchingTags","matchingTag","get","callbackTags","functionTags","typedefTags","potentialTypedef","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","exemptedBy","items","module"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n const templateTags = utils.getTags('template');\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @template for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires `@template` tags be present when type parameters are used.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for a \\`@template\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n description: `Requires that each template have its own separate line, i.e., preventing\ntemplates of this format:\n\n\\`\\`\\`js\n/**\n * @template T, U, V\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.\n`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEf,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,IAAIA,KAAK,CAACC,SAAS,CAAC,CAAC,EAAE;IACrB;EACF;EAEA,MAAM;IACJC,wBAAwB,GAAG;EAC7B,CAAC,GAAGN,OAAO,CAACO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,MAAM;IACJC;EACF,CAAC,GAAGL,QAAQ;EAEZ,MAAMM,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;EAC3B,MAAMC,YAAY,GAAGP,KAAK,CAACQ,OAAO,CAAC,UAAU,CAA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;MAClFC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,UAAU,EAAE;UACVL,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXM,KAAK,EAAE;YACLnC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDvB,wBAAwB,EAAE;UACxBoD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACW7B,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoC,MAAA,CAAAnE,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"requireTemplate.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","node","report","settings","utils","avoidDocs","requireSeparateTemplates","options","mode","usedNames","Set","templateTags","getTags","templateNames","flatMap","tag","parseClosureTemplateTag","names","length","checkTypeParams","aliasDeclaration","params","typeParameters","name","add","usedName","includes","handleTypes","nde","type","declaration","usedNameToTag","Map","checkForUsedTypes","potentialTag","parsedType","tryParseType","parseType","traverse","value","test","has","set","checkTagsAndTemplates","tagNames","tagName","preferredTagName","getPreferredTagName","matchingTags","matchingTag","get","callbackTags","functionTags","typedefTags","potentialTypedef","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","exemptedBy","items","module"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n const templateTags = utils.getTags('template');\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @template for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires `@template` tags be present when type parameters are used.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for a \\`@template\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n description: `Requires that each template have its own separate line, i.e., preventing\ntemplates of this format:\n\n\\`\\`\\`js\n/**\n * @template T, U, V\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEf,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,IAAIA,KAAK,CAACC,SAAS,CAAC,CAAC,EAAE;IACrB;EACF;EAEA,MAAM;IACJC,wBAAwB,GAAG;EAC7B,CAAC,GAAGN,OAAO,CAACO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,MAAM;IACJC;EACF,CAAC,GAAGL,QAAQ;EAEZ,MAAMM,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;EAC3B,MAAMC,YAAY,GAAGP,KAAK,CAACQ,OAAO,CAAC,UAAU,CAAC;EAC9C,MAAMC,aAAa,GAAGF,YAAY,CAACG,OAAO,CAAEC,GAAG,IAAK;IAClD,OAAOX,KAAK,CAACY,uBAAuB,CAACD,GAAG,CAAC;EAC3C,CAAC,CAAC;EAEF,IAAIT,wBAAwB,EAAE;IAC5B,KAAK,MAAMS,GAAG,IAAIJ,YAAY,EAAE;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;UACDA,IAAI,EAAE;QACR,CAAC;QACDvB,wBAAwB,EAAE;UACxBoD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;UACX7B,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoC,MAAA,CAAAnE,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
@@ -618,8 +618,7 @@ a fixed order that doesn't change into the future, supply your own
618
618
  'deprecated',
619
619
  'todo',
620
620
  ]}];
621
- \`\`\`
622
- `,
621
+ \`\`\``,
623
622
  items: {
624
623
  additionalProperties: false,
625
624
  properties: {