@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,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
|
|
8
|
+
var _jsdocUtils = require("../jsdocUtils.cjs");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/**
|
|
11
|
+
* @param {import('../iterateJsdoc.js').Utils} utils
|
|
12
|
+
* @param {import('../iterateJsdoc.js').Settings} settings
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
const canSkip = (utils, settings) => {
|
|
16
|
+
const voidingTags = [
|
|
17
|
+
// An abstract function is by definition incomplete
|
|
18
|
+
// so it is perfectly fine if a return is documented but
|
|
19
|
+
// not present within the function.
|
|
20
|
+
// A subclass may inherit the doc and implement the
|
|
21
|
+
// missing return.
|
|
22
|
+
'abstract', 'virtual',
|
|
23
|
+
// A constructor function returns `this` by default, so may be `@returns`
|
|
24
|
+
// tag indicating this but no explicit return
|
|
25
|
+
'class', 'constructor', 'interface'];
|
|
26
|
+
if (settings.mode === 'closure') {
|
|
27
|
+
// Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned
|
|
28
|
+
voidingTags.push('record');
|
|
29
|
+
}
|
|
30
|
+
return utils.hasATag(voidingTags) || utils.isConstructor() || utils.classHasTag('interface') || settings.mode === 'closure' && utils.classHasTag('record');
|
|
31
|
+
};
|
|
32
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
33
|
+
context,
|
|
34
|
+
node,
|
|
35
|
+
report,
|
|
36
|
+
settings,
|
|
37
|
+
utils
|
|
38
|
+
}) => {
|
|
39
|
+
const {
|
|
40
|
+
exemptAsync = true,
|
|
41
|
+
exemptGenerators = settings.mode === 'typescript',
|
|
42
|
+
noNativeTypes = true,
|
|
43
|
+
reportMissingReturnForUndefinedTypes = false
|
|
44
|
+
} = context.options[0] || {};
|
|
45
|
+
if (canSkip(utils, settings)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const isAsync = utils.isAsync();
|
|
49
|
+
if (exemptAsync && isAsync) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const tagName = /** @type {string} */utils.getPreferredTagName({
|
|
53
|
+
tagName: 'returns'
|
|
54
|
+
});
|
|
55
|
+
if (!tagName) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const tags = utils.getTags(tagName);
|
|
59
|
+
if (tags.length === 0) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (tags.length > 1) {
|
|
63
|
+
report(`Found more than one @${tagName} declaration.`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const [tag] = tags;
|
|
67
|
+
const type = tag.type.trim();
|
|
68
|
+
|
|
69
|
+
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions
|
|
70
|
+
if (/asserts\s/v.test(type)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const returnNever = type === 'never';
|
|
74
|
+
if (returnNever && utils.hasValueOrExecutorHasNonEmptyResolveValue(false)) {
|
|
75
|
+
report(`JSDoc @${tagName} declaration set with "never" but return expression is present in function.`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (noNativeTypes && isAsync && _jsdocUtils.strictNativeTypes.includes(type)) {
|
|
79
|
+
report('Function is async or otherwise returns a Promise but the return type is a native type.');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// In case a return value is declared in JSDoc, we also expect one in the code.
|
|
84
|
+
if (!returnNever && (reportMissingReturnForUndefinedTypes || !utils.mayBeUndefinedTypeTag(tag)) && (tag.type === '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(exemptAsync) || tag.type !== '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(exemptAsync, true)) && Boolean(!exemptGenerators || !node || !('generator' in (/** @type {import('../iterateJsdoc.js').Node} */node)) || !(/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */node).generator)) {
|
|
85
|
+
report(`JSDoc @${tagName} declaration present but return expression not available in function.`);
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
meta: {
|
|
89
|
+
docs: {
|
|
90
|
+
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).',
|
|
91
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-check.md#repos-sticky-header'
|
|
92
|
+
},
|
|
93
|
+
schema: [{
|
|
94
|
+
additionalProperties: false,
|
|
95
|
+
properties: {
|
|
96
|
+
exemptAsync: {
|
|
97
|
+
default: true,
|
|
98
|
+
description: `By default, functions which return a \`Promise\` that are not
|
|
99
|
+
detected as resolving with a non-\`undefined\` value and \`async\` functions
|
|
100
|
+
(even ones that do not explicitly return a value, as these are returning a
|
|
101
|
+
\`Promise\` implicitly) will be exempted from reporting by this rule.
|
|
102
|
+
If you wish to insist that only \`Promise\`'s which resolve to
|
|
103
|
+
non-\`undefined\` values or \`async\` functions with explicit \`return\`'s will
|
|
104
|
+
be exempted from reporting (i.e., that \`async\` functions can be reported
|
|
105
|
+
if they lack an explicit (non-\`undefined\`) \`return\` when a \`@returns\` is
|
|
106
|
+
present), you can set \`exemptAsync\` to \`false\` on the options object.`,
|
|
107
|
+
type: 'boolean'
|
|
108
|
+
},
|
|
109
|
+
exemptGenerators: {
|
|
110
|
+
description: `Because a generator might be labeled as having a
|
|
111
|
+
\`IterableIterator\` \`@returns\` value (along with an iterator type
|
|
112
|
+
corresponding to the type of any \`yield\` statements), projects might wish to
|
|
113
|
+
leverage \`@returns\` in generators even without a \`return\` statement. This
|
|
114
|
+
option is therefore \`true\` by default in \`typescript\` mode (in "jsdoc" mode,
|
|
115
|
+
one might be more likely to take advantage of \`@yields\`). Set it to \`false\`
|
|
116
|
+
if you wish for a missing \`return\` to be flagged regardless.`,
|
|
117
|
+
type: 'boolean'
|
|
118
|
+
},
|
|
119
|
+
noNativeTypes: {
|
|
120
|
+
description: `Whether to check that async functions do not
|
|
121
|
+
indicate they return non-native types. Defaults to \`true\`.`,
|
|
122
|
+
type: 'boolean'
|
|
123
|
+
},
|
|
124
|
+
reportMissingReturnForUndefinedTypes: {
|
|
125
|
+
default: false,
|
|
126
|
+
description: `If \`true\` and no return or
|
|
127
|
+
resolve value is found, this setting will even insist that reporting occur
|
|
128
|
+
with \`void\` or \`undefined\` (including as an indicated \`Promise\` type).
|
|
129
|
+
Unlike \`require-returns\`, with this option in the rule, one can
|
|
130
|
+
*discourage* the labeling of \`undefined\` types. Defaults to \`false\`.`,
|
|
131
|
+
type: 'boolean'
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
type: 'object'
|
|
135
|
+
}],
|
|
136
|
+
type: 'suggestion'
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
module.exports = exports.default;
|
|
140
|
+
//# sourceMappingURL=requireReturnsCheck.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireReturnsCheck.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdocUtils","e","__esModule","default","canSkip","utils","settings","voidingTags","mode","push","hasATag","isConstructor","classHasTag","_default","exports","iterateJsdoc","context","node","report","exemptAsync","exemptGenerators","noNativeTypes","reportMissingReturnForUndefinedTypes","options","isAsync","tagName","getPreferredTagName","tags","getTags","length","tag","type","trim","test","returnNever","hasValueOrExecutorHasNonEmptyResolveValue","strictNativeTypes","includes","mayBeUndefinedTypeTag","Boolean","generator","meta","docs","description","url","schema","additionalProperties","properties","module"],"sources":["../../src/rules/requireReturnsCheck.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n strictNativeTypes,\n} from '../jsdocUtils.js';\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {boolean}\n */\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a return is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing return.\n 'abstract',\n 'virtual',\n\n // A constructor function returns `this` by default, so may be `@returns`\n // tag indicating this but no explicit return\n 'class',\n 'constructor',\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n exemptAsync = true,\n exemptGenerators = settings.mode === 'typescript',\n noNativeTypes = true,\n reportMissingReturnForUndefinedTypes = false,\n } = context.options[0] || {};\n\n if (canSkip(utils, settings)) {\n return;\n }\n\n const isAsync = utils.isAsync();\n if (exemptAsync && isAsync) {\n return;\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'returns',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length === 0) {\n return;\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n\n return;\n }\n\n const [\n tag,\n ] = tags;\n\n const type = tag.type.trim();\n\n // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions\n if (/asserts\\s/v.test(type)) {\n return;\n }\n\n const returnNever = type === 'never';\n\n if (returnNever && utils.hasValueOrExecutorHasNonEmptyResolveValue(false)) {\n report(`JSDoc @${tagName} declaration set with \"never\" but return expression is present in function.`);\n\n return;\n }\n\n if (noNativeTypes && isAsync && strictNativeTypes.includes(type)) {\n report('Function is async or otherwise returns a Promise but the return type is a native type.');\n return;\n }\n\n // In case a return value is declared in JSDoc, we also expect one in the code.\n if (\n !returnNever &&\n (\n reportMissingReturnForUndefinedTypes ||\n !utils.mayBeUndefinedTypeTag(tag)\n ) &&\n (tag.type === '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(\n exemptAsync,\n ) ||\n tag.type !== '' && !utils.hasValueOrExecutorHasNonEmptyResolveValue(\n exemptAsync,\n true,\n )) &&\n Boolean(\n !exemptGenerators || !node ||\n !('generator' in /** @type {import('../iterateJsdoc.js').Node} */ (node)) ||\n !(/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */ (node)).generator,\n )\n ) {\n report(`JSDoc @${tagName} declaration present but return expression not available in function.`);\n }\n}, {\n meta: {\n docs: {\n 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).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-check.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptAsync: {\n default: true,\n description: `By default, functions which return a \\`Promise\\` that are not\ndetected as resolving with a non-\\`undefined\\` value and \\`async\\` functions\n(even ones that do not explicitly return a value, as these are returning a\n\\`Promise\\` implicitly) will be exempted from reporting by this rule.\nIf you wish to insist that only \\`Promise\\`'s which resolve to\nnon-\\`undefined\\` values or \\`async\\` functions with explicit \\`return\\`'s will\nbe exempted from reporting (i.e., that \\`async\\` functions can be reported\nif they lack an explicit (non-\\`undefined\\`) \\`return\\` when a \\`@returns\\` is\npresent), you can set \\`exemptAsync\\` to \\`false\\` on the options object.`,\n type: 'boolean',\n },\n exemptGenerators: {\n description: `Because a generator might be labeled as having a\n\\`IterableIterator\\` \\`@returns\\` value (along with an iterator type\ncorresponding to the type of any \\`yield\\` statements), projects might wish to\nleverage \\`@returns\\` in generators even without a \\`return\\` statement. This\noption is therefore \\`true\\` by default in \\`typescript\\` mode (in \"jsdoc\" mode,\none might be more likely to take advantage of \\`@yields\\`). Set it to \\`false\\`\nif you wish for a missing \\`return\\` to be flagged regardless.`,\n type: 'boolean',\n },\n noNativeTypes: {\n description: `Whether to check that async functions do not\nindicate they return non-native types. Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n reportMissingReturnForUndefinedTypes: {\n default: false,\n description: `If \\`true\\` and no return or\nresolve value is found, this setting will even insist that reporting occur\nwith \\`void\\` or \\`undefined\\` (including as an indicated \\`Promise\\` type).\nUnlike \\`require-returns\\`, with this option in the rule, one can\n*discourage* the labeling of \\`undefined\\` types. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
10
|
+
report,
|
|
11
|
+
utils
|
|
12
|
+
}) => {
|
|
13
|
+
utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {
|
|
14
|
+
const type = jsdocTag.type && jsdocTag.type.trim();
|
|
15
|
+
if (['Promise<undefined>', 'Promise<void>', 'undefined', 'void'].includes(type)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!jsdocTag.description.trim()) {
|
|
19
|
+
report(`Missing JSDoc @${targetTagName} description.`, null, jsdocTag);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}, {
|
|
23
|
+
contextDefaults: true,
|
|
24
|
+
meta: {
|
|
25
|
+
docs: {
|
|
26
|
+
description: 'Requires that the `@returns` tag has a `description` value (not including `void`/`undefined` type returns).',
|
|
27
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-description.md#repos-sticky-header'
|
|
28
|
+
},
|
|
29
|
+
schema: [{
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
properties: {
|
|
32
|
+
contexts: {
|
|
33
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
34
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
35
|
+
|
|
36
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
37
|
+
|
|
38
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
39
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
40
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
41
|
+
for finding function blocks not attached to a function declaration or
|
|
42
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
43
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
44
|
+
|
|
45
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
46
|
+
section of our Advanced docs for more on the expected format.`,
|
|
47
|
+
items: {
|
|
48
|
+
anyOf: [{
|
|
49
|
+
type: 'string'
|
|
50
|
+
}, {
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
properties: {
|
|
53
|
+
comment: {
|
|
54
|
+
type: 'string'
|
|
55
|
+
},
|
|
56
|
+
context: {
|
|
57
|
+
type: 'string'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
type: 'object'
|
|
61
|
+
}]
|
|
62
|
+
},
|
|
63
|
+
type: 'array'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
type: 'object'
|
|
67
|
+
}],
|
|
68
|
+
type: 'suggestion'
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
module.exports = exports.default;
|
|
72
|
+
//# sourceMappingURL=requireReturnsDescription.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireReturnsDescription.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","report","utils","forEachPreferredTag","jsdocTag","targetTagName","type","trim","includes","description","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","comment","context","module"],"sources":["../../src/rules/requireReturnsDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {\n const type = jsdocTag.type && jsdocTag.type.trim();\n\n if ([\n 'Promise<undefined>', 'Promise<void>', 'undefined', 'void',\n ].includes(type)) {\n return;\n }\n\n if (!jsdocTag.description.trim()) {\n report(`Missing JSDoc @${targetTagName} description.`, null, jsdocTag);\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that the `@returns` tag has a `description` value (not including `void`/`undefined` type returns).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\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":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,MAAM;EACNC;AACF,CAAC,KAAK;EACJA,KAAK,CAACC,mBAAmB,CAAC,SAAS,EAAE,CAACC,QAAQ,EAAEC,aAAa,KAAK;IAChE,MAAMC,IAAI,GAAGF,QAAQ,CAACE,IAAI,IAAIF,QAAQ,CAACE,IAAI,CAACC,IAAI,CAAC,CAAC;IAElD,IAAI,CACF,oBAAoB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,CAC3D,CAACC,QAAQ,CAACF,IAAI,CAAC,EAAE;MAChB;IACF;IAEA,IAAI,CAACF,QAAQ,CAACK,WAAW,CAACF,IAAI,CAAC,CAAC,EAAE;MAChCN,MAAM,CAAC,kBAAkBI,aAAa,eAAe,EAAE,IAAI,EAAED,QAAQ,CAAC;IACxE;EACF,CAAC,CAAC;AACJ,CAAC,EAAE;EACDM,eAAe,EAAE,IAAI;EACrBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJH,WAAW,EAAE,6GAA6G;MAC1HI,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,QAAQ,EAAE;UACRR,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClDS,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEb,IAAI,EAAE;YACR,CAAC,EACD;cACES,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVI,OAAO,EAAE;kBACPd,IAAI,EAAE;gBACR,CAAC;gBACDe,OAAO,EAAE;kBACPf,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAgB,MAAA,CAAAvB,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
10
|
+
report,
|
|
11
|
+
utils
|
|
12
|
+
}) => {
|
|
13
|
+
utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {
|
|
14
|
+
if (!jsdocTag.type) {
|
|
15
|
+
report(`Missing JSDoc @${targetTagName} type.`, null, jsdocTag);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}, {
|
|
19
|
+
contextDefaults: true,
|
|
20
|
+
meta: {
|
|
21
|
+
docs: {
|
|
22
|
+
description: 'Requires that `@returns` tag has type value (in curly brackets).',
|
|
23
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-type.md#repos-sticky-header'
|
|
24
|
+
},
|
|
25
|
+
schema: [{
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
properties: {
|
|
28
|
+
contexts: {
|
|
29
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
30
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
31
|
+
|
|
32
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
33
|
+
|
|
34
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
35
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
36
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
37
|
+
for finding function blocks not attached to a function declaration or
|
|
38
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
39
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
40
|
+
|
|
41
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
42
|
+
section of our Advanced docs for more on the expected format.`,
|
|
43
|
+
items: {
|
|
44
|
+
anyOf: [{
|
|
45
|
+
type: 'string'
|
|
46
|
+
}, {
|
|
47
|
+
additionalProperties: false,
|
|
48
|
+
properties: {
|
|
49
|
+
comment: {
|
|
50
|
+
type: 'string'
|
|
51
|
+
},
|
|
52
|
+
context: {
|
|
53
|
+
type: 'string'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
type: 'object'
|
|
57
|
+
}]
|
|
58
|
+
},
|
|
59
|
+
type: 'array'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
type: 'object'
|
|
63
|
+
}],
|
|
64
|
+
type: 'suggestion'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
module.exports = exports.default;
|
|
68
|
+
//# sourceMappingURL=requireReturnsType.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireReturnsType.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","report","utils","forEachPreferredTag","jsdocTag","targetTagName","type","contextDefaults","meta","docs","description","url","schema","additionalProperties","properties","contexts","items","anyOf","comment","context","module"],"sources":["../../src/rules/requireReturnsType.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {\n if (!jsdocTag.type) {\n report(`Missing JSDoc @${targetTagName} type.`, null, jsdocTag);\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that `@returns` tag has type value (in curly brackets).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-type.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\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":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,MAAM;EACNC;AACF,CAAC,KAAK;EACJA,KAAK,CAACC,mBAAmB,CAAC,SAAS,EAAE,CAACC,QAAQ,EAAEC,aAAa,KAAK;IAChE,IAAI,CAACD,QAAQ,CAACE,IAAI,EAAE;MAClBL,MAAM,CAAC,kBAAkBI,aAAa,QAAQ,EAAE,IAAI,EAAED,QAAQ,CAAC;IACjE;EACF,CAAC,CAAC;AACJ,CAAC,EAAE;EACDG,eAAe,EAAE,IAAI;EACrBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,kEAAkE;MAC/EC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,QAAQ,EAAE;UACRL,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClDM,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEX,IAAI,EAAE;YACR,CAAC,EACD;cACEO,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVI,OAAO,EAAE;kBACPZ,IAAI,EAAE;gBACR,CAAC;gBACDa,OAAO,EAAE;kBACPb,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAc,MAAA,CAAArB,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _buildForbidRuleDefinition = require("../buildForbidRuleDefinition.cjs");
|
|
8
|
+
var _default = exports.default = (0, _buildForbidRuleDefinition.buildForbidRuleDefinition)({
|
|
9
|
+
description: 'Requires tags be present, optionally for specific contexts',
|
|
10
|
+
getContexts(context, report) {
|
|
11
|
+
// Transformed options to this option in `modifyContext`:
|
|
12
|
+
if (!context.options[0].contexts) {
|
|
13
|
+
report('Rule `require-tags` is missing a `tags` option.');
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const {
|
|
17
|
+
contexts
|
|
18
|
+
} = context.options[0];
|
|
19
|
+
return contexts;
|
|
20
|
+
},
|
|
21
|
+
modifyContext(context) {
|
|
22
|
+
const tags = /** @type {(string|{tag: string, context: string})[]} */
|
|
23
|
+
context.options?.[0]?.tags;
|
|
24
|
+
const cntxts = tags?.map(tag => {
|
|
25
|
+
const tagName = typeof tag === 'string' ? tag : tag.tag;
|
|
26
|
+
return {
|
|
27
|
+
comment: `JsdocBlock:not(*:has(JsdocTag[tag=${tagName}]))`,
|
|
28
|
+
context: typeof tag === 'string' ? 'any' : tag.context,
|
|
29
|
+
message: `Missing required tag "${tagName}"`
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Reproduce context object with our own `contexts`
|
|
34
|
+
const propertyDescriptors = Object.getOwnPropertyDescriptors(context);
|
|
35
|
+
return Object.create(Object.getPrototypeOf(context), {
|
|
36
|
+
...propertyDescriptors,
|
|
37
|
+
options: {
|
|
38
|
+
...propertyDescriptors.options,
|
|
39
|
+
value: [{
|
|
40
|
+
contexts: cntxts
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
schema: [{
|
|
46
|
+
additionalProperties: false,
|
|
47
|
+
properties: {
|
|
48
|
+
tags: {
|
|
49
|
+
description: `May be an array of either strings or objects with
|
|
50
|
+
a string \`tag\` property and \`context\` string property.`,
|
|
51
|
+
items: {
|
|
52
|
+
anyOf: [{
|
|
53
|
+
type: 'string'
|
|
54
|
+
}, {
|
|
55
|
+
properties: {
|
|
56
|
+
context: {
|
|
57
|
+
type: 'string'
|
|
58
|
+
},
|
|
59
|
+
tag: {
|
|
60
|
+
type: 'string'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
type: 'object'
|
|
64
|
+
}]
|
|
65
|
+
},
|
|
66
|
+
type: 'array'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
type: 'object'
|
|
70
|
+
}],
|
|
71
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-tags.md#repos-sticky-header'
|
|
72
|
+
});
|
|
73
|
+
module.exports = exports.default;
|
|
74
|
+
//# sourceMappingURL=requireTags.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireTags.cjs","names":["_buildForbidRuleDefinition","require","_default","exports","default","buildForbidRuleDefinition","description","getContexts","context","report","options","contexts","modifyContext","tags","cntxts","map","tag","tagName","comment","message","propertyDescriptors","Object","getOwnPropertyDescriptors","create","getPrototypeOf","value","schema","additionalProperties","properties","items","anyOf","type","url","module"],"sources":["../../src/rules/requireTags.js"],"sourcesContent":["import {\n buildForbidRuleDefinition,\n} from '../buildForbidRuleDefinition.js';\n\nexport default buildForbidRuleDefinition({\n description: 'Requires tags be present, optionally for specific contexts',\n getContexts (context, report) {\n // Transformed options to this option in `modifyContext`:\n if (!context.options[0].contexts) {\n report('Rule `require-tags` is missing a `tags` option.');\n return false;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n return contexts;\n },\n modifyContext (context) {\n const tags = /** @type {(string|{tag: string, context: string})[]} */ (\n context.options?.[0]?.tags\n );\n\n const cntxts = tags?.map((tag) => {\n const tagName = typeof tag === 'string' ? tag : tag.tag;\n return {\n comment: `JsdocBlock:not(*:has(JsdocTag[tag=${\n tagName\n }]))`,\n context: typeof tag === 'string' ? 'any' : tag.context,\n message: `Missing required tag \"${tagName}\"`,\n };\n });\n\n // Reproduce context object with our own `contexts`\n const propertyDescriptors = Object.getOwnPropertyDescriptors(context);\n return Object.create(\n Object.getPrototypeOf(context),\n {\n ...propertyDescriptors,\n options: {\n ...propertyDescriptors.options,\n value: [\n {\n contexts: cntxts,\n },\n ],\n },\n },\n );\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n description: `May be an array of either strings or objects with\na string \\`tag\\` property and \\`context\\` string property.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n properties: {\n context: {\n type: 'string',\n },\n tag: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-tags.md#repos-sticky-header',\n});\n"],"mappings":";;;;;;AAAA,IAAAA,0BAAA,GAAAC,OAAA;AAEyC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE1B,IAAAC,oDAAyB,EAAC;EACvCC,WAAW,EAAE,4DAA4D;EACzEC,WAAWA,CAAEC,OAAO,EAAEC,MAAM,EAAE;IAC5B;IACA,IAAI,CAACD,OAAO,CAACE,OAAO,CAAC,CAAC,CAAC,CAACC,QAAQ,EAAE;MAChCF,MAAM,CAAC,iDAAiD,CAAC;MACzD,OAAO,KAAK;IACd;IAEA,MAAM;MACJE;IACF,CAAC,GAAGH,OAAO,CAACE,OAAO,CAAC,CAAC,CAAC;IAEtB,OAAOC,QAAQ;EACjB,CAAC;EACDC,aAAaA,CAAEJ,OAAO,EAAE;IACtB,MAAMK,IAAI,GAAG;IACXL,OAAO,CAACE,OAAO,GAAG,CAAC,CAAC,EAAEG,IACvB;IAED,MAAMC,MAAM,GAAGD,IAAI,EAAEE,GAAG,CAAEC,GAAG,IAAK;MAChC,MAAMC,OAAO,GAAG,OAAOD,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAGA,GAAG,CAACA,GAAG;MACvD,OAAO;QACLE,OAAO,EAAE,qCACPD,OAAO,KACJ;QACLT,OAAO,EAAE,OAAOQ,GAAG,KAAK,QAAQ,GAAG,KAAK,GAAGA,GAAG,CAACR,OAAO;QACtDW,OAAO,EAAE,yBAAyBF,OAAO;MAC3C,CAAC;IACH,CAAC,CAAC;;IAEF;IACA,MAAMG,mBAAmB,GAAGC,MAAM,CAACC,yBAAyB,CAACd,OAAO,CAAC;IACrE,OAAOa,MAAM,CAACE,MAAM,CAClBF,MAAM,CAACG,cAAc,CAAChB,OAAO,CAAC,EAC9B;MACE,GAAGY,mBAAmB;MACtBV,OAAO,EAAE;QACP,GAAGU,mBAAmB,CAACV,OAAO;QAC9Be,KAAK,EAAE,CACL;UACEd,QAAQ,EAAEG;QACZ,CAAC;MAEL;IACF,CACF,CAAC;EACH,CAAC;EACDY,MAAM,EAAE,CACN;IACEC,oBAAoB,EAAE,KAAK;IAC3BC,UAAU,EAAE;MACVf,IAAI,EAAE;QACJP,WAAW,EAAE;AACvB,2DAA2D;QACjDuB,KAAK,EAAE;UACLC,KAAK,EAAE,CACL;YACEC,IAAI,EAAE;UACR,CAAC,EACD;YACEH,UAAU,EAAE;cACVpB,OAAO,EAAE;gBACPuB,IAAI,EAAE;cACR,CAAC;cACDf,GAAG,EAAE;gBACHe,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACDA,IAAI,EAAE;MACR;IACF,CAAC;IACDA,IAAI,EAAE;EACR,CAAC,CACF;EACDC,GAAG,EAAE;AACP,CAAC,CAAC;AAAAC,MAAA,CAAA9B,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
|
|
8
|
+
var _jsdoccomment = require("@es-joy/jsdoccomment");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
11
|
+
context,
|
|
12
|
+
node,
|
|
13
|
+
report,
|
|
14
|
+
settings,
|
|
15
|
+
utils
|
|
16
|
+
}) => {
|
|
17
|
+
if (utils.avoidDocs()) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const {
|
|
21
|
+
requireSeparateTemplates = false
|
|
22
|
+
} = context.options[0] || {};
|
|
23
|
+
const {
|
|
24
|
+
mode
|
|
25
|
+
} = settings;
|
|
26
|
+
const usedNames = new Set();
|
|
27
|
+
const tgName = /** @type {string} */utils.getPreferredTagName({
|
|
28
|
+
tagName: 'template'
|
|
29
|
+
});
|
|
30
|
+
if (!tgName) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const templateTags = utils.getTags(tgName);
|
|
34
|
+
const templateNames = templateTags.flatMap(tag => {
|
|
35
|
+
return utils.parseClosureTemplateTag(tag);
|
|
36
|
+
});
|
|
37
|
+
if (requireSeparateTemplates) {
|
|
38
|
+
for (const tag of templateTags) {
|
|
39
|
+
const names = utils.parseClosureTemplateTag(tag);
|
|
40
|
+
if (names.length > 1) {
|
|
41
|
+
report(`Missing separate @${tgName} for ${names[1]}`, null, tag);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|
|
|
48
|
+
* import('@typescript-eslint/types').TSESTree.ClassDeclaration|
|
|
49
|
+
* import('@typescript-eslint/types').TSESTree.TSDeclareFunction|
|
|
50
|
+
* import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|
|
|
51
|
+
* import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration
|
|
52
|
+
*/
|
|
53
|
+
const checkTypeParams = aliasDeclaration => {
|
|
54
|
+
const {
|
|
55
|
+
params
|
|
56
|
+
/* c8 ignore next -- Guard */
|
|
57
|
+
} = aliasDeclaration.typeParameters ?? {
|
|
58
|
+
/* c8 ignore next -- Guard */
|
|
59
|
+
params: []
|
|
60
|
+
};
|
|
61
|
+
for (const {
|
|
62
|
+
name: {
|
|
63
|
+
name
|
|
64
|
+
}
|
|
65
|
+
} of params) {
|
|
66
|
+
usedNames.add(name);
|
|
67
|
+
}
|
|
68
|
+
for (const usedName of usedNames) {
|
|
69
|
+
if (!templateNames.includes(usedName)) {
|
|
70
|
+
report(`Missing @${tgName} ${usedName}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const handleTypes = () => {
|
|
75
|
+
const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */
|
|
76
|
+
node;
|
|
77
|
+
if (!nde) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
switch (nde.type) {
|
|
81
|
+
case 'ClassDeclaration':
|
|
82
|
+
case 'FunctionDeclaration':
|
|
83
|
+
case 'TSDeclareFunction':
|
|
84
|
+
case 'TSInterfaceDeclaration':
|
|
85
|
+
case 'TSTypeAliasDeclaration':
|
|
86
|
+
checkTypeParams(nde);
|
|
87
|
+
break;
|
|
88
|
+
case 'ExportDefaultDeclaration':
|
|
89
|
+
switch (nde.declaration?.type) {
|
|
90
|
+
case 'ClassDeclaration':
|
|
91
|
+
case 'FunctionDeclaration':
|
|
92
|
+
case 'TSInterfaceDeclaration':
|
|
93
|
+
checkTypeParams(nde.declaration);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
case 'ExportNamedDeclaration':
|
|
98
|
+
switch (nde.declaration?.type) {
|
|
99
|
+
case 'ClassDeclaration':
|
|
100
|
+
case 'FunctionDeclaration':
|
|
101
|
+
case 'TSDeclareFunction':
|
|
102
|
+
case 'TSInterfaceDeclaration':
|
|
103
|
+
case 'TSTypeAliasDeclaration':
|
|
104
|
+
checkTypeParams(nde.declaration);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const usedNameToTag = new Map();
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @param {import('comment-parser').Spec} potentialTag
|
|
114
|
+
*/
|
|
115
|
+
const checkForUsedTypes = potentialTag => {
|
|
116
|
+
let parsedType;
|
|
117
|
+
try {
|
|
118
|
+
parsedType = mode === 'permissive' ? (0, _jsdoccomment.tryParse)(/** @type {string} */potentialTag.type) : (0, _jsdoccomment.parse)(/** @type {string} */potentialTag.type, mode);
|
|
119
|
+
} catch {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
(0, _jsdoccomment.traverse)(parsedType, nde => {
|
|
123
|
+
if (nde.type === 'JsdocTypeTypeParameter') {
|
|
124
|
+
templateNames.push(nde.name.value);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (nde.type === 'JsdocTypeInfer') {
|
|
128
|
+
templateNames.push(nde.element.value);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const {
|
|
132
|
+
type,
|
|
133
|
+
value
|
|
134
|
+
} = /** @type {import('jsdoc-type-pratt-parser').NameResult} */nde;
|
|
135
|
+
if (type === 'JsdocTypeName' && /^[A-Z]$/v.test(value)) {
|
|
136
|
+
usedNames.add(value);
|
|
137
|
+
if (!usedNameToTag.has(value)) {
|
|
138
|
+
usedNameToTag.set(value, potentialTag);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @param {string[]} tagNames
|
|
146
|
+
*/
|
|
147
|
+
const checkTagsAndTemplates = tagNames => {
|
|
148
|
+
for (const tagName of tagNames) {
|
|
149
|
+
const preferredTagName = /** @type {string} */utils.getPreferredTagName({
|
|
150
|
+
tagName
|
|
151
|
+
});
|
|
152
|
+
const matchingTags = utils.getTags(preferredTagName);
|
|
153
|
+
for (const matchingTag of matchingTags) {
|
|
154
|
+
checkForUsedTypes(matchingTag);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Could check against whitelist/blacklist
|
|
159
|
+
for (const usedName of usedNames) {
|
|
160
|
+
if (!templateNames.includes(usedName)) {
|
|
161
|
+
report(`Missing @${tgName} ${usedName}`, null, usedNameToTag.get(usedName));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const callbackTags = utils.getTags('callback');
|
|
166
|
+
const functionTags = utils.getTags('function');
|
|
167
|
+
if (callbackTags.length || functionTags.length) {
|
|
168
|
+
checkTagsAndTemplates(['param', 'returns']);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const typedefTags = utils.getTags('typedef');
|
|
172
|
+
if (!typedefTags.length || typedefTags.length >= 2) {
|
|
173
|
+
handleTypes();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const potentialTypedef = typedefTags[0];
|
|
177
|
+
checkForUsedTypes(potentialTypedef);
|
|
178
|
+
checkTagsAndTemplates(['property']);
|
|
179
|
+
}, {
|
|
180
|
+
iterateAllJsdocs: true,
|
|
181
|
+
meta: {
|
|
182
|
+
docs: {
|
|
183
|
+
description: 'Requires `@template` tags be present when type parameters are used.',
|
|
184
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header'
|
|
185
|
+
},
|
|
186
|
+
schema: [{
|
|
187
|
+
additionalProperties: false,
|
|
188
|
+
properties: {
|
|
189
|
+
exemptedBy: {
|
|
190
|
+
description: `Array of tags (e.g., \`['type']\`) whose presence on the document
|
|
191
|
+
block avoids the need for a \`@template\`. Defaults to an array with
|
|
192
|
+
\`inheritdoc\`. If you set this array, it will overwrite the default,
|
|
193
|
+
so be sure to add back \`inheritdoc\` if you wish its presence to cause
|
|
194
|
+
exemption of the rule.`,
|
|
195
|
+
items: {
|
|
196
|
+
type: 'string'
|
|
197
|
+
},
|
|
198
|
+
type: 'array'
|
|
199
|
+
},
|
|
200
|
+
requireSeparateTemplates: {
|
|
201
|
+
description: `Requires that each template have its own separate line, i.e., preventing
|
|
202
|
+
templates of this format:
|
|
203
|
+
|
|
204
|
+
\`\`\`js
|
|
205
|
+
/**
|
|
206
|
+
* @template T, U, V
|
|
207
|
+
*/
|
|
208
|
+
\`\`\`
|
|
209
|
+
|
|
210
|
+
Defaults to \`false\`.`,
|
|
211
|
+
type: 'boolean'
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
type: 'object'
|
|
215
|
+
}],
|
|
216
|
+
type: 'suggestion'
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
module.exports = exports.default;
|
|
220
|
+
//# sourceMappingURL=requireTemplate.cjs.map
|