eslint-plugin-jsdoc 52.0.3 → 52.0.4

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 (357) 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 +383 -398
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +6 -11
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/iterateJsdoc.cjs +1988 -1528
  22. package/dist/iterateJsdoc.cjs.map +1 -1
  23. package/dist/iterateJsdoc.d.ts +349 -358
  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 +388 -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 +557 -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 +24 -40
  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 +2518 -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 +543 -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 +743 -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 -22
  231. package/dist/index.d.cts.map +0 -1
  232. package/dist/index.js +0 -425
  233. package/dist/index.js.map +0 -1
  234. package/dist/iterateJsdoc.d.cts +0 -471
  235. package/dist/iterateJsdoc.d.cts.map +0 -1
  236. package/dist/iterateJsdoc.js +0 -1617
  237. package/dist/iterateJsdoc.js.map +0 -1
  238. package/dist/jsdocUtils.js +0 -1123
  239. package/dist/jsdocUtils.js.map +0 -1
  240. package/dist/rules/checkAccess.js +0 -33
  241. package/dist/rules/checkAccess.js.map +0 -1
  242. package/dist/rules/checkAlignment.js +0 -47
  243. package/dist/rules/checkAlignment.js.map +0 -1
  244. package/dist/rules/checkExamples.js +0 -348
  245. package/dist/rules/checkExamples.js.map +0 -1
  246. package/dist/rules/checkIndentation.js +0 -59
  247. package/dist/rules/checkIndentation.js.map +0 -1
  248. package/dist/rules/checkLineAlignment.js +0 -229
  249. package/dist/rules/checkLineAlignment.js.map +0 -1
  250. package/dist/rules/checkParamNames.js +0 -237
  251. package/dist/rules/checkParamNames.js.map +0 -1
  252. package/dist/rules/checkPropertyNames.js +0 -88
  253. package/dist/rules/checkPropertyNames.js.map +0 -1
  254. package/dist/rules/checkSyntax.js +0 -25
  255. package/dist/rules/checkSyntax.js.map +0 -1
  256. package/dist/rules/checkTagNames.js +0 -191
  257. package/dist/rules/checkTagNames.js.map +0 -1
  258. package/dist/rules/checkTemplateNames.js +0 -124
  259. package/dist/rules/checkTemplateNames.js.map +0 -1
  260. package/dist/rules/checkTypes.js +0 -299
  261. package/dist/rules/checkTypes.js.map +0 -1
  262. package/dist/rules/checkValues.js +0 -103
  263. package/dist/rules/checkValues.js.map +0 -1
  264. package/dist/rules/convertToJsdocComments.js +0 -231
  265. package/dist/rules/convertToJsdocComments.js.map +0 -1
  266. package/dist/rules/emptyTags.js +0 -67
  267. package/dist/rules/emptyTags.js.map +0 -1
  268. package/dist/rules/implementsOnClasses.js +0 -40
  269. package/dist/rules/implementsOnClasses.js.map +0 -1
  270. package/dist/rules/importsAsDependencies.js +0 -68
  271. package/dist/rules/importsAsDependencies.js.map +0 -1
  272. package/dist/rules/informativeDocs.js +0 -110
  273. package/dist/rules/informativeDocs.js.map +0 -1
  274. package/dist/rules/linesBeforeBlock.js +0 -75
  275. package/dist/rules/linesBeforeBlock.js.map +0 -1
  276. package/dist/rules/matchDescription.js +0 -167
  277. package/dist/rules/matchDescription.js.map +0 -1
  278. package/dist/rules/matchName.js +0 -77
  279. package/dist/rules/matchName.js.map +0 -1
  280. package/dist/rules/multilineBlocks.js +0 -245
  281. package/dist/rules/multilineBlocks.js.map +0 -1
  282. package/dist/rules/noBadBlocks.js +0 -68
  283. package/dist/rules/noBadBlocks.js.map +0 -1
  284. package/dist/rules/noBlankBlockDescriptions.js +0 -41
  285. package/dist/rules/noBlankBlockDescriptions.js.map +0 -1
  286. package/dist/rules/noBlankBlocks.js +0 -30
  287. package/dist/rules/noBlankBlocks.js.map +0 -1
  288. package/dist/rules/noDefaults.js +0 -56
  289. package/dist/rules/noDefaults.js.map +0 -1
  290. package/dist/rules/noMissingSyntax.js +0 -126
  291. package/dist/rules/noMissingSyntax.js.map +0 -1
  292. package/dist/rules/noMultiAsterisks.js +0 -58
  293. package/dist/rules/noMultiAsterisks.js.map +0 -1
  294. package/dist/rules/noRestrictedSyntax.js +0 -49
  295. package/dist/rules/noRestrictedSyntax.js.map +0 -1
  296. package/dist/rules/noTypes.js +0 -65
  297. package/dist/rules/noTypes.js.map +0 -1
  298. package/dist/rules/noUndefinedTypes.js +0 -303
  299. package/dist/rules/noUndefinedTypes.js.map +0 -1
  300. package/dist/rules/requireAsteriskPrefix.js +0 -112
  301. package/dist/rules/requireAsteriskPrefix.js.map +0 -1
  302. package/dist/rules/requireDescription.js +0 -95
  303. package/dist/rules/requireDescription.js.map +0 -1
  304. package/dist/rules/requireDescriptionCompleteSentence.js +0 -220
  305. package/dist/rules/requireDescriptionCompleteSentence.js.map +0 -1
  306. package/dist/rules/requireExample.js +0 -77
  307. package/dist/rules/requireExample.js.map +0 -1
  308. package/dist/rules/requireFileOverview.js +0 -81
  309. package/dist/rules/requireFileOverview.js.map +0 -1
  310. package/dist/rules/requireHyphenBeforeParamDescription.js +0 -89
  311. package/dist/rules/requireHyphenBeforeParamDescription.js.map +0 -1
  312. package/dist/rules/requireJsdoc.js +0 -404
  313. package/dist/rules/requireJsdoc.js.map +0 -1
  314. package/dist/rules/requireParam.js +0 -344
  315. package/dist/rules/requireParam.js.map +0 -1
  316. package/dist/rules/requireParamDescription.js +0 -59
  317. package/dist/rules/requireParamDescription.js.map +0 -1
  318. package/dist/rules/requireParamName.js +0 -36
  319. package/dist/rules/requireParamName.js.map +0 -1
  320. package/dist/rules/requireParamType.js +0 -59
  321. package/dist/rules/requireParamType.js.map +0 -1
  322. package/dist/rules/requireProperty.js +0 -35
  323. package/dist/rules/requireProperty.js.map +0 -1
  324. package/dist/rules/requirePropertyDescription.js +0 -21
  325. package/dist/rules/requirePropertyDescription.js.map +0 -1
  326. package/dist/rules/requirePropertyName.js +0 -21
  327. package/dist/rules/requirePropertyName.js.map +0 -1
  328. package/dist/rules/requirePropertyType.js +0 -21
  329. package/dist/rules/requirePropertyType.js.map +0 -1
  330. package/dist/rules/requireReturns.js +0 -131
  331. package/dist/rules/requireReturns.js.map +0 -1
  332. package/dist/rules/requireReturnsCheck.js +0 -66
  333. package/dist/rules/requireReturnsCheck.js.map +0 -1
  334. package/dist/rules/requireReturnsDescription.js +0 -43
  335. package/dist/rules/requireReturnsDescription.js.map +0 -1
  336. package/dist/rules/requireReturnsType.js +0 -36
  337. package/dist/rules/requireReturnsType.js.map +0 -1
  338. package/dist/rules/requireTemplate.js +0 -122
  339. package/dist/rules/requireTemplate.js.map +0 -1
  340. package/dist/rules/requireThrows.js +0 -67
  341. package/dist/rules/requireThrows.js.map +0 -1
  342. package/dist/rules/requireYields.js +0 -115
  343. package/dist/rules/requireYields.js.map +0 -1
  344. package/dist/rules/requireYieldsCheck.js +0 -105
  345. package/dist/rules/requireYieldsCheck.js.map +0 -1
  346. package/dist/rules/sortTags.js +0 -262
  347. package/dist/rules/sortTags.js.map +0 -1
  348. package/dist/rules/tagLines.js +0 -183
  349. package/dist/rules/tagLines.js.map +0 -1
  350. package/dist/rules/textEscaping.js +0 -102
  351. package/dist/rules/textEscaping.js.map +0 -1
  352. package/dist/rules/validTypes.js +0 -259
  353. package/dist/rules/validTypes.js.map +0 -1
  354. package/dist/tagNames.js +0 -144
  355. package/dist/tagNames.js.map +0 -1
  356. package/dist/utils/hasReturnValue.js +0 -265
  357. package/dist/utils/hasReturnValue.js.map +0 -1
@@ -1,245 +1,362 @@
1
- const require_iterateJsdoc = require('../iterateJsdoc.cjs');
1
+ "use strict";
2
2
 
3
- //#region src/rules/multilineBlocks.js
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
4
9
  /**
5
- * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
6
- * @param {import('../iterateJsdoc.js').Utils} utils
7
- * @param {number} requireSingleLineUnderCount
8
- */
10
+ * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
11
+ * @param {import('../iterateJsdoc.js').Utils} utils
12
+ * @param {number} requireSingleLineUnderCount
13
+ */
9
14
  const checkForShortTags = (jsdoc, utils, requireSingleLineUnderCount) => {
10
- if (!requireSingleLineUnderCount || !jsdoc.tags.length) return false;
11
- let lastLineWithTag = 0;
12
- let isUnderCountLimit = false;
13
- let hasMultiDescOrType = false;
14
- const tagLines = jsdoc.source.reduce((acc, { tokens: { delimiter, description: desc, name, postDelimiter, postName, postTag, postType, start, tag, type } }, idx) => {
15
- if (tag.length) {
16
- lastLineWithTag = idx;
17
- if (start.length + delimiter.length + postDelimiter.length + type.length + postType.length + name.length + postName.length + tag.length + postTag.length + desc.length < requireSingleLineUnderCount) isUnderCountLimit = true;
18
- return acc + 1;
19
- } else if (desc.length || type.length) {
20
- hasMultiDescOrType = true;
21
- return acc;
22
- }
23
- return acc;
24
- }, 0);
25
- if (!hasMultiDescOrType && isUnderCountLimit && tagLines === 1) {
26
- const fixer = () => {
27
- const tokens = jsdoc.source[lastLineWithTag].tokens;
28
- jsdoc.source = [{
29
- number: 0,
30
- source: "",
31
- tokens: utils.seedTokens({
32
- delimiter: "/**",
33
- description: tokens.description.trimEnd() + " ",
34
- end: "*/",
35
- name: tokens.name,
36
- postDelimiter: " ",
37
- postName: tokens.postName,
38
- postTag: tokens.postTag,
39
- postType: tokens.postType,
40
- start: jsdoc.source[0].tokens.start,
41
- tag: tokens.tag,
42
- type: tokens.type
43
- })
44
- }];
45
- };
46
- utils.reportJSDoc("Description is too short to be multi-line.", null, fixer);
47
- return true;
48
- }
49
- return false;
15
+ if (!requireSingleLineUnderCount || !jsdoc.tags.length) {
16
+ return false;
17
+ }
18
+ let lastLineWithTag = 0;
19
+ let isUnderCountLimit = false;
20
+ let hasMultiDescOrType = false;
21
+ const tagLines = jsdoc.source.reduce((acc, {
22
+ tokens: {
23
+ delimiter,
24
+ description: desc,
25
+ name,
26
+ postDelimiter,
27
+ postName,
28
+ postTag,
29
+ postType,
30
+ start,
31
+ tag,
32
+ type
33
+ }
34
+ }, idx) => {
35
+ if (tag.length) {
36
+ lastLineWithTag = idx;
37
+ if (start.length + delimiter.length + postDelimiter.length + type.length + postType.length + name.length + postName.length + tag.length + postTag.length + desc.length < requireSingleLineUnderCount) {
38
+ isUnderCountLimit = true;
39
+ }
40
+ return acc + 1;
41
+ } else if (desc.length || type.length) {
42
+ hasMultiDescOrType = true;
43
+ return acc;
44
+ }
45
+ return acc;
46
+ }, 0);
47
+ // Could be tagLines > 1
48
+ if (!hasMultiDescOrType && isUnderCountLimit && tagLines === 1) {
49
+ const fixer = () => {
50
+ const tokens = jsdoc.source[lastLineWithTag].tokens;
51
+ jsdoc.source = [{
52
+ number: 0,
53
+ source: '',
54
+ tokens: utils.seedTokens({
55
+ delimiter: '/**',
56
+ description: tokens.description.trimEnd() + ' ',
57
+ end: '*/',
58
+ name: tokens.name,
59
+ postDelimiter: ' ',
60
+ postName: tokens.postName,
61
+ postTag: tokens.postTag,
62
+ postType: tokens.postType,
63
+ start: jsdoc.source[0].tokens.start,
64
+ tag: tokens.tag,
65
+ type: tokens.type
66
+ })
67
+ }];
68
+ };
69
+ utils.reportJSDoc('Description is too short to be multi-line.', null, fixer);
70
+ return true;
71
+ }
72
+ return false;
50
73
  };
74
+
51
75
  /**
52
- * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
53
- * @param {import('../iterateJsdoc.js').Utils} utils
54
- * @param {number} requireSingleLineUnderCount
55
- */
76
+ * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
77
+ * @param {import('../iterateJsdoc.js').Utils} utils
78
+ * @param {number} requireSingleLineUnderCount
79
+ */
56
80
  const checkForShortDescriptions = (jsdoc, utils, requireSingleLineUnderCount) => {
57
- if (!requireSingleLineUnderCount || jsdoc.tags.length) return false;
58
- let lastLineWithDesc = 0;
59
- let isUnderCountLimit = false;
60
- const descLines = jsdoc.source.reduce((acc, { tokens: { delimiter, description: desc, postDelimiter, start } }, idx) => {
61
- if (desc.length) {
62
- lastLineWithDesc = idx;
63
- if (start.length + delimiter.length + postDelimiter.length + desc.length < requireSingleLineUnderCount) isUnderCountLimit = true;
64
- return acc + 1;
65
- }
66
- return acc;
67
- }, 0);
68
- if (isUnderCountLimit && descLines === 1) {
69
- const fixer = () => {
70
- const desc = jsdoc.source[lastLineWithDesc].tokens.description;
71
- jsdoc.source = [{
72
- number: 0,
73
- source: "",
74
- tokens: utils.seedTokens({
75
- delimiter: "/**",
76
- description: desc.trimEnd() + " ",
77
- end: "*/",
78
- postDelimiter: " ",
79
- start: jsdoc.source[0].tokens.start
80
- })
81
- }];
82
- };
83
- utils.reportJSDoc("Description is too short to be multi-line.", null, fixer);
84
- return true;
85
- }
86
- return false;
81
+ if (!requireSingleLineUnderCount || jsdoc.tags.length) {
82
+ return false;
83
+ }
84
+ let lastLineWithDesc = 0;
85
+ let isUnderCountLimit = false;
86
+ const descLines = jsdoc.source.reduce((acc, {
87
+ tokens: {
88
+ delimiter,
89
+ description: desc,
90
+ postDelimiter,
91
+ start
92
+ }
93
+ }, idx) => {
94
+ if (desc.length) {
95
+ lastLineWithDesc = idx;
96
+ if (start.length + delimiter.length + postDelimiter.length + desc.length < requireSingleLineUnderCount) {
97
+ isUnderCountLimit = true;
98
+ }
99
+ return acc + 1;
100
+ }
101
+ return acc;
102
+ }, 0);
103
+ // Could be descLines > 1
104
+ if (isUnderCountLimit && descLines === 1) {
105
+ const fixer = () => {
106
+ const desc = jsdoc.source[lastLineWithDesc].tokens.description;
107
+ jsdoc.source = [{
108
+ number: 0,
109
+ source: '',
110
+ tokens: utils.seedTokens({
111
+ delimiter: '/**',
112
+ description: desc.trimEnd() + ' ',
113
+ end: '*/',
114
+ postDelimiter: ' ',
115
+ start: jsdoc.source[0].tokens.start
116
+ })
117
+ }];
118
+ };
119
+ utils.reportJSDoc('Description is too short to be multi-line.', null, fixer);
120
+ return true;
121
+ }
122
+ return false;
87
123
  };
88
- var multilineBlocks_default = require_iterateJsdoc.default(({ context, jsdoc, utils }) => {
89
- const { allowMultipleTags = true, minimumLengthForMultiline = Number.POSITIVE_INFINITY, multilineTags = ["*"], noFinalLineText = true, noMultilineBlocks = false, noSingleLineBlocks = false, noZeroLineText = true, requireSingleLineUnderCount = null, singleLineTags = ["lends", "type"] } = context.options[0] || {};
90
- const { source: [{ tokens }] } = jsdoc;
91
- const { description, tag } = tokens;
92
- const sourceLength = jsdoc.source.length;
93
- /**
94
- * @param {string} tagName
95
- * @returns {boolean}
96
- */
97
- const isInvalidSingleLine = (tagName) => {
98
- return noSingleLineBlocks && (!tagName || !singleLineTags.includes(tagName) && !singleLineTags.includes("*"));
99
- };
100
- if (sourceLength === 1) {
101
- if (!isInvalidSingleLine(tag.slice(1))) return;
102
- const fixer = () => {
103
- utils.makeMultiline();
104
- };
105
- utils.reportJSDoc("Single line blocks are not permitted by your configuration.", null, fixer, true);
106
- return;
107
- }
108
- if (checkForShortDescriptions(jsdoc, utils, requireSingleLineUnderCount)) return;
109
- if (checkForShortTags(jsdoc, utils, requireSingleLineUnderCount)) return;
110
- const lineChecks = () => {
111
- if (noZeroLineText && (tag || description)) {
112
- const fixer = () => {
113
- const line = { ...tokens };
114
- utils.emptyTokens(tokens);
115
- const { tokens: { delimiter, start } } = jsdoc.source[1];
116
- utils.addLine(1, {
117
- ...line,
118
- delimiter,
119
- start
120
- });
121
- };
122
- utils.reportJSDoc("Should have no text on the \"0th\" line (after the `/**`).", null, fixer);
123
- return;
124
- }
125
- const finalLine = jsdoc.source[jsdoc.source.length - 1];
126
- const finalLineTokens = finalLine.tokens;
127
- if (noFinalLineText && finalLineTokens.description.trim()) {
128
- const fixer = () => {
129
- const line = { ...finalLineTokens };
130
- line.description = line.description.trimEnd();
131
- const { delimiter } = line;
132
- for (const prop of [
133
- "delimiter",
134
- "postDelimiter",
135
- "tag",
136
- "type",
137
- "lineEnd",
138
- "postType",
139
- "postTag",
140
- "name",
141
- "postName",
142
- "description"
143
- ]) finalLineTokens[prop] = "";
144
- utils.addLine(jsdoc.source.length - 1, {
145
- ...line,
146
- delimiter,
147
- end: ""
148
- });
149
- };
150
- utils.reportJSDoc("Should have no text on the final line (before the `*/`).", null, fixer);
151
- }
152
- };
153
- if (noMultilineBlocks) {
154
- if (jsdoc.tags.length && (multilineTags.includes("*") || utils.hasATag(multilineTags))) {
155
- lineChecks();
156
- return;
157
- }
158
- if (jsdoc.description.length >= minimumLengthForMultiline) {
159
- lineChecks();
160
- return;
161
- }
162
- if (noSingleLineBlocks && (!jsdoc.tags.length || !utils.filterTags(({ tag: tg }) => {
163
- return !isInvalidSingleLine(tg);
164
- }).length)) {
165
- utils.reportJSDoc("Multiline jsdoc blocks are prohibited by your configuration but fixing would result in a single line block which you have prohibited with `noSingleLineBlocks`.");
166
- return;
167
- }
168
- if (jsdoc.tags.length > 1) {
169
- if (!allowMultipleTags) {
170
- utils.reportJSDoc("Multiline jsdoc blocks are prohibited by your configuration but the block has multiple tags.");
171
- return;
172
- }
173
- } else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {
174
- if (!allowMultipleTags) {
175
- utils.reportJSDoc("Multiline jsdoc blocks are prohibited by your configuration but the block has a description with a tag.");
176
- return;
177
- }
178
- } else {
179
- const fixer = () => {
180
- jsdoc.source = [{
181
- number: 1,
182
- source: "",
183
- tokens: jsdoc.source.reduce((obj, { tokens: { description: desc, lineEnd, name: nme, postName, postTag, postType, tag: tg, type: typ } }) => {
184
- if (typ) obj.type = typ;
185
- if (tg && typ && nme) obj.postType = postType;
186
- if (nme) obj.name += nme;
187
- if (nme && desc) obj.postName = postName;
188
- obj.description += desc;
189
- const nameOrDescription = obj.description || obj.name;
190
- if (nameOrDescription && nameOrDescription.slice(-1) !== " ") obj.description += " ";
191
- obj.lineEnd = lineEnd;
192
- obj.tag += tg;
193
- if (tg) obj.postTag = postTag || " ";
194
- return obj;
195
- }, utils.seedTokens({
196
- delimiter: "/**",
197
- end: "*/",
198
- postDelimiter: " "
199
- }))
200
- }];
201
- };
202
- utils.reportJSDoc("Multiline jsdoc blocks are prohibited by your configuration.", null, fixer);
203
- return;
204
- }
205
- }
206
- lineChecks();
124
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
125
+ context,
126
+ jsdoc,
127
+ utils
128
+ }) => {
129
+ const {
130
+ allowMultipleTags = true,
131
+ minimumLengthForMultiline = Number.POSITIVE_INFINITY,
132
+ multilineTags = ['*'],
133
+ noFinalLineText = true,
134
+ noMultilineBlocks = false,
135
+ noSingleLineBlocks = false,
136
+ noZeroLineText = true,
137
+ requireSingleLineUnderCount = null,
138
+ singleLineTags = ['lends', 'type']
139
+ } = context.options[0] || {};
140
+ const {
141
+ source: [{
142
+ tokens
143
+ }]
144
+ } = jsdoc;
145
+ const {
146
+ description,
147
+ tag
148
+ } = tokens;
149
+ const sourceLength = jsdoc.source.length;
150
+
151
+ /**
152
+ * @param {string} tagName
153
+ * @returns {boolean}
154
+ */
155
+ const isInvalidSingleLine = tagName => {
156
+ return noSingleLineBlocks && (!tagName || !singleLineTags.includes(tagName) && !singleLineTags.includes('*'));
157
+ };
158
+ if (sourceLength === 1) {
159
+ if (!isInvalidSingleLine(tag.slice(1))) {
160
+ return;
161
+ }
162
+ const fixer = () => {
163
+ utils.makeMultiline();
164
+ };
165
+ utils.reportJSDoc('Single line blocks are not permitted by your configuration.', null, fixer, true);
166
+ return;
167
+ }
168
+ if (checkForShortDescriptions(jsdoc, utils, requireSingleLineUnderCount)) {
169
+ return;
170
+ }
171
+ if (checkForShortTags(jsdoc, utils, requireSingleLineUnderCount)) {
172
+ return;
173
+ }
174
+ const lineChecks = () => {
175
+ if (noZeroLineText && (tag || description)) {
176
+ const fixer = () => {
177
+ const line = {
178
+ ...tokens
179
+ };
180
+ utils.emptyTokens(tokens);
181
+ const {
182
+ tokens: {
183
+ delimiter,
184
+ start
185
+ }
186
+ } = jsdoc.source[1];
187
+ utils.addLine(1, {
188
+ ...line,
189
+ delimiter,
190
+ start
191
+ });
192
+ };
193
+ utils.reportJSDoc('Should have no text on the "0th" line (after the `/**`).', null, fixer);
194
+ return;
195
+ }
196
+ const finalLine = jsdoc.source[jsdoc.source.length - 1];
197
+ const finalLineTokens = finalLine.tokens;
198
+ if (noFinalLineText && finalLineTokens.description.trim()) {
199
+ const fixer = () => {
200
+ const line = {
201
+ ...finalLineTokens
202
+ };
203
+ line.description = line.description.trimEnd();
204
+ const {
205
+ delimiter
206
+ } = line;
207
+ for (const prop of ['delimiter', 'postDelimiter', 'tag', 'type', 'lineEnd', 'postType', 'postTag', 'name', 'postName', 'description']) {
208
+ finalLineTokens[(
209
+ /**
210
+ * @type {"delimiter"|"postDelimiter"|"tag"|"type"|
211
+ * "lineEnd"|"postType"|"postTag"|"name"|
212
+ * "postName"|"description"}
213
+ */
214
+ prop)] = '';
215
+ }
216
+ utils.addLine(jsdoc.source.length - 1, {
217
+ ...line,
218
+ delimiter,
219
+ end: ''
220
+ });
221
+ };
222
+ utils.reportJSDoc('Should have no text on the final line (before the `*/`).', null, fixer);
223
+ }
224
+ };
225
+ if (noMultilineBlocks) {
226
+ if (jsdoc.tags.length && (multilineTags.includes('*') || utils.hasATag(multilineTags))) {
227
+ lineChecks();
228
+ return;
229
+ }
230
+ if (jsdoc.description.length >= minimumLengthForMultiline) {
231
+ lineChecks();
232
+ return;
233
+ }
234
+ if (noSingleLineBlocks && (!jsdoc.tags.length || !utils.filterTags(({
235
+ tag: tg
236
+ }) => {
237
+ return !isInvalidSingleLine(tg);
238
+ }).length)) {
239
+ utils.reportJSDoc('Multiline jsdoc blocks are prohibited by ' + 'your configuration but fixing would result in a single ' + 'line block which you have prohibited with `noSingleLineBlocks`.');
240
+ return;
241
+ }
242
+ if (jsdoc.tags.length > 1) {
243
+ if (!allowMultipleTags) {
244
+ utils.reportJSDoc('Multiline jsdoc blocks are prohibited by ' + 'your configuration but the block has multiple tags.');
245
+ return;
246
+ }
247
+ } else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {
248
+ if (!allowMultipleTags) {
249
+ utils.reportJSDoc('Multiline jsdoc blocks are prohibited by ' + 'your configuration but the block has a description with a tag.');
250
+ return;
251
+ }
252
+ } else {
253
+ const fixer = () => {
254
+ jsdoc.source = [{
255
+ number: 1,
256
+ source: '',
257
+ tokens: jsdoc.source.reduce((obj, {
258
+ tokens: {
259
+ description: desc,
260
+ lineEnd,
261
+ name: nme,
262
+ postName,
263
+ postTag,
264
+ postType,
265
+ tag: tg,
266
+ type: typ
267
+ }
268
+ }) => {
269
+ if (typ) {
270
+ obj.type = typ;
271
+ }
272
+ if (tg && typ && nme) {
273
+ obj.postType = postType;
274
+ }
275
+ if (nme) {
276
+ obj.name += nme;
277
+ }
278
+ if (nme && desc) {
279
+ obj.postName = postName;
280
+ }
281
+ obj.description += desc;
282
+ const nameOrDescription = obj.description || obj.name;
283
+ if (nameOrDescription && nameOrDescription.slice(-1) !== ' ') {
284
+ obj.description += ' ';
285
+ }
286
+ obj.lineEnd = lineEnd;
287
+
288
+ // Already filtered for multiple tags
289
+ obj.tag += tg;
290
+ if (tg) {
291
+ obj.postTag = postTag || ' ';
292
+ }
293
+ return obj;
294
+ }, utils.seedTokens({
295
+ delimiter: '/**',
296
+ end: '*/',
297
+ postDelimiter: ' '
298
+ }))
299
+ }];
300
+ };
301
+ utils.reportJSDoc('Multiline jsdoc blocks are prohibited by ' + 'your configuration.', null, fixer);
302
+ return;
303
+ }
304
+ }
305
+ lineChecks();
207
306
  }, {
208
- iterateAllJsdocs: true,
209
- meta: {
210
- docs: {
211
- description: "Controls how and whether jsdoc blocks can be expressed as single or multiple line blocks.",
212
- url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header"
213
- },
214
- fixable: "code",
215
- schema: [{
216
- additionalProperties: false,
217
- properties: {
218
- allowMultipleTags: { type: "boolean" },
219
- minimumLengthForMultiline: { type: "integer" },
220
- multilineTags: { anyOf: [{
221
- enum: ["*"],
222
- type: "string"
223
- }, {
224
- items: { type: "string" },
225
- type: "array"
226
- }] },
227
- noFinalLineText: { type: "boolean" },
228
- noMultilineBlocks: { type: "boolean" },
229
- noSingleLineBlocks: { type: "boolean" },
230
- noZeroLineText: { type: "boolean" },
231
- requireSingleLineUnderCount: { type: "number" },
232
- singleLineTags: {
233
- items: { type: "string" },
234
- type: "array"
235
- }
236
- },
237
- type: "object"
238
- }],
239
- type: "suggestion"
240
- }
307
+ iterateAllJsdocs: true,
308
+ meta: {
309
+ docs: {
310
+ description: 'Controls how and whether jsdoc blocks can be expressed as single or multiple line blocks.',
311
+ url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header'
312
+ },
313
+ fixable: 'code',
314
+ schema: [{
315
+ additionalProperties: false,
316
+ properties: {
317
+ allowMultipleTags: {
318
+ type: 'boolean'
319
+ },
320
+ minimumLengthForMultiline: {
321
+ type: 'integer'
322
+ },
323
+ multilineTags: {
324
+ anyOf: [{
325
+ enum: ['*'],
326
+ type: 'string'
327
+ }, {
328
+ items: {
329
+ type: 'string'
330
+ },
331
+ type: 'array'
332
+ }]
333
+ },
334
+ noFinalLineText: {
335
+ type: 'boolean'
336
+ },
337
+ noMultilineBlocks: {
338
+ type: 'boolean'
339
+ },
340
+ noSingleLineBlocks: {
341
+ type: 'boolean'
342
+ },
343
+ noZeroLineText: {
344
+ type: 'boolean'
345
+ },
346
+ requireSingleLineUnderCount: {
347
+ type: 'number'
348
+ },
349
+ singleLineTags: {
350
+ items: {
351
+ type: 'string'
352
+ },
353
+ type: 'array'
354
+ }
355
+ },
356
+ type: 'object'
357
+ }],
358
+ type: 'suggestion'
359
+ }
241
360
  });
242
-
243
- //#endregion
244
- exports.default = multilineBlocks_default;
361
+ module.exports = exports.default;
245
362
  //# sourceMappingURL=multilineBlocks.cjs.map