@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,321 @@
|
|
|
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 _escapeStringRegexp = _interopRequireDefault(require("escape-string-regexp"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const otherDescriptiveTags = new Set(['classdesc', 'deprecated', 'exception', 'file', 'fileoverview', 'overview',
|
|
11
|
+
// 'copyright' and 'see' might be good addition, but as the former may be
|
|
12
|
+
// sensitive text, and the latter may have just a link, they are not
|
|
13
|
+
// included by default
|
|
14
|
+
'summary', 'throws', 'todo', 'yield', 'yields']);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} text
|
|
18
|
+
* @returns {string[]}
|
|
19
|
+
*/
|
|
20
|
+
const extractParagraphs = text => {
|
|
21
|
+
return text.split(/(?<![;:])\n\n+/v);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} text
|
|
26
|
+
* @param {string|RegExp} abbreviationsRegex
|
|
27
|
+
* @returns {string[]}
|
|
28
|
+
*/
|
|
29
|
+
const extractSentences = (text, abbreviationsRegex) => {
|
|
30
|
+
const txt = text
|
|
31
|
+
// Remove all {} tags.
|
|
32
|
+
.replaceAll(/(?<!^)\{[\s\S]*?\}\s*/gv, '')
|
|
33
|
+
|
|
34
|
+
// Remove custom abbreviations
|
|
35
|
+
.replace(abbreviationsRegex, '');
|
|
36
|
+
const sentenceEndGrouping = /([.?!])(?:\s+|$)/gv;
|
|
37
|
+
const puncts = [...txt.matchAll(sentenceEndGrouping)].map(sentEnd => {
|
|
38
|
+
return sentEnd[0];
|
|
39
|
+
});
|
|
40
|
+
return txt.split(/[.?!](?:\s+|$)/v)
|
|
41
|
+
|
|
42
|
+
// Re-add the dot.
|
|
43
|
+
.map((sentence, idx) => {
|
|
44
|
+
return !puncts[idx] && /^\s*$/v.test(sentence) ? sentence : `${sentence}${puncts[idx] || ''}`;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {string} text
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
const isNewLinePrecededByAPeriod = text => {
|
|
53
|
+
/** @type {boolean} */
|
|
54
|
+
let lastLineEndsSentence;
|
|
55
|
+
const lines = text.split('\n');
|
|
56
|
+
return !lines.some(line => {
|
|
57
|
+
if (lastLineEndsSentence === false && /^[A-Z][a-z]/v.test(line)) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
lastLineEndsSentence = /[.:?!\|]$/v.test(line);
|
|
61
|
+
return false;
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {string} str
|
|
67
|
+
* @returns {boolean}
|
|
68
|
+
*/
|
|
69
|
+
const isCapitalized = str => {
|
|
70
|
+
return str[0] === str[0].toUpperCase();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {string} str
|
|
75
|
+
* @returns {boolean}
|
|
76
|
+
*/
|
|
77
|
+
const isTable = str => {
|
|
78
|
+
return str.charAt(0) === '|';
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @param {string} str
|
|
83
|
+
* @returns {string}
|
|
84
|
+
*/
|
|
85
|
+
const capitalize = str => {
|
|
86
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {string} description
|
|
91
|
+
* @param {import('../iterateJsdoc.js').Report} reportOrig
|
|
92
|
+
* @param {import('eslint').Rule.Node} jsdocNode
|
|
93
|
+
* @param {string|RegExp} abbreviationsRegex
|
|
94
|
+
* @param {import('eslint').SourceCode} sourceCode
|
|
95
|
+
* @param {import('comment-parser').Spec|{
|
|
96
|
+
* line: import('../iterateJsdoc.js').Integer
|
|
97
|
+
* }} tag
|
|
98
|
+
* @param {boolean} newlineBeforeCapsAssumesBadSentenceEnd
|
|
99
|
+
* @returns {boolean}
|
|
100
|
+
*/
|
|
101
|
+
const validateDescription = (description, reportOrig, jsdocNode, abbreviationsRegex, sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd) => {
|
|
102
|
+
if (!description || /^\n+$/v.test(description)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
const descriptionNoHeadings = description.replaceAll(/^\s*#[^\n]*(\n|$)/gmv, '');
|
|
106
|
+
const paragraphs = extractParagraphs(descriptionNoHeadings).filter(Boolean);
|
|
107
|
+
return paragraphs.some((paragraph, parIdx) => {
|
|
108
|
+
const sentences = extractSentences(paragraph, abbreviationsRegex);
|
|
109
|
+
const fix = /** @type {import('eslint').Rule.ReportFixer} */fixer => {
|
|
110
|
+
let text = sourceCode.getText(jsdocNode);
|
|
111
|
+
if (!/[.:?!]$/v.test(paragraph)) {
|
|
112
|
+
const line = paragraph.split('\n').findLast(Boolean);
|
|
113
|
+
text = text.replace(new RegExp(`${(0, _escapeStringRegexp.default)(/** @type {string} */
|
|
114
|
+
line)}$`, 'mv'), `${line}.`);
|
|
115
|
+
}
|
|
116
|
+
for (const sentence of sentences.filter(sentence_ => {
|
|
117
|
+
return !/^\s*$/v.test(sentence_) && !isCapitalized(sentence_) && !isTable(sentence_);
|
|
118
|
+
})) {
|
|
119
|
+
const beginning = sentence.split('\n')[0];
|
|
120
|
+
if ('tag' in tag && tag.tag) {
|
|
121
|
+
const reg = new RegExp(`(@${(0, _escapeStringRegexp.default)(tag.tag)}.*)${(0, _escapeStringRegexp.default)(beginning)}`, 'v');
|
|
122
|
+
text = text.replace(reg, (_$0, $1) => {
|
|
123
|
+
return $1 + capitalize(beginning);
|
|
124
|
+
});
|
|
125
|
+
} else {
|
|
126
|
+
text = text.replace(new RegExp('((?:[.?!]|\\*|\\})\\s*)' + (0, _escapeStringRegexp.default)(beginning), 'v'), '$1' + capitalize(beginning));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return fixer.replaceText(jsdocNode, text);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {string} msg
|
|
134
|
+
* @param {import('eslint').Rule.ReportFixer | null | undefined} fixer
|
|
135
|
+
* @param {{
|
|
136
|
+
* line?: number | undefined;
|
|
137
|
+
* column?: number | undefined;
|
|
138
|
+
* } | (import('comment-parser').Spec & {
|
|
139
|
+
* line?: number | undefined;
|
|
140
|
+
* column?: number | undefined;
|
|
141
|
+
* })} tagObj
|
|
142
|
+
* @returns {void}
|
|
143
|
+
*/
|
|
144
|
+
const report = (msg, fixer, tagObj) => {
|
|
145
|
+
if ('line' in tagObj) {
|
|
146
|
+
/**
|
|
147
|
+
* @type {{
|
|
148
|
+
* line: number;
|
|
149
|
+
* }}
|
|
150
|
+
*/
|
|
151
|
+
tagObj.line += parIdx * 2;
|
|
152
|
+
} else {
|
|
153
|
+
/** @type {import('comment-parser').Spec} */tagObj.source[0].number += parIdx * 2;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Avoid errors if old column doesn't exist here
|
|
157
|
+
tagObj.column = 0;
|
|
158
|
+
reportOrig(msg, fixer, tagObj);
|
|
159
|
+
};
|
|
160
|
+
if (sentences.some(sentence => {
|
|
161
|
+
return /^[.?!]$/v.test(sentence);
|
|
162
|
+
})) {
|
|
163
|
+
report('Sentences must be more than punctuation.', null, tag);
|
|
164
|
+
}
|
|
165
|
+
if (sentences.some(sentence => {
|
|
166
|
+
return !/^\s*$/v.test(sentence) && !isCapitalized(sentence) && !isTable(sentence);
|
|
167
|
+
})) {
|
|
168
|
+
report('Sentences should start with an uppercase character.', fix, tag);
|
|
169
|
+
}
|
|
170
|
+
const paragraphNoAbbreviations = paragraph.replace(abbreviationsRegex, '');
|
|
171
|
+
if (!/(?:[.?!\|]|```)\s*$/v.test(paragraphNoAbbreviations)) {
|
|
172
|
+
report('Sentences must end with a period.', fix, tag);
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
if (newlineBeforeCapsAssumesBadSentenceEnd && !isNewLinePrecededByAPeriod(paragraphNoAbbreviations)) {
|
|
176
|
+
report('A line of text is started with an uppercase character, but the preceding line does not end the sentence.', null, tag);
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
183
|
+
context,
|
|
184
|
+
jsdoc,
|
|
185
|
+
jsdocNode,
|
|
186
|
+
report,
|
|
187
|
+
sourceCode,
|
|
188
|
+
utils
|
|
189
|
+
}) => {
|
|
190
|
+
const /** @type {{abbreviations: string[], newlineBeforeCapsAssumesBadSentenceEnd: boolean}} */{
|
|
191
|
+
abbreviations = [],
|
|
192
|
+
newlineBeforeCapsAssumesBadSentenceEnd = false
|
|
193
|
+
} = context.options[0] || {};
|
|
194
|
+
|
|
195
|
+
// `@inheritDoc` can be used as inline tag with TSDoc/typedoc: https://typedoc.org/documents/Tags.__inheritDoc_.html
|
|
196
|
+
if (utils.getInlineTags().some(({
|
|
197
|
+
tag
|
|
198
|
+
}) => {
|
|
199
|
+
return [
|
|
200
|
+
// Typdoc
|
|
201
|
+
'include', 'includeCode',
|
|
202
|
+
// TSDoc
|
|
203
|
+
'inheritDoc', 'inheritdoc', 'label'].includes(tag);
|
|
204
|
+
})) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const abbreviationsRegex = abbreviations.length ? new RegExp('\\b' + abbreviations.map(abbreviation => {
|
|
208
|
+
return (0, _escapeStringRegexp.default)(abbreviation.replaceAll(/\.$/gv, '') + '.');
|
|
209
|
+
}).join('|') + '(?:$|\\s)', 'gv') : '';
|
|
210
|
+
let {
|
|
211
|
+
description
|
|
212
|
+
} = utils.getDescription();
|
|
213
|
+
const indices = [...description.matchAll(/```[\s\S]*```/gv)].map(match => {
|
|
214
|
+
const {
|
|
215
|
+
index
|
|
216
|
+
} = match;
|
|
217
|
+
const [{
|
|
218
|
+
length
|
|
219
|
+
}] = match;
|
|
220
|
+
return {
|
|
221
|
+
index,
|
|
222
|
+
length
|
|
223
|
+
};
|
|
224
|
+
}).toReversed();
|
|
225
|
+
for (const {
|
|
226
|
+
index,
|
|
227
|
+
length
|
|
228
|
+
} of indices) {
|
|
229
|
+
description = description.slice(0, index) + description.slice(/** @type {import('../iterateJsdoc.js').Integer} */index + length);
|
|
230
|
+
}
|
|
231
|
+
if (validateDescription(description, report, jsdocNode, abbreviationsRegex, sourceCode, {
|
|
232
|
+
line: jsdoc.source[0].number + 1
|
|
233
|
+
}, newlineBeforeCapsAssumesBadSentenceEnd)) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
utils.forEachPreferredTag('description', matchingJsdocTag => {
|
|
237
|
+
const desc = `${matchingJsdocTag.name} ${utils.getTagDescription(matchingJsdocTag)}`.trim();
|
|
238
|
+
validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, matchingJsdocTag, newlineBeforeCapsAssumesBadSentenceEnd);
|
|
239
|
+
}, true);
|
|
240
|
+
const {
|
|
241
|
+
tagsWithNames
|
|
242
|
+
} = utils.getTagsByType(jsdoc.tags);
|
|
243
|
+
const tagsWithoutNames = utils.filterTags(({
|
|
244
|
+
tag: tagName
|
|
245
|
+
}) => {
|
|
246
|
+
return otherDescriptiveTags.has(tagName) || utils.hasOptionTag(tagName) && !tagsWithNames.some(({
|
|
247
|
+
tag
|
|
248
|
+
}) => {
|
|
249
|
+
// If user accidentally adds tags with names (or like `returns`
|
|
250
|
+
// get parsed as having names), do not add to this list
|
|
251
|
+
return tag === tagName;
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
tagsWithNames.some(tag => {
|
|
255
|
+
const desc = /** @type {string} */utils.getTagDescription(tag).replace(/^- /v, '').trimEnd();
|
|
256
|
+
return validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd);
|
|
257
|
+
});
|
|
258
|
+
tagsWithoutNames.some(tag => {
|
|
259
|
+
const desc = `${tag.name} ${utils.getTagDescription(tag)}`.trim();
|
|
260
|
+
return validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd);
|
|
261
|
+
});
|
|
262
|
+
}, {
|
|
263
|
+
iterateAllJsdocs: true,
|
|
264
|
+
meta: {
|
|
265
|
+
docs: {
|
|
266
|
+
description: 'Requires that block description, explicit `@description`, and `@param`/`@returns` tag descriptions are written in complete sentences.',
|
|
267
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-description-complete-sentence.md#repos-sticky-header'
|
|
268
|
+
},
|
|
269
|
+
fixable: 'code',
|
|
270
|
+
schema: [{
|
|
271
|
+
additionalProperties: false,
|
|
272
|
+
properties: {
|
|
273
|
+
abbreviations: {
|
|
274
|
+
description: `You can provide an \`abbreviations\` options array to avoid such strings of text
|
|
275
|
+
being treated as sentence endings when followed by dots. The \`.\` is not
|
|
276
|
+
necessary at the end of the array items.`,
|
|
277
|
+
items: {
|
|
278
|
+
type: 'string'
|
|
279
|
+
},
|
|
280
|
+
type: 'array'
|
|
281
|
+
},
|
|
282
|
+
newlineBeforeCapsAssumesBadSentenceEnd: {
|
|
283
|
+
description: `When \`false\` (the new default), we will not assume capital letters after
|
|
284
|
+
newlines are an incorrect way to end the sentence (they may be proper
|
|
285
|
+
nouns, for example).`,
|
|
286
|
+
type: 'boolean'
|
|
287
|
+
},
|
|
288
|
+
tags: {
|
|
289
|
+
description: `If you want additional tags to be checked for their descriptions, you may
|
|
290
|
+
add them within this option.
|
|
291
|
+
|
|
292
|
+
\`\`\`js
|
|
293
|
+
{
|
|
294
|
+
'jsdoc/require-description-complete-sentence': ['error', {
|
|
295
|
+
tags: ['see', 'copyright']
|
|
296
|
+
}]
|
|
297
|
+
}
|
|
298
|
+
\`\`\`
|
|
299
|
+
|
|
300
|
+
The tags \`@param\`/\`@arg\`/\`@argument\` and \`@property\`/\`@prop\` will be properly
|
|
301
|
+
parsed to ensure that the checked "description" text includes only the text
|
|
302
|
+
after the name.
|
|
303
|
+
|
|
304
|
+
All other tags will treat the text following the tag name, a space, and
|
|
305
|
+
an optional curly-bracketed type expression (and another space) as part of
|
|
306
|
+
its "description" (e.g., for \`@returns {someType} some description\`, the
|
|
307
|
+
description is \`some description\` while for \`@some-tag xyz\`, the description
|
|
308
|
+
is \`xyz\`).`,
|
|
309
|
+
items: {
|
|
310
|
+
type: 'string'
|
|
311
|
+
},
|
|
312
|
+
type: 'array'
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
type: 'object'
|
|
316
|
+
}],
|
|
317
|
+
type: 'suggestion'
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
module.exports = exports.default;
|
|
321
|
+
//# sourceMappingURL=requireDescriptionCompleteSentence.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireDescriptionCompleteSentence.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_escapeStringRegexp","e","__esModule","default","otherDescriptiveTags","Set","extractParagraphs","text","split","extractSentences","abbreviationsRegex","txt","replaceAll","replace","sentenceEndGrouping","puncts","matchAll","map","sentEnd","sentence","idx","test","isNewLinePrecededByAPeriod","lastLineEndsSentence","lines","some","line","isCapitalized","str","toUpperCase","isTable","charAt","capitalize","slice","validateDescription","description","reportOrig","jsdocNode","sourceCode","tag","newlineBeforeCapsAssumesBadSentenceEnd","descriptionNoHeadings","paragraphs","filter","Boolean","paragraph","parIdx","sentences","fix","fixer","getText","findLast","RegExp","escapeStringRegexp","sentence_","beginning","reg","_$0","$1","replaceText","report","msg","tagObj","source","number","column","paragraphNoAbbreviations","_default","exports","iterateJsdoc","context","jsdoc","utils","abbreviations","options","getInlineTags","includes","length","abbreviation","join","getDescription","indices","match","index","toReversed","forEachPreferredTag","matchingJsdocTag","desc","name","getTagDescription","trim","tagsWithNames","getTagsByType","tags","tagsWithoutNames","filterTags","tagName","has","hasOptionTag","trimEnd","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","items","type","module"],"sources":["../../src/rules/requireDescriptionCompleteSentence.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport escapeStringRegexp from 'escape-string-regexp';\n\nconst otherDescriptiveTags = new Set([\n 'classdesc', 'deprecated', 'exception', 'file', 'fileoverview', 'overview',\n // 'copyright' and 'see' might be good addition, but as the former may be\n // sensitive text, and the latter may have just a link, they are not\n // included by default\n 'summary', 'throws', 'todo', 'yield', 'yields',\n]);\n\n/**\n * @param {string} text\n * @returns {string[]}\n */\nconst extractParagraphs = (text) => {\n return text.split(/(?<![;:])\\n\\n+/v);\n};\n\n/**\n * @param {string} text\n * @param {string|RegExp} abbreviationsRegex\n * @returns {string[]}\n */\nconst extractSentences = (text, abbreviationsRegex) => {\n const txt = text\n // Remove all {} tags.\n .replaceAll(/(?<!^)\\{[\\s\\S]*?\\}\\s*/gv, '')\n\n // Remove custom abbreviations\n .replace(abbreviationsRegex, '');\n\n const sentenceEndGrouping = /([.?!])(?:\\s+|$)/gv;\n\n const puncts = [\n ...txt.matchAll(sentenceEndGrouping),\n ].map((sentEnd) => {\n return sentEnd[0];\n });\n\n return txt\n .split(/[.?!](?:\\s+|$)/v)\n\n // Re-add the dot.\n .map((sentence, idx) => {\n return !puncts[idx] && /^\\s*$/v.test(sentence) ? sentence : `${sentence}${puncts[idx] || ''}`;\n });\n};\n\n/**\n * @param {string} text\n * @returns {boolean}\n */\nconst isNewLinePrecededByAPeriod = (text) => {\n /** @type {boolean} */\n let lastLineEndsSentence;\n\n const lines = text.split('\\n');\n\n return !lines.some((line) => {\n if (lastLineEndsSentence === false && /^[A-Z][a-z]/v.test(line)) {\n return true;\n }\n\n lastLineEndsSentence = /[.:?!\\|]$/v.test(line);\n\n return false;\n });\n};\n\n/**\n * @param {string} str\n * @returns {boolean}\n */\nconst isCapitalized = (str) => {\n return str[0] === str[0].toUpperCase();\n};\n\n/**\n * @param {string} str\n * @returns {boolean}\n */\nconst isTable = (str) => {\n return str.charAt(0) === '|';\n};\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst capitalize = (str) => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n};\n\n/**\n * @param {string} description\n * @param {import('../iterateJsdoc.js').Report} reportOrig\n * @param {import('eslint').Rule.Node} jsdocNode\n * @param {string|RegExp} abbreviationsRegex\n * @param {import('eslint').SourceCode} sourceCode\n * @param {import('comment-parser').Spec|{\n * line: import('../iterateJsdoc.js').Integer\n * }} tag\n * @param {boolean} newlineBeforeCapsAssumesBadSentenceEnd\n * @returns {boolean}\n */\nconst validateDescription = (\n description, reportOrig, jsdocNode, abbreviationsRegex,\n sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd,\n) => {\n if (!description || (/^\\n+$/v).test(description)) {\n return false;\n }\n\n const descriptionNoHeadings = description.replaceAll(/^\\s*#[^\\n]*(\\n|$)/gmv, '');\n\n const paragraphs = extractParagraphs(descriptionNoHeadings).filter(Boolean);\n\n return paragraphs.some((paragraph, parIdx) => {\n const sentences = extractSentences(paragraph, abbreviationsRegex);\n\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n let text = sourceCode.getText(jsdocNode);\n\n if (!/[.:?!]$/v.test(paragraph)) {\n const line = paragraph.split('\\n').findLast(Boolean);\n text = text.replace(new RegExp(`${escapeStringRegexp(\n /** @type {string} */\n (line),\n )}$`, 'mv'), `${line}.`);\n }\n\n for (const sentence of sentences.filter((sentence_) => {\n return !(/^\\s*$/v).test(sentence_) && !isCapitalized(sentence_) &&\n !isTable(sentence_);\n })) {\n const beginning = sentence.split('\\n')[0];\n\n if ('tag' in tag && tag.tag) {\n const reg = new RegExp(`(@${escapeStringRegexp(tag.tag)}.*)${escapeStringRegexp(beginning)}`, 'v');\n\n text = text.replace(reg, (_$0, $1) => {\n return $1 + capitalize(beginning);\n });\n } else {\n text = text.replace(new RegExp('((?:[.?!]|\\\\*|\\\\})\\\\s*)' + escapeStringRegexp(beginning), 'v'), '$1' + capitalize(beginning));\n }\n }\n\n return fixer.replaceText(jsdocNode, text);\n };\n\n /**\n * @param {string} msg\n * @param {import('eslint').Rule.ReportFixer | null | undefined} fixer\n * @param {{\n * line?: number | undefined;\n * column?: number | undefined;\n * } | (import('comment-parser').Spec & {\n * line?: number | undefined;\n * column?: number | undefined;\n * })} tagObj\n * @returns {void}\n */\n const report = (msg, fixer, tagObj) => {\n if ('line' in tagObj) {\n /**\n * @type {{\n * line: number;\n * }}\n */ (tagObj).line += parIdx * 2;\n } else {\n /** @type {import('comment-parser').Spec} */ (\n tagObj\n ).source[0].number += parIdx * 2;\n }\n\n // Avoid errors if old column doesn't exist here\n tagObj.column = 0;\n reportOrig(msg, fixer, tagObj);\n };\n\n if (sentences.some((sentence) => {\n return (/^[.?!]$/v).test(sentence);\n })) {\n report('Sentences must be more than punctuation.', null, tag);\n }\n\n if (sentences.some((sentence) => {\n return !(/^\\s*$/v).test(sentence) && !isCapitalized(sentence) && !isTable(sentence);\n })) {\n report('Sentences should start with an uppercase character.', fix, tag);\n }\n\n const paragraphNoAbbreviations = paragraph.replace(abbreviationsRegex, '');\n\n if (!/(?:[.?!\\|]|```)\\s*$/v.test(paragraphNoAbbreviations)) {\n report('Sentences must end with a period.', fix, tag);\n return true;\n }\n\n if (newlineBeforeCapsAssumesBadSentenceEnd && !isNewLinePrecededByAPeriod(paragraphNoAbbreviations)) {\n report('A line of text is started with an uppercase character, but the preceding line does not end the sentence.', null, tag);\n\n return true;\n }\n\n return false;\n });\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n jsdocNode,\n report,\n sourceCode,\n utils,\n}) => {\n const /** @type {{abbreviations: string[], newlineBeforeCapsAssumesBadSentenceEnd: boolean}} */ {\n abbreviations = [],\n newlineBeforeCapsAssumesBadSentenceEnd = false,\n } = context.options[0] || {};\n\n // `@inheritDoc` can be used as inline tag with TSDoc/typedoc: https://typedoc.org/documents/Tags.__inheritDoc_.html\n if (utils.getInlineTags().some(({\n tag,\n }) => {\n return [\n // Typdoc\n 'include', 'includeCode',\n // TSDoc\n 'inheritDoc', 'inheritdoc',\n 'label',\n ].includes(tag);\n })) {\n return;\n }\n\n const abbreviationsRegex = abbreviations.length ?\n new RegExp('\\\\b' + abbreviations.map((abbreviation) => {\n return escapeStringRegexp(abbreviation.replaceAll(/\\.$/gv, '') + '.');\n }).join('|') + '(?:$|\\\\s)', 'gv') :\n '';\n\n let {\n description,\n } = utils.getDescription();\n\n const indices = [\n ...description.matchAll(/```[\\s\\S]*```/gv),\n ].map((match) => {\n const {\n index,\n } = match;\n const [\n {\n length,\n },\n ] = match;\n return {\n index,\n length,\n };\n }).toReversed();\n\n for (const {\n index,\n length,\n } of indices) {\n description = description.slice(0, index) +\n description.slice(/** @type {import('../iterateJsdoc.js').Integer} */ (\n index\n ) + length);\n }\n\n if (validateDescription(description, report, jsdocNode, abbreviationsRegex, sourceCode, {\n line: jsdoc.source[0].number + 1,\n }, newlineBeforeCapsAssumesBadSentenceEnd)) {\n return;\n }\n\n utils.forEachPreferredTag('description', (matchingJsdocTag) => {\n const desc = `${matchingJsdocTag.name} ${utils.getTagDescription(matchingJsdocTag)}`.trim();\n validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, matchingJsdocTag, newlineBeforeCapsAssumesBadSentenceEnd);\n }, true);\n\n const {\n tagsWithNames,\n } = utils.getTagsByType(jsdoc.tags);\n const tagsWithoutNames = utils.filterTags(({\n tag: tagName,\n }) => {\n return otherDescriptiveTags.has(tagName) ||\n utils.hasOptionTag(tagName) && !tagsWithNames.some(({\n tag,\n }) => {\n // If user accidentally adds tags with names (or like `returns`\n // get parsed as having names), do not add to this list\n return tag === tagName;\n });\n });\n\n tagsWithNames.some((tag) => {\n const desc = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(/^- /v, '').trimEnd();\n\n return validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd);\n });\n\n tagsWithoutNames.some((tag) => {\n const desc = `${tag.name} ${utils.getTagDescription(tag)}`.trim();\n\n return validateDescription(desc, report, jsdocNode, abbreviationsRegex, sourceCode, tag, newlineBeforeCapsAssumesBadSentenceEnd);\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires that block description, explicit `@description`, and `@param`/`@returns` tag descriptions are written in complete sentences.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-description-complete-sentence.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n abbreviations: {\n description: `You can provide an \\`abbreviations\\` options array to avoid such strings of text\nbeing treated as sentence endings when followed by dots. The \\`.\\` is not\nnecessary at the end of the array items.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n newlineBeforeCapsAssumesBadSentenceEnd: {\n description: `When \\`false\\` (the new default), we will not assume capital letters after\nnewlines are an incorrect way to end the sentence (they may be proper\nnouns, for example).`,\n type: 'boolean',\n },\n tags: {\n description: `If you want additional tags to be checked for their descriptions, you may\nadd them within this option.\n\n\\`\\`\\`js\n{\n 'jsdoc/require-description-complete-sentence': ['error', {\n tags: ['see', 'copyright']\n }]\n}\n\\`\\`\\`\n\nThe tags \\`@param\\`/\\`@arg\\`/\\`@argument\\` and \\`@property\\`/\\`@prop\\` will be properly\nparsed to ensure that the checked \"description\" text includes only the text\nafter the name.\n\nAll other tags will treat the text following the tag name, a space, and\nan optional curly-bracketed type expression (and another space) as part of\nits \"description\" (e.g., for \\`@returns {someType} some description\\`, the\ndescription is \\`some description\\` while for \\`@some-tag xyz\\`, the description\nis \\`xyz\\`).`,\n items: {\n type: 'string',\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;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAsD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD,MAAMG,oBAAoB,GAAG,IAAIC,GAAG,CAAC,CACnC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU;AAC1E;AACA;AACA;AACA,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAC/C,CAAC;;AAEF;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAIC,IAAI,IAAK;EAClC,OAAOA,IAAI,CAACC,KAAK,CAAC,iBAAiB,CAAC;AACtC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAACF,IAAI,EAAEG,kBAAkB,KAAK;EACrD,MAAMC,GAAG,GAAGJ;EACV;EAAA,CACCK,UAAU,CAAC,yBAAyB,EAAE,EAAE;;EAEzC;EAAA,CACCC,OAAO,CAACH,kBAAkB,EAAE,EAAE,CAAC;EAElC,MAAMI,mBAAmB,GAAG,oBAAoB;EAEhD,MAAMC,MAAM,GAAG,CACb,GAAGJ,GAAG,CAACK,QAAQ,CAACF,mBAAmB,CAAC,CACrC,CAACG,GAAG,CAAEC,OAAO,IAAK;IACjB,OAAOA,OAAO,CAAC,CA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AAC;AAAAC,MAAA,CAAA1C,OAAA,GAAAA,OAAA,CAAAjE,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
context,
|
|
11
|
+
jsdoc,
|
|
12
|
+
report,
|
|
13
|
+
utils
|
|
14
|
+
}) => {
|
|
15
|
+
if (utils.avoidDocs()) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const {
|
|
19
|
+
enableFixer = true,
|
|
20
|
+
exemptNoArguments = false
|
|
21
|
+
} = context.options[0] || {};
|
|
22
|
+
const targetTagName = 'example';
|
|
23
|
+
const functionExamples = jsdoc.tags.filter(({
|
|
24
|
+
tag
|
|
25
|
+
}) => {
|
|
26
|
+
return tag === targetTagName;
|
|
27
|
+
});
|
|
28
|
+
if (!functionExamples.length) {
|
|
29
|
+
if (exemptNoArguments && utils.isIteratingFunctionOrVariable() && !utils.hasParams()) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
utils.reportJSDoc(`Missing JSDoc @${targetTagName} declaration.`, null, () => {
|
|
33
|
+
if (enableFixer) {
|
|
34
|
+
utils.addTag(targetTagName);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
for (const example of functionExamples) {
|
|
40
|
+
const exampleContent = `${example.name} ${utils.getTagDescription(example)}`.trim().split('\n').filter(Boolean);
|
|
41
|
+
if (!exampleContent.length) {
|
|
42
|
+
report(`Missing JSDoc @${targetTagName} description.`, null, example);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
contextDefaults: true,
|
|
47
|
+
meta: {
|
|
48
|
+
docs: {
|
|
49
|
+
description: 'Requires that all functions (and potentially other contexts) have examples.',
|
|
50
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-example.md#repos-sticky-header'
|
|
51
|
+
},
|
|
52
|
+
fixable: 'code',
|
|
53
|
+
schema: [{
|
|
54
|
+
additionalProperties: false,
|
|
55
|
+
properties: {
|
|
56
|
+
checkConstructors: {
|
|
57
|
+
default: true,
|
|
58
|
+
description: `A value indicating whether \`constructor\`s should be checked.
|
|
59
|
+
Defaults to \`true\`.`,
|
|
60
|
+
type: 'boolean'
|
|
61
|
+
},
|
|
62
|
+
checkGetters: {
|
|
63
|
+
default: false,
|
|
64
|
+
description: 'A value indicating whether getters should be checked. Defaults to `false`.',
|
|
65
|
+
type: 'boolean'
|
|
66
|
+
},
|
|
67
|
+
checkSetters: {
|
|
68
|
+
default: false,
|
|
69
|
+
description: 'A value indicating whether setters should be checked. Defaults to `false`.',
|
|
70
|
+
type: 'boolean'
|
|
71
|
+
},
|
|
72
|
+
contexts: {
|
|
73
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
74
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
75
|
+
(e.g., \`ClassDeclaration\` for ES6 classes).
|
|
76
|
+
|
|
77
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
78
|
+
|
|
79
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
80
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want the rule to apply to any
|
|
81
|
+
JSDoc block throughout your files.
|
|
82
|
+
|
|
83
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
84
|
+
section of our Advanced docs for more on the expected format.`,
|
|
85
|
+
items: {
|
|
86
|
+
anyOf: [{
|
|
87
|
+
type: 'string'
|
|
88
|
+
}, {
|
|
89
|
+
additionalProperties: false,
|
|
90
|
+
properties: {
|
|
91
|
+
comment: {
|
|
92
|
+
type: 'string'
|
|
93
|
+
},
|
|
94
|
+
context: {
|
|
95
|
+
type: 'string'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
type: 'object'
|
|
99
|
+
}]
|
|
100
|
+
},
|
|
101
|
+
type: 'array'
|
|
102
|
+
},
|
|
103
|
+
enableFixer: {
|
|
104
|
+
default: true,
|
|
105
|
+
description: `A boolean on whether to enable the fixer (which adds an empty \`@example\` block).
|
|
106
|
+
Defaults to \`true\`.`,
|
|
107
|
+
type: 'boolean'
|
|
108
|
+
},
|
|
109
|
+
exemptedBy: {
|
|
110
|
+
description: `Array of tags (e.g., \`['type']\`) whose presence on the document
|
|
111
|
+
block avoids the need for an \`@example\`. Defaults to an array with
|
|
112
|
+
\`inheritdoc\`. If you set this array, it will overwrite the default,
|
|
113
|
+
so be sure to add back \`inheritdoc\` if you wish its presence to cause
|
|
114
|
+
exemption of the rule.`,
|
|
115
|
+
items: {
|
|
116
|
+
type: 'string'
|
|
117
|
+
},
|
|
118
|
+
type: 'array'
|
|
119
|
+
},
|
|
120
|
+
exemptNoArguments: {
|
|
121
|
+
default: false,
|
|
122
|
+
description: `Boolean to indicate that no-argument functions should not be reported for
|
|
123
|
+
missing \`@example\` declarations.`,
|
|
124
|
+
type: 'boolean'
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
type: 'object'
|
|
128
|
+
}],
|
|
129
|
+
type: 'suggestion'
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
module.exports = exports.default;
|
|
133
|
+
//# sourceMappingURL=requireExample.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireExample.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","jsdoc","report","utils","avoidDocs","enableFixer","exemptNoArguments","options","targetTagName","functionExamples","tags","filter","tag","length","isIteratingFunctionOrVariable","hasParams","reportJSDoc","addTag","example","exampleContent","name","getTagDescription","trim","split","Boolean","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","checkConstructors","type","checkGetters","checkSetters","contexts","items","anyOf","comment","exemptedBy","module"],"sources":["../../src/rules/requireExample.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n enableFixer = true,\n exemptNoArguments = false,\n } = context.options[0] || {};\n\n const targetTagName = 'example';\n\n const functionExamples = jsdoc.tags.filter(({\n tag,\n }) => {\n return tag === targetTagName;\n });\n\n if (!functionExamples.length) {\n if (exemptNoArguments && utils.isIteratingFunctionOrVariable() &&\n !utils.hasParams()\n ) {\n return;\n }\n\n utils.reportJSDoc(`Missing JSDoc @${targetTagName} declaration.`, null, () => {\n if (enableFixer) {\n utils.addTag(targetTagName);\n }\n });\n\n return;\n }\n\n for (const example of functionExamples) {\n const exampleContent = `${example.name} ${utils.getTagDescription(example)}`\n .trim()\n .split('\\n')\n .filter(Boolean);\n\n if (!exampleContent.length) {\n report(`Missing JSDoc @${targetTagName} description.`, null, example);\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that all functions (and potentially other contexts) have examples.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-example.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: true,\n description: `A value indicating whether \\`constructor\\`s should be checked.\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n checkGetters: {\n default: false,\n description: 'A value indicating whether getters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkSetters: {\n default: false,\n description: 'A value indicating whether setters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\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(e.g., \\`ClassDeclaration\\` for ES6 classes).\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 the rule to apply to any\nJSDoc block throughout your files.\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 enableFixer: {\n default: true,\n description: `A boolean on whether to enable the fixer (which adds an empty \\`@example\\` block).\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for an \\`@example\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n exemptNoArguments: {\n default: false,\n description: `Boolean to indicate that no-argument functions should not be reported for\nmissing \\`@example\\` declarations.`,\n type: 'boolean',\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,OAAO;EACPC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,IAAIA,KAAK,CAACC,SAA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