@depup/eslint-plugin-jsdoc 62.8.0-depup.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/LICENSE +24 -0
- package/README.md +33 -0
- package/changes.json +18 -0
- package/dist/WarnSettings.cjs +38 -0
- package/dist/WarnSettings.cjs.map +1 -0
- package/dist/WarnSettings.d.ts +17 -0
- package/dist/alignTransform.cjs +402 -0
- package/dist/alignTransform.cjs.map +1 -0
- package/dist/alignTransform.d.ts +34 -0
- package/dist/buildForbidRuleDefinition.cjs +101 -0
- package/dist/buildForbidRuleDefinition.cjs.map +1 -0
- package/dist/buildForbidRuleDefinition.d.ts +15 -0
- package/dist/buildRejectOrPreferRuleDefinition.cjs +352 -0
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -0
- package/dist/buildRejectOrPreferRuleDefinition.d.ts +9 -0
- package/dist/cjs/WarnSettings.d.ts +16 -0
- package/dist/cjs/alignTransform.d.ts +33 -0
- package/dist/cjs/buildForbidRuleDefinition.d.ts +14 -0
- package/dist/cjs/buildRejectOrPreferRuleDefinition.d.ts +8 -0
- package/dist/cjs/defaultTagOrder.d.ts +4 -0
- package/dist/cjs/exportParser.d.ts +40 -0
- package/dist/cjs/getDefaultTagStructureForMode.d.ts +10 -0
- package/dist/cjs/getJsdocProcessorPlugin.d.cts +5 -0
- package/dist/cjs/getJsdocProcessorPlugin.d.ts +66 -0
- package/dist/cjs/index-cjs.d.ts +23 -0
- package/dist/cjs/index.cjs.d.cts +2 -0
- package/dist/cjs/iterateJsdoc.d.cts +7 -0
- package/dist/cjs/iterateJsdoc.d.ts +495 -0
- package/dist/cjs/jsdocUtils.d.ts +493 -0
- package/dist/cjs/rules/checkAccess.d.ts +2 -0
- package/dist/cjs/rules/checkAlignment.d.ts +2 -0
- package/dist/cjs/rules/checkExamples.d.ts +3 -0
- package/dist/cjs/rules/checkIndentation.d.ts +2 -0
- package/dist/cjs/rules/checkLineAlignment.d.ts +9 -0
- package/dist/cjs/rules/checkParamNames.d.ts +2 -0
- package/dist/cjs/rules/checkPropertyNames.d.ts +2 -0
- package/dist/cjs/rules/checkSyntax.d.ts +2 -0
- package/dist/cjs/rules/checkTagNames.d.ts +2 -0
- package/dist/cjs/rules/checkTemplateNames.d.ts +2 -0
- package/dist/cjs/rules/checkTypes.d.ts +7 -0
- package/dist/cjs/rules/checkValues.d.ts +2 -0
- package/dist/cjs/rules/convertToJsdocComments.d.ts +266 -0
- package/dist/cjs/rules/emptyTags.d.ts +2 -0
- package/dist/cjs/rules/escapeInlineTags.d.ts +2 -0
- package/dist/cjs/rules/implementsOnClasses.d.ts +2 -0
- package/dist/cjs/rules/importsAsDependencies.d.ts +2 -0
- package/dist/cjs/rules/informativeDocs.d.ts +2 -0
- package/dist/cjs/rules/linesBeforeBlock.d.ts +2 -0
- package/dist/cjs/rules/matchDescription.d.ts +2 -0
- package/dist/cjs/rules/matchName.d.ts +2 -0
- package/dist/cjs/rules/multilineBlocks.d.ts +2 -0
- package/dist/cjs/rules/noBadBlocks.d.ts +2 -0
- package/dist/cjs/rules/noBlankBlockDescriptions.d.ts +2 -0
- package/dist/cjs/rules/noBlankBlocks.d.ts +2 -0
- package/dist/cjs/rules/noDefaults.d.ts +2 -0
- package/dist/cjs/rules/noMissingSyntax.d.ts +9 -0
- package/dist/cjs/rules/noMultiAsterisks.d.ts +2 -0
- package/dist/cjs/rules/noRestrictedSyntax.d.ts +2 -0
- package/dist/cjs/rules/noTypes.d.ts +2 -0
- package/dist/cjs/rules/noUndefinedTypes.d.ts +2 -0
- package/dist/cjs/rules/preferImportTag.d.ts +2 -0
- package/dist/cjs/rules/requireAsteriskPrefix.d.ts +2 -0
- package/dist/cjs/rules/requireDescription.d.ts +2 -0
- package/dist/cjs/rules/requireDescriptionCompleteSentence.d.ts +2 -0
- package/dist/cjs/rules/requireExample.d.ts +2 -0
- package/dist/cjs/rules/requireFileOverview.d.ts +2 -0
- package/dist/cjs/rules/requireHyphenBeforeParamDescription.d.ts +2 -0
- package/dist/cjs/rules/requireJsdoc.d.ts +24 -0
- package/dist/cjs/rules/requireParam.d.ts +3 -0
- package/dist/cjs/rules/requireParamDescription.d.ts +2 -0
- package/dist/cjs/rules/requireParamName.d.ts +2 -0
- package/dist/cjs/rules/requireParamType.d.ts +2 -0
- package/dist/cjs/rules/requireProperty.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyDescription.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyName.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyType.d.ts +2 -0
- package/dist/cjs/rules/requireRejects.d.ts +2 -0
- package/dist/cjs/rules/requireReturns.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsCheck.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsDescription.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsType.d.ts +2 -0
- package/dist/cjs/rules/requireTags.d.ts +2 -0
- package/dist/cjs/rules/requireTemplate.d.ts +2 -0
- package/dist/cjs/rules/requireThrows.d.ts +2 -0
- package/dist/cjs/rules/requireYields.d.ts +2 -0
- package/dist/cjs/rules/requireYieldsCheck.d.ts +2 -0
- package/dist/cjs/rules/sortTags.d.ts +2 -0
- package/dist/cjs/rules/tagLines.d.ts +2 -0
- package/dist/cjs/rules/textEscaping.d.ts +2 -0
- package/dist/cjs/rules/tsMethodSignatureStyle.d.ts +2 -0
- package/dist/cjs/rules/tsNoEmptyObjectType.d.ts +2 -0
- package/dist/cjs/rules/tsNoUnnecessaryTemplateExpression.d.ts +2 -0
- package/dist/cjs/rules/tsPreferFunctionType.d.ts +2 -0
- package/dist/cjs/rules/typeFormatting.d.ts +2 -0
- package/dist/cjs/rules/validTypes.d.ts +2 -0
- package/dist/cjs/tagNames.d.ts +15 -0
- package/dist/cjs/utils/hasReturnValue.d.ts +19 -0
- package/dist/defaultTagOrder.cjs +46 -0
- package/dist/defaultTagOrder.cjs.map +1 -0
- package/dist/defaultTagOrder.d.ts +5 -0
- package/dist/exportParser.cjs +732 -0
- package/dist/exportParser.cjs.map +1 -0
- package/dist/exportParser.d.ts +41 -0
- package/dist/generateDocs.cjs +342 -0
- package/dist/generateDocs.cjs.map +1 -0
- package/dist/generateOptions.cjs +62 -0
- package/dist/generateOptions.cjs.map +1 -0
- package/dist/generateRule.cjs +248 -0
- package/dist/generateRule.cjs.map +1 -0
- package/dist/generateRuleTypes.cjs +24 -0
- package/dist/generateRuleTypes.cjs.map +1 -0
- package/dist/getDefaultTagStructureForMode.cjs +289 -0
- package/dist/getDefaultTagStructureForMode.cjs.map +1 -0
- package/dist/getDefaultTagStructureForMode.d.ts +11 -0
- package/dist/getJsdocProcessorPlugin.cjs +587 -0
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -0
- package/dist/getJsdocProcessorPlugin.cts +5 -0
- package/dist/getJsdocProcessorPlugin.d.ts +67 -0
- package/dist/index-cjs.cjs +595 -0
- package/dist/index-cjs.cjs.map +1 -0
- package/dist/index-cjs.d.ts +24 -0
- package/dist/index-esm.cjs +162 -0
- package/dist/index-esm.cjs.map +1 -0
- package/dist/index-esm.d.ts +72 -0
- package/dist/index.cjs +743 -0
- package/dist/index.cjs.cts +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +93 -0
- package/dist/iterateJsdoc.cjs +2150 -0
- package/dist/iterateJsdoc.cjs.map +1 -0
- package/dist/iterateJsdoc.cts +7 -0
- package/dist/iterateJsdoc.d.ts +496 -0
- package/dist/jsdocUtils.cjs +1725 -0
- package/dist/jsdocUtils.cjs.map +1 -0
- package/dist/jsdocUtils.d.ts +494 -0
- package/dist/rules/checkAccess.cjs +40 -0
- package/dist/rules/checkAccess.cjs.map +1 -0
- package/dist/rules/checkAccess.d.ts +3 -0
- package/dist/rules/checkAlignment.cjs +78 -0
- package/dist/rules/checkAlignment.cjs.map +1 -0
- package/dist/rules/checkAlignment.d.ts +3 -0
- package/dist/rules/checkExamples.cjs +521 -0
- package/dist/rules/checkExamples.cjs.map +1 -0
- package/dist/rules/checkExamples.d.ts +4 -0
- package/dist/rules/checkIndentation.cjs +170 -0
- package/dist/rules/checkIndentation.cjs.map +1 -0
- package/dist/rules/checkIndentation.d.ts +3 -0
- package/dist/rules/checkLineAlignment.cjs +398 -0
- package/dist/rules/checkLineAlignment.cjs.map +1 -0
- package/dist/rules/checkLineAlignment.d.ts +10 -0
- package/dist/rules/checkParamNames.cjs +407 -0
- package/dist/rules/checkParamNames.cjs.map +1 -0
- package/dist/rules/checkParamNames.d.ts +3 -0
- package/dist/rules/checkPropertyNames.cjs +135 -0
- package/dist/rules/checkPropertyNames.cjs.map +1 -0
- package/dist/rules/checkPropertyNames.d.ts +3 -0
- package/dist/rules/checkSyntax.cjs +38 -0
- package/dist/rules/checkSyntax.cjs.map +1 -0
- package/dist/rules/checkSyntax.d.ts +3 -0
- package/dist/rules/checkTagNames.cjs +312 -0
- package/dist/rules/checkTagNames.cjs.map +1 -0
- package/dist/rules/checkTagNames.d.ts +3 -0
- package/dist/rules/checkTemplateNames.cjs +185 -0
- package/dist/rules/checkTemplateNames.cjs.map +1 -0
- package/dist/rules/checkTemplateNames.d.ts +3 -0
- package/dist/rules/checkTypes.cjs +111 -0
- package/dist/rules/checkTypes.cjs.map +1 -0
- package/dist/rules/checkTypes.d.ts +8 -0
- package/dist/rules/checkValues.cjs +166 -0
- package/dist/rules/checkValues.cjs.map +1 -0
- package/dist/rules/checkValues.d.ts +3 -0
- package/dist/rules/convertToJsdocComments.cjs +356 -0
- package/dist/rules/convertToJsdocComments.cjs.map +1 -0
- package/dist/rules/convertToJsdocComments.d.ts +267 -0
- package/dist/rules/emptyTags.cjs +85 -0
- package/dist/rules/emptyTags.cjs.map +1 -0
- package/dist/rules/emptyTags.d.ts +3 -0
- package/dist/rules/escapeInlineTags.cjs +149 -0
- package/dist/rules/escapeInlineTags.cjs.map +1 -0
- package/dist/rules/escapeInlineTags.d.ts +3 -0
- package/dist/rules/implementsOnClasses.cjs +74 -0
- package/dist/rules/implementsOnClasses.cjs.map +1 -0
- package/dist/rules/implementsOnClasses.d.ts +3 -0
- package/dist/rules/importsAsDependencies.cjs +104 -0
- package/dist/rules/importsAsDependencies.cjs.map +1 -0
- package/dist/rules/importsAsDependencies.d.ts +3 -0
- package/dist/rules/informativeDocs.cjs +187 -0
- package/dist/rules/informativeDocs.cjs.map +1 -0
- package/dist/rules/informativeDocs.d.ts +3 -0
- package/dist/rules/linesBeforeBlock.cjs +120 -0
- package/dist/rules/linesBeforeBlock.cjs.map +1 -0
- package/dist/rules/linesBeforeBlock.d.ts +3 -0
- package/dist/rules/matchDescription.cjs +356 -0
- package/dist/rules/matchDescription.cjs.map +1 -0
- package/dist/rules/matchDescription.d.ts +3 -0
- package/dist/rules/matchName.cjs +160 -0
- package/dist/rules/matchName.cjs.map +1 -0
- package/dist/rules/matchName.d.ts +3 -0
- package/dist/rules/multilineBlocks.cjs +431 -0
- package/dist/rules/multilineBlocks.cjs.map +1 -0
- package/dist/rules/multilineBlocks.d.ts +3 -0
- package/dist/rules/noBadBlocks.cjs +100 -0
- package/dist/rules/noBadBlocks.cjs.map +1 -0
- package/dist/rules/noBadBlocks.d.ts +3 -0
- package/dist/rules/noBlankBlockDescriptions.cjs +63 -0
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -0
- package/dist/rules/noBlankBlockDescriptions.d.ts +3 -0
- package/dist/rules/noBlankBlocks.cjs +54 -0
- package/dist/rules/noBlankBlocks.cjs.map +1 -0
- package/dist/rules/noBlankBlocks.d.ts +3 -0
- package/dist/rules/noDefaults.cjs +102 -0
- package/dist/rules/noDefaults.cjs.map +1 -0
- package/dist/rules/noDefaults.d.ts +3 -0
- package/dist/rules/noMissingSyntax.cjs +196 -0
- package/dist/rules/noMissingSyntax.cjs.map +1 -0
- package/dist/rules/noMissingSyntax.d.ts +10 -0
- package/dist/rules/noMultiAsterisks.cjs +126 -0
- package/dist/rules/noMultiAsterisks.cjs.map +1 -0
- package/dist/rules/noMultiAsterisks.d.ts +3 -0
- package/dist/rules/noRestrictedSyntax.cjs +68 -0
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -0
- package/dist/rules/noRestrictedSyntax.d.ts +3 -0
- package/dist/rules/noTypes.cjs +101 -0
- package/dist/rules/noTypes.cjs.map +1 -0
- package/dist/rules/noTypes.d.ts +3 -0
- package/dist/rules/noUndefinedTypes.cjs +588 -0
- package/dist/rules/noUndefinedTypes.cjs.map +1 -0
- package/dist/rules/noUndefinedTypes.d.ts +3 -0
- package/dist/rules/preferImportTag.cjs +362 -0
- package/dist/rules/preferImportTag.cjs.map +1 -0
- package/dist/rules/preferImportTag.d.ts +3 -0
- package/dist/rules/requireAsteriskPrefix.cjs +190 -0
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -0
- package/dist/rules/requireAsteriskPrefix.d.ts +3 -0
- package/dist/rules/requireDescription.cjs +164 -0
- package/dist/rules/requireDescription.cjs.map +1 -0
- package/dist/rules/requireDescription.d.ts +3 -0
- package/dist/rules/requireDescriptionCompleteSentence.cjs +321 -0
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -0
- package/dist/rules/requireDescriptionCompleteSentence.d.ts +3 -0
- package/dist/rules/requireExample.cjs +133 -0
- package/dist/rules/requireExample.cjs.map +1 -0
- package/dist/rules/requireExample.d.ts +3 -0
- package/dist/rules/requireFileOverview.cjs +194 -0
- package/dist/rules/requireFileOverview.cjs.map +1 -0
- package/dist/rules/requireFileOverview.d.ts +3 -0
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +166 -0
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -0
- package/dist/rules/requireHyphenBeforeParamDescription.d.ts +3 -0
- package/dist/rules/requireJsdoc.cjs +722 -0
- package/dist/rules/requireJsdoc.cjs.map +1 -0
- package/dist/rules/requireJsdoc.d.ts +25 -0
- package/dist/rules/requireParam.cjs +772 -0
- package/dist/rules/requireParam.cjs.map +1 -0
- package/dist/rules/requireParam.d.ts +4 -0
- package/dist/rules/requireParamDescription.cjs +105 -0
- package/dist/rules/requireParamDescription.cjs.map +1 -0
- package/dist/rules/requireParamDescription.d.ts +3 -0
- package/dist/rules/requireParamName.cjs +68 -0
- package/dist/rules/requireParamName.cjs.map +1 -0
- package/dist/rules/requireParamName.d.ts +3 -0
- package/dist/rules/requireParamType.cjs +104 -0
- package/dist/rules/requireParamType.cjs.map +1 -0
- package/dist/rules/requireParamType.d.ts +3 -0
- package/dist/rules/requireProperty.cjs +63 -0
- package/dist/rules/requireProperty.cjs.map +1 -0
- package/dist/rules/requireProperty.d.ts +3 -0
- package/dist/rules/requirePropertyDescription.cjs +29 -0
- package/dist/rules/requirePropertyDescription.cjs.map +1 -0
- package/dist/rules/requirePropertyDescription.d.ts +3 -0
- package/dist/rules/requirePropertyName.cjs +29 -0
- package/dist/rules/requirePropertyName.cjs.map +1 -0
- package/dist/rules/requirePropertyName.d.ts +3 -0
- package/dist/rules/requirePropertyType.cjs +29 -0
- package/dist/rules/requirePropertyType.cjs.map +1 -0
- package/dist/rules/requirePropertyType.d.ts +3 -0
- package/dist/rules/requireRejects.cjs +226 -0
- package/dist/rules/requireRejects.cjs.map +1 -0
- package/dist/rules/requireRejects.d.ts +3 -0
- package/dist/rules/requireReturns.cjs +262 -0
- package/dist/rules/requireReturns.cjs.map +1 -0
- package/dist/rules/requireReturns.d.ts +3 -0
- package/dist/rules/requireReturnsCheck.cjs +140 -0
- package/dist/rules/requireReturnsCheck.cjs.map +1 -0
- package/dist/rules/requireReturnsCheck.d.ts +3 -0
- package/dist/rules/requireReturnsDescription.cjs +72 -0
- package/dist/rules/requireReturnsDescription.cjs.map +1 -0
- package/dist/rules/requireReturnsDescription.d.ts +3 -0
- package/dist/rules/requireReturnsType.cjs +68 -0
- package/dist/rules/requireReturnsType.cjs.map +1 -0
- package/dist/rules/requireReturnsType.d.ts +3 -0
- package/dist/rules/requireTags.cjs +74 -0
- package/dist/rules/requireTags.cjs.map +1 -0
- package/dist/rules/requireTags.d.ts +3 -0
- package/dist/rules/requireTemplate.cjs +220 -0
- package/dist/rules/requireTemplate.cjs.map +1 -0
- package/dist/rules/requireTemplate.d.ts +3 -0
- package/dist/rules/requireThrows.cjs +118 -0
- package/dist/rules/requireThrows.cjs.map +1 -0
- package/dist/rules/requireThrows.d.ts +3 -0
- package/dist/rules/requireYields.cjs +224 -0
- package/dist/rules/requireYields.cjs.map +1 -0
- package/dist/rules/requireYields.d.ts +3 -0
- package/dist/rules/requireYieldsCheck.cjs +179 -0
- package/dist/rules/requireYieldsCheck.cjs.map +1 -0
- package/dist/rules/requireYieldsCheck.d.ts +3 -0
- package/dist/rules/sortTags.cjs +656 -0
- package/dist/rules/sortTags.cjs.map +1 -0
- package/dist/rules/sortTags.d.ts +3 -0
- package/dist/rules/tagLines.cjs +374 -0
- package/dist/rules/tagLines.cjs.map +1 -0
- package/dist/rules/tagLines.d.ts +3 -0
- package/dist/rules/textEscaping.cjs +141 -0
- package/dist/rules/textEscaping.cjs.map +1 -0
- package/dist/rules/textEscaping.d.ts +3 -0
- package/dist/rules/tsMethodSignatureStyle.cjs +240 -0
- package/dist/rules/tsMethodSignatureStyle.cjs.map +1 -0
- package/dist/rules/tsMethodSignatureStyle.d.ts +3 -0
- package/dist/rules/tsNoEmptyObjectType.cjs +62 -0
- package/dist/rules/tsNoEmptyObjectType.cjs.map +1 -0
- package/dist/rules/tsNoEmptyObjectType.d.ts +3 -0
- package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs +104 -0
- package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs.map +1 -0
- package/dist/rules/tsNoUnnecessaryTemplateExpression.d.ts +3 -0
- package/dist/rules/tsPreferFunctionType.cjs +110 -0
- package/dist/rules/tsPreferFunctionType.cjs.map +1 -0
- package/dist/rules/tsPreferFunctionType.d.ts +3 -0
- package/dist/rules/typeFormatting.cjs +607 -0
- package/dist/rules/typeFormatting.cjs.map +1 -0
- package/dist/rules/typeFormatting.d.ts +3 -0
- package/dist/rules/validTypes.cjs +328 -0
- package/dist/rules/validTypes.cjs.map +1 -0
- package/dist/rules/validTypes.d.ts +3 -0
- package/dist/rules.d.ts +3203 -0
- package/dist/tagNames.cjs +244 -0
- package/dist/tagNames.cjs.map +1 -0
- package/dist/tagNames.d.ts +16 -0
- package/dist/to-valid-identifier.cjs +263 -0
- package/dist/utils/hasReturnValue.cjs +495 -0
- package/dist/utils/hasReturnValue.cjs.map +1 -0
- package/dist/utils/hasReturnValue.d.ts +20 -0
- package/package.json +220 -0
- package/rollup.config.js +16 -0
- package/src/WarnSettings.js +34 -0
- package/src/alignTransform.js +444 -0
- package/src/buildForbidRuleDefinition.js +106 -0
- package/src/buildRejectOrPreferRuleDefinition.js +481 -0
- package/src/defaultTagOrder.js +169 -0
- package/src/exportParser.js +973 -0
- package/src/getDefaultTagStructureForMode.js +968 -0
- package/src/getJsdocProcessorPlugin.cts +5 -0
- package/src/getJsdocProcessorPlugin.js +692 -0
- package/src/index-cjs.js +755 -0
- package/src/index-esm.js +196 -0
- package/src/index.cjs.cts +3 -0
- package/src/index.js +940 -0
- package/src/iterateJsdoc.cts +7 -0
- package/src/iterateJsdoc.js +2612 -0
- package/src/jsdocUtils.js +2158 -0
- package/src/rules/checkAccess.js +45 -0
- package/src/rules/checkAlignment.js +82 -0
- package/src/rules/checkExamples.js +613 -0
- package/src/rules/checkIndentation.js +176 -0
- package/src/rules/checkLineAlignment.js +453 -0
- package/src/rules/checkParamNames.js +541 -0
- package/src/rules/checkPropertyNames.js +174 -0
- package/src/rules/checkSyntax.js +30 -0
- package/src/rules/checkTagNames.js +414 -0
- package/src/rules/checkTemplateNames.js +208 -0
- package/src/rules/checkTypes.js +130 -0
- package/src/rules/checkValues.js +264 -0
- package/src/rules/convertToJsdocComments.js +444 -0
- package/src/rules/emptyTags.js +106 -0
- package/src/rules/escapeInlineTags.js +189 -0
- package/src/rules/implementsOnClasses.js +78 -0
- package/src/rules/importsAsDependencies.js +132 -0
- package/src/rules/informativeDocs.js +228 -0
- package/src/rules/linesBeforeBlock.js +144 -0
- package/src/rules/matchDescription.js +413 -0
- package/src/rules/matchName.js +179 -0
- package/src/rules/multilineBlocks.js +562 -0
- package/src/rules/noBadBlocks.js +127 -0
- package/src/rules/noBlankBlockDescriptions.js +69 -0
- package/src/rules/noBlankBlocks.js +55 -0
- package/src/rules/noDefaults.js +104 -0
- package/src/rules/noMissingSyntax.js +215 -0
- package/src/rules/noMultiAsterisks.js +162 -0
- package/src/rules/noRestrictedSyntax.js +72 -0
- package/src/rules/noTypes.js +108 -0
- package/src/rules/noUndefinedTypes.js +797 -0
- package/src/rules/preferImportTag.js +521 -0
- package/src/rules/requireAsteriskPrefix.js +217 -0
- package/src/rules/requireDescription.js +190 -0
- package/src/rules/requireDescriptionCompleteSentence.js +376 -0
- package/src/rules/requireExample.js +143 -0
- package/src/rules/requireFileOverview.js +213 -0
- package/src/rules/requireHyphenBeforeParamDescription.js +210 -0
- package/src/rules/requireJsdoc.js +897 -0
- package/src/rules/requireParam.js +848 -0
- package/src/rules/requireParamDescription.js +110 -0
- package/src/rules/requireParamName.js +69 -0
- package/src/rules/requireParamType.js +109 -0
- package/src/rules/requireProperty.js +66 -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/requireRejects.js +246 -0
- package/src/rules/requireReturns.js +291 -0
- package/src/rules/requireReturnsCheck.js +180 -0
- package/src/rules/requireReturnsDescription.js +73 -0
- package/src/rules/requireReturnsType.js +65 -0
- package/src/rules/requireTags.js +85 -0
- package/src/rules/requireTemplate.js +246 -0
- package/src/rules/requireThrows.js +128 -0
- package/src/rules/requireYields.js +265 -0
- package/src/rules/requireYieldsCheck.js +226 -0
- package/src/rules/sortTags.js +766 -0
- package/src/rules/tagLines.js +486 -0
- package/src/rules/textEscaping.js +158 -0
- package/src/rules/tsMethodSignatureStyle.js +300 -0
- package/src/rules/tsNoEmptyObjectType.js +61 -0
- package/src/rules/tsNoUnnecessaryTemplateExpression.js +130 -0
- package/src/rules/tsPreferFunctionType.js +127 -0
- package/src/rules/typeFormatting.js +690 -0
- package/src/rules/validTypes.js +466 -0
- package/src/rules.d.ts +3203 -0
- package/src/tagNames.js +301 -0
- package/src/utils/hasReturnValue.js +572 -0
- package/typings/babel__eslint-parser.d.ts +1 -0
- package/typings/gitdown.d.ts +16 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
+
import {
|
|
3
|
+
parse as parseType,
|
|
4
|
+
traverse,
|
|
5
|
+
tryParse as tryParseType,
|
|
6
|
+
} from '@es-joy/jsdoccomment';
|
|
7
|
+
|
|
8
|
+
export default iterateJsdoc(({
|
|
9
|
+
context,
|
|
10
|
+
node,
|
|
11
|
+
report,
|
|
12
|
+
settings,
|
|
13
|
+
utils,
|
|
14
|
+
}) => {
|
|
15
|
+
if (utils.avoidDocs()) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
requireSeparateTemplates = false,
|
|
21
|
+
} = context.options[0] || {};
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
mode,
|
|
25
|
+
} = settings;
|
|
26
|
+
|
|
27
|
+
const usedNames = new Set();
|
|
28
|
+
|
|
29
|
+
const tgName = /** @type {string} */ (utils.getPreferredTagName({
|
|
30
|
+
tagName: 'template',
|
|
31
|
+
}));
|
|
32
|
+
if (!tgName) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const templateTags = utils.getTags(tgName);
|
|
37
|
+
|
|
38
|
+
const templateNames = templateTags.flatMap((tag) => {
|
|
39
|
+
return utils.parseClosureTemplateTag(tag);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (requireSeparateTemplates) {
|
|
43
|
+
for (const tag of templateTags) {
|
|
44
|
+
const names = utils.parseClosureTemplateTag(tag);
|
|
45
|
+
if (names.length > 1) {
|
|
46
|
+
report(`Missing separate @${tgName} for ${names[1]}`, null, tag);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|
|
|
53
|
+
* import('@typescript-eslint/types').TSESTree.ClassDeclaration|
|
|
54
|
+
* import('@typescript-eslint/types').TSESTree.TSDeclareFunction|
|
|
55
|
+
* import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|
|
|
56
|
+
* import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration
|
|
57
|
+
*/
|
|
58
|
+
const checkTypeParams = (aliasDeclaration) => {
|
|
59
|
+
const {
|
|
60
|
+
params,
|
|
61
|
+
/* c8 ignore next -- Guard */
|
|
62
|
+
} = aliasDeclaration.typeParameters ?? {
|
|
63
|
+
/* c8 ignore next -- Guard */
|
|
64
|
+
params: [],
|
|
65
|
+
};
|
|
66
|
+
for (const {
|
|
67
|
+
name: {
|
|
68
|
+
name,
|
|
69
|
+
},
|
|
70
|
+
} of params) {
|
|
71
|
+
usedNames.add(name);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
for (const usedName of usedNames) {
|
|
75
|
+
if (!templateNames.includes(usedName)) {
|
|
76
|
+
report(`Missing @${tgName} ${usedName}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const handleTypes = () => {
|
|
82
|
+
const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (
|
|
83
|
+
node
|
|
84
|
+
);
|
|
85
|
+
if (!nde) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
switch (nde.type) {
|
|
90
|
+
case 'ClassDeclaration':
|
|
91
|
+
case 'FunctionDeclaration':
|
|
92
|
+
case 'TSDeclareFunction':
|
|
93
|
+
case 'TSInterfaceDeclaration':
|
|
94
|
+
case 'TSTypeAliasDeclaration':
|
|
95
|
+
checkTypeParams(nde);
|
|
96
|
+
break;
|
|
97
|
+
case 'ExportDefaultDeclaration':
|
|
98
|
+
switch (nde.declaration?.type) {
|
|
99
|
+
case 'ClassDeclaration':
|
|
100
|
+
case 'FunctionDeclaration':
|
|
101
|
+
case 'TSInterfaceDeclaration':
|
|
102
|
+
checkTypeParams(nde.declaration);
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
break;
|
|
107
|
+
case 'ExportNamedDeclaration':
|
|
108
|
+
switch (nde.declaration?.type) {
|
|
109
|
+
case 'ClassDeclaration':
|
|
110
|
+
case 'FunctionDeclaration':
|
|
111
|
+
case 'TSDeclareFunction':
|
|
112
|
+
case 'TSInterfaceDeclaration':
|
|
113
|
+
case 'TSTypeAliasDeclaration':
|
|
114
|
+
checkTypeParams(nde.declaration);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const usedNameToTag = new Map();
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @param {import('comment-parser').Spec} potentialTag
|
|
126
|
+
*/
|
|
127
|
+
const checkForUsedTypes = (potentialTag) => {
|
|
128
|
+
let parsedType;
|
|
129
|
+
try {
|
|
130
|
+
parsedType = mode === 'permissive' ?
|
|
131
|
+
tryParseType(/** @type {string} */ (potentialTag.type)) :
|
|
132
|
+
parseType(/** @type {string} */ (potentialTag.type), mode);
|
|
133
|
+
} catch {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
traverse(parsedType, (nde) => {
|
|
138
|
+
if (nde.type === 'JsdocTypeTypeParameter') {
|
|
139
|
+
templateNames.push(nde.name.value);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (nde.type === 'JsdocTypeInfer') {
|
|
144
|
+
templateNames.push(nde.element.value);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const {
|
|
149
|
+
type,
|
|
150
|
+
value,
|
|
151
|
+
} = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);
|
|
152
|
+
|
|
153
|
+
if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {
|
|
154
|
+
usedNames.add(value);
|
|
155
|
+
if (!usedNameToTag.has(value)) {
|
|
156
|
+
usedNameToTag.set(value, potentialTag);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @param {string[]} tagNames
|
|
164
|
+
*/
|
|
165
|
+
const checkTagsAndTemplates = (tagNames) => {
|
|
166
|
+
for (const tagName of tagNames) {
|
|
167
|
+
const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({
|
|
168
|
+
tagName,
|
|
169
|
+
}));
|
|
170
|
+
const matchingTags = utils.getTags(preferredTagName);
|
|
171
|
+
for (const matchingTag of matchingTags) {
|
|
172
|
+
checkForUsedTypes(matchingTag);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Could check against whitelist/blacklist
|
|
177
|
+
for (const usedName of usedNames) {
|
|
178
|
+
if (!templateNames.includes(usedName)) {
|
|
179
|
+
report(`Missing @${tgName} ${usedName}`, null, usedNameToTag.get(usedName));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const callbackTags = utils.getTags('callback');
|
|
185
|
+
const functionTags = utils.getTags('function');
|
|
186
|
+
if (callbackTags.length || functionTags.length) {
|
|
187
|
+
checkTagsAndTemplates([
|
|
188
|
+
'param', 'returns',
|
|
189
|
+
]);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const typedefTags = utils.getTags('typedef');
|
|
194
|
+
if (!typedefTags.length || typedefTags.length >= 2) {
|
|
195
|
+
handleTypes();
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const potentialTypedef = typedefTags[0];
|
|
200
|
+
checkForUsedTypes(potentialTypedef);
|
|
201
|
+
|
|
202
|
+
checkTagsAndTemplates([
|
|
203
|
+
'property',
|
|
204
|
+
]);
|
|
205
|
+
}, {
|
|
206
|
+
iterateAllJsdocs: true,
|
|
207
|
+
meta: {
|
|
208
|
+
docs: {
|
|
209
|
+
description: 'Requires `@template` tags be present when type parameters are used.',
|
|
210
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',
|
|
211
|
+
},
|
|
212
|
+
schema: [
|
|
213
|
+
{
|
|
214
|
+
additionalProperties: false,
|
|
215
|
+
properties: {
|
|
216
|
+
exemptedBy: {
|
|
217
|
+
description: `Array of tags (e.g., \`['type']\`) whose presence on the document
|
|
218
|
+
block avoids the need for a \`@template\`. Defaults to an array with
|
|
219
|
+
\`inheritdoc\`. If you set this array, it will overwrite the default,
|
|
220
|
+
so be sure to add back \`inheritdoc\` if you wish its presence to cause
|
|
221
|
+
exemption of the rule.`,
|
|
222
|
+
items: {
|
|
223
|
+
type: 'string',
|
|
224
|
+
},
|
|
225
|
+
type: 'array',
|
|
226
|
+
},
|
|
227
|
+
requireSeparateTemplates: {
|
|
228
|
+
description: `Requires that each template have its own separate line, i.e., preventing
|
|
229
|
+
templates of this format:
|
|
230
|
+
|
|
231
|
+
\`\`\`js
|
|
232
|
+
/**
|
|
233
|
+
* @template T, U, V
|
|
234
|
+
*/
|
|
235
|
+
\`\`\`
|
|
236
|
+
|
|
237
|
+
Defaults to \`false\`.`,
|
|
238
|
+
type: 'boolean',
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
type: 'object',
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
type: 'suggestion',
|
|
245
|
+
},
|
|
246
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* We can skip checking for a throws value, in case the documentation is inherited
|
|
5
|
+
* or the method is either a constructor or an abstract method.
|
|
6
|
+
* @param {import('../iterateJsdoc.js').Utils} utils a reference to the utils which are used to probe if a tag is present or not.
|
|
7
|
+
* @returns {boolean} true in case deep checking can be skipped; otherwise false.
|
|
8
|
+
*/
|
|
9
|
+
const canSkip = (utils) => {
|
|
10
|
+
return utils.hasATag([
|
|
11
|
+
// inheritdoc implies that all documentation is inherited
|
|
12
|
+
// see https://jsdoc.app/tags-inheritdoc.html
|
|
13
|
+
//
|
|
14
|
+
// Abstract methods are by definition incomplete,
|
|
15
|
+
// so it is not necessary to document that they throw an error.
|
|
16
|
+
'abstract',
|
|
17
|
+
'virtual',
|
|
18
|
+
|
|
19
|
+
// The designated type can itself document `@throws`
|
|
20
|
+
'type',
|
|
21
|
+
]) ||
|
|
22
|
+
utils.avoidDocs();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default iterateJsdoc(({
|
|
26
|
+
report,
|
|
27
|
+
utils,
|
|
28
|
+
}) => {
|
|
29
|
+
// A preflight check. We do not need to run a deep check for abstract
|
|
30
|
+
// functions.
|
|
31
|
+
if (canSkip(utils)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const tagName = /** @type {string} */ (utils.getPreferredTagName({
|
|
36
|
+
tagName: 'throws',
|
|
37
|
+
}));
|
|
38
|
+
if (!tagName) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const tags = utils.getTags(tagName);
|
|
43
|
+
const iteratingFunction = utils.isIteratingFunction();
|
|
44
|
+
|
|
45
|
+
// In case the code returns something, we expect a return value in JSDoc.
|
|
46
|
+
const [
|
|
47
|
+
tag,
|
|
48
|
+
] = tags;
|
|
49
|
+
const missingThrowsTag = typeof tag === 'undefined' || tag === null;
|
|
50
|
+
|
|
51
|
+
const shouldReport = () => {
|
|
52
|
+
if (!missingThrowsTag) {
|
|
53
|
+
if (tag.type.trim() === 'never' && iteratingFunction && utils.hasThrowValue()) {
|
|
54
|
+
report(`JSDoc @${tagName} declaration set to "never" but throw value found.`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return iteratingFunction && utils.hasThrowValue();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if (shouldReport()) {
|
|
64
|
+
report(`Missing JSDoc @${tagName} declaration.`);
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
contextDefaults: true,
|
|
68
|
+
meta: {
|
|
69
|
+
docs: {
|
|
70
|
+
description: 'Requires that throw statements are documented with `@throws` tags.',
|
|
71
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-throws.md#repos-sticky-header',
|
|
72
|
+
},
|
|
73
|
+
schema: [
|
|
74
|
+
{
|
|
75
|
+
additionalProperties: false,
|
|
76
|
+
properties: {
|
|
77
|
+
contexts: {
|
|
78
|
+
description: `Set this to an array of strings representing the AST context
|
|
79
|
+
(or objects with optional \`context\` and \`comment\` properties) where you wish
|
|
80
|
+
the rule to be applied.
|
|
81
|
+
|
|
82
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
83
|
+
|
|
84
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
85
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
86
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
87
|
+
for finding function blocks not attached to a function declaration or
|
|
88
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
89
|
+
\`@method\`) (including those associated with an \`@interface\`).`,
|
|
90
|
+
items: {
|
|
91
|
+
anyOf: [
|
|
92
|
+
{
|
|
93
|
+
type: 'string',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
additionalProperties: false,
|
|
97
|
+
properties: {
|
|
98
|
+
comment: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
},
|
|
101
|
+
context: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
type: 'object',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
type: 'array',
|
|
110
|
+
},
|
|
111
|
+
exemptedBy: {
|
|
112
|
+
description: `Array of tags (e.g., \`['type']\`) whose presence on the
|
|
113
|
+
document block avoids the need for a \`@throws\`. Defaults to an array
|
|
114
|
+
with \`inheritdoc\`. If you set this array, it will overwrite the default,
|
|
115
|
+
so be sure to add back \`inheritdoc\` if you wish its presence to cause
|
|
116
|
+
exemption of the rule.`,
|
|
117
|
+
items: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
},
|
|
120
|
+
type: 'array',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
type: 'object',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
type: 'suggestion',
|
|
127
|
+
},
|
|
128
|
+
});
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* We can skip checking for a yield value, in case the documentation is inherited
|
|
5
|
+
* or the method has a constructor or abstract tag.
|
|
6
|
+
*
|
|
7
|
+
* In either of these cases the yield value is optional or not defined.
|
|
8
|
+
* @param {import('../iterateJsdoc.js').Utils} utils a reference to the utils which are used to probe if a tag is present or not.
|
|
9
|
+
* @returns {boolean} true in case deep checking can be skipped; otherwise false.
|
|
10
|
+
*/
|
|
11
|
+
const canSkip = (utils) => {
|
|
12
|
+
return utils.hasATag([
|
|
13
|
+
// inheritdoc implies that all documentation is inherited
|
|
14
|
+
// see https://jsdoc.app/tags-inheritdoc.html
|
|
15
|
+
//
|
|
16
|
+
// Abstract methods are by definition incomplete,
|
|
17
|
+
// so it is not an error if it declares a yield value but does not implement it.
|
|
18
|
+
'abstract',
|
|
19
|
+
'virtual',
|
|
20
|
+
|
|
21
|
+
// Constructors do not have a yield value
|
|
22
|
+
// so we can bail out here, too.
|
|
23
|
+
'class',
|
|
24
|
+
'constructor',
|
|
25
|
+
|
|
26
|
+
// Yield (and any `next`) type is specified accompanying the targeted
|
|
27
|
+
// @type
|
|
28
|
+
'type',
|
|
29
|
+
|
|
30
|
+
// This seems to imply a class as well
|
|
31
|
+
'interface',
|
|
32
|
+
]) ||
|
|
33
|
+
utils.avoidDocs();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {import('../iterateJsdoc.js').Utils} utils
|
|
38
|
+
* @param {import('../iterateJsdoc.js').Report} report
|
|
39
|
+
* @param {string} tagName
|
|
40
|
+
* @returns {[preferredTagName?: string, missingTag?: boolean]}
|
|
41
|
+
*/
|
|
42
|
+
const checkTagName = (utils, report, tagName) => {
|
|
43
|
+
const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({
|
|
44
|
+
tagName,
|
|
45
|
+
}));
|
|
46
|
+
if (!preferredTagName) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const tags = utils.getTags(preferredTagName);
|
|
51
|
+
|
|
52
|
+
if (tags.length > 1) {
|
|
53
|
+
report(`Found more than one @${preferredTagName} declaration.`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// In case the code yields something, we expect a yields value in JSDoc.
|
|
57
|
+
const [
|
|
58
|
+
tag,
|
|
59
|
+
] = tags;
|
|
60
|
+
const missingTag = typeof tag === 'undefined' || tag === null;
|
|
61
|
+
|
|
62
|
+
return [
|
|
63
|
+
preferredTagName, missingTag,
|
|
64
|
+
];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default iterateJsdoc(({
|
|
68
|
+
context,
|
|
69
|
+
report,
|
|
70
|
+
utils,
|
|
71
|
+
}) => {
|
|
72
|
+
const {
|
|
73
|
+
forceRequireNext = false,
|
|
74
|
+
forceRequireYields = false,
|
|
75
|
+
next = false,
|
|
76
|
+
nextWithGeneratorTag = false,
|
|
77
|
+
withGeneratorTag = true,
|
|
78
|
+
} = context.options[0] || {};
|
|
79
|
+
|
|
80
|
+
// A preflight check. We do not need to run a deep check
|
|
81
|
+
// in case the @yield comment is optional or undefined.
|
|
82
|
+
if (canSkip(utils)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const iteratingFunction = utils.isIteratingFunction();
|
|
87
|
+
|
|
88
|
+
const [
|
|
89
|
+
preferredYieldTagName,
|
|
90
|
+
missingYieldTag,
|
|
91
|
+
] = checkTagName(
|
|
92
|
+
utils, report, 'yields',
|
|
93
|
+
);
|
|
94
|
+
if (preferredYieldTagName) {
|
|
95
|
+
const shouldReportYields = () => {
|
|
96
|
+
if (!missingYieldTag) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (
|
|
101
|
+
withGeneratorTag && utils.hasTag('generator') ||
|
|
102
|
+
forceRequireYields && iteratingFunction && utils.isGenerator()
|
|
103
|
+
) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return iteratingFunction && utils.isGenerator() && utils.hasYieldValue();
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
if (shouldReportYields()) {
|
|
111
|
+
report(`Missing JSDoc @${preferredYieldTagName} declaration.`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (next || nextWithGeneratorTag || forceRequireNext) {
|
|
116
|
+
const [
|
|
117
|
+
preferredNextTagName,
|
|
118
|
+
missingNextTag,
|
|
119
|
+
] = checkTagName(
|
|
120
|
+
utils, report, 'next',
|
|
121
|
+
);
|
|
122
|
+
if (!preferredNextTagName) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const shouldReportNext = () => {
|
|
127
|
+
if (!missingNextTag) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (
|
|
132
|
+
nextWithGeneratorTag && utils.hasTag('generator')) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (
|
|
137
|
+
!next && !forceRequireNext ||
|
|
138
|
+
!iteratingFunction ||
|
|
139
|
+
!utils.isGenerator()
|
|
140
|
+
) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return forceRequireNext || utils.hasYieldReturnValue();
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
if (shouldReportNext()) {
|
|
148
|
+
report(`Missing JSDoc @${preferredNextTagName} declaration.`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
contextDefaults: true,
|
|
153
|
+
meta: {
|
|
154
|
+
docs: {
|
|
155
|
+
description: 'Requires yields are documented with `@yields` tags.',
|
|
156
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields.md#repos-sticky-header',
|
|
157
|
+
},
|
|
158
|
+
schema: [
|
|
159
|
+
{
|
|
160
|
+
additionalProperties: false,
|
|
161
|
+
properties: {
|
|
162
|
+
contexts: {
|
|
163
|
+
description: `Set this to an array of strings representing the AST context
|
|
164
|
+
(or objects with optional \`context\` and \`comment\` properties) where you wish
|
|
165
|
+
the rule to be applied.
|
|
166
|
+
|
|
167
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
168
|
+
|
|
169
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
170
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
171
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
172
|
+
for finding function blocks not attached to a function declaration or
|
|
173
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
174
|
+
\`@method\`) (including those associated with an \`@interface\`). This
|
|
175
|
+
rule will only apply on non-default contexts when there is such a tag
|
|
176
|
+
present and the \`forceRequireYields\` option is set or if the
|
|
177
|
+
\`withGeneratorTag\` option is set with a present \`@generator\` tag
|
|
178
|
+
(since we are not checking against the actual \`yield\` values in these
|
|
179
|
+
cases).`,
|
|
180
|
+
items: {
|
|
181
|
+
anyOf: [
|
|
182
|
+
{
|
|
183
|
+
type: 'string',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
additionalProperties: false,
|
|
187
|
+
properties: {
|
|
188
|
+
comment: {
|
|
189
|
+
type: 'string',
|
|
190
|
+
},
|
|
191
|
+
context: {
|
|
192
|
+
type: 'string',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
type: 'object',
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
type: 'array',
|
|
200
|
+
},
|
|
201
|
+
exemptedBy: {
|
|
202
|
+
description: `Array of tags (e.g., \`['type']\`) whose presence on the
|
|
203
|
+
document block avoids the need for a \`@yields\`. Defaults to an array
|
|
204
|
+
with \`inheritdoc\`. If you set this array, it will overwrite the default,
|
|
205
|
+
so be sure to add back \`inheritdoc\` if you wish its presence to cause
|
|
206
|
+
exemption of the rule.`,
|
|
207
|
+
items: {
|
|
208
|
+
type: 'string',
|
|
209
|
+
},
|
|
210
|
+
type: 'array',
|
|
211
|
+
},
|
|
212
|
+
forceRequireNext: {
|
|
213
|
+
default: false,
|
|
214
|
+
description: `Set to \`true\` to always insist on
|
|
215
|
+
\`@next\` documentation even if there are no \`yield\` statements in the
|
|
216
|
+
function or none return values. May be desired to flag that a project is
|
|
217
|
+
aware of the expected yield return being \`undefined\`. Defaults to \`false\`.`,
|
|
218
|
+
type: 'boolean',
|
|
219
|
+
},
|
|
220
|
+
forceRequireYields: {
|
|
221
|
+
default: false,
|
|
222
|
+
description: `Set to \`true\` to always insist on
|
|
223
|
+
\`@yields\` documentation for generators even if there are only
|
|
224
|
+
expressionless \`yield\` statements in the function. May be desired to flag
|
|
225
|
+
that a project is aware of an \`undefined\`/\`void\` yield. Defaults to
|
|
226
|
+
\`false\`.`,
|
|
227
|
+
type: 'boolean',
|
|
228
|
+
},
|
|
229
|
+
next: {
|
|
230
|
+
default: false,
|
|
231
|
+
description: `If \`true\`, this option will insist that any use of a \`yield\` return
|
|
232
|
+
value (e.g., \`const rv = yield;\` or \`const rv = yield value;\`) has a
|
|
233
|
+
(non-standard) \`@next\` tag (in addition to any \`@yields\` tag) so as to be
|
|
234
|
+
able to document the type expected to be supplied into the iterator
|
|
235
|
+
(the \`Generator\` iterator that is returned by the call to the generator
|
|
236
|
+
function) to the iterator (e.g., \`it.next(value)\`). The tag will not be
|
|
237
|
+
expected if the generator function body merely has plain \`yield;\` or
|
|
238
|
+
\`yield value;\` statements without returning the values. Defaults to
|
|
239
|
+
\`false\`.`,
|
|
240
|
+
type: 'boolean',
|
|
241
|
+
},
|
|
242
|
+
nextWithGeneratorTag: {
|
|
243
|
+
default: false,
|
|
244
|
+
description: `If a \`@generator\` tag is present on a block, require
|
|
245
|
+
(non-standard ) \`@next\` (see \`next\` option). This will require using \`void\`
|
|
246
|
+
or \`undefined\` in cases where generators do not use the \`next()\`-supplied
|
|
247
|
+
incoming \`yield\`-returned value. Defaults to \`false\`. See \`contexts\` to
|
|
248
|
+
\`any\` if you want to catch \`@generator\` with \`@callback\` or such not
|
|
249
|
+
attached to a function.`,
|
|
250
|
+
type: 'boolean',
|
|
251
|
+
},
|
|
252
|
+
withGeneratorTag: {
|
|
253
|
+
default: true,
|
|
254
|
+
description: `If a \`@generator\` tag is present on a block, require
|
|
255
|
+
\`@yields\`/\`@yield\`. Defaults to \`true\`. See \`contexts\` to \`any\` if you want
|
|
256
|
+
to catch \`@generator\` with \`@callback\` or such not attached to a function.`,
|
|
257
|
+
type: 'boolean',
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
type: 'object',
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
type: 'suggestion',
|
|
264
|
+
},
|
|
265
|
+
});
|