eslint-plugin-jsdoc 63.3.3 → 64.0.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 (269) hide show
  1. package/package.json +23 -48
  2. package/src/index.js +3 -6
  3. package/dist/WarnSettings.cjs +0 -38
  4. package/dist/WarnSettings.cjs.map +0 -1
  5. package/dist/alignTransform.cjs +0 -402
  6. package/dist/alignTransform.cjs.map +0 -1
  7. package/dist/buildForbidRuleDefinition.cjs +0 -101
  8. package/dist/buildForbidRuleDefinition.cjs.map +0 -1
  9. package/dist/buildRejectOrPreferRuleDefinition.cjs +0 -352
  10. package/dist/buildRejectOrPreferRuleDefinition.cjs.map +0 -1
  11. package/dist/cjs/WarnSettings.d.ts +0 -16
  12. package/dist/cjs/alignTransform.d.ts +0 -33
  13. package/dist/cjs/buildForbidRuleDefinition.d.ts +0 -14
  14. package/dist/cjs/buildRejectOrPreferRuleDefinition.d.ts +0 -8
  15. package/dist/cjs/defaultTagOrder.d.ts +0 -4
  16. package/dist/cjs/exportParser.d.ts +0 -40
  17. package/dist/cjs/getDefaultTagStructureForMode.d.ts +0 -10
  18. package/dist/cjs/getJsdocProcessorPlugin.d.cts +0 -5
  19. package/dist/cjs/getJsdocProcessorPlugin.d.ts +0 -66
  20. package/dist/cjs/index-cjs.d.ts +0 -26
  21. package/dist/cjs/index.cjs.d.cts +0 -2
  22. package/dist/cjs/iterateJsdoc.d.cts +0 -7
  23. package/dist/cjs/iterateJsdoc.d.ts +0 -495
  24. package/dist/cjs/jsdocUtils.d.ts +0 -500
  25. package/dist/cjs/rules/checkAccess.d.ts +0 -2
  26. package/dist/cjs/rules/checkAlignment.d.ts +0 -2
  27. package/dist/cjs/rules/checkExamples.d.ts +0 -3
  28. package/dist/cjs/rules/checkIndentation.d.ts +0 -2
  29. package/dist/cjs/rules/checkLineAlignment.d.ts +0 -9
  30. package/dist/cjs/rules/checkParamNames.d.ts +0 -2
  31. package/dist/cjs/rules/checkPropertyNames.d.ts +0 -2
  32. package/dist/cjs/rules/checkSyntax.d.ts +0 -2
  33. package/dist/cjs/rules/checkTagNames.d.ts +0 -2
  34. package/dist/cjs/rules/checkTemplateNames.d.ts +0 -2
  35. package/dist/cjs/rules/checkTypes.d.ts +0 -7
  36. package/dist/cjs/rules/checkValues.d.ts +0 -2
  37. package/dist/cjs/rules/convertToJsdocComments.d.ts +0 -266
  38. package/dist/cjs/rules/emptyTags.d.ts +0 -2
  39. package/dist/cjs/rules/escapeInlineTags.d.ts +0 -2
  40. package/dist/cjs/rules/implementsOnClasses.d.ts +0 -2
  41. package/dist/cjs/rules/importsAsDependencies.d.ts +0 -2
  42. package/dist/cjs/rules/informativeDocs.d.ts +0 -2
  43. package/dist/cjs/rules/linesBeforeBlock.d.ts +0 -2
  44. package/dist/cjs/rules/matchDescription.d.ts +0 -2
  45. package/dist/cjs/rules/matchName.d.ts +0 -2
  46. package/dist/cjs/rules/multilineBlocks.d.ts +0 -2
  47. package/dist/cjs/rules/noBadBlocks.d.ts +0 -2
  48. package/dist/cjs/rules/noBlankBlockDescriptions.d.ts +0 -2
  49. package/dist/cjs/rules/noBlankBlocks.d.ts +0 -2
  50. package/dist/cjs/rules/noDefaults.d.ts +0 -2
  51. package/dist/cjs/rules/noMissingSyntax.d.ts +0 -9
  52. package/dist/cjs/rules/noMultiAsterisks.d.ts +0 -2
  53. package/dist/cjs/rules/noRestrictedSyntax.d.ts +0 -2
  54. package/dist/cjs/rules/noTypes.d.ts +0 -2
  55. package/dist/cjs/rules/noUndefinedTypes.d.ts +0 -2
  56. package/dist/cjs/rules/normalizeSeeLinks.d.ts +0 -2
  57. package/dist/cjs/rules/preferImportTag.d.ts +0 -2
  58. package/dist/cjs/rules/requireAsteriskPrefix.d.ts +0 -2
  59. package/dist/cjs/rules/requireDescription.d.ts +0 -2
  60. package/dist/cjs/rules/requireDescriptionCompleteSentence.d.ts +0 -2
  61. package/dist/cjs/rules/requireExample.d.ts +0 -2
  62. package/dist/cjs/rules/requireFileOverview.d.ts +0 -2
  63. package/dist/cjs/rules/requireHyphenBeforeParamDescription.d.ts +0 -2
  64. package/dist/cjs/rules/requireJsdoc.d.ts +0 -24
  65. package/dist/cjs/rules/requireParam.d.ts +0 -3
  66. package/dist/cjs/rules/requireParamDescription.d.ts +0 -2
  67. package/dist/cjs/rules/requireParamName.d.ts +0 -2
  68. package/dist/cjs/rules/requireParamType.d.ts +0 -2
  69. package/dist/cjs/rules/requireProperty.d.ts +0 -2
  70. package/dist/cjs/rules/requirePropertyDescription.d.ts +0 -2
  71. package/dist/cjs/rules/requirePropertyName.d.ts +0 -2
  72. package/dist/cjs/rules/requirePropertyType.d.ts +0 -2
  73. package/dist/cjs/rules/requireRejects.d.ts +0 -2
  74. package/dist/cjs/rules/requireReturns.d.ts +0 -2
  75. package/dist/cjs/rules/requireReturnsCheck.d.ts +0 -2
  76. package/dist/cjs/rules/requireReturnsDescription.d.ts +0 -2
  77. package/dist/cjs/rules/requireReturnsType.d.ts +0 -2
  78. package/dist/cjs/rules/requireTags.d.ts +0 -2
  79. package/dist/cjs/rules/requireTemplate.d.ts +0 -2
  80. package/dist/cjs/rules/requireThrows.d.ts +0 -2
  81. package/dist/cjs/rules/requireYields.d.ts +0 -2
  82. package/dist/cjs/rules/requireYieldsCheck.d.ts +0 -2
  83. package/dist/cjs/rules/sortTags.d.ts +0 -2
  84. package/dist/cjs/rules/tagLines.d.ts +0 -2
  85. package/dist/cjs/rules/textEscaping.d.ts +0 -2
  86. package/dist/cjs/rules/tsMethodSignatureStyle.d.ts +0 -2
  87. package/dist/cjs/rules/tsNoEmptyObjectType.d.ts +0 -2
  88. package/dist/cjs/rules/tsNoUnnecessaryTemplateExpression.d.ts +0 -2
  89. package/dist/cjs/rules/tsPreferFunctionType.d.ts +0 -2
  90. package/dist/cjs/rules/typeFormatting.d.ts +0 -2
  91. package/dist/cjs/rules/validTypes.d.ts +0 -2
  92. package/dist/cjs/tagNames.d.ts +0 -15
  93. package/dist/cjs/utils/hasReturnValue.d.ts +0 -19
  94. package/dist/defaultTagOrder.cjs +0 -46
  95. package/dist/defaultTagOrder.cjs.map +0 -1
  96. package/dist/exportParser.cjs +0 -732
  97. package/dist/exportParser.cjs.map +0 -1
  98. package/dist/generateDocs.cjs +0 -342
  99. package/dist/generateDocs.cjs.map +0 -1
  100. package/dist/generateOptions.cjs +0 -62
  101. package/dist/generateOptions.cjs.map +0 -1
  102. package/dist/generateRule.cjs +0 -248
  103. package/dist/generateRule.cjs.map +0 -1
  104. package/dist/generateRuleTypes.cjs +0 -24
  105. package/dist/generateRuleTypes.cjs.map +0 -1
  106. package/dist/getDefaultTagStructureForMode.cjs +0 -289
  107. package/dist/getDefaultTagStructureForMode.cjs.map +0 -1
  108. package/dist/getJsdocProcessorPlugin.cjs +0 -587
  109. package/dist/getJsdocProcessorPlugin.cjs.map +0 -1
  110. package/dist/getJsdocProcessorPlugin.cts +0 -5
  111. package/dist/index-cjs.cjs +0 -600
  112. package/dist/index-cjs.cjs.map +0 -1
  113. package/dist/index-cjs.d.ts +0 -27
  114. package/dist/index-esm.cjs +0 -162
  115. package/dist/index-esm.cjs.map +0 -1
  116. package/dist/index-esm.d.ts +0 -72
  117. package/dist/index.cjs +0 -748
  118. package/dist/index.cjs.cts +0 -3
  119. package/dist/index.cjs.map +0 -1
  120. package/dist/iterateJsdoc.cjs +0 -2150
  121. package/dist/iterateJsdoc.cjs.map +0 -1
  122. package/dist/iterateJsdoc.cts +0 -7
  123. package/dist/jsdocUtils.cjs +0 -1786
  124. package/dist/jsdocUtils.cjs.map +0 -1
  125. package/dist/rules/checkAccess.cjs +0 -40
  126. package/dist/rules/checkAccess.cjs.map +0 -1
  127. package/dist/rules/checkAlignment.cjs +0 -78
  128. package/dist/rules/checkAlignment.cjs.map +0 -1
  129. package/dist/rules/checkExamples.cjs +0 -521
  130. package/dist/rules/checkExamples.cjs.map +0 -1
  131. package/dist/rules/checkIndentation.cjs +0 -170
  132. package/dist/rules/checkIndentation.cjs.map +0 -1
  133. package/dist/rules/checkLineAlignment.cjs +0 -398
  134. package/dist/rules/checkLineAlignment.cjs.map +0 -1
  135. package/dist/rules/checkParamNames.cjs +0 -407
  136. package/dist/rules/checkParamNames.cjs.map +0 -1
  137. package/dist/rules/checkPropertyNames.cjs +0 -135
  138. package/dist/rules/checkPropertyNames.cjs.map +0 -1
  139. package/dist/rules/checkSyntax.cjs +0 -38
  140. package/dist/rules/checkSyntax.cjs.map +0 -1
  141. package/dist/rules/checkTagNames.cjs +0 -312
  142. package/dist/rules/checkTagNames.cjs.map +0 -1
  143. package/dist/rules/checkTemplateNames.cjs +0 -192
  144. package/dist/rules/checkTemplateNames.cjs.map +0 -1
  145. package/dist/rules/checkTypes.cjs +0 -111
  146. package/dist/rules/checkTypes.cjs.map +0 -1
  147. package/dist/rules/checkValues.cjs +0 -166
  148. package/dist/rules/checkValues.cjs.map +0 -1
  149. package/dist/rules/convertToJsdocComments.cjs +0 -356
  150. package/dist/rules/convertToJsdocComments.cjs.map +0 -1
  151. package/dist/rules/emptyTags.cjs +0 -98
  152. package/dist/rules/emptyTags.cjs.map +0 -1
  153. package/dist/rules/escapeInlineTags.cjs +0 -234
  154. package/dist/rules/escapeInlineTags.cjs.map +0 -1
  155. package/dist/rules/implementsOnClasses.cjs +0 -74
  156. package/dist/rules/implementsOnClasses.cjs.map +0 -1
  157. package/dist/rules/importsAsDependencies.cjs +0 -104
  158. package/dist/rules/importsAsDependencies.cjs.map +0 -1
  159. package/dist/rules/informativeDocs.cjs +0 -187
  160. package/dist/rules/informativeDocs.cjs.map +0 -1
  161. package/dist/rules/linesBeforeBlock.cjs +0 -120
  162. package/dist/rules/linesBeforeBlock.cjs.map +0 -1
  163. package/dist/rules/matchDescription.cjs +0 -356
  164. package/dist/rules/matchDescription.cjs.map +0 -1
  165. package/dist/rules/matchName.cjs +0 -160
  166. package/dist/rules/matchName.cjs.map +0 -1
  167. package/dist/rules/multilineBlocks.cjs +0 -431
  168. package/dist/rules/multilineBlocks.cjs.map +0 -1
  169. package/dist/rules/noBadBlocks.cjs +0 -100
  170. package/dist/rules/noBadBlocks.cjs.map +0 -1
  171. package/dist/rules/noBlankBlockDescriptions.cjs +0 -63
  172. package/dist/rules/noBlankBlockDescriptions.cjs.map +0 -1
  173. package/dist/rules/noBlankBlocks.cjs +0 -54
  174. package/dist/rules/noBlankBlocks.cjs.map +0 -1
  175. package/dist/rules/noDefaults.cjs +0 -102
  176. package/dist/rules/noDefaults.cjs.map +0 -1
  177. package/dist/rules/noMissingSyntax.cjs +0 -196
  178. package/dist/rules/noMissingSyntax.cjs.map +0 -1
  179. package/dist/rules/noMultiAsterisks.cjs +0 -126
  180. package/dist/rules/noMultiAsterisks.cjs.map +0 -1
  181. package/dist/rules/noRestrictedSyntax.cjs +0 -68
  182. package/dist/rules/noRestrictedSyntax.cjs.map +0 -1
  183. package/dist/rules/noTypes.cjs +0 -101
  184. package/dist/rules/noTypes.cjs.map +0 -1
  185. package/dist/rules/noUndefinedTypes.cjs +0 -616
  186. package/dist/rules/noUndefinedTypes.cjs.map +0 -1
  187. package/dist/rules/normalizeSeeLinks.cjs +0 -271
  188. package/dist/rules/normalizeSeeLinks.cjs.map +0 -1
  189. package/dist/rules/preferImportTag.cjs +0 -362
  190. package/dist/rules/preferImportTag.cjs.map +0 -1
  191. package/dist/rules/requireAsteriskPrefix.cjs +0 -190
  192. package/dist/rules/requireAsteriskPrefix.cjs.map +0 -1
  193. package/dist/rules/requireDescription.cjs +0 -164
  194. package/dist/rules/requireDescription.cjs.map +0 -1
  195. package/dist/rules/requireDescriptionCompleteSentence.cjs +0 -321
  196. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +0 -1
  197. package/dist/rules/requireExample.cjs +0 -136
  198. package/dist/rules/requireExample.cjs.map +0 -1
  199. package/dist/rules/requireFileOverview.cjs +0 -194
  200. package/dist/rules/requireFileOverview.cjs.map +0 -1
  201. package/dist/rules/requireHyphenBeforeParamDescription.cjs +0 -166
  202. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +0 -1
  203. package/dist/rules/requireJsdoc.cjs +0 -721
  204. package/dist/rules/requireJsdoc.cjs.map +0 -1
  205. package/dist/rules/requireParam.cjs +0 -772
  206. package/dist/rules/requireParam.cjs.map +0 -1
  207. package/dist/rules/requireParamDescription.cjs +0 -105
  208. package/dist/rules/requireParamDescription.cjs.map +0 -1
  209. package/dist/rules/requireParamName.cjs +0 -68
  210. package/dist/rules/requireParamName.cjs.map +0 -1
  211. package/dist/rules/requireParamType.cjs +0 -104
  212. package/dist/rules/requireParamType.cjs.map +0 -1
  213. package/dist/rules/requireProperty.cjs +0 -63
  214. package/dist/rules/requireProperty.cjs.map +0 -1
  215. package/dist/rules/requirePropertyDescription.cjs +0 -29
  216. package/dist/rules/requirePropertyDescription.cjs.map +0 -1
  217. package/dist/rules/requirePropertyName.cjs +0 -29
  218. package/dist/rules/requirePropertyName.cjs.map +0 -1
  219. package/dist/rules/requirePropertyType.cjs +0 -29
  220. package/dist/rules/requirePropertyType.cjs.map +0 -1
  221. package/dist/rules/requireRejects.cjs +0 -226
  222. package/dist/rules/requireRejects.cjs.map +0 -1
  223. package/dist/rules/requireReturns.cjs +0 -262
  224. package/dist/rules/requireReturns.cjs.map +0 -1
  225. package/dist/rules/requireReturnsCheck.cjs +0 -225
  226. package/dist/rules/requireReturnsCheck.cjs.map +0 -1
  227. package/dist/rules/requireReturnsDescription.cjs +0 -72
  228. package/dist/rules/requireReturnsDescription.cjs.map +0 -1
  229. package/dist/rules/requireReturnsType.cjs +0 -68
  230. package/dist/rules/requireReturnsType.cjs.map +0 -1
  231. package/dist/rules/requireTags.cjs +0 -74
  232. package/dist/rules/requireTags.cjs.map +0 -1
  233. package/dist/rules/requireTemplate.cjs +0 -220
  234. package/dist/rules/requireTemplate.cjs.map +0 -1
  235. package/dist/rules/requireThrows.cjs +0 -118
  236. package/dist/rules/requireThrows.cjs.map +0 -1
  237. package/dist/rules/requireYields.cjs +0 -224
  238. package/dist/rules/requireYields.cjs.map +0 -1
  239. package/dist/rules/requireYieldsCheck.cjs +0 -179
  240. package/dist/rules/requireYieldsCheck.cjs.map +0 -1
  241. package/dist/rules/sortTags.cjs +0 -656
  242. package/dist/rules/sortTags.cjs.map +0 -1
  243. package/dist/rules/tagLines.cjs +0 -374
  244. package/dist/rules/tagLines.cjs.map +0 -1
  245. package/dist/rules/textEscaping.cjs +0 -141
  246. package/dist/rules/textEscaping.cjs.map +0 -1
  247. package/dist/rules/tsMethodSignatureStyle.cjs +0 -240
  248. package/dist/rules/tsMethodSignatureStyle.cjs.map +0 -1
  249. package/dist/rules/tsNoEmptyObjectType.cjs +0 -62
  250. package/dist/rules/tsNoEmptyObjectType.cjs.map +0 -1
  251. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs +0 -104
  252. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs.map +0 -1
  253. package/dist/rules/tsPreferFunctionType.cjs +0 -110
  254. package/dist/rules/tsPreferFunctionType.cjs.map +0 -1
  255. package/dist/rules/typeFormatting.cjs +0 -607
  256. package/dist/rules/typeFormatting.cjs.map +0 -1
  257. package/dist/rules/validTypes.cjs +0 -324
  258. package/dist/rules/validTypes.cjs.map +0 -1
  259. package/dist/tagNames.cjs +0 -244
  260. package/dist/tagNames.cjs.map +0 -1
  261. package/dist/to-valid-identifier.cjs +0 -263
  262. package/dist/utils/hasReturnValue.cjs +0 -495
  263. package/dist/utils/hasReturnValue.cjs.map +0 -1
  264. package/rollup.config.js +0 -16
  265. package/src/getJsdocProcessorPlugin.cts +0 -5
  266. package/src/index-cjs.js +0 -760
  267. package/src/index-esm.js +0 -196
  268. package/src/index.cjs.cts +0 -3
  269. package/src/iterateJsdoc.cts +0 -7
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkTypes.cjs","names":["strictNativeTypes","buildRejectOrPreferRuleDefinition"],"sources":["../../src/rules/checkTypes.js"],"sourcesContent":["import {\n buildRejectOrPreferRuleDefinition,\n} from '../buildRejectOrPreferRuleDefinition.js';\nimport {\n strictNativeTypes,\n} from '../jsdocUtils.js';\n\n/**\n * @callback CheckNativeTypes\n * Iterates strict types to see if any should be added to `invalidTypes` (and\n * the the relevant strict type returned as the new preferred type).\n * @param {import('../iterateJsdoc.js').PreferredTypes} preferredTypes\n * @param {string} typeNodeName\n * @param {string|undefined} preferred\n * @param {import('jsdoc-type-pratt-parser').NonRootResult|undefined} parentNode\n * @param {(string|false|undefined)[][]} invalidTypes\n * @returns {string|undefined} The `preferred` type string, optionally changed\n */\n\n/** @type {CheckNativeTypes} */\nconst checkNativeTypes = (preferredTypes, typeNodeName, preferred, parentNode, invalidTypes) => {\n let changedPreferred = preferred;\n for (const strictNativeType of strictNativeTypes) {\n if (\n strictNativeType === 'object' &&\n (\n // This is not set to remap with exact type match (e.g.,\n // `object: 'Object'`), so can ignore (including if circular)\n !preferredTypes?.[typeNodeName] ||\n // Although present on `preferredTypes` for remapping, this is a\n // parent object without a parent match (and not\n // `unifyParentAndChildTypeChecks`) and we don't want\n // `object<>` given TypeScript issue https://github.com/microsoft/TypeScript/issues/20555\n /**\n * @type {import('jsdoc-type-pratt-parser').GenericResult}\n */\n (\n parentNode\n )?.elements?.length && (\n /**\n * @type {import('jsdoc-type-pratt-parser').GenericResult}\n */\n (\n parentNode\n )?.left?.type === 'JsdocTypeName' &&\n /**\n * @type {import('jsdoc-type-pratt-parser').GenericResult}\n */\n (parentNode)?.left?.value === 'Object'\n )\n )\n ) {\n continue;\n }\n\n if (strictNativeType !== typeNodeName &&\n strictNativeType.toLowerCase() === typeNodeName.toLowerCase() &&\n\n // Don't report if user has own map for a strict native type\n (!preferredTypes || preferredTypes?.[strictNativeType] === undefined)\n ) {\n changedPreferred = strictNativeType;\n invalidTypes.push([\n typeNodeName, changedPreferred,\n ]);\n break;\n }\n }\n\n return changedPreferred;\n};\n\nexport default buildRejectOrPreferRuleDefinition({\n checkNativeTypes,\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptTagContexts: {\n description: 'Avoids reporting when a bad type is found on a specified tag.',\n items: {\n additionalProperties: false,\n properties: {\n tag: {\n description: 'Set a key `tag` to the tag to exempt',\n type: 'string',\n },\n types: {\n description: `Set to \\`true\\` to indicate that any types on that tag will be allowed,\nor to an array of strings which will only allow specific bad types.\nIf an array of strings is given, these must match the type exactly,\ne.g., if you only allow \\`\"object\"\\`, it will not allow\n\\`\"object<string, string>\"\\`. Note that this is different from the\nbehavior of \\`settings.jsdoc.preferredTypes\\`. This option is useful\nfor normally restricting generic types like \\`object\\` with\n\\`preferredTypes\\`, but allowing \\`typedef\\` to indicate that its base\ntype is \\`object\\`.`,\n oneOf: [\n {\n type: 'boolean',\n },\n {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ],\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n noDefaults: {\n description: `Insists that only the supplied option type\nmap is to be used, and that the default preferences (such as \"string\"\nover \"String\") will not be enforced. The option's default is \\`false\\`.`,\n type: 'boolean',\n },\n unifyParentAndChildTypeChecks: {\n description: `@deprecated Use the \\`preferredTypes[preferredType]\\` setting of the same name instead.\nIf this option is \\`true\\`, will currently override \\`unifyParentAndChildTypeChecks\\` on the \\`preferredTypes\\` setting.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n});\n"],"mappings":";;;;;;AAAA;AAGA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM,gBAAgB,GAAG,CAAC,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,KAAK;EAC9F,IAAI,gBAAgB,GAAG,SAAS;EAChC,KAAK,MAAM,gBAAgB,IAAIA,YAAA,iBAAiB,EAAE;IAChD,IACE,gBAAgB,KAAK,QAAQ;IAE3B;IACA;IACA,CAAC,cAAc,GAAG,YAAY,CAAC;IAC/B;IACA;IACA;IACA;IACA;AACR;AACA;IAEU,UAAU,EACT,QAAQ,EAAE,MAAM;IACnB;AACR;AACA;IAEY,UAAU,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EAAE;EACR,CAAC;AAEL,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,166 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
- var _parseImportsExports = require("parse-imports-exports");
9
- var _semver = _interopRequireDefault(require("semver"));
10
- var _spdxExpressionParse = _interopRequireDefault(require("spdx-expression-parse"));
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- const allowedKinds = new Set(['class', 'constant', 'event', 'external', 'file', 'function', 'member', 'mixin', 'module', 'namespace', 'typedef']);
13
- var _default = exports.default = (0, _iterateJsdoc.default)(({
14
- context,
15
- report,
16
- settings,
17
- utils
18
- }) => {
19
- const options = context.options[0] || {};
20
- const {
21
- allowedAuthors = null,
22
- allowedLicenses = null,
23
- licensePattern = '/([^\n\r]*)/gv',
24
- numericOnlyVariation = false
25
- } = options;
26
- utils.forEachPreferredTag('version', (jsdocParameter, targetTagName) => {
27
- const version = /** @type {string} */utils.getTagDescription(jsdocParameter).trim();
28
- if (!version) {
29
- report(`Missing JSDoc @${targetTagName} value.`, null, jsdocParameter);
30
- } else if (!_semver.default.valid(version)) {
31
- report(`Invalid JSDoc @${targetTagName}: "${utils.getTagDescription(jsdocParameter)}".`, null, jsdocParameter);
32
- }
33
- });
34
- utils.forEachPreferredTag('kind', (jsdocParameter, targetTagName) => {
35
- const kind = /** @type {string} */utils.getTagDescription(jsdocParameter).trim();
36
- if (!kind) {
37
- report(`Missing JSDoc @${targetTagName} value.`, null, jsdocParameter);
38
- } else if (!allowedKinds.has(kind)) {
39
- report(`Invalid JSDoc @${targetTagName}: "${utils.getTagDescription(jsdocParameter)}"; ` + `must be one of: ${[...allowedKinds].join(', ')}.`, null, jsdocParameter);
40
- }
41
- });
42
- if (numericOnlyVariation) {
43
- utils.forEachPreferredTag('variation', (jsdocParameter, targetTagName) => {
44
- const variation = /** @type {string} */utils.getTagDescription(jsdocParameter).trim();
45
- if (!variation) {
46
- report(`Missing JSDoc @${targetTagName} value.`, null, jsdocParameter);
47
- } else if (!Number.isInteger(Number(variation)) || Number(variation) <= 0) {
48
- report(`Invalid JSDoc @${targetTagName}: "${utils.getTagDescription(jsdocParameter)}".`, null, jsdocParameter);
49
- }
50
- });
51
- }
52
- utils.forEachPreferredTag('since', (jsdocParameter, targetTagName) => {
53
- const version = /** @type {string} */utils.getTagDescription(jsdocParameter).trim();
54
- if (!version) {
55
- report(`Missing JSDoc @${targetTagName} value.`, null, jsdocParameter);
56
- } else if (!_semver.default.valid(version)) {
57
- report(`Invalid JSDoc @${targetTagName}: "${utils.getTagDescription(jsdocParameter)}".`, null, jsdocParameter);
58
- }
59
- });
60
- utils.forEachPreferredTag('license', (jsdocParameter, targetTagName) => {
61
- const licenseRegex = utils.getRegexFromString(licensePattern, 'g');
62
- const matches = /** @type {string} */utils.getTagDescription(jsdocParameter).matchAll(licenseRegex);
63
- let positiveMatch = false;
64
- for (const match of matches) {
65
- const license = match[1] || match[0];
66
- if (license) {
67
- positiveMatch = true;
68
- }
69
- if (!license.trim()) {
70
- // Avoid reporting again as empty match
71
- if (positiveMatch) {
72
- return;
73
- }
74
- report(`Missing JSDoc @${targetTagName} value.`, null, jsdocParameter);
75
- } else if (allowedLicenses) {
76
- if (allowedLicenses !== true && !allowedLicenses.includes(license)) {
77
- report(`Invalid JSDoc @${targetTagName}: "${license}"; expected one of ${allowedLicenses.join(', ')}.`, null, jsdocParameter);
78
- }
79
- } else {
80
- try {
81
- (0, _spdxExpressionParse.default)(license);
82
- } catch {
83
- report(`Invalid JSDoc @${targetTagName}: "${license}"; expected SPDX expression: https://spdx.org/licenses/.`, null, jsdocParameter);
84
- }
85
- }
86
- }
87
- });
88
- if (settings.mode === 'typescript') {
89
- utils.forEachPreferredTag('import', tag => {
90
- const {
91
- description,
92
- name,
93
- type
94
- } = tag;
95
- const typePart = type ? `{${type}} ` : '';
96
- const imprt = 'import ' + (description ? `${typePart}${name} ${description}` : `${typePart}${name}`);
97
- const importsExports = (0, _parseImportsExports.parseImportsExports)(imprt.trim());
98
- if (importsExports.errors) {
99
- report('Bad @import tag', null, tag);
100
- }
101
- });
102
- }
103
- utils.forEachPreferredTag('author', (jsdocParameter, targetTagName) => {
104
- const author = /** @type {string} */utils.getTagDescription(jsdocParameter).trim();
105
- if (!author) {
106
- report(`Missing JSDoc @${targetTagName} value.`, null, jsdocParameter);
107
- } else if (allowedAuthors && !allowedAuthors.includes(author)) {
108
- report(`Invalid JSDoc @${targetTagName}: "${utils.getTagDescription(jsdocParameter)}"; expected one of ${allowedAuthors.join(', ')}.`, null, jsdocParameter);
109
- }
110
- });
111
- }, {
112
- iterateAllJsdocs: true,
113
- meta: {
114
- docs: {
115
- description: 'This rule checks the values for a handful of tags: `@version`, `@since`, `@license` and `@author`.',
116
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-values.md#repos-sticky-header'
117
- },
118
- schema: [{
119
- additionalProperties: false,
120
- properties: {
121
- allowedAuthors: {
122
- description: `An array of allowable author values. If absent, only non-whitespace will
123
- be checked for.`,
124
- items: {
125
- type: 'string'
126
- },
127
- type: 'array'
128
- },
129
- allowedLicenses: {
130
- anyOf: [{
131
- items: {
132
- type: 'string'
133
- },
134
- type: 'array'
135
- }, {
136
- type: 'boolean'
137
- }],
138
- description: `An array of allowable license values or \`true\` to allow any license text.
139
- If present as an array, will be used in place of [SPDX identifiers](https://spdx.org/licenses/).`
140
- },
141
- licensePattern: {
142
- description: `A string to be converted into a \`RegExp\` (with \`v\` flag) and whose first
143
- parenthetical grouping, if present, will match the portion of the license
144
- description to check (if no grouping is present, then the whole portion
145
- matched will be used). Defaults to \`/([^\\n\\r]*)/gv\`, i.e., the SPDX expression
146
- is expected before any line breaks.
147
-
148
- Note that the \`/\` delimiters are optional, but necessary to add flags.
149
-
150
- Defaults to using the \`v\` flag, so to add your own flags, encapsulate
151
- your expression as a string, but like a literal, e.g., \`/^mit$/vi\`.`,
152
- type: 'string'
153
- },
154
- numericOnlyVariation: {
155
- description: `Whether to enable validation that \`@variation\` must be a number. Defaults to
156
- \`false\`.`,
157
- type: 'boolean'
158
- }
159
- },
160
- type: 'object'
161
- }],
162
- type: 'suggestion'
163
- }
164
- });
165
- module.exports = exports.default;
166
- //# sourceMappingURL=checkValues.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkValues.cjs","names":["iterateJsdoc","semver","spdxExpressionParse","parseImportsExports"],"sources":["../../src/rules/checkValues.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parseImportsExports,\n} from 'parse-imports-exports';\nimport semver from 'semver';\nimport spdxExpressionParse from 'spdx-expression-parse';\n\nconst allowedKinds = new Set([\n 'class',\n 'constant',\n 'event',\n 'external',\n 'file',\n 'function',\n 'member',\n 'mixin',\n 'module',\n 'namespace',\n 'typedef',\n]);\n\nexport default iterateJsdoc(({\n context,\n report,\n settings,\n utils,\n}) => {\n const options = context.options[0] || {};\n const {\n allowedAuthors = null,\n allowedLicenses = null,\n licensePattern = '/([^\\n\\r]*)/gv',\n numericOnlyVariation = false,\n } = options;\n\n utils.forEachPreferredTag('version', (jsdocParameter, targetTagName) => {\n const version = /** @type {string} */ (\n utils.getTagDescription(jsdocParameter)\n ).trim();\n if (!version) {\n report(\n `Missing JSDoc @${targetTagName} value.`,\n null,\n jsdocParameter,\n );\n } else if (!semver.valid(version)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${utils.getTagDescription(jsdocParameter)}\".`,\n null,\n jsdocParameter,\n );\n }\n });\n\n utils.forEachPreferredTag('kind', (jsdocParameter, targetTagName) => {\n const kind = /** @type {string} */ (\n utils.getTagDescription(jsdocParameter)\n ).trim();\n if (!kind) {\n report(\n `Missing JSDoc @${targetTagName} value.`,\n null,\n jsdocParameter,\n );\n } else if (!allowedKinds.has(kind)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${utils.getTagDescription(jsdocParameter)}\"; ` +\n `must be one of: ${[\n ...allowedKinds,\n ].join(', ')}.`,\n null,\n jsdocParameter,\n );\n }\n });\n\n if (numericOnlyVariation) {\n utils.forEachPreferredTag('variation', (jsdocParameter, targetTagName) => {\n const variation = /** @type {string} */ (\n utils.getTagDescription(jsdocParameter)\n ).trim();\n if (!variation) {\n report(\n `Missing JSDoc @${targetTagName} value.`,\n null,\n jsdocParameter,\n );\n } else if (\n !Number.isInteger(Number(variation)) ||\n Number(variation) <= 0\n ) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${utils.getTagDescription(jsdocParameter)}\".`,\n null,\n jsdocParameter,\n );\n }\n });\n }\n\n utils.forEachPreferredTag('since', (jsdocParameter, targetTagName) => {\n const version = /** @type {string} */ (\n utils.getTagDescription(jsdocParameter)\n ).trim();\n if (!version) {\n report(\n `Missing JSDoc @${targetTagName} value.`,\n null,\n jsdocParameter,\n );\n } else if (!semver.valid(version)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${utils.getTagDescription(jsdocParameter)}\".`,\n null,\n jsdocParameter,\n );\n }\n });\n utils.forEachPreferredTag('license', (jsdocParameter, targetTagName) => {\n const licenseRegex = utils.getRegexFromString(licensePattern, 'g');\n const matches = /** @type {string} */ (\n utils.getTagDescription(jsdocParameter)\n ).matchAll(licenseRegex);\n let positiveMatch = false;\n for (const match of matches) {\n const license = match[1] || match[0];\n if (license) {\n positiveMatch = true;\n }\n\n if (!license.trim()) {\n // Avoid reporting again as empty match\n if (positiveMatch) {\n return;\n }\n\n report(\n `Missing JSDoc @${targetTagName} value.`,\n null,\n jsdocParameter,\n );\n } else if (allowedLicenses) {\n if (allowedLicenses !== true && !allowedLicenses.includes(license)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${license}\"; expected one of ${allowedLicenses.join(', ')}.`,\n null,\n jsdocParameter,\n );\n }\n } else {\n try {\n spdxExpressionParse(license);\n } catch {\n report(\n `Invalid JSDoc @${targetTagName}: \"${license}\"; expected SPDX expression: https://spdx.org/licenses/.`,\n null,\n jsdocParameter,\n );\n }\n }\n }\n });\n\n if (settings.mode === 'typescript') {\n utils.forEachPreferredTag('import', (tag) => {\n const {\n description,\n name,\n type,\n } = tag;\n const typePart = type ? `{${type}} ` : '';\n const imprt = 'import ' + (description ?\n `${typePart}${name} ${description}` :\n `${typePart}${name}`);\n\n const importsExports = parseImportsExports(imprt.trim());\n\n if (importsExports.errors) {\n report(\n 'Bad @import tag',\n null,\n tag,\n );\n }\n });\n }\n\n utils.forEachPreferredTag('author', (jsdocParameter, targetTagName) => {\n const author = /** @type {string} */ (\n utils.getTagDescription(jsdocParameter)\n ).trim();\n if (!author) {\n report(\n `Missing JSDoc @${targetTagName} value.`,\n null,\n jsdocParameter,\n );\n } else if (allowedAuthors && !allowedAuthors.includes(author)) {\n report(\n `Invalid JSDoc @${targetTagName}: \"${utils.getTagDescription(jsdocParameter)}\"; expected one of ${allowedAuthors.join(', ')}.`,\n null,\n jsdocParameter,\n );\n }\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'This rule checks the values for a handful of tags: `@version`, `@since`, `@license` and `@author`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-values.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedAuthors: {\n description: `An array of allowable author values. If absent, only non-whitespace will\nbe checked for.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n allowedLicenses: {\n anyOf: [\n {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n {\n type: 'boolean',\n },\n ],\n description: `An array of allowable license values or \\`true\\` to allow any license text.\nIf present as an array, will be used in place of [SPDX identifiers](https://spdx.org/licenses/).`,\n },\n licensePattern: {\n description: `A string to be converted into a \\`RegExp\\` (with \\`v\\` flag) and whose first\nparenthetical grouping, if present, will match the portion of the license\ndescription to check (if no grouping is present, then the whole portion\nmatched will be used). Defaults to \\`/([^\\\\n\\\\r]*)/gv\\`, i.e., the SPDX expression\nis expected before any line breaks.\n\nNote that the \\`/\\` delimiters are optional, but necessary to add flags.\n\nDefaults to using the \\`v\\` flag, so to add your own flags, encapsulate\nyour expression as a string, but like a literal, e.g., \\`/^mit$/vi\\`.`,\n type: 'string',\n },\n numericOnlyVariation: {\n description: `Whether to enable validation that \\`@variation\\` must be a number. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAGA;AACA;AAAwD;AAExD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAC3B,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,MAAM,EACN,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,WAAW,EACX,SAAS,CACV,CAAC;AAAC,iCAEY,IAAAA,qBAAY,EAAC,CAAC;EAC3B,OAAO;EACP,MAAM;EACN,QAAQ;EACR;AACF,CAAC,KAAK;EACJ,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EACxC,MAAM;IACJ,cAAc,GAAG,IAAI;IACrB,eAAe,GAAG,IAAI;IACtB,cAAc,GAAG,gBAAgB;IACjC,oBAAoB,GAAG;EACzB,CAAC,GAAG,OAAO;EAEX,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC,cAAc,EAAE,aAAa,KAAK;IACtE,MAAM,OAAO,GAAG,qBACd,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,CACvC,IAAI,CAAC,CAAC;IACR,IAAI,CAAC,OAAO,EAAE;MACZ,MAAM,CACJ,kBAAkB,aAAa,SAAS,EACxC,IAAI,EACJ,cACF,CAAC;IACH,CAAC,MAAM,IAAI,CAACC,eAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;MACjC,MAAM,CACJ,kBAAkB,aAAa,MAAM,KAAK,CAAC,iBAAiB,CAAC,cAAc,C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c,CAAC,sBAAsB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAC9H,IAAI,EACJ,cACF,CAAC;IACH;EACF,CAAC,CAAC;AACJ,CAAC,EAAE;EACD,gBAAgB,EAAE,IAAI;EACtB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,oGAAoG;MACjH,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,cAAc,EAAE;UACd,WAAW,EAAE;AACzB,gBAAgB;UACJ,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,eAAe,EAAE;UACf,KAAK,EAAE,CACL;YACE,KAAK,EAAE;cACL,IAAI,EAAE;YACR,CAAC;YACD,IAAI,EAAE;UACR,CAAC,EACD;YACE,IAAI,EAAE;UACR,CAAC,CACF;UACD,WAAW,EAAE;AACzB;QACU,CAAC;QACD,cAAc,EAAE;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE;UAC1D,IAAI,EAAE;QACR,CAAC;QACD,oBAAoB,EAAE;UACpB,WAAW,EAAE;AACzB,WAAW;UACC,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,356 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _iterateJsdoc = require("../iterateJsdoc.cjs");
8
- var _jsdocUtils = require("../jsdocUtils.cjs");
9
- var _jsdoccomment = require("@es-joy/jsdoccomment");
10
- /** @type {import('eslint').Rule.RuleModule} */
11
- var _default = exports.default = {
12
- create(context) {
13
- /**
14
- * @typedef {import('eslint').AST.Token | import('estree').Comment | {
15
- * type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang",
16
- * range: [number, number],
17
- * value: string
18
- * }} Token
19
- */
20
-
21
- /**
22
- * @callback AddComment
23
- * @param {boolean|undefined} inlineCommentBlock
24
- * @param {Token} comment
25
- * @param {string} indent
26
- * @param {number} lines
27
- * @param {import('eslint').Rule.RuleFixer} fixer
28
- */
29
-
30
- /* c8 ignore next -- Fallback to deprecated method */
31
- const {
32
- // @ts-expect-error ESLint < 10
33
- sourceCode = context.getSourceCode()
34
- } = context;
35
- const settings = (0, _iterateJsdoc.getSettings)(context);
36
- if (!settings) {
37
- return {};
38
- }
39
- const {
40
- allowedPrefixes = ['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-'],
41
- contexts = settings.contexts || [],
42
- contextsAfter = (/** @type {string[]} */[]),
43
- contextsBeforeAndAfter = ['VariableDeclarator', 'TSPropertySignature', 'PropertyDefinition'],
44
- enableFixer = true,
45
- enforceJsdocLineStyle = 'multi',
46
- lineOrBlockStyle = 'both'
47
- } = context.options[0] ?? {};
48
- let reportingNonJsdoc = false;
49
-
50
- /**
51
- * @param {string} messageId
52
- * @param {import('estree').Comment|Token} comment
53
- * @param {import('eslint').Rule.Node} node
54
- * @param {import('eslint').Rule.ReportFixer} fixer
55
- */
56
- const report = (messageId, comment, node, fixer) => {
57
- const loc = {
58
- end: {
59
- column: 0,
60
- /* c8 ignore next 2 -- Guard */
61
- // @ts-expect-error Ok
62
- line: comment.loc?.start?.line ?? 1
63
- },
64
- start: {
65
- column: 0,
66
- /* c8 ignore next 2 -- Guard */
67
- // @ts-expect-error Ok
68
- line: comment.loc?.start?.line ?? 1
69
- }
70
- };
71
- context.report({
72
- fix: enableFixer ? fixer : null,
73
- loc,
74
- messageId,
75
- node
76
- });
77
- };
78
-
79
- /**
80
- * @param {import('eslint').Rule.Node} node
81
- * @param {import('eslint').AST.Token | import('estree').Comment | {
82
- * type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang",
83
- * range: [number, number],
84
- * value: string
85
- * }} comment
86
- * @param {AddComment} addComment
87
- * @param {import('../iterateJsdoc.js').Context[]} ctxts
88
- */
89
- const getFixer = (node, comment, addComment, ctxts) => {
90
- return /** @type {import('eslint').Rule.ReportFixer} */fixer => {
91
- // Default to one line break if the `minLines`/`maxLines` settings allow
92
- const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;
93
- let baseNode =
94
- /**
95
- * @type {import('@typescript-eslint/types').TSESTree.Node|import('eslint').Rule.Node}
96
- */
97
- (0, _jsdoccomment.getReducedASTNode)(node, sourceCode);
98
- const decorator = (0, _jsdoccomment.getDecorator)(/** @type {import('eslint').Rule.Node} */
99
- baseNode);
100
- if (decorator) {
101
- baseNode = /** @type {import('@typescript-eslint/types').TSESTree.Decorator} */
102
- decorator;
103
- }
104
- const indent = (0, _jsdocUtils.getIndent)({
105
- text: sourceCode.getText(/** @type {import('eslint').Rule.Node} */baseNode, /** @type {import('eslint').AST.SourceLocation} */
106
- (/** @type {import('eslint').Rule.Node} */baseNode.loc).start.column)
107
- });
108
- const {
109
- inlineCommentBlock
110
- } =
111
- /**
112
- * @type {{
113
- * context: string,
114
- * inlineCommentBlock: boolean,
115
- * minLineCount: import('../iterateJsdoc.js').Integer
116
- * }[]}
117
- */
118
- ctxts.find(contxt => {
119
- if (typeof contxt === 'string') {
120
- return false;
121
- }
122
- const {
123
- context: ctxt
124
- } = contxt;
125
- return ctxt === node.type;
126
- }) || {};
127
- return addComment(inlineCommentBlock, comment, indent, lines, fixer);
128
- };
129
- };
130
-
131
- /**
132
- * @param {import('eslint').AST.Token | import('estree').Comment | {
133
- * type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang",
134
- * range: [number, number],
135
- * value: string
136
- * }} comment
137
- * @param {import('eslint').Rule.Node} node
138
- * @param {AddComment} addComment
139
- * @param {import('../iterateJsdoc.js').Context[]} ctxts
140
- */
141
- const reportings = (comment, node, addComment, ctxts) => {
142
- const fixer = getFixer(node, comment, addComment, ctxts);
143
- if (comment.type === 'Block') {
144
- if (lineOrBlockStyle === 'line') {
145
- return;
146
- }
147
- report('blockCommentsJsdocStyle', comment, node, fixer);
148
- return;
149
- }
150
- if (comment.type === 'Line') {
151
- if (lineOrBlockStyle === 'block') {
152
- return;
153
- }
154
- report('lineCommentsJsdocStyle', comment, node, fixer);
155
- }
156
- };
157
-
158
- /**
159
- * @type {import('../iterateJsdoc.js').CheckJsdoc}
160
- */
161
- const checkNonJsdoc = (_info, _handler, node) => {
162
- const comment = (0, _jsdoccomment.getNonJsdocComment)(sourceCode, node, settings);
163
- if (!comment || /** @type {string[]} */
164
- allowedPrefixes.some(prefix => {
165
- return comment.value.trimStart().startsWith(prefix);
166
- })) {
167
- return;
168
- }
169
- reportingNonJsdoc = true;
170
-
171
- /** @type {AddComment} */
172
- const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {
173
- const insertion = (inlineCommentBlock || enforceJsdocLineStyle === 'single' ? `/** ${commentToAdd.value.trim()} ` : `/**\n${indent}*${commentToAdd.value.trimEnd()}\n${indent}`) + `*/${'\n'.repeat((lines || 1) - 1)}`;
174
- return fixer.replaceText(/** @type {import('eslint').AST.Token} */
175
- commentToAdd, insertion);
176
- };
177
- reportings(comment, node, addComment, contexts);
178
- };
179
-
180
- /**
181
- * @param {import('eslint').Rule.Node} node
182
- * @param {import('../iterateJsdoc.js').Context[]} ctxts
183
- */
184
- const checkNonJsdocAfter = (node, ctxts) => {
185
- const comment = (0, _jsdoccomment.getFollowingComment)(sourceCode, node);
186
- if (!comment || comment.value.startsWith('*') || /** @type {string[]} */
187
- allowedPrefixes.some(prefix => {
188
- return comment.value.trimStart().startsWith(prefix);
189
- })) {
190
- return;
191
- }
192
-
193
- /** @type {AddComment} */
194
- const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {
195
- const insertion = (inlineCommentBlock || enforceJsdocLineStyle === 'single' ? `/** ${commentToAdd.value.trim()} ` : `/**\n${indent}*${commentToAdd.value.trimEnd()}\n${indent}`) + `*/${'\n'.repeat((lines || 1) - 1)}${lines ? `\n${indent.slice(1)}` : ' '}`;
196
- return [fixer.remove(/** @type {import('eslint').AST.Token} */
197
- commentToAdd), fixer.insertTextBefore(node.type === 'VariableDeclarator' ? node.parent : node, insertion)];
198
- };
199
- reportings(comment, node, addComment, ctxts);
200
- };
201
-
202
- // Todo: add contexts to check after (and handle if want both before and after)
203
- return {
204
- ...(0, _jsdocUtils.getContextObject)((0, _jsdocUtils.enforcedContexts)(context, true, settings), checkNonJsdoc),
205
- ...(0, _jsdocUtils.getContextObject)(contextsAfter, (_info, _handler, node) => {
206
- checkNonJsdocAfter(node, contextsAfter);
207
- }),
208
- ...(0, _jsdocUtils.getContextObject)(contextsBeforeAndAfter, (_info, _handler, node) => {
209
- checkNonJsdoc({}, null, node);
210
- if (!reportingNonJsdoc) {
211
- checkNonJsdocAfter(node, contextsBeforeAndAfter);
212
- }
213
- })
214
- };
215
- },
216
- meta: {
217
- docs: {
218
- description: 'Converts non-JSDoc comments preceding or following nodes into JSDoc ones',
219
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/convert-to-jsdoc-comments.md#repos-sticky-header'
220
- },
221
- fixable: 'code',
222
- messages: {
223
- blockCommentsJsdocStyle: 'Block comments should be JSDoc-style.',
224
- lineCommentsJsdocStyle: 'Line comments should be JSDoc-style.'
225
- },
226
- schema: [{
227
- additionalProperties: false,
228
- properties: {
229
- allowedPrefixes: {
230
- description: `An array of prefixes to allow at the beginning of a comment.
231
-
232
- Defaults to \`['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\`.
233
-
234
- Supplying your own value overrides the defaults.`,
235
- items: {
236
- type: 'string'
237
- },
238
- type: 'array'
239
- },
240
- contexts: {
241
- description: `The contexts array which will be checked for preceding content.
242
-
243
- Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
244
-
245
- Defaults to \`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
246
- \`FunctionExpression\`, \`TSDeclareFunction\`.`,
247
- items: {
248
- anyOf: [{
249
- type: 'string'
250
- }, {
251
- additionalProperties: false,
252
- properties: {
253
- context: {
254
- type: 'string'
255
- },
256
- inlineCommentBlock: {
257
- type: 'boolean'
258
- }
259
- },
260
- type: 'object'
261
- }]
262
- },
263
- type: 'array'
264
- },
265
- contextsAfter: {
266
- description: `The contexts array which will be checked for content on the same line after.
267
-
268
- Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
269
-
270
- Defaults to an empty array.`,
271
- items: {
272
- anyOf: [{
273
- type: 'string'
274
- }, {
275
- additionalProperties: false,
276
- properties: {
277
- context: {
278
- type: 'string'
279
- },
280
- inlineCommentBlock: {
281
- type: 'boolean'
282
- }
283
- },
284
- type: 'object'
285
- }]
286
- },
287
- type: 'array'
288
- },
289
- contextsBeforeAndAfter: {
290
- description: `The contexts array which will be checked for content before and on the same
291
- line after.
292
-
293
- Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
294
-
295
- Defaults to \`VariableDeclarator\`, \`TSPropertySignature\`, \`PropertyDefinition\`.`,
296
- items: {
297
- anyOf: [{
298
- type: 'string'
299
- }, {
300
- additionalProperties: false,
301
- properties: {
302
- context: {
303
- type: 'string'
304
- },
305
- inlineCommentBlock: {
306
- type: 'boolean'
307
- }
308
- },
309
- type: 'object'
310
- }]
311
- },
312
- type: 'array'
313
- },
314
- enableFixer: {
315
- description: 'Set to `false` to disable fixing.',
316
- type: 'boolean'
317
- },
318
- enforceJsdocLineStyle: {
319
- description: `What policy to enforce on the conversion of non-JSDoc comments without
320
- line breaks. (Non-JSDoc (mulitline) comments with line breaks will always
321
- be converted to \`multi\` style JSDoc comments.)
322
-
323
- - \`multi\` - Convert to multi-line style
324
- \`\`\`js
325
- /**
326
- * Some text
327
- */
328
- \`\`\`
329
- - \`single\` - Convert to single-line style
330
- \`\`\`js
331
- /** Some text */
332
- \`\`\`
333
-
334
- Defaults to \`multi\`.`,
335
- enum: ['multi', 'single'],
336
- type: 'string'
337
- },
338
- lineOrBlockStyle: {
339
- description: `What style of comments to which to apply JSDoc conversion.
340
-
341
- - \`block\` - Applies to block-style comments (\`/* ... */\`)
342
- - \`line\` - Applies to line-style comments (\`// ...\`)
343
- - \`both\` - Applies to both block and line-style comments
344
-
345
- Defaults to \`both\`.`,
346
- enum: ['block', 'line', 'both'],
347
- type: 'string'
348
- }
349
- },
350
- type: 'object'
351
- }],
352
- type: 'suggestion'
353
- }
354
- };
355
- module.exports = exports.default;
356
- //# sourceMappingURL=convertToJsdocComments.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convertToJsdocComments.cjs","names":["getSettings","getReducedASTNode","getDecorator","getIndent","getNonJsdocComment","getFollowingComment","getContextObject","enforcedContexts"],"sources":["../../src/rules/convertToJsdocComments.js"],"sourcesContent":["import {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n getContextObject,\n getIndent,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getFollowingComment,\n getNonJsdocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /**\n * @typedef {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} Token\n */\n\n /**\n * @callback AddComment\n * @param {boolean|undefined} inlineCommentBlock\n * @param {Token} comment\n * @param {string} indent\n * @param {number} lines\n * @param {import('eslint').Rule.RuleFixer} fixer\n */\n\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n // @ts-expect-error ESLint < 10\n sourceCode = context.getSourceCode(),\n } = context;\n const settings = getSettings(context);\n if (!settings) {\n return {};\n }\n\n const {\n allowedPrefixes = [\n '@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-',\n ],\n contexts = settings.contexts || [],\n contextsAfter = /** @type {string[]} */ ([]),\n contextsBeforeAndAfter = [\n 'VariableDeclarator', 'TSPropertySignature', 'PropertyDefinition',\n ],\n enableFixer = true,\n enforceJsdocLineStyle = 'multi',\n lineOrBlockStyle = 'both',\n } = context.options[0] ?? {};\n\n let reportingNonJsdoc = false;\n\n /**\n * @param {string} messageId\n * @param {import('estree').Comment|Token} comment\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').Rule.ReportFixer} fixer\n */\n const report = (messageId, comment, node, fixer) => {\n const loc = {\n end: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n start: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n };\n\n context.report({\n fix: enableFixer ? fixer : null,\n loc,\n messageId,\n node,\n });\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const getFixer = (node, comment, addComment, ctxts) => {\n return /** @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 let baseNode =\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Node|import('eslint').Rule.Node}\n */ (\n getReducedASTNode(node, sourceCode)\n );\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n );\n if (decorator) {\n baseNode = /** @type {import('@typescript-eslint/types').TSESTree.Decorator} */ (\n decorator\n );\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 */ (ctxts).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\n return addComment(inlineCommentBlock, comment, indent, lines, fixer);\n };\n };\n\n /**\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {import('eslint').Rule.Node} node\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const reportings = (comment, node, addComment, ctxts) => {\n const fixer = getFixer(node, comment, addComment, ctxts);\n\n if (comment.type === 'Block') {\n if (lineOrBlockStyle === 'line') {\n return;\n }\n\n report('blockCommentsJsdocStyle', comment, node, fixer);\n return;\n }\n\n if (comment.type === 'Line') {\n if (lineOrBlockStyle === 'block') {\n return;\n }\n\n report('lineCommentsJsdocStyle', comment, node, fixer);\n }\n };\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkNonJsdoc = (_info, _handler, node) => {\n const comment = getNonJsdocComment(sourceCode, node, settings);\n\n if (\n !comment ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n reportingNonJsdoc = true;\n\n /** @type {AddComment} */\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}`;\n\n return fixer.replaceText(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n insertion,\n );\n };\n\n reportings(comment, node, addComment, contexts);\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const checkNonJsdocAfter = (node, ctxts) => {\n const comment = getFollowingComment(sourceCode, node);\n\n if (\n !comment ||\n comment.value.startsWith('*') ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n /** @type {AddComment} */\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}${lines ? `\\n${indent.slice(1)}` : ' '}`;\n\n return [\n fixer.remove(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n ), fixer.insertTextBefore(\n node.type === 'VariableDeclarator' ? node.parent : node,\n insertion,\n ),\n ];\n };\n\n reportings(comment, node, addComment, ctxts);\n };\n\n // Todo: add contexts to check after (and handle if want both before and after)\n return {\n ...getContextObject(\n enforcedContexts(context, true, settings),\n checkNonJsdoc,\n ),\n ...getContextObject(\n contextsAfter,\n (_info, _handler, node) => {\n checkNonJsdocAfter(node, contextsAfter);\n },\n ),\n ...getContextObject(\n contextsBeforeAndAfter,\n (_info, _handler, node) => {\n checkNonJsdoc({}, null, node);\n if (!reportingNonJsdoc) {\n checkNonJsdocAfter(node, contextsBeforeAndAfter);\n }\n },\n ),\n };\n },\n meta: {\n docs: {\n description: 'Converts non-JSDoc comments preceding or following nodes into JSDoc ones',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/convert-to-jsdoc-comments.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n blockCommentsJsdocStyle: 'Block comments should be JSDoc-style.',\n lineCommentsJsdocStyle: 'Line comments should be JSDoc-style.',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedPrefixes: {\n description: `An array of prefixes to allow at the beginning of a comment.\n\nDefaults to \\`['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\\`.\n\nSupplying your own value overrides the defaults.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n contexts: {\n description: `The contexts array which will be checked for preceding content.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to \\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`, \\`TSDeclareFunction\\`.`,\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsAfter: {\n description: `The contexts array which will be checked for content on the same line after.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to an empty array.`,\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsBeforeAndAfter: {\n description: `The contexts array which will be checked for content before and on the same\nline after.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to \\`VariableDeclarator\\`, \\`TSPropertySignature\\`, \\`PropertyDefinition\\`.`,\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Set to `false` to disable fixing.',\n type: 'boolean',\n },\n enforceJsdocLineStyle: {\n description: `What policy to enforce on the conversion of non-JSDoc comments without\nline breaks. (Non-JSDoc (mulitline) comments with line breaks will always\nbe converted to \\`multi\\` style JSDoc comments.)\n\n- \\`multi\\` - Convert to multi-line style\n\\`\\`\\`js\n/**\n * Some text\n */\n\\`\\`\\`\n- \\`single\\` - Convert to single-line style\n\\`\\`\\`js\n/** Some text */\n\\`\\`\\`\n\nDefaults to \\`multi\\`.`,\n enum: [\n 'multi', 'single',\n ],\n type: 'string',\n },\n lineOrBlockStyle: {\n description: `What style of comments to which to apply JSDoc conversion.\n\n- \\`block\\` - Applies to block-style comments (\\`/* ... */\\`)\n- \\`line\\` - Applies to line-style comments (\\`// ...\\`)\n- \\`both\\` - Applies to both block and line-style comments\n\nDefaults to \\`both\\`.`,\n enum: [\n 'block', 'line', 'both',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA;AAGA;AAKA;AAOA;AAAA,iCACe;EACb,MAAM,CAAE,OAAO,EAAE;IACf;AACJ;AACA;AACA;AACA;AACA;AACA;;IAEI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;IAEI;IACA,MAAM;MACJ;MACA,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IACrC,CAAC,GAAG,OAAO;IACX,MAAM,QAAQ,GAAG,IAAAA,cAAA,WAAW,EAAC,OAAO,CAAC;IACrC,IAAI,CAAC,QAAQ,EAAE;MACb,OAAO,CAAC,CAAC;IACX;IAEA,MAAM;MACJ,eAAe,GAAG,CAChB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CACzD;MACD,QAAQ,GAAG,QAAQ,CAAC,QAAQ,IAAI,EAAE;MAClC,aAAa,IAAG,uBAAyB,EAAE,CAAC;MAC5C,sBAAsB,GAAG,CACvB,oBAAoB,EAAE,qBAAqB,EAAE,oBAAoB,CAClE;MACD,WAAW,GAAG,IA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