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,431 +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
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /**
10
- * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
11
- * @param {import('../iterateJsdoc.js').Utils} utils
12
- * @param {number} requireSingleLineUnderCount
13
- */
14
- const checkForShortTags = (jsdoc, utils, requireSingleLineUnderCount) => {
15
- if (!requireSingleLineUnderCount || !jsdoc.tags.length) {
16
- return false;
17
- }
18
- let lastLineWithTag = 0;
19
- let isUnderCountLimit = false;
20
- let hasMultiDescOrType = false;
21
- const tagLines = jsdoc.source.reduce((acc, {
22
- tokens: {
23
- delimiter,
24
- description: desc,
25
- name,
26
- postDelimiter,
27
- postName,
28
- postTag,
29
- postType,
30
- start,
31
- tag,
32
- type
33
- }
34
- }, idx) => {
35
- if (tag.length) {
36
- lastLineWithTag = idx;
37
- if (start.length + delimiter.length + postDelimiter.length + type.length + postType.length + name.length + postName.length + tag.length + postTag.length + desc.length < requireSingleLineUnderCount) {
38
- isUnderCountLimit = true;
39
- }
40
- return acc + 1;
41
- } else if (desc.length || type.length) {
42
- hasMultiDescOrType = true;
43
- return acc;
44
- }
45
- return acc;
46
- }, 0);
47
- // Could be tagLines > 1
48
- if (!hasMultiDescOrType && isUnderCountLimit && tagLines === 1) {
49
- const fixer = () => {
50
- const tokens = jsdoc.source[lastLineWithTag].tokens;
51
- jsdoc.source = [{
52
- number: 0,
53
- source: '',
54
- tokens: utils.seedTokens({
55
- delimiter: '/**',
56
- description: tokens.description.trimEnd() + ' ',
57
- end: '*/',
58
- name: tokens.name,
59
- postDelimiter: ' ',
60
- postName: tokens.postName,
61
- postTag: tokens.postTag,
62
- postType: tokens.postType,
63
- start: jsdoc.source[0].tokens.start,
64
- tag: tokens.tag,
65
- type: tokens.type
66
- })
67
- }];
68
- };
69
- utils.reportJSDoc('Description is too short to be multi-line.', null, fixer);
70
- return true;
71
- }
72
- return false;
73
- };
74
-
75
- /**
76
- * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
77
- * @param {import('../iterateJsdoc.js').Utils} utils
78
- * @param {number} requireSingleLineUnderCount
79
- */
80
- const checkForShortDescriptions = (jsdoc, utils, requireSingleLineUnderCount) => {
81
- if (!requireSingleLineUnderCount || jsdoc.tags.length) {
82
- return false;
83
- }
84
- let lastLineWithDesc = 0;
85
- let isUnderCountLimit = false;
86
- const descLines = jsdoc.source.reduce((acc, {
87
- tokens: {
88
- delimiter,
89
- description: desc,
90
- postDelimiter,
91
- start
92
- }
93
- }, idx) => {
94
- if (desc.length) {
95
- lastLineWithDesc = idx;
96
- if (start.length + delimiter.length + postDelimiter.length + desc.length < requireSingleLineUnderCount) {
97
- isUnderCountLimit = true;
98
- }
99
- return acc + 1;
100
- }
101
- return acc;
102
- }, 0);
103
- // Could be descLines > 1
104
- if (isUnderCountLimit && descLines === 1) {
105
- const fixer = () => {
106
- const desc = jsdoc.source[lastLineWithDesc].tokens.description;
107
- jsdoc.source = [{
108
- number: 0,
109
- source: '',
110
- tokens: utils.seedTokens({
111
- delimiter: '/**',
112
- description: desc.trimEnd() + ' ',
113
- end: '*/',
114
- postDelimiter: ' ',
115
- start: jsdoc.source[0].tokens.start
116
- })
117
- }];
118
- };
119
- utils.reportJSDoc('Description is too short to be multi-line.', null, fixer);
120
- return true;
121
- }
122
- return false;
123
- };
124
- var _default = exports.default = (0, _iterateJsdoc.default)(({
125
- context,
126
- jsdoc,
127
- utils
128
- }) => {
129
- const {
130
- allowMultipleTags = true,
131
- minimumLengthForMultiline = Number.POSITIVE_INFINITY,
132
- multilineTags = ['*'],
133
- noFinalLineText = true,
134
- noMultilineBlocks = false,
135
- noSingleLineBlocks = false,
136
- noZeroLineText = true,
137
- requireSingleLineUnderCount = null,
138
- singleLineTags = ['lends', 'type']
139
- } = context.options[0] || {};
140
- const {
141
- source: [{
142
- tokens
143
- }]
144
- } = jsdoc;
145
- const {
146
- description,
147
- tag
148
- } = tokens;
149
- const sourceLength = jsdoc.source.length;
150
-
151
- /**
152
- * @param {string} tagName
153
- * @returns {boolean}
154
- */
155
- const isInvalidSingleLine = tagName => {
156
- return noSingleLineBlocks && (!tagName || !singleLineTags.includes(tagName) && !singleLineTags.includes('*'));
157
- };
158
- if (sourceLength === 1) {
159
- if (!isInvalidSingleLine(tag.slice(1))) {
160
- return;
161
- }
162
- const fixer = () => {
163
- utils.makeMultiline();
164
- };
165
- utils.reportJSDoc('Single line blocks are not permitted by your configuration.', null, fixer, true);
166
- return;
167
- }
168
- if (checkForShortDescriptions(jsdoc, utils, requireSingleLineUnderCount)) {
169
- return;
170
- }
171
- if (checkForShortTags(jsdoc, utils, requireSingleLineUnderCount)) {
172
- return;
173
- }
174
- const lineChecks = () => {
175
- if (noZeroLineText && (tag || description)) {
176
- const fixer = () => {
177
- const line = {
178
- ...tokens
179
- };
180
- utils.emptyTokens(tokens);
181
- const {
182
- tokens: {
183
- delimiter,
184
- start
185
- }
186
- } = jsdoc.source[1];
187
- utils.addLine(1, {
188
- ...line,
189
- delimiter,
190
- start
191
- });
192
- };
193
- utils.reportJSDoc('Should have no text on the "0th" line (after the `/**`).', null, fixer);
194
- return;
195
- }
196
- const finalLine = jsdoc.source[jsdoc.source.length - 1];
197
- const finalLineTokens = finalLine.tokens;
198
- if (noFinalLineText && finalLineTokens.description.trim()) {
199
- const fixer = () => {
200
- const line = {
201
- ...finalLineTokens
202
- };
203
- line.description = line.description.trimEnd();
204
- const {
205
- delimiter
206
- } = line;
207
- for (const prop of ['delimiter', 'postDelimiter', 'tag', 'type', 'lineEnd', 'postType', 'postTag', 'name', 'postName', 'description']) {
208
- finalLineTokens[(
209
- /**
210
- * @type {"delimiter"|"postDelimiter"|"tag"|"type"|
211
- * "lineEnd"|"postType"|"postTag"|"name"|
212
- * "postName"|"description"}
213
- */
214
- prop)] = '';
215
- }
216
- utils.addLine(jsdoc.source.length - 1, {
217
- ...line,
218
- delimiter,
219
- end: ''
220
- });
221
- };
222
- utils.reportJSDoc('Should have no text on the final line (before the `*/`).', null, fixer);
223
- }
224
- };
225
- if (noMultilineBlocks) {
226
- if (jsdoc.tags.length && (multilineTags.includes('*') || utils.hasATag(multilineTags))) {
227
- lineChecks();
228
- return;
229
- }
230
- if (jsdoc.description.length >= minimumLengthForMultiline) {
231
- lineChecks();
232
- return;
233
- }
234
- if (noSingleLineBlocks && (!jsdoc.tags.length || !utils.filterTags(({
235
- tag: tg
236
- }) => {
237
- return !isInvalidSingleLine(tg);
238
- }).length)) {
239
- utils.reportJSDoc('Multiline JSDoc blocks are prohibited by ' + 'your configuration but fixing would result in a single ' + 'line block which you have prohibited with `noSingleLineBlocks`.');
240
- return;
241
- }
242
- if (jsdoc.tags.length > 1) {
243
- if (!allowMultipleTags) {
244
- utils.reportJSDoc('Multiline JSDoc blocks are prohibited by ' + 'your configuration but the block has multiple tags.');
245
- return;
246
- }
247
- } else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {
248
- if (!allowMultipleTags) {
249
- utils.reportJSDoc('Multiline JSDoc blocks are prohibited by ' + 'your configuration but the block has a description with a tag.');
250
- return;
251
- }
252
- } else {
253
- const fixer = () => {
254
- jsdoc.source = [{
255
- number: 1,
256
- source: '',
257
- tokens: jsdoc.source.reduce((obj, {
258
- tokens: {
259
- description: desc,
260
- lineEnd,
261
- name: nme,
262
- postName,
263
- postTag,
264
- postType,
265
- tag: tg,
266
- type: typ
267
- }
268
- }) => {
269
- if (typ) {
270
- obj.type = typ;
271
- }
272
- if (tg && typ && nme) {
273
- obj.postType = postType;
274
- }
275
- if (nme) {
276
- obj.name += nme;
277
- }
278
- if (nme && desc) {
279
- obj.postName = postName;
280
- }
281
- obj.description += desc;
282
- const nameOrDescription = obj.description || obj.name;
283
- if (nameOrDescription && nameOrDescription.slice(-1) !== ' ') {
284
- obj.description += ' ';
285
- }
286
- obj.lineEnd = lineEnd;
287
-
288
- // Already filtered for multiple tags
289
- obj.tag += tg;
290
- if (tg) {
291
- obj.postTag = postTag || ' ';
292
- }
293
- return obj;
294
- }, utils.seedTokens({
295
- delimiter: '/**',
296
- end: '*/',
297
- postDelimiter: ' '
298
- }))
299
- }];
300
- };
301
- utils.reportJSDoc('Multiline JSDoc blocks are prohibited by ' + 'your configuration.', null, fixer);
302
- return;
303
- }
304
- }
305
- lineChecks();
306
- }, {
307
- iterateAllJsdocs: true,
308
- meta: {
309
- docs: {
310
- description: 'Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks.',
311
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header'
312
- },
313
- fixable: 'code',
314
- schema: [{
315
- additionalProperties: false,
316
- properties: {
317
- allowMultipleTags: {
318
- description: `If \`noMultilineBlocks\` is set to \`true\` with this option and multiple tags are
319
- found in a block, an error will not be reported.
320
-
321
- Since multiple-tagged lines cannot be collapsed into a single line, this option
322
- prevents them from being reported. Set to \`false\` if you really want to report
323
- any blocks.
324
-
325
- This option will also be applied when there is a block description and a single
326
- tag (since a description cannot precede a tag on a single line, and also
327
- cannot be reliably added after the tag either).
328
-
329
- Defaults to \`true\`.`,
330
- type: 'boolean'
331
- },
332
- minimumLengthForMultiline: {
333
- description: `If \`noMultilineBlocks\` is set with this numeric option, multiline blocks will
334
- be permitted if containing at least the given amount of text.
335
-
336
- If not set, multiline blocks will not be permitted regardless of length unless
337
- a relevant tag is present and \`multilineTags\` is set.
338
-
339
- Defaults to not being in effect.`,
340
- type: 'integer'
341
- },
342
- multilineTags: {
343
- anyOf: [{
344
- enum: ['*'],
345
- type: 'string'
346
- }, {
347
- items: {
348
- type: 'string'
349
- },
350
- type: 'array'
351
- }],
352
- description: `If \`noMultilineBlocks\` is set with this option, multiline blocks may be allowed
353
- regardless of length as long as a tag or a tag of a certain type is present.
354
-
355
- If \`*\` is included in the array, the presence of a tags will allow for
356
- multiline blocks (but not when without any tags unless the amount of text is
357
- over an amount specified by \`minimumLengthForMultiline\`).
358
-
359
- If the array does not include \`*\` but lists certain tags, the presence of
360
- such a tag will cause multiline blocks to be allowed.
361
-
362
- You may set this to an empty array to prevent any tag from permitting multiple
363
- lines.
364
-
365
- Defaults to \`['*']\`.`
366
- },
367
- noFinalLineText: {
368
- description: `For multiline blocks, any non-whitespace text preceding the \`*/\` on the final
369
- line will be reported. (Text preceding a newline is not reported.)
370
-
371
- \`noMultilineBlocks\` will have priority over this rule if it applies.
372
-
373
- Defaults to \`true\`.`,
374
- type: 'boolean'
375
- },
376
- noMultilineBlocks: {
377
- description: `Requires that JSDoc blocks are restricted to single lines only unless impacted
378
- by the options \`minimumLengthForMultiline\`, \`multilineTags\`, or
379
- \`allowMultipleTags\`.
380
-
381
- Defaults to \`false\`.`,
382
- type: 'boolean'
383
- },
384
- noSingleLineBlocks: {
385
- description: `If this is \`true\`, any single line blocks will be reported, except those which
386
- are whitelisted in \`singleLineTags\`.
387
-
388
- Defaults to \`false\`.`,
389
- type: 'boolean'
390
- },
391
- noZeroLineText: {
392
- description: `For multiline blocks, any non-whitespace text immediately after the \`/**\` and
393
- space will be reported. (Text after a newline is not reported.)
394
-
395
- \`noMultilineBlocks\` will have priority over this rule if it applies.
396
-
397
- Defaults to \`true\`.`,
398
- type: 'boolean'
399
- },
400
- requireSingleLineUnderCount: {
401
- description: `If this number is set, it indicates a minimum line width for a single line of
402
- JSDoc content spread over a multi-line comment block. If a single line is under
403
- the minimum length, it will be reported so as to enforce single line JSDoc blocks
404
- for such cases. Blocks are not reported which have multi-line descriptions,
405
- multiple tags, a block description and tag, or tags with multi-line types or
406
- descriptions.
407
-
408
- Defaults to \`null\`.`,
409
- type: 'number'
410
- },
411
- singleLineTags: {
412
- description: `An array of tags which can nevertheless be allowed as single line blocks when
413
- \`noSingleLineBlocks\` is set. You may set this to a empty array to
414
- cause all single line blocks to be reported. If \`'*'\` is present, then
415
- the presence of a tag will allow single line blocks (but not if a tag is
416
- missing).
417
-
418
- Defaults to \`['lends', 'type']\`.`,
419
- items: {
420
- type: 'string'
421
- },
422
- type: 'array'
423
- }
424
- },
425
- type: 'object'
426
- }],
427
- type: 'suggestion'
428
- }
429
- });
430
- module.exports = exports.default;
431
- //# sourceMappingURL=multilineBlocks.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multilineBlocks.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/multilineBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {number} requireSingleLineUnderCount\n */\nconst checkForShortTags = (jsdoc, utils, requireSingleLineUnderCount) => {\n if (!requireSingleLineUnderCount || !jsdoc.tags.length) {\n return false;\n }\n\n let lastLineWithTag = 0;\n let isUnderCountLimit = false;\n let hasMultiDescOrType = false;\n const tagLines = jsdoc.source.reduce((acc, {\n tokens: {\n delimiter,\n description: desc,\n name,\n postDelimiter,\n postName,\n postTag,\n postType,\n start,\n tag,\n type,\n },\n }, idx) => {\n if (tag.length) {\n lastLineWithTag = idx;\n if (\n start.length + delimiter.length + postDelimiter.length +\n type.length + postType.length + name.length + postName.length +\n tag.length + postTag.length + desc.length <\n requireSingleLineUnderCount\n ) {\n isUnderCountLimit = true;\n }\n\n return acc + 1;\n } else if (desc.length || type.length) {\n hasMultiDescOrType = true;\n return acc;\n }\n\n return acc;\n }, 0);\n // Could be tagLines > 1\n if (!hasMultiDescOrType && isUnderCountLimit && tagLines === 1) {\n const fixer = () => {\n const tokens = jsdoc.source[lastLineWithTag].tokens;\n jsdoc.source = [\n {\n number: 0,\n source: '',\n tokens: utils.seedTokens({\n delimiter: '/**',\n description: tokens.description.trimEnd() + ' ',\n end: '*/',\n name: tokens.name,\n postDelimiter: ' ',\n postName: tokens.postName,\n postTag: tokens.postTag,\n postType: tokens.postType,\n start: jsdoc.source[0].tokens.start,\n tag: tokens.tag,\n type: tokens.type,\n }),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Description is too short to be multi-line.',\n null,\n fixer,\n );\n return true;\n }\n\n return false;\n};\n\n/**\n * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {number} requireSingleLineUnderCount\n */\nconst checkForShortDescriptions = (jsdoc, utils, requireSingleLineUnderCount) => {\n if (!requireSingleLineUnderCount || jsdoc.tags.length) {\n return false;\n }\n\n let lastLineWithDesc = 0;\n let isUnderCountLimit = false;\n const descLines = jsdoc.source.reduce((acc, {\n tokens: {\n delimiter,\n description: desc,\n postDelimiter,\n start,\n },\n }, idx) => {\n if (desc.length) {\n lastLineWithDesc = idx;\n if (\n start.length + delimiter.length + postDelimiter.length + desc.length <\n requireSingleLineUnderCount\n ) {\n isUnderCountLimit = true;\n }\n\n return acc + 1;\n }\n\n return acc;\n }, 0);\n // Could be descLines > 1\n if (isUnderCountLimit && descLines === 1) {\n const fixer = () => {\n const desc = jsdoc.source[lastLineWithDesc].tokens.description;\n jsdoc.source = [\n {\n number: 0,\n source: '',\n tokens: utils.seedTokens({\n delimiter: '/**',\n description: desc.trimEnd() + ' ',\n end: '*/',\n postDelimiter: ' ',\n start: jsdoc.source[0].tokens.start,\n }),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Description is too short to be multi-line.',\n null,\n fixer,\n );\n return true;\n }\n\n return false;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n allowMultipleTags = true,\n minimumLengthForMultiline = Number.POSITIVE_INFINITY,\n multilineTags = [\n '*',\n ],\n noFinalLineText = true,\n noMultilineBlocks = false,\n noSingleLineBlocks = false,\n noZeroLineText = true,\n requireSingleLineUnderCount = null,\n singleLineTags = [\n 'lends', 'type',\n ],\n } = context.options[0] || {};\n\n const {\n source: [\n {\n tokens,\n },\n ],\n } = jsdoc;\n const {\n description,\n tag,\n } = tokens;\n const sourceLength = jsdoc.source.length;\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const isInvalidSingleLine = (tagName) => {\n return noSingleLineBlocks &&\n (!tagName ||\n !singleLineTags.includes(tagName) && !singleLineTags.includes('*'));\n };\n\n if (sourceLength === 1) {\n if (!isInvalidSingleLine(tag.slice(1))) {\n return;\n }\n\n const fixer = () => {\n utils.makeMultiline();\n };\n\n utils.reportJSDoc(\n 'Single line blocks are not permitted by your configuration.',\n null,\n fixer,\n true,\n );\n\n return;\n }\n\n if (checkForShortDescriptions(jsdoc, utils, requireSingleLineUnderCount)\n ) {\n return;\n }\n\n if (checkForShortTags(jsdoc, utils, requireSingleLineUnderCount)\n ) {\n return;\n }\n\n const lineChecks = () => {\n if (\n noZeroLineText &&\n (tag || description)\n ) {\n const fixer = () => {\n const line = {\n ...tokens,\n };\n utils.emptyTokens(tokens);\n const {\n tokens: {\n delimiter,\n start,\n },\n } = jsdoc.source[1];\n utils.addLine(1, {\n ...line,\n delimiter,\n start,\n });\n };\n\n utils.reportJSDoc(\n 'Should have no text on the \"0th\" line (after the `/**`).',\n null,\n fixer,\n );\n\n return;\n }\n\n const finalLine = jsdoc.source[jsdoc.source.length - 1];\n const finalLineTokens = finalLine.tokens;\n if (\n noFinalLineText &&\n finalLineTokens.description.trim()\n ) {\n const fixer = () => {\n const line = {\n ...finalLineTokens,\n };\n line.description = line.description.trimEnd();\n\n const {\n delimiter,\n } = line;\n\n for (const prop of [\n 'delimiter',\n 'postDelimiter',\n 'tag',\n 'type',\n 'lineEnd',\n 'postType',\n 'postTag',\n 'name',\n 'postName',\n 'description',\n ]) {\n finalLineTokens[\n /**\n * @type {\"delimiter\"|\"postDelimiter\"|\"tag\"|\"type\"|\n * \"lineEnd\"|\"postType\"|\"postTag\"|\"name\"|\n * \"postName\"|\"description\"}\n */ (\n prop\n )\n ] = '';\n }\n\n utils.addLine(jsdoc.source.length - 1, {\n ...line,\n delimiter,\n end: '',\n });\n };\n\n utils.reportJSDoc(\n 'Should have no text on the final line (before the `*/`).',\n null,\n fixer,\n );\n }\n };\n\n if (noMultilineBlocks) {\n if (\n jsdoc.tags.length &&\n (multilineTags.includes('*') || utils.hasATag(multilineTags))\n ) {\n lineChecks();\n\n return;\n }\n\n if (jsdoc.description.length >= minimumLengthForMultiline) {\n lineChecks();\n\n return;\n }\n\n if (\n noSingleLineBlocks &&\n (!jsdoc.tags.length ||\n !utils.filterTags(({\n tag: tg,\n }) => {\n return !isInvalidSingleLine(tg);\n }).length)\n ) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but fixing would result in a single ' +\n 'line block which you have prohibited with `noSingleLineBlocks`.',\n );\n\n return;\n }\n\n if (jsdoc.tags.length > 1) {\n if (!allowMultipleTags) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but the block has multiple tags.',\n );\n\n return;\n }\n } else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {\n if (!allowMultipleTags) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but the block has a description with a tag.',\n );\n\n return;\n }\n } else {\n const fixer = () => {\n jsdoc.source = [\n {\n number: 1,\n source: '',\n tokens: jsdoc.source.reduce((obj, {\n tokens: {\n description: desc,\n lineEnd,\n name: nme,\n postName,\n postTag,\n postType,\n tag: tg,\n type: typ,\n },\n }) => {\n if (typ) {\n obj.type = typ;\n }\n\n if (tg && typ && nme) {\n obj.postType = postType;\n }\n\n if (nme) {\n obj.name += nme;\n }\n\n if (nme && desc) {\n obj.postName = postName;\n }\n\n obj.description += desc;\n\n const nameOrDescription = obj.description || obj.name;\n if (\n nameOrDescription && nameOrDescription.slice(-1) !== ' '\n ) {\n obj.description += ' ';\n }\n\n obj.lineEnd = lineEnd;\n\n // Already filtered for multiple tags\n obj.tag += tg;\n if (tg) {\n obj.postTag = postTag || ' ';\n }\n\n return obj;\n }, utils.seedTokens({\n delimiter: '/**',\n end: '*/',\n postDelimiter: ' ',\n })),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration.',\n null,\n fixer,\n );\n\n return;\n }\n }\n\n lineChecks();\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowMultipleTags: {\n description: `If \\`noMultilineBlocks\\` is set to \\`true\\` with this option and multiple tags are\nfound in a block, an error will not be reported.\n\nSince multiple-tagged lines cannot be collapsed into a single line, this option\nprevents them from being reported. Set to \\`false\\` if you really want to report\nany blocks.\n\nThis option will also be applied when there is a block description and a single\ntag (since a description cannot precede a tag on a single line, and also\ncannot be reliably added after the tag either).\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n minimumLengthForMultiline: {\n description: `If \\`noMultilineBlocks\\` is set with this numeric option, multiline blocks will\nbe permitted if containing at least the given amount of text.\n\nIf not set, multiline blocks will not be permitted regardless of length unless\na relevant tag is present and \\`multilineTags\\` is set.\n\nDefaults to not being in effect.`,\n type: 'integer',\n },\n multilineTags: {\n anyOf: [\n {\n enum: [\n '*',\n ],\n type: 'string',\n }, {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ],\n description: `If \\`noMultilineBlocks\\` is set with this option, multiline blocks may be allowed\nregardless of length as long as a tag or a tag of a certain type is present.\n\nIf \\`*\\` is included in the array, the presence of a tags will allow for\nmultiline blocks (but not when without any tags unless the amount of text is\nover an amount specified by \\`minimumLengthForMultiline\\`).\n\nIf the array does not include \\`*\\` but lists certain tags, the presence of\nsuch a tag will cause multiline blocks to be allowed.\n\nYou may set this to an empty array to prevent any tag from permitting multiple\nlines.\n\nDefaults to \\`['*']\\`.`,\n },\n noFinalLineText: {\n description: `For multiline blocks, any non-whitespace text preceding the \\`*/\\` on the final\nline will be reported. (Text preceding a newline is not reported.)\n\n\\`noMultilineBlocks\\` will have priority over this rule if it applies.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n noMultilineBlocks: {\n description: `Requires that JSDoc blocks are restricted to single lines only unless impacted\nby the options \\`minimumLengthForMultiline\\`, \\`multilineTags\\`, or\n\\`allowMultipleTags\\`.\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n noSingleLineBlocks: {\n description: `If this is \\`true\\`, any single line blocks will be reported, except those which\nare whitelisted in \\`singleLineTags\\`.\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n noZeroLineText: {\n description: `For multiline blocks, any non-whitespace text immediately after the \\`/**\\` and\nspace will be reported. (Text after a newline is not reported.)\n\n\\`noMultilineBlocks\\` will have priority over this rule if it applies.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n requireSingleLineUnderCount: {\n description: `If this number is set, it indicates a minimum line width for a single line of\nJSDoc content spread over a multi-line comment block. If a single line is under\nthe minimum length, it will be reported so as to enforce single line JSDoc blocks\nfor such cases. Blocks are not reported which have multi-line descriptions,\nmultiple tags, a block description and tag, or tags with multi-line types or\ndescriptions.\n\nDefaults to \\`null\\`.`,\n type: 'number',\n },\n singleLineTags: {\n description: `An array of tags which can nevertheless be allowed as single line blocks when\n\\`noSingleLineBlocks\\` is set. You may set this to a empty array to\ncause all single line blocks to be reported. If \\`'*'\\` is present, then\nthe presence of a tag will allow single line blocks (but not if a tag is\nmissing).\n\nDefaults to \\`['lends', 'type']\\`.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,2BAA2B,KAAK;EACvE,IAAI,CAAC,2BAA2B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;IACtD,OAAO,KAAK;EACd;EAEA,IAAI,eAAe,GAAG,CAAC;EACvB,IAAI,iBAAiB,GAAG,KAAK;EAC7B,IAAI,kBAAkB,GAAG,KAAK;EAC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EAAE;YACR,CAAC;YACD,IAAI,EAAE;UACR,CAAC,CACF;UACD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;QACU,CAAC;QACD,eAAe,EAAE;UACf,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,iBAAiB,EAAE;UACjB,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACX,IAAI,EAAE;QACR,CAAC;QACD,kBAAkB,EAAE;UAClB,WAAW,EAAE;AACzB;AACA;AACA,uBAAuB;UACX,IAAI,EAAE;QACR,CAAC;QACD,cAAc,EAAE;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,2BAA2B,EAAE;UAC3B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,cAAc,EAAE;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,mCAAmC;UACvB,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,100 +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 _commentParser = require("comment-parser");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- // Neither a single nor 3+ asterisks are valid JSDoc per
11
- // https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code
12
- const commentRegexp = /^\/\*(?!\*)/v;
13
- const extraAsteriskCommentRegexp = /^\/\*{3,}/v;
14
- var _default = exports.default = (0, _iterateJsdoc.default)(({
15
- allComments,
16
- context,
17
- makeReport,
18
- sourceCode
19
- }) => {
20
- const [{
21
- ignore = ['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck'],
22
- preventAllMultiAsteriskBlocks = false
23
- } = {}] = context.options;
24
- let extraAsterisks = false;
25
- const nonJsdocNodes = /** @type {import('estree').Node[]} */allComments.filter(comment => {
26
- const commentText = sourceCode.getText(comment);
27
- const initialText = commentText.replace(commentRegexp, '').trimStart();
28
- if (['eslint'].some(directive => {
29
- return initialText.startsWith(directive);
30
- })) {
31
- return false;
32
- }
33
- let sliceIndex = 2;
34
- if (!commentRegexp.test(commentText)) {
35
- const multiline = extraAsteriskCommentRegexp.exec(commentText)?.[0];
36
- if (!multiline) {
37
- return false;
38
- }
39
- sliceIndex = multiline.length;
40
- extraAsterisks = true;
41
- if (preventAllMultiAsteriskBlocks) {
42
- return true;
43
- }
44
- }
45
- const tags = ((0, _commentParser.parse)(`${commentText.slice(0, 2)}*${commentText.slice(sliceIndex)}`)[0] || {}).tags ?? [];
46
- return tags.length && !tags.some(({
47
- tag
48
- }) => {
49
- return ignore.includes(tag);
50
- });
51
- });
52
- if (!nonJsdocNodes.length) {
53
- return;
54
- }
55
- for (const node of nonJsdocNodes) {
56
- const report = /** @type {import('../iterateJsdoc.js').MakeReport} */makeReport(context, node);
57
-
58
- // eslint-disable-next-line no-loop-func
59
- const fix = /** @type {import('eslint').Rule.ReportFixer} */fixer => {
60
- const text = sourceCode.getText(node);
61
- return fixer.replaceText(node, extraAsterisks ? text.replace(extraAsteriskCommentRegexp, '/**') : text.replace('/*', '/**'));
62
- };
63
- report('Expected JSDoc-like comment to begin with two asterisks.', fix);
64
- }
65
- }, {
66
- checkFile: true,
67
- meta: {
68
- docs: {
69
- description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block.',
70
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md#repos-sticky-header'
71
- },
72
- fixable: 'code',
73
- schema: [{
74
- additionalProperties: false,
75
- properties: {
76
- ignore: {
77
- description: `An array of directives that will not be reported if present at the beginning of
78
- a multi-comment block and at-sign \`/* @\`.
79
-
80
- Defaults to \`['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']\`
81
- (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).`,
82
- items: {
83
- type: 'string'
84
- },
85
- type: 'array'
86
- },
87
- preventAllMultiAsteriskBlocks: {
88
- description: `A boolean (defaulting to \`false\`) which if \`true\` will prevent all
89
- JSDoc-like blocks with more than two initial asterisks even those without
90
- apparent tag content.`,
91
- type: 'boolean'
92
- }
93
- },
94
- type: 'object'
95
- }],
96
- type: 'layout'
97
- }
98
- });
99
- module.exports = exports.default;
100
- //# sourceMappingURL=noBadBlocks.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noBadBlocks.cjs","names":["iterateJsdoc","commentParser"],"sources":["../../src/rules/noBadBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as commentParser,\n} from 'comment-parser';\n\n// Neither a single nor 3+ asterisks are valid JSDoc per\n// https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code\nconst commentRegexp = /^\\/\\*(?!\\*)/v;\nconst extraAsteriskCommentRegexp = /^\\/\\*{3,}/v;\n\nexport default iterateJsdoc(({\n allComments,\n context,\n makeReport,\n sourceCode,\n}) => {\n const [\n {\n ignore = [\n 'ts-check',\n 'ts-expect-error',\n 'ts-ignore',\n 'ts-nocheck',\n ],\n preventAllMultiAsteriskBlocks = false,\n } = {},\n ] = context.options;\n\n let extraAsterisks = false;\n const nonJsdocNodes = /** @type {import('estree').Node[]} */ (\n allComments\n ).filter((comment) => {\n const commentText = sourceCode.getText(comment);\n\n const initialText = commentText.replace(commentRegexp, '').trimStart();\n if ([\n 'eslint',\n ].some((directive) => {\n return initialText.startsWith(directive);\n })) {\n return false;\n }\n\n let sliceIndex = 2;\n if (!commentRegexp.test(commentText)) {\n const multiline = extraAsteriskCommentRegexp.exec(commentText)?.[0];\n if (!multiline) {\n return false;\n }\n\n sliceIndex = multiline.length;\n extraAsterisks = true;\n if (preventAllMultiAsteriskBlocks) {\n return true;\n }\n }\n\n const tags = (commentParser(\n `${commentText.slice(0, 2)}*${commentText.slice(sliceIndex)}`,\n )[0] || {}).tags ?? [];\n\n return tags.length && !tags.some(({\n tag,\n }) => {\n return ignore.includes(tag);\n });\n });\n\n if (!nonJsdocNodes.length) {\n return;\n }\n\n for (const node of nonJsdocNodes) {\n const report = /** @type {import('../iterateJsdoc.js').MakeReport} */ (\n makeReport\n )(context, node);\n\n // eslint-disable-next-line no-loop-func\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n const text = sourceCode.getText(node);\n\n return fixer.replaceText(\n node,\n extraAsterisks ?\n text.replace(extraAsteriskCommentRegexp, '/**') :\n text.replace('/*', '/**'),\n );\n };\n\n report('Expected JSDoc-like comment to begin with two asterisks.', fix);\n }\n}, {\n checkFile: true,\n meta: {\n docs: {\n description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n ignore: {\n description: `An array of directives that will not be reported if present at the beginning of\na multi-comment block and at-sign \\`/* @\\`.\n\nDefaults to \\`['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']\\`\n(some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n preventAllMultiAsteriskBlocks: {\n description: `A boolean (defaulting to \\`false\\`) which if \\`true\\` will prevent all\nJSDoc-like blocks with more than two initial asterisks even those without\napparent tag content.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n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V,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,63 +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
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- const anyWhitespaceLines = /^\s*$/v;
10
- const atLeastTwoLinesWhitespace = /^[ \t]*\n[ \t]*\n\s*$/v;
11
- var _default = exports.default = (0, _iterateJsdoc.default)(({
12
- jsdoc,
13
- utils
14
- }) => {
15
- const {
16
- description,
17
- descriptions,
18
- lastDescriptionLine
19
- } = utils.getDescription();
20
- const regex = jsdoc.tags.length ? anyWhitespaceLines : atLeastTwoLinesWhitespace;
21
- if (descriptions.length && regex.test(description)) {
22
- if (jsdoc.tags.length) {
23
- utils.reportJSDoc('There should be no blank lines in block descriptions followed by tags.', {
24
- line: lastDescriptionLine
25
- }, () => {
26
- utils.setBlockDescription(() => {
27
- // Remove all lines
28
- return [];
29
- });
30
- });
31
- } else {
32
- utils.reportJSDoc('There should be no extra blank lines in block descriptions not followed by tags.', {
33
- line: lastDescriptionLine
34
- }, () => {
35
- utils.setBlockDescription((info, seedTokens) => {
36
- return [
37
- // Keep the starting line
38
- {
39
- number: 0,
40
- source: '',
41
- tokens: seedTokens({
42
- ...info,
43
- description: ''
44
- })
45
- }];
46
- });
47
- });
48
- }
49
- }
50
- }, {
51
- iterateAllJsdocs: true,
52
- meta: {
53
- docs: {
54
- description: 'If tags are present, this rule will prevent empty lines in the block description. If no tags are present, this rule will prevent extra empty lines in the block description.',
55
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header'
56
- },
57
- fixable: 'whitespace',
58
- schema: [],
59
- type: 'layout'
60
- }
61
- });
62
- module.exports = exports.default;
63
- //# sourceMappingURL=noBlankBlockDescriptions.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noBlankBlockDescriptions.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/noBlankBlockDescriptions.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst anyWhitespaceLines = /^\\s*$/v;\nconst atLeastTwoLinesWhitespace = /^[ \\t]*\\n[ \\t]*\\n\\s*$/v;\n\nexport default iterateJsdoc(({\n jsdoc,\n utils,\n}) => {\n const {\n description,\n descriptions,\n lastDescriptionLine,\n } = utils.getDescription();\n\n const regex = jsdoc.tags.length ?\n anyWhitespaceLines :\n atLeastTwoLinesWhitespace;\n\n if (descriptions.length && regex.test(description)) {\n if (jsdoc.tags.length) {\n utils.reportJSDoc(\n 'There should be no blank lines in block descriptions followed by tags.',\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription(() => {\n // Remove all lines\n return [];\n });\n },\n );\n } else {\n utils.reportJSDoc(\n 'There should be no extra blank lines in block descriptions not followed by tags.',\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens) => {\n return [\n // Keep the starting line\n {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: '',\n }),\n },\n ];\n });\n },\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'If tags are present, this rule will prevent empty lines in the block description. If no tags are present, this rule will prevent extra empty lines in the block description.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header',\n },\n fixable: 'whitespace',\n schema: [],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C,MAAM,kBAAkB,GAAG,QAAQ;AACnC,MAAM,yBAAyB,GAAG,wBAAwB;AAAC,iCAE5C,IAAAA,qBAAY,EAAC,CAAC;EAC3B,KAAK;EACL;AACF,CAAC,KAAK;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