eslint-plugin-jsdoc 53.0.1 → 54.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WarnSettings.cjs +35 -18
- package/dist/WarnSettings.cjs.map +1 -1
- package/dist/alignTransform.cjs +305 -224
- package/dist/alignTransform.cjs.map +1 -1
- package/dist/defaultTagOrder.cjs +43 -132
- package/dist/defaultTagOrder.cjs.map +1 -1
- package/dist/exportParser.cjs +696 -478
- package/dist/exportParser.cjs.map +1 -1
- package/dist/generateRule.cjs +242 -0
- package/dist/generateRule.cjs.map +1 -0
- package/dist/getDefaultTagStructureForMode.cjs +288 -184
- package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.cjs +550 -364
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.d.ts +65 -68
- package/dist/getJsdocProcessorPlugin.d.ts.map +1 -1
- package/dist/index.cjs +410 -2
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/iterateJsdoc.cjs +2005 -1539
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/iterateJsdoc.d.ts +350 -359
- package/dist/iterateJsdoc.d.ts.map +1 -1
- package/dist/jsdocUtils.cjs +1376 -1009
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkAccess.cjs +36 -29
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +54 -41
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +484 -327
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +65 -50
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +311 -220
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +335 -227
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +106 -78
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkSyntax.cjs +34 -21
- package/dist/rules/checkSyntax.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +210 -188
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTemplateNames.cjs +178 -121
- package/dist/rules/checkTemplateNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +385 -291
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +146 -100
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +306 -228
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/emptyTags.cjs +72 -62
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.cjs +56 -36
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/importsAsDependencies.cjs +99 -62
- package/dist/rules/importsAsDependencies.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +142 -105
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +105 -70
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +222 -160
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +128 -73
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +352 -235
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +86 -63
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs +57 -35
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.cjs +48 -26
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noDefaults.cjs +79 -52
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.cjs +165 -115
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +89 -48
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +79 -45
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +80 -59
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +388 -297
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +159 -108
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +129 -89
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +262 -201
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireExample.cjs +104 -73
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +129 -75
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +133 -85
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +557 -384
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +526 -336
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamDescription.cjs +80 -55
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +50 -32
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamType.cjs +80 -55
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requireProperty.cjs +42 -31
- package/dist/rules/requireProperty.cjs.map +1 -1
- package/dist/rules/requirePropertyDescription.cjs +25 -17
- package/dist/rules/requirePropertyDescription.cjs.map +1 -1
- package/dist/rules/requirePropertyName.cjs +25 -17
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyType.cjs +25 -17
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +203 -125
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +103 -60
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +54 -39
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsType.cjs +50 -32
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +178 -119
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireThrows.cjs +95 -61
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +166 -106
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +152 -96
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +444 -258
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +266 -179
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +127 -92
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +265 -252
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/tagNames.cjs +170 -134
- package/dist/tagNames.cjs.map +1 -1
- package/dist/utils/hasReturnValue.cjs +474 -246
- package/dist/utils/hasReturnValue.cjs.map +1 -1
- package/package.json +24 -40
- package/src/WarnSettings.js +34 -0
- package/src/alignTransform.js +358 -0
- package/src/defaultTagOrder.js +169 -0
- package/src/exportParser.js +978 -0
- package/src/getDefaultTagStructureForMode.js +969 -0
- package/src/getJsdocProcessorPlugin.js +672 -0
- package/src/index.js +530 -0
- package/src/iterateJsdoc.js +2541 -0
- package/src/jsdocUtils.js +1896 -0
- package/src/rules/checkAccess.js +45 -0
- package/src/rules/checkAlignment.js +63 -0
- package/src/rules/checkExamples.js +589 -0
- package/src/rules/checkIndentation.js +75 -0
- package/src/rules/checkLineAlignment.js +372 -0
- package/src/rules/checkParamNames.js +474 -0
- package/src/rules/checkPropertyNames.js +152 -0
- package/src/rules/checkSyntax.js +30 -0
- package/src/rules/checkTagNames.js +314 -0
- package/src/rules/checkTemplateNames.js +204 -0
- package/src/rules/checkTypes.js +535 -0
- package/src/rules/checkValues.js +248 -0
- package/src/rules/convertToJsdocComments.js +398 -0
- package/src/rules/emptyTags.js +98 -0
- package/src/rules/implementsOnClasses.js +64 -0
- package/src/rules/importsAsDependencies.js +133 -0
- package/src/rules/informativeDocs.js +189 -0
- package/src/rules/linesBeforeBlock.js +134 -0
- package/src/rules/matchDescription.js +286 -0
- package/src/rules/matchName.js +151 -0
- package/src/rules/multilineBlocks.js +493 -0
- package/src/rules/noBadBlocks.js +119 -0
- package/src/rules/noBlankBlockDescriptions.js +69 -0
- package/src/rules/noBlankBlocks.js +53 -0
- package/src/rules/noDefaults.js +85 -0
- package/src/rules/noMissingSyntax.js +195 -0
- package/src/rules/noMultiAsterisks.js +134 -0
- package/src/rules/noRestrictedSyntax.js +91 -0
- package/src/rules/noTypes.js +93 -0
- package/src/rules/noUndefinedTypes.js +543 -0
- package/src/rules/requireAsteriskPrefix.js +190 -0
- package/src/rules/requireDescription.js +161 -0
- package/src/rules/requireDescriptionCompleteSentence.js +335 -0
- package/src/rules/requireExample.js +118 -0
- package/src/rules/requireFileOverview.js +154 -0
- package/src/rules/requireHyphenBeforeParamDescription.js +176 -0
- package/src/rules/requireJsdoc.js +743 -0
- package/src/rules/requireParam.js +602 -0
- package/src/rules/requireParamDescription.js +89 -0
- package/src/rules/requireParamName.js +55 -0
- package/src/rules/requireParamType.js +89 -0
- package/src/rules/requireProperty.js +48 -0
- package/src/rules/requirePropertyDescription.js +25 -0
- package/src/rules/requirePropertyName.js +25 -0
- package/src/rules/requirePropertyType.js +25 -0
- package/src/rules/requireReturns.js +238 -0
- package/src/rules/requireReturnsCheck.js +145 -0
- package/src/rules/requireReturnsDescription.js +59 -0
- package/src/rules/requireReturnsType.js +51 -0
- package/src/rules/requireTemplate.js +201 -0
- package/src/rules/requireThrows.js +111 -0
- package/src/rules/requireYields.js +216 -0
- package/src/rules/requireYieldsCheck.js +208 -0
- package/src/rules/sortTags.js +558 -0
- package/src/rules/tagLines.js +359 -0
- package/src/rules/textEscaping.js +154 -0
- package/src/rules/validTypes.js +401 -0
- package/src/tagNames.js +238 -0
- package/src/utils/hasReturnValue.js +572 -0
- package/dist/WarnSettings.js +0 -20
- package/dist/WarnSettings.js.map +0 -1
- package/dist/_virtual/rolldown_runtime.cjs +0 -32
- package/dist/_virtual/rolldown_runtime.js +0 -11
- package/dist/alignTransform.js +0 -241
- package/dist/alignTransform.js.map +0 -1
- package/dist/defaultTagOrder.js +0 -134
- package/dist/defaultTagOrder.js.map +0 -1
- package/dist/exportParser.js +0 -518
- package/dist/exportParser.js.map +0 -1
- package/dist/getDefaultTagStructureForMode.js +0 -188
- package/dist/getDefaultTagStructureForMode.js.map +0 -1
- package/dist/getJsdocProcessorPlugin.d.cts +0 -70
- package/dist/getJsdocProcessorPlugin.d.cts.map +0 -1
- package/dist/getJsdocProcessorPlugin.js +0 -383
- package/dist/getJsdocProcessorPlugin.js.map +0 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.js +0 -3
- package/dist/iterateJsdoc.d.cts +0 -472
- package/dist/iterateJsdoc.d.cts.map +0 -1
- package/dist/iterateJsdoc.js +0 -1628
- package/dist/iterateJsdoc.js.map +0 -1
- package/dist/jsdocUtils.js +0 -1123
- package/dist/jsdocUtils.js.map +0 -1
- package/dist/plugin.cjs +0 -427
- package/dist/plugin.cjs.map +0 -1
- package/dist/plugin.js +0 -427
- package/dist/plugin.js.map +0 -1
- package/dist/rules/checkAccess.js +0 -33
- package/dist/rules/checkAccess.js.map +0 -1
- package/dist/rules/checkAlignment.js +0 -47
- package/dist/rules/checkAlignment.js.map +0 -1
- package/dist/rules/checkExamples.js +0 -348
- package/dist/rules/checkExamples.js.map +0 -1
- package/dist/rules/checkIndentation.js +0 -59
- package/dist/rules/checkIndentation.js.map +0 -1
- package/dist/rules/checkLineAlignment.js +0 -229
- package/dist/rules/checkLineAlignment.js.map +0 -1
- package/dist/rules/checkParamNames.js +0 -237
- package/dist/rules/checkParamNames.js.map +0 -1
- package/dist/rules/checkPropertyNames.js +0 -88
- package/dist/rules/checkPropertyNames.js.map +0 -1
- package/dist/rules/checkSyntax.js +0 -25
- package/dist/rules/checkSyntax.js.map +0 -1
- package/dist/rules/checkTagNames.js +0 -191
- package/dist/rules/checkTagNames.js.map +0 -1
- package/dist/rules/checkTemplateNames.js +0 -124
- package/dist/rules/checkTemplateNames.js.map +0 -1
- package/dist/rules/checkTypes.js +0 -299
- package/dist/rules/checkTypes.js.map +0 -1
- package/dist/rules/checkValues.js +0 -103
- package/dist/rules/checkValues.js.map +0 -1
- package/dist/rules/convertToJsdocComments.js +0 -231
- package/dist/rules/convertToJsdocComments.js.map +0 -1
- package/dist/rules/emptyTags.js +0 -67
- package/dist/rules/emptyTags.js.map +0 -1
- package/dist/rules/implementsOnClasses.js +0 -40
- package/dist/rules/implementsOnClasses.js.map +0 -1
- package/dist/rules/importsAsDependencies.js +0 -68
- package/dist/rules/importsAsDependencies.js.map +0 -1
- package/dist/rules/informativeDocs.js +0 -110
- package/dist/rules/informativeDocs.js.map +0 -1
- package/dist/rules/linesBeforeBlock.js +0 -75
- package/dist/rules/linesBeforeBlock.js.map +0 -1
- package/dist/rules/matchDescription.js +0 -167
- package/dist/rules/matchDescription.js.map +0 -1
- package/dist/rules/matchName.js +0 -77
- package/dist/rules/matchName.js.map +0 -1
- package/dist/rules/multilineBlocks.js +0 -245
- package/dist/rules/multilineBlocks.js.map +0 -1
- package/dist/rules/noBadBlocks.js +0 -68
- package/dist/rules/noBadBlocks.js.map +0 -1
- package/dist/rules/noBlankBlockDescriptions.js +0 -41
- package/dist/rules/noBlankBlockDescriptions.js.map +0 -1
- package/dist/rules/noBlankBlocks.js +0 -30
- package/dist/rules/noBlankBlocks.js.map +0 -1
- package/dist/rules/noDefaults.js +0 -56
- package/dist/rules/noDefaults.js.map +0 -1
- package/dist/rules/noMissingSyntax.js +0 -126
- package/dist/rules/noMissingSyntax.js.map +0 -1
- package/dist/rules/noMultiAsterisks.js +0 -58
- package/dist/rules/noMultiAsterisks.js.map +0 -1
- package/dist/rules/noRestrictedSyntax.js +0 -49
- package/dist/rules/noRestrictedSyntax.js.map +0 -1
- package/dist/rules/noTypes.js +0 -65
- package/dist/rules/noTypes.js.map +0 -1
- package/dist/rules/noUndefinedTypes.js +0 -303
- package/dist/rules/noUndefinedTypes.js.map +0 -1
- package/dist/rules/requireAsteriskPrefix.js +0 -112
- package/dist/rules/requireAsteriskPrefix.js.map +0 -1
- package/dist/rules/requireDescription.js +0 -95
- package/dist/rules/requireDescription.js.map +0 -1
- package/dist/rules/requireDescriptionCompleteSentence.js +0 -220
- package/dist/rules/requireDescriptionCompleteSentence.js.map +0 -1
- package/dist/rules/requireExample.js +0 -77
- package/dist/rules/requireExample.js.map +0 -1
- package/dist/rules/requireFileOverview.js +0 -81
- package/dist/rules/requireFileOverview.js.map +0 -1
- package/dist/rules/requireHyphenBeforeParamDescription.js +0 -89
- package/dist/rules/requireHyphenBeforeParamDescription.js.map +0 -1
- package/dist/rules/requireJsdoc.js +0 -404
- package/dist/rules/requireJsdoc.js.map +0 -1
- package/dist/rules/requireParam.js +0 -344
- package/dist/rules/requireParam.js.map +0 -1
- package/dist/rules/requireParamDescription.js +0 -59
- package/dist/rules/requireParamDescription.js.map +0 -1
- package/dist/rules/requireParamName.js +0 -36
- package/dist/rules/requireParamName.js.map +0 -1
- package/dist/rules/requireParamType.js +0 -59
- package/dist/rules/requireParamType.js.map +0 -1
- package/dist/rules/requireProperty.js +0 -35
- package/dist/rules/requireProperty.js.map +0 -1
- package/dist/rules/requirePropertyDescription.js +0 -21
- package/dist/rules/requirePropertyDescription.js.map +0 -1
- package/dist/rules/requirePropertyName.js +0 -21
- package/dist/rules/requirePropertyName.js.map +0 -1
- package/dist/rules/requirePropertyType.js +0 -21
- package/dist/rules/requirePropertyType.js.map +0 -1
- package/dist/rules/requireReturns.js +0 -131
- package/dist/rules/requireReturns.js.map +0 -1
- package/dist/rules/requireReturnsCheck.js +0 -66
- package/dist/rules/requireReturnsCheck.js.map +0 -1
- package/dist/rules/requireReturnsDescription.js +0 -43
- package/dist/rules/requireReturnsDescription.js.map +0 -1
- package/dist/rules/requireReturnsType.js +0 -36
- package/dist/rules/requireReturnsType.js.map +0 -1
- package/dist/rules/requireTemplate.js +0 -122
- package/dist/rules/requireTemplate.js.map +0 -1
- package/dist/rules/requireThrows.js +0 -67
- package/dist/rules/requireThrows.js.map +0 -1
- package/dist/rules/requireYields.js +0 -115
- package/dist/rules/requireYields.js.map +0 -1
- package/dist/rules/requireYieldsCheck.js +0 -105
- package/dist/rules/requireYieldsCheck.js.map +0 -1
- package/dist/rules/sortTags.js +0 -262
- package/dist/rules/sortTags.js.map +0 -1
- package/dist/rules/tagLines.js +0 -183
- package/dist/rules/tagLines.js.map +0 -1
- package/dist/rules/textEscaping.js +0 -102
- package/dist/rules/textEscaping.js.map +0 -1
- package/dist/rules/validTypes.js +0 -259
- package/dist/rules/validTypes.js.map +0 -1
- package/dist/tagNames.js +0 -144
- package/dist/tagNames.js.map +0 -1
- package/dist/utils/hasReturnValue.js +0 -265
- package/dist/utils/hasReturnValue.js.map +0 -1
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
import { parse } from "comment-parser";
|
|
3
|
-
|
|
4
|
-
//#region src/rules/noBadBlocks.js
|
|
5
|
-
const commentRegexp = /^\/\*(?!\*)/v;
|
|
6
|
-
const extraAsteriskCommentRegexp = /^\/\*{3,}/v;
|
|
7
|
-
var noBadBlocks_default = iterateJsdoc(({ allComments, context, makeReport, sourceCode }) => {
|
|
8
|
-
const [{ ignore = [
|
|
9
|
-
"ts-check",
|
|
10
|
-
"ts-expect-error",
|
|
11
|
-
"ts-ignore",
|
|
12
|
-
"ts-nocheck"
|
|
13
|
-
], preventAllMultiAsteriskBlocks = false } = {}] = context.options;
|
|
14
|
-
let extraAsterisks = false;
|
|
15
|
-
const nonJsdocNodes = allComments.filter((comment) => {
|
|
16
|
-
const commentText = sourceCode.getText(comment);
|
|
17
|
-
const initialText = commentText.replace(commentRegexp, "").trimStart();
|
|
18
|
-
if (["eslint"].some((directive) => {
|
|
19
|
-
return initialText.startsWith(directive);
|
|
20
|
-
})) return false;
|
|
21
|
-
let sliceIndex = 2;
|
|
22
|
-
if (!commentRegexp.test(commentText)) {
|
|
23
|
-
const multiline = extraAsteriskCommentRegexp.exec(commentText)?.[0];
|
|
24
|
-
if (!multiline) return false;
|
|
25
|
-
sliceIndex = multiline.length;
|
|
26
|
-
extraAsterisks = true;
|
|
27
|
-
if (preventAllMultiAsteriskBlocks) return true;
|
|
28
|
-
}
|
|
29
|
-
const tags = (parse(`${commentText.slice(0, 2)}*${commentText.slice(sliceIndex)}`)[0] || {}).tags ?? [];
|
|
30
|
-
return tags.length && !tags.some(({ tag }) => {
|
|
31
|
-
return ignore.includes(tag);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
if (!nonJsdocNodes.length) return;
|
|
35
|
-
for (const node of nonJsdocNodes) {
|
|
36
|
-
const report = makeReport(context, node);
|
|
37
|
-
const fix = (fixer) => {
|
|
38
|
-
const text = sourceCode.getText(node);
|
|
39
|
-
return fixer.replaceText(node, extraAsterisks ? text.replace(extraAsteriskCommentRegexp, "/**") : text.replace("/*", "/**"));
|
|
40
|
-
};
|
|
41
|
-
report("Expected JSDoc-like comment to begin with two asterisks.", fix);
|
|
42
|
-
}
|
|
43
|
-
}, {
|
|
44
|
-
checkFile: true,
|
|
45
|
-
meta: {
|
|
46
|
-
docs: {
|
|
47
|
-
description: "This rule checks for multi-line-style comments which fail to meet the criteria of a jsdoc block.",
|
|
48
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md#repos-sticky-header"
|
|
49
|
-
},
|
|
50
|
-
fixable: "code",
|
|
51
|
-
schema: [{
|
|
52
|
-
additionalProperties: false,
|
|
53
|
-
properties: {
|
|
54
|
-
ignore: {
|
|
55
|
-
items: { type: "string" },
|
|
56
|
-
type: "array"
|
|
57
|
-
},
|
|
58
|
-
preventAllMultiAsteriskBlocks: { type: "boolean" }
|
|
59
|
-
},
|
|
60
|
-
type: "object"
|
|
61
|
-
}],
|
|
62
|
-
type: "layout"
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
|
-
export { noBadBlocks_default as default };
|
|
68
|
-
//# sourceMappingURL=noBadBlocks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noBadBlocks.js","names":["commentParser"],"sources":["../../src/rules/noBadBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as commentParser,\n} from 'comment-parser';\n\n// Neither a single nor 3+ asterisks are valid jsdoc per\n// https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code\nconst commentRegexp = /^\\/\\*(?!\\*)/v;\nconst extraAsteriskCommentRegexp = /^\\/\\*{3,}/v;\n\nexport default iterateJsdoc(({\n allComments,\n context,\n makeReport,\n sourceCode,\n}) => {\n const [\n {\n ignore = [\n 'ts-check',\n 'ts-expect-error',\n 'ts-ignore',\n 'ts-nocheck',\n ],\n preventAllMultiAsteriskBlocks = false,\n } = {},\n ] = context.options;\n\n let extraAsterisks = false;\n const nonJsdocNodes = /** @type {import('estree').Node[]} */ (\n allComments\n ).filter((comment) => {\n const commentText = sourceCode.getText(comment);\n\n const initialText = commentText.replace(commentRegexp, '').trimStart();\n if ([\n 'eslint',\n ].some((directive) => {\n return initialText.startsWith(directive);\n })) {\n return false;\n }\n\n let sliceIndex = 2;\n if (!commentRegexp.test(commentText)) {\n const multiline = extraAsteriskCommentRegexp.exec(commentText)?.[0];\n if (!multiline) {\n return false;\n }\n\n sliceIndex = multiline.length;\n extraAsterisks = true;\n if (preventAllMultiAsteriskBlocks) {\n return true;\n }\n }\n\n const tags = (commentParser(\n `${commentText.slice(0, 2)}*${commentText.slice(sliceIndex)}`,\n )[0] || {}).tags ?? [];\n\n return tags.length && !tags.some(({\n tag,\n }) => {\n return ignore.includes(tag);\n });\n });\n\n if (!nonJsdocNodes.length) {\n return;\n }\n\n for (const node of nonJsdocNodes) {\n const report = /** @type {import('../iterateJsdoc.js').MakeReport} */ (\n makeReport\n )(context, node);\n\n // eslint-disable-next-line no-loop-func\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n const text = sourceCode.getText(node);\n\n return fixer.replaceText(\n node,\n extraAsterisks ?\n text.replace(extraAsteriskCommentRegexp, '/**') :\n text.replace('/*', '/**'),\n );\n };\n\n report('Expected JSDoc-like comment to begin with two asterisks.', fix);\n }\n}, {\n checkFile: true,\n meta: {\n docs: {\n description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a jsdoc block.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n ignore: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n preventAllMultiAsteriskBlocks: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":";;;;AAOA,MAAM,gBAAgB;AACtB,MAAM,6BAA6B;AAEnC,0BAAe,aAAa,CAAC,EAC3B,aACA,SACA,YACA,YACD,KAAK;CACJ,MAAM,CACJ,EACE,SAAS;EACP;EACA;EACA;EACA;CACD,GACD,gCAAgC,OACjC,GAAG,CAAE,EACP,GAAG,QAAQ;CAEZ,IAAI,iBAAiB;CACrB,MAAM,gBACJ,YACA,OAAO,CAAC,YAAY;EACpB,MAAM,cAAc,WAAW,QAAQ,QAAQ;EAE/C,MAAM,cAAc,YAAY,QAAQ,eAAe,GAAG,CAAC,WAAW;AACtE,MAAI,CACF,QACD,EAAC,KAAK,CAAC,cAAc;AACpB,UAAO,YAAY,WAAW,UAAU;EACzC,EAAC,CACA,QAAO;EAGT,IAAI,aAAa;AACjB,MAAI,CAAC,cAAc,KAAK,YAAY,EAAE;GACpC,MAAM,YAAY,2BAA2B,KAAK,YAAY,GAAG;AACjE,OAAI,CAAC,UACH,QAAO;GAGT,aAAa,UAAU;GACvB,iBAAiB;AACjB,OAAI,8BACF,QAAO;EAEV;EAED,MAAM,QAAQA,MACZ,GAAG,YAAY,MAAM,GAAG,EAAE,CAAC,CAAC,EAAE,YAAY,MAAM,WAAW,EAAE,CAC9D,CAAC,MAAM,CAAE,GAAE,QAAQ,CAAE;AAEtB,SAAO,KAAK,UAAU,CAAC,KAAK,KAAK,CAAC,EAChC,KACD,KAAK;AACJ,UAAO,OAAO,SAAS,IAAI;EAC5B,EAAC;CACH,EAAC;AAEF,KAAI,CAAC,cAAc,OACjB;AAGF,MAAK,MAAM,QAAQ,eAAe;EAChC,MAAM,SACJ,WACA,SAAS,KAAK;EAGhB,MAAM,MAAuD,CAAC,UAAU;GACtE,MAAM,OAAO,WAAW,QAAQ,KAAK;AAErC,UAAO,MAAM,YACX,MACA,iBACE,KAAK,QAAQ,4BAA4B,MAAM,GAC/C,KAAK,QAAQ,MAAM,MAAM,CAC5B;EACF;EAED,OAAO,4DAA4D,IAAI;CACxE;AACF,GAAE;CACD,WAAW;CACX,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY;IACV,QAAQ;KACN,OAAO,EACL,MAAM,SACP;KACD,MAAM;IACP;IACD,+BAA+B,EAC7B,MAAM,UACP;GACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/noBlankBlockDescriptions.js
|
|
4
|
-
const anyWhitespaceLines = /^\s*$/v;
|
|
5
|
-
const atLeastTwoLinesWhitespace = /^[ \t]*\n[ \t]*\n\s*$/v;
|
|
6
|
-
var noBlankBlockDescriptions_default = iterateJsdoc(({ jsdoc, utils }) => {
|
|
7
|
-
const { description, descriptions, lastDescriptionLine } = utils.getDescription();
|
|
8
|
-
const regex = jsdoc.tags.length ? anyWhitespaceLines : atLeastTwoLinesWhitespace;
|
|
9
|
-
if (descriptions.length && regex.test(description)) if (jsdoc.tags.length) utils.reportJSDoc("There should be no blank lines in block descriptions followed by tags.", { line: lastDescriptionLine }, () => {
|
|
10
|
-
utils.setBlockDescription(() => {
|
|
11
|
-
return [];
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
else utils.reportJSDoc("There should be no extra blank lines in block descriptions not followed by tags.", { line: lastDescriptionLine }, () => {
|
|
15
|
-
utils.setBlockDescription((info, seedTokens) => {
|
|
16
|
-
return [{
|
|
17
|
-
number: 0,
|
|
18
|
-
source: "",
|
|
19
|
-
tokens: seedTokens({
|
|
20
|
-
...info,
|
|
21
|
-
description: ""
|
|
22
|
-
})
|
|
23
|
-
}];
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}, {
|
|
27
|
-
iterateAllJsdocs: true,
|
|
28
|
-
meta: {
|
|
29
|
-
docs: {
|
|
30
|
-
description: "Detects and removes extra lines of a blank block description",
|
|
31
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header"
|
|
32
|
-
},
|
|
33
|
-
fixable: "whitespace",
|
|
34
|
-
schema: [],
|
|
35
|
-
type: "layout"
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
export { noBlankBlockDescriptions_default as default };
|
|
41
|
-
//# sourceMappingURL=noBlankBlockDescriptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noBlankBlockDescriptions.js","names":[],"sources":["../../src/rules/noBlankBlockDescriptions.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst anyWhitespaceLines = /^\\s*$/v;\nconst atLeastTwoLinesWhitespace = /^[ \\t]*\\n[ \\t]*\\n\\s*$/v;\n\nexport default iterateJsdoc(({\n jsdoc,\n utils,\n}) => {\n const {\n description,\n descriptions,\n lastDescriptionLine,\n } = utils.getDescription();\n\n const regex = jsdoc.tags.length ?\n anyWhitespaceLines :\n atLeastTwoLinesWhitespace;\n\n if (descriptions.length && regex.test(description)) {\n if (jsdoc.tags.length) {\n utils.reportJSDoc(\n 'There should be no blank lines in block descriptions followed by tags.',\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription(() => {\n // Remove all lines\n return [];\n });\n },\n );\n } else {\n utils.reportJSDoc(\n 'There should be no extra blank lines in block descriptions not followed by tags.',\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens) => {\n return [\n // Keep the starting line\n {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: '',\n }),\n },\n ];\n });\n },\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Detects and removes extra lines of a blank block description',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header',\n },\n fixable: 'whitespace',\n schema: [],\n type: 'layout',\n },\n});\n"],"mappings":";;;AAEA,MAAM,qBAAqB;AAC3B,MAAM,4BAA4B;AAElC,uCAAe,aAAa,CAAC,EAC3B,OACA,OACD,KAAK;CACJ,MAAM,EACJ,aACA,cACA,qBACD,GAAG,MAAM,gBAAgB;CAE1B,MAAM,QAAQ,MAAM,KAAK,SACvB,qBACA;AAEF,KAAI,aAAa,UAAU,MAAM,KAAK,YAAY,CAChD,KAAI,MAAM,KAAK,QACb,MAAM,YACJ,0EACA,EACE,MAAM,oBACP,GACD,MAAM;EACJ,MAAM,oBAAoB,MAAM;AAE9B,UAAO,CAAE;EACV,EAAC;CACH,EACF;MAED,MAAM,YACJ,oFACA,EACE,MAAM,oBACP,GACD,MAAM;EACJ,MAAM,oBAAoB,CAAC,MAAM,eAAe;AAC9C,UAAO,CAEL;IACE,QAAQ;IACR,QAAQ;IACR,QAAQ,WAAW;KACjB,GAAG;KACH,aAAa;IACd,EAAC;GACH,CACF;EACF,EAAC;CACH,EACF;AAGN,GAAE;CACD,kBAAkB;CAClB,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CAAE;EACV,MAAM;CACP;AACF,EAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/noBlankBlocks.js
|
|
4
|
-
var noBlankBlocks_default = iterateJsdoc(({ context, jsdoc, utils }) => {
|
|
5
|
-
if (jsdoc.tags.length) return;
|
|
6
|
-
const { description, lastDescriptionLine } = utils.getDescription();
|
|
7
|
-
if (description.trim()) return;
|
|
8
|
-
const { enableFixer } = context.options[0] || {};
|
|
9
|
-
utils.reportJSDoc("No empty blocks", { line: lastDescriptionLine }, enableFixer ? () => {
|
|
10
|
-
jsdoc.source.splice(0, jsdoc.source.length);
|
|
11
|
-
} : null);
|
|
12
|
-
}, {
|
|
13
|
-
iterateAllJsdocs: true,
|
|
14
|
-
meta: {
|
|
15
|
-
docs: {
|
|
16
|
-
description: "Removes empty blocks with nothing but possibly line breaks",
|
|
17
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-blocks.md#repos-sticky-header"
|
|
18
|
-
},
|
|
19
|
-
fixable: "code",
|
|
20
|
-
schema: [{
|
|
21
|
-
additionalProperties: false,
|
|
22
|
-
properties: { enableFixer: { type: "boolean" } }
|
|
23
|
-
}],
|
|
24
|
-
type: "suggestion"
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { noBlankBlocks_default as default };
|
|
30
|
-
//# sourceMappingURL=noBlankBlocks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noBlankBlocks.js","names":[],"sources":["../../src/rules/noBlankBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n if (jsdoc.tags.length) {\n return;\n }\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n if (description.trim()) {\n return;\n }\n\n const {\n enableFixer,\n } = context.options[0] || {};\n\n utils.reportJSDoc(\n 'No empty blocks',\n {\n line: lastDescriptionLine,\n },\n enableFixer ? () => {\n jsdoc.source.splice(0, jsdoc.source.length);\n } : null,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Removes empty blocks with nothing but possibly line breaks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n enableFixer: {\n type: 'boolean',\n },\n },\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;AAEA,4BAAe,aAAa,CAAC,EAC3B,SACA,OACA,OACD,KAAK;AACJ,KAAI,MAAM,KAAK,OACb;CAGF,MAAM,EACJ,aACA,qBACD,GAAG,MAAM,gBAAgB;AAC1B,KAAI,YAAY,MAAM,CACpB;CAGF,MAAM,EACJ,aACD,GAAG,QAAQ,QAAQ,MAAM,CAAE;CAE5B,MAAM,YACJ,mBACA,EACE,MAAM,oBACP,GACD,cAAc,MAAM;EAClB,MAAM,OAAO,OAAO,GAAG,MAAM,OAAO,OAAO;CAC5C,IAAG,KACL;AACF,GAAE;CACD,kBAAkB;CAClB,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY,EACV,aAAa,EACX,MAAM,UACP,EACF;EACF,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
package/dist/rules/noDefaults.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/noDefaults.js
|
|
4
|
-
var noDefaults_default = iterateJsdoc(({ context, utils }) => {
|
|
5
|
-
const { noOptionalParamNames } = context.options[0] || {};
|
|
6
|
-
const paramTags = utils.getPresentTags([
|
|
7
|
-
"param",
|
|
8
|
-
"arg",
|
|
9
|
-
"argument"
|
|
10
|
-
]);
|
|
11
|
-
for (const tag of paramTags) if (noOptionalParamNames && tag.optional) utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {
|
|
12
|
-
utils.changeTag(tag, { name: tag.name.replace(/([^=]*)(=.+)?/v, "$1") });
|
|
13
|
-
});
|
|
14
|
-
else if (tag.default) utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {
|
|
15
|
-
utils.changeTag(tag, { name: tag.name.replace(/([^=]*)(=.+)?/v, "[$1]") });
|
|
16
|
-
});
|
|
17
|
-
const defaultTags = utils.getPresentTags(["default", "defaultvalue"]);
|
|
18
|
-
for (const tag of defaultTags) if (tag.description.trim()) utils.reportJSDoc(`Default values are not permitted on @${tag.tag}.`, tag, () => {
|
|
19
|
-
utils.changeTag(tag, {
|
|
20
|
-
description: "",
|
|
21
|
-
postTag: ""
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
}, {
|
|
25
|
-
contextDefaults: true,
|
|
26
|
-
meta: {
|
|
27
|
-
docs: {
|
|
28
|
-
description: "This rule reports defaults being used on the relevant portion of `@param` or `@default`.",
|
|
29
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-defaults.md#repos-sticky-header"
|
|
30
|
-
},
|
|
31
|
-
fixable: "code",
|
|
32
|
-
schema: [{
|
|
33
|
-
additionalProperties: false,
|
|
34
|
-
properties: {
|
|
35
|
-
contexts: {
|
|
36
|
-
items: { anyOf: [{ type: "string" }, {
|
|
37
|
-
additionalProperties: false,
|
|
38
|
-
properties: {
|
|
39
|
-
comment: { type: "string" },
|
|
40
|
-
context: { type: "string" }
|
|
41
|
-
},
|
|
42
|
-
type: "object"
|
|
43
|
-
}] },
|
|
44
|
-
type: "array"
|
|
45
|
-
},
|
|
46
|
-
noOptionalParamNames: { type: "boolean" }
|
|
47
|
-
},
|
|
48
|
-
type: "object"
|
|
49
|
-
}],
|
|
50
|
-
type: "suggestion"
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
export { noDefaults_default as default };
|
|
56
|
-
//# sourceMappingURL=noDefaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noDefaults.js","names":[],"sources":["../../src/rules/noDefaults.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n const {\n noOptionalParamNames,\n } = context.options[0] || {};\n const paramTags = utils.getPresentTags([\n 'param', 'arg', 'argument',\n ]);\n for (const tag of paramTags) {\n if (noOptionalParamNames && tag.optional) {\n utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '$1'),\n });\n });\n } else if (tag.default) {\n utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '[$1]'),\n });\n });\n }\n }\n\n const defaultTags = utils.getPresentTags([\n 'default', 'defaultvalue',\n ]);\n for (const tag of defaultTags) {\n if (tag.description.trim()) {\n utils.reportJSDoc(`Default values are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n description: '',\n postTag: '',\n });\n });\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'This rule reports defaults being used on the relevant portion of `@param` or `@default`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-defaults.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n noOptionalParamNames: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;AAEA,yBAAe,aAAa,CAAC,EAC3B,SACA,OACD,KAAK;CACJ,MAAM,EACJ,sBACD,GAAG,QAAQ,QAAQ,MAAM,CAAE;CAC5B,MAAM,YAAY,MAAM,eAAe;EACrC;EAAS;EAAO;CACjB,EAAC;AACF,MAAK,MAAM,OAAO,UAChB,KAAI,wBAAwB,IAAI,UAC9B,MAAM,YAAY,CAAC,2CAA2C,EAAE,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM;EACrF,MAAM,UAAU,KAAK,EACnB,MAAM,IAAI,KAAK,QAAQ,kBAAkB,KAAK,CAC/C,EAAC;CACH,EAAC;UACO,IAAI,SACb,MAAM,YAAY,CAAC,+BAA+B,EAAE,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM;EACzE,MAAM,UAAU,KAAK,EACnB,MAAM,IAAI,KAAK,QAAQ,kBAAkB,OAAO,CACjD,EAAC;CACH,EAAC;CAIN,MAAM,cAAc,MAAM,eAAe,CACvC,WAAW,cACZ,EAAC;AACF,MAAK,MAAM,OAAO,YAChB,KAAI,IAAI,YAAY,MAAM,EACxB,MAAM,YAAY,CAAC,qCAAqC,EAAE,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM;EAC/E,MAAM,UAAU,KAAK;GACnB,aAAa;GACb,SAAS;EACV,EAAC;CACH,EAAC;AAGP,GAAE;CACD,iBAAiB;CACjB,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY;IACV,UAAU;KACR,OAAO,EACL,OAAO,CACL,EACE,MAAM,SACP,GACD;MACE,sBAAsB;MACtB,YAAY;OACV,SAAS,EACP,MAAM,SACP;OACD,SAAS,EACP,MAAM,SACP;MACF;MACD,MAAM;KACP,CACF,EACF;KACD,MAAM;IACP;IACD,sBAAsB,EACpB,MAAM,UACP;GACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/noMissingSyntax.js
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {{
|
|
6
|
-
* comment: string,
|
|
7
|
-
* context: string,
|
|
8
|
-
* message: string,
|
|
9
|
-
* minimum: import('../iterateJsdoc.js').Integer
|
|
10
|
-
* }} ContextObject
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {string|ContextObject} Context
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* @param {import('../iterateJsdoc.js').StateObject} state
|
|
17
|
-
* @returns {void}
|
|
18
|
-
*/
|
|
19
|
-
const setDefaults = (state) => {
|
|
20
|
-
if (!state.selectorMap) state.selectorMap = {};
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* @param {import('../iterateJsdoc.js').StateObject} state
|
|
24
|
-
* @param {string} selector
|
|
25
|
-
* @param {string} comment
|
|
26
|
-
* @returns {void}
|
|
27
|
-
*/
|
|
28
|
-
const incrementSelector = (state, selector, comment) => {
|
|
29
|
-
if (!state.selectorMap[selector]) state.selectorMap[selector] = {};
|
|
30
|
-
if (!state.selectorMap[selector][comment]) state.selectorMap[selector][comment] = 0;
|
|
31
|
-
state.selectorMap[selector][comment]++;
|
|
32
|
-
};
|
|
33
|
-
var noMissingSyntax_default = iterateJsdoc(({ context, info: { comment }, state, utils }) => {
|
|
34
|
-
if (!context.options[0]) return;
|
|
35
|
-
/**
|
|
36
|
-
* @type {Context[]}
|
|
37
|
-
*/
|
|
38
|
-
const contexts = context.options[0].contexts;
|
|
39
|
-
const { contextStr } = utils.findContext(contexts, comment);
|
|
40
|
-
setDefaults(state);
|
|
41
|
-
incrementSelector(state, contextStr, String(comment));
|
|
42
|
-
}, {
|
|
43
|
-
contextSelected: true,
|
|
44
|
-
exit({ context, settings, state }) {
|
|
45
|
-
if (!context.options.length && !settings.contexts) {
|
|
46
|
-
context.report({
|
|
47
|
-
loc: {
|
|
48
|
-
end: {
|
|
49
|
-
column: 1,
|
|
50
|
-
line: 1
|
|
51
|
-
},
|
|
52
|
-
start: {
|
|
53
|
-
column: 1,
|
|
54
|
-
line: 1
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
message: "Rule `no-missing-syntax` is missing a `contexts` option."
|
|
58
|
-
});
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
setDefaults(state);
|
|
62
|
-
/**
|
|
63
|
-
* @type {Context[]}
|
|
64
|
-
*/
|
|
65
|
-
const contexts = (context.options[0] ?? {}).contexts ?? settings?.contexts;
|
|
66
|
-
contexts.some((cntxt) => {
|
|
67
|
-
const contextStr = typeof cntxt === "object" ? cntxt.context ?? "any" : cntxt;
|
|
68
|
-
const comment = typeof cntxt === "string" ? "" : cntxt?.comment;
|
|
69
|
-
const contextKey = contextStr === "any" ? "undefined" : contextStr;
|
|
70
|
-
if ((!state.selectorMap[contextKey] || !state.selectorMap[contextKey][comment] || state.selectorMap[contextKey][comment] < (cntxt?.minimum ?? 1)) && (contextStr !== "any" || Object.values(state.selectorMap).every((cmmnt) => {
|
|
71
|
-
return !cmmnt[comment] || cmmnt[comment] < (cntxt?.minimum ?? 1);
|
|
72
|
-
}))) {
|
|
73
|
-
const message = typeof cntxt === "string" ? "Syntax is required: {{context}}" : cntxt?.message ?? "Syntax is required: {{context}}" + (comment ? " with {{comment}}" : "");
|
|
74
|
-
context.report({
|
|
75
|
-
data: {
|
|
76
|
-
comment,
|
|
77
|
-
context: contextStr
|
|
78
|
-
},
|
|
79
|
-
loc: {
|
|
80
|
-
end: {
|
|
81
|
-
column: 1,
|
|
82
|
-
line: 1
|
|
83
|
-
},
|
|
84
|
-
start: {
|
|
85
|
-
column: 1,
|
|
86
|
-
line: 1
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
message
|
|
90
|
-
});
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
return false;
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
matchContext: true,
|
|
97
|
-
meta: {
|
|
98
|
-
docs: {
|
|
99
|
-
description: "Reports when certain comment structures are always expected.",
|
|
100
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.md#repos-sticky-header"
|
|
101
|
-
},
|
|
102
|
-
fixable: "code",
|
|
103
|
-
schema: [{
|
|
104
|
-
additionalProperties: false,
|
|
105
|
-
properties: { contexts: {
|
|
106
|
-
items: { anyOf: [{ type: "string" }, {
|
|
107
|
-
additionalProperties: false,
|
|
108
|
-
properties: {
|
|
109
|
-
comment: { type: "string" },
|
|
110
|
-
context: { type: "string" },
|
|
111
|
-
message: { type: "string" },
|
|
112
|
-
minimum: { type: "integer" }
|
|
113
|
-
},
|
|
114
|
-
type: "object"
|
|
115
|
-
}] },
|
|
116
|
-
type: "array"
|
|
117
|
-
} },
|
|
118
|
-
type: "object"
|
|
119
|
-
}],
|
|
120
|
-
type: "suggestion"
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
//#endregion
|
|
125
|
-
export { noMissingSyntax_default as default };
|
|
126
|
-
//# sourceMappingURL=noMissingSyntax.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noMissingSyntax.js","names":[],"sources":["../../src/rules/noMissingSyntax.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {{\n * comment: string,\n * context: string,\n * message: string,\n * minimum: import('../iterateJsdoc.js').Integer\n * }} ContextObject\n */\n\n/**\n * @typedef {string|ContextObject} Context\n */\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @returns {void}\n */\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @param {string} selector\n * @param {string} comment\n * @returns {void}\n */\nconst incrementSelector = (state, selector, comment) => {\n if (!state.selectorMap[selector]) {\n state.selectorMap[selector] = {};\n }\n\n if (!state.selectorMap[selector][comment]) {\n state.selectorMap[selector][comment] = 0;\n }\n\n state.selectorMap[selector][comment]++;\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n state,\n utils,\n}) => {\n if (!context.options[0]) {\n // Handle error later\n return;\n }\n\n /**\n * @type {Context[]}\n */\n const contexts = context.options[0].contexts;\n\n const {\n contextStr,\n } = utils.findContext(contexts, comment);\n\n setDefaults(state);\n\n incrementSelector(state, contextStr, String(comment));\n}, {\n contextSelected: true,\n exit ({\n context,\n settings,\n state,\n }) {\n if (!context.options.length && !settings.contexts) {\n context.report({\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `contexts` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n\n /**\n * @type {Context[]}\n */\n const contexts = (context.options[0] ?? {}).contexts ?? settings?.contexts;\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = typeof cntxt === 'string' ? '' : cntxt?.comment;\n\n const contextKey = contextStr === 'any' ? 'undefined' : contextStr;\n\n if (\n (!state.selectorMap[contextKey] ||\n !state.selectorMap[contextKey][comment] ||\n state.selectorMap[contextKey][comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n )) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n );\n }))\n ) {\n const message = typeof cntxt === 'string' ?\n 'Syntax is required: {{context}}' :\n cntxt?.message ?? ('Syntax is required: {{context}}' +\n (comment ? ' with {{comment}}' : ''));\n context.report({\n data: {\n comment,\n context: contextStr,\n },\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message,\n });\n\n return true;\n }\n\n return false;\n });\n },\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are always expected.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n minimum: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,cAAc,CAAC,UAAU;AAC7B,KAAI,CAAC,MAAM,aACT,MAAM,cAAc,CAAE;AAEzB;;;;;;;AAQD,MAAM,oBAAoB,CAAC,OAAO,UAAU,YAAY;AACtD,KAAI,CAAC,MAAM,YAAY,WACrB,MAAM,YAAY,YAAY,CAAE;AAGlC,KAAI,CAAC,MAAM,YAAY,UAAU,UAC/B,MAAM,YAAY,UAAU,WAAW;CAGzC,MAAM,YAAY,UAAU;AAC7B;AAED,8BAAe,aAAa,CAAC,EAC3B,SACA,MAAM,EACJ,SACD,EACD,OACA,OACD,KAAK;AACJ,KAAI,CAAC,QAAQ,QAAQ,GAEnB;;;;CAMF,MAAM,WAAW,QAAQ,QAAQ,GAAG;CAEpC,MAAM,EACJ,YACD,GAAG,MAAM,YAAY,UAAU,QAAQ;CAExC,YAAY,MAAM;CAElB,kBAAkB,OAAO,YAAY,OAAO,QAAQ,CAAC;AACtD,GAAE;CACD,iBAAiB;CACjB,KAAM,EACJ,SACA,UACA,OACD,EAAE;AACD,MAAI,CAAC,QAAQ,QAAQ,UAAU,CAAC,SAAS,UAAU;GACjD,QAAQ,OAAO;IACb,KAAK;KACH,KAAK;MACH,QAAQ;MACR,MAAM;KACP;KACD,OAAO;MACL,QAAQ;MACR,MAAM;KACP;IACF;IACD,SAAS;GACV,EAAC;AAEF;EACD;EAED,YAAY,MAAM;;;;EAKlB,MAAM,YAAY,QAAQ,QAAQ,MAAM,CAAE,GAAE,YAAY,UAAU;EAGlE,SAAS,KAAK,CAAC,UAAU;GACvB,MAAM,aAAa,OAAO,UAAU,WAAW,MAAM,WAAW,QAAQ;GACxE,MAAM,UAAU,OAAO,UAAU,WAAW,KAAK,OAAO;GAExD,MAAM,aAAa,eAAe,QAAQ,cAAc;AAExD,QACG,CAAC,MAAM,YAAY,eACpB,CAAC,MAAM,YAAY,YAAY,YAC/B,MAAM,YAAY,YAAY,YAE5B,OAAO,WAAW,QAEnB,eAAe,SAAS,OAAO,OAAO,MAAM,YAAY,CAAC,MAAM,CAAC,UAAU;AACzE,WAAO,CAAC,MAAM,YAAY,MAAM,YAE9B,OAAO,WAAW;GAErB,EAAC,GACF;IACA,MAAM,UAAU,OAAO,UAAU,WAC/B,oCACA,OAAO,WAAY,qCAChB,UAAU,sBAAsB;IACrC,QAAQ,OAAO;KACb,MAAM;MACJ;MACA,SAAS;KACV;KACD,KAAK;MACH,KAAK;OACH,QAAQ;OACR,MAAM;MACP;MACD,OAAO;OACL,QAAQ;OACR,MAAM;MACP;KACF;KACD;IACD,EAAC;AAEF,WAAO;GACR;AAED,UAAO;EACR,EAAC;CACH;CACD,cAAc;CACd,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY,EACV,UAAU;IACR,OAAO,EACL,OAAO,CACL,EACE,MAAM,SACP,GACD;KACE,sBAAsB;KACtB,YAAY;MACV,SAAS,EACP,MAAM,SACP;MACD,SAAS,EACP,MAAM,SACP;MACD,SAAS,EACP,MAAM,SACP;MACD,SAAS,EACP,MAAM,UACP;KACF;KACD,MAAM;IACP,CACF,EACF;IACD,MAAM;GACP,EACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/noMultiAsterisks.js
|
|
4
|
-
const middleAsterisksBlockWS = /^([\t ]|\*(?!\*))+/v;
|
|
5
|
-
const middleAsterisksNoBlockWS = /^\*+/v;
|
|
6
|
-
const endAsterisksSingleLineBlockWS = /\*((?:\*|(?: |\t))*)\*$/v;
|
|
7
|
-
const endAsterisksMultipleLineBlockWS = /((?:\*|(?: |\t))*)\*$/v;
|
|
8
|
-
const endAsterisksSingleLineNoBlockWS = /\*(\**)\*$/v;
|
|
9
|
-
const endAsterisksMultipleLineNoBlockWS = /(\**)\*$/v;
|
|
10
|
-
var noMultiAsterisks_default = iterateJsdoc(({ context, jsdoc, utils }) => {
|
|
11
|
-
const { allowWhitespace = false, preventAtEnd = true, preventAtMiddleLines = true } = context.options[0] || {};
|
|
12
|
-
const middleAsterisks = allowWhitespace ? middleAsterisksNoBlockWS : middleAsterisksBlockWS;
|
|
13
|
-
jsdoc.source.some(({ number, tokens }) => {
|
|
14
|
-
const { delimiter, description, end, name, postDelimiter, tag, type } = tokens;
|
|
15
|
-
if (preventAtMiddleLines && !end && !tag && !type && !name && (!allowWhitespace && middleAsterisks.test(description) || allowWhitespace && middleAsterisks.test(postDelimiter + description))) {
|
|
16
|
-
const fix = () => {
|
|
17
|
-
tokens.description = description.replace(middleAsterisks, "");
|
|
18
|
-
};
|
|
19
|
-
utils.reportJSDoc("Should be no multiple asterisks on middle lines.", { line: number }, fix, true);
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
if (!preventAtEnd || !end) return false;
|
|
23
|
-
const isSingleLineBlock = delimiter === "/**";
|
|
24
|
-
const delim = isSingleLineBlock ? "*" : delimiter;
|
|
25
|
-
const endAsterisks = allowWhitespace ? isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS : isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS;
|
|
26
|
-
const endingAsterisksAndSpaces = (allowWhitespace ? postDelimiter + description + delim : description + delim).match(endAsterisks);
|
|
27
|
-
if (!endingAsterisksAndSpaces || !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()) return false;
|
|
28
|
-
const endFix = () => {
|
|
29
|
-
if (!isSingleLineBlock) tokens.delimiter = "";
|
|
30
|
-
tokens.description = (description + delim).replace(endAsterisks, "");
|
|
31
|
-
};
|
|
32
|
-
utils.reportJSDoc("Should be no multiple asterisks on end lines.", { line: number }, endFix, true);
|
|
33
|
-
return true;
|
|
34
|
-
});
|
|
35
|
-
}, {
|
|
36
|
-
iterateAllJsdocs: true,
|
|
37
|
-
meta: {
|
|
38
|
-
docs: {
|
|
39
|
-
description: "Prevents use of multiple asterisks at the beginning of lines.",
|
|
40
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-multi-asterisks.md#repos-sticky-header"
|
|
41
|
-
},
|
|
42
|
-
fixable: "code",
|
|
43
|
-
schema: [{
|
|
44
|
-
additionalProperties: false,
|
|
45
|
-
properties: {
|
|
46
|
-
allowWhitespace: { type: "boolean" },
|
|
47
|
-
preventAtEnd: { type: "boolean" },
|
|
48
|
-
preventAtMiddleLines: { type: "boolean" }
|
|
49
|
-
},
|
|
50
|
-
type: "object"
|
|
51
|
-
}],
|
|
52
|
-
type: "suggestion"
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
//#endregion
|
|
57
|
-
export { noMultiAsterisks_default as default };
|
|
58
|
-
//# sourceMappingURL=noMultiAsterisks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noMultiAsterisks.js","names":[],"sources":["../../src/rules/noMultiAsterisks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst middleAsterisksBlockWS = /^([\\t ]|\\*(?!\\*))+/v;\nconst middleAsterisksNoBlockWS = /^\\*+/v;\n\nconst endAsterisksSingleLineBlockWS = /\\*((?:\\*|(?: |\\t))*)\\*$/v;\nconst endAsterisksMultipleLineBlockWS = /((?:\\*|(?: |\\t))*)\\*$/v;\n\nconst endAsterisksSingleLineNoBlockWS = /\\*(\\**)\\*$/v;\nconst endAsterisksMultipleLineNoBlockWS = /(\\**)\\*$/v;\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n allowWhitespace = false,\n preventAtEnd = true,\n preventAtMiddleLines = true,\n } = context.options[0] || {};\n\n const middleAsterisks = allowWhitespace ? middleAsterisksNoBlockWS : middleAsterisksBlockWS;\n\n // eslint-disable-next-line complexity -- Todo\n jsdoc.source.some(({\n number,\n tokens,\n }) => {\n const {\n delimiter,\n description,\n end,\n name,\n postDelimiter,\n tag,\n type,\n } = tokens;\n\n if (\n preventAtMiddleLines &&\n !end && !tag && !type && !name &&\n (\n !allowWhitespace && middleAsterisks.test(description) ||\n allowWhitespace && middleAsterisks.test(postDelimiter + description)\n )\n ) {\n // console.log('description', JSON.stringify(description));\n const fix = () => {\n tokens.description = description.replace(middleAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on middle lines.',\n {\n line: number,\n },\n fix,\n true,\n );\n\n return true;\n }\n\n if (!preventAtEnd || !end) {\n return false;\n }\n\n const isSingleLineBlock = delimiter === '/**';\n const delim = isSingleLineBlock ? '*' : delimiter;\n const endAsterisks = allowWhitespace ?\n (isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS) :\n (isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS);\n\n const endingAsterisksAndSpaces = (\n allowWhitespace ? postDelimiter + description + delim : description + delim\n ).match(\n endAsterisks,\n );\n\n if (\n !endingAsterisksAndSpaces ||\n !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()\n ) {\n return false;\n }\n\n const endFix = () => {\n if (!isSingleLineBlock) {\n tokens.delimiter = '';\n }\n\n tokens.description = (description + delim).replace(endAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on end lines.',\n {\n line: number,\n },\n endFix,\n true,\n );\n\n return true;\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Prevents use of multiple asterisks at the beginning of lines.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-multi-asterisks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowWhitespace: {\n type: 'boolean',\n },\n preventAtEnd: {\n type: 'boolean',\n },\n preventAtMiddleLines: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;AAEA,MAAM,yBAAyB;AAC/B,MAAM,2BAA2B;AAEjC,MAAM,gCAAgC;AACtC,MAAM,kCAAkC;AAExC,MAAM,kCAAkC;AACxC,MAAM,oCAAoC;AAE1C,+BAAe,aAAa,CAAC,EAC3B,SACA,OACA,OACD,KAAK;CACJ,MAAM,EACJ,kBAAkB,OAClB,eAAe,MACf,uBAAuB,MACxB,GAAG,QAAQ,QAAQ,MAAM,CAAE;CAE5B,MAAM,kBAAkB,kBAAkB,2BAA2B;CAGrE,MAAM,OAAO,KAAK,CAAC,EACjB,QACA,QACD,KAAK;EACJ,MAAM,EACJ,WACA,aACA,KACA,MACA,eACA,KACA,MACD,GAAG;AAEJ,MACE,wBACA,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAExB,CAAC,mBAAmB,gBAAgB,KAAK,YAAY,IACrD,mBAAmB,gBAAgB,KAAK,gBAAgB,YAAY,GAEtE;GAEA,MAAM,MAAM,MAAM;IAChB,OAAO,cAAc,YAAY,QAAQ,iBAAiB,GAAG;GAC9D;GAED,MAAM,YACJ,oDACA,EACE,MAAM,OACP,GACD,KACA,KACD;AAED,UAAO;EACR;AAED,MAAI,CAAC,gBAAgB,CAAC,IACpB,QAAO;EAGT,MAAM,oBAAoB,cAAc;EACxC,MAAM,QAAQ,oBAAoB,MAAM;EACxC,MAAM,eAAe,kBAClB,oBAAoB,kCAAkC,oCACtD,oBAAoB,gCAAgC;EAEvD,MAAM,4BACJ,kBAAkB,gBAAgB,cAAc,QAAQ,cAAc,OACtE,MACA,aACD;AAED,MACE,CAAC,4BACD,CAAC,qBAAqB,yBAAyB,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAExF,QAAO;EAGT,MAAM,SAAS,MAAM;AACnB,OAAI,CAAC,mBACH,OAAO,YAAY;GAGrB,OAAO,eAAe,cAAc,OAAO,QAAQ,cAAc,GAAG;EACrE;EAED,MAAM,YACJ,iDACA,EACE,MAAM,OACP,GACD,QACA,KACD;AAED,SAAO;CACR,EAAC;AACH,GAAE;CACD,kBAAkB;CAClB,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY;IACV,iBAAiB,EACf,MAAM,UACP;IACD,cAAc,EACZ,MAAM,UACP;IACD,sBAAsB,EACpB,MAAM,UACP;GACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/noRestrictedSyntax.js
|
|
4
|
-
var noRestrictedSyntax_default = iterateJsdoc(({ context, info: { comment }, report, utils }) => {
|
|
5
|
-
if (!context.options.length) {
|
|
6
|
-
report("Rule `no-restricted-syntax` is missing a `contexts` option.");
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const { contexts } = context.options[0];
|
|
10
|
-
const { contextStr, foundContext } = utils.findContext(contexts, comment);
|
|
11
|
-
if (!foundContext) return;
|
|
12
|
-
const message = foundContext?.message ?? "Syntax is restricted: {{context}}" + (comment ? " with {{comment}}" : "");
|
|
13
|
-
report(message, null, null, comment ? {
|
|
14
|
-
comment,
|
|
15
|
-
context: contextStr
|
|
16
|
-
} : { context: contextStr });
|
|
17
|
-
}, {
|
|
18
|
-
contextSelected: true,
|
|
19
|
-
meta: {
|
|
20
|
-
docs: {
|
|
21
|
-
description: "Reports when certain comment structures are present.",
|
|
22
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header"
|
|
23
|
-
},
|
|
24
|
-
fixable: "code",
|
|
25
|
-
schema: [{
|
|
26
|
-
additionalProperties: false,
|
|
27
|
-
properties: { contexts: {
|
|
28
|
-
items: { anyOf: [{ type: "string" }, {
|
|
29
|
-
additionalProperties: false,
|
|
30
|
-
properties: {
|
|
31
|
-
comment: { type: "string" },
|
|
32
|
-
context: { type: "string" },
|
|
33
|
-
message: { type: "string" }
|
|
34
|
-
},
|
|
35
|
-
type: "object"
|
|
36
|
-
}] },
|
|
37
|
-
type: "array"
|
|
38
|
-
} },
|
|
39
|
-
required: ["contexts"],
|
|
40
|
-
type: "object"
|
|
41
|
-
}],
|
|
42
|
-
type: "suggestion"
|
|
43
|
-
},
|
|
44
|
-
nonGlobalSettings: true
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
export { noRestrictedSyntax_default as default };
|
|
49
|
-
//# sourceMappingURL=noRestrictedSyntax.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noRestrictedSyntax.js","names":[],"sources":["../../src/rules/noRestrictedSyntax.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n report,\n utils,\n}) => {\n if (!context.options.length) {\n report('Rule `no-restricted-syntax` is missing a `contexts` option.');\n\n return;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n const {\n contextStr,\n foundContext,\n } = utils.findContext(contexts, comment);\n\n // We are not on the *particular* matching context/comment, so don't assume\n // we need reporting\n if (!foundContext) {\n return;\n }\n\n const message = /** @type {import('../iterateJsdoc.js').ContextObject} */ (\n foundContext\n )?.message ??\n 'Syntax is restricted: {{context}}' +\n (comment ? ' with {{comment}}' : '');\n\n report(message, null, null, comment ? {\n comment,\n context: contextStr,\n } : {\n context: contextStr,\n });\n}, {\n contextSelected: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are present.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n required: [\n 'contexts',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n nonGlobalSettings: true,\n});\n"],"mappings":";;;AAEA,iCAAe,aAAa,CAAC,EAC3B,SACA,MAAM,EACJ,SACD,EACD,QACA,OACD,KAAK;AACJ,KAAI,CAAC,QAAQ,QAAQ,QAAQ;EAC3B,OAAO,8DAA8D;AAErE;CACD;CAED,MAAM,EACJ,UACD,GAAG,QAAQ,QAAQ;CAEpB,MAAM,EACJ,YACA,cACD,GAAG,MAAM,YAAY,UAAU,QAAQ;AAIxC,KAAI,CAAC,aACH;CAGF,MAAM,UACJ,cACC,WACD,uCACG,UAAU,sBAAsB;CAErC,OAAO,SAAS,MAAM,MAAM,UAAU;EACpC;EACA,SAAS;CACV,IAAG,EACF,SAAS,WACV,EAAC;AACH,GAAE;CACD,iBAAiB;CACjB,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY,EACV,UAAU;IACR,OAAO,EACL,OAAO,CACL,EACE,MAAM,SACP,GACD;KACE,sBAAsB;KACtB,YAAY;MACV,SAAS,EACP,MAAM,SACP;MACD,SAAS,EACP,MAAM,SACP;MACD,SAAS,EACP,MAAM,SACP;KACF;KACD,MAAM;IACP,CACF,EACF;IACD,MAAM;GACP,EACF;GACD,UAAU,CACR,UACD;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;CACD,mBAAmB;AACpB,EAAC"}
|
package/dist/rules/noTypes.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import iterateJsdoc from "../iterateJsdoc.js";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/noTypes.js
|
|
4
|
-
/**
|
|
5
|
-
* @param {import('comment-parser').Line} line
|
|
6
|
-
*/
|
|
7
|
-
const removeType = ({ tokens }) => {
|
|
8
|
-
tokens.postTag = "";
|
|
9
|
-
tokens.type = "";
|
|
10
|
-
};
|
|
11
|
-
var noTypes_default = iterateJsdoc(({ node, utils }) => {
|
|
12
|
-
if (!utils.isIteratingFunctionOrVariable() && !utils.isVirtualFunction()) return;
|
|
13
|
-
const tags = utils.getPresentTags([
|
|
14
|
-
"param",
|
|
15
|
-
"arg",
|
|
16
|
-
"argument",
|
|
17
|
-
"returns",
|
|
18
|
-
"return"
|
|
19
|
-
]);
|
|
20
|
-
for (const tag of tags) if (tag.type) utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {
|
|
21
|
-
for (const source of tag.source) removeType(source);
|
|
22
|
-
});
|
|
23
|
-
if (node?.type === "ClassDeclaration") {
|
|
24
|
-
const propertyTags = utils.getPresentTags(["prop", "property"]);
|
|
25
|
-
for (const tag of propertyTags) if (tag.type) utils.reportJSDoc(`Types are not permitted on @${tag.tag} in the supplied context.`, tag, () => {
|
|
26
|
-
for (const source of tag.source) removeType(source);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}, {
|
|
30
|
-
contextDefaults: [
|
|
31
|
-
"ArrowFunctionExpression",
|
|
32
|
-
"FunctionDeclaration",
|
|
33
|
-
"FunctionExpression",
|
|
34
|
-
"TSDeclareFunction",
|
|
35
|
-
"TSMethodSignature",
|
|
36
|
-
"ClassDeclaration"
|
|
37
|
-
],
|
|
38
|
-
meta: {
|
|
39
|
-
docs: {
|
|
40
|
-
description: "This rule reports types being used on `@param` or `@returns`.",
|
|
41
|
-
url: "https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.md#repos-sticky-header"
|
|
42
|
-
},
|
|
43
|
-
fixable: "code",
|
|
44
|
-
schema: [{
|
|
45
|
-
additionalProperties: false,
|
|
46
|
-
properties: { contexts: {
|
|
47
|
-
items: { anyOf: [{ type: "string" }, {
|
|
48
|
-
additionalProperties: false,
|
|
49
|
-
properties: {
|
|
50
|
-
comment: { type: "string" },
|
|
51
|
-
context: { type: "string" }
|
|
52
|
-
},
|
|
53
|
-
type: "object"
|
|
54
|
-
}] },
|
|
55
|
-
type: "array"
|
|
56
|
-
} },
|
|
57
|
-
type: "object"
|
|
58
|
-
}],
|
|
59
|
-
type: "suggestion"
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
//#endregion
|
|
64
|
-
export { noTypes_default as default };
|
|
65
|
-
//# sourceMappingURL=noTypes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noTypes.js","names":[],"sources":["../../src/rules/noTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('comment-parser').Line} line\n */\nconst removeType = ({\n tokens,\n}) => {\n tokens.postTag = '';\n tokens.type = '';\n};\n\nexport default iterateJsdoc(({\n node,\n utils,\n}) => {\n if (!utils.isIteratingFunctionOrVariable() && !utils.isVirtualFunction()) {\n return;\n }\n\n const tags = utils.getPresentTags([\n 'param', 'arg', 'argument', 'returns', 'return',\n ]);\n\n for (const tag of tags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n\n if (node?.type === 'ClassDeclaration') {\n const propertyTags = utils.getPresentTags([\n 'prop', 'property',\n ]);\n for (const tag of propertyTags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag} in the supplied context.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n }\n}, {\n contextDefaults: [\n 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',\n // Add this to above defaults\n 'TSMethodSignature', 'ClassDeclaration',\n ],\n meta: {\n docs: {\n description: 'This rule reports types being used on `@param` or `@returns`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAKA,MAAM,aAAa,CAAC,EAClB,QACD,KAAK;CACJ,OAAO,UAAU;CACjB,OAAO,OAAO;AACf;AAED,sBAAe,aAAa,CAAC,EAC3B,MACA,OACD,KAAK;AACJ,KAAI,CAAC,MAAM,+BAA+B,IAAI,CAAC,MAAM,mBAAmB,CACtE;CAGF,MAAM,OAAO,MAAM,eAAe;EAChC;EAAS;EAAO;EAAY;EAAW;CACxC,EAAC;AAEF,MAAK,MAAM,OAAO,KAChB,KAAI,IAAI,MACN,MAAM,YAAY,CAAC,4BAA4B,EAAE,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM;AACtE,OAAK,MAAM,UAAU,IAAI,QACvB,WAAW,OAAO;CAErB,EAAC;AAIN,KAAI,MAAM,SAAS,oBAAoB;EACrC,MAAM,eAAe,MAAM,eAAe,CACxC,QAAQ,UACT,EAAC;AACF,OAAK,MAAM,OAAO,aAChB,KAAI,IAAI,MACN,MAAM,YAAY,CAAC,4BAA4B,EAAE,IAAI,IAAI,yBAAyB,CAAC,EAAE,KAAK,MAAM;AAC9F,QAAK,MAAM,UAAU,IAAI,QACvB,WAAW,OAAO;EAErB,EAAC;CAGP;AACF,GAAE;CACD,iBAAiB;EACf;EAA2B;EAAuB;EAAsB;EAExE;EAAqB;CACtB;CACD,MAAM;EACJ,MAAM;GACJ,aAAa;GACb,KAAK;EACN;EACD,SAAS;EACT,QAAQ,CACN;GACE,sBAAsB;GACtB,YAAY,EACV,UAAU;IACR,OAAO,EACL,OAAO,CACL,EACE,MAAM,SACP,GACD;KACE,sBAAsB;KACtB,YAAY;MACV,SAAS,EACP,MAAM,SACP;MACD,SAAS,EACP,MAAM,SACP;KACF;KACD,MAAM;IACP,CACF,EACF;IACD,MAAM;GACP,EACF;GACD,MAAM;EACP,CACF;EACD,MAAM;CACP;AACF,EAAC"}
|