eslint-plugin-jsdoc 58.1.1 → 59.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.
- package/README.md +66 -62
- package/dist/buildForbidRuleDefinition.cjs +0 -1
- package/dist/buildForbidRuleDefinition.cjs.map +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.cjs +7 -2
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
- package/dist/cjs/rules/convertToJsdocComments.d.ts +7 -0
- package/dist/generateDocs.cjs +129 -3
- package/dist/generateDocs.cjs.map +1 -1
- package/dist/generateRule.cjs +3 -1
- package/dist/generateRule.cjs.map +1 -1
- package/dist/generateRuleTypes.cjs +5 -5
- package/dist/generateRuleTypes.cjs.map +1 -1
- package/dist/index-cjs.cjs +30 -0
- package/dist/index-cjs.cjs.map +1 -1
- package/dist/index.cjs +30 -0
- package/dist/index.cjs.map +1 -1
- package/dist/rules/checkAccess.cjs +1 -1
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +4 -1
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +1 -1
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +19 -0
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +25 -1
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +62 -1
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +6 -0
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +71 -0
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +16 -1
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +17 -1
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +48 -0
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.d.ts +7 -0
- package/dist/rules/emptyTags.cjs +10 -1
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.cjs +15 -1
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +45 -0
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +14 -0
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +129 -0
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +30 -0
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +78 -6
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +11 -2
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.cjs +3 -1
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noDefaults.cjs +19 -0
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.cjs +22 -2
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +29 -0
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +17 -1
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +17 -1
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +11 -1
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +28 -0
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +30 -1
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +27 -0
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireExample.cjs +26 -1
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +61 -0
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +20 -2
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +82 -3
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +213 -1
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamDescription.cjs +21 -0
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +16 -1
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamType.cjs +21 -1
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requirePropertyName.cjs +1 -1
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyType.cjs +1 -1
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +54 -1
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +22 -1
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +15 -1
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsType.cjs +15 -1
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +17 -1
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireThrows.cjs +18 -1
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +50 -1
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +25 -7
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +200 -1
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +32 -2
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +5 -1
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/typeFormatting.cjs +47 -10
- package/dist/rules/typeFormatting.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +8 -1
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/rules.d.ts +2130 -32
- package/package.json +1 -1
- package/src/buildForbidRuleDefinition.js +0 -1
- package/src/buildRejectOrPreferRuleDefinition.js +12 -2
- package/src/index-cjs.js +36 -0
- package/src/index.js +36 -0
- package/src/rules/checkAccess.js +1 -1
- package/src/rules/checkAlignment.js +3 -0
- package/src/rules/checkExamples.js +1 -1
- package/src/rules/checkIndentation.js +19 -0
- package/src/rules/checkLineAlignment.js +24 -0
- package/src/rules/checkParamNames.js +62 -1
- package/src/rules/checkPropertyNames.js +6 -0
- package/src/rules/checkTagNames.js +71 -0
- package/src/rules/checkTypes.js +16 -1
- package/src/rules/checkValues.js +16 -0
- package/src/rules/convertToJsdocComments.js +48 -0
- package/src/rules/emptyTags.js +10 -1
- package/src/rules/implementsOnClasses.js +15 -1
- package/src/rules/informativeDocs.js +45 -0
- package/src/rules/linesBeforeBlock.js +14 -0
- package/src/rules/matchDescription.js +129 -0
- package/src/rules/matchName.js +30 -0
- package/src/rules/multilineBlocks.js +77 -5
- package/src/rules/noBadBlocks.js +11 -2
- package/src/rules/noBlankBlockDescriptions.js +1 -1
- package/src/rules/noBlankBlocks.js +2 -0
- package/src/rules/noDefaults.js +19 -0
- package/src/rules/noMissingSyntax.js +22 -2
- package/src/rules/noMultiAsterisks.js +29 -0
- package/src/rules/noRestrictedSyntax.js +17 -1
- package/src/rules/noTypes.js +17 -1
- package/src/rules/noUndefinedTypes.js +11 -1
- package/src/rules/requireAsteriskPrefix.js +28 -0
- package/src/rules/requireDescription.js +30 -1
- package/src/rules/requireDescriptionCompleteSentence.js +27 -0
- package/src/rules/requireExample.js +26 -1
- package/src/rules/requireFileOverview.js +61 -0
- package/src/rules/requireHyphenBeforeParamDescription.js +19 -1
- package/src/rules/requireJsdoc.js +80 -1
- package/src/rules/requireParam.js +213 -1
- package/src/rules/requireParamDescription.js +21 -0
- package/src/rules/requireParamName.js +16 -1
- package/src/rules/requireParamType.js +21 -1
- package/src/rules/requirePropertyName.js +1 -1
- package/src/rules/requirePropertyType.js +1 -1
- package/src/rules/requireReturns.js +54 -1
- package/src/rules/requireReturnsCheck.js +22 -1
- package/src/rules/requireReturnsDescription.js +15 -1
- package/src/rules/requireReturnsType.js +15 -1
- package/src/rules/requireTemplate.js +17 -1
- package/src/rules/requireThrows.js +18 -1
- package/src/rules/requireYields.js +50 -1
- package/src/rules/requireYieldsCheck.js +25 -7
- package/src/rules/sortTags.js +200 -1
- package/src/rules/tagLines.js +30 -0
- package/src/rules/textEscaping.js +5 -1
- package/src/rules/typeFormatting.js +44 -7
- package/src/rules/validTypes.js +8 -1
- package/src/rules.d.ts +2130 -32
- package/typings/gitdown.d.ts +4 -0
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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: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,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: '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,KAAK;EAC7B,IAAIC,kBAAkB,GAAG,KAAK;EAC9B,MAAMC,QAAQ,GAAGR,KAAK,CAACS,MAAM,CAACC,MAAM,CAAC,CAACC,GAAG,EAAE;IACzCC,MAAM,EAAE;MACNC,SAAS;MACTC,WAAW,EAAEC,IAAI;MACjBC,IAAI;MACJC,aAAa;MACbC,QAAQ;MACRC,OAAO;MACPC,QAAQ;MACRC,KAAK;MACLC,GAAG;MACHC;IACF;EACF,C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E,KAAK;MAC3BC,UAAU,EAAE;QACVxC,iBAAiB,EAAE;UACjBxB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACVS,IAAI,EAAE;QACR,CAAC;QACDgB,yBAAyB,EAAE;UACzBzB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,iCAAiC;UACrBS,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,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":[]}
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
|
|
8
8
|
var _commentParser = require("comment-parser");
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
// Neither a single nor 3+ asterisks are valid
|
|
10
|
+
// Neither a single nor 3+ asterisks are valid JSDoc per
|
|
11
11
|
// https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code
|
|
12
12
|
const commentRegexp = /^\/\*(?!\*)/v;
|
|
13
13
|
const extraAsteriskCommentRegexp = /^\/\*{3,}/v;
|
|
@@ -66,7 +66,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
66
66
|
checkFile: true,
|
|
67
67
|
meta: {
|
|
68
68
|
docs: {
|
|
69
|
-
description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a
|
|
69
|
+
description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block.',
|
|
70
70
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md#repos-sticky-header'
|
|
71
71
|
},
|
|
72
72
|
fixable: 'code',
|
|
@@ -74,12 +74,21 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
74
74
|
additionalProperties: false,
|
|
75
75
|
properties: {
|
|
76
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
|
+
`,
|
|
77
83
|
items: {
|
|
78
84
|
type: 'string'
|
|
79
85
|
},
|
|
80
86
|
type: 'array'
|
|
81
87
|
},
|
|
82
88
|
preventAllMultiAsteriskBlocks: {
|
|
89
|
+
description: `A boolean (defaulting to \`false\`) which if \`true\` will prevent all
|
|
90
|
+
JSDoc-like blocks with more than two initial asterisks even those without
|
|
91
|
+
apparent tag content.`,
|
|
83
92
|
type: 'boolean'
|
|
84
93
|
}
|
|
85
94
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noBadBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_commentParser","e","__esModule","default","commentRegexp","extraAsteriskCommentRegexp","_default","exports","iterateJsdoc","allComments","context","makeReport","sourceCode","ignore","preventAllMultiAsteriskBlocks","options","extraAsterisks","nonJsdocNodes","filter","comment","commentText","getText","initialText","replace","trimStart","some","directive","startsWith","sliceIndex","test","multiline","exec","length","tags","commentParser","slice","tag","includes","node","report","fix","fixer","text","replaceText","checkFile","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","module"],"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
|
|
1
|
+
{"version":3,"file":"noBadBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_commentParser","e","__esModule","default","commentRegexp","extraAsteriskCommentRegexp","_default","exports","iterateJsdoc","allComments","context","makeReport","sourceCode","ignore","preventAllMultiAsteriskBlocks","options","extraAsterisks","nonJsdocNodes","filter","comment","commentText","getText","initialText","replace","trimStart","some","directive","startsWith","sliceIndex","test","multiline","exec","length","tags","commentParser","slice","tag","includes","node","report","fix","fixer","text","replaceText","checkFile","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","module"],"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`,\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 ],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEwB,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExB;AACA;AACA,MAAMG,aAAa,GAAG,cAAc;AACpC,MAAMC,0BAA0B,GAAG,YAAY;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEjC,IAAAK,qBAAY,EAAC,CAAC;EAC3BC,WAAW;EACXC,OAAO;EACPC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,MAAM,CACJ;IACEC,MAAM,GAAG,CACP,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,YAAY,CACb;IACDC,6BAA6B,GAAG;EAClC,CAAC,GAAG,CAAC,CAAC,CACP,GAAGJ,OAAO,CAACK,OAAO;EAEnB,IAAIC,cAAc,GAAG,KAAK;EAC1B,MAAMC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AIrB,aAAa,EAAE;IAChC,MAAMsB,MAAM,GAAG,sDACb5B,UAAU,CACVD,OAAO,EAAE4B,IAAI,CAAC;;IAEhB;IACA,MAAME,GAAG,GAAG,gDAAkDC,KAAK,IAAK;MACtE,MAAMC,IAAI,GAAG9B,UAAU,CAACS,OAAO,CAACiB,IAAI,CAAC;MAErC,OAAOG,KAAK,CAACE,WAAW,CACtBL,IAAI,EACJtB,cAAc,GACZ0B,IAAI,CAACnB,OAAO,CAAClB,0BAA0B,EAAE,KAAK,CAAC,GAC/CqC,IAAI,CAACnB,OAAO,CAAC,IAAI,EAAE,KAAK,CAC5B,CAAC;IACH,CAAC;IAEDgB,MAAM,CAAC,0DAA0D,EAAEC,GAAG,CAAC;EACzE;AACF,CAAC,EAAE;EACDI,SAAS,EAAE,IAAI;EACfC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,kGAAkG;MAC/GC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVvC,MAAM,EAAE;UACNkC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,CAAC;UACWM,KAAK,EAAE;YACLC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDxC,6BAA6B,EAAE;UAC7BiC,WAAW,EAAE;AACzB;AACA,sBAAsB;UACVO,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,MAAA,CAAAhD,OAAA,GAAAA,OAAA,CAAAJ,OAAA","ignoreList":[]}
|
|
@@ -51,7 +51,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
51
51
|
iterateAllJsdocs: true,
|
|
52
52
|
meta: {
|
|
53
53
|
docs: {
|
|
54
|
-
description: '
|
|
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
55
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header'
|
|
56
56
|
},
|
|
57
57
|
fixable: 'whitespace',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noBlankBlockDescriptions.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","anyWhitespaceLines","atLeastTwoLinesWhitespace","_default","exports","iterateJsdoc","jsdoc","utils","description","descriptions","lastDescriptionLine","getDescription","regex","tags","length","test","reportJSDoc","line","setBlockDescription","info","seedTokens","number","source","tokens","iterateAllJsdocs","meta","docs","url","fixable","schema","type","module"],"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: '
|
|
1
|
+
{"version":3,"file":"noBlankBlockDescriptions.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","anyWhitespaceLines","atLeastTwoLinesWhitespace","_default","exports","iterateJsdoc","jsdoc","utils","description","descriptions","lastDescriptionLine","getDescription","regex","tags","length","test","reportJSDoc","line","setBlockDescription","info","seedTokens","number","source","tokens","iterateAllJsdocs","meta","docs","url","fixable","schema","type","module"],"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,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C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AAI,EAAE;MACJlB,WAAW,EAAE,8KAA8K;MAC3LmB,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,YAAY;IACrBC,MAAM,EAAE,EAAE;IACVC,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,MAAA,CAAA3B,OAAA,GAAAA,OAAA,CAAAJ,OAAA","ignoreList":[]}
|
|
@@ -41,9 +41,11 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
41
41
|
additionalProperties: false,
|
|
42
42
|
properties: {
|
|
43
43
|
enableFixer: {
|
|
44
|
+
description: 'Whether or not to auto-remove the blank block. Defaults to `false`.',
|
|
44
45
|
type: 'boolean'
|
|
45
46
|
}
|
|
46
|
-
}
|
|
47
|
+
},
|
|
48
|
+
type: 'object'
|
|
47
49
|
}],
|
|
48
50
|
type: 'suggestion'
|
|
49
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noBlankBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","jsdoc","utils","tags","length","description","lastDescriptionLine","getDescription","trim","enableFixer","options","reportJSDoc","line","source","splice","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","type","module"],"sources":["../../src/rules/noBlankBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n if (jsdoc.tags.length) {\n return;\n }\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n if (description.trim()) {\n return;\n }\n\n const {\n enableFixer,\n } = context.options[0] || {};\n\n utils.reportJSDoc(\n 'No empty blocks',\n {\n line: lastDescriptionLine,\n },\n enableFixer ? () => {\n jsdoc.source.splice(0);\n } : null,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Removes empty blocks with nothing but possibly line breaks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n enableFixer: {\n type: 'boolean',\n },\n },\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,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,IAAID,KAAK,CAACE,IAAI,CAACC,MAAM,EAAE;IACrB;EACF;EAEA,MAAM;IACJC,WAAW;IACXC;EACF,CAAC,GAAGJ,KAAK,CAACK,cAAc,CAAC,CAAC;EAC1B,IAAIF,WAAW,CAACG,IAAI,CAAC,CAAC,EAAE;IACtB;EACF;EAEA,MAAM;IACJC;EACF,CAAC,GAAGT,OAAO,CAACU,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5BR,KAAK,CAACS,WAAW,CACf,iBAAiB,EACjB;IACEC,IAAI,EAAEN;EACR,CAAC,EACDG,WAAW,GAAG,MAAM;IAClBR,KAAK,CAACY,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC;EACxB,CAAC,GAAG,IACN,CAAC;AACH,CAAC,EAAE;EACDC,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJZ,WAAW,EAAE,4DAA4D;MACzEa,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVb,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"noBlankBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","jsdoc","utils","tags","length","description","lastDescriptionLine","getDescription","trim","enableFixer","options","reportJSDoc","line","source","splice","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","type","module"],"sources":["../../src/rules/noBlankBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n if (jsdoc.tags.length) {\n return;\n }\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n if (description.trim()) {\n return;\n }\n\n const {\n enableFixer,\n } = context.options[0] || {};\n\n utils.reportJSDoc(\n 'No empty blocks',\n {\n line: lastDescriptionLine,\n },\n enableFixer ? () => {\n jsdoc.source.splice(0);\n } : null,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Removes empty blocks with nothing but possibly line breaks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n enableFixer: {\n description: 'Whether or not to auto-remove the blank block. Defaults to `false`.',\n type: 'boolean',\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;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,IAAID,KAAK,CAACE,IAAI,CAACC,MAAM,EAAE;IACrB;EACF;EAEA,MAAM;IACJC,WAAW;IACXC;EACF,CAAC,GAAGJ,KAAK,CAACK,cAAc,CAAC,CAAC;EAC1B,IAAIF,WAAW,CAACG,IAAI,CAAC,CAAC,EAAE;IACtB;EACF;EAEA,MAAM;IACJC;EACF,CAAC,GAAGT,OAAO,CAACU,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5BR,KAAK,CAACS,WAAW,CACf,iBAAiB,EACjB;IACEC,IAAI,EAAEN;EACR,CAAC,EACDG,WAAW,GAAG,MAAM;IAClBR,KAAK,CAACY,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC;EACxB,CAAC,GAAG,IACN,CAAC;AACH,CAAC,EAAE;EACDC,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJZ,WAAW,EAAE,4DAA4D;MACzEa,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVb,WAAW,EAAE;UACXJ,WAAW,EAAE,qEAAqE;UAClFkB,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,MAAA,CAAA1B,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
|
@@ -52,6 +52,20 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
52
52
|
additionalProperties: false,
|
|
53
53
|
properties: {
|
|
54
54
|
contexts: {
|
|
55
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
56
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
57
|
+
|
|
58
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
59
|
+
|
|
60
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
61
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
62
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
63
|
+
for finding function blocks not attached to a function declaration or
|
|
64
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
65
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
66
|
+
|
|
67
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
68
|
+
section of our Advanced docs for more on the expected format.`,
|
|
55
69
|
items: {
|
|
56
70
|
anyOf: [{
|
|
57
71
|
type: 'string'
|
|
@@ -71,6 +85,11 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
71
85
|
type: 'array'
|
|
72
86
|
},
|
|
73
87
|
noOptionalParamNames: {
|
|
88
|
+
description: `Set this to \`true\` to report the presence of optional parameters. May be
|
|
89
|
+
used if the project is insisting on optionality being indicated by
|
|
90
|
+
the presence of ES6 default parameters (bearing in mind that such
|
|
91
|
+
"defaults" are only applied when the supplied value is missing or
|
|
92
|
+
\`undefined\` but not for \`null\` or other "falsey" values).`,
|
|
74
93
|
type: 'boolean'
|
|
75
94
|
}
|
|
76
95
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noDefaults.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","utils","noOptionalParamNames","options","paramTags","getPresentTags","tag","optional","reportJSDoc","changeTag","name","replace","defaultTags","description","trim","postTag","contextDefaults","meta","docs","url","fixable","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","module"],"sources":["../../src/rules/noDefaults.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n const {\n noOptionalParamNames,\n } = context.options[0] || {};\n const paramTags = utils.getPresentTags([\n 'param', 'arg', 'argument',\n ]);\n for (const tag of paramTags) {\n if (noOptionalParamNames && tag.optional) {\n utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '$1'),\n });\n });\n } else if (tag.default) {\n utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '[$1]'),\n });\n });\n }\n }\n\n const defaultTags = utils.getPresentTags([\n 'default', 'defaultvalue',\n ]);\n for (const tag of defaultTags) {\n if (tag.description.trim()) {\n utils.reportJSDoc(`Default values are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n description: '',\n postTag: '',\n });\n });\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'This rule reports defaults being used on the relevant portion of `@param` or `@default`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-defaults.md#repos-sticky-header',\n },\n fixable: 'code',\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 noOptionalParamNames: {\n type: 'boolean',\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;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC;EACF,CAAC,GAAGF,OAAO,CAACG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAC5B,MAAMC,SAAS,GAAGH,KAAK,CAACI,cAAc,CAAC,CACrC,OAAO,EAAE,KAAK,EAAE,UAAU,CAC3B,CAAC;EACF,KAAK,MAAMC,GA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E,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"noDefaults.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","utils","noOptionalParamNames","options","paramTags","getPresentTags","tag","optional","reportJSDoc","changeTag","name","replace","defaultTags","description","trim","postTag","contextDefaults","meta","docs","url","fixable","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","module"],"sources":["../../src/rules/noDefaults.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n const {\n noOptionalParamNames,\n } = context.options[0] || {};\n const paramTags = utils.getPresentTags([\n 'param', 'arg', 'argument',\n ]);\n for (const tag of paramTags) {\n if (noOptionalParamNames && tag.optional) {\n utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '$1'),\n });\n });\n } else if (tag.default) {\n utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '[$1]'),\n });\n });\n }\n }\n\n const defaultTags = utils.getPresentTags([\n 'default', 'defaultvalue',\n ]);\n for (const tag of defaultTags) {\n if (tag.description.trim()) {\n utils.reportJSDoc(`Default values are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n description: '',\n postTag: '',\n });\n });\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'This rule reports defaults being used on the relevant portion of `@param` or `@default`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-defaults.md#repos-sticky-header',\n },\n fixable: 'code',\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.\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\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\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 noOptionalParamNames: {\n description: `Set this to \\`true\\` to report the presence of optional parameters. May be\nused if the project is insisting on optionality being indicated by\nthe presence of ES6 default parameters (bearing in mind that such\n\"defaults\" are only applied when the supplied value is missing or\n\\`undefined\\` but not for \\`null\\` or other \"falsey\" values).`,\n type: 'boolean',\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;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC;EACF,CAAC,GAAGF,OAAO,CAACG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAC5B,MAAMC,SAAS,GAAGH,KAAK,CAACI,cAAc,CAAC,CACrC,OAAO,EAAE,KAAK,EAAE,UAAU,CAC3B,CAAC;EACF,KAAK,MAA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M,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,QAAQ,EAAE;UACRX,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClDY,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;gBACD3B,OAAO,EAAE;kBACP2B,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDzB,oBAAoB,EAAE;UACpBW,WAAW,EAAE;AACzB;AACA;AACA;AACA,8DAA8D;UAClDc,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAE,MAAA,CAAA/B,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
|
@@ -99,7 +99,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
99
99
|
// Report when MISSING
|
|
100
100
|
contexts.some(cntxt => {
|
|
101
101
|
const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;
|
|
102
|
-
const comment = typeof cntxt === 'string' ? '' : cntxt?.comment;
|
|
102
|
+
const comment = typeof cntxt === 'string' ? '' : cntxt?.comment ?? '';
|
|
103
103
|
const contextKey = contextStr === 'any' ? 'undefined' : contextStr;
|
|
104
104
|
if ((!state.selectorMap[contextKey] || !state.selectorMap[contextKey][comment] || state.selectorMap[contextKey][comment] < (
|
|
105
105
|
// @ts-expect-error comment would need an object, not string
|
|
@@ -137,11 +137,31 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
137
137
|
description: 'Reports when certain comment structures are always expected.',
|
|
138
138
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.md#repos-sticky-header'
|
|
139
139
|
},
|
|
140
|
-
fixable: 'code',
|
|
141
140
|
schema: [{
|
|
142
141
|
additionalProperties: false,
|
|
143
142
|
properties: {
|
|
144
143
|
contexts: {
|
|
144
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
145
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
146
|
+
|
|
147
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
148
|
+
|
|
149
|
+
Use the \`minimum\` property (defaults to 1) to indicate how many are required
|
|
150
|
+
for the rule to be reported.
|
|
151
|
+
|
|
152
|
+
Use the \`message\` property to indicate the specific error to be shown when an
|
|
153
|
+
error is reported for that context being found missing. You may use
|
|
154
|
+
\`{{context}}\` and \`{{comment}}\` with such messages. Defaults to
|
|
155
|
+
\`"Syntax is required: {{context}}"\`, or with a comment, to
|
|
156
|
+
\`"Syntax is required: {{context}} with {{comment}}"\`.
|
|
157
|
+
|
|
158
|
+
Set to \`"any"\` if you want the rule to apply to any JSDoc block throughout
|
|
159
|
+
your files (as is necessary for finding function blocks not attached to a
|
|
160
|
+
function declaration or expression, i.e., \`@callback\` or \`@function\` (or its
|
|
161
|
+
aliases \`@func\` or \`@method\`) (including those associated with an \`@interface\`).
|
|
162
|
+
|
|
163
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
164
|
+
section of our Advanced docs for more on the expected format.`,
|
|
145
165
|
items: {
|
|
146
166
|
anyOf: [{
|
|
147
167
|
type: 'string'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noMissingSyntax.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","setDefaults","state","selectorMap","incrementSelector","selector","comment","_default","exports","iterateJsdoc","context","info","utils","options","contexts","contextStr","findContext","String","contextSelected","exit","settings","length","report","loc","end","column","line","start","message","some","cntxt","contextKey","minimum","Object","values","every","cmmnt","data","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type","module"],"sources":["../../src/rules/noMissingSyntax.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {{\n * comment: string,\n * context: string,\n * message: string,\n * minimum: import('../iterateJsdoc.js').Integer\n * }} ContextObject\n */\n\n/**\n * @typedef {string|ContextObject} Context\n */\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @returns {void}\n */\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @param {string} selector\n * @param {string} comment\n * @returns {void}\n */\nconst incrementSelector = (state, selector, comment) => {\n if (!state.selectorMap[selector]) {\n state.selectorMap[selector] = {};\n }\n\n if (!state.selectorMap[selector][comment]) {\n state.selectorMap[selector][comment] = 0;\n }\n\n state.selectorMap[selector][comment]++;\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n state,\n utils,\n}) => {\n if (!context.options[0]) {\n // Handle error later\n return;\n }\n\n /**\n * @type {Context[]}\n */\n const contexts = context.options[0].contexts;\n\n const {\n contextStr,\n } = utils.findContext(contexts, comment);\n\n setDefaults(state);\n\n incrementSelector(state, contextStr, String(comment));\n}, {\n contextSelected: true,\n exit ({\n context,\n settings,\n state,\n }) {\n if (!context.options.length && !settings.contexts) {\n context.report({\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `contexts` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n\n /**\n * @type {Context[]}\n */\n const contexts = (context.options[0] ?? {}).contexts ?? settings?.contexts;\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = typeof cntxt === 'string' ? '' : cntxt?.comment;\n\n const contextKey = contextStr === 'any' ? 'undefined' : contextStr;\n\n if (\n (!state.selectorMap[contextKey] ||\n !state.selectorMap[contextKey][comment] ||\n state.selectorMap[contextKey][comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n )) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n );\n }))\n ) {\n const message = typeof cntxt === 'string' ?\n 'Syntax is required: {{context}}' :\n cntxt?.message ?? ('Syntax is required: {{context}}' +\n (comment ? ' with {{comment}}' : ''));\n context.report({\n data: {\n comment,\n context: contextStr,\n },\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message,\n });\n\n return true;\n }\n\n return false;\n });\n },\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are always expected.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.md#repos-sticky-header',\n },\n fixable: 'code',\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 message: {\n type: 'string',\n },\n minimum: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\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;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAMG,WAAW,GAAIC,KAAK,IA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;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,MAAA,CAAA1C,OAAA,GAAAA,OAAA,CAAAR,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"noMissingSyntax.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","setDefaults","state","selectorMap","incrementSelector","selector","comment","_default","exports","iterateJsdoc","context","info","utils","options","contexts","contextStr","findContext","String","contextSelected","exit","settings","length","report","loc","end","column","line","start","message","some","cntxt","contextKey","minimum","Object","values","every","cmmnt","data","matchContext","meta","docs","description","url","schema","additionalProperties","properties","items","anyOf","type","module"],"sources":["../../src/rules/noMissingSyntax.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {{\n * comment: string,\n * context: string,\n * message: string,\n * minimum: import('../iterateJsdoc.js').Integer\n * }} ContextObject\n */\n\n/**\n * @typedef {string|ContextObject} Context\n */\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @returns {void}\n */\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @param {string} selector\n * @param {string} comment\n * @returns {void}\n */\nconst incrementSelector = (state, selector, comment) => {\n if (!state.selectorMap[selector]) {\n state.selectorMap[selector] = {};\n }\n\n if (!state.selectorMap[selector][comment]) {\n state.selectorMap[selector][comment] = 0;\n }\n\n state.selectorMap[selector][comment]++;\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n state,\n utils,\n}) => {\n if (!context.options[0]) {\n // Handle error later\n return;\n }\n\n /**\n * @type {Context[]}\n */\n const contexts = context.options[0].contexts;\n\n const {\n contextStr,\n } = utils.findContext(contexts, comment);\n\n setDefaults(state);\n\n incrementSelector(state, contextStr, String(comment));\n}, {\n contextSelected: true,\n exit ({\n context,\n settings,\n state,\n }) {\n if (!context.options.length && !settings.contexts) {\n context.report({\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `contexts` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n\n /**\n * @type {Context[]}\n */\n const contexts = (context.options[0] ?? {}).contexts ?? settings?.contexts;\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = typeof cntxt === 'string' ? '' : cntxt?.comment ?? '';\n\n const contextKey = contextStr === 'any' ? 'undefined' : contextStr;\n\n if (\n (!state.selectorMap[contextKey] ||\n !state.selectorMap[contextKey][comment] ||\n state.selectorMap[contextKey][comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n )) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n );\n }))\n ) {\n const message = typeof cntxt === 'string' ?\n 'Syntax is required: {{context}}' :\n cntxt?.message ?? ('Syntax is required: {{context}}' +\n (comment ? ' with {{comment}}' : ''));\n context.report({\n data: {\n comment,\n context: contextStr,\n },\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message,\n });\n\n return true;\n }\n\n return false;\n });\n },\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are always expected.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.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.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nUse the \\`minimum\\` property (defaults to 1) to indicate how many are required\nfor the rule to be reported.\n\nUse the \\`message\\` property to indicate the specific error to be shown when an\nerror is reported for that context being found missing. You may use\n\\`{{context}}\\` and \\`{{comment}}\\` with such messages. Defaults to\n\\`\"Syntax is required: {{context}}\"\\`, or with a comment, to\n\\`\"Syntax is required: {{context}} with {{comment}}\"\\`.\n\nSet to \\`\"any\"\\` if you want the rule to apply to any JSDoc block throughout\nyour files (as is necessary for finding function blocks not attached to a\nfunction declaration or expression, i.e., \\`@callback\\` or \\`@function\\` (or its\naliases \\`@func\\` or \\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\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 message: {\n type: 'string',\n },\n minimum: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\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;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAMG,WAAW,GAAIC,KAAK,IAAK;EAC7B,IAAI,CAACA,KAAK,CAACC,WAAW,EAAE;IACtBD,KAAK,CAACC,WAAW,GAAG,CAAC,CAAC;EACxB;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAGA,CAACF,KAAK,EAAEG,QAAQ,EAAEC,OAAO,KAAK;EACtD,IAAI,CAACJ,KAAK,CAACC,WAAW,CAACE,QAAQ,CAAC,EAAE;IAChCH,KAAK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","ignoreList":[]}
|
|
@@ -79,12 +79,41 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
79
79
|
additionalProperties: false,
|
|
80
80
|
properties: {
|
|
81
81
|
allowWhitespace: {
|
|
82
|
+
description: `Set to \`true\` if you wish to allow asterisks after a space (as with Markdown):
|
|
83
|
+
|
|
84
|
+
\`\`\`js
|
|
85
|
+
/**
|
|
86
|
+
* *bold* text
|
|
87
|
+
*/
|
|
88
|
+
\`\`\`
|
|
89
|
+
|
|
90
|
+
Defaults to \`false\`.`,
|
|
82
91
|
type: 'boolean'
|
|
83
92
|
},
|
|
84
93
|
preventAtEnd: {
|
|
94
|
+
description: `Prevent the likes of this:
|
|
95
|
+
|
|
96
|
+
\`\`\`js
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
*
|
|
100
|
+
**/
|
|
101
|
+
\`\`\`
|
|
102
|
+
|
|
103
|
+
Defaults to \`true\`.`,
|
|
85
104
|
type: 'boolean'
|
|
86
105
|
},
|
|
87
106
|
preventAtMiddleLines: {
|
|
107
|
+
description: `Prevent the likes of this:
|
|
108
|
+
|
|
109
|
+
\`\`\`js
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
**
|
|
113
|
+
*/
|
|
114
|
+
\`\`\`
|
|
115
|
+
|
|
116
|
+
Defaults to \`true\`.`,
|
|
88
117
|
type: 'boolean'
|
|
89
118
|
}
|
|
90
119
|
},
|