eslint-plugin-jsdoc 53.0.1 → 54.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/dist/WarnSettings.cjs +35 -18
- package/dist/WarnSettings.cjs.map +1 -1
- package/dist/alignTransform.cjs +305 -224
- package/dist/alignTransform.cjs.map +1 -1
- package/dist/defaultTagOrder.cjs +43 -132
- package/dist/defaultTagOrder.cjs.map +1 -1
- package/dist/exportParser.cjs +696 -478
- package/dist/exportParser.cjs.map +1 -1
- package/dist/generateRule.cjs +242 -0
- package/dist/generateRule.cjs.map +1 -0
- package/dist/getDefaultTagStructureForMode.cjs +288 -184
- package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.cjs +550 -364
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.d.ts +65 -68
- package/dist/getJsdocProcessorPlugin.d.ts.map +1 -1
- package/dist/index.cjs +410 -2
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/iterateJsdoc.cjs +2005 -1539
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/iterateJsdoc.d.ts +350 -359
- package/dist/iterateJsdoc.d.ts.map +1 -1
- package/dist/jsdocUtils.cjs +1376 -1009
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkAccess.cjs +36 -29
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +54 -41
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +484 -327
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +65 -50
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +311 -220
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +335 -227
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +106 -78
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkSyntax.cjs +34 -21
- package/dist/rules/checkSyntax.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +210 -188
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTemplateNames.cjs +178 -121
- package/dist/rules/checkTemplateNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +385 -291
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +146 -100
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +306 -228
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/emptyTags.cjs +72 -62
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.cjs +56 -36
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/importsAsDependencies.cjs +99 -62
- package/dist/rules/importsAsDependencies.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +142 -105
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +105 -70
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +222 -160
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +128 -73
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +352 -235
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +86 -63
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs +57 -35
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.cjs +48 -26
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noDefaults.cjs +79 -52
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.cjs +165 -115
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +89 -48
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +79 -45
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +80 -59
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +388 -297
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +159 -108
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +129 -89
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +262 -201
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireExample.cjs +104 -73
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +129 -75
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +133 -85
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +557 -384
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +526 -336
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamDescription.cjs +80 -55
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +50 -32
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamType.cjs +80 -55
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requireProperty.cjs +42 -31
- package/dist/rules/requireProperty.cjs.map +1 -1
- package/dist/rules/requirePropertyDescription.cjs +25 -17
- package/dist/rules/requirePropertyDescription.cjs.map +1 -1
- package/dist/rules/requirePropertyName.cjs +25 -17
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyType.cjs +25 -17
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +203 -125
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +103 -60
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +54 -39
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsType.cjs +50 -32
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +178 -119
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireThrows.cjs +95 -61
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +166 -106
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +152 -96
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +444 -258
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +266 -179
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +127 -92
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +265 -252
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/tagNames.cjs +170 -134
- package/dist/tagNames.cjs.map +1 -1
- package/dist/utils/hasReturnValue.cjs +474 -246
- package/dist/utils/hasReturnValue.cjs.map +1 -1
- package/package.json +24 -40
- package/src/WarnSettings.js +34 -0
- package/src/alignTransform.js +358 -0
- package/src/defaultTagOrder.js +169 -0
- package/src/exportParser.js +978 -0
- package/src/getDefaultTagStructureForMode.js +969 -0
- package/src/getJsdocProcessorPlugin.js +672 -0
- package/src/index.js +530 -0
- package/src/iterateJsdoc.js +2541 -0
- package/src/jsdocUtils.js +1896 -0
- package/src/rules/checkAccess.js +45 -0
- package/src/rules/checkAlignment.js +63 -0
- package/src/rules/checkExamples.js +589 -0
- package/src/rules/checkIndentation.js +75 -0
- package/src/rules/checkLineAlignment.js +372 -0
- package/src/rules/checkParamNames.js +474 -0
- package/src/rules/checkPropertyNames.js +152 -0
- package/src/rules/checkSyntax.js +30 -0
- package/src/rules/checkTagNames.js +314 -0
- package/src/rules/checkTemplateNames.js +204 -0
- package/src/rules/checkTypes.js +535 -0
- package/src/rules/checkValues.js +248 -0
- package/src/rules/convertToJsdocComments.js +398 -0
- package/src/rules/emptyTags.js +98 -0
- package/src/rules/implementsOnClasses.js +64 -0
- package/src/rules/importsAsDependencies.js +133 -0
- package/src/rules/informativeDocs.js +189 -0
- package/src/rules/linesBeforeBlock.js +134 -0
- package/src/rules/matchDescription.js +286 -0
- package/src/rules/matchName.js +151 -0
- package/src/rules/multilineBlocks.js +493 -0
- package/src/rules/noBadBlocks.js +119 -0
- package/src/rules/noBlankBlockDescriptions.js +69 -0
- package/src/rules/noBlankBlocks.js +53 -0
- package/src/rules/noDefaults.js +85 -0
- package/src/rules/noMissingSyntax.js +195 -0
- package/src/rules/noMultiAsterisks.js +134 -0
- package/src/rules/noRestrictedSyntax.js +91 -0
- package/src/rules/noTypes.js +93 -0
- package/src/rules/noUndefinedTypes.js +543 -0
- package/src/rules/requireAsteriskPrefix.js +190 -0
- package/src/rules/requireDescription.js +161 -0
- package/src/rules/requireDescriptionCompleteSentence.js +335 -0
- package/src/rules/requireExample.js +118 -0
- package/src/rules/requireFileOverview.js +154 -0
- package/src/rules/requireHyphenBeforeParamDescription.js +176 -0
- package/src/rules/requireJsdoc.js +743 -0
- package/src/rules/requireParam.js +602 -0
- package/src/rules/requireParamDescription.js +89 -0
- package/src/rules/requireParamName.js +55 -0
- package/src/rules/requireParamType.js +89 -0
- package/src/rules/requireProperty.js +48 -0
- package/src/rules/requirePropertyDescription.js +25 -0
- package/src/rules/requirePropertyName.js +25 -0
- package/src/rules/requirePropertyType.js +25 -0
- package/src/rules/requireReturns.js +238 -0
- package/src/rules/requireReturnsCheck.js +145 -0
- package/src/rules/requireReturnsDescription.js +59 -0
- package/src/rules/requireReturnsType.js +51 -0
- package/src/rules/requireTemplate.js +201 -0
- package/src/rules/requireThrows.js +111 -0
- package/src/rules/requireYields.js +216 -0
- package/src/rules/requireYieldsCheck.js +208 -0
- package/src/rules/sortTags.js +558 -0
- package/src/rules/tagLines.js +359 -0
- package/src/rules/textEscaping.js +154 -0
- package/src/rules/validTypes.js +401 -0
- package/src/tagNames.js +238 -0
- package/src/utils/hasReturnValue.js +572 -0
- package/dist/WarnSettings.js +0 -20
- package/dist/WarnSettings.js.map +0 -1
- package/dist/_virtual/rolldown_runtime.cjs +0 -32
- package/dist/_virtual/rolldown_runtime.js +0 -11
- package/dist/alignTransform.js +0 -241
- package/dist/alignTransform.js.map +0 -1
- package/dist/defaultTagOrder.js +0 -134
- package/dist/defaultTagOrder.js.map +0 -1
- package/dist/exportParser.js +0 -518
- package/dist/exportParser.js.map +0 -1
- package/dist/getDefaultTagStructureForMode.js +0 -188
- package/dist/getDefaultTagStructureForMode.js.map +0 -1
- package/dist/getJsdocProcessorPlugin.d.cts +0 -70
- package/dist/getJsdocProcessorPlugin.d.cts.map +0 -1
- package/dist/getJsdocProcessorPlugin.js +0 -383
- package/dist/getJsdocProcessorPlugin.js.map +0 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.js +0 -3
- package/dist/iterateJsdoc.d.cts +0 -472
- package/dist/iterateJsdoc.d.cts.map +0 -1
- package/dist/iterateJsdoc.js +0 -1628
- package/dist/iterateJsdoc.js.map +0 -1
- package/dist/jsdocUtils.js +0 -1123
- package/dist/jsdocUtils.js.map +0 -1
- package/dist/plugin.cjs +0 -427
- package/dist/plugin.cjs.map +0 -1
- package/dist/plugin.js +0 -427
- package/dist/plugin.js.map +0 -1
- package/dist/rules/checkAccess.js +0 -33
- package/dist/rules/checkAccess.js.map +0 -1
- package/dist/rules/checkAlignment.js +0 -47
- package/dist/rules/checkAlignment.js.map +0 -1
- package/dist/rules/checkExamples.js +0 -348
- package/dist/rules/checkExamples.js.map +0 -1
- package/dist/rules/checkIndentation.js +0 -59
- package/dist/rules/checkIndentation.js.map +0 -1
- package/dist/rules/checkLineAlignment.js +0 -229
- package/dist/rules/checkLineAlignment.js.map +0 -1
- package/dist/rules/checkParamNames.js +0 -237
- package/dist/rules/checkParamNames.js.map +0 -1
- package/dist/rules/checkPropertyNames.js +0 -88
- package/dist/rules/checkPropertyNames.js.map +0 -1
- package/dist/rules/checkSyntax.js +0 -25
- package/dist/rules/checkSyntax.js.map +0 -1
- package/dist/rules/checkTagNames.js +0 -191
- package/dist/rules/checkTagNames.js.map +0 -1
- package/dist/rules/checkTemplateNames.js +0 -124
- package/dist/rules/checkTemplateNames.js.map +0 -1
- package/dist/rules/checkTypes.js +0 -299
- package/dist/rules/checkTypes.js.map +0 -1
- package/dist/rules/checkValues.js +0 -103
- package/dist/rules/checkValues.js.map +0 -1
- package/dist/rules/convertToJsdocComments.js +0 -231
- package/dist/rules/convertToJsdocComments.js.map +0 -1
- package/dist/rules/emptyTags.js +0 -67
- package/dist/rules/emptyTags.js.map +0 -1
- package/dist/rules/implementsOnClasses.js +0 -40
- package/dist/rules/implementsOnClasses.js.map +0 -1
- package/dist/rules/importsAsDependencies.js +0 -68
- package/dist/rules/importsAsDependencies.js.map +0 -1
- package/dist/rules/informativeDocs.js +0 -110
- package/dist/rules/informativeDocs.js.map +0 -1
- package/dist/rules/linesBeforeBlock.js +0 -75
- package/dist/rules/linesBeforeBlock.js.map +0 -1
- package/dist/rules/matchDescription.js +0 -167
- package/dist/rules/matchDescription.js.map +0 -1
- package/dist/rules/matchName.js +0 -77
- package/dist/rules/matchName.js.map +0 -1
- package/dist/rules/multilineBlocks.js +0 -245
- package/dist/rules/multilineBlocks.js.map +0 -1
- package/dist/rules/noBadBlocks.js +0 -68
- package/dist/rules/noBadBlocks.js.map +0 -1
- package/dist/rules/noBlankBlockDescriptions.js +0 -41
- package/dist/rules/noBlankBlockDescriptions.js.map +0 -1
- package/dist/rules/noBlankBlocks.js +0 -30
- package/dist/rules/noBlankBlocks.js.map +0 -1
- package/dist/rules/noDefaults.js +0 -56
- package/dist/rules/noDefaults.js.map +0 -1
- package/dist/rules/noMissingSyntax.js +0 -126
- package/dist/rules/noMissingSyntax.js.map +0 -1
- package/dist/rules/noMultiAsterisks.js +0 -58
- package/dist/rules/noMultiAsterisks.js.map +0 -1
- package/dist/rules/noRestrictedSyntax.js +0 -49
- package/dist/rules/noRestrictedSyntax.js.map +0 -1
- package/dist/rules/noTypes.js +0 -65
- package/dist/rules/noTypes.js.map +0 -1
- package/dist/rules/noUndefinedTypes.js +0 -303
- package/dist/rules/noUndefinedTypes.js.map +0 -1
- package/dist/rules/requireAsteriskPrefix.js +0 -112
- package/dist/rules/requireAsteriskPrefix.js.map +0 -1
- package/dist/rules/requireDescription.js +0 -95
- package/dist/rules/requireDescription.js.map +0 -1
- package/dist/rules/requireDescriptionCompleteSentence.js +0 -220
- package/dist/rules/requireDescriptionCompleteSentence.js.map +0 -1
- package/dist/rules/requireExample.js +0 -77
- package/dist/rules/requireExample.js.map +0 -1
- package/dist/rules/requireFileOverview.js +0 -81
- package/dist/rules/requireFileOverview.js.map +0 -1
- package/dist/rules/requireHyphenBeforeParamDescription.js +0 -89
- package/dist/rules/requireHyphenBeforeParamDescription.js.map +0 -1
- package/dist/rules/requireJsdoc.js +0 -404
- package/dist/rules/requireJsdoc.js.map +0 -1
- package/dist/rules/requireParam.js +0 -344
- package/dist/rules/requireParam.js.map +0 -1
- package/dist/rules/requireParamDescription.js +0 -59
- package/dist/rules/requireParamDescription.js.map +0 -1
- package/dist/rules/requireParamName.js +0 -36
- package/dist/rules/requireParamName.js.map +0 -1
- package/dist/rules/requireParamType.js +0 -59
- package/dist/rules/requireParamType.js.map +0 -1
- package/dist/rules/requireProperty.js +0 -35
- package/dist/rules/requireProperty.js.map +0 -1
- package/dist/rules/requirePropertyDescription.js +0 -21
- package/dist/rules/requirePropertyDescription.js.map +0 -1
- package/dist/rules/requirePropertyName.js +0 -21
- package/dist/rules/requirePropertyName.js.map +0 -1
- package/dist/rules/requirePropertyType.js +0 -21
- package/dist/rules/requirePropertyType.js.map +0 -1
- package/dist/rules/requireReturns.js +0 -131
- package/dist/rules/requireReturns.js.map +0 -1
- package/dist/rules/requireReturnsCheck.js +0 -66
- package/dist/rules/requireReturnsCheck.js.map +0 -1
- package/dist/rules/requireReturnsDescription.js +0 -43
- package/dist/rules/requireReturnsDescription.js.map +0 -1
- package/dist/rules/requireReturnsType.js +0 -36
- package/dist/rules/requireReturnsType.js.map +0 -1
- package/dist/rules/requireTemplate.js +0 -122
- package/dist/rules/requireTemplate.js.map +0 -1
- package/dist/rules/requireThrows.js +0 -67
- package/dist/rules/requireThrows.js.map +0 -1
- package/dist/rules/requireYields.js +0 -115
- package/dist/rules/requireYields.js.map +0 -1
- package/dist/rules/requireYieldsCheck.js +0 -105
- package/dist/rules/requireYieldsCheck.js.map +0 -1
- package/dist/rules/sortTags.js +0 -262
- package/dist/rules/sortTags.js.map +0 -1
- package/dist/rules/tagLines.js +0 -183
- package/dist/rules/tagLines.js.map +0 -1
- package/dist/rules/textEscaping.js +0 -102
- package/dist/rules/textEscaping.js.map +0 -1
- package/dist/rules/validTypes.js +0 -259
- package/dist/rules/validTypes.js.map +0 -1
- package/dist/tagNames.js +0 -144
- package/dist/tagNames.js.map +0 -1
- package/dist/utils/hasReturnValue.js +0 -265
- package/dist/utils/hasReturnValue.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/linesBeforeBlock.js
|
|
4
|
-
/**
|
|
5
|
-
* Punctuators that begin a logical group should not require a line before it skipped. Specifically
|
|
6
|
-
* `[` starts an array, `{` starts an object or block, `(` starts a grouping, and `=` starts a
|
|
7
|
-
* declaration (like a variable or a type alias).
|
|
8
|
-
*/
|
|
9
|
-
const startPunctuators = new Set([
|
|
10
|
-
"(",
|
|
11
|
-
"=",
|
|
12
|
-
"[",
|
|
13
|
-
"{"
|
|
14
|
-
]);
|
|
15
|
-
var linesBeforeBlock_default = iterateJsdoc(({ context, jsdocNode, report, sourceCode, utils }) => {
|
|
16
|
-
const { checkBlockStarts, excludedTags = ["type"], ignoreSameLine = true, ignoreSingleLines = true, lines = 1 } = context.options[0] || {};
|
|
17
|
-
if (utils.hasATag(excludedTags)) return;
|
|
18
|
-
const tokensBefore = sourceCode.getTokensBefore(jsdocNode, { includeComments: true });
|
|
19
|
-
const tokenBefore = tokensBefore.at(-1);
|
|
20
|
-
if (!tokenBefore || tokenBefore.type === "Punctuator" && !checkBlockStarts && startPunctuators.has(tokenBefore.value)) return;
|
|
21
|
-
if (tokenBefore.loc?.end?.line + lines >= jsdocNode.loc?.start?.line) {
|
|
22
|
-
const startLine = jsdocNode.loc?.start?.line;
|
|
23
|
-
const sameLine = tokenBefore.loc?.end?.line === startLine;
|
|
24
|
-
if (sameLine && ignoreSameLine) return;
|
|
25
|
-
if (ignoreSingleLines && jsdocNode.loc?.start.line === jsdocNode.loc?.end.line) return;
|
|
26
|
-
/** @type {import('eslint').Rule.ReportFixer} */
|
|
27
|
-
const fix = (fixer) => {
|
|
28
|
-
let indent = "";
|
|
29
|
-
if (sameLine) {
|
|
30
|
-
const spaceDiff = jsdocNode.loc?.start?.column - tokenBefore.loc?.end?.column;
|
|
31
|
-
indent = jsdocNode.value.match(/^\*\n([\t ]*) \*/v)?.[1]?.slice(spaceDiff);
|
|
32
|
-
if (!indent) {
|
|
33
|
-
/** @type {import('eslint').AST.Token|import('estree').Comment|undefined} */
|
|
34
|
-
let tokenPrior = tokenBefore;
|
|
35
|
-
let startColumn;
|
|
36
|
-
while (tokenPrior && tokenPrior?.loc?.start?.line === startLine) {
|
|
37
|
-
startColumn = tokenPrior.loc?.start?.column;
|
|
38
|
-
tokenPrior = tokensBefore.pop();
|
|
39
|
-
}
|
|
40
|
-
indent = " ".repeat(startColumn ? startColumn - 1 : 0);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return fixer.insertTextAfter(tokenBefore, "\n".repeat(lines) + (sameLine ? "\n" + indent : ""));
|
|
44
|
-
};
|
|
45
|
-
report(`Required ${lines} line(s) before JSDoc block`, fix);
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
iterateAllJsdocs: true,
|
|
49
|
-
meta: {
|
|
50
|
-
docs: {
|
|
51
|
-
description: "Enforces minimum number of newlines before JSDoc comment blocks",
|
|
52
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/lines-before-block.md#repos-sticky-header"
|
|
53
|
-
},
|
|
54
|
-
fixable: "code",
|
|
55
|
-
schema: [{
|
|
56
|
-
additionalProperties: false,
|
|
57
|
-
properties: {
|
|
58
|
-
checkBlockStarts: { type: "boolean" },
|
|
59
|
-
excludedTags: {
|
|
60
|
-
items: { type: "string" },
|
|
61
|
-
type: "array"
|
|
62
|
-
},
|
|
63
|
-
ignoreSameLine: { type: "boolean" },
|
|
64
|
-
ignoreSingleLines: { type: "boolean" },
|
|
65
|
-
lines: { type: "integer" }
|
|
66
|
-
},
|
|
67
|
-
type: "object"
|
|
68
|
-
}],
|
|
69
|
-
type: "suggestion"
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
//#endregion
|
|
74
|
-
export { linesBeforeBlock_default as default };
|
|
75
|
-
//# sourceMappingURL=linesBeforeBlock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linesBeforeBlock.js","names":[],"sources":["../../src/rules/linesBeforeBlock.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * Punctuators that begin a logical group should not require a line before it skipped. Specifically\n * `[` starts an array, `{` starts an object or block, `(` starts a grouping, and `=` starts a\n * declaration (like a variable or a type alias).\n */\nconst startPunctuators = new Set([\n '(', '=', '[', '{',\n]);\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n utils,\n}) => {\n const {\n checkBlockStarts,\n excludedTags = [\n 'type',\n ],\n ignoreSameLine = true,\n ignoreSingleLines = true,\n lines = 1,\n } = context.options[0] || {};\n\n if (utils.hasATag(excludedTags)) {\n return;\n }\n\n const tokensBefore = sourceCode.getTokensBefore(jsdocNode, {\n includeComments: true,\n });\n const tokenBefore = tokensBefore.at(-1);\n if (\n !tokenBefore || (\n tokenBefore.type === 'Punctuator' &&\n !checkBlockStarts &&\n startPunctuators.has(tokenBefore.value)\n )\n ) {\n return;\n }\n\n if (tokenBefore.loc?.end?.line + lines >=\n /** @type {number} */\n (jsdocNode.loc?.start?.line)\n ) {\n const startLine = jsdocNode.loc?.start?.line;\n const sameLine = tokenBefore.loc?.end?.line === startLine;\n\n if (sameLine && ignoreSameLine) {\n return;\n }\n\n if (ignoreSingleLines && jsdocNode.loc?.start.line === jsdocNode.loc?.end.line) {\n return;\n }\n\n /** @type {import('eslint').Rule.ReportFixer} */\n const fix = (fixer) => {\n let indent = '';\n if (sameLine) {\n const spaceDiff = /** @type {number} */ (jsdocNode.loc?.start?.column) -\n /** @type {number} */ (tokenBefore.loc?.end?.column);\n // @ts-expect-error Should be a comment\n indent = /** @type {import('estree').Comment} */ (\n jsdocNode\n ).value.match(/^\\*\\n([\\t ]*) \\*/v)?.[1]?.slice(spaceDiff);\n if (!indent) {\n /** @type {import('eslint').AST.Token|import('estree').Comment|undefined} */\n let tokenPrior = tokenBefore;\n let startColumn;\n while (tokenPrior && tokenPrior?.loc?.start?.line === startLine) {\n startColumn = tokenPrior.loc?.start?.column;\n tokenPrior = tokensBefore.pop();\n }\n\n indent = ' '.repeat(\n /* c8 ignore next */\n /** @type {number} */ (startColumn ? startColumn - 1 : 0),\n );\n }\n }\n\n return fixer.insertTextAfter(\n /** @type {import('eslint').AST.Token} */\n (tokenBefore),\n '\\n'.repeat(lines) +\n (sameLine ? '\\n' + indent : ''),\n );\n };\n\n report(`Required ${lines} line(s) before JSDoc block`, fix);\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces minimum number of newlines before JSDoc comment blocks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/lines-before-block.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkBlockStarts: {\n type: 'boolean',\n },\n excludedTags: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreSameLine: {\n type: 'boolean',\n },\n ignoreSingleLines: {\n type: 'boolean',\n },\n lines: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;;;AAOA,MAAM,mBAAmB,IAAI,IAAI;CAC/B;CAAK;CAAK;CAAK;AAChB;AAED,+BAAe,aAAa,CAAC,EAC3B,SACA,WACA,QACA,YACA,OACD,KAAK;CACJ,MAAM,EACJ,kBACA,eAAe,CACb,MACD,GACD,iBAAiB,MACjB,oBAAoB,MACpB,QAAQ,GACT,GAAG,QAAQ,QAAQ,MAAM,CAAE;AAE5B,KAAI,MAAM,QAAQ,aAAa,CAC7B;CAGF,MAAM,eAAe,WAAW,gBAAgB,WAAW,EACzD,iBAAiB,KAClB,EAAC;CACF,MAAM,cAAc,aAAa,GAAG,GAAG;AACvC,KACE,CAAC,eACC,YAAY,SAAS,gBACrB,CAAC,oBACD,iBAAiB,IAAI,YAAY,MAAM,CAGzC;AAGF,KAAI,YAAY,KAAK,KAAK,OAAO,SAE5B,UAAU,KAAK,OAAO,MACzB;EACA,MAAM,YAAY,UAAU,KAAK,OAAO;EACxC,MAAM,WAAW,YAAY,KAAK,KAAK,SAAS;AAEhD,MAAI,YAAY,eACd;AAGF,MAAI,qBAAqB,UAAU,KAAK,MAAM,SAAS,UAAU,KAAK,IAAI,KACxE;;EAIF,MAAM,MAAM,CAAC,UAAU;GACrB,IAAI,SAAS;AACb,OAAI,UAAU;IACZ,MAAM,YAAmC,UAAU,KAAK,OAAO,SACxC,YAAY,KAAK,KAAK;IAE7C,SACE,UACA,MAAM,MAAM,oBAAoB,GAAG,IAAI,MAAM,UAAU;AACzD,QAAI,CAAC,QAAQ;;KAEX,IAAI,aAAa;KACjB,IAAI;AACJ,YAAO,cAAc,YAAY,KAAK,OAAO,SAAS,WAAW;MAC/D,cAAc,WAAW,KAAK,OAAO;MACrC,aAAa,aAAa,KAAK;KAChC;KAED,SAAS,IAAI,OAEY,cAAc,cAAc,IAAI,EACxD;IACF;GACF;AAED,UAAO,MAAM,gBAEV,aACD,KAAK,OAAO,MAAM,IACjB,WAAW,OAAO,SAAS,IAC7B;EACF;EAED,OAAO,CAAC,SAAS,EAAE,MAAM,2BAA2B,CAAC,EAAE,IAAI;CAC5D;AACF,GAAE;CACD,kBAAkB;CAClB,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY;IACV,kBAAkB,EAChB,MAAM,UACP;IACD,cAAc;KACZ,OAAO,EACL,MAAM,SACP;KACD,MAAM;IACP;IACD,gBAAgB,EACd,MAAM,UACP;IACD,mBAAmB,EACjB,MAAM,UACP;IACD,OAAO,EACL,MAAM,UACP;GACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/matchDescription.js
|
|
4
|
-
const matchDescriptionDefault = "^\n?([A-Z`\\d_][\\s\\S]*[.?!`\\p{RGI_Emoji}]\\s*)?$";
|
|
5
|
-
/**
|
|
6
|
-
* @param {string} value
|
|
7
|
-
* @param {string} userDefault
|
|
8
|
-
* @returns {string}
|
|
9
|
-
*/
|
|
10
|
-
const stringOrDefault = (value, userDefault) => {
|
|
11
|
-
return typeof value === "string" ? value : userDefault || matchDescriptionDefault;
|
|
12
|
-
};
|
|
13
|
-
var matchDescription_default = iterateJsdoc(({ context, jsdoc, report, utils }) => {
|
|
14
|
-
const { mainDescription, matchDescription, message, nonemptyTags = true, tags = {} } = context.options[0] || {};
|
|
15
|
-
/**
|
|
16
|
-
* @param {string} desc
|
|
17
|
-
* @param {import('comment-parser').Spec} [tag]
|
|
18
|
-
* @returns {void}
|
|
19
|
-
*/
|
|
20
|
-
const validateDescription = (desc, tag) => {
|
|
21
|
-
let mainDescriptionMatch = mainDescription;
|
|
22
|
-
let errorMessage = message;
|
|
23
|
-
if (typeof mainDescription === "object") {
|
|
24
|
-
mainDescriptionMatch = mainDescription.match;
|
|
25
|
-
errorMessage = mainDescription.message;
|
|
26
|
-
}
|
|
27
|
-
if (mainDescriptionMatch === false && (!tag || !Object.hasOwn(tags, tag.tag))) return;
|
|
28
|
-
let tagValue = mainDescriptionMatch;
|
|
29
|
-
if (tag) {
|
|
30
|
-
const tagName = tag.tag;
|
|
31
|
-
if (typeof tags[tagName] === "object") {
|
|
32
|
-
tagValue = tags[tagName].match;
|
|
33
|
-
errorMessage = tags[tagName].message;
|
|
34
|
-
} else tagValue = tags[tagName];
|
|
35
|
-
}
|
|
36
|
-
const regex = utils.getRegexFromString(stringOrDefault(tagValue, matchDescription));
|
|
37
|
-
if (!regex.test(desc)) report(errorMessage || "JSDoc description does not satisfy the regex pattern.", null, tag || { line: jsdoc.source[0].number + 1 });
|
|
38
|
-
};
|
|
39
|
-
const { description } = utils.getDescription();
|
|
40
|
-
if (description) validateDescription(description);
|
|
41
|
-
/**
|
|
42
|
-
* @param {string} tagName
|
|
43
|
-
* @returns {boolean}
|
|
44
|
-
*/
|
|
45
|
-
const hasNoTag = (tagName) => {
|
|
46
|
-
return !tags[tagName];
|
|
47
|
-
};
|
|
48
|
-
for (const tag of [
|
|
49
|
-
"description",
|
|
50
|
-
"summary",
|
|
51
|
-
"file",
|
|
52
|
-
"classdesc"
|
|
53
|
-
]) utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {
|
|
54
|
-
const desc = (matchingJsdocTag.name + " " + utils.getTagDescription(matchingJsdocTag)).trim();
|
|
55
|
-
if (hasNoTag(targetTagName)) validateDescription(desc, matchingJsdocTag);
|
|
56
|
-
}, true);
|
|
57
|
-
if (nonemptyTags) for (const tag of [
|
|
58
|
-
"copyright",
|
|
59
|
-
"example",
|
|
60
|
-
"see",
|
|
61
|
-
"todo"
|
|
62
|
-
]) utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {
|
|
63
|
-
const desc = (matchingJsdocTag.name + " " + utils.getTagDescription(matchingJsdocTag)).trim();
|
|
64
|
-
if (hasNoTag(targetTagName) && !/.+/v.test(desc)) report("JSDoc description must not be empty.", null, matchingJsdocTag);
|
|
65
|
-
});
|
|
66
|
-
if (!Object.keys(tags).length) return;
|
|
67
|
-
/**
|
|
68
|
-
* @param {string} tagName
|
|
69
|
-
* @returns {boolean}
|
|
70
|
-
*/
|
|
71
|
-
const hasOptionTag = (tagName) => {
|
|
72
|
-
return Boolean(tags[tagName]);
|
|
73
|
-
};
|
|
74
|
-
const whitelistedTags = utils.filterTags(({ tag: tagName }) => {
|
|
75
|
-
return hasOptionTag(tagName);
|
|
76
|
-
});
|
|
77
|
-
const { tagsWithNames, tagsWithoutNames } = utils.getTagsByType(whitelistedTags);
|
|
78
|
-
tagsWithNames.some((tag) => {
|
|
79
|
-
const desc = utils.getTagDescription(tag).replace(/^[\- ]*/v, "").trim();
|
|
80
|
-
return validateDescription(desc, tag);
|
|
81
|
-
});
|
|
82
|
-
tagsWithoutNames.some((tag) => {
|
|
83
|
-
const desc = (tag.name + " " + utils.getTagDescription(tag)).trim();
|
|
84
|
-
return validateDescription(desc, tag);
|
|
85
|
-
});
|
|
86
|
-
}, {
|
|
87
|
-
contextDefaults: true,
|
|
88
|
-
meta: {
|
|
89
|
-
docs: {
|
|
90
|
-
description: "Enforces a regular expression pattern on descriptions.",
|
|
91
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-description.md#repos-sticky-header"
|
|
92
|
-
},
|
|
93
|
-
schema: [{
|
|
94
|
-
additionalProperties: false,
|
|
95
|
-
properties: {
|
|
96
|
-
contexts: {
|
|
97
|
-
items: { anyOf: [{ type: "string" }, {
|
|
98
|
-
additionalProperties: false,
|
|
99
|
-
properties: {
|
|
100
|
-
comment: { type: "string" },
|
|
101
|
-
context: { type: "string" }
|
|
102
|
-
},
|
|
103
|
-
type: "object"
|
|
104
|
-
}] },
|
|
105
|
-
type: "array"
|
|
106
|
-
},
|
|
107
|
-
mainDescription: { oneOf: [
|
|
108
|
-
{
|
|
109
|
-
format: "regex",
|
|
110
|
-
type: "string"
|
|
111
|
-
},
|
|
112
|
-
{ type: "boolean" },
|
|
113
|
-
{
|
|
114
|
-
additionalProperties: false,
|
|
115
|
-
properties: {
|
|
116
|
-
match: { oneOf: [{
|
|
117
|
-
format: "regex",
|
|
118
|
-
type: "string"
|
|
119
|
-
}, { type: "boolean" }] },
|
|
120
|
-
message: { type: "string" }
|
|
121
|
-
},
|
|
122
|
-
type: "object"
|
|
123
|
-
}
|
|
124
|
-
] },
|
|
125
|
-
matchDescription: {
|
|
126
|
-
format: "regex",
|
|
127
|
-
type: "string"
|
|
128
|
-
},
|
|
129
|
-
message: { type: "string" },
|
|
130
|
-
nonemptyTags: { type: "boolean" },
|
|
131
|
-
tags: {
|
|
132
|
-
patternProperties: { ".*": { oneOf: [
|
|
133
|
-
{
|
|
134
|
-
format: "regex",
|
|
135
|
-
type: "string"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
enum: [true],
|
|
139
|
-
type: "boolean"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
additionalProperties: false,
|
|
143
|
-
properties: {
|
|
144
|
-
match: { oneOf: [{
|
|
145
|
-
format: "regex",
|
|
146
|
-
type: "string"
|
|
147
|
-
}, {
|
|
148
|
-
enum: [true],
|
|
149
|
-
type: "boolean"
|
|
150
|
-
}] },
|
|
151
|
-
message: { type: "string" }
|
|
152
|
-
},
|
|
153
|
-
type: "object"
|
|
154
|
-
}
|
|
155
|
-
] } },
|
|
156
|
-
type: "object"
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
type: "object"
|
|
160
|
-
}],
|
|
161
|
-
type: "suggestion"
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
//#endregion
|
|
166
|
-
export { matchDescription_default as default };
|
|
167
|
-
//# sourceMappingURL=matchDescription.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchDescription.js","names":[],"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":";;;AAIA,MAAM,0BAA0B;;;;;;AAOhC,MAAM,kBAAkB,CAAC,OAAO,gBAAgB;AAC9C,QAAO,OAAO,UAAU,WACtB,QACA,eAAe;AAClB;AAED,+BAAe,aAAa,CAAC,EAC3B,SACA,OACA,QACA,OACD,KAAK;CACJ,MAAM,EACJ,iBACA,kBACA,SACA,eAAe,MACf,OAAO,CAAE,GACV,GAAG,QAAQ,QAAQ,MAAM,CAAE;;;;;;CAO5B,MAAM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,MAAM,UACP;IACD,MAAM;KACJ,mBAAmB,EACjB,MAAM,EACJ,OAAO;MACL;OACE,QAAQ;OACR,MAAM;MACP;MACD;OACE,MAAM,CACJ,IACD;OACD,MAAM;MACP;MACD;OACE,sBAAsB;OACtB,YAAY;QACV,OAAO,EACL,OAAO,CACL;SACE,QAAQ;SACR,MAAM;QACP,GACD;SACE,MAAM,CACJ,IACD;SACD,MAAM;QACP,CACF,EACF;QACD,SAAS,EACP,MAAM,SACP;OACF;OACD,MAAM;MACP;KACF,EACF,EACF;KACD,MAAM;IACP;GACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
package/dist/rules/matchName.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/matchName.js
|
|
4
|
-
var matchName_default = iterateJsdoc(({ context, info: { lastIndex }, jsdoc, report, utils }) => {
|
|
5
|
-
const { match } = context.options[0] || {};
|
|
6
|
-
if (!match) {
|
|
7
|
-
report("Rule `no-restricted-syntax` is missing a `match` option.");
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const { allowName, disallowName, replacement, tags = ["*"] } = match[lastIndex];
|
|
11
|
-
const allowNameRegex = allowName && utils.getRegexFromString(allowName);
|
|
12
|
-
const disallowNameRegex = disallowName && utils.getRegexFromString(disallowName);
|
|
13
|
-
let applicableTags = jsdoc.tags;
|
|
14
|
-
if (!tags.includes("*")) applicableTags = utils.getPresentTags(tags);
|
|
15
|
-
let reported = false;
|
|
16
|
-
for (const tag of applicableTags) {
|
|
17
|
-
const tagName = tag.name.replace(/^\[/v, "").replace(/(=.*)?\]$/v, "");
|
|
18
|
-
const allowed = !allowNameRegex || allowNameRegex.test(tagName);
|
|
19
|
-
const disallowed = disallowNameRegex && disallowNameRegex.test(tagName);
|
|
20
|
-
const hasRegex = allowNameRegex || disallowNameRegex;
|
|
21
|
-
if (hasRegex && allowed && !disallowed) continue;
|
|
22
|
-
if (!hasRegex && reported) continue;
|
|
23
|
-
const fixer = () => {
|
|
24
|
-
for (const src of tag.source) if (src.tokens.name) {
|
|
25
|
-
src.tokens.name = src.tokens.name.replace(disallowNameRegex, replacement);
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
let { message } = match[lastIndex];
|
|
30
|
-
if (!message) if (hasRegex) message = disallowed ? `Only allowing names not matching \`${disallowNameRegex}\` but found "${tagName}".` : `Only allowing names matching \`${allowNameRegex}\` but found "${tagName}".`;
|
|
31
|
-
else message = `Prohibited context for "${tagName}".`;
|
|
32
|
-
utils.reportJSDoc(message, hasRegex ? tag : null, disallowNameRegex && replacement !== void 0 ? fixer : null, false, {
|
|
33
|
-
allowName,
|
|
34
|
-
disallowName,
|
|
35
|
-
name: tagName
|
|
36
|
-
});
|
|
37
|
-
if (!hasRegex) reported = true;
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
matchContext: true,
|
|
41
|
-
meta: {
|
|
42
|
-
docs: {
|
|
43
|
-
description: "Reports the name portion of a JSDoc tag if matching or not matching a given regular expression.",
|
|
44
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-name.md#repos-sticky-header"
|
|
45
|
-
},
|
|
46
|
-
fixable: "code",
|
|
47
|
-
schema: [{
|
|
48
|
-
additionalProperties: false,
|
|
49
|
-
properties: { match: {
|
|
50
|
-
items: {
|
|
51
|
-
additionalProperties: false,
|
|
52
|
-
properties: {
|
|
53
|
-
allowName: { type: "string" },
|
|
54
|
-
comment: { type: "string" },
|
|
55
|
-
context: { type: "string" },
|
|
56
|
-
disallowName: { type: "string" },
|
|
57
|
-
message: { type: "string" },
|
|
58
|
-
replacement: { type: "string" },
|
|
59
|
-
tags: {
|
|
60
|
-
items: { type: "string" },
|
|
61
|
-
type: "array"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
type: "object"
|
|
65
|
-
},
|
|
66
|
-
type: "array"
|
|
67
|
-
} },
|
|
68
|
-
required: ["match"],
|
|
69
|
-
type: "object"
|
|
70
|
-
}],
|
|
71
|
-
type: "suggestion"
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
//#endregion
|
|
76
|
-
export { matchName_default as default };
|
|
77
|
-
//# sourceMappingURL=matchName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchName.js","names":[],"sources":["../../src/rules/matchName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n// eslint-disable-next-line complexity\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":";;;AAGA,wBAAe,aAAa,CAAC,EAC3B,SACA,MAAM,EACJ,WACD,EACD,OACA,QACA,OACD,KAAK;CACJ,MAAM,EACJ,OACD,GAAG,QAAQ,QAAQ,MAAM,CAAE;AAC5B,KAAI,CAAC,OAAO;EACV,OAAO,2DAA2D;AAElE;CACD;CAED,MAAM,EACJ,WACA,cACA,aACA,OAAO,CACL,GACD,GACF,GAAG,MAA2D;CAE/D,MAAM,iBAAiB,aAAa,MAAM,mBAAmB,UAAU;CACvE,MAAM,oBAAoB,gBAAgB,MAAM,mBAAmB,aAAa;CAEhF,IAAI,iBAAiB,MAAM;AAC3B,KAAI,CAAC,KAAK,SAAS,IAAI,EACrB,iBA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AAM,SACP;MACD,MAAM;OACJ,OAAO,EACL,MAAM,SACP;OACD,MAAM;MACP;KACF;KACD,MAAM;IACP;IACD,MAAM;GACP,EACF;GACD,UAAU,CACR,OACD;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/multilineBlocks.js
|
|
4
|
-
/**
|
|
5
|
-
* @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
|
|
6
|
-
* @param {import('../iterateJsdoc.js').Utils} utils
|
|
7
|
-
* @param {number} requireSingleLineUnderCount
|
|
8
|
-
*/
|
|
9
|
-
const checkForShortTags = (jsdoc, utils, requireSingleLineUnderCount) => {
|
|
10
|
-
if (!requireSingleLineUnderCount || !jsdoc.tags.length) return false;
|
|
11
|
-
let lastLineWithTag = 0;
|
|
12
|
-
let isUnderCountLimit = false;
|
|
13
|
-
let hasMultiDescOrType = false;
|
|
14
|
-
const tagLines = jsdoc.source.reduce((acc, { tokens: { delimiter, description: desc, name, postDelimiter, postName, postTag, postType, start, tag, type } }, idx) => {
|
|
15
|
-
if (tag.length) {
|
|
16
|
-
lastLineWithTag = idx;
|
|
17
|
-
if (start.length + delimiter.length + postDelimiter.length + type.length + postType.length + name.length + postName.length + tag.length + postTag.length + desc.length < requireSingleLineUnderCount) isUnderCountLimit = true;
|
|
18
|
-
return acc + 1;
|
|
19
|
-
} else if (desc.length || type.length) {
|
|
20
|
-
hasMultiDescOrType = true;
|
|
21
|
-
return acc;
|
|
22
|
-
}
|
|
23
|
-
return acc;
|
|
24
|
-
}, 0);
|
|
25
|
-
if (!hasMultiDescOrType && isUnderCountLimit && tagLines === 1) {
|
|
26
|
-
const fixer = () => {
|
|
27
|
-
const tokens = jsdoc.source[lastLineWithTag].tokens;
|
|
28
|
-
jsdoc.source = [{
|
|
29
|
-
number: 0,
|
|
30
|
-
source: "",
|
|
31
|
-
tokens: utils.seedTokens({
|
|
32
|
-
delimiter: "/**",
|
|
33
|
-
description: tokens.description.trimEnd() + " ",
|
|
34
|
-
end: "*/",
|
|
35
|
-
name: tokens.name,
|
|
36
|
-
postDelimiter: " ",
|
|
37
|
-
postName: tokens.postName,
|
|
38
|
-
postTag: tokens.postTag,
|
|
39
|
-
postType: tokens.postType,
|
|
40
|
-
start: jsdoc.source[0].tokens.start,
|
|
41
|
-
tag: tokens.tag,
|
|
42
|
-
type: tokens.type
|
|
43
|
-
})
|
|
44
|
-
}];
|
|
45
|
-
};
|
|
46
|
-
utils.reportJSDoc("Description is too short to be multi-line.", null, fixer);
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
|
|
53
|
-
* @param {import('../iterateJsdoc.js').Utils} utils
|
|
54
|
-
* @param {number} requireSingleLineUnderCount
|
|
55
|
-
*/
|
|
56
|
-
const checkForShortDescriptions = (jsdoc, utils, requireSingleLineUnderCount) => {
|
|
57
|
-
if (!requireSingleLineUnderCount || jsdoc.tags.length) return false;
|
|
58
|
-
let lastLineWithDesc = 0;
|
|
59
|
-
let isUnderCountLimit = false;
|
|
60
|
-
const descLines = jsdoc.source.reduce((acc, { tokens: { delimiter, description: desc, postDelimiter, start } }, idx) => {
|
|
61
|
-
if (desc.length) {
|
|
62
|
-
lastLineWithDesc = idx;
|
|
63
|
-
if (start.length + delimiter.length + postDelimiter.length + desc.length < requireSingleLineUnderCount) isUnderCountLimit = true;
|
|
64
|
-
return acc + 1;
|
|
65
|
-
}
|
|
66
|
-
return acc;
|
|
67
|
-
}, 0);
|
|
68
|
-
if (isUnderCountLimit && descLines === 1) {
|
|
69
|
-
const fixer = () => {
|
|
70
|
-
const desc = jsdoc.source[lastLineWithDesc].tokens.description;
|
|
71
|
-
jsdoc.source = [{
|
|
72
|
-
number: 0,
|
|
73
|
-
source: "",
|
|
74
|
-
tokens: utils.seedTokens({
|
|
75
|
-
delimiter: "/**",
|
|
76
|
-
description: desc.trimEnd() + " ",
|
|
77
|
-
end: "*/",
|
|
78
|
-
postDelimiter: " ",
|
|
79
|
-
start: jsdoc.source[0].tokens.start
|
|
80
|
-
})
|
|
81
|
-
}];
|
|
82
|
-
};
|
|
83
|
-
utils.reportJSDoc("Description is too short to be multi-line.", null, fixer);
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
return false;
|
|
87
|
-
};
|
|
88
|
-
var multilineBlocks_default = iterateJsdoc(({ context, jsdoc, utils }) => {
|
|
89
|
-
const { allowMultipleTags = true, minimumLengthForMultiline = Number.POSITIVE_INFINITY, multilineTags = ["*"], noFinalLineText = true, noMultilineBlocks = false, noSingleLineBlocks = false, noZeroLineText = true, requireSingleLineUnderCount = null, singleLineTags = ["lends", "type"] } = context.options[0] || {};
|
|
90
|
-
const { source: [{ tokens }] } = jsdoc;
|
|
91
|
-
const { description, tag } = tokens;
|
|
92
|
-
const sourceLength = jsdoc.source.length;
|
|
93
|
-
/**
|
|
94
|
-
* @param {string} tagName
|
|
95
|
-
* @returns {boolean}
|
|
96
|
-
*/
|
|
97
|
-
const isInvalidSingleLine = (tagName) => {
|
|
98
|
-
return noSingleLineBlocks && (!tagName || !singleLineTags.includes(tagName) && !singleLineTags.includes("*"));
|
|
99
|
-
};
|
|
100
|
-
if (sourceLength === 1) {
|
|
101
|
-
if (!isInvalidSingleLine(tag.slice(1))) return;
|
|
102
|
-
const fixer = () => {
|
|
103
|
-
utils.makeMultiline();
|
|
104
|
-
};
|
|
105
|
-
utils.reportJSDoc("Single line blocks are not permitted by your configuration.", null, fixer, true);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (checkForShortDescriptions(jsdoc, utils, requireSingleLineUnderCount)) return;
|
|
109
|
-
if (checkForShortTags(jsdoc, utils, requireSingleLineUnderCount)) return;
|
|
110
|
-
const lineChecks = () => {
|
|
111
|
-
if (noZeroLineText && (tag || description)) {
|
|
112
|
-
const fixer = () => {
|
|
113
|
-
const line = { ...tokens };
|
|
114
|
-
utils.emptyTokens(tokens);
|
|
115
|
-
const { tokens: { delimiter, start } } = jsdoc.source[1];
|
|
116
|
-
utils.addLine(1, {
|
|
117
|
-
...line,
|
|
118
|
-
delimiter,
|
|
119
|
-
start
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
utils.reportJSDoc("Should have no text on the \"0th\" line (after the `/**`).", null, fixer);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const finalLine = jsdoc.source[jsdoc.source.length - 1];
|
|
126
|
-
const finalLineTokens = finalLine.tokens;
|
|
127
|
-
if (noFinalLineText && finalLineTokens.description.trim()) {
|
|
128
|
-
const fixer = () => {
|
|
129
|
-
const line = { ...finalLineTokens };
|
|
130
|
-
line.description = line.description.trimEnd();
|
|
131
|
-
const { delimiter } = line;
|
|
132
|
-
for (const prop of [
|
|
133
|
-
"delimiter",
|
|
134
|
-
"postDelimiter",
|
|
135
|
-
"tag",
|
|
136
|
-
"type",
|
|
137
|
-
"lineEnd",
|
|
138
|
-
"postType",
|
|
139
|
-
"postTag",
|
|
140
|
-
"name",
|
|
141
|
-
"postName",
|
|
142
|
-
"description"
|
|
143
|
-
]) finalLineTokens[prop] = "";
|
|
144
|
-
utils.addLine(jsdoc.source.length - 1, {
|
|
145
|
-
...line,
|
|
146
|
-
delimiter,
|
|
147
|
-
end: ""
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
utils.reportJSDoc("Should have no text on the final line (before the `*/`).", null, fixer);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
if (noMultilineBlocks) {
|
|
154
|
-
if (jsdoc.tags.length && (multilineTags.includes("*") || utils.hasATag(multilineTags))) {
|
|
155
|
-
lineChecks();
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
if (jsdoc.description.length >= minimumLengthForMultiline) {
|
|
159
|
-
lineChecks();
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (noSingleLineBlocks && (!jsdoc.tags.length || !utils.filterTags(({ tag: tg }) => {
|
|
163
|
-
return !isInvalidSingleLine(tg);
|
|
164
|
-
}).length)) {
|
|
165
|
-
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`.");
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (jsdoc.tags.length > 1) {
|
|
169
|
-
if (!allowMultipleTags) {
|
|
170
|
-
utils.reportJSDoc("Multiline jsdoc blocks are prohibited by your configuration but the block has multiple tags.");
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
} else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {
|
|
174
|
-
if (!allowMultipleTags) {
|
|
175
|
-
utils.reportJSDoc("Multiline jsdoc blocks are prohibited by your configuration but the block has a description with a tag.");
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
} else {
|
|
179
|
-
const fixer = () => {
|
|
180
|
-
jsdoc.source = [{
|
|
181
|
-
number: 1,
|
|
182
|
-
source: "",
|
|
183
|
-
tokens: jsdoc.source.reduce((obj, { tokens: { description: desc, lineEnd, name: nme, postName, postTag, postType, tag: tg, type: typ } }) => {
|
|
184
|
-
if (typ) obj.type = typ;
|
|
185
|
-
if (tg && typ && nme) obj.postType = postType;
|
|
186
|
-
if (nme) obj.name += nme;
|
|
187
|
-
if (nme && desc) obj.postName = postName;
|
|
188
|
-
obj.description += desc;
|
|
189
|
-
const nameOrDescription = obj.description || obj.name;
|
|
190
|
-
if (nameOrDescription && nameOrDescription.slice(-1) !== " ") obj.description += " ";
|
|
191
|
-
obj.lineEnd = lineEnd;
|
|
192
|
-
obj.tag += tg;
|
|
193
|
-
if (tg) obj.postTag = postTag || " ";
|
|
194
|
-
return obj;
|
|
195
|
-
}, utils.seedTokens({
|
|
196
|
-
delimiter: "/**",
|
|
197
|
-
end: "*/",
|
|
198
|
-
postDelimiter: " "
|
|
199
|
-
}))
|
|
200
|
-
}];
|
|
201
|
-
};
|
|
202
|
-
utils.reportJSDoc("Multiline jsdoc blocks are prohibited by your configuration.", null, fixer);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
lineChecks();
|
|
207
|
-
}, {
|
|
208
|
-
iterateAllJsdocs: true,
|
|
209
|
-
meta: {
|
|
210
|
-
docs: {
|
|
211
|
-
description: "Controls how and whether jsdoc blocks can be expressed as single or multiple line blocks.",
|
|
212
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header"
|
|
213
|
-
},
|
|
214
|
-
fixable: "code",
|
|
215
|
-
schema: [{
|
|
216
|
-
additionalProperties: false,
|
|
217
|
-
properties: {
|
|
218
|
-
allowMultipleTags: { type: "boolean" },
|
|
219
|
-
minimumLengthForMultiline: { type: "integer" },
|
|
220
|
-
multilineTags: { anyOf: [{
|
|
221
|
-
enum: ["*"],
|
|
222
|
-
type: "string"
|
|
223
|
-
}, {
|
|
224
|
-
items: { type: "string" },
|
|
225
|
-
type: "array"
|
|
226
|
-
}] },
|
|
227
|
-
noFinalLineText: { type: "boolean" },
|
|
228
|
-
noMultilineBlocks: { type: "boolean" },
|
|
229
|
-
noSingleLineBlocks: { type: "boolean" },
|
|
230
|
-
noZeroLineText: { type: "boolean" },
|
|
231
|
-
requireSingleLineUnderCount: { type: "number" },
|
|
232
|
-
singleLineTags: {
|
|
233
|
-
items: { type: "string" },
|
|
234
|
-
type: "array"
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
type: "object"
|
|
238
|
-
}],
|
|
239
|
-
type: "suggestion"
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
//#endregion
|
|
244
|
-
export { multilineBlocks_default as default };
|
|
245
|
-
//# sourceMappingURL=multilineBlocks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multilineBlocks.js","names":[],"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":";;;;;;;;AAOA,MAAM,oBAAoB,CAAC,OAAO,OAAO,gCAAgC;AACvE,KAAI,CAAC,+BAA+B,CAAC,MAAM,KAAK,OAC9C,QAAO;CAGT,IAAI,kBAAkB;CACtB,IAAI,oBAAoB;CACxB,IAAI,qBAAqB;CACzB,MAAM,WAAW,MAAM,OAAO,OAAO,CAAC,KAAK,EACzC,QAAQ,EACN,WACA,aAAa,MACb,MACA,eACA,UACA,SACA,UACA,OACA,KACA,MACD,EACF,EAAE,QAAQ;AACT,MAAI,IAAI,QAAQ;GACd,kBAAkB;AAClB,OACE,MAAM,SAAS,UAAU,SAAS,cAAc,SAChD,KAAK,SAAS,SAAS,SAAS,KAAK,SAAS,SAAS,SACvD,IAAI,SAAS,QAAQ,SAAS,KAAK,SACjC,6BAEF,oBAAoB;AAGtB,UAAO,MAAM;EACd,WAAU,KAAK,UAAU,KAAK,QAAQ;GACrC,qBAAqB;AACrB,UAAO;EACR;AAED,SAAO;CACR,GAAE,EAAE;AAEL,KAAI,CAAC,sBAAsB,qBAAqB,aAAa,GAAG;EAC9D,MAAM,QAAQ,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