@depup/eslint-plugin-jsdoc 62.8.0-depup.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 (430) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +33 -0
  3. package/changes.json +18 -0
  4. package/dist/WarnSettings.cjs +38 -0
  5. package/dist/WarnSettings.cjs.map +1 -0
  6. package/dist/WarnSettings.d.ts +17 -0
  7. package/dist/alignTransform.cjs +402 -0
  8. package/dist/alignTransform.cjs.map +1 -0
  9. package/dist/alignTransform.d.ts +34 -0
  10. package/dist/buildForbidRuleDefinition.cjs +101 -0
  11. package/dist/buildForbidRuleDefinition.cjs.map +1 -0
  12. package/dist/buildForbidRuleDefinition.d.ts +15 -0
  13. package/dist/buildRejectOrPreferRuleDefinition.cjs +352 -0
  14. package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -0
  15. package/dist/buildRejectOrPreferRuleDefinition.d.ts +9 -0
  16. package/dist/cjs/WarnSettings.d.ts +16 -0
  17. package/dist/cjs/alignTransform.d.ts +33 -0
  18. package/dist/cjs/buildForbidRuleDefinition.d.ts +14 -0
  19. package/dist/cjs/buildRejectOrPreferRuleDefinition.d.ts +8 -0
  20. package/dist/cjs/defaultTagOrder.d.ts +4 -0
  21. package/dist/cjs/exportParser.d.ts +40 -0
  22. package/dist/cjs/getDefaultTagStructureForMode.d.ts +10 -0
  23. package/dist/cjs/getJsdocProcessorPlugin.d.cts +5 -0
  24. package/dist/cjs/getJsdocProcessorPlugin.d.ts +66 -0
  25. package/dist/cjs/index-cjs.d.ts +23 -0
  26. package/dist/cjs/index.cjs.d.cts +2 -0
  27. package/dist/cjs/iterateJsdoc.d.cts +7 -0
  28. package/dist/cjs/iterateJsdoc.d.ts +495 -0
  29. package/dist/cjs/jsdocUtils.d.ts +493 -0
  30. package/dist/cjs/rules/checkAccess.d.ts +2 -0
  31. package/dist/cjs/rules/checkAlignment.d.ts +2 -0
  32. package/dist/cjs/rules/checkExamples.d.ts +3 -0
  33. package/dist/cjs/rules/checkIndentation.d.ts +2 -0
  34. package/dist/cjs/rules/checkLineAlignment.d.ts +9 -0
  35. package/dist/cjs/rules/checkParamNames.d.ts +2 -0
  36. package/dist/cjs/rules/checkPropertyNames.d.ts +2 -0
  37. package/dist/cjs/rules/checkSyntax.d.ts +2 -0
  38. package/dist/cjs/rules/checkTagNames.d.ts +2 -0
  39. package/dist/cjs/rules/checkTemplateNames.d.ts +2 -0
  40. package/dist/cjs/rules/checkTypes.d.ts +7 -0
  41. package/dist/cjs/rules/checkValues.d.ts +2 -0
  42. package/dist/cjs/rules/convertToJsdocComments.d.ts +266 -0
  43. package/dist/cjs/rules/emptyTags.d.ts +2 -0
  44. package/dist/cjs/rules/escapeInlineTags.d.ts +2 -0
  45. package/dist/cjs/rules/implementsOnClasses.d.ts +2 -0
  46. package/dist/cjs/rules/importsAsDependencies.d.ts +2 -0
  47. package/dist/cjs/rules/informativeDocs.d.ts +2 -0
  48. package/dist/cjs/rules/linesBeforeBlock.d.ts +2 -0
  49. package/dist/cjs/rules/matchDescription.d.ts +2 -0
  50. package/dist/cjs/rules/matchName.d.ts +2 -0
  51. package/dist/cjs/rules/multilineBlocks.d.ts +2 -0
  52. package/dist/cjs/rules/noBadBlocks.d.ts +2 -0
  53. package/dist/cjs/rules/noBlankBlockDescriptions.d.ts +2 -0
  54. package/dist/cjs/rules/noBlankBlocks.d.ts +2 -0
  55. package/dist/cjs/rules/noDefaults.d.ts +2 -0
  56. package/dist/cjs/rules/noMissingSyntax.d.ts +9 -0
  57. package/dist/cjs/rules/noMultiAsterisks.d.ts +2 -0
  58. package/dist/cjs/rules/noRestrictedSyntax.d.ts +2 -0
  59. package/dist/cjs/rules/noTypes.d.ts +2 -0
  60. package/dist/cjs/rules/noUndefinedTypes.d.ts +2 -0
  61. package/dist/cjs/rules/preferImportTag.d.ts +2 -0
  62. package/dist/cjs/rules/requireAsteriskPrefix.d.ts +2 -0
  63. package/dist/cjs/rules/requireDescription.d.ts +2 -0
  64. package/dist/cjs/rules/requireDescriptionCompleteSentence.d.ts +2 -0
  65. package/dist/cjs/rules/requireExample.d.ts +2 -0
  66. package/dist/cjs/rules/requireFileOverview.d.ts +2 -0
  67. package/dist/cjs/rules/requireHyphenBeforeParamDescription.d.ts +2 -0
  68. package/dist/cjs/rules/requireJsdoc.d.ts +24 -0
  69. package/dist/cjs/rules/requireParam.d.ts +3 -0
  70. package/dist/cjs/rules/requireParamDescription.d.ts +2 -0
  71. package/dist/cjs/rules/requireParamName.d.ts +2 -0
  72. package/dist/cjs/rules/requireParamType.d.ts +2 -0
  73. package/dist/cjs/rules/requireProperty.d.ts +2 -0
  74. package/dist/cjs/rules/requirePropertyDescription.d.ts +2 -0
  75. package/dist/cjs/rules/requirePropertyName.d.ts +2 -0
  76. package/dist/cjs/rules/requirePropertyType.d.ts +2 -0
  77. package/dist/cjs/rules/requireRejects.d.ts +2 -0
  78. package/dist/cjs/rules/requireReturns.d.ts +2 -0
  79. package/dist/cjs/rules/requireReturnsCheck.d.ts +2 -0
  80. package/dist/cjs/rules/requireReturnsDescription.d.ts +2 -0
  81. package/dist/cjs/rules/requireReturnsType.d.ts +2 -0
  82. package/dist/cjs/rules/requireTags.d.ts +2 -0
  83. package/dist/cjs/rules/requireTemplate.d.ts +2 -0
  84. package/dist/cjs/rules/requireThrows.d.ts +2 -0
  85. package/dist/cjs/rules/requireYields.d.ts +2 -0
  86. package/dist/cjs/rules/requireYieldsCheck.d.ts +2 -0
  87. package/dist/cjs/rules/sortTags.d.ts +2 -0
  88. package/dist/cjs/rules/tagLines.d.ts +2 -0
  89. package/dist/cjs/rules/textEscaping.d.ts +2 -0
  90. package/dist/cjs/rules/tsMethodSignatureStyle.d.ts +2 -0
  91. package/dist/cjs/rules/tsNoEmptyObjectType.d.ts +2 -0
  92. package/dist/cjs/rules/tsNoUnnecessaryTemplateExpression.d.ts +2 -0
  93. package/dist/cjs/rules/tsPreferFunctionType.d.ts +2 -0
  94. package/dist/cjs/rules/typeFormatting.d.ts +2 -0
  95. package/dist/cjs/rules/validTypes.d.ts +2 -0
  96. package/dist/cjs/tagNames.d.ts +15 -0
  97. package/dist/cjs/utils/hasReturnValue.d.ts +19 -0
  98. package/dist/defaultTagOrder.cjs +46 -0
  99. package/dist/defaultTagOrder.cjs.map +1 -0
  100. package/dist/defaultTagOrder.d.ts +5 -0
  101. package/dist/exportParser.cjs +732 -0
  102. package/dist/exportParser.cjs.map +1 -0
  103. package/dist/exportParser.d.ts +41 -0
  104. package/dist/generateDocs.cjs +342 -0
  105. package/dist/generateDocs.cjs.map +1 -0
  106. package/dist/generateOptions.cjs +62 -0
  107. package/dist/generateOptions.cjs.map +1 -0
  108. package/dist/generateRule.cjs +248 -0
  109. package/dist/generateRule.cjs.map +1 -0
  110. package/dist/generateRuleTypes.cjs +24 -0
  111. package/dist/generateRuleTypes.cjs.map +1 -0
  112. package/dist/getDefaultTagStructureForMode.cjs +289 -0
  113. package/dist/getDefaultTagStructureForMode.cjs.map +1 -0
  114. package/dist/getDefaultTagStructureForMode.d.ts +11 -0
  115. package/dist/getJsdocProcessorPlugin.cjs +587 -0
  116. package/dist/getJsdocProcessorPlugin.cjs.map +1 -0
  117. package/dist/getJsdocProcessorPlugin.cts +5 -0
  118. package/dist/getJsdocProcessorPlugin.d.ts +67 -0
  119. package/dist/index-cjs.cjs +595 -0
  120. package/dist/index-cjs.cjs.map +1 -0
  121. package/dist/index-cjs.d.ts +24 -0
  122. package/dist/index-esm.cjs +162 -0
  123. package/dist/index-esm.cjs.map +1 -0
  124. package/dist/index-esm.d.ts +72 -0
  125. package/dist/index.cjs +743 -0
  126. package/dist/index.cjs.cts +3 -0
  127. package/dist/index.cjs.map +1 -0
  128. package/dist/index.d.ts +93 -0
  129. package/dist/iterateJsdoc.cjs +2150 -0
  130. package/dist/iterateJsdoc.cjs.map +1 -0
  131. package/dist/iterateJsdoc.cts +7 -0
  132. package/dist/iterateJsdoc.d.ts +496 -0
  133. package/dist/jsdocUtils.cjs +1725 -0
  134. package/dist/jsdocUtils.cjs.map +1 -0
  135. package/dist/jsdocUtils.d.ts +494 -0
  136. package/dist/rules/checkAccess.cjs +40 -0
  137. package/dist/rules/checkAccess.cjs.map +1 -0
  138. package/dist/rules/checkAccess.d.ts +3 -0
  139. package/dist/rules/checkAlignment.cjs +78 -0
  140. package/dist/rules/checkAlignment.cjs.map +1 -0
  141. package/dist/rules/checkAlignment.d.ts +3 -0
  142. package/dist/rules/checkExamples.cjs +521 -0
  143. package/dist/rules/checkExamples.cjs.map +1 -0
  144. package/dist/rules/checkExamples.d.ts +4 -0
  145. package/dist/rules/checkIndentation.cjs +170 -0
  146. package/dist/rules/checkIndentation.cjs.map +1 -0
  147. package/dist/rules/checkIndentation.d.ts +3 -0
  148. package/dist/rules/checkLineAlignment.cjs +398 -0
  149. package/dist/rules/checkLineAlignment.cjs.map +1 -0
  150. package/dist/rules/checkLineAlignment.d.ts +10 -0
  151. package/dist/rules/checkParamNames.cjs +407 -0
  152. package/dist/rules/checkParamNames.cjs.map +1 -0
  153. package/dist/rules/checkParamNames.d.ts +3 -0
  154. package/dist/rules/checkPropertyNames.cjs +135 -0
  155. package/dist/rules/checkPropertyNames.cjs.map +1 -0
  156. package/dist/rules/checkPropertyNames.d.ts +3 -0
  157. package/dist/rules/checkSyntax.cjs +38 -0
  158. package/dist/rules/checkSyntax.cjs.map +1 -0
  159. package/dist/rules/checkSyntax.d.ts +3 -0
  160. package/dist/rules/checkTagNames.cjs +312 -0
  161. package/dist/rules/checkTagNames.cjs.map +1 -0
  162. package/dist/rules/checkTagNames.d.ts +3 -0
  163. package/dist/rules/checkTemplateNames.cjs +185 -0
  164. package/dist/rules/checkTemplateNames.cjs.map +1 -0
  165. package/dist/rules/checkTemplateNames.d.ts +3 -0
  166. package/dist/rules/checkTypes.cjs +111 -0
  167. package/dist/rules/checkTypes.cjs.map +1 -0
  168. package/dist/rules/checkTypes.d.ts +8 -0
  169. package/dist/rules/checkValues.cjs +166 -0
  170. package/dist/rules/checkValues.cjs.map +1 -0
  171. package/dist/rules/checkValues.d.ts +3 -0
  172. package/dist/rules/convertToJsdocComments.cjs +356 -0
  173. package/dist/rules/convertToJsdocComments.cjs.map +1 -0
  174. package/dist/rules/convertToJsdocComments.d.ts +267 -0
  175. package/dist/rules/emptyTags.cjs +85 -0
  176. package/dist/rules/emptyTags.cjs.map +1 -0
  177. package/dist/rules/emptyTags.d.ts +3 -0
  178. package/dist/rules/escapeInlineTags.cjs +149 -0
  179. package/dist/rules/escapeInlineTags.cjs.map +1 -0
  180. package/dist/rules/escapeInlineTags.d.ts +3 -0
  181. package/dist/rules/implementsOnClasses.cjs +74 -0
  182. package/dist/rules/implementsOnClasses.cjs.map +1 -0
  183. package/dist/rules/implementsOnClasses.d.ts +3 -0
  184. package/dist/rules/importsAsDependencies.cjs +104 -0
  185. package/dist/rules/importsAsDependencies.cjs.map +1 -0
  186. package/dist/rules/importsAsDependencies.d.ts +3 -0
  187. package/dist/rules/informativeDocs.cjs +187 -0
  188. package/dist/rules/informativeDocs.cjs.map +1 -0
  189. package/dist/rules/informativeDocs.d.ts +3 -0
  190. package/dist/rules/linesBeforeBlock.cjs +120 -0
  191. package/dist/rules/linesBeforeBlock.cjs.map +1 -0
  192. package/dist/rules/linesBeforeBlock.d.ts +3 -0
  193. package/dist/rules/matchDescription.cjs +356 -0
  194. package/dist/rules/matchDescription.cjs.map +1 -0
  195. package/dist/rules/matchDescription.d.ts +3 -0
  196. package/dist/rules/matchName.cjs +160 -0
  197. package/dist/rules/matchName.cjs.map +1 -0
  198. package/dist/rules/matchName.d.ts +3 -0
  199. package/dist/rules/multilineBlocks.cjs +431 -0
  200. package/dist/rules/multilineBlocks.cjs.map +1 -0
  201. package/dist/rules/multilineBlocks.d.ts +3 -0
  202. package/dist/rules/noBadBlocks.cjs +100 -0
  203. package/dist/rules/noBadBlocks.cjs.map +1 -0
  204. package/dist/rules/noBadBlocks.d.ts +3 -0
  205. package/dist/rules/noBlankBlockDescriptions.cjs +63 -0
  206. package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -0
  207. package/dist/rules/noBlankBlockDescriptions.d.ts +3 -0
  208. package/dist/rules/noBlankBlocks.cjs +54 -0
  209. package/dist/rules/noBlankBlocks.cjs.map +1 -0
  210. package/dist/rules/noBlankBlocks.d.ts +3 -0
  211. package/dist/rules/noDefaults.cjs +102 -0
  212. package/dist/rules/noDefaults.cjs.map +1 -0
  213. package/dist/rules/noDefaults.d.ts +3 -0
  214. package/dist/rules/noMissingSyntax.cjs +196 -0
  215. package/dist/rules/noMissingSyntax.cjs.map +1 -0
  216. package/dist/rules/noMissingSyntax.d.ts +10 -0
  217. package/dist/rules/noMultiAsterisks.cjs +126 -0
  218. package/dist/rules/noMultiAsterisks.cjs.map +1 -0
  219. package/dist/rules/noMultiAsterisks.d.ts +3 -0
  220. package/dist/rules/noRestrictedSyntax.cjs +68 -0
  221. package/dist/rules/noRestrictedSyntax.cjs.map +1 -0
  222. package/dist/rules/noRestrictedSyntax.d.ts +3 -0
  223. package/dist/rules/noTypes.cjs +101 -0
  224. package/dist/rules/noTypes.cjs.map +1 -0
  225. package/dist/rules/noTypes.d.ts +3 -0
  226. package/dist/rules/noUndefinedTypes.cjs +588 -0
  227. package/dist/rules/noUndefinedTypes.cjs.map +1 -0
  228. package/dist/rules/noUndefinedTypes.d.ts +3 -0
  229. package/dist/rules/preferImportTag.cjs +362 -0
  230. package/dist/rules/preferImportTag.cjs.map +1 -0
  231. package/dist/rules/preferImportTag.d.ts +3 -0
  232. package/dist/rules/requireAsteriskPrefix.cjs +190 -0
  233. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -0
  234. package/dist/rules/requireAsteriskPrefix.d.ts +3 -0
  235. package/dist/rules/requireDescription.cjs +164 -0
  236. package/dist/rules/requireDescription.cjs.map +1 -0
  237. package/dist/rules/requireDescription.d.ts +3 -0
  238. package/dist/rules/requireDescriptionCompleteSentence.cjs +321 -0
  239. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -0
  240. package/dist/rules/requireDescriptionCompleteSentence.d.ts +3 -0
  241. package/dist/rules/requireExample.cjs +133 -0
  242. package/dist/rules/requireExample.cjs.map +1 -0
  243. package/dist/rules/requireExample.d.ts +3 -0
  244. package/dist/rules/requireFileOverview.cjs +194 -0
  245. package/dist/rules/requireFileOverview.cjs.map +1 -0
  246. package/dist/rules/requireFileOverview.d.ts +3 -0
  247. package/dist/rules/requireHyphenBeforeParamDescription.cjs +166 -0
  248. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -0
  249. package/dist/rules/requireHyphenBeforeParamDescription.d.ts +3 -0
  250. package/dist/rules/requireJsdoc.cjs +722 -0
  251. package/dist/rules/requireJsdoc.cjs.map +1 -0
  252. package/dist/rules/requireJsdoc.d.ts +25 -0
  253. package/dist/rules/requireParam.cjs +772 -0
  254. package/dist/rules/requireParam.cjs.map +1 -0
  255. package/dist/rules/requireParam.d.ts +4 -0
  256. package/dist/rules/requireParamDescription.cjs +105 -0
  257. package/dist/rules/requireParamDescription.cjs.map +1 -0
  258. package/dist/rules/requireParamDescription.d.ts +3 -0
  259. package/dist/rules/requireParamName.cjs +68 -0
  260. package/dist/rules/requireParamName.cjs.map +1 -0
  261. package/dist/rules/requireParamName.d.ts +3 -0
  262. package/dist/rules/requireParamType.cjs +104 -0
  263. package/dist/rules/requireParamType.cjs.map +1 -0
  264. package/dist/rules/requireParamType.d.ts +3 -0
  265. package/dist/rules/requireProperty.cjs +63 -0
  266. package/dist/rules/requireProperty.cjs.map +1 -0
  267. package/dist/rules/requireProperty.d.ts +3 -0
  268. package/dist/rules/requirePropertyDescription.cjs +29 -0
  269. package/dist/rules/requirePropertyDescription.cjs.map +1 -0
  270. package/dist/rules/requirePropertyDescription.d.ts +3 -0
  271. package/dist/rules/requirePropertyName.cjs +29 -0
  272. package/dist/rules/requirePropertyName.cjs.map +1 -0
  273. package/dist/rules/requirePropertyName.d.ts +3 -0
  274. package/dist/rules/requirePropertyType.cjs +29 -0
  275. package/dist/rules/requirePropertyType.cjs.map +1 -0
  276. package/dist/rules/requirePropertyType.d.ts +3 -0
  277. package/dist/rules/requireRejects.cjs +226 -0
  278. package/dist/rules/requireRejects.cjs.map +1 -0
  279. package/dist/rules/requireRejects.d.ts +3 -0
  280. package/dist/rules/requireReturns.cjs +262 -0
  281. package/dist/rules/requireReturns.cjs.map +1 -0
  282. package/dist/rules/requireReturns.d.ts +3 -0
  283. package/dist/rules/requireReturnsCheck.cjs +140 -0
  284. package/dist/rules/requireReturnsCheck.cjs.map +1 -0
  285. package/dist/rules/requireReturnsCheck.d.ts +3 -0
  286. package/dist/rules/requireReturnsDescription.cjs +72 -0
  287. package/dist/rules/requireReturnsDescription.cjs.map +1 -0
  288. package/dist/rules/requireReturnsDescription.d.ts +3 -0
  289. package/dist/rules/requireReturnsType.cjs +68 -0
  290. package/dist/rules/requireReturnsType.cjs.map +1 -0
  291. package/dist/rules/requireReturnsType.d.ts +3 -0
  292. package/dist/rules/requireTags.cjs +74 -0
  293. package/dist/rules/requireTags.cjs.map +1 -0
  294. package/dist/rules/requireTags.d.ts +3 -0
  295. package/dist/rules/requireTemplate.cjs +220 -0
  296. package/dist/rules/requireTemplate.cjs.map +1 -0
  297. package/dist/rules/requireTemplate.d.ts +3 -0
  298. package/dist/rules/requireThrows.cjs +118 -0
  299. package/dist/rules/requireThrows.cjs.map +1 -0
  300. package/dist/rules/requireThrows.d.ts +3 -0
  301. package/dist/rules/requireYields.cjs +224 -0
  302. package/dist/rules/requireYields.cjs.map +1 -0
  303. package/dist/rules/requireYields.d.ts +3 -0
  304. package/dist/rules/requireYieldsCheck.cjs +179 -0
  305. package/dist/rules/requireYieldsCheck.cjs.map +1 -0
  306. package/dist/rules/requireYieldsCheck.d.ts +3 -0
  307. package/dist/rules/sortTags.cjs +656 -0
  308. package/dist/rules/sortTags.cjs.map +1 -0
  309. package/dist/rules/sortTags.d.ts +3 -0
  310. package/dist/rules/tagLines.cjs +374 -0
  311. package/dist/rules/tagLines.cjs.map +1 -0
  312. package/dist/rules/tagLines.d.ts +3 -0
  313. package/dist/rules/textEscaping.cjs +141 -0
  314. package/dist/rules/textEscaping.cjs.map +1 -0
  315. package/dist/rules/textEscaping.d.ts +3 -0
  316. package/dist/rules/tsMethodSignatureStyle.cjs +240 -0
  317. package/dist/rules/tsMethodSignatureStyle.cjs.map +1 -0
  318. package/dist/rules/tsMethodSignatureStyle.d.ts +3 -0
  319. package/dist/rules/tsNoEmptyObjectType.cjs +62 -0
  320. package/dist/rules/tsNoEmptyObjectType.cjs.map +1 -0
  321. package/dist/rules/tsNoEmptyObjectType.d.ts +3 -0
  322. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs +104 -0
  323. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs.map +1 -0
  324. package/dist/rules/tsNoUnnecessaryTemplateExpression.d.ts +3 -0
  325. package/dist/rules/tsPreferFunctionType.cjs +110 -0
  326. package/dist/rules/tsPreferFunctionType.cjs.map +1 -0
  327. package/dist/rules/tsPreferFunctionType.d.ts +3 -0
  328. package/dist/rules/typeFormatting.cjs +607 -0
  329. package/dist/rules/typeFormatting.cjs.map +1 -0
  330. package/dist/rules/typeFormatting.d.ts +3 -0
  331. package/dist/rules/validTypes.cjs +328 -0
  332. package/dist/rules/validTypes.cjs.map +1 -0
  333. package/dist/rules/validTypes.d.ts +3 -0
  334. package/dist/rules.d.ts +3203 -0
  335. package/dist/tagNames.cjs +244 -0
  336. package/dist/tagNames.cjs.map +1 -0
  337. package/dist/tagNames.d.ts +16 -0
  338. package/dist/to-valid-identifier.cjs +263 -0
  339. package/dist/utils/hasReturnValue.cjs +495 -0
  340. package/dist/utils/hasReturnValue.cjs.map +1 -0
  341. package/dist/utils/hasReturnValue.d.ts +20 -0
  342. package/package.json +220 -0
  343. package/rollup.config.js +16 -0
  344. package/src/WarnSettings.js +34 -0
  345. package/src/alignTransform.js +444 -0
  346. package/src/buildForbidRuleDefinition.js +106 -0
  347. package/src/buildRejectOrPreferRuleDefinition.js +481 -0
  348. package/src/defaultTagOrder.js +169 -0
  349. package/src/exportParser.js +973 -0
  350. package/src/getDefaultTagStructureForMode.js +968 -0
  351. package/src/getJsdocProcessorPlugin.cts +5 -0
  352. package/src/getJsdocProcessorPlugin.js +692 -0
  353. package/src/index-cjs.js +755 -0
  354. package/src/index-esm.js +196 -0
  355. package/src/index.cjs.cts +3 -0
  356. package/src/index.js +940 -0
  357. package/src/iterateJsdoc.cts +7 -0
  358. package/src/iterateJsdoc.js +2612 -0
  359. package/src/jsdocUtils.js +2158 -0
  360. package/src/rules/checkAccess.js +45 -0
  361. package/src/rules/checkAlignment.js +82 -0
  362. package/src/rules/checkExamples.js +613 -0
  363. package/src/rules/checkIndentation.js +176 -0
  364. package/src/rules/checkLineAlignment.js +453 -0
  365. package/src/rules/checkParamNames.js +541 -0
  366. package/src/rules/checkPropertyNames.js +174 -0
  367. package/src/rules/checkSyntax.js +30 -0
  368. package/src/rules/checkTagNames.js +414 -0
  369. package/src/rules/checkTemplateNames.js +208 -0
  370. package/src/rules/checkTypes.js +130 -0
  371. package/src/rules/checkValues.js +264 -0
  372. package/src/rules/convertToJsdocComments.js +444 -0
  373. package/src/rules/emptyTags.js +106 -0
  374. package/src/rules/escapeInlineTags.js +189 -0
  375. package/src/rules/implementsOnClasses.js +78 -0
  376. package/src/rules/importsAsDependencies.js +132 -0
  377. package/src/rules/informativeDocs.js +228 -0
  378. package/src/rules/linesBeforeBlock.js +144 -0
  379. package/src/rules/matchDescription.js +413 -0
  380. package/src/rules/matchName.js +179 -0
  381. package/src/rules/multilineBlocks.js +562 -0
  382. package/src/rules/noBadBlocks.js +127 -0
  383. package/src/rules/noBlankBlockDescriptions.js +69 -0
  384. package/src/rules/noBlankBlocks.js +55 -0
  385. package/src/rules/noDefaults.js +104 -0
  386. package/src/rules/noMissingSyntax.js +215 -0
  387. package/src/rules/noMultiAsterisks.js +162 -0
  388. package/src/rules/noRestrictedSyntax.js +72 -0
  389. package/src/rules/noTypes.js +108 -0
  390. package/src/rules/noUndefinedTypes.js +797 -0
  391. package/src/rules/preferImportTag.js +521 -0
  392. package/src/rules/requireAsteriskPrefix.js +217 -0
  393. package/src/rules/requireDescription.js +190 -0
  394. package/src/rules/requireDescriptionCompleteSentence.js +376 -0
  395. package/src/rules/requireExample.js +143 -0
  396. package/src/rules/requireFileOverview.js +213 -0
  397. package/src/rules/requireHyphenBeforeParamDescription.js +210 -0
  398. package/src/rules/requireJsdoc.js +897 -0
  399. package/src/rules/requireParam.js +848 -0
  400. package/src/rules/requireParamDescription.js +110 -0
  401. package/src/rules/requireParamName.js +69 -0
  402. package/src/rules/requireParamType.js +109 -0
  403. package/src/rules/requireProperty.js +66 -0
  404. package/src/rules/requirePropertyDescription.js +25 -0
  405. package/src/rules/requirePropertyName.js +25 -0
  406. package/src/rules/requirePropertyType.js +25 -0
  407. package/src/rules/requireRejects.js +246 -0
  408. package/src/rules/requireReturns.js +291 -0
  409. package/src/rules/requireReturnsCheck.js +180 -0
  410. package/src/rules/requireReturnsDescription.js +73 -0
  411. package/src/rules/requireReturnsType.js +65 -0
  412. package/src/rules/requireTags.js +85 -0
  413. package/src/rules/requireTemplate.js +246 -0
  414. package/src/rules/requireThrows.js +128 -0
  415. package/src/rules/requireYields.js +265 -0
  416. package/src/rules/requireYieldsCheck.js +226 -0
  417. package/src/rules/sortTags.js +766 -0
  418. package/src/rules/tagLines.js +486 -0
  419. package/src/rules/textEscaping.js +158 -0
  420. package/src/rules/tsMethodSignatureStyle.js +300 -0
  421. package/src/rules/tsNoEmptyObjectType.js +61 -0
  422. package/src/rules/tsNoUnnecessaryTemplateExpression.js +130 -0
  423. package/src/rules/tsPreferFunctionType.js +127 -0
  424. package/src/rules/typeFormatting.js +690 -0
  425. package/src/rules/validTypes.js +466 -0
  426. package/src/rules.d.ts +3203 -0
  427. package/src/tagNames.js +301 -0
  428. package/src/utils/hasReturnValue.js +572 -0
  429. package/typings/babel__eslint-parser.d.ts +1 -0
  430. package/typings/gitdown.d.ts +16 -0
@@ -0,0 +1,722 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _exportParser = _interopRequireDefault(require("../exportParser.cjs"));
8
+ var _iterateJsdoc = require("../iterateJsdoc.cjs");
9
+ var _jsdocUtils = require("../jsdocUtils.cjs");
10
+ var _jsdoccomment = require("@es-joy/jsdoccomment");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * @typedef {{
14
+ * ancestorsOnly: boolean,
15
+ * esm: boolean,
16
+ * initModuleExports: boolean,
17
+ * initWindow: boolean
18
+ * }} RequireJsdocOpts
19
+ */
20
+
21
+ /**
22
+ * @typedef {import('eslint').Rule.Node|
23
+ * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode
24
+ */
25
+
26
+ /** @type {import('json-schema').JSONSchema4} */
27
+ const OPTIONS_SCHEMA = {
28
+ additionalProperties: false,
29
+ description: 'Has the following optional keys.\n',
30
+ properties: {
31
+ checkAllFunctionExpressions: {
32
+ default: false,
33
+ description: `Normally, when \`FunctionExpression\` is checked, additional checks are
34
+ added to check the parent contexts where reporting is likely to be desired. If you really
35
+ want to check *all* function expressions, then set this to \`true\`.`,
36
+ type: 'boolean'
37
+ },
38
+ checkConstructors: {
39
+ default: true,
40
+ description: `A value indicating whether \`constructor\`s should be checked. Defaults to
41
+ \`true\`. When \`true\`, \`exemptEmptyConstructors\` may still avoid reporting when
42
+ no parameters or return values are found.`,
43
+ type: 'boolean'
44
+ },
45
+ checkGetters: {
46
+ anyOf: [{
47
+ type: 'boolean'
48
+ }, {
49
+ enum: ['no-setter'],
50
+ type: 'string'
51
+ }],
52
+ default: true,
53
+ description: `A value indicating whether getters should be checked. Besides setting as a
54
+ boolean, this option can be set to the string \`"no-setter"\` to indicate that
55
+ getters should be checked but only when there is no setter. This may be useful
56
+ if one only wishes documentation on one of the two accessors. Defaults to
57
+ \`false\`.`
58
+ },
59
+ checkSetters: {
60
+ anyOf: [{
61
+ type: 'boolean'
62
+ }, {
63
+ enum: ['no-getter'],
64
+ type: 'string'
65
+ }],
66
+ default: true,
67
+ description: `A value indicating whether setters should be checked. Besides setting as a
68
+ boolean, this option can be set to the string \`"no-getter"\` to indicate that
69
+ setters should be checked but only when there is no getter. This may be useful
70
+ if one only wishes documentation on one of the two accessors. Defaults to
71
+ \`false\`.`
72
+ },
73
+ contexts: {
74
+ description: `Set this to an array of strings or objects representing the additional AST
75
+ contexts where you wish the rule to be applied (e.g., \`Property\` for
76
+ properties). If specified as an object, it should have a \`context\` property
77
+ and can have an \`inlineCommentBlock\` property which, if set to \`true\`, will
78
+ add an inline \`/** */\` instead of the regular, multi-line, indented jsdoc
79
+ block which will otherwise be added. Defaults to an empty array. Contexts
80
+ may also have their own \`minLineCount\` property which is an integer
81
+ indicating a minimum number of lines expected for a node in order
82
+ for it to require documentation.
83
+
84
+ Note that you may need to disable \`require\` items (e.g., \`MethodDefinition\`)
85
+ if you are specifying a more precise form in \`contexts\` (e.g., \`MethodDefinition:not([accessibility="private"] > FunctionExpression\`).
86
+
87
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
88
+ section of our Advanced docs for more on the expected format.`,
89
+ items: {
90
+ anyOf: [{
91
+ type: 'string'
92
+ }, {
93
+ additionalProperties: false,
94
+ properties: {
95
+ context: {
96
+ type: 'string'
97
+ },
98
+ inlineCommentBlock: {
99
+ type: 'boolean'
100
+ },
101
+ minLineCount: {
102
+ type: 'integer'
103
+ }
104
+ },
105
+ type: 'object'
106
+ }]
107
+ },
108
+ type: 'array'
109
+ },
110
+ enableFixer: {
111
+ default: true,
112
+ description: `A boolean on whether to enable the fixer (which adds an empty JSDoc block).
113
+ Defaults to \`true\`.`,
114
+ type: 'boolean'
115
+ },
116
+ exemptEmptyConstructors: {
117
+ default: false,
118
+ description: `When \`true\`, the rule will not report missing JSDoc blocks above constructors
119
+ with no parameters or return values (this is enabled by default as the class
120
+ name or description should be seen as sufficient to convey intent).
121
+
122
+ Defaults to \`true\`.`,
123
+ type: 'boolean'
124
+ },
125
+ exemptEmptyFunctions: {
126
+ default: false,
127
+ description: `When \`true\`, the rule will not report missing JSDoc blocks above
128
+ functions/methods with no parameters or return values (intended where
129
+ function/method names are sufficient for themselves as documentation).
130
+
131
+ Defaults to \`false\`.`,
132
+ type: 'boolean'
133
+ },
134
+ exemptOverloadedImplementations: {
135
+ default: false,
136
+ description: `If set to \`true\` will avoid checking an overloaded function's implementation.
137
+
138
+ Defaults to \`false\`.`,
139
+ type: 'boolean'
140
+ },
141
+ fixerMessage: {
142
+ default: '',
143
+ description: `An optional message to add to the inserted JSDoc block. Defaults to the
144
+ empty string.`,
145
+ type: 'string'
146
+ },
147
+ minLineCount: {
148
+ description: `An integer to indicate a minimum number of lines expected for a node in order
149
+ for it to require documentation. Defaults to \`undefined\`. This option will
150
+ apply to any context; see \`contexts\` for line counts specific to a context.`,
151
+ type: 'integer'
152
+ },
153
+ publicOnly: {
154
+ description: `This option will insist that missing JSDoc blocks are only reported for
155
+ function bodies / class declarations that are exported from the module.
156
+ May be a boolean or object. If set to \`true\`, the defaults below will be
157
+ used. If unset, JSDoc block reporting will not be limited to exports.
158
+
159
+ This object supports the following optional boolean keys (\`false\` unless
160
+ otherwise noted):
161
+
162
+ - \`ancestorsOnly\` - Optimization to only check node ancestors to check if node is exported
163
+ - \`esm\` - ESM exports are checked for JSDoc comments (Defaults to \`true\`)
164
+ - \`cjs\` - CommonJS exports are checked for JSDoc comments (Defaults to \`true\`)
165
+ - \`window\` - Window global exports are checked for JSDoc comments`,
166
+ oneOf: [{
167
+ default: false,
168
+ type: 'boolean'
169
+ }, {
170
+ additionalProperties: false,
171
+ default: {},
172
+ properties: {
173
+ ancestorsOnly: {
174
+ type: 'boolean'
175
+ },
176
+ cjs: {
177
+ type: 'boolean'
178
+ },
179
+ esm: {
180
+ type: 'boolean'
181
+ },
182
+ window: {
183
+ type: 'boolean'
184
+ }
185
+ },
186
+ type: 'object'
187
+ }]
188
+ },
189
+ require: {
190
+ additionalProperties: false,
191
+ default: {},
192
+ description: `An object with the following optional boolean keys which all default to
193
+ \`false\` except for \`FunctionDeclaration\` which defaults to \`true\`.`,
194
+ properties: {
195
+ ArrowFunctionExpression: {
196
+ default: false,
197
+ description: 'Whether to check arrow functions like `() => {}`',
198
+ type: 'boolean'
199
+ },
200
+ ClassDeclaration: {
201
+ default: false,
202
+ description: 'Whether to check declarations like `class A {}`',
203
+ type: 'boolean'
204
+ },
205
+ ClassExpression: {
206
+ default: false,
207
+ description: 'Whether to check class expressions like `const myClass = class {}`',
208
+ type: 'boolean'
209
+ },
210
+ FunctionDeclaration: {
211
+ default: true,
212
+ description: 'Whether to check function declarations like `function a {}`',
213
+ type: 'boolean'
214
+ },
215
+ FunctionExpression: {
216
+ default: false,
217
+ description: 'Whether to check function expressions like `const a = function {}`',
218
+ type: 'boolean'
219
+ },
220
+ MethodDefinition: {
221
+ default: false,
222
+ description: 'Whether to check method definitions like `class A { someMethodDefinition () {} }`',
223
+ type: 'boolean'
224
+ }
225
+ },
226
+ type: 'object'
227
+ },
228
+ skipInterveningOverloadedDeclarations: {
229
+ default: true,
230
+ description: `If \`true\`, will skip above uncommented overloaded functions to check
231
+ for a comment block (e.g., at the top of a set of overloaded functions).
232
+
233
+ If \`false\`, will force each overloaded function to be checked for a
234
+ comment block.
235
+
236
+ Defaults to \`true\`.`,
237
+ type: 'boolean'
238
+ }
239
+ },
240
+ type: 'object'
241
+ };
242
+
243
+ /**
244
+ * @param {string} interfaceName
245
+ * @param {string} methodName
246
+ * @param {import("eslint").Scope.Scope | null} scope
247
+ * @returns {import('@typescript-eslint/types').TSESTree.TSMethodSignature|null}
248
+ */
249
+ const getMethodOnInterface = (interfaceName, methodName, scope) => {
250
+ let scp = scope;
251
+ while (scp) {
252
+ for (const {
253
+ identifiers,
254
+ name
255
+ } of scp.variables) {
256
+ if (interfaceName !== name) {
257
+ continue;
258
+ }
259
+ for (const identifier of identifiers) {
260
+ const interfaceDeclaration = /** @type {import('@typescript-eslint/types').TSESTree.Identifier & {parent: import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration}} */identifier.parent;
261
+ /* c8 ignore next 3 -- TS */
262
+ if (interfaceDeclaration.type !== 'TSInterfaceDeclaration') {
263
+ continue;
264
+ }
265
+ for (const bodyItem of interfaceDeclaration.body.body) {
266
+ const methodSig = /** @type {import('@typescript-eslint/types').TSESTree.TSMethodSignature} */
267
+ bodyItem;
268
+ if (methodName === /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */methodSig.key.name) {
269
+ return methodSig;
270
+ }
271
+ }
272
+ }
273
+ }
274
+ scp = scp.upper;
275
+ }
276
+ return null;
277
+ };
278
+
279
+ /**
280
+ * @param {import('eslint').Rule.Node} node
281
+ * @param {import('eslint').SourceCode} sourceCode
282
+ * @param {import('eslint').Rule.RuleContext} context
283
+ * @param {import('../iterateJsdoc.js').Settings} settings
284
+ */
285
+ const isExemptedImplementer = (node, sourceCode, context, settings) => {
286
+ if (node.type === 'FunctionExpression' && node.parent.type === 'MethodDefinition' && node.parent.parent.type === 'ClassBody' && node.parent.parent.parent.type === 'ClassDeclaration' && 'implements' in node.parent.parent.parent) {
287
+ const implments = /** @type {import('@typescript-eslint/types').TSESTree.TSClassImplements[]} */
288
+ node.parent.parent.parent.implements;
289
+ const {
290
+ name: methodName
291
+ } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */
292
+ node.parent.key;
293
+ for (const impl of implments) {
294
+ const {
295
+ name: interfaceName
296
+ } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */
297
+ impl.expression;
298
+ const interfaceMethodNode = getMethodOnInterface(interfaceName, methodName, node && (sourceCode.getScope && /* c8 ignore next 3 */
299
+ sourceCode.getScope(node) ||
300
+ // @ts-expect-error ESLint 8
301
+ context.getScope()));
302
+ if (interfaceMethodNode) {
303
+ // @ts-expect-error Ok
304
+ const comment = (0, _jsdoccomment.getJSDocComment)(sourceCode, interfaceMethodNode, settings);
305
+ if (comment) {
306
+ return true;
307
+ }
308
+ }
309
+ }
310
+ }
311
+ return false;
312
+ };
313
+
314
+ /**
315
+ * @param {import('eslint').Rule.RuleContext} context
316
+ * @param {import('json-schema').JSONSchema4Object} baseObject
317
+ * @param {string} option
318
+ * @param {string} key
319
+ * @returns {boolean|undefined}
320
+ */
321
+ const getOption = (context, baseObject, option, key) => {
322
+ if (context.options[0] && option in context.options[0] && (
323
+ // Todo: boolean shouldn't be returning property, but
324
+ // tests currently require
325
+ typeof context.options[0][option] === 'boolean' || key in context.options[0][option])) {
326
+ return context.options[0][option][key];
327
+ }
328
+ return /** @type {{[key: string]: {default?: boolean|undefined}}} */baseObject.properties[key].default;
329
+ };
330
+
331
+ /**
332
+ * @param {import('eslint').Rule.RuleContext} context
333
+ * @param {import('../iterateJsdoc.js').Settings} settings
334
+ * @returns {{
335
+ * checkAllFunctionExpressions: boolean,
336
+ * contexts: (string|{
337
+ * context: string,
338
+ * inlineCommentBlock: boolean,
339
+ * minLineCount: import('../iterateJsdoc.js').Integer
340
+ * })[],
341
+ * enableFixer: boolean,
342
+ * exemptEmptyConstructors: boolean,
343
+ * exemptEmptyFunctions: boolean,
344
+ * skipInterveningOverloadedDeclarations: boolean,
345
+ * exemptOverloadedImplementations: boolean,
346
+ * fixerMessage: string,
347
+ * minLineCount: undefined|import('../iterateJsdoc.js').Integer,
348
+ * publicOnly: boolean|{[key: string]: boolean|undefined}
349
+ * require: {[key: string]: boolean|undefined}
350
+ * }}
351
+ */
352
+ const getOptions = (context, settings) => {
353
+ const {
354
+ checkAllFunctionExpressions = false,
355
+ contexts = settings.contexts || [],
356
+ enableFixer = true,
357
+ exemptEmptyConstructors = true,
358
+ exemptEmptyFunctions = false,
359
+ exemptOverloadedImplementations = false,
360
+ fixerMessage = '',
361
+ minLineCount = undefined,
362
+ publicOnly,
363
+ skipInterveningOverloadedDeclarations = true
364
+ } = context.options[0] || {};
365
+ return {
366
+ checkAllFunctionExpressions,
367
+ contexts,
368
+ enableFixer,
369
+ exemptEmptyConstructors,
370
+ exemptEmptyFunctions,
371
+ exemptOverloadedImplementations,
372
+ fixerMessage,
373
+ minLineCount,
374
+ publicOnly: (baseObj => {
375
+ if (!publicOnly) {
376
+ return false;
377
+ }
378
+
379
+ /** @type {{[key: string]: boolean|undefined}} */
380
+ const properties = {};
381
+ for (const prop of Object.keys(/** @type {import('json-schema').JSONSchema4Object} */
382
+ /** @type {import('json-schema').JSONSchema4Object} */baseObj.properties)) {
383
+ const opt = getOption(context, /** @type {import('json-schema').JSONSchema4Object} */baseObj, 'publicOnly', prop);
384
+ properties[prop] = opt;
385
+ }
386
+ return properties;
387
+ })(/** @type {import('json-schema').JSONSchema4Object} */
388
+ (/** @type {import('json-schema').JSONSchema4Object} */
389
+ (/** @type {import('json-schema').JSONSchema4Object} */
390
+ OPTIONS_SCHEMA.properties.publicOnly).oneOf)[1]),
391
+ require: (baseObj => {
392
+ /** @type {{[key: string]: boolean|undefined}} */
393
+ const properties = {};
394
+ for (const prop of Object.keys(/** @type {import('json-schema').JSONSchema4Object} */
395
+ /** @type {import('json-schema').JSONSchema4Object} */baseObj.properties)) {
396
+ const opt = getOption(context, /** @type {import('json-schema').JSONSchema4Object} */
397
+ baseObj, 'require', prop);
398
+ properties[prop] = opt;
399
+ }
400
+ return properties;
401
+ })(/** @type {import('json-schema').JSONSchema4Object} */
402
+ OPTIONS_SCHEMA.properties.require),
403
+ skipInterveningOverloadedDeclarations
404
+ };
405
+ };
406
+
407
+ /**
408
+ * @param {ESLintOrTSNode} node
409
+ */
410
+ const isFunctionWithOverload = node => {
411
+ if (node.type !== 'FunctionDeclaration') {
412
+ return false;
413
+ }
414
+ let parent;
415
+ let child;
416
+ if (node.parent?.type === 'Program') {
417
+ parent = node.parent;
418
+ child = node;
419
+ } else if (node.parent?.type === 'ExportNamedDeclaration' && node.parent?.parent.type === 'Program') {
420
+ parent = node.parent?.parent;
421
+ child = node.parent;
422
+ }
423
+ if (!child || !parent) {
424
+ return false;
425
+ }
426
+ const functionName = node.id?.name;
427
+ const idx = parent.body.indexOf(child);
428
+ const prevSibling = parent.body[idx - 1];
429
+ return (
430
+ // @ts-expect-error Should be ok
431
+ prevSibling?.type === 'TSDeclareFunction' &&
432
+ // @ts-expect-error Should be ok
433
+ functionName === prevSibling.id.name || prevSibling?.type === 'ExportNamedDeclaration' &&
434
+ // @ts-expect-error Should be ok
435
+ prevSibling.declaration?.type === 'TSDeclareFunction' &&
436
+ // @ts-expect-error Should be ok
437
+ prevSibling.declaration?.id?.name === functionName
438
+ );
439
+ };
440
+
441
+ /** @type {import('eslint').Rule.RuleModule} */
442
+ var _default = exports.default = {
443
+ create(context) {
444
+ /* c8 ignore next -- Fallback to deprecated method */
445
+ const {
446
+ // @ts-expect-error ESLint < 10
447
+ sourceCode = context.getSourceCode()
448
+ } = context;
449
+ const settings = (0, _iterateJsdoc.getSettings)(context);
450
+ if (!settings) {
451
+ return {};
452
+ }
453
+ const opts = getOptions(context, settings);
454
+ const {
455
+ checkAllFunctionExpressions,
456
+ contexts,
457
+ enableFixer,
458
+ exemptEmptyConstructors,
459
+ exemptEmptyFunctions,
460
+ exemptOverloadedImplementations,
461
+ fixerMessage,
462
+ minLineCount,
463
+ require: requireOption,
464
+ skipInterveningOverloadedDeclarations
465
+ } = opts;
466
+ const publicOnly =
467
+ /**
468
+ * @type {{
469
+ * [key: string]: boolean | undefined;
470
+ * }}
471
+ */
472
+ opts.publicOnly;
473
+
474
+ /**
475
+ * @type {import('../iterateJsdoc.js').CheckJsdoc}
476
+ */
477
+ const checkJsDoc = (info, _handler, node) => {
478
+ if (
479
+ // Optimize
480
+ minLineCount !== undefined || contexts.some(ctxt => {
481
+ if (typeof ctxt === 'string') {
482
+ return false;
483
+ }
484
+ const {
485
+ minLineCount: count
486
+ } = ctxt;
487
+ return count !== undefined;
488
+ })) {
489
+ /**
490
+ * @param {undefined|import('../iterateJsdoc.js').Integer} count
491
+ */
492
+ const underMinLine = count => {
493
+ return count !== undefined && count > (sourceCode.getText(node).match(/\n/gv)?.length ?? 0) + 1;
494
+ };
495
+ if (underMinLine(minLineCount)) {
496
+ return;
497
+ }
498
+ const {
499
+ minLineCount: contextMinLineCount
500
+ } =
501
+ /**
502
+ * @type {{
503
+ * context: string;
504
+ * inlineCommentBlock: boolean;
505
+ * minLineCount: number;
506
+ * }}
507
+ */
508
+ contexts.find(ctxt => {
509
+ if (typeof ctxt === 'string') {
510
+ return false;
511
+ }
512
+ const {
513
+ context: ctx
514
+ } = ctxt;
515
+ return ctx === (info.selector || node.type);
516
+ }) || {};
517
+ if (underMinLine(contextMinLineCount)) {
518
+ return;
519
+ }
520
+ }
521
+ if (exemptOverloadedImplementations && isFunctionWithOverload(node)) {
522
+ return;
523
+ }
524
+ const jsDocNode = (0, _jsdoccomment.getJSDocComment)(sourceCode, node, settings, {
525
+ checkOverloads: skipInterveningOverloadedDeclarations
526
+ });
527
+ if (jsDocNode) {
528
+ return;
529
+ }
530
+
531
+ // For those who have options configured against ANY constructors (or
532
+ // setters or getters) being reported
533
+ if ((0, _jsdocUtils.exemptSpeciaMethods)({
534
+ description: '',
535
+ inlineTags: [],
536
+ problems: [],
537
+ source: [],
538
+ tags: []
539
+ }, node, context, [OPTIONS_SCHEMA])) {
540
+ return;
541
+ }
542
+ if (
543
+ // Avoid reporting param-less, return-less functions (when
544
+ // `exemptEmptyFunctions` option is set)
545
+ exemptEmptyFunctions && info.isFunctionContext ||
546
+ // Avoid reporting param-less, return-less constructor methods (when
547
+ // `exemptEmptyConstructors` option is set)
548
+ exemptEmptyConstructors && (0, _jsdocUtils.isConstructor)(node)) {
549
+ const functionParameterNames = (0, _jsdocUtils.getFunctionParameterNames)(node);
550
+ if (!functionParameterNames.length && !(0, _jsdocUtils.hasReturnValue)(node)) {
551
+ return;
552
+ }
553
+ }
554
+ if (isExemptedImplementer(node, sourceCode, context, settings)) {
555
+ return;
556
+ }
557
+ const fix = /** @type {import('eslint').Rule.ReportFixer} */fixer => {
558
+ // Default to one line break if the `minLines`/`maxLines` settings allow
559
+ const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;
560
+ /** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */
561
+ let baseNode = (0, _jsdoccomment.getReducedASTNode)(node, sourceCode);
562
+ const decorator = (0, _jsdoccomment.getDecorator)(/** @type {import('eslint').Rule.Node} */
563
+ baseNode);
564
+ if (decorator) {
565
+ baseNode = decorator;
566
+ }
567
+ const indent = (0, _jsdocUtils.getIndent)({
568
+ text: sourceCode.getText(/** @type {import('eslint').Rule.Node} */baseNode, /** @type {import('eslint').AST.SourceLocation} */
569
+ (/** @type {import('eslint').Rule.Node} */baseNode.loc).start.column)
570
+ });
571
+ const {
572
+ inlineCommentBlock
573
+ } =
574
+ /**
575
+ * @type {{
576
+ * context: string,
577
+ * inlineCommentBlock: boolean,
578
+ * minLineCount: import('../iterateJsdoc.js').Integer
579
+ * }}
580
+ */
581
+ contexts.find(contxt => {
582
+ if (typeof contxt === 'string') {
583
+ return false;
584
+ }
585
+ const {
586
+ context: ctxt
587
+ } = contxt;
588
+ return ctxt === node.type;
589
+ }) || {};
590
+ const insertion = (inlineCommentBlock ? `/** ${fixerMessage}` : `/**\n${indent}*${fixerMessage}\n${indent}`) + `*/${'\n'.repeat(lines)}${indent.slice(0, -1)}`;
591
+ return fixer.insertTextBefore(/** @type {import('eslint').Rule.Node} */
592
+ baseNode, insertion);
593
+ };
594
+ const report = () => {
595
+ const {
596
+ start
597
+ } = /** @type {import('eslint').AST.SourceLocation} */node.loc;
598
+ const loc = {
599
+ end: {
600
+ column: 0,
601
+ line: start.line + 1
602
+ },
603
+ start
604
+ };
605
+ context.report({
606
+ fix: enableFixer ? fix : null,
607
+ loc,
608
+ messageId: 'missingJsDoc',
609
+ node
610
+ });
611
+ };
612
+ if (publicOnly) {
613
+ /** @type {RequireJsdocOpts} */
614
+ const opt = {
615
+ ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),
616
+ esm: Boolean(publicOnly?.esm ?? true),
617
+ initModuleExports: Boolean(publicOnly?.cjs ?? true),
618
+ initWindow: Boolean(publicOnly?.window ?? false)
619
+ };
620
+ const exported = _exportParser.default.isUncommentedExport(node, sourceCode, opt, settings);
621
+ if (exported) {
622
+ report();
623
+ }
624
+ } else {
625
+ report();
626
+ }
627
+ };
628
+
629
+ /**
630
+ * @param {string} prop
631
+ * @returns {boolean}
632
+ */
633
+ const hasOption = prop => {
634
+ return requireOption[prop] || contexts.some(ctxt => {
635
+ return typeof ctxt === 'object' ? ctxt.context === prop : ctxt === prop;
636
+ });
637
+ };
638
+ return {
639
+ ...(0, _jsdocUtils.getContextObject)((0, _jsdocUtils.enforcedContexts)(context, [], settings), checkJsDoc),
640
+ ArrowFunctionExpression(node) {
641
+ if (!hasOption('ArrowFunctionExpression')) {
642
+ return;
643
+ }
644
+ if (['AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator'].includes(node.parent.type) || ['ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition'].includes(node.parent.type) && node ===
645
+ /**
646
+ * @type {import('@typescript-eslint/types').TSESTree.Property|
647
+ * import('@typescript-eslint/types').TSESTree.PropertyDefinition
648
+ * }
649
+ */
650
+ node.parent.value) {
651
+ checkJsDoc({
652
+ isFunctionContext: true
653
+ }, null, node);
654
+ }
655
+ },
656
+ ClassDeclaration(node) {
657
+ if (!hasOption('ClassDeclaration')) {
658
+ return;
659
+ }
660
+ checkJsDoc({
661
+ isFunctionContext: false
662
+ }, null, node);
663
+ },
664
+ ClassExpression(node) {
665
+ if (!hasOption('ClassExpression')) {
666
+ return;
667
+ }
668
+ checkJsDoc({
669
+ isFunctionContext: false
670
+ }, null, node);
671
+ },
672
+ FunctionDeclaration(node) {
673
+ if (!hasOption('FunctionDeclaration')) {
674
+ return;
675
+ }
676
+ checkJsDoc({
677
+ isFunctionContext: true
678
+ }, null, node);
679
+ },
680
+ FunctionExpression(node) {
681
+ if (!hasOption('FunctionExpression')) {
682
+ return;
683
+ }
684
+ if (checkAllFunctionExpressions || ['AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator'].includes(node.parent.type) || ['ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition'].includes(node.parent.type) && node ===
685
+ /**
686
+ * @type {import('@typescript-eslint/types').TSESTree.Property|
687
+ * import('@typescript-eslint/types').TSESTree.PropertyDefinition
688
+ * }
689
+ */
690
+ node.parent.value) {
691
+ checkJsDoc({
692
+ isFunctionContext: true
693
+ }, null, node);
694
+ }
695
+ },
696
+ MethodDefinition(node) {
697
+ if (!hasOption('MethodDefinition')) {
698
+ return;
699
+ }
700
+ checkJsDoc({
701
+ isFunctionContext: true,
702
+ selector: 'MethodDefinition'
703
+ }, null, /** @type {import('eslint').Rule.Node} */node.value);
704
+ }
705
+ };
706
+ },
707
+ meta: {
708
+ docs: {
709
+ description: 'Checks for presence of JSDoc comments, on functions and potentially other contexts (optionally limited to exports).',
710
+ recommended: true,
711
+ url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md#repos-sticky-header'
712
+ },
713
+ fixable: 'code',
714
+ messages: {
715
+ missingJsDoc: 'Missing JSDoc comment.'
716
+ },
717
+ schema: [OPTIONS_SCHEMA],
718
+ type: 'suggestion'
719
+ }
720
+ };
721
+ module.exports = exports.default;
722
+ //# sourceMappingURL=requireJsdoc.cjs.map