@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,291 @@
|
|
|
1
|
+
import exportParser from '../exportParser.js';
|
|
2
|
+
import iterateJsdoc from '../iterateJsdoc.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* We can skip checking for a return value, in case the documentation is inherited
|
|
6
|
+
* or the method is either a constructor or an abstract method.
|
|
7
|
+
*
|
|
8
|
+
* In either of these cases the return value is optional or not defined.
|
|
9
|
+
* @param {import('../iterateJsdoc.js').Utils} utils
|
|
10
|
+
* a reference to the utils which are used to probe if a tag is present or not.
|
|
11
|
+
* @returns {boolean}
|
|
12
|
+
* true in case deep checking can be skipped; otherwise false.
|
|
13
|
+
*/
|
|
14
|
+
const canSkip = (utils) => {
|
|
15
|
+
return utils.hasATag([
|
|
16
|
+
// inheritdoc implies that all documentation is inherited
|
|
17
|
+
// see https://jsdoc.app/tags-inheritdoc.html
|
|
18
|
+
//
|
|
19
|
+
// Abstract methods are by definition incomplete,
|
|
20
|
+
// so it is not an error if it declares a return value but does not implement it.
|
|
21
|
+
'abstract',
|
|
22
|
+
'virtual',
|
|
23
|
+
|
|
24
|
+
// Constructors do not have a return value by definition (https://jsdoc.app/tags-class.html)
|
|
25
|
+
// So we can bail out here, too.
|
|
26
|
+
'class',
|
|
27
|
+
'constructor',
|
|
28
|
+
|
|
29
|
+
// Return type is specified by type in @type
|
|
30
|
+
'type',
|
|
31
|
+
|
|
32
|
+
// This seems to imply a class as well
|
|
33
|
+
'interface',
|
|
34
|
+
]) ||
|
|
35
|
+
utils.avoidDocs();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default iterateJsdoc(({
|
|
39
|
+
context,
|
|
40
|
+
info: {
|
|
41
|
+
comment,
|
|
42
|
+
},
|
|
43
|
+
node,
|
|
44
|
+
report,
|
|
45
|
+
settings,
|
|
46
|
+
utils,
|
|
47
|
+
}) => {
|
|
48
|
+
const {
|
|
49
|
+
contexts,
|
|
50
|
+
enableFixer = false,
|
|
51
|
+
forceRequireReturn = false,
|
|
52
|
+
forceReturnsWithAsync = false,
|
|
53
|
+
publicOnly = false,
|
|
54
|
+
} = context.options[0] || {};
|
|
55
|
+
|
|
56
|
+
// A preflight check. We do not need to run a deep check
|
|
57
|
+
// in case the @returns comment is optional or undefined.
|
|
58
|
+
if (canSkip(utils)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** @type {boolean|undefined} */
|
|
63
|
+
let forceRequireReturnContext;
|
|
64
|
+
if (contexts) {
|
|
65
|
+
const {
|
|
66
|
+
foundContext,
|
|
67
|
+
} = utils.findContext(contexts, comment);
|
|
68
|
+
if (typeof foundContext === 'object') {
|
|
69
|
+
forceRequireReturnContext = foundContext.forceRequireReturn;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const tagName = /** @type {string} */ (utils.getPreferredTagName({
|
|
74
|
+
tagName: 'returns',
|
|
75
|
+
}));
|
|
76
|
+
if (!tagName) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const tags = utils.getTags(tagName);
|
|
81
|
+
|
|
82
|
+
if (tags.length > 1) {
|
|
83
|
+
report(`Found more than one @${tagName} declaration.`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const iteratingFunction = utils.isIteratingFunction();
|
|
87
|
+
|
|
88
|
+
// In case the code returns something, we expect a return value in JSDoc.
|
|
89
|
+
const [
|
|
90
|
+
tag,
|
|
91
|
+
] = tags;
|
|
92
|
+
const missingReturnTag = typeof tag === 'undefined' || tag === null;
|
|
93
|
+
|
|
94
|
+
const shouldReport = () => {
|
|
95
|
+
if (!missingReturnTag) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (publicOnly) {
|
|
100
|
+
/** @type {import('./requireJsdoc.js').RequireJsdocOpts} */
|
|
101
|
+
const opt = {
|
|
102
|
+
ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),
|
|
103
|
+
esm: Boolean(publicOnly?.esm ?? true),
|
|
104
|
+
initModuleExports: Boolean(publicOnly?.cjs ?? true),
|
|
105
|
+
initWindow: Boolean(publicOnly?.window ?? false),
|
|
106
|
+
};
|
|
107
|
+
/* c8 ignore next -- Fallback to deprecated method */
|
|
108
|
+
const {
|
|
109
|
+
// @ts-expect-error ESLint < 10
|
|
110
|
+
sourceCode = context.getSourceCode(),
|
|
111
|
+
} = context;
|
|
112
|
+
const exported = exportParser.isUncommentedExport(
|
|
113
|
+
/** @type {import('eslint').Rule.Node} */ (node), sourceCode, opt, settings,
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
if (!exported) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if ((forceRequireReturn || forceRequireReturnContext) && (
|
|
122
|
+
iteratingFunction || utils.isVirtualFunction()
|
|
123
|
+
)) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const isAsync = !iteratingFunction && utils.hasTag('async') ||
|
|
128
|
+
iteratingFunction && utils.isAsync();
|
|
129
|
+
|
|
130
|
+
if (forceReturnsWithAsync && isAsync) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return iteratingFunction && utils.hasValueOrExecutorHasNonEmptyResolveValue(
|
|
135
|
+
forceReturnsWithAsync,
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
if (shouldReport()) {
|
|
140
|
+
utils.reportJSDoc(`Missing JSDoc @${tagName} declaration.`, null, enableFixer ? () => {
|
|
141
|
+
utils.addTag(tagName);
|
|
142
|
+
} : null);
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
contextDefaults: true,
|
|
146
|
+
meta: {
|
|
147
|
+
docs: {
|
|
148
|
+
description: 'Requires that returns are documented with `@returns`.',
|
|
149
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#repos-sticky-header',
|
|
150
|
+
},
|
|
151
|
+
fixable: 'code',
|
|
152
|
+
schema: [
|
|
153
|
+
{
|
|
154
|
+
additionalProperties: false,
|
|
155
|
+
properties: {
|
|
156
|
+
checkConstructors: {
|
|
157
|
+
default: false,
|
|
158
|
+
description: `A value indicating whether \`constructor\`s should
|
|
159
|
+
be checked for \`@returns\` tags. Defaults to \`false\`.`,
|
|
160
|
+
type: 'boolean',
|
|
161
|
+
},
|
|
162
|
+
checkGetters: {
|
|
163
|
+
default: true,
|
|
164
|
+
description: `Boolean to determine whether getter methods should
|
|
165
|
+
be checked for \`@returns\` tags. Defaults to \`true\`.`,
|
|
166
|
+
type: 'boolean',
|
|
167
|
+
},
|
|
168
|
+
contexts: {
|
|
169
|
+
description: `Set this to an array of strings representing the AST context
|
|
170
|
+
(or objects with optional \`context\` and \`comment\` properties) where you wish
|
|
171
|
+
the rule to be applied.
|
|
172
|
+
|
|
173
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
174
|
+
|
|
175
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
176
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
177
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
178
|
+
for finding function blocks not attached to a function declaration or
|
|
179
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
180
|
+
\`@method\`) (including those associated with an \`@interface\`). This
|
|
181
|
+
rule will only apply on non-default contexts when there is such a tag
|
|
182
|
+
present and the \`forceRequireReturn\` option is set or if the
|
|
183
|
+
\`forceReturnsWithAsync\` option is set with a present \`@async\` tag
|
|
184
|
+
(since we are not checking against the actual \`return\` values in these
|
|
185
|
+
cases).`,
|
|
186
|
+
items: {
|
|
187
|
+
anyOf: [
|
|
188
|
+
{
|
|
189
|
+
type: 'string',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
additionalProperties: false,
|
|
193
|
+
properties: {
|
|
194
|
+
comment: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
},
|
|
197
|
+
context: {
|
|
198
|
+
type: 'string',
|
|
199
|
+
},
|
|
200
|
+
forceRequireReturn: {
|
|
201
|
+
type: 'boolean',
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
type: 'object',
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
type: 'array',
|
|
209
|
+
},
|
|
210
|
+
enableFixer: {
|
|
211
|
+
description: `Whether to enable the fixer to add a blank \`@returns\`.
|
|
212
|
+
Defaults to \`false\`.`,
|
|
213
|
+
type: 'boolean',
|
|
214
|
+
},
|
|
215
|
+
exemptedBy: {
|
|
216
|
+
description: `Array of tags (e.g., \`['type']\`) whose presence on the
|
|
217
|
+
document block avoids the need for a \`@returns\`. Defaults to an array
|
|
218
|
+
with \`inheritdoc\`. If you set this array, it will overwrite the default,
|
|
219
|
+
so be sure to add back \`inheritdoc\` if you wish its presence to cause
|
|
220
|
+
exemption of the rule.`,
|
|
221
|
+
items: {
|
|
222
|
+
type: 'string',
|
|
223
|
+
},
|
|
224
|
+
type: 'array',
|
|
225
|
+
},
|
|
226
|
+
forceRequireReturn: {
|
|
227
|
+
default: false,
|
|
228
|
+
description: `Set to \`true\` to always insist on
|
|
229
|
+
\`@returns\` documentation regardless of implicit or explicit \`return\`'s
|
|
230
|
+
in the function. May be desired to flag that a project is aware of an
|
|
231
|
+
\`undefined\`/\`void\` return. Defaults to \`false\`.`,
|
|
232
|
+
type: 'boolean',
|
|
233
|
+
},
|
|
234
|
+
forceReturnsWithAsync: {
|
|
235
|
+
default: false,
|
|
236
|
+
description: `By default \`async\` functions that do not explicitly
|
|
237
|
+
return a value pass this rule as an \`async\` function will always return a
|
|
238
|
+
\`Promise\`, even if the \`Promise\` resolves to void. You can force all
|
|
239
|
+
\`async\` functions (including ones with an explicit \`Promise\` but no
|
|
240
|
+
detected non-\`undefined\` \`resolve\` value) to require \`@return\`
|
|
241
|
+
documentation by setting \`forceReturnsWithAsync\` to \`true\` on the options
|
|
242
|
+
object. This may be useful for flagging that there has been consideration
|
|
243
|
+
of return type. Defaults to \`false\`.`,
|
|
244
|
+
type: 'boolean',
|
|
245
|
+
},
|
|
246
|
+
publicOnly: {
|
|
247
|
+
description: `This option will insist that missing \`@returns\` are only reported for
|
|
248
|
+
function bodies / class declarations that are exported from the module.
|
|
249
|
+
May be a boolean or object. If set to \`true\`, the defaults below will be
|
|
250
|
+
used. If unset, \`@returns\` reporting will not be limited to exports.
|
|
251
|
+
|
|
252
|
+
This object supports the following optional boolean keys (\`false\` unless
|
|
253
|
+
otherwise noted):
|
|
254
|
+
|
|
255
|
+
- \`ancestorsOnly\` - Optimization to only check node ancestors to check if node is exported
|
|
256
|
+
- \`esm\` - ESM exports are checked for \`@returns\` JSDoc comments (Defaults to \`true\`)
|
|
257
|
+
- \`cjs\` - CommonJS exports are checked for \`@returns\` JSDoc comments (Defaults to \`true\`)
|
|
258
|
+
- \`window\` - Window global exports are checked for \`@returns\` JSDoc comments`,
|
|
259
|
+
oneOf: [
|
|
260
|
+
{
|
|
261
|
+
default: false,
|
|
262
|
+
type: 'boolean',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
additionalProperties: false,
|
|
266
|
+
default: {},
|
|
267
|
+
properties: {
|
|
268
|
+
ancestorsOnly: {
|
|
269
|
+
type: 'boolean',
|
|
270
|
+
},
|
|
271
|
+
cjs: {
|
|
272
|
+
type: 'boolean',
|
|
273
|
+
},
|
|
274
|
+
esm: {
|
|
275
|
+
type: 'boolean',
|
|
276
|
+
},
|
|
277
|
+
window: {
|
|
278
|
+
type: 'boolean',
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
type: 'object',
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
type: 'object',
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
type: 'suggestion',
|
|
290
|
+
},
|
|
291
|
+
});
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
+
import {
|
|
3
|
+
strictNativeTypes,
|
|
4
|
+
} from '../jsdocUtils.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('../iterateJsdoc.js').Utils} utils
|
|
8
|
+
* @param {import('../iterateJsdoc.js').Settings} settings
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
const canSkip = (utils, settings) => {
|
|
12
|
+
const voidingTags = [
|
|
13
|
+
// An abstract function is by definition incomplete
|
|
14
|
+
// so it is perfectly fine if a return is documented but
|
|
15
|
+
// not present within the function.
|
|
16
|
+
// A subclass may inherit the doc and implement the
|
|
17
|
+
// missing return.
|
|
18
|
+
'abstract',
|
|
19
|
+
'virtual',
|
|
20
|
+
|
|
21
|
+
// A constructor function returns `this` by default, so may be `@returns`
|
|
22
|
+
// tag indicating this but no explicit return
|
|
23
|
+
'class',
|
|
24
|
+
'constructor',
|
|
25
|
+
'interface',
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
if (settings.mode === 'closure') {
|
|
29
|
+
// Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned
|
|
30
|
+
voidingTags.push('record');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return utils.hasATag(voidingTags) ||
|
|
34
|
+
utils.isConstructor() ||
|
|
35
|
+
utils.classHasTag('interface') ||
|
|
36
|
+
settings.mode === 'closure' && utils.classHasTag('record');
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default iterateJsdoc(({
|
|
40
|
+
context,
|
|
41
|
+
node,
|
|
42
|
+
report,
|
|
43
|
+
settings,
|
|
44
|
+
utils,
|
|
45
|
+
}) => {
|
|
46
|
+
const {
|
|
47
|
+
exemptAsync = true,
|
|
48
|
+
exemptGenerators = settings.mode === 'typescript',
|
|
49
|
+
noNativeTypes = true,
|
|
50
|
+
reportMissingReturnForUndefinedTypes = false,
|
|
51
|
+
} = context.options[0] || {};
|
|
52
|
+
|
|
53
|
+
if (canSkip(utils, settings)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const isAsync = utils.isAsync();
|
|
58
|
+
if (exemptAsync && isAsync) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const tagName = /** @type {string} */ (utils.getPreferredTagName({
|
|
63
|
+
tagName: 'returns',
|
|
64
|
+
}));
|
|
65
|
+
if (!tagName) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const tags = utils.getTags(tagName);
|
|
70
|
+
|
|
71
|
+
if (tags.length === 0) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (tags.length > 1) {
|
|
76
|
+
report(`Found more than one @${tagName} declaration.`);
|
|
77
|
+
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const [
|
|
82
|
+
tag,
|
|
83
|
+
] = tags;
|
|
84
|
+
|
|
85
|
+
const type = tag.type.trim();
|
|
86
|
+
|
|
87
|
+
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions
|
|
88
|
+
if (/asserts\s/v.test(type)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const returnNever = type === 'never';
|
|
93
|
+
|
|
94
|
+
if (returnNever && utils.hasValueOrExecutorHasNonEmptyResolveValue(false)) {
|
|
95
|
+
report(`JSDoc @${tagName} declaration set with "never" but return expression is present in function.`);
|
|
96
|
+
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (noNativeTypes && isAsync && strictNativeTypes.includes(type)) {
|
|
101
|
+
report('Function is async or otherwise returns a Promise but the return type is a native type.');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// In case a return value is declared in JSDoc, we also expect one in the code.
|
|
106
|
+
if (
|
|
107
|
+
!returnNever &&
|
|
108
|
+
(
|
|
109
|
+
reportMissingReturnForUndefinedTypes ||
|
|
110
|
+
!utils.mayBeUndefinedTypeTag(tag)
|
|
111
|
+
) &&
|
|
112
|
+
(tag.type === '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(
|
|
113
|
+
exemptAsync,
|
|
114
|
+
) ||
|
|
115
|
+
tag.type !== '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(
|
|
116
|
+
exemptAsync,
|
|
117
|
+
true,
|
|
118
|
+
)) &&
|
|
119
|
+
Boolean(
|
|
120
|
+
!exemptGenerators || !node ||
|
|
121
|
+
!('generator' in /** @type {import('../iterateJsdoc.js').Node} */ (node)) ||
|
|
122
|
+
!(/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */ (node)).generator,
|
|
123
|
+
)
|
|
124
|
+
) {
|
|
125
|
+
report(`JSDoc @${tagName} declaration present but return expression not available in function.`);
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
meta: {
|
|
129
|
+
docs: {
|
|
130
|
+
description: 'Requires a return statement in function body if a `@returns` tag is specified in JSDoc comment(and reports if multiple `@returns` tags are present).',
|
|
131
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-check.md#repos-sticky-header',
|
|
132
|
+
},
|
|
133
|
+
schema: [
|
|
134
|
+
{
|
|
135
|
+
additionalProperties: false,
|
|
136
|
+
properties: {
|
|
137
|
+
exemptAsync: {
|
|
138
|
+
default: true,
|
|
139
|
+
description: `By default, functions which return a \`Promise\` that are not
|
|
140
|
+
detected as resolving with a non-\`undefined\` value and \`async\` functions
|
|
141
|
+
(even ones that do not explicitly return a value, as these are returning a
|
|
142
|
+
\`Promise\` implicitly) will be exempted from reporting by this rule.
|
|
143
|
+
If you wish to insist that only \`Promise\`'s which resolve to
|
|
144
|
+
non-\`undefined\` values or \`async\` functions with explicit \`return\`'s will
|
|
145
|
+
be exempted from reporting (i.e., that \`async\` functions can be reported
|
|
146
|
+
if they lack an explicit (non-\`undefined\`) \`return\` when a \`@returns\` is
|
|
147
|
+
present), you can set \`exemptAsync\` to \`false\` on the options object.`,
|
|
148
|
+
type: 'boolean',
|
|
149
|
+
},
|
|
150
|
+
exemptGenerators: {
|
|
151
|
+
description: `Because a generator might be labeled as having a
|
|
152
|
+
\`IterableIterator\` \`@returns\` value (along with an iterator type
|
|
153
|
+
corresponding to the type of any \`yield\` statements), projects might wish to
|
|
154
|
+
leverage \`@returns\` in generators even without a \`return\` statement. This
|
|
155
|
+
option is therefore \`true\` by default in \`typescript\` mode (in "jsdoc" mode,
|
|
156
|
+
one might be more likely to take advantage of \`@yields\`). Set it to \`false\`
|
|
157
|
+
if you wish for a missing \`return\` to be flagged regardless.`,
|
|
158
|
+
type: 'boolean',
|
|
159
|
+
},
|
|
160
|
+
noNativeTypes: {
|
|
161
|
+
description: `Whether to check that async functions do not
|
|
162
|
+
indicate they return non-native types. Defaults to \`true\`.`,
|
|
163
|
+
type: 'boolean',
|
|
164
|
+
},
|
|
165
|
+
reportMissingReturnForUndefinedTypes: {
|
|
166
|
+
default: false,
|
|
167
|
+
description: `If \`true\` and no return or
|
|
168
|
+
resolve value is found, this setting will even insist that reporting occur
|
|
169
|
+
with \`void\` or \`undefined\` (including as an indicated \`Promise\` type).
|
|
170
|
+
Unlike \`require-returns\`, with this option in the rule, one can
|
|
171
|
+
*discourage* the labeling of \`undefined\` types. Defaults to \`false\`.`,
|
|
172
|
+
type: 'boolean',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
type: 'object',
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
type: 'suggestion',
|
|
179
|
+
},
|
|
180
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
+
|
|
3
|
+
export default iterateJsdoc(({
|
|
4
|
+
report,
|
|
5
|
+
utils,
|
|
6
|
+
}) => {
|
|
7
|
+
utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {
|
|
8
|
+
const type = jsdocTag.type && jsdocTag.type.trim();
|
|
9
|
+
|
|
10
|
+
if ([
|
|
11
|
+
'Promise<undefined>', 'Promise<void>', 'undefined', 'void',
|
|
12
|
+
].includes(type)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!jsdocTag.description.trim()) {
|
|
17
|
+
report(`Missing JSDoc @${targetTagName} description.`, null, jsdocTag);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}, {
|
|
21
|
+
contextDefaults: true,
|
|
22
|
+
meta: {
|
|
23
|
+
docs: {
|
|
24
|
+
description: 'Requires that the `@returns` tag has a `description` value (not including `void`/`undefined` type returns).',
|
|
25
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-description.md#repos-sticky-header',
|
|
26
|
+
},
|
|
27
|
+
schema: [
|
|
28
|
+
{
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
properties: {
|
|
31
|
+
contexts: {
|
|
32
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
33
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
34
|
+
|
|
35
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
36
|
+
|
|
37
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
38
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
39
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
40
|
+
for finding function blocks not attached to a function declaration or
|
|
41
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
42
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
43
|
+
|
|
44
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
45
|
+
section of our Advanced docs for more on the expected format.`,
|
|
46
|
+
items: {
|
|
47
|
+
anyOf: [
|
|
48
|
+
{
|
|
49
|
+
type: 'string',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
additionalProperties: false,
|
|
53
|
+
properties: {
|
|
54
|
+
comment: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
},
|
|
57
|
+
context: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
type: 'object',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
type: 'array',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
type: 'object',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
type: 'suggestion',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import iterateJsdoc from '../iterateJsdoc.js';
|
|
2
|
+
|
|
3
|
+
export default iterateJsdoc(({
|
|
4
|
+
report,
|
|
5
|
+
utils,
|
|
6
|
+
}) => {
|
|
7
|
+
utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {
|
|
8
|
+
if (!jsdocTag.type) {
|
|
9
|
+
report(`Missing JSDoc @${targetTagName} type.`, null, jsdocTag);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}, {
|
|
13
|
+
contextDefaults: true,
|
|
14
|
+
meta: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: 'Requires that `@returns` tag has type value (in curly brackets).',
|
|
17
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-type.md#repos-sticky-header',
|
|
18
|
+
},
|
|
19
|
+
schema: [
|
|
20
|
+
{
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
properties: {
|
|
23
|
+
contexts: {
|
|
24
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
25
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
26
|
+
|
|
27
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
28
|
+
|
|
29
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
30
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
31
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
32
|
+
for finding function blocks not attached to a function declaration or
|
|
33
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
34
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
35
|
+
|
|
36
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
37
|
+
section of our Advanced docs for more on the expected format.`,
|
|
38
|
+
items: {
|
|
39
|
+
anyOf: [
|
|
40
|
+
{
|
|
41
|
+
type: 'string',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
additionalProperties: false,
|
|
45
|
+
properties: {
|
|
46
|
+
comment: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
},
|
|
49
|
+
context: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
type: 'object',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
type: 'array',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
type: 'object',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
type: 'suggestion',
|
|
64
|
+
},
|
|
65
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildForbidRuleDefinition,
|
|
3
|
+
} from '../buildForbidRuleDefinition.js';
|
|
4
|
+
|
|
5
|
+
export default buildForbidRuleDefinition({
|
|
6
|
+
description: 'Requires tags be present, optionally for specific contexts',
|
|
7
|
+
getContexts (context, report) {
|
|
8
|
+
// Transformed options to this option in `modifyContext`:
|
|
9
|
+
if (!context.options[0].contexts) {
|
|
10
|
+
report('Rule `require-tags` is missing a `tags` option.');
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
contexts,
|
|
16
|
+
} = context.options[0];
|
|
17
|
+
|
|
18
|
+
return contexts;
|
|
19
|
+
},
|
|
20
|
+
modifyContext (context) {
|
|
21
|
+
const tags = /** @type {(string|{tag: string, context: string})[]} */ (
|
|
22
|
+
context.options?.[0]?.tags
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const cntxts = tags?.map((tag) => {
|
|
26
|
+
const tagName = typeof tag === 'string' ? tag : tag.tag;
|
|
27
|
+
return {
|
|
28
|
+
comment: `JsdocBlock:not(*:has(JsdocTag[tag=${
|
|
29
|
+
tagName
|
|
30
|
+
}]))`,
|
|
31
|
+
context: typeof tag === 'string' ? 'any' : tag.context,
|
|
32
|
+
message: `Missing required tag "${tagName}"`,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Reproduce context object with our own `contexts`
|
|
37
|
+
const propertyDescriptors = Object.getOwnPropertyDescriptors(context);
|
|
38
|
+
return Object.create(
|
|
39
|
+
Object.getPrototypeOf(context),
|
|
40
|
+
{
|
|
41
|
+
...propertyDescriptors,
|
|
42
|
+
options: {
|
|
43
|
+
...propertyDescriptors.options,
|
|
44
|
+
value: [
|
|
45
|
+
{
|
|
46
|
+
contexts: cntxts,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
schema: [
|
|
54
|
+
{
|
|
55
|
+
additionalProperties: false,
|
|
56
|
+
properties: {
|
|
57
|
+
tags: {
|
|
58
|
+
description: `May be an array of either strings or objects with
|
|
59
|
+
a string \`tag\` property and \`context\` string property.`,
|
|
60
|
+
items: {
|
|
61
|
+
anyOf: [
|
|
62
|
+
{
|
|
63
|
+
type: 'string',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
properties: {
|
|
67
|
+
context: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
},
|
|
70
|
+
tag: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
type: 'object',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
type: 'array',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
type: 'object',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-tags.md#repos-sticky-header',
|
|
85
|
+
});
|