eslint-plugin-jsdoc 58.1.1 → 59.0.1

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 (184) hide show
  1. package/README.md +87 -69
  2. package/dist/buildForbidRuleDefinition.cjs +0 -1
  3. package/dist/buildForbidRuleDefinition.cjs.map +1 -1
  4. package/dist/buildRejectOrPreferRuleDefinition.cjs +7 -2
  5. package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
  6. package/dist/cjs/rules/convertToJsdocComments.d.ts +7 -0
  7. package/dist/generateDocs.cjs +129 -3
  8. package/dist/generateDocs.cjs.map +1 -1
  9. package/dist/generateRule.cjs +3 -1
  10. package/dist/generateRule.cjs.map +1 -1
  11. package/dist/generateRuleTypes.cjs +5 -5
  12. package/dist/generateRuleTypes.cjs.map +1 -1
  13. package/dist/index-cjs.cjs +30 -0
  14. package/dist/index-cjs.cjs.map +1 -1
  15. package/dist/index.cjs +30 -0
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/rules/checkAccess.cjs +1 -1
  18. package/dist/rules/checkAccess.cjs.map +1 -1
  19. package/dist/rules/checkAlignment.cjs +4 -1
  20. package/dist/rules/checkAlignment.cjs.map +1 -1
  21. package/dist/rules/checkExamples.cjs +1 -1
  22. package/dist/rules/checkExamples.cjs.map +1 -1
  23. package/dist/rules/checkIndentation.cjs +19 -0
  24. package/dist/rules/checkIndentation.cjs.map +1 -1
  25. package/dist/rules/checkLineAlignment.cjs +25 -1
  26. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  27. package/dist/rules/checkParamNames.cjs +62 -1
  28. package/dist/rules/checkParamNames.cjs.map +1 -1
  29. package/dist/rules/checkPropertyNames.cjs +6 -0
  30. package/dist/rules/checkPropertyNames.cjs.map +1 -1
  31. package/dist/rules/checkTagNames.cjs +71 -0
  32. package/dist/rules/checkTagNames.cjs.map +1 -1
  33. package/dist/rules/checkTypes.cjs +16 -1
  34. package/dist/rules/checkTypes.cjs.map +1 -1
  35. package/dist/rules/checkValues.cjs +17 -1
  36. package/dist/rules/checkValues.cjs.map +1 -1
  37. package/dist/rules/convertToJsdocComments.cjs +48 -0
  38. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  39. package/dist/rules/convertToJsdocComments.d.ts +7 -0
  40. package/dist/rules/emptyTags.cjs +10 -1
  41. package/dist/rules/emptyTags.cjs.map +1 -1
  42. package/dist/rules/implementsOnClasses.cjs +15 -1
  43. package/dist/rules/implementsOnClasses.cjs.map +1 -1
  44. package/dist/rules/informativeDocs.cjs +45 -0
  45. package/dist/rules/informativeDocs.cjs.map +1 -1
  46. package/dist/rules/linesBeforeBlock.cjs +14 -0
  47. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  48. package/dist/rules/matchDescription.cjs +129 -0
  49. package/dist/rules/matchDescription.cjs.map +1 -1
  50. package/dist/rules/matchName.cjs +30 -0
  51. package/dist/rules/matchName.cjs.map +1 -1
  52. package/dist/rules/multilineBlocks.cjs +78 -6
  53. package/dist/rules/multilineBlocks.cjs.map +1 -1
  54. package/dist/rules/noBadBlocks.cjs +11 -2
  55. package/dist/rules/noBadBlocks.cjs.map +1 -1
  56. package/dist/rules/noBlankBlockDescriptions.cjs +1 -1
  57. package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
  58. package/dist/rules/noBlankBlocks.cjs +3 -1
  59. package/dist/rules/noBlankBlocks.cjs.map +1 -1
  60. package/dist/rules/noDefaults.cjs +19 -0
  61. package/dist/rules/noDefaults.cjs.map +1 -1
  62. package/dist/rules/noMissingSyntax.cjs +22 -2
  63. package/dist/rules/noMissingSyntax.cjs.map +1 -1
  64. package/dist/rules/noMultiAsterisks.cjs +29 -0
  65. package/dist/rules/noMultiAsterisks.cjs.map +1 -1
  66. package/dist/rules/noRestrictedSyntax.cjs +17 -1
  67. package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
  68. package/dist/rules/noTypes.cjs +17 -1
  69. package/dist/rules/noTypes.cjs.map +1 -1
  70. package/dist/rules/noUndefinedTypes.cjs +11 -1
  71. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  72. package/dist/rules/requireAsteriskPrefix.cjs +28 -0
  73. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  74. package/dist/rules/requireDescription.cjs +30 -1
  75. package/dist/rules/requireDescription.cjs.map +1 -1
  76. package/dist/rules/requireDescriptionCompleteSentence.cjs +27 -0
  77. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  78. package/dist/rules/requireExample.cjs +26 -1
  79. package/dist/rules/requireExample.cjs.map +1 -1
  80. package/dist/rules/requireFileOverview.cjs +61 -0
  81. package/dist/rules/requireFileOverview.cjs.map +1 -1
  82. package/dist/rules/requireHyphenBeforeParamDescription.cjs +20 -2
  83. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  84. package/dist/rules/requireJsdoc.cjs +82 -3
  85. package/dist/rules/requireJsdoc.cjs.map +1 -1
  86. package/dist/rules/requireParam.cjs +213 -1
  87. package/dist/rules/requireParam.cjs.map +1 -1
  88. package/dist/rules/requireParamDescription.cjs +21 -0
  89. package/dist/rules/requireParamDescription.cjs.map +1 -1
  90. package/dist/rules/requireParamName.cjs +16 -1
  91. package/dist/rules/requireParamName.cjs.map +1 -1
  92. package/dist/rules/requireParamType.cjs +21 -1
  93. package/dist/rules/requireParamType.cjs.map +1 -1
  94. package/dist/rules/requirePropertyName.cjs +1 -1
  95. package/dist/rules/requirePropertyName.cjs.map +1 -1
  96. package/dist/rules/requirePropertyType.cjs +1 -1
  97. package/dist/rules/requirePropertyType.cjs.map +1 -1
  98. package/dist/rules/requireReturns.cjs +54 -1
  99. package/dist/rules/requireReturns.cjs.map +1 -1
  100. package/dist/rules/requireReturnsCheck.cjs +22 -1
  101. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  102. package/dist/rules/requireReturnsDescription.cjs +15 -1
  103. package/dist/rules/requireReturnsDescription.cjs.map +1 -1
  104. package/dist/rules/requireReturnsType.cjs +15 -1
  105. package/dist/rules/requireReturnsType.cjs.map +1 -1
  106. package/dist/rules/requireTemplate.cjs +17 -1
  107. package/dist/rules/requireTemplate.cjs.map +1 -1
  108. package/dist/rules/requireThrows.cjs +18 -1
  109. package/dist/rules/requireThrows.cjs.map +1 -1
  110. package/dist/rules/requireYields.cjs +50 -1
  111. package/dist/rules/requireYields.cjs.map +1 -1
  112. package/dist/rules/requireYieldsCheck.cjs +25 -7
  113. package/dist/rules/requireYieldsCheck.cjs.map +1 -1
  114. package/dist/rules/sortTags.cjs +200 -1
  115. package/dist/rules/sortTags.cjs.map +1 -1
  116. package/dist/rules/tagLines.cjs +32 -2
  117. package/dist/rules/tagLines.cjs.map +1 -1
  118. package/dist/rules/textEscaping.cjs +5 -1
  119. package/dist/rules/textEscaping.cjs.map +1 -1
  120. package/dist/rules/typeFormatting.cjs +47 -10
  121. package/dist/rules/typeFormatting.cjs.map +1 -1
  122. package/dist/rules/validTypes.cjs +8 -1
  123. package/dist/rules/validTypes.cjs.map +1 -1
  124. package/dist/rules.d.ts +2130 -32
  125. package/package.json +2 -2
  126. package/src/buildForbidRuleDefinition.js +0 -1
  127. package/src/buildRejectOrPreferRuleDefinition.js +12 -2
  128. package/src/index-cjs.js +36 -0
  129. package/src/index.js +36 -0
  130. package/src/rules/checkAccess.js +1 -1
  131. package/src/rules/checkAlignment.js +3 -0
  132. package/src/rules/checkExamples.js +1 -1
  133. package/src/rules/checkIndentation.js +19 -0
  134. package/src/rules/checkLineAlignment.js +24 -0
  135. package/src/rules/checkParamNames.js +62 -1
  136. package/src/rules/checkPropertyNames.js +6 -0
  137. package/src/rules/checkTagNames.js +71 -0
  138. package/src/rules/checkTypes.js +16 -1
  139. package/src/rules/checkValues.js +16 -0
  140. package/src/rules/convertToJsdocComments.js +48 -0
  141. package/src/rules/emptyTags.js +10 -1
  142. package/src/rules/implementsOnClasses.js +15 -1
  143. package/src/rules/informativeDocs.js +45 -0
  144. package/src/rules/linesBeforeBlock.js +14 -0
  145. package/src/rules/matchDescription.js +129 -0
  146. package/src/rules/matchName.js +30 -0
  147. package/src/rules/multilineBlocks.js +77 -5
  148. package/src/rules/noBadBlocks.js +11 -2
  149. package/src/rules/noBlankBlockDescriptions.js +1 -1
  150. package/src/rules/noBlankBlocks.js +2 -0
  151. package/src/rules/noDefaults.js +19 -0
  152. package/src/rules/noMissingSyntax.js +22 -2
  153. package/src/rules/noMultiAsterisks.js +29 -0
  154. package/src/rules/noRestrictedSyntax.js +17 -1
  155. package/src/rules/noTypes.js +17 -1
  156. package/src/rules/noUndefinedTypes.js +11 -1
  157. package/src/rules/requireAsteriskPrefix.js +28 -0
  158. package/src/rules/requireDescription.js +30 -1
  159. package/src/rules/requireDescriptionCompleteSentence.js +27 -0
  160. package/src/rules/requireExample.js +26 -1
  161. package/src/rules/requireFileOverview.js +61 -0
  162. package/src/rules/requireHyphenBeforeParamDescription.js +19 -1
  163. package/src/rules/requireJsdoc.js +80 -1
  164. package/src/rules/requireParam.js +213 -1
  165. package/src/rules/requireParamDescription.js +21 -0
  166. package/src/rules/requireParamName.js +16 -1
  167. package/src/rules/requireParamType.js +21 -1
  168. package/src/rules/requirePropertyName.js +1 -1
  169. package/src/rules/requirePropertyType.js +1 -1
  170. package/src/rules/requireReturns.js +54 -1
  171. package/src/rules/requireReturnsCheck.js +22 -1
  172. package/src/rules/requireReturnsDescription.js +15 -1
  173. package/src/rules/requireReturnsType.js +15 -1
  174. package/src/rules/requireTemplate.js +17 -1
  175. package/src/rules/requireThrows.js +18 -1
  176. package/src/rules/requireYields.js +50 -1
  177. package/src/rules/requireYieldsCheck.js +25 -7
  178. package/src/rules/sortTags.js +200 -1
  179. package/src/rules/tagLines.js +30 -0
  180. package/src/rules/textEscaping.js +5 -1
  181. package/src/rules/typeFormatting.js +44 -7
  182. package/src/rules/validTypes.js +8 -1
  183. package/src/rules.d.ts +2130 -32
  184. package/typings/gitdown.d.ts +4 -0
@@ -136,6 +136,19 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
136
136
  additionalProperties: false,
137
137
  properties: {
138
138
  contexts: {
139
+ description: `Set this to an array of strings representing the AST context (or an object with
140
+ optional \`context\` and \`comment\` properties) where you wish the rule to be applied (e.g.,
141
+ \`ClassDeclaration\` for ES6 classes).
142
+
143
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
144
+
145
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
146
+ \`FunctionExpression\`). Set to \`"any"\` if you want the rule to apply to any
147
+ JSDoc block throughout your files.
148
+
149
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
150
+ section of our Advanced docs for more on the expected format.
151
+ `,
139
152
  items: {
140
153
  anyOf: [{
141
154
  type: 'string'
@@ -155,6 +168,42 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
155
168
  type: 'array'
156
169
  },
157
170
  mainDescription: {
171
+ description: `If you wish to override the main block description without changing the
172
+ default \`match-description\` (which can cascade to the \`tags\` with \`true\`),
173
+ you may use \`mainDescription\`:
174
+
175
+ \`\`\`js
176
+ {
177
+ 'jsdoc/match-description': ['error', {
178
+ mainDescription: '[A-Z].*\\\\.',
179
+ tags: {
180
+ param: true,
181
+ returns: true
182
+ }
183
+ }]
184
+ }
185
+ \`\`\`
186
+
187
+ There is no need to add \`mainDescription: true\`, as by default, the main
188
+ block description (and only the main block description) is linted, though you
189
+ may disable checking it by setting it to \`false\`.
190
+
191
+ You may also provide an object with \`message\`:
192
+
193
+ \`\`\`js
194
+ {
195
+ 'jsdoc/match-description': ['error', {
196
+ mainDescription: {
197
+ message: 'Capitalize first word of JSDoc block descriptions',
198
+ match: '[A-Z].*\\\\.'
199
+ },
200
+ tags: {
201
+ param: true,
202
+ returns: true
203
+ }
204
+ }]
205
+ }
206
+ \`\`\``,
158
207
  oneOf: [{
159
208
  format: 'regex',
160
209
  type: 'string'
@@ -179,16 +228,96 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
179
228
  }]
180
229
  },
181
230
  matchDescription: {
231
+ description: `You can supply your own expression to override the default, passing a
232
+ \`matchDescription\` string on the options object.
233
+
234
+ Defaults to using (only) the \`v\` flag, so
235
+ to add your own flags, encapsulate your expression as a string, but like a
236
+ literal, e.g., \`/[A-Z].*\\./vi\`.
237
+
238
+ \`\`\`js
239
+ {
240
+ 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\\\.'}]
241
+ }
242
+ \`\`\``,
182
243
  format: 'regex',
183
244
  type: 'string'
184
245
  },
185
246
  message: {
247
+ description: `You may provide a custom default message by using the following format:
248
+
249
+ \`\`\`js
250
+ {
251
+ 'jsdoc/match-description': ['error', {
252
+ message: 'The default description should begin with a capital letter.'
253
+ }]
254
+ }
255
+ \`\`\`
256
+
257
+ This can be overridden per tag or for the main block description by setting
258
+ \`message\` within \`tags\` or \`mainDescription\`, respectively.
259
+ `,
186
260
  type: 'string'
187
261
  },
188
262
  nonemptyTags: {
263
+ description: `If not set to \`false\`, will enforce that the following tags have at least
264
+ some content:
265
+
266
+ - \`@copyright\`
267
+ - \`@example\`
268
+ - \`@see\`
269
+ - \`@todo\`
270
+
271
+ If you supply your own tag description for any of the above tags in \`tags\`,
272
+ your description will take precedence.`,
189
273
  type: 'boolean'
190
274
  },
191
275
  tags: {
276
+ description: `If you want different regular expressions to apply to tags, you may use
277
+ the \`tags\` option object:
278
+
279
+ \`\`\`js
280
+ {
281
+ 'jsdoc/match-description': ['error', {tags: {
282
+ param: '\\\\- [A-Z].*\\\\.',
283
+ returns: '[A-Z].*\\\\.'
284
+ }}]
285
+ }
286
+ \`\`\`
287
+
288
+ In place of a string, you can also add \`true\` to indicate that a particular
289
+ tag should be linted with the \`matchDescription\` value (or the default).
290
+
291
+ \`\`\`js
292
+ {
293
+ 'jsdoc/match-description': ['error', {tags: {
294
+ param: true,
295
+ returns: true
296
+ }}]
297
+ }
298
+ \`\`\`
299
+
300
+ Alternatively, you may supply an object with a \`message\` property to indicate
301
+ the error message for that tag.
302
+
303
+ \`\`\`js
304
+ {
305
+ 'jsdoc/match-description': ['error', {tags: {
306
+ param: {message: 'Begin with a hyphen', match: '\\\\- [A-Z].*\\\\.'},
307
+ returns: {message: 'Capitalize for returns (the default)', match: true}
308
+ }}]
309
+ }
310
+ \`\`\`
311
+
312
+ The tags \`@param\`/\`@arg\`/\`@argument\` and \`@property\`/\`@prop\` will be properly
313
+ parsed to ensure that the matched "description" text includes only the text
314
+ after the name.
315
+
316
+ All other tags will treat the text following the tag name, a space, and
317
+ an optional curly-bracketed type expression (and another space) as part of
318
+ its "description" (e.g., for \`@returns {someType} some description\`, the
319
+ description is \`some description\` while for \`@some-tag xyz\`, the description
320
+ is \`xyz\`).`,
192
321
  patternProperties: {
193
322
  '.*': {
194
323
  oneOf: [{
@@ -1 +1 @@
1
- {"version":3,"file":"matchDescription.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","matchDescriptionDefault","stringOrDefault","value","userDefault","_default","exports","iterateJsdoc","context","jsdoc","report","utils","mainDescription","matchDescription","message","nonemptyTags","tags","options","validateDescription","desc","tag","mainDescriptionMatch","errorMessage","match","Object","hasOwn","tagValue","tagName","regex","getRegexFromString","test","line","source","number","description","getDescription","hasNoTag","forEachPreferredTag","matchingJsdocTag","targetTagName","name","getTagDescription","trim","keys","length","hasOptionTag","Boolean","whitelistedTags","filterTags","tagsWithNames","tagsWithoutNames","getTagsByType","some","replace","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","oneOf","format","patternProperties","enum","module"],"sources":["../../src/rules/matchDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n// If supporting Node >= 10, we could loosen the default to this for the\n// initial letter: \\\\p{Upper}\nconst matchDescriptionDefault = '^\\n?([A-Z`\\\\d_][\\\\s\\\\S]*[.?!`\\\\p{RGI_Emoji}]\\\\s*)?$';\n\n/**\n * @param {string} value\n * @param {string} userDefault\n * @returns {string}\n */\nconst stringOrDefault = (value, userDefault) => {\n return typeof value === 'string' ?\n value :\n userDefault || matchDescriptionDefault;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n utils,\n}) => {\n const {\n mainDescription,\n matchDescription,\n message,\n nonemptyTags = true,\n tags = {},\n } = context.options[0] || {};\n\n /**\n * @param {string} desc\n * @param {import('comment-parser').Spec} [tag]\n * @returns {void}\n */\n const validateDescription = (desc, tag) => {\n let mainDescriptionMatch = mainDescription;\n let errorMessage = message;\n if (typeof mainDescription === 'object') {\n mainDescriptionMatch = mainDescription.match;\n errorMessage = mainDescription.message;\n }\n\n if (mainDescriptionMatch === false && (\n !tag || !Object.hasOwn(tags, tag.tag))\n ) {\n return;\n }\n\n let tagValue = mainDescriptionMatch;\n if (tag) {\n const tagName = tag.tag;\n if (typeof tags[tagName] === 'object') {\n tagValue = tags[tagName].match;\n errorMessage = tags[tagName].message;\n } else {\n tagValue = tags[tagName];\n }\n }\n\n const regex = utils.getRegexFromString(\n stringOrDefault(tagValue, matchDescription),\n );\n\n if (!regex.test(desc)) {\n report(\n errorMessage || 'JSDoc description does not satisfy the regex pattern.',\n null,\n tag || {\n // Add one as description would typically be into block\n line: jsdoc.source[0].number + 1,\n },\n );\n }\n };\n\n const {\n description,\n } = utils.getDescription();\n if (description) {\n validateDescription(description);\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasNoTag = (tagName) => {\n return !tags[tagName];\n };\n\n for (const tag of [\n 'description',\n 'summary',\n 'file',\n 'classdesc',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n if (hasNoTag(targetTagName)) {\n validateDescription(desc, matchingJsdocTag);\n }\n }, true);\n }\n\n if (nonemptyTags) {\n for (const tag of [\n 'copyright',\n 'example',\n 'see',\n 'todo',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n\n if (hasNoTag(targetTagName) && !(/.+/v).test(desc)) {\n report(\n 'JSDoc description must not be empty.',\n null,\n matchingJsdocTag,\n );\n }\n });\n }\n }\n\n if (!Object.keys(tags).length) {\n return;\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasOptionTag = (tagName) => {\n return Boolean(tags[tagName]);\n };\n\n const whitelistedTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return hasOptionTag(tagName);\n });\n const {\n tagsWithNames,\n tagsWithoutNames,\n } = utils.getTagsByType(whitelistedTags);\n\n tagsWithNames.some((tag) => {\n const desc = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(/^[\\- ]*/v, '')\n .trim();\n\n return validateDescription(desc, tag);\n });\n\n tagsWithoutNames.some((tag) => {\n const desc = (tag.name + ' ' + utils.getTagDescription(tag)).trim();\n\n return validateDescription(desc, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Enforces a regular expression pattern on descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n mainDescription: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n matchDescription: {\n format: 'regex',\n type: 'string',\n },\n message: {\n type: 'string',\n },\n nonemptyTags: {\n type: 'boolean',\n },\n tags: {\n patternProperties: {\n '.*': {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA,MAAMG,uBAAuB,GAAG,qDAAqD;;AAErF;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAGA,CAACC,KAAK,EAAEC,WAAW,KAAK;EAC9C,OAAO,OAAOD,KAAK,KAAK,QAAQ,GAC9BA,KAAK,GACLC,WAAW,IAAIH,uBAAuB;AAC1C,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEa,IAAAO,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,eAAe;IACfC,gBAAgB;IAChBC,OAAO;IACPC,YAAY,GAAG,IAAI;IACnBC,IAAI,GAAG,CAAC;EACV,CAAC,GAAGR,OAAO,CAACS,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;;EAE5B;AACF;AACA;AACA;AACA;EACE,MAAMC,mBAAmB,GAAGA,CAACC,IAAI,EAAEC,GAAG,KAAK;IACzC,IAAIC,oBAAoB,GAAGT,eAAe;IAC1C,IAAIU,YAAY,GAAGR,OAAO;IAC1B,IAAI,OAAOF,eAAe,KAAK,QAAQ,EAAE;MACvCS,oBAAoB,GAAGT,eAAe,CAACW,KAAK;MAC5CD,YAAY,GA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AA,OAAA,CAAAN,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"matchDescription.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","matchDescriptionDefault","stringOrDefault","value","userDefault","_default","exports","iterateJsdoc","context","jsdoc","report","utils","mainDescription","matchDescription","message","nonemptyTags","tags","options","validateDescription","desc","tag","mainDescriptionMatch","errorMessage","match","Object","hasOwn","tagValue","tagName","regex","getRegexFromString","test","line","source","number","description","getDescription","hasNoTag","forEachPreferredTag","matchingJsdocTag","targetTagName","name","getTagDescription","trim","keys","length","hasOptionTag","Boolean","whitelistedTags","filterTags","tagsWithNames","tagsWithoutNames","getTagsByType","some","replace","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","oneOf","format","patternProperties","enum","module"],"sources":["../../src/rules/matchDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n// If supporting Node >= 10, we could loosen the default to this for the\n// initial letter: \\\\p{Upper}\nconst matchDescriptionDefault = '^\\n?([A-Z`\\\\d_][\\\\s\\\\S]*[.?!`\\\\p{RGI_Emoji}]\\\\s*)?$';\n\n/**\n * @param {string} value\n * @param {string} userDefault\n * @returns {string}\n */\nconst stringOrDefault = (value, userDefault) => {\n return typeof value === 'string' ?\n value :\n userDefault || matchDescriptionDefault;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n utils,\n}) => {\n const {\n mainDescription,\n matchDescription,\n message,\n nonemptyTags = true,\n tags = {},\n } = context.options[0] || {};\n\n /**\n * @param {string} desc\n * @param {import('comment-parser').Spec} [tag]\n * @returns {void}\n */\n const validateDescription = (desc, tag) => {\n let mainDescriptionMatch = mainDescription;\n let errorMessage = message;\n if (typeof mainDescription === 'object') {\n mainDescriptionMatch = mainDescription.match;\n errorMessage = mainDescription.message;\n }\n\n if (mainDescriptionMatch === false && (\n !tag || !Object.hasOwn(tags, tag.tag))\n ) {\n return;\n }\n\n let tagValue = mainDescriptionMatch;\n if (tag) {\n const tagName = tag.tag;\n if (typeof tags[tagName] === 'object') {\n tagValue = tags[tagName].match;\n errorMessage = tags[tagName].message;\n } else {\n tagValue = tags[tagName];\n }\n }\n\n const regex = utils.getRegexFromString(\n stringOrDefault(tagValue, matchDescription),\n );\n\n if (!regex.test(desc)) {\n report(\n errorMessage || 'JSDoc description does not satisfy the regex pattern.',\n null,\n tag || {\n // Add one as description would typically be into block\n line: jsdoc.source[0].number + 1,\n },\n );\n }\n };\n\n const {\n description,\n } = utils.getDescription();\n if (description) {\n validateDescription(description);\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasNoTag = (tagName) => {\n return !tags[tagName];\n };\n\n for (const tag of [\n 'description',\n 'summary',\n 'file',\n 'classdesc',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n if (hasNoTag(targetTagName)) {\n validateDescription(desc, matchingJsdocTag);\n }\n }, true);\n }\n\n if (nonemptyTags) {\n for (const tag of [\n 'copyright',\n 'example',\n 'see',\n 'todo',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n\n if (hasNoTag(targetTagName) && !(/.+/v).test(desc)) {\n report(\n 'JSDoc description must not be empty.',\n null,\n matchingJsdocTag,\n );\n }\n });\n }\n }\n\n if (!Object.keys(tags).length) {\n return;\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasOptionTag = (tagName) => {\n return Boolean(tags[tagName]);\n };\n\n const whitelistedTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return hasOptionTag(tagName);\n });\n const {\n tagsWithNames,\n tagsWithoutNames,\n } = utils.getTagsByType(whitelistedTags);\n\n tagsWithNames.some((tag) => {\n const desc = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(/^[\\- ]*/v, '')\n .trim();\n\n return validateDescription(desc, tag);\n });\n\n tagsWithoutNames.some((tag) => {\n const desc = (tag.name + ' ' + utils.getTagDescription(tag)).trim();\n\n return validateDescription(desc, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Enforces a regular expression pattern on descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied (e.g.,\n\\`ClassDeclaration\\` for ES6 classes).\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want the rule to apply to any\nJSDoc block throughout your files.\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.\n`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n mainDescription: {\n description: `If you wish to override the main block description without changing the\ndefault \\`match-description\\` (which can cascade to the \\`tags\\` with \\`true\\`),\nyou may use \\`mainDescription\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: '[A-Z].*\\\\\\\\.',\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\`\n\nThere is no need to add \\`mainDescription: true\\`, as by default, the main\nblock description (and only the main block description) is linted, though you\nmay disable checking it by setting it to \\`false\\`.\n\nYou may also provide an object with \\`message\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: {\n message: 'Capitalize first word of JSDoc block descriptions',\n match: '[A-Z].*\\\\\\\\.'\n },\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\``,\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n matchDescription: {\n description: `You can supply your own expression to override the default, passing a\n\\`matchDescription\\` string on the options object.\n\nDefaults to using (only) the \\`v\\` flag, so\nto add your own flags, encapsulate your expression as a string, but like a\nliteral, e.g., \\`/[A-Z].*\\\\./vi\\`.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\\\\\\\.'}]\n}\n\\`\\`\\``,\n format: 'regex',\n type: 'string',\n },\n message: {\n description: `You may provide a custom default message by using the following format:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n message: 'The default description should begin with a capital letter.'\n }]\n}\n\\`\\`\\`\n\nThis can be overridden per tag or for the main block description by setting\n\\`message\\` within \\`tags\\` or \\`mainDescription\\`, respectively.\n`,\n type: 'string',\n },\n nonemptyTags: {\n description: `If not set to \\`false\\`, will enforce that the following tags have at least\nsome content:\n\n- \\`@copyright\\`\n- \\`@example\\`\n- \\`@see\\`\n- \\`@todo\\`\n\nIf you supply your own tag description for any of the above tags in \\`tags\\`,\nyour description will take precedence.`,\n type: 'boolean',\n },\n tags: {\n description: `If you want different regular expressions to apply to tags, you may use\nthe \\`tags\\` option object:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: '\\\\\\\\- [A-Z].*\\\\\\\\.',\n returns: '[A-Z].*\\\\\\\\.'\n }}]\n}\n\\`\\`\\`\n\nIn place of a string, you can also add \\`true\\` to indicate that a particular\ntag should be linted with the \\`matchDescription\\` value (or the default).\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: true,\n returns: true\n }}]\n}\n\\`\\`\\`\n\nAlternatively, you may supply an object with a \\`message\\` property to indicate\nthe error message for that tag.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: {message: 'Begin with a hyphen', match: '\\\\\\\\- [A-Z].*\\\\\\\\.'},\n returns: {message: 'Capitalize for returns (the default)', match: true}\n }}]\n}\n\\`\\`\\`\n\nThe tags \\`@param\\`/\\`@arg\\`/\\`@argument\\` and \\`@property\\`/\\`@prop\\` will be properly\nparsed to ensure that the matched \"description\" text includes only the text\nafter the name.\n\nAll other tags will treat the text following the tag name, a space, and\nan optional curly-bracketed type expression (and another space) as part of\nits \"description\" (e.g., for \\`@returns {someType} some description\\`, the\ndescription is \\`some description\\` while for \\`@some-tag xyz\\`, the description\nis \\`xyz\\`).`,\n patternProperties: {\n '.*': {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA,MAAMG,uBAAuB,GAAG,qDAAqD;;AAErF;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAGA,CAACC,KAAK,EAAEC,WAAW,KAAK;EAC9C,OAAO,OAAOD,KAAK,KAAK,QAAQ,GAC9BA,KAAK,GACLC,WAAW,IAAIH,uBAAuB;AAC1C,CAAC;AAAC,IAAAI,QAAA,GAAAC,O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,IAAI,EAAE;IACJC,IAAI,EAAE;MACJtB,WAAW,EAAE,wDAAwD;MACrEuB,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,QAAQ,EAAE;UACR3B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACW4B,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEC,IAAI,EAAE;YACR,CAAC,EACD;cACEL,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVK,OAAO,EAAE;kBACPD,IAAI,EAAE;gBACR,CAAC;gBACDxD,OAAO,EAAE;kBACPwD,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDpD,eAAe,EAAE;UACfsB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKgC,KAAK,EAAE,CACL;YACEC,MAAM,EAAE,OAAO;YACfH,IAAI,EAAE;UACR,CAAC,EACD;YACEA,IAAI,EAAE;UACR,CAAC,EACD;YACEL,oBAAoB,EAAE,KAAK;YAC3BC,UAAU,EAAE;cACVrC,KAAK,EAAE;gBACL2C,KAAK,EAAE,CACL;kBACEC,MAAM,EAAE,OAAO;kBACfH,IAAI,EAAE;gBACR,CAAC,EACD;kBACEA,IAAI,EAAE;gBACR,CAAC;cAEL,CAAC;cACDlD,OAAO,EAAE;gBACPkD,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACDnD,gBAAgB,EAAE;UAChBqB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,MAAM,EAAE,OAAO;UACfH,IAAI,EAAE;QACR,CAAC;QACDlD,OAAO,EAAE;UACPoB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACW8B,IAAI,EAAE;QACR,CAAC;QACDjD,YAAY,EAAE;UACZmB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3B8B,IAAI,EAAE;QACR,CAAC;QACDhD,IAAI,EAAE;UACJkB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;UACDkC,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJF,KAAK,EAAE,CACL;gBACEC,MAAM,EAAE,OAAO;gBACfH,IAAI,EAAE;cACR,CAAC,EACD;gBACEK,IAAI,EAAE,CACJ,IAAI,CACL;gBACDL,IAAI,EAAE;cACR,CAAC,EACD;gBACEL,oBAAoB,EAAE,KAAK;gBAC3BC,UAAU,EAAE;kBACVrC,KAAK,EAAE;oBACL2C,KAAK,EAAE,CACL;sBACEC,MAAM,EAAE,OAAO;sBACfH,IAAI,EAAE;oBACR,CAAC,EACD;sBACEK,IAAI,EAAE,CACJ,IAAI,CACL;sBACDL,IAAI,EAAE;oBACR,CAAC;kBAEL,CAAC;kBACDlD,OAAO,EAAE;oBACPkD,IAAI,EAAE;kBACR;gBACF,CAAC;gBACDA,IAAI,EAAE;cACR,CAAC;YAEL;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAAhE,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
@@ -88,28 +88,58 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
88
88
  additionalProperties: false,
89
89
  properties: {
90
90
  match: {
91
+ description: `\`match\` is a required option containing an array of objects which determine
92
+ the conditions whereby a name is reported as being problematic.
93
+
94
+ These objects can have any combination of the following groups of optional
95
+ properties, all of which act to confine one another.
96
+
97
+ Note that \`comment\`, even if targeting a specific tag, is used to match the
98
+ whole block. So if a \`comment\` finds its specific tag, it may still apply
99
+ fixes found by the likes of \`disallowName\` even when a different tag has the
100
+ disallowed name. An alternative is to ensure that \`comment\` finds the specific
101
+ tag of the desired tag and/or name and no \`disallowName\` (or \`allowName\`) is
102
+ supplied. In such a case, only one error will be reported, but no fixer will
103
+ be applied, however.
104
+ `,
91
105
  items: {
92
106
  additionalProperties: false,
93
107
  properties: {
94
108
  allowName: {
109
+ description: `Indicates which names are allowed for the given tag (or \`*\`).
110
+ Accepts a string regular expression (optionally wrapped between two
111
+ \`/\` delimiters followed by optional flags) used to match the name.`,
95
112
  type: 'string'
96
113
  },
97
114
  comment: {
115
+ description: 'As with `context` but AST for the JSDoc block comment and types.',
98
116
  type: 'string'
99
117
  },
100
118
  context: {
119
+ description: `AST to confine the allowing or disallowing to JSDoc blocks
120
+ associated with a particular context. See the
121
+ ["AST and Selectors"](../#advanced-ast-and-selectors)
122
+ section of our Advanced docs for more on the expected format.`,
101
123
  type: 'string'
102
124
  },
103
125
  disallowName: {
126
+ description: 'As with `allowName` but indicates names that are not allowed.',
104
127
  type: 'string'
105
128
  },
106
129
  message: {
130
+ description: 'An optional custom message to use when there is a match.',
107
131
  type: 'string'
108
132
  },
109
133
  replacement: {
134
+ description: `If \`disallowName\` is supplied and this value is present, it
135
+ will replace the matched \`disallowName\` text.`,
110
136
  type: 'string'
111
137
  },
112
138
  tags: {
139
+ description: `This array should include tag names or \`*\` to indicate the
140
+ match will apply for all tags (except as confined by any context
141
+ properties). If \`*\` is not used, then these rules will only apply to
142
+ the specified tags. If \`tags\` is omitted, then \`*\` is assumed.`,
113
143
  items: {
114
144
  type: 'string'
115
145
  },
@@ -1 +1 @@
1
- {"version":3,"file":"matchName.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","info","lastIndex","jsdoc","report","utils","match","options","allowName","disallowName","replacement","tags","allowNameRegex","getRegexFromString","disallowNameRegex","applicableTags","includes","getPresentTags","reported","tag","tagName","name","replace","allowed","test","disallowed","hasRegex","fixer","src","source","tokens","message","reportJSDoc","undefined","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","comment","required","module"],"sources":["../../src/rules/matchName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n info: {\n lastIndex,\n },\n jsdoc,\n report,\n utils,\n}) => {\n const {\n match,\n } = context.options[0] || {};\n if (!match) {\n report('Rule `no-restricted-syntax` is missing a `match` option.');\n\n return;\n }\n\n const {\n allowName,\n disallowName,\n replacement,\n tags = [\n '*',\n ],\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n\n const allowNameRegex = allowName && utils.getRegexFromString(allowName);\n const disallowNameRegex = disallowName && utils.getRegexFromString(disallowName);\n\n let applicableTags = jsdoc.tags;\n if (!tags.includes('*')) {\n applicableTags = utils.getPresentTags(tags);\n }\n\n let reported = false;\n for (const tag of applicableTags) {\n const tagName = tag.name.replace(/^\\[/v, '').replace(/(=.*)?\\]$/v, '');\n const allowed = !allowNameRegex || allowNameRegex.test(tagName);\n const disallowed = disallowNameRegex && disallowNameRegex.test(tagName);\n const hasRegex = allowNameRegex || disallowNameRegex;\n if (hasRegex && allowed && !disallowed) {\n continue;\n }\n\n if (!hasRegex && reported) {\n continue;\n }\n\n const fixer = () => {\n for (const src of tag.source) {\n if (src.tokens.name) {\n src.tokens.name = src.tokens.name.replace(\n disallowNameRegex, replacement,\n );\n break;\n }\n }\n };\n\n let {\n message,\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n if (!message) {\n if (hasRegex) {\n message = disallowed ?\n `Only allowing names not matching \\`${disallowNameRegex}\\` but found \"${tagName}\".` :\n `Only allowing names matching \\`${allowNameRegex}\\` but found \"${tagName}\".`;\n } else {\n message = `Prohibited context for \"${tagName}\".`;\n }\n }\n\n utils.reportJSDoc(\n message,\n hasRegex ? tag : null,\n\n // We could match up\n disallowNameRegex && replacement !== undefined ?\n fixer :\n null,\n false,\n {\n // Could also supply `context`, `comment`, `tags`\n allowName,\n disallowName,\n name: tagName,\n },\n );\n if (!hasRegex) {\n reported = true;\n }\n }\n}, {\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports the name portion of a JSDoc tag if matching or not matching a given regular expression.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-name.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n match: {\n items: {\n additionalProperties: false,\n properties: {\n allowName: {\n type: 'string',\n },\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n disallowName: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n replacement: {\n type: 'string',\n },\n tags: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n },\n required: [\n 'match',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI,EAA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U,EAAE;cACVlC,SAAS,EAAE;gBACToC,IAAI,EAAE;cACR,CAAC;cACDC,OAAO,EAAE;gBACPD,IAAI,EAAE;cACR,CAAC;cACD5C,OAAO,EAAE;gBACP4C,IAAI,EAAE;cACR,CAAC;cACDnC,YAAY,EAAE;gBACZmC,IAAI,EAAE;cACR,CAAC;cACDb,OAAO,EAAE;gBACPa,IAAI,EAAE;cACR,CAAC;cACDlC,WAAW,EAAE;gBACXkC,IAAI,EAAE;cACR,CAAC;cACDjC,IAAI,EAAE;gBACJgC,KAAK,EAAE;kBACLC,IAAI,EAAE;gBACR,CAAC;gBACDA,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDE,QAAQ,EAAE,CACR,OAAO,CACR;MACDF,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAG,MAAA,CAAAjD,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"matchName.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","info","lastIndex","jsdoc","report","utils","match","options","allowName","disallowName","replacement","tags","allowNameRegex","getRegexFromString","disallowNameRegex","applicableTags","includes","getPresentTags","reported","tag","tagName","name","replace","allowed","test","disallowed","hasRegex","fixer","src","source","tokens","message","reportJSDoc","undefined","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","comment","required","module"],"sources":["../../src/rules/matchName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n info: {\n lastIndex,\n },\n jsdoc,\n report,\n utils,\n}) => {\n const {\n match,\n } = context.options[0] || {};\n if (!match) {\n report('Rule `no-restricted-syntax` is missing a `match` option.');\n\n return;\n }\n\n const {\n allowName,\n disallowName,\n replacement,\n tags = [\n '*',\n ],\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n\n const allowNameRegex = allowName && utils.getRegexFromString(allowName);\n const disallowNameRegex = disallowName && utils.getRegexFromString(disallowName);\n\n let applicableTags = jsdoc.tags;\n if (!tags.includes('*')) {\n applicableTags = utils.getPresentTags(tags);\n }\n\n let reported = false;\n for (const tag of applicableTags) {\n const tagName = tag.name.replace(/^\\[/v, '').replace(/(=.*)?\\]$/v, '');\n const allowed = !allowNameRegex || allowNameRegex.test(tagName);\n const disallowed = disallowNameRegex && disallowNameRegex.test(tagName);\n const hasRegex = allowNameRegex || disallowNameRegex;\n if (hasRegex && allowed && !disallowed) {\n continue;\n }\n\n if (!hasRegex && reported) {\n continue;\n }\n\n const fixer = () => {\n for (const src of tag.source) {\n if (src.tokens.name) {\n src.tokens.name = src.tokens.name.replace(\n disallowNameRegex, replacement,\n );\n break;\n }\n }\n };\n\n let {\n message,\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n if (!message) {\n if (hasRegex) {\n message = disallowed ?\n `Only allowing names not matching \\`${disallowNameRegex}\\` but found \"${tagName}\".` :\n `Only allowing names matching \\`${allowNameRegex}\\` but found \"${tagName}\".`;\n } else {\n message = `Prohibited context for \"${tagName}\".`;\n }\n }\n\n utils.reportJSDoc(\n message,\n hasRegex ? tag : null,\n\n // We could match up\n disallowNameRegex && replacement !== undefined ?\n fixer :\n null,\n false,\n {\n // Could also supply `context`, `comment`, `tags`\n allowName,\n disallowName,\n name: tagName,\n },\n );\n if (!hasRegex) {\n reported = true;\n }\n }\n}, {\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports the name portion of a JSDoc tag if matching or not matching a given regular expression.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-name.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n match: {\n description: `\\`match\\` is a required option containing an array of objects which determine\nthe conditions whereby a name is reported as being problematic.\n\nThese objects can have any combination of the following groups of optional\nproperties, all of which act to confine one another.\n\nNote that \\`comment\\`, even if targeting a specific tag, is used to match the\nwhole block. So if a \\`comment\\` finds its specific tag, it may still apply\nfixes found by the likes of \\`disallowName\\` even when a different tag has the\ndisallowed name. An alternative is to ensure that \\`comment\\` finds the specific\ntag of the desired tag and/or name and no \\`disallowName\\` (or \\`allowName\\`) is\nsupplied. In such a case, only one error will be reported, but no fixer will\nbe applied, however.\n`,\n items: {\n additionalProperties: false,\n properties: {\n allowName: {\n description: `Indicates which names are allowed for the given tag (or \\`*\\`).\nAccepts a string regular expression (optionally wrapped between two\n\\`/\\` delimiters followed by optional flags) used to match the name.`,\n type: 'string',\n },\n comment: {\n description: 'As with `context` but AST for the JSDoc block comment and types.',\n type: 'string',\n },\n context: {\n description: `AST to confine the allowing or disallowing to JSDoc blocks\nassociated with a particular context. See the\n[\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n type: 'string',\n },\n disallowName: {\n description: 'As with `allowName` but indicates names that are not allowed.',\n type: 'string',\n },\n message: {\n description: 'An optional custom message to use when there is a match.',\n type: 'string',\n },\n replacement: {\n description: `If \\`disallowName\\` is supplied and this value is present, it\nwill replace the matched \\`disallowName\\` text.`,\n type: 'string',\n },\n tags: {\n description: `This array should include tag names or \\`*\\` to indicate the\n match will apply for all tags (except as confined by any context\n properties). If \\`*\\` is not used, then these rules will only apply to\n the specified tags. If \\`tags\\` is omitted, then \\`*\\` is assumed.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n },\n required: [\n 'match',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAA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U,EAAE;QACVpC,KAAK,EAAE;UACL+B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWM,KAAK,EAAE;YACLF,oBAAoB,EAAE,KAAK;YAC3BC,UAAU,EAAE;cACVlC,SAAS,EAAE;gBACT6B,WAAW,EAAE;AAC/B;AACA,qEAAqE;gBACnDO,IAAI,EAAE;cACR,CAAC;cACDC,OAAO,EAAE;gBACPR,WAAW,EAAE,kEAAkE;gBAC/EO,IAAI,EAAE;cACR,CAAC;cACD5C,OAAO,EAAE;gBACPqC,WAAW,EAAE;AAC/B;AACA;AACA,8DAA8D;gBAC5CO,IAAI,EAAE;cACR,CAAC;cACDnC,YAAY,EAAE;gBACZ4B,WAAW,EAAE,+DAA+D;gBAC5EO,IAAI,EAAE;cACR,CAAC;cACDb,OAAO,EAAE;gBACPM,WAAW,EAAE,0DAA0D;gBACvEO,IAAI,EAAE;cACR,CAAC;cACDlC,WAAW,EAAE;gBACX2B,WAAW,EAAE;AAC/B,gDAAgD;gBAC9BO,IAAI,EAAE;cACR,CAAC;cACDjC,IAAI,EAAE;gBACJ0B,WAAW,EAAE;AAC/B;AACA;AACA,qEAAqE;gBACnDM,KAAK,EAAE;kBACLC,IAAI,EAAE;gBACR,CAAC;gBACDA,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDE,QAAQ,EAAE,CACR,OAAO,CACR;MACDF,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAG,MAAA,CAAAjD,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
@@ -236,17 +236,17 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
236
236
  }) => {
237
237
  return !isInvalidSingleLine(tg);
238
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`.');
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
240
  return;
241
241
  }
242
242
  if (jsdoc.tags.length > 1) {
243
243
  if (!allowMultipleTags) {
244
- utils.reportJSDoc('Multiline jsdoc blocks are prohibited by ' + 'your configuration but the block has multiple tags.');
244
+ utils.reportJSDoc('Multiline JSDoc blocks are prohibited by ' + 'your configuration but the block has multiple tags.');
245
245
  return;
246
246
  }
247
247
  } else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {
248
248
  if (!allowMultipleTags) {
249
- utils.reportJSDoc('Multiline jsdoc blocks are prohibited by ' + 'your configuration but the block has a description with a tag.');
249
+ utils.reportJSDoc('Multiline JSDoc blocks are prohibited by ' + 'your configuration but the block has a description with a tag.');
250
250
  return;
251
251
  }
252
252
  } else {
@@ -298,7 +298,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
298
298
  }))
299
299
  }];
300
300
  };
301
- utils.reportJSDoc('Multiline jsdoc blocks are prohibited by ' + 'your configuration.', null, fixer);
301
+ utils.reportJSDoc('Multiline JSDoc blocks are prohibited by ' + 'your configuration.', null, fixer);
302
302
  return;
303
303
  }
304
304
  }
@@ -307,7 +307,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
307
307
  iterateAllJsdocs: true,
308
308
  meta: {
309
309
  docs: {
310
- description: 'Controls how and whether jsdoc blocks can be expressed as single or multiple line blocks.',
310
+ description: 'Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks.',
311
311
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header'
312
312
  },
313
313
  fixable: 'code',
@@ -315,9 +315,28 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
315
315
  additionalProperties: false,
316
316
  properties: {
317
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\`.`,
318
330
  type: 'boolean'
319
331
  },
320
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.`,
321
340
  type: 'integer'
322
341
  },
323
342
  multilineTags: {
@@ -329,24 +348,77 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
329
348
  type: 'string'
330
349
  },
331
350
  type: 'array'
332
- }]
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
+ `
333
367
  },
334
368
  noFinalLineText: {
369
+ description: `For multiline blocks, any non-whitespace text preceding the \`*/\` on the final
370
+ line will be reported. (Text preceding a newline is not reported.)
371
+
372
+ \`noMultilineBlocks\` will have priority over this rule if it applies.
373
+
374
+ Defaults to \`true\`.`,
335
375
  type: 'boolean'
336
376
  },
337
377
  noMultilineBlocks: {
378
+ description: `Requires that JSDoc blocks are restricted to single lines only unless impacted
379
+ by the options \`minimumLengthForMultiline\`, \`multilineTags\`, or
380
+ \`allowMultipleTags\`.
381
+
382
+ Defaults to \`false\`.`,
338
383
  type: 'boolean'
339
384
  },
340
385
  noSingleLineBlocks: {
386
+ description: `If this is \`true\`, any single line blocks will be reported, except those which
387
+ are whitelisted in \`singleLineTags\`.
388
+
389
+ Defaults to \`false\`.
390
+ `,
341
391
  type: 'boolean'
342
392
  },
343
393
  noZeroLineText: {
394
+ description: `For multiline blocks, any non-whitespace text immediately after the \`/**\` and
395
+ space will be reported. (Text after a newline is not reported.)
396
+
397
+ \`noMultilineBlocks\` will have priority over this rule if it applies.
398
+
399
+ Defaults to \`true\`.`,
344
400
  type: 'boolean'
345
401
  },
346
402
  requireSingleLineUnderCount: {
403
+ description: `If this number is set, it indicates a minimum line width for a single line of
404
+ JSDoc content spread over a multi-line comment block. If a single line is under
405
+ the minimum length, it will be reported so as to enforce single line JSDoc blocks
406
+ for such cases. Blocks are not reported which have multi-line descriptions,
407
+ multiple tags, a block description and tag, or tags with multi-line types or
408
+ descriptions.
409
+
410
+ Defaults to \`null\`.
411
+ `,
347
412
  type: 'number'
348
413
  },
349
414
  singleLineTags: {
415
+ description: `An array of tags which can nevertheless be allowed as single line blocks when
416
+ \`noSingleLineBlocks\` is set. You may set this to a empty array to
417
+ cause all single line blocks to be reported. If \`'*'\` is present, then
418
+ the presence of a tag will allow single line blocks (but not if a tag is
419
+ missing).
420
+
421
+ Defaults to \`['lends', 'type']\`.`,
350
422
  items: {
351
423
  type: 'string'
352
424
  },
@@ -1 +1 @@
1
- {"version":3,"file":"multilineBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","checkForShortTags","jsdoc","utils","requireSingleLineUnderCount","tags","length","lastLineWithTag","isUnderCountLimit","hasMultiDescOrType","tagLines","source","reduce","acc","tokens","delimiter","description","desc","name","postDelimiter","postName","postTag","postType","start","tag","type","idx","fixer","number","seedTokens","trimEnd","end","reportJSDoc","checkForShortDescriptions","lastLineWithDesc","descLines","_default","exports","iterateJsdoc","context","allowMultipleTags","minimumLengthForMultiline","Number","POSITIVE_INFINITY","multilineTags","noFinalLineText","noMultilineBlocks","noSingleLineBlocks","noZeroLineText","singleLineTags","options","sourceLength","isInvalidSingleLine","tagName","includes","slice","makeMultiline","lineChecks","line","emptyTokens","addLine","finalLine","finalLineTokens","trim","prop","hasATag","filterTags","tg","obj","lineEnd","nme","typ","nameOrDescription","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","anyOf","enum","items","module"],"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 type: 'boolean',\n },\n minimumLengthForMultiline: {\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 },\n noFinalLineText: {\n type: 'boolean',\n },\n noMultilineBlocks: {\n type: 'boolean',\n },\n noSingleLineBlocks: {\n type: 'boolean',\n },\n noZeroLineText: {\n type: 'boolean',\n },\n requireSingleLineUnderCount: {\n type: 'number',\n },\n singleLineTags: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAMG,iBAAiB,GAAGA,CAACC,KAAK,EAAEC,KAAK,EAAEC,2BAA2B,KAAK;EACvE,IAAI,CAACA,2BAA2B,IAAI,CAACF,KAAK,CAACG,IAAI,CAACC,MAAM,EAAE;IACtD,OAAO,KAAK;EACd;EAEA,IAAIC,eAAe,GAAG,CAAC;EACvB,IAAIC,iBAAiB,GAAG,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qBAAqB,EACvB,IAAI,EACJL,KACF,CAAC;MAED;IACF;EACF;EAEA8B,UAAU,CAAC,CAAC;AACd,CAAC,EAAE;EACDgB,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJ3D,WAAW,EAAE,2FAA2F;MACxG4D,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVxC,iBAAiB,EAAE;UACjBf,IAAI,EAAE;QACR,CAAC;QACDgB,yBAAyB,EAAE;UACzBhB,IAAI,EAAE;QACR,CAAC;QACDmB,aAAa,EAAE;UACbqC,KAAK,EAAE,CACL;YACEC,IAAI,EAAE,CACJ,GAAG,CACJ;YACDzD,IAAI,EAAE;UACR,CAAC,EAAE;YACD0D,KAAK,EAAE;cACL1D,IAAI,EAAE;YACR,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACDoB,eAAe,EAAE;UACfpB,IAAI,EAAE;QACR,CAAC;QACDqB,iBAAiB,EAAE;UACjBrB,IAAI,EAAE;QACR,CAAC;QACDsB,kBAAkB,EAAE;UAClBtB,IAAI,EAAE;QACR,CAAC;QACDuB,cAAc,EAAE;UACdvB,IAAI,EAAE;QACR,CAAC;QACDrB,2BAA2B,EAAE;UAC3BqB,IAAI,EAAE;QACR,CAAC;QACDwB,cAAc,EAAE;UACdkC,KAAK,EAAE;YACL1D,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA2D,MAAA,CAAA/C,OAAA,GAAAA,OAAA,CAAArC,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"multilineBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","checkForShortTags","jsdoc","utils","requireSingleLineUnderCount","tags","length","lastLineWithTag","isUnderCountLimit","hasMultiDescOrType","tagLines","source","reduce","acc","tokens","delimiter","description","desc","name","postDelimiter","postName","postTag","postType","start","tag","type","idx","fixer","number","seedTokens","trimEnd","end","reportJSDoc","checkForShortDescriptions","lastLineWithDesc","descLines","_default","exports","iterateJsdoc","context","allowMultipleTags","minimumLengthForMultiline","Number","POSITIVE_INFINITY","multilineTags","noFinalLineText","noMultilineBlocks","noSingleLineBlocks","noZeroLineText","singleLineTags","options","sourceLength","isInvalidSingleLine","tagName","includes","slice","makeMultiline","lineChecks","line","emptyTokens","addLine","finalLine","finalLineTokens","trim","prop","hasATag","filterTags","tg","obj","lineEnd","nme","typ","nameOrDescription","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","anyOf","enum","items","module"],"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 },\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`,\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`,\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: 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E;UACR,CAAC,CACF;UACDT,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;QACU,CAAC;QACD6B,eAAe,EAAE;UACf7B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACVS,IAAI,EAAE;QACR,CAAC;QACDqB,iBAAiB,EAAE;UACjB9B,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXS,IAAI,EAAE;QACR,CAAC;QACDsB,kBAAkB,EAAE;UAClB/B,WAAW,EAAE;AACzB;AACA;AACA;AACA,CAAC;UACWS,IAAI,EAAE;QACR,CAAC;QACDuB,cAAc,EAAE;UACdhC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACVS,IAAI,EAAE;QACR,CAAC;QACDrB,2BAA2B,EAAE;UAC3BY,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWS,IAAI,EAAE;QACR,CAAC;QACDwB,cAAc,EAAE;UACdjC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,mCAAmC;UACvBmE,KAAK,EAAE;YACL1D,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA2D,MAAA,CAAA/C,OAAA,GAAAA,OAAA,CAAArC,OAAA","ignoreList":[]}