eslint-plugin-jsdoc 52.0.4 → 53.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 +18 -35
- package/dist/WarnSettings.cjs.map +1 -1
- package/dist/WarnSettings.js +20 -0
- package/dist/WarnSettings.js.map +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +32 -0
- package/dist/_virtual/rolldown_runtime.js +11 -0
- package/dist/alignTransform.cjs +224 -305
- package/dist/alignTransform.cjs.map +1 -1
- package/dist/alignTransform.js +241 -0
- package/dist/alignTransform.js.map +1 -0
- package/dist/defaultTagOrder.cjs +132 -43
- package/dist/defaultTagOrder.cjs.map +1 -1
- package/dist/defaultTagOrder.js +134 -0
- package/dist/defaultTagOrder.js.map +1 -0
- package/dist/exportParser.cjs +478 -696
- package/dist/exportParser.cjs.map +1 -1
- package/dist/exportParser.js +518 -0
- package/dist/exportParser.js.map +1 -0
- package/dist/getDefaultTagStructureForMode.cjs +184 -288
- package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
- package/dist/getDefaultTagStructureForMode.js +188 -0
- package/dist/getDefaultTagStructureForMode.js.map +1 -0
- package/dist/getJsdocProcessorPlugin.cjs +364 -550
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.d.cts +70 -0
- package/dist/getJsdocProcessorPlugin.d.cts.map +1 -0
- package/dist/getJsdocProcessorPlugin.d.ts +68 -65
- package/dist/getJsdocProcessorPlugin.d.ts.map +1 -1
- package/dist/getJsdocProcessorPlugin.js +383 -0
- package/dist/getJsdocProcessorPlugin.js.map +1 -0
- package/dist/index.cjs +2 -410
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -17
- package/dist/index.js +3 -0
- package/dist/iterateJsdoc.cjs +1528 -1988
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/iterateJsdoc.d.cts +471 -0
- package/dist/iterateJsdoc.d.cts.map +1 -0
- package/dist/iterateJsdoc.d.ts +358 -349
- package/dist/iterateJsdoc.d.ts.map +1 -1
- package/dist/iterateJsdoc.js +1617 -0
- package/dist/iterateJsdoc.js.map +1 -0
- package/dist/jsdocUtils.cjs +1009 -1376
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/jsdocUtils.js +1123 -0
- package/dist/jsdocUtils.js.map +1 -0
- package/dist/plugin.cjs +427 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.js +427 -0
- package/dist/plugin.js.map +1 -0
- package/dist/rules/checkAccess.cjs +29 -36
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAccess.js +33 -0
- package/dist/rules/checkAccess.js.map +1 -0
- package/dist/rules/checkAlignment.cjs +41 -54
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkAlignment.js +47 -0
- package/dist/rules/checkAlignment.js.map +1 -0
- package/dist/rules/checkExamples.cjs +327 -484
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkExamples.js +348 -0
- package/dist/rules/checkExamples.js.map +1 -0
- package/dist/rules/checkIndentation.cjs +50 -65
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkIndentation.js +59 -0
- package/dist/rules/checkIndentation.js.map +1 -0
- package/dist/rules/checkLineAlignment.cjs +220 -311
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.js +229 -0
- package/dist/rules/checkLineAlignment.js.map +1 -0
- package/dist/rules/checkParamNames.cjs +227 -335
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkParamNames.js +237 -0
- package/dist/rules/checkParamNames.js.map +1 -0
- package/dist/rules/checkPropertyNames.cjs +78 -106
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.js +88 -0
- package/dist/rules/checkPropertyNames.js.map +1 -0
- package/dist/rules/checkSyntax.cjs +21 -34
- package/dist/rules/checkSyntax.cjs.map +1 -1
- package/dist/rules/checkSyntax.js +25 -0
- package/dist/rules/checkSyntax.js.map +1 -0
- package/dist/rules/checkTagNames.cjs +188 -210
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTagNames.js +191 -0
- package/dist/rules/checkTagNames.js.map +1 -0
- package/dist/rules/checkTemplateNames.cjs +121 -178
- package/dist/rules/checkTemplateNames.cjs.map +1 -1
- package/dist/rules/checkTemplateNames.js +124 -0
- package/dist/rules/checkTemplateNames.js.map +1 -0
- package/dist/rules/checkTypes.cjs +291 -385
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkTypes.js +299 -0
- package/dist/rules/checkTypes.js.map +1 -0
- package/dist/rules/checkValues.cjs +100 -146
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/checkValues.js +103 -0
- package/dist/rules/checkValues.js.map +1 -0
- package/dist/rules/convertToJsdocComments.cjs +228 -306
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.js +231 -0
- package/dist/rules/convertToJsdocComments.js.map +1 -0
- package/dist/rules/emptyTags.cjs +62 -72
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/emptyTags.js +67 -0
- package/dist/rules/emptyTags.js.map +1 -0
- package/dist/rules/implementsOnClasses.cjs +36 -56
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.js +40 -0
- package/dist/rules/implementsOnClasses.js.map +1 -0
- package/dist/rules/importsAsDependencies.cjs +62 -99
- package/dist/rules/importsAsDependencies.cjs.map +1 -1
- package/dist/rules/importsAsDependencies.js +68 -0
- package/dist/rules/importsAsDependencies.js.map +1 -0
- package/dist/rules/informativeDocs.cjs +105 -142
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/informativeDocs.js +110 -0
- package/dist/rules/informativeDocs.js.map +1 -0
- package/dist/rules/linesBeforeBlock.cjs +70 -105
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.js +75 -0
- package/dist/rules/linesBeforeBlock.js.map +1 -0
- package/dist/rules/matchDescription.cjs +160 -222
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchDescription.js +167 -0
- package/dist/rules/matchDescription.js.map +1 -0
- package/dist/rules/matchName.cjs +73 -128
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/matchName.js +77 -0
- package/dist/rules/matchName.js.map +1 -0
- package/dist/rules/multilineBlocks.cjs +235 -352
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/multilineBlocks.js +245 -0
- package/dist/rules/multilineBlocks.js.map +1 -0
- package/dist/rules/noBadBlocks.cjs +63 -86
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.js +68 -0
- package/dist/rules/noBadBlocks.js.map +1 -0
- package/dist/rules/noBlankBlockDescriptions.cjs +35 -57
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.js +41 -0
- package/dist/rules/noBlankBlockDescriptions.js.map +1 -0
- package/dist/rules/noBlankBlocks.cjs +26 -48
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.js +30 -0
- package/dist/rules/noBlankBlocks.js.map +1 -0
- package/dist/rules/noDefaults.cjs +52 -79
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noDefaults.js +56 -0
- package/dist/rules/noDefaults.js.map +1 -0
- package/dist/rules/noMissingSyntax.cjs +115 -165
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.js +126 -0
- package/dist/rules/noMissingSyntax.js.map +1 -0
- package/dist/rules/noMultiAsterisks.cjs +48 -89
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.js +58 -0
- package/dist/rules/noMultiAsterisks.js.map +1 -0
- package/dist/rules/noRestrictedSyntax.cjs +45 -79
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.js +49 -0
- package/dist/rules/noRestrictedSyntax.js.map +1 -0
- package/dist/rules/noTypes.cjs +59 -80
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noTypes.js +65 -0
- package/dist/rules/noTypes.js.map +1 -0
- package/dist/rules/noUndefinedTypes.cjs +297 -388
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.js +303 -0
- package/dist/rules/noUndefinedTypes.js.map +1 -0
- package/dist/rules/requireAsteriskPrefix.cjs +108 -159
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.js +112 -0
- package/dist/rules/requireAsteriskPrefix.js.map +1 -0
- package/dist/rules/requireDescription.cjs +89 -129
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescription.js +95 -0
- package/dist/rules/requireDescription.js.map +1 -0
- package/dist/rules/requireDescriptionCompleteSentence.cjs +201 -262
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.js +220 -0
- package/dist/rules/requireDescriptionCompleteSentence.js.map +1 -0
- package/dist/rules/requireExample.cjs +73 -104
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireExample.js +77 -0
- package/dist/rules/requireExample.js.map +1 -0
- package/dist/rules/requireFileOverview.cjs +75 -129
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireFileOverview.js +81 -0
- package/dist/rules/requireFileOverview.js.map +1 -0
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +85 -133
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.js +89 -0
- package/dist/rules/requireHyphenBeforeParamDescription.js.map +1 -0
- package/dist/rules/requireJsdoc.cjs +384 -557
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireJsdoc.js +404 -0
- package/dist/rules/requireJsdoc.js.map +1 -0
- package/dist/rules/requireParam.cjs +336 -526
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParam.js +344 -0
- package/dist/rules/requireParam.js.map +1 -0
- package/dist/rules/requireParamDescription.cjs +55 -80
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamDescription.js +59 -0
- package/dist/rules/requireParamDescription.js.map +1 -0
- package/dist/rules/requireParamName.cjs +32 -50
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamName.js +36 -0
- package/dist/rules/requireParamName.js.map +1 -0
- package/dist/rules/requireParamType.cjs +55 -80
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requireParamType.js +59 -0
- package/dist/rules/requireParamType.js.map +1 -0
- package/dist/rules/requireProperty.cjs +31 -42
- package/dist/rules/requireProperty.cjs.map +1 -1
- package/dist/rules/requireProperty.js +35 -0
- package/dist/rules/requireProperty.js.map +1 -0
- package/dist/rules/requirePropertyDescription.cjs +17 -25
- package/dist/rules/requirePropertyDescription.cjs.map +1 -1
- package/dist/rules/requirePropertyDescription.js +21 -0
- package/dist/rules/requirePropertyDescription.js.map +1 -0
- package/dist/rules/requirePropertyName.cjs +17 -25
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyName.js +21 -0
- package/dist/rules/requirePropertyName.js.map +1 -0
- package/dist/rules/requirePropertyType.cjs +17 -25
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requirePropertyType.js +21 -0
- package/dist/rules/requirePropertyType.js.map +1 -0
- package/dist/rules/requireReturns.cjs +125 -203
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturns.js +131 -0
- package/dist/rules/requireReturns.js.map +1 -0
- package/dist/rules/requireReturnsCheck.cjs +60 -103
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.js +66 -0
- package/dist/rules/requireReturnsCheck.js.map +1 -0
- package/dist/rules/requireReturnsDescription.cjs +39 -54
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.js +43 -0
- package/dist/rules/requireReturnsDescription.js.map +1 -0
- package/dist/rules/requireReturnsType.cjs +32 -50
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireReturnsType.js +36 -0
- package/dist/rules/requireReturnsType.js.map +1 -0
- package/dist/rules/requireTemplate.cjs +119 -178
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireTemplate.js +122 -0
- package/dist/rules/requireTemplate.js.map +1 -0
- package/dist/rules/requireThrows.cjs +61 -95
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireThrows.js +67 -0
- package/dist/rules/requireThrows.js.map +1 -0
- package/dist/rules/requireYields.cjs +106 -166
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYields.js +115 -0
- package/dist/rules/requireYields.js.map +1 -0
- package/dist/rules/requireYieldsCheck.cjs +96 -152
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.js +105 -0
- package/dist/rules/requireYieldsCheck.js.map +1 -0
- package/dist/rules/sortTags.cjs +258 -444
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/sortTags.js +262 -0
- package/dist/rules/sortTags.js.map +1 -0
- package/dist/rules/tagLines.cjs +179 -266
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/tagLines.js +183 -0
- package/dist/rules/tagLines.js.map +1 -0
- package/dist/rules/textEscaping.cjs +92 -127
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/textEscaping.js +102 -0
- package/dist/rules/textEscaping.js.map +1 -0
- package/dist/rules/validTypes.cjs +252 -265
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/rules/validTypes.js +259 -0
- package/dist/rules/validTypes.js.map +1 -0
- package/dist/tagNames.cjs +134 -170
- package/dist/tagNames.cjs.map +1 -1
- package/dist/tagNames.js +144 -0
- package/dist/tagNames.js.map +1 -0
- package/dist/utils/hasReturnValue.cjs +246 -474
- package/dist/utils/hasReturnValue.cjs.map +1 -1
- package/dist/utils/hasReturnValue.js +265 -0
- package/dist/utils/hasReturnValue.js.map +1 -0
- package/package.json +40 -24
- package/dist/generateRule.cjs +0 -242
- package/dist/generateRule.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/src/WarnSettings.js +0 -34
- package/src/alignTransform.js +0 -358
- package/src/defaultTagOrder.js +0 -169
- package/src/exportParser.js +0 -978
- package/src/getDefaultTagStructureForMode.js +0 -969
- package/src/getJsdocProcessorPlugin.js +0 -672
- package/src/index.js +0 -530
- package/src/iterateJsdoc.js +0 -2518
- package/src/jsdocUtils.js +0 -1896
- package/src/rules/checkAccess.js +0 -45
- package/src/rules/checkAlignment.js +0 -63
- package/src/rules/checkExamples.js +0 -589
- package/src/rules/checkIndentation.js +0 -75
- package/src/rules/checkLineAlignment.js +0 -372
- package/src/rules/checkParamNames.js +0 -474
- package/src/rules/checkPropertyNames.js +0 -152
- package/src/rules/checkSyntax.js +0 -30
- package/src/rules/checkTagNames.js +0 -314
- package/src/rules/checkTemplateNames.js +0 -204
- package/src/rules/checkTypes.js +0 -535
- package/src/rules/checkValues.js +0 -248
- package/src/rules/convertToJsdocComments.js +0 -398
- package/src/rules/emptyTags.js +0 -98
- package/src/rules/implementsOnClasses.js +0 -64
- package/src/rules/importsAsDependencies.js +0 -133
- package/src/rules/informativeDocs.js +0 -189
- package/src/rules/linesBeforeBlock.js +0 -134
- package/src/rules/matchDescription.js +0 -286
- package/src/rules/matchName.js +0 -151
- package/src/rules/multilineBlocks.js +0 -493
- package/src/rules/noBadBlocks.js +0 -119
- package/src/rules/noBlankBlockDescriptions.js +0 -69
- package/src/rules/noBlankBlocks.js +0 -53
- package/src/rules/noDefaults.js +0 -85
- package/src/rules/noMissingSyntax.js +0 -195
- package/src/rules/noMultiAsterisks.js +0 -134
- package/src/rules/noRestrictedSyntax.js +0 -91
- package/src/rules/noTypes.js +0 -93
- package/src/rules/noUndefinedTypes.js +0 -543
- package/src/rules/requireAsteriskPrefix.js +0 -190
- package/src/rules/requireDescription.js +0 -161
- package/src/rules/requireDescriptionCompleteSentence.js +0 -335
- package/src/rules/requireExample.js +0 -118
- package/src/rules/requireFileOverview.js +0 -154
- package/src/rules/requireHyphenBeforeParamDescription.js +0 -176
- package/src/rules/requireJsdoc.js +0 -743
- package/src/rules/requireParam.js +0 -602
- package/src/rules/requireParamDescription.js +0 -89
- package/src/rules/requireParamName.js +0 -55
- package/src/rules/requireParamType.js +0 -89
- package/src/rules/requireProperty.js +0 -48
- package/src/rules/requirePropertyDescription.js +0 -25
- package/src/rules/requirePropertyName.js +0 -25
- package/src/rules/requirePropertyType.js +0 -25
- package/src/rules/requireReturns.js +0 -238
- package/src/rules/requireReturnsCheck.js +0 -145
- package/src/rules/requireReturnsDescription.js +0 -59
- package/src/rules/requireReturnsType.js +0 -51
- package/src/rules/requireTemplate.js +0 -201
- package/src/rules/requireThrows.js +0 -111
- package/src/rules/requireYields.js +0 -216
- package/src/rules/requireYieldsCheck.js +0 -208
- package/src/rules/sortTags.js +0 -558
- package/src/rules/tagLines.js +0 -359
- package/src/rules/textEscaping.js +0 -154
- package/src/rules/validTypes.js +0 -401
- package/src/tagNames.js +0 -238
- package/src/utils/hasReturnValue.js +0 -572
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
-
|
|
3
|
-
export default iterateJsdoc(({
|
|
4
|
-
context,
|
|
5
|
-
indent,
|
|
6
|
-
jsdoc,
|
|
7
|
-
utils,
|
|
8
|
-
}) => {
|
|
9
|
-
const [
|
|
10
|
-
defaultRequireValue = 'always',
|
|
11
|
-
{
|
|
12
|
-
tags: tagMap = {},
|
|
13
|
-
} = {},
|
|
14
|
-
] = context.options;
|
|
15
|
-
|
|
16
|
-
const {
|
|
17
|
-
source,
|
|
18
|
-
} = jsdoc;
|
|
19
|
-
|
|
20
|
-
const always = defaultRequireValue === 'always';
|
|
21
|
-
const never = defaultRequireValue === 'never';
|
|
22
|
-
|
|
23
|
-
/** @type {string} */
|
|
24
|
-
let currentTag;
|
|
25
|
-
source.some(({
|
|
26
|
-
number,
|
|
27
|
-
tokens,
|
|
28
|
-
}) => {
|
|
29
|
-
const {
|
|
30
|
-
delimiter,
|
|
31
|
-
description,
|
|
32
|
-
end,
|
|
33
|
-
tag,
|
|
34
|
-
} = tokens;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @returns {void}
|
|
38
|
-
*/
|
|
39
|
-
const neverFix = () => {
|
|
40
|
-
tokens.delimiter = '';
|
|
41
|
-
tokens.postDelimiter = '';
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @param {string} checkValue
|
|
46
|
-
* @returns {boolean}
|
|
47
|
-
*/
|
|
48
|
-
const checkNever = (checkValue) => {
|
|
49
|
-
if (delimiter && delimiter !== '/**' && (
|
|
50
|
-
never && !tagMap.always?.includes(checkValue) ||
|
|
51
|
-
tagMap.never?.includes(checkValue)
|
|
52
|
-
)) {
|
|
53
|
-
utils.reportJSDoc('Expected JSDoc line to have no prefix.', {
|
|
54
|
-
column: 0,
|
|
55
|
-
line: number,
|
|
56
|
-
}, neverFix);
|
|
57
|
-
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return false;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @returns {void}
|
|
66
|
-
*/
|
|
67
|
-
const alwaysFix = () => {
|
|
68
|
-
if (!tokens.start) {
|
|
69
|
-
tokens.start = indent + ' ';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
tokens.delimiter = '*';
|
|
73
|
-
tokens.postDelimiter = tag || description ? ' ' : '';
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @param {string} checkValue
|
|
78
|
-
* @returns {boolean}
|
|
79
|
-
*/
|
|
80
|
-
const checkAlways = (checkValue) => {
|
|
81
|
-
if (
|
|
82
|
-
!delimiter && (
|
|
83
|
-
always && !tagMap.never?.includes(checkValue) ||
|
|
84
|
-
tagMap.always?.includes(checkValue)
|
|
85
|
-
)
|
|
86
|
-
) {
|
|
87
|
-
utils.reportJSDoc('Expected JSDoc line to have the prefix.', {
|
|
88
|
-
column: 0,
|
|
89
|
-
line: number,
|
|
90
|
-
}, alwaysFix);
|
|
91
|
-
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return false;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
if (tag) {
|
|
99
|
-
// Remove at sign
|
|
100
|
-
currentTag = tag.slice(1);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
// If this is the end but has a tag, the delimiter will also be
|
|
105
|
-
// populated and will be safely ignored later
|
|
106
|
-
end && !tag
|
|
107
|
-
) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!currentTag) {
|
|
112
|
-
if (tagMap.any?.includes('*description')) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (checkNever('*description')) {
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (checkAlways('*description')) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (tagMap.any?.includes(currentTag)) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (checkNever(currentTag)) {
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (checkAlways(currentTag)) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return false;
|
|
140
|
-
});
|
|
141
|
-
}, {
|
|
142
|
-
iterateAllJsdocs: true,
|
|
143
|
-
meta: {
|
|
144
|
-
docs: {
|
|
145
|
-
description:
|
|
146
|
-
'Requires that each JSDoc line starts with an `*`.',
|
|
147
|
-
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-asterisk-prefix.md#repos-sticky-header',
|
|
148
|
-
},
|
|
149
|
-
fixable: 'code',
|
|
150
|
-
schema: [
|
|
151
|
-
{
|
|
152
|
-
enum: [
|
|
153
|
-
'always', 'never', 'any',
|
|
154
|
-
],
|
|
155
|
-
type: 'string',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
additionalProperties: false,
|
|
159
|
-
properties: {
|
|
160
|
-
tags: {
|
|
161
|
-
additionalProperties: false,
|
|
162
|
-
properties: {
|
|
163
|
-
always: {
|
|
164
|
-
items: {
|
|
165
|
-
type: 'string',
|
|
166
|
-
},
|
|
167
|
-
type: 'array',
|
|
168
|
-
},
|
|
169
|
-
any: {
|
|
170
|
-
items: {
|
|
171
|
-
type: 'string',
|
|
172
|
-
},
|
|
173
|
-
type: 'array',
|
|
174
|
-
},
|
|
175
|
-
never: {
|
|
176
|
-
items: {
|
|
177
|
-
type: 'string',
|
|
178
|
-
},
|
|
179
|
-
type: 'array',
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
type: 'object',
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
type: 'object',
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
type: 'layout',
|
|
189
|
-
},
|
|
190
|
-
});
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {string} description
|
|
5
|
-
* @returns {import('../iterateJsdoc.js').Integer}
|
|
6
|
-
*/
|
|
7
|
-
const checkDescription = (description) => {
|
|
8
|
-
return description
|
|
9
|
-
.trim()
|
|
10
|
-
.split('\n')
|
|
11
|
-
.filter(Boolean)
|
|
12
|
-
.length;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default iterateJsdoc(({
|
|
16
|
-
context,
|
|
17
|
-
jsdoc,
|
|
18
|
-
report,
|
|
19
|
-
utils,
|
|
20
|
-
}) => {
|
|
21
|
-
if (utils.avoidDocs()) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
descriptionStyle = 'body',
|
|
27
|
-
} = context.options[0] || {};
|
|
28
|
-
|
|
29
|
-
let targetTagName = utils.getPreferredTagName({
|
|
30
|
-
// We skip reporting except when `@description` is essential to the rule,
|
|
31
|
-
// so user can block the tag and still meaningfully use this rule
|
|
32
|
-
// even if the tag is present (and `check-tag-names` is the one to
|
|
33
|
-
// normally report the fact that it is blocked but present)
|
|
34
|
-
skipReportingBlockedTag: descriptionStyle !== 'tag',
|
|
35
|
-
tagName: 'description',
|
|
36
|
-
});
|
|
37
|
-
if (!targetTagName) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const isBlocked = typeof targetTagName === 'object' && 'blocked' in targetTagName && targetTagName.blocked;
|
|
42
|
-
if (isBlocked) {
|
|
43
|
-
targetTagName = /** @type {{blocked: true; tagName: string;}} */ (
|
|
44
|
-
targetTagName
|
|
45
|
-
).tagName;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (descriptionStyle !== 'tag') {
|
|
49
|
-
const {
|
|
50
|
-
description,
|
|
51
|
-
} = utils.getDescription();
|
|
52
|
-
if (checkDescription(description || '')) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (descriptionStyle === 'body') {
|
|
57
|
-
const descTags = utils.getPresentTags([
|
|
58
|
-
'desc', 'description',
|
|
59
|
-
]);
|
|
60
|
-
if (descTags.length) {
|
|
61
|
-
const [
|
|
62
|
-
{
|
|
63
|
-
tag: tagName,
|
|
64
|
-
},
|
|
65
|
-
] = descTags;
|
|
66
|
-
report(`Remove the @${tagName} tag to leave a plain block description or add additional description text above the @${tagName} line.`);
|
|
67
|
-
} else {
|
|
68
|
-
report('Missing JSDoc block description.');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const functionExamples = isBlocked ?
|
|
76
|
-
[] :
|
|
77
|
-
jsdoc.tags.filter(({
|
|
78
|
-
tag,
|
|
79
|
-
}) => {
|
|
80
|
-
return tag === targetTagName;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
if (!functionExamples.length) {
|
|
84
|
-
report(
|
|
85
|
-
descriptionStyle === 'any' ?
|
|
86
|
-
`Missing JSDoc block description or @${targetTagName} declaration.` :
|
|
87
|
-
`Missing JSDoc @${targetTagName} declaration.`,
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
for (const example of functionExamples) {
|
|
94
|
-
if (!checkDescription(`${example.name} ${utils.getTagDescription(example)}`)) {
|
|
95
|
-
report(`Missing JSDoc @${targetTagName} description.`, null, example);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
contextDefaults: true,
|
|
100
|
-
meta: {
|
|
101
|
-
docs: {
|
|
102
|
-
description: 'Requires that all functions have a description.',
|
|
103
|
-
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-description.md#repos-sticky-header',
|
|
104
|
-
},
|
|
105
|
-
schema: [
|
|
106
|
-
{
|
|
107
|
-
additionalProperties: false,
|
|
108
|
-
properties: {
|
|
109
|
-
checkConstructors: {
|
|
110
|
-
default: true,
|
|
111
|
-
type: 'boolean',
|
|
112
|
-
},
|
|
113
|
-
checkGetters: {
|
|
114
|
-
default: true,
|
|
115
|
-
type: 'boolean',
|
|
116
|
-
},
|
|
117
|
-
checkSetters: {
|
|
118
|
-
default: true,
|
|
119
|
-
type: 'boolean',
|
|
120
|
-
},
|
|
121
|
-
contexts: {
|
|
122
|
-
items: {
|
|
123
|
-
anyOf: [
|
|
124
|
-
{
|
|
125
|
-
type: 'string',
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
additionalProperties: false,
|
|
129
|
-
properties: {
|
|
130
|
-
comment: {
|
|
131
|
-
type: 'string',
|
|
132
|
-
},
|
|
133
|
-
context: {
|
|
134
|
-
type: 'string',
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
type: 'object',
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
type: 'array',
|
|
142
|
-
},
|
|
143
|
-
descriptionStyle: {
|
|
144
|
-
enum: [
|
|
145
|
-
'body', 'tag', 'any',
|
|
146
|
-
],
|
|
147
|
-
type: 'string',
|
|
148
|
-
},
|
|
149
|
-
exemptedBy: {
|
|
150
|
-
items: {
|
|
151
|
-
type: 'string',
|
|
152
|
-
},
|
|
153
|
-
type: 'array',
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
type: 'object',
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
type: 'suggestion',
|
|
160
|
-
},
|
|
161
|
-
});
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
-
import escapeStringRegexp from 'escape-string-regexp';
|
|
3
|
-
|
|
4
|
-
const otherDescriptiveTags = new Set([
|
|
5
|
-
'classdesc', 'deprecated', 'exception', 'file', 'fileoverview', 'overview',
|
|
6
|
-
// 'copyright' and 'see' might be good addition, but as the former may be
|
|
7
|
-
// sensitive text, and the latter may have just a link, they are not
|
|
8
|
-
// included by default
|
|
9
|
-
'summary', 'throws', 'todo', 'yield', 'yields',
|
|
10
|
-
]);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {string} text
|
|
14
|
-
* @returns {string[]}
|
|
15
|
-
*/
|
|
16
|
-
const extractParagraphs = (text) => {
|
|
17
|
-
return text.split(/(?<![;:])\n\n+/v);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {string} text
|
|
22
|
-
* @param {string|RegExp} abbreviationsRegex
|
|
23
|
-
* @returns {string[]}
|
|
24
|
-
*/
|
|
25
|
-
const extractSentences = (text, abbreviationsRegex) => {
|
|
26
|
-
const txt = text
|
|
27
|
-
// Remove all {} tags.
|
|
28
|
-
.replaceAll(/(?<!^)\{[\s\S]*?\}\s*/gv, '')
|
|
29
|
-
|
|
30
|
-
// Remove custom abbreviations
|
|
31
|
-
.replace(abbreviationsRegex, '');
|
|
32
|
-
|
|
33
|
-
const sentenceEndGrouping = /([.?!])(?:\s+|$)/gv;
|
|
34
|
-
|
|
35
|
-
const puncts = [
|
|
36
|
-
...txt.matchAll(sentenceEndGrouping),
|
|
37
|
-
].map((sentEnd) => {
|
|
38
|
-
return sentEnd[0];
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return txt
|
|
42
|
-
.split(/[.?!](?:\s+|$)/v)
|
|
43
|
-
|
|
44
|
-
// Re-add the dot.
|
|
45
|
-
.map((sentence, idx) => {
|
|
46
|
-
return !puncts[idx] && /^\s*$/v.test(sentence) ? sentence : `${sentence}${puncts[idx] || ''}`;
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @param {string} text
|
|
52
|
-
* @returns {boolean}
|
|
53
|
-
*/
|
|
54
|
-
const isNewLinePrecededByAPeriod = (text) => {
|
|
55
|
-
/** @type {boolean} */
|
|
56
|
-
let lastLineEndsSentence;
|
|
57
|
-
|
|
58
|
-
const lines = text.split('\n');
|
|
59
|
-
|
|
60
|
-
return !lines.some((line) => {
|
|
61
|
-
if (lastLineEndsSentence === false && /^[A-Z][a-z]/v.test(line)) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
lastLineEndsSentence = /[.:?!\|]$/v.test(line);
|
|
66
|
-
|
|
67
|
-
return false;
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @param {string} str
|
|
73
|
-
* @returns {boolean}
|
|
74
|
-
*/
|
|
75
|
-
const isCapitalized = (str) => {
|
|
76
|
-
return str[0] === str[0].toUpperCase();
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @param {string} str
|
|
81
|
-
* @returns {boolean}
|
|
82
|
-
*/
|
|
83
|
-
const isTable = (str) => {
|
|
84
|
-
return str.charAt(0) === '|';
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @param {string} str
|
|
89
|
-
* @returns {string}
|
|
90
|
-
*/
|
|
91
|
-
const capitalize = (str) => {
|
|
92
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @param {string} description
|
|
97
|
-
* @param {import('../iterateJsdoc.js').Report} reportOrig
|
|
98
|
-
* @param {import('eslint').Rule.Node} jsdocNode
|
|
99
|
-
* @param {string|RegExp} abbreviationsRegex
|
|
100
|
-
* @param {import('eslint').SourceCode} sourceCode
|
|
101
|
-
* @param {import('comment-parser').Spec|{
|
|
102
|
-
* line: import('../iterateJsdoc.js').Integer
|
|
103
|
-
* }} tag
|
|
104
|
-
* @param {boolean} newlineBeforeCapsAssumesBadSentenceEnd
|
|
105
|
-
* @returns {boolean}
|
|
106
|
-
*/
|
|
107
|
-
const validateDescription = (
|
|
108
|
-
description, reportOrig, jsdocNode, abbreviationsRegex,
|
|
109
|
-
sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd,
|
|
110
|
-
) => {
|
|
111
|
-
if (!description || (/^\n+$/v).test(description)) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const descriptionNoHeadings = description.replaceAll(/^\s*#[^\n]*(\n|$)/gmv, '');
|
|
116
|
-
|
|
117
|
-
const paragraphs = extractParagraphs(descriptionNoHeadings).filter(Boolean);
|
|
118
|
-
|
|
119
|
-
return paragraphs.some((paragraph, parIdx) => {
|
|
120
|
-
const sentences = extractSentences(paragraph, abbreviationsRegex);
|
|
121
|
-
|
|
122
|
-
const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {
|
|
123
|
-
let text = sourceCode.getText(jsdocNode);
|
|
124
|
-
|
|
125
|
-
if (!/[.:?!]$/v.test(paragraph)) {
|
|
126
|
-
const line = paragraph.split('\n').findLast(Boolean);
|
|
127
|
-
text = text.replace(new RegExp(`${escapeStringRegexp(
|
|
128
|
-
/** @type {string} */
|
|
129
|
-
(line),
|
|
130
|
-
)}$`, 'mv'), `${line}.`);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
for (const sentence of sentences.filter((sentence_) => {
|
|
134
|
-
return !(/^\s*$/v).test(sentence_) && !isCapitalized(sentence_) &&
|
|
135
|
-
!isTable(sentence_);
|
|
136
|
-
})) {
|
|
137
|
-
const beginning = sentence.split('\n')[0];
|
|
138
|
-
|
|
139
|
-
if ('tag' in tag && tag.tag) {
|
|
140
|
-
const reg = new RegExp(`(@${escapeStringRegexp(tag.tag)}.*)${escapeStringRegexp(beginning)}`, 'v');
|
|
141
|
-
|
|
142
|
-
text = text.replace(reg, (_$0, $1) => {
|
|
143
|
-
return $1 + capitalize(beginning);
|
|
144
|
-
});
|
|
145
|
-
} else {
|
|
146
|
-
text = text.replace(new RegExp('((?:[.?!]|\\*|\\})\\s*)' + escapeStringRegexp(beginning), 'v'), '$1' + capitalize(beginning));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return fixer.replaceText(jsdocNode, text);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @param {string} msg
|
|
155
|
-
* @param {import('eslint').Rule.ReportFixer | null | undefined} fixer
|
|
156
|
-
* @param {{
|
|
157
|
-
* line?: number | undefined;
|
|
158
|
-
* column?: number | undefined;
|
|
159
|
-
* } | (import('comment-parser').Spec & {
|
|
160
|
-
* line?: number | undefined;
|
|
161
|
-
* column?: number | undefined;
|
|
162
|
-
* })} tagObj
|
|
163
|
-
* @returns {void}
|
|
164
|
-
*/
|
|
165
|
-
const report = (msg, fixer, tagObj) => {
|
|
166
|
-
if ('line' in tagObj) {
|
|
167
|
-
/**
|
|
168
|
-
* @type {{
|
|
169
|
-
* line: number;
|
|
170
|
-
* }}
|
|
171
|
-
*/ (tagObj).line += parIdx * 2;
|
|
172
|
-
} else {
|
|
173
|
-
/** @type {import('comment-parser').Spec} */ (
|
|
174
|
-
tagObj
|
|
175
|
-
).source[0].number += parIdx * 2;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Avoid errors if old column doesn't exist here
|
|
179
|
-
tagObj.column = 0;
|
|
180
|
-
reportOrig(msg, fixer, tagObj);
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
if (sentences.some((sentence) => {
|
|
184
|
-
return (/^[.?!]$/v).test(sentence);
|
|
185
|
-
})) {
|
|
186
|
-
report('Sentences must be more than punctuation.', null, tag);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (sentences.some((sentence) => {
|
|
190
|
-
return !(/^\s*$/v).test(sentence) && !isCapitalized(sentence) && !isTable(sentence);
|
|
191
|
-
})) {
|
|
192
|
-
report('Sentences should start with an uppercase character.', fix, tag);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const paragraphNoAbbreviations = paragraph.replace(abbreviationsRegex, '');
|
|
196
|
-
|
|
197
|
-
if (!/(?:[.?!\|]|```)\s*$/v.test(paragraphNoAbbreviations)) {
|
|
198
|
-
report('Sentences must end with a period.', fix, tag);
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (newlineBeforeCapsAssumesBadSentenceEnd && !isNewLinePrecededByAPeriod(paragraphNoAbbreviations)) {
|
|
203
|
-
report('A line of text is started with an uppercase character, but the preceding line does not end the sentence.', null, tag);
|
|
204
|
-
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return false;
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export default iterateJsdoc(({
|
|
213
|
-
context,
|
|
214
|
-
jsdoc,
|
|
215
|
-
jsdocNode,
|
|
216
|
-
report,
|
|
217
|
-
sourceCode,
|
|
218
|
-
utils,
|
|
219
|
-
}) => {
|
|
220
|
-
const /** @type {{abbreviations: string[], newlineBeforeCapsAssumesBadSentenceEnd: boolean}} */ {
|
|
221
|
-
abbreviations = [],
|
|
222
|
-
newlineBeforeCapsAssumesBadSentenceEnd = false,
|
|
223
|
-
} = context.options[0] || {};
|
|
224
|
-
|
|
225
|
-
const abbreviationsRegex = abbreviations.length ?
|
|
226
|
-
new RegExp('\\b' + abbreviations.map((abbreviation) => {
|
|
227
|
-
return escapeStringRegexp(abbreviation.replaceAll(/\.$/gv, '') + '.');
|
|
228
|
-
}).join('|') + '(?:$|\\s)', 'gv') :
|
|
229
|
-
'';
|
|
230
|
-
|
|
231
|
-
let {
|
|
232
|
-
description,
|
|
233
|
-
} = utils.getDescription();
|
|
234
|
-
|
|
235
|
-
const indices = [
|
|
236
|
-
...description.matchAll(/```[\s\S]*```/gv),
|
|
237
|
-
].map((match) => {
|
|
238
|
-
const {
|
|
239
|
-
index,
|
|
240
|
-
} = match;
|
|
241
|
-
const [
|
|
242
|
-
{
|
|
243
|
-
length,
|
|
244
|
-
},
|
|
245
|
-
] = match;
|
|
246
|
-
return {
|
|
247
|
-
index,
|
|
248
|
-
length,
|
|
249
|
-
};
|
|
250
|
-
}).reverse();
|
|
251
|
-
|
|
252
|
-
for (const {
|
|
253
|
-
index,
|
|
254
|
-
length,
|
|
255
|
-
} of indices) {
|
|
256
|
-
description = description.slice(0, index) +
|
|
257
|
-
description.slice(/** @type {import('../iterateJsdoc.js').Integer} */ (
|
|
258
|
-
index
|
|
259
|
-
) + length);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (validateDescription(description, report, jsdocNode, abbreviationsRegex, sourceCode, {
|
|
263
|
-
line: jsdoc.source[0].number + 1,
|
|
264
|
-
}, newlineBeforeCapsAssumesBadSentenceEnd)) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
utils.forEachPreferredTag('description', (matchingJsdocTag) => {
|
|
269
|
-
const desc = `${matchingJsdocTag.name} ${utils.getTagDescription(matchingJsdocTag)}`.trim();
|
|
270
|
-
validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, matchingJsdocTag, newlineBeforeCapsAssumesBadSentenceEnd);
|
|
271
|
-
}, true);
|
|
272
|
-
|
|
273
|
-
const {
|
|
274
|
-
tagsWithNames,
|
|
275
|
-
} = utils.getTagsByType(jsdoc.tags);
|
|
276
|
-
const tagsWithoutNames = utils.filterTags(({
|
|
277
|
-
tag: tagName,
|
|
278
|
-
}) => {
|
|
279
|
-
return otherDescriptiveTags.has(tagName) ||
|
|
280
|
-
utils.hasOptionTag(tagName) && !tagsWithNames.some(({
|
|
281
|
-
tag,
|
|
282
|
-
}) => {
|
|
283
|
-
// If user accidentally adds tags with names (or like `returns`
|
|
284
|
-
// get parsed as having names), do not add to this list
|
|
285
|
-
return tag === tagName;
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
tagsWithNames.some((tag) => {
|
|
290
|
-
const desc = /** @type {string} */ (
|
|
291
|
-
utils.getTagDescription(tag)
|
|
292
|
-
).replace(/^- /v, '').trimEnd();
|
|
293
|
-
|
|
294
|
-
return validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd);
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
tagsWithoutNames.some((tag) => {
|
|
298
|
-
const desc = `${tag.name} ${utils.getTagDescription(tag)}`.trim();
|
|
299
|
-
|
|
300
|
-
return validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd);
|
|
301
|
-
});
|
|
302
|
-
}, {
|
|
303
|
-
iterateAllJsdocs: true,
|
|
304
|
-
meta: {
|
|
305
|
-
docs: {
|
|
306
|
-
description: 'Requires that block description, explicit `@description`, and `@param`/`@returns` tag descriptions are written in complete sentences.',
|
|
307
|
-
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-description-complete-sentence.md#repos-sticky-header',
|
|
308
|
-
},
|
|
309
|
-
fixable: 'code',
|
|
310
|
-
schema: [
|
|
311
|
-
{
|
|
312
|
-
additionalProperties: false,
|
|
313
|
-
properties: {
|
|
314
|
-
abbreviations: {
|
|
315
|
-
items: {
|
|
316
|
-
type: 'string',
|
|
317
|
-
},
|
|
318
|
-
type: 'array',
|
|
319
|
-
},
|
|
320
|
-
newlineBeforeCapsAssumesBadSentenceEnd: {
|
|
321
|
-
type: 'boolean',
|
|
322
|
-
},
|
|
323
|
-
tags: {
|
|
324
|
-
items: {
|
|
325
|
-
type: 'string',
|
|
326
|
-
},
|
|
327
|
-
type: 'array',
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
type: 'object',
|
|
331
|
-
},
|
|
332
|
-
],
|
|
333
|
-
type: 'suggestion',
|
|
334
|
-
},
|
|
335
|
-
});
|