eslint-plugin-jsdoc 53.0.1 → 54.1.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 (359) hide show
  1. package/dist/WarnSettings.cjs +35 -18
  2. package/dist/WarnSettings.cjs.map +1 -1
  3. package/dist/alignTransform.cjs +305 -224
  4. package/dist/alignTransform.cjs.map +1 -1
  5. package/dist/defaultTagOrder.cjs +43 -132
  6. package/dist/defaultTagOrder.cjs.map +1 -1
  7. package/dist/exportParser.cjs +696 -478
  8. package/dist/exportParser.cjs.map +1 -1
  9. package/dist/generateRule.cjs +242 -0
  10. package/dist/generateRule.cjs.map +1 -0
  11. package/dist/getDefaultTagStructureForMode.cjs +288 -184
  12. package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
  13. package/dist/getJsdocProcessorPlugin.cjs +550 -364
  14. package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
  15. package/dist/getJsdocProcessorPlugin.d.ts +65 -68
  16. package/dist/getJsdocProcessorPlugin.d.ts.map +1 -1
  17. package/dist/index.cjs +410 -2
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/index.d.ts +17 -2
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/iterateJsdoc.cjs +2007 -1539
  22. package/dist/iterateJsdoc.cjs.map +1 -1
  23. package/dist/iterateJsdoc.d.ts +350 -359
  24. package/dist/iterateJsdoc.d.ts.map +1 -1
  25. package/dist/jsdocUtils.cjs +1376 -1009
  26. package/dist/jsdocUtils.cjs.map +1 -1
  27. package/dist/rules/checkAccess.cjs +36 -29
  28. package/dist/rules/checkAccess.cjs.map +1 -1
  29. package/dist/rules/checkAlignment.cjs +54 -41
  30. package/dist/rules/checkAlignment.cjs.map +1 -1
  31. package/dist/rules/checkExamples.cjs +484 -327
  32. package/dist/rules/checkExamples.cjs.map +1 -1
  33. package/dist/rules/checkIndentation.cjs +65 -50
  34. package/dist/rules/checkIndentation.cjs.map +1 -1
  35. package/dist/rules/checkLineAlignment.cjs +311 -220
  36. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  37. package/dist/rules/checkParamNames.cjs +335 -227
  38. package/dist/rules/checkParamNames.cjs.map +1 -1
  39. package/dist/rules/checkPropertyNames.cjs +106 -78
  40. package/dist/rules/checkPropertyNames.cjs.map +1 -1
  41. package/dist/rules/checkSyntax.cjs +34 -21
  42. package/dist/rules/checkSyntax.cjs.map +1 -1
  43. package/dist/rules/checkTagNames.cjs +210 -188
  44. package/dist/rules/checkTagNames.cjs.map +1 -1
  45. package/dist/rules/checkTemplateNames.cjs +178 -121
  46. package/dist/rules/checkTemplateNames.cjs.map +1 -1
  47. package/dist/rules/checkTypes.cjs +385 -291
  48. package/dist/rules/checkTypes.cjs.map +1 -1
  49. package/dist/rules/checkValues.cjs +146 -100
  50. package/dist/rules/checkValues.cjs.map +1 -1
  51. package/dist/rules/convertToJsdocComments.cjs +306 -228
  52. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  53. package/dist/rules/emptyTags.cjs +72 -62
  54. package/dist/rules/emptyTags.cjs.map +1 -1
  55. package/dist/rules/implementsOnClasses.cjs +56 -36
  56. package/dist/rules/implementsOnClasses.cjs.map +1 -1
  57. package/dist/rules/importsAsDependencies.cjs +99 -62
  58. package/dist/rules/importsAsDependencies.cjs.map +1 -1
  59. package/dist/rules/informativeDocs.cjs +142 -105
  60. package/dist/rules/informativeDocs.cjs.map +1 -1
  61. package/dist/rules/linesBeforeBlock.cjs +105 -70
  62. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  63. package/dist/rules/matchDescription.cjs +222 -160
  64. package/dist/rules/matchDescription.cjs.map +1 -1
  65. package/dist/rules/matchName.cjs +128 -73
  66. package/dist/rules/matchName.cjs.map +1 -1
  67. package/dist/rules/multilineBlocks.cjs +352 -235
  68. package/dist/rules/multilineBlocks.cjs.map +1 -1
  69. package/dist/rules/noBadBlocks.cjs +86 -63
  70. package/dist/rules/noBadBlocks.cjs.map +1 -1
  71. package/dist/rules/noBlankBlockDescriptions.cjs +57 -35
  72. package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
  73. package/dist/rules/noBlankBlocks.cjs +48 -26
  74. package/dist/rules/noBlankBlocks.cjs.map +1 -1
  75. package/dist/rules/noDefaults.cjs +79 -52
  76. package/dist/rules/noDefaults.cjs.map +1 -1
  77. package/dist/rules/noMissingSyntax.cjs +165 -115
  78. package/dist/rules/noMissingSyntax.cjs.map +1 -1
  79. package/dist/rules/noMultiAsterisks.cjs +89 -48
  80. package/dist/rules/noMultiAsterisks.cjs.map +1 -1
  81. package/dist/rules/noRestrictedSyntax.cjs +79 -45
  82. package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
  83. package/dist/rules/noTypes.cjs +80 -59
  84. package/dist/rules/noTypes.cjs.map +1 -1
  85. package/dist/rules/noUndefinedTypes.cjs +391 -297
  86. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  87. package/dist/rules/requireAsteriskPrefix.cjs +159 -108
  88. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  89. package/dist/rules/requireDescription.cjs +129 -89
  90. package/dist/rules/requireDescription.cjs.map +1 -1
  91. package/dist/rules/requireDescriptionCompleteSentence.cjs +262 -201
  92. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  93. package/dist/rules/requireExample.cjs +104 -73
  94. package/dist/rules/requireExample.cjs.map +1 -1
  95. package/dist/rules/requireFileOverview.cjs +129 -75
  96. package/dist/rules/requireFileOverview.cjs.map +1 -1
  97. package/dist/rules/requireHyphenBeforeParamDescription.cjs +133 -85
  98. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  99. package/dist/rules/requireJsdoc.cjs +559 -384
  100. package/dist/rules/requireJsdoc.cjs.map +1 -1
  101. package/dist/rules/requireParam.cjs +526 -336
  102. package/dist/rules/requireParam.cjs.map +1 -1
  103. package/dist/rules/requireParamDescription.cjs +80 -55
  104. package/dist/rules/requireParamDescription.cjs.map +1 -1
  105. package/dist/rules/requireParamName.cjs +50 -32
  106. package/dist/rules/requireParamName.cjs.map +1 -1
  107. package/dist/rules/requireParamType.cjs +80 -55
  108. package/dist/rules/requireParamType.cjs.map +1 -1
  109. package/dist/rules/requireProperty.cjs +42 -31
  110. package/dist/rules/requireProperty.cjs.map +1 -1
  111. package/dist/rules/requirePropertyDescription.cjs +25 -17
  112. package/dist/rules/requirePropertyDescription.cjs.map +1 -1
  113. package/dist/rules/requirePropertyName.cjs +25 -17
  114. package/dist/rules/requirePropertyName.cjs.map +1 -1
  115. package/dist/rules/requirePropertyType.cjs +25 -17
  116. package/dist/rules/requirePropertyType.cjs.map +1 -1
  117. package/dist/rules/requireReturns.cjs +203 -125
  118. package/dist/rules/requireReturns.cjs.map +1 -1
  119. package/dist/rules/requireReturnsCheck.cjs +103 -60
  120. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  121. package/dist/rules/requireReturnsDescription.cjs +54 -39
  122. package/dist/rules/requireReturnsDescription.cjs.map +1 -1
  123. package/dist/rules/requireReturnsType.cjs +50 -32
  124. package/dist/rules/requireReturnsType.cjs.map +1 -1
  125. package/dist/rules/requireTemplate.cjs +178 -119
  126. package/dist/rules/requireTemplate.cjs.map +1 -1
  127. package/dist/rules/requireThrows.cjs +95 -61
  128. package/dist/rules/requireThrows.cjs.map +1 -1
  129. package/dist/rules/requireYields.cjs +166 -106
  130. package/dist/rules/requireYields.cjs.map +1 -1
  131. package/dist/rules/requireYieldsCheck.cjs +152 -96
  132. package/dist/rules/requireYieldsCheck.cjs.map +1 -1
  133. package/dist/rules/sortTags.cjs +444 -258
  134. package/dist/rules/sortTags.cjs.map +1 -1
  135. package/dist/rules/tagLines.cjs +266 -179
  136. package/dist/rules/tagLines.cjs.map +1 -1
  137. package/dist/rules/textEscaping.cjs +127 -92
  138. package/dist/rules/textEscaping.cjs.map +1 -1
  139. package/dist/rules/validTypes.cjs +265 -252
  140. package/dist/rules/validTypes.cjs.map +1 -1
  141. package/dist/tagNames.cjs +170 -134
  142. package/dist/tagNames.cjs.map +1 -1
  143. package/dist/utils/hasReturnValue.cjs +474 -246
  144. package/dist/utils/hasReturnValue.cjs.map +1 -1
  145. package/package.json +41 -57
  146. package/src/WarnSettings.js +34 -0
  147. package/src/alignTransform.js +358 -0
  148. package/src/defaultTagOrder.js +169 -0
  149. package/src/exportParser.js +978 -0
  150. package/src/getDefaultTagStructureForMode.js +969 -0
  151. package/src/getJsdocProcessorPlugin.js +672 -0
  152. package/src/index.js +530 -0
  153. package/src/iterateJsdoc.js +2542 -0
  154. package/src/jsdocUtils.js +1896 -0
  155. package/src/rules/checkAccess.js +45 -0
  156. package/src/rules/checkAlignment.js +63 -0
  157. package/src/rules/checkExamples.js +589 -0
  158. package/src/rules/checkIndentation.js +75 -0
  159. package/src/rules/checkLineAlignment.js +372 -0
  160. package/src/rules/checkParamNames.js +474 -0
  161. package/src/rules/checkPropertyNames.js +152 -0
  162. package/src/rules/checkSyntax.js +30 -0
  163. package/src/rules/checkTagNames.js +314 -0
  164. package/src/rules/checkTemplateNames.js +204 -0
  165. package/src/rules/checkTypes.js +535 -0
  166. package/src/rules/checkValues.js +248 -0
  167. package/src/rules/convertToJsdocComments.js +398 -0
  168. package/src/rules/emptyTags.js +98 -0
  169. package/src/rules/implementsOnClasses.js +64 -0
  170. package/src/rules/importsAsDependencies.js +133 -0
  171. package/src/rules/informativeDocs.js +189 -0
  172. package/src/rules/linesBeforeBlock.js +134 -0
  173. package/src/rules/matchDescription.js +286 -0
  174. package/src/rules/matchName.js +151 -0
  175. package/src/rules/multilineBlocks.js +493 -0
  176. package/src/rules/noBadBlocks.js +119 -0
  177. package/src/rules/noBlankBlockDescriptions.js +69 -0
  178. package/src/rules/noBlankBlocks.js +53 -0
  179. package/src/rules/noDefaults.js +85 -0
  180. package/src/rules/noMissingSyntax.js +195 -0
  181. package/src/rules/noMultiAsterisks.js +134 -0
  182. package/src/rules/noRestrictedSyntax.js +91 -0
  183. package/src/rules/noTypes.js +93 -0
  184. package/src/rules/noUndefinedTypes.js +545 -0
  185. package/src/rules/requireAsteriskPrefix.js +190 -0
  186. package/src/rules/requireDescription.js +161 -0
  187. package/src/rules/requireDescriptionCompleteSentence.js +335 -0
  188. package/src/rules/requireExample.js +118 -0
  189. package/src/rules/requireFileOverview.js +154 -0
  190. package/src/rules/requireHyphenBeforeParamDescription.js +176 -0
  191. package/src/rules/requireJsdoc.js +744 -0
  192. package/src/rules/requireParam.js +602 -0
  193. package/src/rules/requireParamDescription.js +89 -0
  194. package/src/rules/requireParamName.js +55 -0
  195. package/src/rules/requireParamType.js +89 -0
  196. package/src/rules/requireProperty.js +48 -0
  197. package/src/rules/requirePropertyDescription.js +25 -0
  198. package/src/rules/requirePropertyName.js +25 -0
  199. package/src/rules/requirePropertyType.js +25 -0
  200. package/src/rules/requireReturns.js +238 -0
  201. package/src/rules/requireReturnsCheck.js +145 -0
  202. package/src/rules/requireReturnsDescription.js +59 -0
  203. package/src/rules/requireReturnsType.js +51 -0
  204. package/src/rules/requireTemplate.js +201 -0
  205. package/src/rules/requireThrows.js +111 -0
  206. package/src/rules/requireYields.js +216 -0
  207. package/src/rules/requireYieldsCheck.js +208 -0
  208. package/src/rules/sortTags.js +558 -0
  209. package/src/rules/tagLines.js +359 -0
  210. package/src/rules/textEscaping.js +154 -0
  211. package/src/rules/validTypes.js +401 -0
  212. package/src/tagNames.js +238 -0
  213. package/src/utils/hasReturnValue.js +572 -0
  214. package/dist/WarnSettings.js +0 -20
  215. package/dist/WarnSettings.js.map +0 -1
  216. package/dist/_virtual/rolldown_runtime.cjs +0 -32
  217. package/dist/_virtual/rolldown_runtime.js +0 -11
  218. package/dist/alignTransform.js +0 -241
  219. package/dist/alignTransform.js.map +0 -1
  220. package/dist/defaultTagOrder.js +0 -134
  221. package/dist/defaultTagOrder.js.map +0 -1
  222. package/dist/exportParser.js +0 -518
  223. package/dist/exportParser.js.map +0 -1
  224. package/dist/getDefaultTagStructureForMode.js +0 -188
  225. package/dist/getDefaultTagStructureForMode.js.map +0 -1
  226. package/dist/getJsdocProcessorPlugin.d.cts +0 -70
  227. package/dist/getJsdocProcessorPlugin.d.cts.map +0 -1
  228. package/dist/getJsdocProcessorPlugin.js +0 -383
  229. package/dist/getJsdocProcessorPlugin.js.map +0 -1
  230. package/dist/index.d.cts +0 -2
  231. package/dist/index.js +0 -3
  232. package/dist/iterateJsdoc.d.cts +0 -472
  233. package/dist/iterateJsdoc.d.cts.map +0 -1
  234. package/dist/iterateJsdoc.js +0 -1628
  235. package/dist/iterateJsdoc.js.map +0 -1
  236. package/dist/jsdocUtils.js +0 -1123
  237. package/dist/jsdocUtils.js.map +0 -1
  238. package/dist/plugin.cjs +0 -427
  239. package/dist/plugin.cjs.map +0 -1
  240. package/dist/plugin.js +0 -427
  241. package/dist/plugin.js.map +0 -1
  242. package/dist/rules/checkAccess.js +0 -33
  243. package/dist/rules/checkAccess.js.map +0 -1
  244. package/dist/rules/checkAlignment.js +0 -47
  245. package/dist/rules/checkAlignment.js.map +0 -1
  246. package/dist/rules/checkExamples.js +0 -348
  247. package/dist/rules/checkExamples.js.map +0 -1
  248. package/dist/rules/checkIndentation.js +0 -59
  249. package/dist/rules/checkIndentation.js.map +0 -1
  250. package/dist/rules/checkLineAlignment.js +0 -229
  251. package/dist/rules/checkLineAlignment.js.map +0 -1
  252. package/dist/rules/checkParamNames.js +0 -237
  253. package/dist/rules/checkParamNames.js.map +0 -1
  254. package/dist/rules/checkPropertyNames.js +0 -88
  255. package/dist/rules/checkPropertyNames.js.map +0 -1
  256. package/dist/rules/checkSyntax.js +0 -25
  257. package/dist/rules/checkSyntax.js.map +0 -1
  258. package/dist/rules/checkTagNames.js +0 -191
  259. package/dist/rules/checkTagNames.js.map +0 -1
  260. package/dist/rules/checkTemplateNames.js +0 -124
  261. package/dist/rules/checkTemplateNames.js.map +0 -1
  262. package/dist/rules/checkTypes.js +0 -299
  263. package/dist/rules/checkTypes.js.map +0 -1
  264. package/dist/rules/checkValues.js +0 -103
  265. package/dist/rules/checkValues.js.map +0 -1
  266. package/dist/rules/convertToJsdocComments.js +0 -231
  267. package/dist/rules/convertToJsdocComments.js.map +0 -1
  268. package/dist/rules/emptyTags.js +0 -67
  269. package/dist/rules/emptyTags.js.map +0 -1
  270. package/dist/rules/implementsOnClasses.js +0 -40
  271. package/dist/rules/implementsOnClasses.js.map +0 -1
  272. package/dist/rules/importsAsDependencies.js +0 -68
  273. package/dist/rules/importsAsDependencies.js.map +0 -1
  274. package/dist/rules/informativeDocs.js +0 -110
  275. package/dist/rules/informativeDocs.js.map +0 -1
  276. package/dist/rules/linesBeforeBlock.js +0 -75
  277. package/dist/rules/linesBeforeBlock.js.map +0 -1
  278. package/dist/rules/matchDescription.js +0 -167
  279. package/dist/rules/matchDescription.js.map +0 -1
  280. package/dist/rules/matchName.js +0 -77
  281. package/dist/rules/matchName.js.map +0 -1
  282. package/dist/rules/multilineBlocks.js +0 -245
  283. package/dist/rules/multilineBlocks.js.map +0 -1
  284. package/dist/rules/noBadBlocks.js +0 -68
  285. package/dist/rules/noBadBlocks.js.map +0 -1
  286. package/dist/rules/noBlankBlockDescriptions.js +0 -41
  287. package/dist/rules/noBlankBlockDescriptions.js.map +0 -1
  288. package/dist/rules/noBlankBlocks.js +0 -30
  289. package/dist/rules/noBlankBlocks.js.map +0 -1
  290. package/dist/rules/noDefaults.js +0 -56
  291. package/dist/rules/noDefaults.js.map +0 -1
  292. package/dist/rules/noMissingSyntax.js +0 -126
  293. package/dist/rules/noMissingSyntax.js.map +0 -1
  294. package/dist/rules/noMultiAsterisks.js +0 -58
  295. package/dist/rules/noMultiAsterisks.js.map +0 -1
  296. package/dist/rules/noRestrictedSyntax.js +0 -49
  297. package/dist/rules/noRestrictedSyntax.js.map +0 -1
  298. package/dist/rules/noTypes.js +0 -65
  299. package/dist/rules/noTypes.js.map +0 -1
  300. package/dist/rules/noUndefinedTypes.js +0 -303
  301. package/dist/rules/noUndefinedTypes.js.map +0 -1
  302. package/dist/rules/requireAsteriskPrefix.js +0 -112
  303. package/dist/rules/requireAsteriskPrefix.js.map +0 -1
  304. package/dist/rules/requireDescription.js +0 -95
  305. package/dist/rules/requireDescription.js.map +0 -1
  306. package/dist/rules/requireDescriptionCompleteSentence.js +0 -220
  307. package/dist/rules/requireDescriptionCompleteSentence.js.map +0 -1
  308. package/dist/rules/requireExample.js +0 -77
  309. package/dist/rules/requireExample.js.map +0 -1
  310. package/dist/rules/requireFileOverview.js +0 -81
  311. package/dist/rules/requireFileOverview.js.map +0 -1
  312. package/dist/rules/requireHyphenBeforeParamDescription.js +0 -89
  313. package/dist/rules/requireHyphenBeforeParamDescription.js.map +0 -1
  314. package/dist/rules/requireJsdoc.js +0 -404
  315. package/dist/rules/requireJsdoc.js.map +0 -1
  316. package/dist/rules/requireParam.js +0 -344
  317. package/dist/rules/requireParam.js.map +0 -1
  318. package/dist/rules/requireParamDescription.js +0 -59
  319. package/dist/rules/requireParamDescription.js.map +0 -1
  320. package/dist/rules/requireParamName.js +0 -36
  321. package/dist/rules/requireParamName.js.map +0 -1
  322. package/dist/rules/requireParamType.js +0 -59
  323. package/dist/rules/requireParamType.js.map +0 -1
  324. package/dist/rules/requireProperty.js +0 -35
  325. package/dist/rules/requireProperty.js.map +0 -1
  326. package/dist/rules/requirePropertyDescription.js +0 -21
  327. package/dist/rules/requirePropertyDescription.js.map +0 -1
  328. package/dist/rules/requirePropertyName.js +0 -21
  329. package/dist/rules/requirePropertyName.js.map +0 -1
  330. package/dist/rules/requirePropertyType.js +0 -21
  331. package/dist/rules/requirePropertyType.js.map +0 -1
  332. package/dist/rules/requireReturns.js +0 -131
  333. package/dist/rules/requireReturns.js.map +0 -1
  334. package/dist/rules/requireReturnsCheck.js +0 -66
  335. package/dist/rules/requireReturnsCheck.js.map +0 -1
  336. package/dist/rules/requireReturnsDescription.js +0 -43
  337. package/dist/rules/requireReturnsDescription.js.map +0 -1
  338. package/dist/rules/requireReturnsType.js +0 -36
  339. package/dist/rules/requireReturnsType.js.map +0 -1
  340. package/dist/rules/requireTemplate.js +0 -122
  341. package/dist/rules/requireTemplate.js.map +0 -1
  342. package/dist/rules/requireThrows.js +0 -67
  343. package/dist/rules/requireThrows.js.map +0 -1
  344. package/dist/rules/requireYields.js +0 -115
  345. package/dist/rules/requireYields.js.map +0 -1
  346. package/dist/rules/requireYieldsCheck.js +0 -105
  347. package/dist/rules/requireYieldsCheck.js.map +0 -1
  348. package/dist/rules/sortTags.js +0 -262
  349. package/dist/rules/sortTags.js.map +0 -1
  350. package/dist/rules/tagLines.js +0 -183
  351. package/dist/rules/tagLines.js.map +0 -1
  352. package/dist/rules/textEscaping.js +0 -102
  353. package/dist/rules/textEscaping.js.map +0 -1
  354. package/dist/rules/validTypes.js +0 -259
  355. package/dist/rules/validTypes.js.map +0 -1
  356. package/dist/tagNames.js +0 -144
  357. package/dist/tagNames.js.map +0 -1
  358. package/dist/utils/hasReturnValue.js +0 -265
  359. package/dist/utils/hasReturnValue.js.map +0 -1
@@ -1,404 +0,0 @@
1
- import { hasReturnValue } from "../utils/hasReturnValue.js";
2
- import { enforcedContexts, exemptSpeciaMethods, getContextObject, getFunctionParameterNames, getIndent, isConstructor } from "../jsdocUtils.js";
3
- import { getSettings } from "../iterateJsdoc.js";
4
- import exportParser_default from "../exportParser.js";
5
- import { getDecorator, getJSDocComment, getReducedASTNode } from "@es-joy/jsdoccomment";
6
-
7
- //#region src/rules/requireJsdoc.js
8
- /**
9
- * @typedef {{
10
- * ancestorsOnly: boolean,
11
- * esm: boolean,
12
- * initModuleExports: boolean,
13
- * initWindow: boolean
14
- * }} RequireJsdocOpts
15
- */
16
- /**
17
- * @typedef {import('eslint').Rule.Node|
18
- * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode
19
- */
20
- /** @type {import('json-schema').JSONSchema4} */
21
- const OPTIONS_SCHEMA = {
22
- additionalProperties: false,
23
- properties: {
24
- checkConstructors: {
25
- default: true,
26
- type: "boolean"
27
- },
28
- checkGetters: {
29
- anyOf: [{ type: "boolean" }, {
30
- enum: ["no-setter"],
31
- type: "string"
32
- }],
33
- default: true
34
- },
35
- checkSetters: {
36
- anyOf: [{ type: "boolean" }, {
37
- enum: ["no-getter"],
38
- type: "string"
39
- }],
40
- default: true
41
- },
42
- contexts: {
43
- items: { anyOf: [{ type: "string" }, {
44
- additionalProperties: false,
45
- properties: {
46
- context: { type: "string" },
47
- inlineCommentBlock: { type: "boolean" },
48
- minLineCount: { type: "integer" }
49
- },
50
- type: "object"
51
- }] },
52
- type: "array"
53
- },
54
- enableFixer: {
55
- default: true,
56
- type: "boolean"
57
- },
58
- exemptEmptyConstructors: {
59
- default: false,
60
- type: "boolean"
61
- },
62
- exemptEmptyFunctions: {
63
- default: false,
64
- type: "boolean"
65
- },
66
- fixerMessage: {
67
- default: "",
68
- type: "string"
69
- },
70
- minLineCount: { type: "integer" },
71
- publicOnly: { oneOf: [{
72
- default: false,
73
- type: "boolean"
74
- }, {
75
- additionalProperties: false,
76
- default: {},
77
- properties: {
78
- ancestorsOnly: { type: "boolean" },
79
- cjs: { type: "boolean" },
80
- esm: { type: "boolean" },
81
- window: { type: "boolean" }
82
- },
83
- type: "object"
84
- }] },
85
- require: {
86
- additionalProperties: false,
87
- default: {},
88
- properties: {
89
- ArrowFunctionExpression: {
90
- default: false,
91
- type: "boolean"
92
- },
93
- ClassDeclaration: {
94
- default: false,
95
- type: "boolean"
96
- },
97
- ClassExpression: {
98
- default: false,
99
- type: "boolean"
100
- },
101
- FunctionDeclaration: {
102
- default: true,
103
- type: "boolean"
104
- },
105
- FunctionExpression: {
106
- default: false,
107
- type: "boolean"
108
- },
109
- MethodDefinition: {
110
- default: false,
111
- type: "boolean"
112
- }
113
- },
114
- type: "object"
115
- }
116
- },
117
- type: "object"
118
- };
119
- /**
120
- * @param {string} interfaceName
121
- * @param {string} methodName
122
- * @param {import("eslint").Scope.Scope | null} scope
123
- * @returns {import('@typescript-eslint/types').TSESTree.TSMethodSignature|null}
124
- */
125
- const getMethodOnInterface = (interfaceName, methodName, scope) => {
126
- let scp = scope;
127
- while (scp) {
128
- for (const { identifiers, name } of scp.variables) {
129
- if (interfaceName !== name) continue;
130
- for (const identifier of identifiers) {
131
- const interfaceDeclaration = identifier.parent;
132
- /* c8 ignore next 3 -- TS */
133
- if (interfaceDeclaration.type !== "TSInterfaceDeclaration") continue;
134
- for (const bodyItem of interfaceDeclaration.body.body) {
135
- const methodSig = bodyItem;
136
- if (methodName === methodSig.key.name) return methodSig;
137
- }
138
- }
139
- }
140
- scp = scp.upper;
141
- }
142
- return null;
143
- };
144
- /**
145
- * @param {import('eslint').Rule.Node} node
146
- * @param {import('eslint').SourceCode} sourceCode
147
- * @param {import('eslint').Rule.RuleContext} context
148
- * @param {import('../iterateJsdoc.js').Settings} settings
149
- */
150
- const isExemptedImplementer = (node, sourceCode, context, settings) => {
151
- 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) {
152
- const implments = node.parent.parent.parent.implements;
153
- const { name: methodName } = node.parent.key;
154
- for (const impl of implments) {
155
- const { name: interfaceName } = impl.expression;
156
- const interfaceMethodNode = getMethodOnInterface(interfaceName, methodName, node && (sourceCode.getScope && sourceCode.getScope(node) || context.getScope()));
157
- if (interfaceMethodNode) {
158
- const comment = getJSDocComment(sourceCode, interfaceMethodNode, settings);
159
- if (comment) return true;
160
- }
161
- }
162
- }
163
- return false;
164
- };
165
- /**
166
- * @param {import('eslint').Rule.RuleContext} context
167
- * @param {import('json-schema').JSONSchema4Object} baseObject
168
- * @param {string} option
169
- * @param {string} key
170
- * @returns {boolean|undefined}
171
- */
172
- const getOption = (context, baseObject, option, key) => {
173
- if (context.options[0] && option in context.options[0] && (typeof context.options[0][option] === "boolean" || key in context.options[0][option])) return context.options[0][option][key];
174
- return baseObject.properties[key].default;
175
- };
176
- /**
177
- * @param {import('eslint').Rule.RuleContext} context
178
- * @param {import('../iterateJsdoc.js').Settings} settings
179
- * @returns {{
180
- * contexts: (string|{
181
- * context: string,
182
- * inlineCommentBlock: boolean,
183
- * minLineCount: import('../iterateJsdoc.js').Integer
184
- * })[],
185
- * enableFixer: boolean,
186
- * exemptEmptyConstructors: boolean,
187
- * exemptEmptyFunctions: boolean,
188
- * fixerMessage: string,
189
- * minLineCount: undefined|import('../iterateJsdoc.js').Integer,
190
- * publicOnly: boolean|{[key: string]: boolean|undefined}
191
- * require: {[key: string]: boolean|undefined}
192
- * }}
193
- */
194
- const getOptions = (context, settings) => {
195
- const { contexts = settings.contexts || [], enableFixer = true, exemptEmptyConstructors = true, exemptEmptyFunctions = false, fixerMessage = "", minLineCount = void 0, publicOnly } = context.options[0] || {};
196
- return {
197
- contexts,
198
- enableFixer,
199
- exemptEmptyConstructors,
200
- exemptEmptyFunctions,
201
- fixerMessage,
202
- minLineCount,
203
- publicOnly: ((baseObj) => {
204
- if (!publicOnly) return false;
205
- /** @type {{[key: string]: boolean|undefined}} */
206
- const properties = {};
207
- for (const prop of Object.keys(
208
- /** @type {import('json-schema').JSONSchema4Object} */
209
- baseObj.properties
210
- )) {
211
- const opt = getOption(context, baseObj, "publicOnly", prop);
212
- properties[prop] = opt;
213
- }
214
- return properties;
215
- })(
216
- /** @type {import('json-schema').JSONSchema4Object} */
217
- OPTIONS_SCHEMA.properties.publicOnly.oneOf[1]
218
- ),
219
- require: ((baseObj) => {
220
- /** @type {{[key: string]: boolean|undefined}} */
221
- const properties = {};
222
- for (const prop of Object.keys(
223
- /** @type {import('json-schema').JSONSchema4Object} */
224
- baseObj.properties
225
- )) {
226
- const opt = getOption(context, baseObj, "require", prop);
227
- properties[prop] = opt;
228
- }
229
- return properties;
230
- })(
231
- /** @type {import('json-schema').JSONSchema4Object} */
232
- OPTIONS_SCHEMA.properties.require
233
- )
234
- };
235
- };
236
- /** @type {import('eslint').Rule.RuleModule} */
237
- var requireJsdoc_default = {
238
- create(context) {
239
- /* c8 ignore next -- Fallback to deprecated method */
240
- const { sourceCode = context.getSourceCode() } = context;
241
- const settings = getSettings(context);
242
- if (!settings) return {};
243
- const opts = getOptions(context, settings);
244
- const { contexts, enableFixer, exemptEmptyConstructors, exemptEmptyFunctions, fixerMessage, minLineCount, require: requireOption } = opts;
245
- const publicOnly = opts.publicOnly;
246
- /**
247
- * @type {import('../iterateJsdoc.js').CheckJsdoc}
248
- */
249
- const checkJsDoc = (info, _handler, node) => {
250
- if (minLineCount !== void 0 || contexts.some((ctxt) => {
251
- if (typeof ctxt === "string") return false;
252
- const { minLineCount: count } = ctxt;
253
- return count !== void 0;
254
- })) {
255
- /**
256
- * @param {undefined|import('../iterateJsdoc.js').Integer} count
257
- */
258
- const underMinLine = (count) => {
259
- return count !== void 0 && count > (sourceCode.getText(node).match(/\n/gv)?.length ?? 0) + 1;
260
- };
261
- if (underMinLine(minLineCount)) return;
262
- const { minLineCount: contextMinLineCount } = contexts.find((ctxt) => {
263
- if (typeof ctxt === "string") return false;
264
- const { context: ctx } = ctxt;
265
- return ctx === (info.selector || node.type);
266
- }) || {};
267
- if (underMinLine(contextMinLineCount)) return;
268
- }
269
- const jsDocNode = getJSDocComment(sourceCode, node, settings);
270
- if (jsDocNode) return;
271
- if (exemptSpeciaMethods({
272
- description: "",
273
- inlineTags: [],
274
- problems: [],
275
- source: [],
276
- tags: []
277
- }, node, context, [OPTIONS_SCHEMA])) return;
278
- if (exemptEmptyFunctions && info.isFunctionContext || exemptEmptyConstructors && isConstructor(node)) {
279
- const functionParameterNames = getFunctionParameterNames(node);
280
- if (!functionParameterNames.length && !hasReturnValue(node)) return;
281
- }
282
- if (isExemptedImplementer(node, sourceCode, context, settings)) return;
283
- const fix = (fixer) => {
284
- const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;
285
- /** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */
286
- let baseNode = getReducedASTNode(node, sourceCode);
287
- const decorator = getDecorator(baseNode);
288
- if (decorator) baseNode = decorator;
289
- const indent = getIndent({ text: sourceCode.getText(
290
- baseNode,
291
- /** @type {import('eslint').AST.SourceLocation} */
292
- baseNode.loc.start.column
293
- ) });
294
- const { inlineCommentBlock } = contexts.find((contxt) => {
295
- if (typeof contxt === "string") return false;
296
- const { context: ctxt } = contxt;
297
- return ctxt === node.type;
298
- }) || {};
299
- const insertion = (inlineCommentBlock ? `/** ${fixerMessage}` : `/**\n${indent}*${fixerMessage}\n${indent}`) + `*/${"\n".repeat(lines)}${indent.slice(0, -1)}`;
300
- return fixer.insertTextBefore(baseNode, insertion);
301
- };
302
- const report = () => {
303
- const { start } = node.loc;
304
- const loc = {
305
- end: {
306
- column: 0,
307
- line: start.line + 1
308
- },
309
- start
310
- };
311
- context.report({
312
- fix: enableFixer ? fix : null,
313
- loc,
314
- messageId: "missingJsDoc",
315
- node
316
- });
317
- };
318
- if (publicOnly) {
319
- /** @type {RequireJsdocOpts} */
320
- const opt = {
321
- ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),
322
- esm: Boolean(publicOnly?.esm ?? true),
323
- initModuleExports: Boolean(publicOnly?.cjs ?? true),
324
- initWindow: Boolean(publicOnly?.window ?? false)
325
- };
326
- const exported = exportParser_default.isUncommentedExport(node, sourceCode, opt, settings);
327
- if (exported) report();
328
- } else report();
329
- };
330
- /**
331
- * @param {string} prop
332
- * @returns {boolean}
333
- */
334
- const hasOption = (prop) => {
335
- return requireOption[prop] || contexts.some((ctxt) => {
336
- return typeof ctxt === "object" ? ctxt.context === prop : ctxt === prop;
337
- });
338
- };
339
- return {
340
- ...getContextObject(enforcedContexts(context, [], settings), checkJsDoc),
341
- ArrowFunctionExpression(node) {
342
- if (!hasOption("ArrowFunctionExpression")) return;
343
- if ([
344
- "AssignmentExpression",
345
- "ExportDefaultDeclaration",
346
- "VariableDeclarator"
347
- ].includes(node.parent.type) || [
348
- "ClassProperty",
349
- "ObjectProperty",
350
- "Property",
351
- "PropertyDefinition"
352
- ].includes(node.parent.type) && node === node.parent.value) checkJsDoc({ isFunctionContext: true }, null, node);
353
- },
354
- ClassDeclaration(node) {
355
- if (!hasOption("ClassDeclaration")) return;
356
- checkJsDoc({ isFunctionContext: false }, null, node);
357
- },
358
- ClassExpression(node) {
359
- if (!hasOption("ClassExpression")) return;
360
- checkJsDoc({ isFunctionContext: false }, null, node);
361
- },
362
- FunctionDeclaration(node) {
363
- if (!hasOption("FunctionDeclaration")) return;
364
- checkJsDoc({ isFunctionContext: true }, null, node);
365
- },
366
- FunctionExpression(node) {
367
- if (!hasOption("FunctionExpression")) return;
368
- if ([
369
- "AssignmentExpression",
370
- "ExportDefaultDeclaration",
371
- "VariableDeclarator"
372
- ].includes(node.parent.type) || [
373
- "ClassProperty",
374
- "ObjectProperty",
375
- "Property",
376
- "PropertyDefinition"
377
- ].includes(node.parent.type) && node === node.parent.value) checkJsDoc({ isFunctionContext: true }, null, node);
378
- },
379
- MethodDefinition(node) {
380
- if (!hasOption("MethodDefinition")) return;
381
- checkJsDoc({
382
- isFunctionContext: true,
383
- selector: "MethodDefinition"
384
- }, null, node.value);
385
- }
386
- };
387
- },
388
- meta: {
389
- docs: {
390
- category: "Stylistic Issues",
391
- description: "Require JSDoc comments",
392
- recommended: true,
393
- url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md#repos-sticky-header"
394
- },
395
- fixable: "code",
396
- messages: { missingJsDoc: "Missing JSDoc comment." },
397
- schema: [OPTIONS_SCHEMA],
398
- type: "suggestion"
399
- }
400
- };
401
-
402
- //#endregion
403
- export { requireJsdoc_default as default };
404
- //# sourceMappingURL=requireJsdoc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requireJsdoc.js","names":["exportParser"],"sources":["../../src/rules/requireJsdoc.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n exemptSpeciaMethods,\n getContextObject,\n getFunctionParameterNames,\n getIndent,\n hasReturnValue,\n isConstructor,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getJSDocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/**\n * @typedef {{\n * ancestorsOnly: boolean,\n * esm: boolean,\n * initModuleExports: boolean,\n * initWindow: boolean\n * }} RequireJsdocOpts\n */\n\n/**\n * @typedef {import('eslint').Rule.Node|\n * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode\n */\n\n/** @type {import('json-schema').JSONSchema4} */\nconst OPTIONS_SCHEMA = {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: true,\n type: 'boolean',\n },\n checkGetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-setter',\n ],\n type: 'string',\n },\n ],\n default: true,\n },\n checkSetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-getter',\n ],\n type: 'string',\n },\n ],\n default: true,\n },\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n minLineCount: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n default: true,\n type: 'boolean',\n },\n exemptEmptyConstructors: {\n default: false,\n type: 'boolean',\n },\n exemptEmptyFunctions: {\n default: false,\n type: 'boolean',\n },\n fixerMessage: {\n default: '',\n type: 'string',\n },\n minLineCount: {\n type: 'integer',\n },\n publicOnly: {\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 require: {\n additionalProperties: false,\n default: {},\n properties: {\n ArrowFunctionExpression: {\n default: false,\n type: 'boolean',\n },\n ClassDeclaration: {\n default: false,\n type: 'boolean',\n },\n ClassExpression: {\n default: false,\n type: 'boolean',\n },\n FunctionDeclaration: {\n default: true,\n type: 'boolean',\n },\n FunctionExpression: {\n default: false,\n type: 'boolean',\n },\n MethodDefinition: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n};\n\n/**\n * @param {string} interfaceName\n * @param {string} methodName\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {import('@typescript-eslint/types').TSESTree.TSMethodSignature|null}\n */\nconst getMethodOnInterface = (interfaceName, methodName, scope) => {\n let scp = scope;\n while (scp) {\n for (const {\n identifiers,\n name,\n } of scp.variables) {\n if (interfaceName !== name) {\n continue;\n }\n\n for (const identifier of identifiers) {\n const interfaceDeclaration = /** @type {import('@typescript-eslint/types').TSESTree.Identifier & {parent: import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration}} */ (\n identifier\n ).parent;\n /* c8 ignore next 3 -- TS */\n if (interfaceDeclaration.type !== 'TSInterfaceDeclaration') {\n continue;\n }\n\n for (const bodyItem of interfaceDeclaration.body.body) {\n const methodSig = /** @type {import('@typescript-eslint/types').TSESTree.TSMethodSignature} */ (\n bodyItem\n );\n if (methodName === /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n methodSig.key\n ).name) {\n return methodSig;\n }\n }\n }\n }\n\n scp = scp.upper;\n }\n\n return null;\n};\n\n/**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').SourceCode} sourceCode\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n */\nconst isExemptedImplementer = (node, sourceCode, context, settings) => {\n if (node.type === 'FunctionExpression' &&\n node.parent.type === 'MethodDefinition' &&\n node.parent.parent.type === 'ClassBody' &&\n node.parent.parent.parent.type === 'ClassDeclaration' &&\n 'implements' in node.parent.parent.parent\n ) {\n const implments = /** @type {import('@typescript-eslint/types').TSESTree.TSClassImplements[]} */ (\n node.parent.parent.parent.implements\n );\n\n const {\n name: methodName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n node.parent.key\n );\n\n for (const impl of implments) {\n const {\n name: interfaceName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n impl.expression\n );\n\n const interfaceMethodNode = getMethodOnInterface(interfaceName, methodName, node && (\n (sourceCode.getScope &&\n /* c8 ignore next 2 */\n sourceCode.getScope(node)) ||\n context.getScope()\n ));\n if (interfaceMethodNode) {\n // @ts-expect-error Ok\n const comment = getJSDocComment(sourceCode, interfaceMethodNode, settings);\n if (comment) {\n return true;\n }\n }\n }\n }\n\n return false;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('json-schema').JSONSchema4Object} baseObject\n * @param {string} option\n * @param {string} key\n * @returns {boolean|undefined}\n */\nconst getOption = (context, baseObject, option, key) => {\n if (context.options[0] && option in context.options[0] &&\n // Todo: boolean shouldn't be returning property, but\n // tests currently require\n (typeof context.options[0][option] === 'boolean' ||\n key in context.options[0][option])\n ) {\n return context.options[0][option][key];\n }\n\n return /** @type {{[key: string]: {default?: boolean|undefined}}} */ (\n baseObject.properties\n )[key].default;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {{\n * contexts: (string|{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * })[],\n * enableFixer: boolean,\n * exemptEmptyConstructors: boolean,\n * exemptEmptyFunctions: boolean,\n * fixerMessage: string,\n * minLineCount: undefined|import('../iterateJsdoc.js').Integer,\n * publicOnly: boolean|{[key: string]: boolean|undefined}\n * require: {[key: string]: boolean|undefined}\n * }}\n */\nconst getOptions = (context, settings) => {\n const {\n contexts = settings.contexts || [],\n enableFixer = true,\n exemptEmptyConstructors = true,\n exemptEmptyFunctions = false,\n fixerMessage = '',\n minLineCount = undefined,\n publicOnly,\n } = context.options[0] || {};\n\n return {\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n fixerMessage,\n minLineCount,\n publicOnly: ((baseObj) => {\n if (!publicOnly) {\n return false;\n }\n\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */ (baseObj),\n 'publicOnly',\n prop,\n );\n\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n OPTIONS_SCHEMA.properties\n ).publicOnly\n ).oneOf\n )[1],\n ),\n require: ((baseObj) => {\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */\n (baseObj),\n 'require',\n prop,\n );\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (OPTIONS_SCHEMA.properties).require,\n ),\n };\n};\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const settings = getSettings(context);\n if (!settings) {\n return {};\n }\n\n const opts = getOptions(context, settings);\n\n const {\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n fixerMessage,\n minLineCount,\n require: requireOption,\n } = opts;\n\n const publicOnly =\n\n /**\n * @type {{\n * [key: string]: boolean | undefined;\n * }}\n */ (\n opts.publicOnly\n );\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkJsDoc = (info, _handler, node) => {\n if (\n // Optimize\n minLineCount !== undefined || contexts.some((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n minLineCount: count,\n } = ctxt;\n return count !== undefined;\n })\n ) {\n /**\n * @param {undefined|import('../iterateJsdoc.js').Integer} count\n */\n const underMinLine = (count) => {\n return count !== undefined && count >\n (sourceCode.getText(node).match(/\\n/gv)?.length ?? 0) + 1;\n };\n\n if (underMinLine(minLineCount)) {\n return;\n }\n\n const {\n minLineCount: contextMinLineCount,\n } =\n /**\n * @type {{\n * context: string;\n * inlineCommentBlock: boolean;\n * minLineCount: number;\n * }}\n */ (contexts.find((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n context: ctx,\n } = ctxt;\n return ctx === (info.selector || node.type);\n })) || {};\n if (underMinLine(contextMinLineCount)) {\n return;\n }\n }\n\n const jsDocNode = getJSDocComment(sourceCode, node, settings);\n\n if (jsDocNode) {\n return;\n }\n\n // For those who have options configured against ANY constructors (or\n // setters or getters) being reported\n if (exemptSpeciaMethods(\n {\n description: '',\n inlineTags: [],\n problems: [],\n source: [],\n tags: [],\n },\n node,\n context,\n [\n OPTIONS_SCHEMA,\n ],\n )) {\n return;\n }\n\n if (\n // Avoid reporting param-less, return-less functions (when\n // `exemptEmptyFunctions` option is set)\n exemptEmptyFunctions && info.isFunctionContext ||\n\n // Avoid reporting param-less, return-less constructor methods (when\n // `exemptEmptyConstructors` option is set)\n exemptEmptyConstructors && isConstructor(node)\n ) {\n const functionParameterNames = getFunctionParameterNames(node);\n if (!functionParameterNames.length && !hasReturnValue(node)) {\n return;\n }\n }\n\n if (isExemptedImplementer(node, sourceCode, context, settings)) {\n return;\n }\n\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n // Default to one line break if the `minLines`/`maxLines` settings allow\n const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;\n /** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */\n let baseNode = getReducedASTNode(node, sourceCode);\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n );\n if (decorator) {\n baseNode = decorator;\n }\n\n const indent = getIndent({\n text: sourceCode.getText(\n /** @type {import('eslint').Rule.Node} */ (baseNode),\n /** @type {import('eslint').AST.SourceLocation} */\n (\n /** @type {import('eslint').Rule.Node} */ (baseNode).loc\n ).start.column,\n ),\n });\n\n const {\n inlineCommentBlock,\n } =\n /**\n * @type {{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * }}\n */ (contexts.find((contxt) => {\n if (typeof contxt === 'string') {\n return false;\n }\n\n const {\n context: ctxt,\n } = contxt;\n return ctxt === node.type;\n })) || {};\n const insertion = (inlineCommentBlock ?\n `/** ${fixerMessage}` :\n `/**\\n${indent}*${fixerMessage}\\n${indent}`) +\n `*/${'\\n'.repeat(lines)}${indent.slice(0, -1)}`;\n\n return fixer.insertTextBefore(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n insertion,\n );\n };\n\n const report = () => {\n const {\n start,\n } = /** @type {import('eslint').AST.SourceLocation} */ (node.loc);\n const loc = {\n end: {\n column: 0,\n line: start.line + 1,\n },\n start,\n };\n context.report({\n fix: enableFixer ? fix : null,\n loc,\n messageId: 'missingJsDoc',\n node,\n });\n };\n\n if (publicOnly) {\n /** @type {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 const exported = exportParser.isUncommentedExport(node, sourceCode, opt, settings);\n\n if (exported) {\n report();\n }\n } else {\n report();\n }\n };\n\n /**\n * @param {string} prop\n * @returns {boolean}\n */\n const hasOption = (prop) => {\n return requireOption[prop] || contexts.some((ctxt) => {\n return typeof ctxt === 'object' ? ctxt.context === prop : ctxt === prop;\n });\n };\n\n return {\n ...getContextObject(\n enforcedContexts(context, [], settings),\n checkJsDoc,\n ),\n ArrowFunctionExpression (node) {\n if (!hasOption('ArrowFunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n ClassDeclaration (node) {\n if (!hasOption('ClassDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n ClassExpression (node) {\n if (!hasOption('ClassExpression')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n FunctionDeclaration (node) {\n if (!hasOption('FunctionDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n },\n\n FunctionExpression (node) {\n if (!hasOption('FunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n MethodDefinition (node) {\n if (!hasOption('MethodDefinition')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n selector: 'MethodDefinition',\n }, null, /** @type {import('eslint').Rule.Node} */ (node.value));\n },\n };\n },\n meta: {\n docs: {\n category: 'Stylistic Issues',\n description: 'Require JSDoc comments',\n recommended: true,\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n missingJsDoc: 'Missing JSDoc comment.',\n },\n\n schema: [\n OPTIONS_SCHEMA,\n ],\n\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,iBAAiB;CACrB,sBAAsB;CACtB,YAAY;EACV,mBAAmB;GACjB,SAAS;GACT,MAAM;EACP;EACD,cAAc;GACZ,OAAO,CACL,EACE,MAAM,UACP,GACD;IACE,MAAM,CACJ,WACD;IACD,MAAM;GACP,CACF;GACD,SAAS;EACV;EACD,cAAc;GACZ,OAAO,CACL,EACE,MAAM,UACP,GACD;IACE,MAAM,CACJ,WACD;IACD,MAAM;GACP,CACF;GACD,SAAS;EACV;EACD,UAAU;GACR,OAAO,EACL,OAAO,CACL,EACE,MAAM,SACP,GACD;IACE,sBAAsB;IACtB,YAAY;KACV,SAAS,EACP,MAAM,SACP;KACD,oBAAoB,EAClB,MAAM,UACP;KACD,cAAc,EACZ,MAAM,UACP;IACF;IACD,MAAM;GACP,CACF,EACF;GACD,MAAM;EACP;EACD,aAAa;GACX,SAAS;GACT,MAAM;EACP;EACD,yBAAyB;GACvB,SAAS;GACT,MAAM;EACP;EACD,sBAAsB;GACpB,SAAS;GACT,MAAM;EACP;EACD,cAAc;GACZ,SAAS;GACT,MAAM;EACP;EACD,cAAc,EACZ,MAAM,UACP;EACD,YAAY,EACV,OAAO,CACL;GACE,SAAS;GACT,MAAM;EACP,GACD;GACE,sBAAsB;GACtB,SAAS,CAAE;GACX,YAAY;IACV,eAAe,EACb,MAAM,UACP;IACD,KAAK,EACH,MAAM,UACP;IACD,KAAK,EACH,MAAM,UACP;IACD,QAAQ,EACN,MAAM,UACP;GACF;GACD,MAAM;EACP,CACF,EACF;EACD,SAAS;GACP,sBAAsB;GACtB,SAAS,CAAE;GACX,YAAY;IACV,yBAAyB;KACvB,SAAS;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