@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,5 @@
1
+ import {getJsdocProcessorPlugin} from './getJsdocProcessorPlugin.js';
2
+
3
+ export = {
4
+ getJsdocProcessorPlugin: getJsdocProcessorPlugin as typeof getJsdocProcessorPlugin
5
+ };
@@ -0,0 +1,692 @@
1
+ import {
2
+ forEachPreferredTag,
3
+ getPreferredTagName,
4
+ getRegexFromString,
5
+ getTagDescription,
6
+ hasTag,
7
+ } from './jsdocUtils.js';
8
+ import {
9
+ parseComment,
10
+ } from '@es-joy/jsdoccomment';
11
+ import * as espree from 'espree';
12
+ import {
13
+ decode,
14
+ } from 'html-entities';
15
+ import {
16
+ readFileSync,
17
+ } from 'node:fs';
18
+ import {
19
+ join,
20
+ } from 'node:path';
21
+ /**
22
+ * @import {
23
+ * Integer,
24
+ * JsdocBlockWithInline,
25
+ * } from './iterateJsdoc.js';
26
+ * @import {
27
+ * ESLint,
28
+ * Linter,
29
+ * } from 'eslint';
30
+ */
31
+
32
+ const {
33
+ version,
34
+ } = JSON.parse(
35
+ readFileSync(join(import.meta.dirname, '../package.json'), 'utf8'),
36
+ );
37
+
38
+ // const zeroBasedLineIndexAdjust = -1;
39
+ const likelyNestedJSDocIndentSpace = 1;
40
+ const preTagSpaceLength = 1;
41
+
42
+ // If a space is present, we should ignore it
43
+ const firstLinePrefixLength = preTagSpaceLength;
44
+
45
+ const hasCaptionRegex = /^\s*<caption>([\s\S]*?)<\/caption>/v;
46
+
47
+ /**
48
+ * @param {string} str
49
+ * @returns {string}
50
+ */
51
+ const escapeStringRegexp = (str) => {
52
+ return str.replaceAll(/[.*+?^$\{\}\(\)\|\[\]\\]/gv, '\\$&');
53
+ };
54
+
55
+ /**
56
+ * @param {string} str
57
+ * @param {string} ch
58
+ * @returns {Integer}
59
+ */
60
+ const countChars = (str, ch) => {
61
+ return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;
62
+ };
63
+
64
+ /**
65
+ * @param {string} text
66
+ * @returns {[
67
+ * Integer,
68
+ * Integer
69
+ * ]}
70
+ */
71
+ const getLinesCols = (text) => {
72
+ const matchLines = countChars(text, '\n');
73
+
74
+ const colDelta = matchLines ?
75
+ text.slice(text.lastIndexOf('\n') + 1).length :
76
+ text.length;
77
+
78
+ return [
79
+ matchLines, colDelta,
80
+ ];
81
+ };
82
+
83
+ /**
84
+ * @typedef {number} Integer
85
+ */
86
+ /**
87
+ * @typedef {object} JsdocProcessorOptions
88
+ * @property {boolean} [captionRequired] Require captions for example tags
89
+ * @property {Integer} [paddedIndent] See docs
90
+ * @property {boolean} [checkDefaults] See docs
91
+ * @property {boolean} [checkParams] See docs
92
+ * @property {boolean} [checkExamples] See docs
93
+ * @property {boolean} [checkProperties] See docs
94
+ * @property {string} [matchingFileName] See docs
95
+ * @property {string} [matchingFileNameDefaults] See docs
96
+ * @property {string} [matchingFileNameParams] See docs
97
+ * @property {string} [matchingFileNameProperties] See docs
98
+ * @property {string|RegExp} [exampleCodeRegex] See docs
99
+ * @property {string|RegExp} [rejectExampleCodeRegex] See docs
100
+ * @property {string[]} [allowedLanguagesToProcess] See docs
101
+ * @property {"script"|"module"} [sourceType] See docs
102
+ * @property {import('eslint').Linter.ESTreeParser|import('eslint').Linter.NonESTreeParser} [parser] See docs
103
+ */
104
+
105
+ /**
106
+ * We use a function for the ability of the user to pass in a config, but
107
+ * without requiring all users of the plugin to do so.
108
+ * @param {JsdocProcessorOptions} [options]
109
+ * @returns {ESLint.Plugin}
110
+ */
111
+ export const getJsdocProcessorPlugin = (options = {}) => {
112
+ /**
113
+ * @typedef {{
114
+ * text: string,
115
+ * filename: string|null|undefined
116
+ * }} TextAndFileName
117
+ */
118
+
119
+ const {
120
+ allowedLanguagesToProcess = [
121
+ 'js', 'ts', 'javascript', 'typescript',
122
+ ],
123
+ captionRequired = false,
124
+ checkDefaults = false,
125
+ checkExamples = true,
126
+ checkParams = false,
127
+ checkProperties = false,
128
+ exampleCodeRegex = null,
129
+ matchingFileName = null,
130
+ matchingFileNameDefaults = null,
131
+ matchingFileNameParams = null,
132
+ matchingFileNameProperties = null,
133
+ paddedIndent = 0,
134
+ parser = undefined,
135
+ rejectExampleCodeRegex = null,
136
+ sourceType = 'module',
137
+ } = options;
138
+
139
+ /** @type {RegExp} */
140
+ let exampleCodeRegExp;
141
+ /** @type {RegExp} */
142
+ let rejectExampleCodeRegExp;
143
+
144
+ if (exampleCodeRegex) {
145
+ exampleCodeRegExp = typeof exampleCodeRegex === 'string' ?
146
+ getRegexFromString(exampleCodeRegex) :
147
+ exampleCodeRegex;
148
+ }
149
+
150
+ if (rejectExampleCodeRegex) {
151
+ rejectExampleCodeRegExp = typeof rejectExampleCodeRegex === 'string' ?
152
+ getRegexFromString(rejectExampleCodeRegex) :
153
+ rejectExampleCodeRegex;
154
+ }
155
+
156
+ /**
157
+ * @type {{
158
+ * targetTagName: string,
159
+ * ext: string,
160
+ * codeStartLine: number,
161
+ * codeStartCol: number,
162
+ * nonJSPrefacingCols: number,
163
+ * commentLineCols: [number, number]
164
+ * }[]}
165
+ */
166
+ const otherInfo = [];
167
+
168
+ /** @type {import('eslint').Linter.LintMessage[]} */
169
+ let extraMessages = [];
170
+
171
+ /**
172
+ * @param {JsdocBlockWithInline} jsdoc
173
+ * @param {string} jsFileName
174
+ * @param {[number, number]} commentLineCols
175
+ */
176
+ const getTextsAndFileNames = (jsdoc, jsFileName, commentLineCols) => {
177
+ /**
178
+ * @type {TextAndFileName[]}
179
+ */
180
+ const textsAndFileNames = [];
181
+
182
+ /**
183
+ * @param {{
184
+ * filename: string|null,
185
+ * defaultFileName: string|undefined,
186
+ * source: string,
187
+ * targetTagName: string,
188
+ * rules?: import('eslint').Linter.RulesRecord|undefined,
189
+ * lines?: Integer,
190
+ * cols?: Integer,
191
+ * skipInit?: boolean,
192
+ * ext: string,
193
+ * sources?: {
194
+ * nonJSPrefacingCols: Integer,
195
+ * nonJSPrefacingLines: Integer,
196
+ * string: string,
197
+ * }[],
198
+ * tag?: import('comment-parser').Spec & {
199
+ * line?: Integer,
200
+ * }|{
201
+ * line: Integer,
202
+ * }
203
+ * }} cfg
204
+ */
205
+ const checkSource = ({
206
+ cols = 0,
207
+ defaultFileName,
208
+ ext,
209
+ filename,
210
+ lines = 0,
211
+ skipInit,
212
+ source,
213
+ sources = [],
214
+ tag = {
215
+ line: 0,
216
+ },
217
+ targetTagName,
218
+ }) => {
219
+ if (!skipInit) {
220
+ sources.push({
221
+ nonJSPrefacingCols: cols,
222
+ nonJSPrefacingLines: lines,
223
+ string: source,
224
+ });
225
+ }
226
+
227
+ /**
228
+ * @param {{
229
+ * nonJSPrefacingCols: Integer,
230
+ * nonJSPrefacingLines: Integer,
231
+ * string: string
232
+ * }} cfg
233
+ */
234
+ const addSourceInfo = function ({
235
+ nonJSPrefacingCols,
236
+ nonJSPrefacingLines,
237
+ string,
238
+ }) {
239
+ const src = paddedIndent ?
240
+ string.replaceAll(new RegExp(`(^|\n) {${paddedIndent}}(?!$)`, 'gv'), '\n') :
241
+ string;
242
+
243
+ // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api
244
+ const file = filename || defaultFileName;
245
+
246
+ if (!('line' in tag)) {
247
+ tag.line = tag.source[0].number;
248
+ }
249
+
250
+ // NOTE: `tag.line` can be 0 if of form `/** @tag ... */`
251
+ const codeStartLine = /**
252
+ * @type {import('comment-parser').Spec & {
253
+ * line: Integer,
254
+ * }}
255
+ */ (tag).line + nonJSPrefacingLines;
256
+ const codeStartCol = likelyNestedJSDocIndentSpace;
257
+
258
+ textsAndFileNames.push({
259
+ filename: file,
260
+ // See https://github.com/gajus/eslint-plugin-jsdoc/issues/710
261
+ text: src.replaceAll(/(?<=\*)\\(?=\\*\/)/gv, '').replaceAll(/&([^\s;]+);/gv, (_, code) => {
262
+ // Dec
263
+ if ((/^#\d+$/v).test(code)) {
264
+ return String.fromCodePoint(Number.parseInt(code.slice(1), 10));
265
+ }
266
+
267
+ // Hex
268
+ if ((/^#x\d+$/v).test(code)) {
269
+ return String.fromCodePoint(Number.parseInt(code.slice(2), 16));
270
+ }
271
+
272
+ return decode(_, {
273
+ level: 'html5',
274
+ });
275
+ }),
276
+ });
277
+ otherInfo.push({
278
+ codeStartCol,
279
+ codeStartLine,
280
+ commentLineCols,
281
+ ext,
282
+ nonJSPrefacingCols,
283
+ targetTagName,
284
+ });
285
+ };
286
+
287
+ for (const targetSource of sources) {
288
+ addSourceInfo(targetSource);
289
+ }
290
+ };
291
+
292
+ /**
293
+ *
294
+ * @param {string|null} filename
295
+ * @param {string} [ext] Since `eslint-plugin-markdown` v2, and
296
+ * ESLint 7, this is the default which other JS-fenced rules will used.
297
+ * Formerly "md" was the default.
298
+ * @returns {{
299
+ * defaultFileName: string|undefined,
300
+ * filename: string|null,
301
+ * ext: string
302
+ * }}
303
+ */
304
+ const getFilenameInfo = (filename, ext = 'md/*.js') => {
305
+ let defaultFileName;
306
+ if (!filename) {
307
+ if (typeof jsFileName === 'string' && jsFileName.includes('.')) {
308
+ defaultFileName = jsFileName.replace(/\.[^.]*$/v, `.${ext}`);
309
+ } else {
310
+ defaultFileName = `dummy.${ext}`;
311
+ }
312
+ }
313
+
314
+ return {
315
+ defaultFileName,
316
+ ext,
317
+ filename,
318
+ };
319
+ };
320
+
321
+ if (checkDefaults) {
322
+ const filenameInfo = getFilenameInfo(matchingFileNameDefaults, 'jsdoc-defaults');
323
+ forEachPreferredTag(jsdoc, 'default', (tag, targetTagName) => {
324
+ if (!tag.description.trim()) {
325
+ return;
326
+ }
327
+
328
+ checkSource({
329
+ source: `(${getTagDescription(tag)})`,
330
+ targetTagName,
331
+ ...filenameInfo,
332
+ });
333
+ });
334
+ }
335
+
336
+ if (checkParams) {
337
+ const filenameInfo = getFilenameInfo(matchingFileNameParams, 'jsdoc-params');
338
+ forEachPreferredTag(jsdoc, 'param', (tag, targetTagName) => {
339
+ if (!tag.default || !tag.default.trim()) {
340
+ return;
341
+ }
342
+
343
+ checkSource({
344
+ source: `(${tag.default})`,
345
+ targetTagName,
346
+ ...filenameInfo,
347
+ });
348
+ });
349
+ }
350
+
351
+ if (checkProperties) {
352
+ const filenameInfo = getFilenameInfo(matchingFileNameProperties, 'jsdoc-properties');
353
+ forEachPreferredTag(jsdoc, 'property', (tag, targetTagName) => {
354
+ if (!tag.default || !tag.default.trim()) {
355
+ return;
356
+ }
357
+
358
+ checkSource({
359
+ source: `(${tag.default})`,
360
+ targetTagName,
361
+ ...filenameInfo,
362
+ });
363
+ });
364
+ }
365
+
366
+ if (!checkExamples) {
367
+ return textsAndFileNames;
368
+ }
369
+
370
+ const tagName = /** @type {string} */ (getPreferredTagName(jsdoc, {
371
+ tagName: 'example',
372
+ }));
373
+ if (!hasTag(jsdoc, tagName)) {
374
+ return textsAndFileNames;
375
+ }
376
+
377
+ const matchingFilenameInfo = getFilenameInfo(matchingFileName);
378
+
379
+ forEachPreferredTag(jsdoc, 'example', (tag, targetTagName) => {
380
+ let source = /** @type {string} */ (getTagDescription(tag));
381
+ const match = source.match(hasCaptionRegex);
382
+
383
+ if (captionRequired && (!match || !match[1].trim())) {
384
+ extraMessages.push({
385
+ column: commentLineCols[1] + 1,
386
+ line: 1 + commentLineCols[0] + (tag.line ?? tag.source[0].number),
387
+ message: `@${targetTagName} error - Caption is expected for examples.`,
388
+ ruleId: 'jsdoc/example-missing-caption',
389
+ severity: 2,
390
+ });
391
+ return;
392
+ }
393
+
394
+ source = source.replace(hasCaptionRegex, '');
395
+ const [
396
+ lines,
397
+ cols,
398
+ ] = match ? getLinesCols(match[0]) : [
399
+ 0, 0,
400
+ ];
401
+
402
+ if (exampleCodeRegex && !exampleCodeRegExp.test(source) ||
403
+ rejectExampleCodeRegex && rejectExampleCodeRegExp.test(source)
404
+ ) {
405
+ return;
406
+ }
407
+
408
+ // If `allowedLanguagesToProcess` is falsy, all languages should be processed.
409
+ if (allowedLanguagesToProcess) {
410
+ const matches = (/^\s*```(?<language>\S+)([\s\S]*)```\s*$/v).exec(source);
411
+ if (matches?.groups && !allowedLanguagesToProcess.includes(
412
+ matches.groups.language.toLowerCase(),
413
+ )) {
414
+ return;
415
+ }
416
+ }
417
+
418
+ const sources = [];
419
+ let skipInit = false;
420
+ if (exampleCodeRegex) {
421
+ let nonJSPrefacingCols = 0;
422
+ let nonJSPrefacingLines = 0;
423
+
424
+ let startingIndex = 0;
425
+ let lastStringCount = 0;
426
+
427
+ let exampleCode;
428
+ exampleCodeRegExp.lastIndex = 0;
429
+ while ((exampleCode = exampleCodeRegExp.exec(source)) !== null) {
430
+ const {
431
+ '0': n0,
432
+ '1': n1,
433
+ index,
434
+ } = exampleCode;
435
+
436
+ // Count anything preceding user regex match (can affect line numbering)
437
+ const preMatch = source.slice(startingIndex, index);
438
+
439
+ const [
440
+ preMatchLines,
441
+ colDelta,
442
+ ] = getLinesCols(preMatch);
443
+
444
+ let nonJSPreface;
445
+ let nonJSPrefaceLineCount;
446
+ if (n1) {
447
+ const idx = n0.indexOf(n1);
448
+ nonJSPreface = n0.slice(0, idx);
449
+ nonJSPrefaceLineCount = countChars(nonJSPreface, '\n');
450
+ } else {
451
+ nonJSPreface = '';
452
+ nonJSPrefaceLineCount = 0;
453
+ }
454
+
455
+ nonJSPrefacingLines += lastStringCount + preMatchLines + nonJSPrefaceLineCount;
456
+
457
+ // Ignore `preMatch` delta if newlines here
458
+ if (nonJSPrefaceLineCount) {
459
+ const charsInLastLine = nonJSPreface.slice(nonJSPreface.lastIndexOf('\n') + 1).length;
460
+
461
+ nonJSPrefacingCols += charsInLastLine;
462
+ } else {
463
+ nonJSPrefacingCols += colDelta + nonJSPreface.length;
464
+ }
465
+
466
+ const string = n1 || n0;
467
+ sources.push({
468
+ nonJSPrefacingCols,
469
+ nonJSPrefacingLines,
470
+ string,
471
+ });
472
+ startingIndex = exampleCodeRegExp.lastIndex;
473
+ lastStringCount = countChars(string, '\n');
474
+ if (!exampleCodeRegExp.global) {
475
+ break;
476
+ }
477
+ }
478
+
479
+ skipInit = true;
480
+ }
481
+
482
+ checkSource({
483
+ cols,
484
+ lines,
485
+ skipInit,
486
+ source,
487
+ sources,
488
+ tag,
489
+ targetTagName,
490
+ ...matchingFilenameInfo,
491
+ });
492
+ });
493
+
494
+ return textsAndFileNames;
495
+ };
496
+
497
+ // See https://eslint.org/docs/latest/extend/plugins#processors-in-plugins
498
+ // See https://eslint.org/docs/latest/extend/custom-processors
499
+ // From https://github.com/eslint/eslint/issues/14745#issuecomment-869457265
500
+ /*
501
+ {
502
+ "files": ["*.js", "*.ts"],
503
+ "processor": "jsdoc/example" // a pretended value here
504
+ },
505
+ {
506
+ "files": [
507
+ "*.js/*_jsdoc-example.js",
508
+ "*.ts/*_jsdoc-example.js",
509
+ "*.js/*_jsdoc-example.ts"
510
+ ],
511
+ "rules": {
512
+ // specific rules for examples in jsdoc only here
513
+ // And other rules for `.js` and `.ts` will also be enabled for them
514
+ }
515
+ }
516
+ */
517
+ return {
518
+ meta: {
519
+ name: 'eslint-plugin-jsdoc/processor',
520
+ version,
521
+ },
522
+ processors: {
523
+ examples: {
524
+ meta: {
525
+ name: 'eslint-plugin-jsdoc/preprocessor',
526
+ version,
527
+ },
528
+ /**
529
+ * @param {import('eslint').Linter.LintMessage[][]} messages
530
+ * @param {string} filename
531
+ */
532
+ postprocess ([
533
+ jsMessages,
534
+ ...messages
535
+ // eslint-disable-next-line no-unused-vars -- Placeholder
536
+ ], filename) {
537
+ for (const [
538
+ idx,
539
+ message,
540
+ ] of messages.entries()) {
541
+ const {
542
+ codeStartCol,
543
+ codeStartLine,
544
+ commentLineCols,
545
+ nonJSPrefacingCols,
546
+ targetTagName,
547
+ } = otherInfo[idx];
548
+
549
+ for (const msg of message) {
550
+ const {
551
+ column,
552
+ endColumn,
553
+ endLine,
554
+ fatal,
555
+ line,
556
+ message: messageText,
557
+ ruleId,
558
+ severity,
559
+
560
+ // Todo: Make fixable
561
+ // fix
562
+ // fix: {range: [number, number], text: string}
563
+ // suggestions: {desc: , messageId:, fix: }[],
564
+ } = msg;
565
+ delete msg.fix;
566
+
567
+ const [
568
+ codeCtxLine,
569
+ codeCtxColumn,
570
+ ] = commentLineCols;
571
+ const startLine = codeCtxLine + codeStartLine + line;
572
+
573
+ // Seems to need one more now
574
+ const startCol = 1 +
575
+ codeCtxColumn + codeStartCol + (
576
+ // This might not work for line 0, but line 0 is unlikely for examples
577
+ line <= 1 ? nonJSPrefacingCols + firstLinePrefixLength : preTagSpaceLength
578
+ ) + column;
579
+
580
+ msg.message = '@' + targetTagName + ' ' + (severity === 2 ? 'error' : 'warning') +
581
+ (ruleId ? ' (' + ruleId + ')' : '') + ': ' +
582
+ (fatal ? 'Fatal: ' : '') +
583
+ messageText;
584
+ msg.line = startLine;
585
+ msg.column = startCol;
586
+ msg.endLine = endLine ? startLine + endLine : startLine;
587
+ // added `- column` to offset what `endColumn` already seemed to include
588
+ msg.endColumn = endColumn ? startCol - column + endColumn : startCol;
589
+ }
590
+ }
591
+
592
+ const ret = [
593
+ ...jsMessages,
594
+ ].concat(...messages, ...extraMessages);
595
+ extraMessages = [];
596
+ return ret;
597
+ },
598
+
599
+ /**
600
+ * @param {string} text
601
+ * @param {string} filename
602
+ * @returns {(string | Linter.ProcessorFile)[]}
603
+ */
604
+ preprocess (text, filename) {
605
+ try {
606
+ let ast;
607
+
608
+ // May be running a second time so catch and ignore
609
+ try {
610
+ ast = parser ?
611
+ // @ts-expect-error Should be present
612
+ parser.parseForESLint(text, {
613
+ comment: true,
614
+ ecmaVersion: 'latest',
615
+ sourceType,
616
+ }).ast :
617
+ espree.parse(text, {
618
+ comment: true,
619
+ ecmaVersion: 'latest',
620
+ sourceType,
621
+ });
622
+ } catch {
623
+ return [
624
+ text,
625
+ ];
626
+ }
627
+
628
+ /** @type {[number, number][]} */
629
+ const commentLineCols = [];
630
+ const jsdocComments = /** @type {import('estree').Comment[]} */ (
631
+ /**
632
+ * @type {import('estree').Program & {
633
+ * comments?: import('estree').Comment[]
634
+ * }}
635
+ */
636
+ (ast).comments
637
+ ).filter((comment) => {
638
+ return (/^\*\s/v).test(comment.value);
639
+ }).map((comment) => {
640
+ const [
641
+ start,
642
+ /* c8 ignore next -- Unsupporting processors only? */
643
+ ] = comment.range ?? [];
644
+ const textToStart = text.slice(0, start);
645
+
646
+ const [
647
+ lines,
648
+ cols,
649
+ ] = getLinesCols(textToStart);
650
+
651
+ // const lines = [...textToStart.matchAll(/\n/gv)].length
652
+ // const lastLinePos = textToStart.lastIndexOf('\n');
653
+ // const cols = lastLinePos === -1
654
+ // ? 0
655
+ // : textToStart.slice(lastLinePos).length;
656
+ commentLineCols.push([
657
+ lines, cols,
658
+ ]);
659
+ return parseComment(comment);
660
+ });
661
+
662
+ return [
663
+ text,
664
+ ...jsdocComments.flatMap((jsdoc, idx) => {
665
+ return getTextsAndFileNames(
666
+ jsdoc,
667
+ filename,
668
+ commentLineCols[idx],
669
+ );
670
+ }).filter(
671
+ /**
672
+ * @param {TextAndFileName} file
673
+ * @returns {file is Linter.ProcessorFile}
674
+ */
675
+ (file) => {
676
+ return file !== null && file !== undefined;
677
+ },
678
+ ),
679
+ ];
680
+ /* c8 ignore next 6 */
681
+ } catch (error) {
682
+ // eslint-disable-next-line no-console -- Debugging
683
+ console.log('err', filename, error);
684
+ }
685
+
686
+ return [];
687
+ },
688
+ supportsAutofix: true,
689
+ },
690
+ },
691
+ };
692
+ };