eslint-plugin-jsdoc 53.0.1 → 54.1.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 +2007 -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 +391 -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 +559 -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 +41 -57
- 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 +2542 -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 +545 -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 +744 -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
package/dist/rules/tagLines.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/tagLines.js
|
|
4
|
-
var tagLines_default = iterateJsdoc(({ context, jsdoc, utils }) => {
|
|
5
|
-
const [alwaysNever = "never", { applyToEndTag = true, count = 1, endLines = 0, startLines = 0, tags = {} } = {}] = context.options;
|
|
6
|
-
jsdoc.tags.some((tg, tagIdx) => {
|
|
7
|
-
let lastTag;
|
|
8
|
-
/**
|
|
9
|
-
* @type {null|import('../iterateJsdoc.js').Integer}
|
|
10
|
-
*/
|
|
11
|
-
let lastEmpty = null;
|
|
12
|
-
/**
|
|
13
|
-
* @type {null|import('../iterateJsdoc.js').Integer}
|
|
14
|
-
*/
|
|
15
|
-
let reportIndex = null;
|
|
16
|
-
let emptyLinesCount = 0;
|
|
17
|
-
for (const [idx, { tokens: { description, end, name, tag, type } }] of tg.source.entries()) {
|
|
18
|
-
if (description) reportIndex = null;
|
|
19
|
-
if (lastTag && ["always", "any"].includes(tags[lastTag.slice(1)]?.lines)) continue;
|
|
20
|
-
const empty = !tag && !name && !type && !description;
|
|
21
|
-
if (empty && !end && (alwaysNever === "never" || lastTag && tags[lastTag.slice(1)]?.lines === "never")) {
|
|
22
|
-
reportIndex = idx;
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (!end) {
|
|
26
|
-
if (empty) emptyLinesCount++;
|
|
27
|
-
else emptyLinesCount = 0;
|
|
28
|
-
lastEmpty = empty ? idx : null;
|
|
29
|
-
}
|
|
30
|
-
lastTag = tag;
|
|
31
|
-
}
|
|
32
|
-
if (typeof endLines === "number" && lastEmpty !== null && tagIdx === jsdoc.tags.length - 1) {
|
|
33
|
-
const lineDiff = endLines - emptyLinesCount;
|
|
34
|
-
if (lineDiff < 0) {
|
|
35
|
-
const fixer = () => {
|
|
36
|
-
utils.removeTag(tagIdx, { tagSourceOffset: lastEmpty + lineDiff + 1 });
|
|
37
|
-
};
|
|
38
|
-
utils.reportJSDoc(`Expected ${endLines} trailing lines`, { line: tg.source[lastEmpty].number + lineDiff + 1 }, fixer);
|
|
39
|
-
} else if (lineDiff > 0) {
|
|
40
|
-
const fixer = () => {
|
|
41
|
-
utils.addLines(tagIdx, lastEmpty, endLines - emptyLinesCount);
|
|
42
|
-
};
|
|
43
|
-
utils.reportJSDoc(`Expected ${endLines} trailing lines`, { line: tg.source[lastEmpty].number }, fixer);
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
if (reportIndex !== null) {
|
|
48
|
-
const fixer = () => {
|
|
49
|
-
utils.removeTag(tagIdx, { tagSourceOffset: reportIndex });
|
|
50
|
-
};
|
|
51
|
-
utils.reportJSDoc("Expected no lines between tags", { line: tg.source[0].number + 1 }, fixer);
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
});
|
|
56
|
-
(applyToEndTag ? jsdoc.tags : jsdoc.tags.slice(0, -1)).some((tg, tagIdx) => {
|
|
57
|
-
/**
|
|
58
|
-
* @type {{
|
|
59
|
-
* idx: import('../iterateJsdoc.js').Integer,
|
|
60
|
-
* number: import('../iterateJsdoc.js').Integer
|
|
61
|
-
* }[]}
|
|
62
|
-
*/
|
|
63
|
-
const lines = [];
|
|
64
|
-
let currentTag;
|
|
65
|
-
let tagSourceIdx = 0;
|
|
66
|
-
for (const [idx, { number, tokens: { description, end, name, tag, type } }] of tg.source.entries()) {
|
|
67
|
-
if (description) {
|
|
68
|
-
lines.splice(0, lines.length);
|
|
69
|
-
tagSourceIdx = idx;
|
|
70
|
-
}
|
|
71
|
-
if (tag) currentTag = tag;
|
|
72
|
-
if (!tag && !name && !type && !description && !end) lines.push({
|
|
73
|
-
idx,
|
|
74
|
-
number
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
const currentTg = currentTag && tags[currentTag.slice(1)];
|
|
78
|
-
const tagCount = currentTg?.count;
|
|
79
|
-
const defaultAlways = alwaysNever === "always" && currentTg?.lines !== "never" && currentTg?.lines !== "any" && lines.length < count;
|
|
80
|
-
let overrideAlways;
|
|
81
|
-
let fixCount = count;
|
|
82
|
-
if (!defaultAlways) {
|
|
83
|
-
fixCount = typeof tagCount === "number" ? tagCount : count;
|
|
84
|
-
overrideAlways = currentTg?.lines === "always" && lines.length < fixCount;
|
|
85
|
-
}
|
|
86
|
-
if (defaultAlways || overrideAlways) {
|
|
87
|
-
const fixer = () => {
|
|
88
|
-
utils.addLines(tagIdx, lines[lines.length - 1]?.idx || tagSourceIdx + 1, fixCount - lines.length);
|
|
89
|
-
};
|
|
90
|
-
const line = lines[lines.length - 1]?.number || tg.source[tagSourceIdx].number;
|
|
91
|
-
utils.reportJSDoc(`Expected ${fixCount} line${fixCount === 1 ? "" : "s"} between tags but found ${lines.length}`, { line }, fixer);
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
});
|
|
96
|
-
if (typeof startLines === "number") {
|
|
97
|
-
if (!jsdoc.tags.length) return;
|
|
98
|
-
const { description, lastDescriptionLine } = utils.getDescription();
|
|
99
|
-
if (!/\S/v.test(description)) return;
|
|
100
|
-
const trailingLines = description.match(/\n+$/v)?.[0]?.length;
|
|
101
|
-
const trailingDiff = (trailingLines ?? 0) - startLines;
|
|
102
|
-
if (trailingDiff > 0) utils.reportJSDoc(`Expected only ${startLines} line after block description`, { line: lastDescriptionLine - trailingDiff }, () => {
|
|
103
|
-
utils.setBlockDescription((info, seedTokens, descLines) => {
|
|
104
|
-
return descLines.slice(0, -trailingDiff).map((desc) => {
|
|
105
|
-
return {
|
|
106
|
-
number: 0,
|
|
107
|
-
source: "",
|
|
108
|
-
tokens: seedTokens({
|
|
109
|
-
...info,
|
|
110
|
-
description: desc,
|
|
111
|
-
postDelimiter: desc.trim() ? info.postDelimiter : ""
|
|
112
|
-
})
|
|
113
|
-
};
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
else if (trailingDiff < 0) utils.reportJSDoc(`Expected ${startLines} lines after block description`, { line: lastDescriptionLine }, () => {
|
|
118
|
-
utils.setBlockDescription((info, seedTokens, descLines) => {
|
|
119
|
-
return [...descLines, ...Array.from({ length: -trailingDiff }, () => {
|
|
120
|
-
return "";
|
|
121
|
-
})].map((desc) => {
|
|
122
|
-
return {
|
|
123
|
-
number: 0,
|
|
124
|
-
source: "",
|
|
125
|
-
tokens: seedTokens({
|
|
126
|
-
...info,
|
|
127
|
-
description: desc,
|
|
128
|
-
postDelimiter: desc.trim() ? info.postDelimiter : ""
|
|
129
|
-
})
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
iterateAllJsdocs: true,
|
|
137
|
-
meta: {
|
|
138
|
-
docs: {
|
|
139
|
-
description: "Enforces lines (or no lines) between tags.",
|
|
140
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/tag-lines.md#repos-sticky-header"
|
|
141
|
-
},
|
|
142
|
-
fixable: "code",
|
|
143
|
-
schema: [{
|
|
144
|
-
enum: [
|
|
145
|
-
"always",
|
|
146
|
-
"any",
|
|
147
|
-
"never"
|
|
148
|
-
],
|
|
149
|
-
type: "string"
|
|
150
|
-
}, {
|
|
151
|
-
additionalProperties: false,
|
|
152
|
-
properties: {
|
|
153
|
-
applyToEndTag: { type: "boolean" },
|
|
154
|
-
count: { type: "integer" },
|
|
155
|
-
endLines: { anyOf: [{ type: "integer" }, { type: "null" }] },
|
|
156
|
-
startLines: { anyOf: [{ type: "integer" }, { type: "null" }] },
|
|
157
|
-
tags: {
|
|
158
|
-
patternProperties: { ".*": {
|
|
159
|
-
additionalProperties: false,
|
|
160
|
-
properties: {
|
|
161
|
-
count: { type: "integer" },
|
|
162
|
-
lines: {
|
|
163
|
-
enum: [
|
|
164
|
-
"always",
|
|
165
|
-
"never",
|
|
166
|
-
"any"
|
|
167
|
-
],
|
|
168
|
-
type: "string"
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
} },
|
|
172
|
-
type: "object"
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
type: "object"
|
|
176
|
-
}],
|
|
177
|
-
type: "suggestion"
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
//#endregion
|
|
182
|
-
export { tagLines_default as default };
|
|
183
|
-
//# sourceMappingURL=tagLines.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tagLines.js","names":[],"sources":["../../src/rules/tagLines.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const [\n alwaysNever = 'never',\n {\n applyToEndTag = true,\n count = 1,\n endLines = 0,\n startLines = 0,\n tags = {},\n } = {},\n ] = context.options;\n\n // eslint-disable-next-line complexity -- Temporary\n jsdoc.tags.some((tg, tagIdx) => {\n let lastTag;\n\n /**\n * @type {null|import('../iterateJsdoc.js').Integer}\n */\n let lastEmpty = null;\n\n /**\n * @type {null|import('../iterateJsdoc.js').Integer}\n */\n let reportIndex = null;\n let emptyLinesCount = 0;\n for (const [\n idx,\n {\n tokens: {\n description,\n end,\n name,\n tag,\n type,\n },\n },\n ] of tg.source.entries()) {\n // May be text after a line break within a tag description\n if (description) {\n reportIndex = null;\n }\n\n if (lastTag && [\n 'always', 'any',\n ].includes(tags[lastTag.slice(1)]?.lines)) {\n continue;\n }\n\n const empty = !tag && !name && !type && !description;\n if (\n empty && !end &&\n (alwaysNever === 'never' ||\n lastTag && tags[lastTag.slice(1)]?.lines === 'never'\n )\n ) {\n reportIndex = idx;\n\n continue;\n }\n\n if (!end) {\n if (empty) {\n emptyLinesCount++;\n } else {\n emptyLinesCount = 0;\n }\n\n lastEmpty = empty ? idx : null;\n }\n\n lastTag = tag;\n }\n\n if (\n typeof endLines === 'number' &&\n lastEmpty !== null && tagIdx === jsdoc.tags.length - 1\n ) {\n const lineDiff = endLines - emptyLinesCount;\n\n if (lineDiff < 0) {\n const fixer = () => {\n utils.removeTag(tagIdx, {\n tagSourceOffset: /** @type {import('../iterateJsdoc.js').Integer} */ (\n lastEmpty\n ) + lineDiff + 1,\n });\n };\n\n utils.reportJSDoc(\n `Expected ${endLines} trailing lines`,\n {\n line: tg.source[lastEmpty].number + lineDiff + 1,\n },\n fixer,\n );\n } else if (lineDiff > 0) {\n const fixer = () => {\n utils.addLines(\n tagIdx,\n /** @type {import('../iterateJsdoc.js').Integer} */ (lastEmpty),\n endLines - emptyLinesCount,\n );\n };\n\n utils.reportJSDoc(\n `Expected ${endLines} trailing lines`,\n {\n line: tg.source[lastEmpty].number,\n },\n fixer,\n );\n }\n\n return true;\n }\n\n if (reportIndex !== null) {\n const fixer = () => {\n utils.removeTag(tagIdx, {\n tagSourceOffset: /** @type {import('../iterateJsdoc.js').Integer} */ (\n reportIndex\n ),\n });\n };\n\n utils.reportJSDoc(\n 'Expected no lines between tags',\n {\n line: tg.source[0].number + 1,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n\n (applyToEndTag ? jsdoc.tags : jsdoc.tags.slice(0, -1)).some((tg, tagIdx) => {\n /**\n * @type {{\n * idx: import('../iterateJsdoc.js').Integer,\n * number: import('../iterateJsdoc.js').Integer\n * }[]}\n */\n const lines = [];\n\n let currentTag;\n let tagSourceIdx = 0;\n for (const [\n idx,\n {\n number,\n tokens: {\n description,\n end,\n name,\n tag,\n type,\n },\n },\n ] of tg.source.entries()) {\n if (description) {\n lines.splice(0, lines.length);\n tagSourceIdx = idx;\n }\n\n if (tag) {\n currentTag = tag;\n }\n\n if (!tag && !name && !type && !description && !end) {\n lines.push({\n idx,\n number,\n });\n }\n }\n\n const currentTg = currentTag && tags[currentTag.slice(1)];\n const tagCount = currentTg?.count;\n\n const defaultAlways = alwaysNever === 'always' && currentTg?.lines !== 'never' &&\n currentTg?.lines !== 'any' && lines.length < count;\n\n let overrideAlways;\n let fixCount = count;\n if (!defaultAlways) {\n fixCount = typeof tagCount === 'number' ? tagCount : count;\n overrideAlways = currentTg?.lines === 'always' &&\n lines.length < fixCount;\n }\n\n if (defaultAlways || overrideAlways) {\n const fixer = () => {\n utils.addLines(tagIdx, lines[lines.length - 1]?.idx || tagSourceIdx + 1, fixCount - lines.length);\n };\n\n const line = lines[lines.length - 1]?.number || tg.source[tagSourceIdx].number;\n utils.reportJSDoc(\n `Expected ${fixCount} line${fixCount === 1 ? '' : 's'} between tags but found ${lines.length}`,\n {\n line,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n\n if (typeof startLines === 'number') {\n if (!jsdoc.tags.length) {\n return;\n }\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n if (!(/\\S/v).test(description)) {\n return;\n }\n\n const trailingLines = description.match(/\\n+$/v)?.[0]?.length;\n const trailingDiff = (trailingLines ?? 0) - startLines;\n if (trailingDiff > 0) {\n utils.reportJSDoc(\n `Expected only ${startLines} line after block description`,\n {\n line: lastDescriptionLine - trailingDiff,\n },\n () => {\n utils.setBlockDescription((info, seedTokens, descLines) => {\n return descLines.slice(0, -trailingDiff).map((desc) => {\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: desc,\n postDelimiter: desc.trim() ? info.postDelimiter : '',\n }),\n };\n });\n });\n },\n );\n } else if (trailingDiff < 0) {\n utils.reportJSDoc(\n `Expected ${startLines} lines after block description`,\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens, descLines) => {\n return [\n ...descLines,\n ...Array.from({\n length: -trailingDiff,\n }, () => {\n return '';\n }),\n ].map((desc) => {\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: desc,\n postDelimiter: desc.trim() ? info.postDelimiter : '',\n }),\n };\n });\n });\n },\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces lines (or no lines) between tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/tag-lines.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n enum: [\n 'always', 'any', 'never',\n ],\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n applyToEndTag: {\n type: 'boolean',\n },\n count: {\n type: 'integer',\n },\n endLines: {\n anyOf: [\n {\n type: 'integer',\n },\n {\n type: 'null',\n },\n ],\n },\n startLines: {\n anyOf: [\n {\n type: 'integer',\n },\n {\n type: 'null',\n },\n ],\n },\n tags: {\n patternProperties: {\n '.*': {\n additionalProperties: false,\n properties: {\n count: {\n type: 'integer',\n },\n lines: {\n enum: [\n 'always', 'never', 'any',\n ],\n type: 'string',\n },\n },\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;AAEA,uBAAe,aAAa,CAAC,EAC3B,SACA,OACA,OACD,KAAK;CACJ,MAAM,CACJ,cAAc,SACd,EACE,gBAAgB,MAChB,QAAQ,GACR,WAAW,GACX,aAAa,GACb,OAAO,CAAE,GACV,GAAG,CAAE,EACP,GAAG,QAAQ;CAGZ,MAAM,KAAK,KAAK,CAAC,IAAI,WAAW;EAC9B,IAAI;;;;EAKJ,IAAI,YAAY;;;;EAKhB,IAAI,cAAc;EAClB,IAAI,kBAAkB;AACtB,OAAK,MAAM,CACT,KACA,EACE,QAAQ,EACN,aACA,KACA,MACA,KACA,MACD,EACF,CACF,IAAI,GAAG,OAAO,SAAS,EAAE;AAExB,OAAI,aACF,cAAc;AAGhB,OAAI,WAAW,CACb,UAAU,KACX,EAAC,SAAS,KAAK,QAAQ,MAAM,EAAE,GAAG,MAAM,CACvC;GAGF,MAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACzC,OACE,SAAS,CAAC,QACT,gBAAgB,WACf,WAAW,KAAK,QAAQ,MAAM,EAAE,GAAG,UAAU,UAE/C;IACA,cAAc;AAEd;GACD;AAED,OAAI,CAAC,KAAK;AACR,QAAI,OACF;SAEA,kBAAkB;IAGpB,YAAY,QAAQ,MAAM;GAC3B;GAED,UAAU;EACX;AAED,MACE,OAAO,aAAa,YACpB,cAAc,QAAQ,WAAW,MAAM,KAAK,SAAS,GACrD;GACA,MAAM,WAAW,WAAW;AAE5B,OAAI,WAAW,GAAG;IAChB,MAAM,QAAQ,MAAM;KAClB,MAAM,UA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EACtD,EACE,MAAM,oBACP,GACD,MAAM;GACJ,MAAM,oBAAoB,CAAC,MAAM,YAAY,cAAc;AACzD,WAAO,CACL,GAAG,WACH,GAAG,MAAM,KAAK,EACZ,QAAQ,CAAC,aACV,GAAE,MAAM;AACP,YAAO;IACR,EAAC,AACH,EAAC,IAAI,CAAC,SAAS;AACd,YAAO;MACL,QAAQ;MACR,QAAQ;MACR,QAAQ,WAAW;OACjB,GAAG;OACH,aAAa;OACb,eAAe,KAAK,MAAM,GAAG,KAAK,gBAAgB;MACnD,EAAC;KACH;IACF,EAAC;GACH,EAAC;EACH,EACF;CAEJ;AACF,GAAE;CACD,kBAAkB;CAClB,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,MAAM;IACJ;IAAU;IAAO;GAClB;GACD,MAAM;EACP,GACD;GACE,sBAAsB;GACtB,YAAY;IACV,eAAe,EACb,MAAM,UACP;IACD,OAAO,EACL,MAAM,UACP;IACD,UAAU,EACR,OAAO,CACL,EACE,MAAM,UACP,GACD,EACE,MAAM,OACP,CACF,EACF;IACD,YAAY,EACV,OAAO,CACL,EACE,MAAM,UACP,GACD,EACE,MAAM,OACP,CACF,EACF;IACD,MAAM;KACJ,mBAAmB,EACjB,MAAM;MACJ,sBAAsB;MACtB,YAAY;OACV,OAAO,EACL,MAAM,UACP;OACD,OAAO;QACL,MAAM;SACJ;SAAU;SAAS;QACpB;QACD,MAAM;OACP;MACF;KACF,EACF;KACD,MAAM;IACP;GACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/textEscaping.js
|
|
4
|
-
const htmlRegex = /(<|&(?!(?:amp|lt|gt|quot|apos);))(?=\S)/v;
|
|
5
|
-
const markdownRegex = /(?<!\\)(`+)([^`]+)\1(?!`)/v;
|
|
6
|
-
/**
|
|
7
|
-
* @param {string} desc
|
|
8
|
-
* @returns {string}
|
|
9
|
-
*/
|
|
10
|
-
const htmlReplacer = (desc) => {
|
|
11
|
-
return desc.replaceAll(new RegExp(htmlRegex, "gv"), (_) => {
|
|
12
|
-
if (_ === "<") return "<";
|
|
13
|
-
return "&";
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @param {string} desc
|
|
18
|
-
* @returns {string}
|
|
19
|
-
*/
|
|
20
|
-
const markdownReplacer = (desc) => {
|
|
21
|
-
return desc.replaceAll(new RegExp(markdownRegex, "gv"), (_, backticks, encapsed) => {
|
|
22
|
-
const bookend = "`".repeat(backticks.length);
|
|
23
|
-
return `\\${bookend}${encapsed}${bookend}`;
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var textEscaping_default = iterateJsdoc(({ context, jsdoc, utils }) => {
|
|
27
|
-
const { escapeHTML, escapeMarkdown } = context.options[0] || {};
|
|
28
|
-
if (!escapeHTML && !escapeMarkdown) {
|
|
29
|
-
context.report({
|
|
30
|
-
loc: {
|
|
31
|
-
end: {
|
|
32
|
-
column: 1,
|
|
33
|
-
line: 1
|
|
34
|
-
},
|
|
35
|
-
start: {
|
|
36
|
-
column: 1,
|
|
37
|
-
line: 1
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
message: "You must include either `escapeHTML` or `escapeMarkdown`"
|
|
41
|
-
});
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const { descriptions } = utils.getDescription();
|
|
45
|
-
if (escapeHTML) {
|
|
46
|
-
if (descriptions.some((desc) => {
|
|
47
|
-
return htmlRegex.test(desc);
|
|
48
|
-
})) {
|
|
49
|
-
const line = utils.setDescriptionLines(htmlRegex, htmlReplacer);
|
|
50
|
-
utils.reportJSDoc("You have unescaped HTML characters < or &", { line }, () => {}, true);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
for (const tag of jsdoc.tags) {
|
|
54
|
-
if (tag.tag === "example") continue;
|
|
55
|
-
if (utils.getTagDescription(tag, true).some((desc) => {
|
|
56
|
-
return htmlRegex.test(desc);
|
|
57
|
-
})) {
|
|
58
|
-
const line = utils.setTagDescription(tag, htmlRegex, htmlReplacer) + tag.source[0].number;
|
|
59
|
-
utils.reportJSDoc("You have unescaped HTML characters < or & in a tag", { line }, () => {}, true);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (descriptions.some((desc) => {
|
|
65
|
-
return markdownRegex.test(desc);
|
|
66
|
-
})) {
|
|
67
|
-
const line = utils.setDescriptionLines(markdownRegex, markdownReplacer);
|
|
68
|
-
utils.reportJSDoc("You have unescaped Markdown backtick sequences", { line }, () => {}, true);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
for (const tag of jsdoc.tags) {
|
|
72
|
-
if (tag.tag === "example") continue;
|
|
73
|
-
if (utils.getTagDescription(tag, true).some((desc) => {
|
|
74
|
-
return markdownRegex.test(desc);
|
|
75
|
-
})) {
|
|
76
|
-
const line = utils.setTagDescription(tag, markdownRegex, markdownReplacer) + tag.source[0].number;
|
|
77
|
-
utils.reportJSDoc("You have unescaped Markdown backtick sequences in a tag", { line }, () => {}, true);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
iterateAllJsdocs: true,
|
|
82
|
-
meta: {
|
|
83
|
-
docs: {
|
|
84
|
-
description: "Auto-escape certain characters that are input within block and tag descriptions.",
|
|
85
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/text-escaping.md#repos-sticky-header"
|
|
86
|
-
},
|
|
87
|
-
fixable: "code",
|
|
88
|
-
schema: [{
|
|
89
|
-
additionalProperties: false,
|
|
90
|
-
properties: {
|
|
91
|
-
escapeHTML: { type: "boolean" },
|
|
92
|
-
escapeMarkdown: { type: "boolean" }
|
|
93
|
-
},
|
|
94
|
-
type: "object"
|
|
95
|
-
}],
|
|
96
|
-
type: "suggestion"
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
export { textEscaping_default as default };
|
|
102
|
-
//# sourceMappingURL=textEscaping.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"textEscaping.js","names":[],"sources":["../../src/rules/textEscaping.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n// We could disallow raw gt, quot, and apos, but allow for parity; but we do\n// not allow hex or decimal character references\nconst htmlRegex = /(<|&(?!(?:amp|lt|gt|quot|apos);))(?=\\S)/v;\nconst markdownRegex = /(?<!\\\\)(`+)([^`]+)\\1(?!`)/v;\n\n/**\n * @param {string} desc\n * @returns {string}\n */\nconst htmlReplacer = (desc) => {\n return desc.replaceAll(new RegExp(htmlRegex, 'gv'), (_) => {\n if (_ === '<') {\n return '<';\n }\n\n return '&';\n });\n};\n\n/**\n * @param {string} desc\n * @returns {string}\n */\nconst markdownReplacer = (desc) => {\n return desc.replaceAll(new RegExp(markdownRegex, 'gv'), (_, backticks, encapsed) => {\n const bookend = '`'.repeat(backticks.length);\n return `\\\\${bookend}${encapsed}${bookend}`;\n });\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n escapeHTML,\n escapeMarkdown,\n } = context.options[0] || {};\n\n if (!escapeHTML && !escapeMarkdown) {\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: 'You must include either `escapeHTML` or `escapeMarkdown`',\n });\n return;\n }\n\n const {\n descriptions,\n } = utils.getDescription();\n\n if (escapeHTML) {\n if (descriptions.some((desc) => {\n return htmlRegex.test(desc);\n })) {\n const line = utils.setDescriptionLines(htmlRegex, htmlReplacer);\n utils.reportJSDoc('You have unescaped HTML characters < or &', {\n line,\n }, () => {}, true);\n return;\n }\n\n for (const tag of jsdoc.tags) {\n if (tag.tag === 'example') {\n continue;\n }\n\n if (/** @type {string[]} */ (\n utils.getTagDescription(tag, true)\n ).some((desc) => {\n return htmlRegex.test(desc);\n })) {\n const line = utils.setTagDescription(tag, htmlRegex, htmlReplacer) +\n tag.source[0].number;\n utils.reportJSDoc('You have unescaped HTML characters < or & in a tag', {\n line,\n }, () => {}, true);\n }\n }\n\n return;\n }\n\n if (descriptions.some((desc) => {\n return markdownRegex.test(desc);\n })) {\n const line = utils.setDescriptionLines(markdownRegex, markdownReplacer);\n utils.reportJSDoc('You have unescaped Markdown backtick sequences', {\n line,\n }, () => {}, true);\n return;\n }\n\n for (const tag of jsdoc.tags) {\n if (tag.tag === 'example') {\n continue;\n }\n\n if (/** @type {string[]} */ (\n utils.getTagDescription(tag, true)\n ).some((desc) => {\n return markdownRegex.test(desc);\n })) {\n const line = utils.setTagDescription(\n tag, markdownRegex, markdownReplacer,\n ) + tag.source[0].number;\n utils.reportJSDoc(\n 'You have unescaped Markdown backtick sequences in a tag',\n {\n line,\n },\n () => {},\n true,\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Auto-escape certain characters that are input within block and tag descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/text-escaping.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n // Option properties here (or remove the object)\n escapeHTML: {\n type: 'boolean',\n },\n escapeMarkdown: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;AAIA,MAAM,YAAY;AAClB,MAAM,gBAAgB;;;;;AAMtB,MAAM,eAAe,CAAC,SAAS;AAC7B,QAAO,KAAK,WAAW,IAAI,OAAO,WAAW,OAAO,CAAC,MAAM;AACzD,MAAI,MAAM,IACR,QAAO;AAGT,SAAO;CACR,EAAC;AACH;;;;;AAMD,MAAM,mBAAmB,CAAC,SAAS;AACjC,QAAO,KAAK,WAAW,IAAI,OAA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AAE,GAAE,KAAK;AAClB;CACD;AAED,MAAK,MAAM,OAAO,MAAM,MAAM;AAC5B,MAAI,IAAI,QAAQ,UACd;AAGF,MACE,MAAM,kBAAkB,KAAK,KAAK,CAClC,KAAK,CAAC,SAAS;AACf,UAAO,cAAc,KAAK,KAAK;EAChC,EAAC,EAAE;GACF,MAAM,OAAO,MAAM,kBACjB,KAAK,eAAe,iBACrB,GAAG,IAAI,OAAO,GAAG;GAClB,MAAM,YACJ,2DACA,EACE,KACD,GACD,MAAM,CAAE,GACR,KACD;EACF;CACF;AACF,GAAE;CACD,kBAAkB;CAClB,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY;IAEV,YAAY,EACV,MAAM,UACP;IACD,gBAAgB,EACd,MAAM,UACP;GACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
package/dist/rules/validTypes.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
import { parse, traverse, tryParse } from "@es-joy/jsdoccomment";
|
|
3
|
-
|
|
4
|
-
//#region src/rules/validTypes.js
|
|
5
|
-
const inlineTags = new Set([
|
|
6
|
-
"link",
|
|
7
|
-
"linkcode",
|
|
8
|
-
"linkplain",
|
|
9
|
-
"tutorial"
|
|
10
|
-
]);
|
|
11
|
-
const jsdocTypePrattKeywords = new Set([
|
|
12
|
-
"import",
|
|
13
|
-
"is",
|
|
14
|
-
"readonly",
|
|
15
|
-
"typeof"
|
|
16
|
-
]);
|
|
17
|
-
const asExpression = /as\s+/v;
|
|
18
|
-
const suppressTypes = new Set([
|
|
19
|
-
"accessControls",
|
|
20
|
-
"checkDebuggerStatement",
|
|
21
|
-
"checkEs5InheritanceCorrectnessConditions",
|
|
22
|
-
"checkPrototypalTypes",
|
|
23
|
-
"checkRegExp",
|
|
24
|
-
"checkTypes",
|
|
25
|
-
"checkVars",
|
|
26
|
-
"closureClassChecks",
|
|
27
|
-
"closureDepMethodUsageChecks",
|
|
28
|
-
"const",
|
|
29
|
-
"constantProperty",
|
|
30
|
-
"dangerousUnrecognizedTypeError",
|
|
31
|
-
"deprecated",
|
|
32
|
-
"duplicate",
|
|
33
|
-
"es5Strict",
|
|
34
|
-
"externsValidation",
|
|
35
|
-
"extraProvide",
|
|
36
|
-
"extraRequire",
|
|
37
|
-
"globalThis",
|
|
38
|
-
"invalidCasts",
|
|
39
|
-
"lateProvide",
|
|
40
|
-
"legacyGoogScopeRequire",
|
|
41
|
-
"lintChecks",
|
|
42
|
-
"lintVarDeclarations",
|
|
43
|
-
"messageConventions",
|
|
44
|
-
"misplacedTypeAnnotation",
|
|
45
|
-
"missingOverride",
|
|
46
|
-
"missingPolyfill",
|
|
47
|
-
"missingProperties",
|
|
48
|
-
"missingProvide",
|
|
49
|
-
"missingRequire",
|
|
50
|
-
"missingReturn",
|
|
51
|
-
"missingSourcesWarnings",
|
|
52
|
-
"moduleLoad",
|
|
53
|
-
"msgDescriptions",
|
|
54
|
-
"nonStandardJsDocs",
|
|
55
|
-
"partialAlias",
|
|
56
|
-
"polymer",
|
|
57
|
-
"reportUnknownTypes",
|
|
58
|
-
"strictCheckTypes",
|
|
59
|
-
"strictMissingProperties",
|
|
60
|
-
"strictModuleDepCheck",
|
|
61
|
-
"strictPrimitiveOperators",
|
|
62
|
-
"suspiciousCode",
|
|
63
|
-
"switch",
|
|
64
|
-
"transitionalSuspiciousCodeWarnings",
|
|
65
|
-
"undefinedNames",
|
|
66
|
-
"undefinedVars",
|
|
67
|
-
"underscore",
|
|
68
|
-
"unknownDefines",
|
|
69
|
-
"untranspilableFeatures",
|
|
70
|
-
"unusedLocalVariables",
|
|
71
|
-
"unusedPrivateMembers",
|
|
72
|
-
"uselessCode",
|
|
73
|
-
"useOfGoogProvide",
|
|
74
|
-
"visibility",
|
|
75
|
-
"with"
|
|
76
|
-
]);
|
|
77
|
-
/**
|
|
78
|
-
* @param {string} path
|
|
79
|
-
* @returns {boolean}
|
|
80
|
-
*/
|
|
81
|
-
const tryParsePathIgnoreError = (path) => {
|
|
82
|
-
try {
|
|
83
|
-
tryParse(path);
|
|
84
|
-
return true;
|
|
85
|
-
} catch {}
|
|
86
|
-
return false;
|
|
87
|
-
};
|
|
88
|
-
var validTypes_default = iterateJsdoc(({ context, jsdoc, report, settings, utils }) => {
|
|
89
|
-
const { allowEmptyNamepaths = false } = context.options[0] || {};
|
|
90
|
-
const { mode } = settings;
|
|
91
|
-
for (const tag of jsdoc.tags) {
|
|
92
|
-
/**
|
|
93
|
-
* @param {string} namepath
|
|
94
|
-
* @param {string} [tagName]
|
|
95
|
-
* @returns {boolean}
|
|
96
|
-
*/
|
|
97
|
-
const validNamepathParsing = function(namepath, tagName) {
|
|
98
|
-
if (tryParsePathIgnoreError(namepath) || jsdocTypePrattKeywords.has(namepath)) return true;
|
|
99
|
-
let handled = false;
|
|
100
|
-
if (tagName) switch (tagName) {
|
|
101
|
-
case "memberof":
|
|
102
|
-
case "memberof!": {
|
|
103
|
-
const endChar = namepath.slice(-1);
|
|
104
|
-
if ([
|
|
105
|
-
"#",
|
|
106
|
-
".",
|
|
107
|
-
"~"
|
|
108
|
-
].includes(endChar)) handled = tryParsePathIgnoreError(namepath.slice(0, -1));
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
case "module":
|
|
112
|
-
case "requires":
|
|
113
|
-
if (!namepath.startsWith("module:")) handled = tryParsePathIgnoreError(`module:${namepath}`);
|
|
114
|
-
break;
|
|
115
|
-
case "borrows": {
|
|
116
|
-
const startChar = namepath.charAt(0);
|
|
117
|
-
if ([
|
|
118
|
-
"#",
|
|
119
|
-
".",
|
|
120
|
-
"~"
|
|
121
|
-
].includes(startChar)) handled = tryParsePathIgnoreError(namepath.slice(1));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (!handled) {
|
|
125
|
-
report(`Syntax error in namepath: ${namepath}`, null, tag);
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
return true;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* @param {string} type
|
|
132
|
-
* @returns {boolean}
|
|
133
|
-
*/
|
|
134
|
-
const validTypeParsing = function(type) {
|
|
135
|
-
let parsedTypes;
|
|
136
|
-
try {
|
|
137
|
-
if (mode === "permissive") parsedTypes = tryParse(type);
|
|
138
|
-
else parsedTypes = parse(type, mode);
|
|
139
|
-
} catch {
|
|
140
|
-
report(`Syntax error in type: ${type}`, null, tag);
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
if (mode === "closure" || mode === "typescript") traverse(parsedTypes, (node) => {
|
|
144
|
-
const { type: typ } = node;
|
|
145
|
-
if ((typ === "JsdocTypeObjectField" || typ === "JsdocTypeKeyValue") && node.right?.type === "JsdocTypeNullable" && node.right?.meta?.position === "suffix") report(`Syntax error in type: ${node.right.type}`, null, tag);
|
|
146
|
-
});
|
|
147
|
-
return true;
|
|
148
|
-
};
|
|
149
|
-
if (tag.problems.length) {
|
|
150
|
-
const msg = tag.problems.reduce((str, { message }) => {
|
|
151
|
-
return str + "; " + message;
|
|
152
|
-
}, "").slice(2);
|
|
153
|
-
report(`Invalid name: ${msg}`, null, tag);
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
if (tag.tag === "import") continue;
|
|
157
|
-
if (tag.tag === "borrows") {
|
|
158
|
-
const thisNamepath = utils.getTagDescription(tag).replace(asExpression, "").trim();
|
|
159
|
-
if (!asExpression.test(utils.getTagDescription(tag)) || !thisNamepath) {
|
|
160
|
-
report(`@borrows must have an "as" expression. Found "${utils.getTagDescription(tag)}"`, null, tag);
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
if (validNamepathParsing(thisNamepath, "borrows")) {
|
|
164
|
-
const thatNamepath = tag.name;
|
|
165
|
-
validNamepathParsing(thatNamepath);
|
|
166
|
-
}
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
if (tag.tag === "suppress" && mode === "closure") {
|
|
170
|
-
let parsedTypes;
|
|
171
|
-
try {
|
|
172
|
-
parsedTypes = tryParse(tag.type);
|
|
173
|
-
} catch {}
|
|
174
|
-
if (parsedTypes) traverse(parsedTypes, (node) => {
|
|
175
|
-
let type;
|
|
176
|
-
if ("value" in node && typeof node.value === "string") type = node.value;
|
|
177
|
-
if (type !== void 0 && !suppressTypes.has(type)) report(`Syntax error in suppress type: ${type}`, null, tag);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
const otherModeMaps = [
|
|
181
|
-
"jsdoc",
|
|
182
|
-
"typescript",
|
|
183
|
-
"closure",
|
|
184
|
-
"permissive"
|
|
185
|
-
].filter((mde) => {
|
|
186
|
-
return mde !== mode;
|
|
187
|
-
}).map((mde) => {
|
|
188
|
-
return utils.getTagStructureForMode(mde);
|
|
189
|
-
});
|
|
190
|
-
const tagMightHaveNamePosition = utils.tagMightHaveNamePosition(tag.tag, otherModeMaps);
|
|
191
|
-
if (tagMightHaveNamePosition !== true && tag.name) {
|
|
192
|
-
const modeInfo = tagMightHaveNamePosition === false ? "" : ` in "${mode}" mode`;
|
|
193
|
-
report(`@${tag.tag} should not have a name${modeInfo}.`, null, tag);
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
if (tag.type.trim().startsWith("@")) {
|
|
197
|
-
tag.description = `{${tag.type}} ${tag.description}`;
|
|
198
|
-
tag.type = "";
|
|
199
|
-
}
|
|
200
|
-
const mightHaveTypePosition = utils.tagMightHaveTypePosition(tag.tag, otherModeMaps);
|
|
201
|
-
if (mightHaveTypePosition !== true && tag.type) {
|
|
202
|
-
const modeInfo = mightHaveTypePosition === false ? "" : ` in "${mode}" mode`;
|
|
203
|
-
report(`@${tag.tag} should not have a bracketed type${modeInfo}.`, null, tag);
|
|
204
|
-
continue;
|
|
205
|
-
}
|
|
206
|
-
const tagMustHaveNamePosition = utils.tagMustHaveNamePosition(tag.tag, otherModeMaps);
|
|
207
|
-
if (tagMustHaveNamePosition !== false && !tag.name && !allowEmptyNamepaths && ![
|
|
208
|
-
"arg",
|
|
209
|
-
"argument",
|
|
210
|
-
"param",
|
|
211
|
-
"prop",
|
|
212
|
-
"property"
|
|
213
|
-
].includes(tag.tag) && (tag.tag !== "see" || !utils.getTagDescription(tag).includes("{@link"))) {
|
|
214
|
-
const modeInfo = tagMustHaveNamePosition === true ? "" : ` in "${mode}" mode`;
|
|
215
|
-
report(`Tag @${tag.tag} must have a name/namepath${modeInfo}.`, null, tag);
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
const mustHaveTypePosition = utils.tagMustHaveTypePosition(tag.tag, otherModeMaps);
|
|
219
|
-
if (mustHaveTypePosition !== false && !tag.type) {
|
|
220
|
-
const modeInfo = mustHaveTypePosition === true ? "" : ` in "${mode}" mode`;
|
|
221
|
-
report(`Tag @${tag.tag} must have a type${modeInfo}.`, null, tag);
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
const tagMissingRequiredTypeOrNamepath = utils.tagMissingRequiredTypeOrNamepath(tag, otherModeMaps);
|
|
225
|
-
if (tagMissingRequiredTypeOrNamepath !== false && !allowEmptyNamepaths) {
|
|
226
|
-
const modeInfo = tagMissingRequiredTypeOrNamepath === true ? "" : ` in "${mode}" mode`;
|
|
227
|
-
report(`Tag @${tag.tag} must have either a type or namepath${modeInfo}.`, null, tag);
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
const hasTypePosition = mightHaveTypePosition === true && Boolean(tag.type);
|
|
231
|
-
if (hasTypePosition) validTypeParsing(tag.type);
|
|
232
|
-
const hasNameOrNamepathPosition = (tagMustHaveNamePosition !== false || utils.tagMightHaveNamepath(tag.tag)) && Boolean(tag.name);
|
|
233
|
-
if (hasNameOrNamepathPosition) if (mode !== "jsdoc" && tag.tag === "template") for (const namepath of utils.parseClosureTemplateTag(tag)) validNamepathParsing(namepath);
|
|
234
|
-
else validNamepathParsing(tag.name, tag.tag);
|
|
235
|
-
for (const inlineTag of tag.inlineTags) if (inlineTags.has(inlineTag.tag) && !inlineTag.text && !inlineTag.namepathOrURL) report(`Inline tag "${inlineTag.tag}" missing content`, null, tag);
|
|
236
|
-
}
|
|
237
|
-
for (const inlineTag of jsdoc.inlineTags) if (inlineTags.has(inlineTag.tag) && !inlineTag.text && !inlineTag.namepathOrURL) report(`Inline tag "${inlineTag.tag}" missing content`);
|
|
238
|
-
}, {
|
|
239
|
-
iterateAllJsdocs: true,
|
|
240
|
-
meta: {
|
|
241
|
-
docs: {
|
|
242
|
-
description: "Requires all types to be valid JSDoc or Closure compiler types without syntax errors.",
|
|
243
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/valid-types.md#repos-sticky-header"
|
|
244
|
-
},
|
|
245
|
-
schema: [{
|
|
246
|
-
additionalProperties: false,
|
|
247
|
-
properties: { allowEmptyNamepaths: {
|
|
248
|
-
default: false,
|
|
249
|
-
type: "boolean"
|
|
250
|
-
} },
|
|
251
|
-
type: "object"
|
|
252
|
-
}],
|
|
253
|
-
type: "suggestion"
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
//#endregion
|
|
258
|
-
export { validTypes_default as default };
|
|
259
|
-
//# sourceMappingURL=validTypes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validTypes.js","names":[],"sources":["../../src/rules/validTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse,\n traverse,\n tryParse,\n} from '@es-joy/jsdoccomment';\n\nconst inlineTags = new Set([\n 'link', 'linkcode', 'linkplain',\n 'tutorial',\n]);\n\nconst jsdocTypePrattKeywords = new Set([\n 'import',\n 'is',\n 'readonly',\n 'typeof',\n]);\n\nconst asExpression = /as\\s+/v;\n\nconst suppressTypes = new Set([\n // https://github.com/google/closure-compiler/wiki/@suppress-annotations\n // https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/ParserConfig.properties#L154\n 'accessControls',\n 'checkDebuggerStatement',\n 'checkEs5InheritanceCorrectnessConditions',\n 'checkPrototypalTypes',\n 'checkRegExp',\n 'checkTypes',\n 'checkVars',\n 'closureClassChecks',\n 'closureDepMethodUsageChecks',\n 'const',\n 'constantProperty',\n 'dangerousUnrecognizedTypeError',\n 'deprecated',\n 'duplicate',\n 'es5Strict',\n 'externsValidation',\n 'extraProvide',\n 'extraRequire',\n 'globalThis',\n 'invalidCasts',\n 'lateProvide',\n 'legacyGoogScopeRequire',\n 'lintChecks',\n 'lintVarDeclarations',\n 'messageConventions',\n 'misplacedTypeAnnotation',\n 'missingOverride',\n 'missingPolyfill',\n 'missingProperties',\n 'missingProvide',\n 'missingRequire',\n 'missingReturn',\n 'missingSourcesWarnings',\n 'moduleLoad',\n 'msgDescriptions',\n 'nonStandardJsDocs',\n 'partialAlias',\n 'polymer',\n 'reportUnknownTypes',\n 'strictCheckTypes',\n 'strictMissingProperties',\n 'strictModuleDepCheck',\n 'strictPrimitiveOperators',\n 'suspiciousCode',\n\n // Not documented in enum\n 'switch',\n 'transitionalSuspiciousCodeWarnings',\n 'undefinedNames',\n 'undefinedVars',\n 'underscore',\n 'unknownDefines',\n 'untranspilableFeatures',\n 'unusedLocalVariables',\n\n // Not documented?\n 'unusedPrivateMembers',\n 'uselessCode',\n 'useOfGoogProvide',\n 'visibility',\n 'with',\n]);\n\n/**\n * @param {string} path\n * @returns {boolean}\n */\nconst tryParsePathIgnoreError = (path) => {\n try {\n tryParse(path);\n\n return true;\n } catch {\n // Keep the original error for including the whole type\n }\n\n return false;\n};\n\n// eslint-disable-next-line complexity\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n settings,\n utils,\n}) => {\n const {\n allowEmptyNamepaths = false,\n } = context.options[0] || {};\n const {\n mode,\n } = settings;\n\n for (const tag of jsdoc.tags) {\n /**\n * @param {string} namepath\n * @param {string} [tagName]\n * @returns {boolean}\n */\n const validNamepathParsing = function (namepath, tagName) {\n if (\n tryParsePathIgnoreError(namepath) ||\n jsdocTypePrattKeywords.has(namepath)\n ) {\n return true;\n }\n\n let handled = false;\n\n if (tagName) {\n switch (tagName) {\n case 'memberof':\n case 'memberof!': {\n const endChar = namepath.slice(-1);\n if ([\n '#', '.', '~',\n ].includes(endChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(0, -1));\n }\n\n break;\n }\n\n case 'module': case 'requires': {\n if (!namepath.startsWith('module:')) {\n handled = tryParsePathIgnoreError(`module:${namepath}`);\n }\n\n break;\n }\n\n case 'borrows': {\n const startChar = namepath.charAt(0);\n if ([\n '#', '.', '~',\n ].includes(startChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(1));\n }\n }\n }\n }\n\n if (!handled) {\n report(`Syntax error in namepath: ${namepath}`, null, tag);\n\n return false;\n }\n\n return true;\n };\n\n /**\n * @param {string} type\n * @returns {boolean}\n */\n const validTypeParsing = function (type) {\n let parsedTypes;\n try {\n if (mode === 'permissive') {\n parsedTypes = tryParse(type);\n } else {\n parsedTypes = parse(type, mode);\n }\n } catch {\n report(`Syntax error in type: ${type}`, null, tag);\n\n return false;\n }\n\n if (mode === 'closure' || mode === 'typescript') {\n traverse(parsedTypes, (node) => {\n const {\n type: typ,\n } = node;\n\n if (\n (typ === 'JsdocTypeObjectField' || typ === 'JsdocTypeKeyValue') &&\n node.right?.type === 'JsdocTypeNullable' &&\n node.right?.meta?.position === 'suffix'\n ) {\n report(`Syntax error in type: ${node.right.type}`, null, tag);\n }\n });\n }\n\n return true;\n };\n\n if (tag.problems.length) {\n const msg = tag.problems.reduce((str, {\n message,\n }) => {\n return str + '; ' + message;\n }, '').slice(2);\n report(`Invalid name: ${msg}`, null, tag);\n continue;\n }\n\n if (tag.tag === 'import') {\n // A named import will look like a type, but not be valid; we also don't\n // need to check the name/namepath\n continue;\n }\n\n if (tag.tag === 'borrows') {\n const thisNamepath = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(asExpression, '')\n .trim();\n\n if (!asExpression.test(/** @type {string} */ (\n utils.getTagDescription(tag)\n )) || !thisNamepath) {\n report(`@borrows must have an \"as\" expression. Found \"${utils.getTagDescription(tag)}\"`, null, tag);\n\n continue;\n }\n\n if (validNamepathParsing(thisNamepath, 'borrows')) {\n const thatNamepath = tag.name;\n\n validNamepathParsing(thatNamepath);\n }\n\n continue;\n }\n\n if (tag.tag === 'suppress' && mode === 'closure') {\n let parsedTypes;\n\n try {\n parsedTypes = tryParse(tag.type);\n } catch {\n // Ignore\n }\n\n if (parsedTypes) {\n traverse(parsedTypes, (node) => {\n let type;\n if ('value' in node && typeof node.value === 'string') {\n type = node.value;\n }\n\n if (type !== undefined && !suppressTypes.has(type)) {\n report(`Syntax error in suppress type: ${type}`, null, tag);\n }\n });\n }\n }\n\n const otherModeMaps = /** @type {import('../jsdocUtils.js').ParserMode[]} */ ([\n 'jsdoc', 'typescript', 'closure', 'permissive',\n ]).filter(\n (mde) => {\n return mde !== mode;\n },\n ).map((mde) => {\n return utils.getTagStructureForMode(mde);\n });\n\n const tagMightHaveNamePosition = utils.tagMightHaveNamePosition(tag.tag, otherModeMaps);\n if (tagMightHaveNamePosition !== true && tag.name) {\n const modeInfo = tagMightHaveNamePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a name${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // Documentation like `@returns {@link SomeType}` is technically ambiguous. Specifically it\n // could either be intepreted as a type `\"@link SomeType\"` or a description `\"{@link SomeType}\"`.\n // However this is a good heuristic.\n if (tag.type.trim().startsWith('@')) {\n tag.description = `{${tag.type}} ${tag.description}`;\n tag.type = '';\n }\n\n const mightHaveTypePosition = utils.tagMightHaveTypePosition(tag.tag, otherModeMaps);\n if (mightHaveTypePosition !== true && tag.type) {\n const modeInfo = mightHaveTypePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a bracketed type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED NAME\n const tagMustHaveNamePosition = utils.tagMustHaveNamePosition(tag.tag, otherModeMaps);\n\n // Don't handle `@param` here though it does require name as handled by\n // `require-param-name` (`@property` would similarly seem to require one,\n // but is handled by `require-property-name`)\n if (tagMustHaveNamePosition !== false && !tag.name && !allowEmptyNamepaths && ![\n 'arg', 'argument', 'param',\n 'prop', 'property',\n ].includes(tag.tag) &&\n (tag.tag !== 'see' || !utils.getTagDescription(tag).includes('{@link'))\n ) {\n const modeInfo = tagMustHaveNamePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a name/namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE\n const mustHaveTypePosition = utils.tagMustHaveTypePosition(tag.tag, otherModeMaps);\n if (mustHaveTypePosition !== false && !tag.type) {\n const modeInfo = mustHaveTypePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE OR NAME/NAMEPATH\n const tagMissingRequiredTypeOrNamepath = utils.tagMissingRequiredTypeOrNamepath(tag, otherModeMaps);\n if (tagMissingRequiredTypeOrNamepath !== false && !allowEmptyNamepaths) {\n const modeInfo = tagMissingRequiredTypeOrNamepath === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have either a type or namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // VALID TYPE\n const hasTypePosition = mightHaveTypePosition === true && Boolean(tag.type);\n if (hasTypePosition) {\n validTypeParsing(tag.type);\n }\n\n // VALID NAME/NAMEPATH\n const hasNameOrNamepathPosition = (\n tagMustHaveNamePosition !== false ||\n utils.tagMightHaveNamepath(tag.tag)\n ) && Boolean(tag.name);\n\n if (hasNameOrNamepathPosition) {\n if (mode !== 'jsdoc' && tag.tag === 'template') {\n for (const namepath of utils.parseClosureTemplateTag(tag)) {\n validNamepathParsing(namepath);\n }\n } else {\n validNamepathParsing(tag.name, tag.tag);\n }\n }\n\n for (const inlineTag of tag.inlineTags) {\n if (inlineTags.has(inlineTag.tag) && !inlineTag.text && !inlineTag.namepathOrURL) {\n report(`Inline tag \"${inlineTag.tag}\" missing content`, null, tag);\n }\n }\n }\n\n for (const inlineTag of jsdoc.inlineTags) {\n if (inlineTags.has(inlineTag.tag) && !inlineTag.text && !inlineTag.namepathOrURL) {\n report(`Inline tag \"${inlineTag.tag}\" missing content`);\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires all types to be valid JSDoc or Closure compiler types without syntax errors.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/valid-types.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowEmptyNamepaths: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;AAOA,MAAM,aAAa,IAAI,IAAI;CACzB;CAAQ;CAAY;CACpB;AACD;AAED,MAAM,yBAAyB,IAAI,IAAI;CACrC;CACA;CACA;CACA;AACD;AAED,MAAM,eAAe;AAErB,MAAM,gBAAgB,IAAI,IAAI;CAG5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;AACD;;;;;AAMD,MAAM,0BAA0B,CAAC,SAAS;AACxC,KAAI;EACF,SAAS,KAAK;AAEd,SAAO;CACR,QAAO,CAEP;AAED,QAAO;AACR;AAGD,yBAAe,aAAa,CAAC,EAC3B,SACA,OACA,QACA,UACA,OACD,KAAK;CACJ,MAAM,EACJ,sBAAsB,OACvB,GAAG,QAAQ,QAAQ,MAAM,CAAE;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