@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,607 @@
|
|
|
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
|
+
var _jsdoccomment = require("@es-joy/jsdoccomment");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const digitRegex = /^(\d+(\.\d*)?|\.\d+)([eE][\-+]?\d+)?$/v;
|
|
12
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
13
|
+
context,
|
|
14
|
+
indent,
|
|
15
|
+
jsdoc,
|
|
16
|
+
settings,
|
|
17
|
+
utils
|
|
18
|
+
// eslint-disable-next-line complexity -- Todo
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
arrayBrackets = 'square',
|
|
22
|
+
arrowFunctionPostReturnMarkerSpacing = ' ',
|
|
23
|
+
arrowFunctionPreReturnMarkerSpacing = ' ',
|
|
24
|
+
enableFixer = true,
|
|
25
|
+
functionOrClassParameterSpacing = ' ',
|
|
26
|
+
functionOrClassPostGenericSpacing = '',
|
|
27
|
+
functionOrClassPostReturnMarkerSpacing = ' ',
|
|
28
|
+
functionOrClassPreReturnMarkerSpacing = '',
|
|
29
|
+
functionOrClassTypeParameterSpacing = ' ',
|
|
30
|
+
genericAndTupleElementSpacing = ' ',
|
|
31
|
+
genericDot = false,
|
|
32
|
+
keyValuePostColonSpacing = ' ',
|
|
33
|
+
keyValuePostKeySpacing = '',
|
|
34
|
+
keyValuePostOptionalSpacing = '',
|
|
35
|
+
keyValuePostVariadicSpacing = '',
|
|
36
|
+
methodQuotes = 'double',
|
|
37
|
+
objectFieldIndent = '',
|
|
38
|
+
objectFieldQuote = null,
|
|
39
|
+
objectFieldSeparator = 'comma',
|
|
40
|
+
objectFieldSeparatorOptionalLinebreak = true,
|
|
41
|
+
objectFieldSeparatorTrailingPunctuation = false,
|
|
42
|
+
objectTypeBracketSpacing = '',
|
|
43
|
+
parameterDefaultValueSpacing = ' ',
|
|
44
|
+
postMethodNameSpacing = '',
|
|
45
|
+
postNewSpacing = ' ',
|
|
46
|
+
// propertyQuotes = null,
|
|
47
|
+
separatorForSingleObjectField = false,
|
|
48
|
+
stringQuotes = 'double',
|
|
49
|
+
trailingPunctuationMultilineOnly = false,
|
|
50
|
+
typeBracketSpacing = '',
|
|
51
|
+
unionSpacing = ' '
|
|
52
|
+
} = context.options[0] || {};
|
|
53
|
+
const {
|
|
54
|
+
mode
|
|
55
|
+
} = settings;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {import('@es-joy/jsdoccomment').JsdocTagWithInline} tag
|
|
59
|
+
*/
|
|
60
|
+
const checkTypeFormats = tag => {
|
|
61
|
+
const potentialType = tag.type;
|
|
62
|
+
let parsedType;
|
|
63
|
+
try {
|
|
64
|
+
parsedType = mode === 'permissive' ? (0, _jsdoccomment.tryParse)(/** @type {string} */potentialType) : (0, _jsdoccomment.parse)(/** @type {string} */potentialType, mode);
|
|
65
|
+
} catch {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const fix = () => {
|
|
69
|
+
(0, _jsdocUtils.rewireByParsedType)(jsdoc, tag, parsedType, indent, typeBracketSpacing);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/** @type {string[]} */
|
|
73
|
+
const errorMessages = [];
|
|
74
|
+
if (typeBracketSpacing && (!tag.type.startsWith(typeBracketSpacing) || !tag.type.endsWith(typeBracketSpacing))) {
|
|
75
|
+
errorMessages.push(`Must have initial and final "${typeBracketSpacing}" spacing`);
|
|
76
|
+
} else if (!typeBracketSpacing && (/^\s/v.test(tag.type) || /\s$/v.test(tag.type))) {
|
|
77
|
+
errorMessages.push('Must have no initial spacing');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// eslint-disable-next-line complexity -- Todo
|
|
81
|
+
(0, _jsdoccomment.traverse)(parsedType, nde => {
|
|
82
|
+
let errorMessage = '';
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @param {Partial<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
|
|
86
|
+
* postNewSpacing?: string,
|
|
87
|
+
* postMethodNameSpacing?: string
|
|
88
|
+
* }} meta
|
|
89
|
+
* @returns {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
|
|
90
|
+
* postNewSpacing?: string,
|
|
91
|
+
* postMethodNameSpacing?: string
|
|
92
|
+
* }}
|
|
93
|
+
*/
|
|
94
|
+
const conditionalAdds = meta => {
|
|
95
|
+
const typNode =
|
|
96
|
+
/**
|
|
97
|
+
* @type {import('jsdoc-type-pratt-parser').FunctionResult|
|
|
98
|
+
* import('jsdoc-type-pratt-parser').CallSignatureResult|
|
|
99
|
+
* import('jsdoc-type-pratt-parser').ComputedMethodResult|
|
|
100
|
+
* import('jsdoc-type-pratt-parser').ConstructorSignatureResult|
|
|
101
|
+
* import('jsdoc-type-pratt-parser').MethodSignatureResult
|
|
102
|
+
* }
|
|
103
|
+
*/
|
|
104
|
+
nde;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
|
|
108
|
+
* postNewSpacing?: string,
|
|
109
|
+
* postMethodNameSpacing?: string
|
|
110
|
+
* }}
|
|
111
|
+
*/
|
|
112
|
+
const newMeta = {
|
|
113
|
+
parameterSpacing: meta.parameterSpacing ?? typNode.meta?.parameterSpacing ?? ' ',
|
|
114
|
+
postGenericSpacing: meta.postGenericSpacing ?? typNode.meta?.postGenericSpacing ?? '',
|
|
115
|
+
postReturnMarkerSpacing: meta.postReturnMarkerSpacing ?? typNode.meta?.postReturnMarkerSpacing ?? ' ',
|
|
116
|
+
preReturnMarkerSpacing: meta.preReturnMarkerSpacing ?? typNode.meta?.preReturnMarkerSpacing ?? '',
|
|
117
|
+
typeParameterSpacing: meta.typeParameterSpacing ?? typNode.meta?.typeParameterSpacing ?? ' '
|
|
118
|
+
};
|
|
119
|
+
if (typNode.type === 'JsdocTypeConstructorSignature') {
|
|
120
|
+
newMeta.postNewSpacing = meta.postNewSpacing;
|
|
121
|
+
}
|
|
122
|
+
if (typNode.type === 'JsdocTypeMethodSignature') {
|
|
123
|
+
newMeta.postMethodNameSpacing = meta.postMethodNameSpacing ?? typNode.meta?.postMethodNameSpacing ?? '';
|
|
124
|
+
}
|
|
125
|
+
return newMeta;
|
|
126
|
+
};
|
|
127
|
+
switch (nde.type) {
|
|
128
|
+
case 'JsdocTypeConstructorSignature':
|
|
129
|
+
{
|
|
130
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').ConstructorSignatureResult} */nde;
|
|
131
|
+
/* c8 ignore next -- Guard */
|
|
132
|
+
if ((typeNode.meta?.postNewSpacing ?? ' ') !== postNewSpacing) {
|
|
133
|
+
typeNode.meta =
|
|
134
|
+
/**
|
|
135
|
+
* @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
|
|
136
|
+
* postNewSpacing: string,
|
|
137
|
+
* }}
|
|
138
|
+
*/
|
|
139
|
+
conditionalAdds({
|
|
140
|
+
postNewSpacing
|
|
141
|
+
});
|
|
142
|
+
errorMessage = `Post-\`new\` spacing should be "${postNewSpacing}"`;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
case 'JsdocTypeFunction':
|
|
147
|
+
{
|
|
148
|
+
const typeNode =
|
|
149
|
+
/**
|
|
150
|
+
* @type {import('jsdoc-type-pratt-parser').FunctionResult}
|
|
151
|
+
*/
|
|
152
|
+
nde;
|
|
153
|
+
if ('arrow' in typeNode && typeNode.arrow) {
|
|
154
|
+
/* c8 ignore next -- Guard */
|
|
155
|
+
if ((typeNode.meta?.postReturnMarkerSpacing ?? ' ') !== arrowFunctionPostReturnMarkerSpacing) {
|
|
156
|
+
typeNode.meta =
|
|
157
|
+
/**
|
|
158
|
+
* @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
|
|
159
|
+
* postNewSpacing: string,
|
|
160
|
+
* }}
|
|
161
|
+
*/
|
|
162
|
+
conditionalAdds({
|
|
163
|
+
postReturnMarkerSpacing: arrowFunctionPostReturnMarkerSpacing,
|
|
164
|
+
/* c8 ignore next -- Guard */
|
|
165
|
+
preReturnMarkerSpacing: typeNode.meta?.preReturnMarkerSpacing ?? ' '
|
|
166
|
+
});
|
|
167
|
+
errorMessage = `Post-return-marker spacing should be "${arrowFunctionPostReturnMarkerSpacing}"`;
|
|
168
|
+
break;
|
|
169
|
+
/* c8 ignore next -- Guard */
|
|
170
|
+
} else if ((typeNode.meta?.preReturnMarkerSpacing ?? ' ') !== arrowFunctionPreReturnMarkerSpacing) {
|
|
171
|
+
typeNode.meta =
|
|
172
|
+
/**
|
|
173
|
+
* @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
|
|
174
|
+
* postNewSpacing: string,
|
|
175
|
+
* }}
|
|
176
|
+
*/
|
|
177
|
+
conditionalAdds({
|
|
178
|
+
/* c8 ignore next -- Guard */
|
|
179
|
+
postReturnMarkerSpacing: typeNode.meta?.postReturnMarkerSpacing ?? ' ',
|
|
180
|
+
preReturnMarkerSpacing: arrowFunctionPreReturnMarkerSpacing
|
|
181
|
+
});
|
|
182
|
+
errorMessage = `Pre-return-marker spacing should be "${arrowFunctionPreReturnMarkerSpacing}"`;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
case 'JsdocTypeCallSignature':
|
|
189
|
+
case 'JsdocTypeComputedMethod':
|
|
190
|
+
case 'JsdocTypeMethodSignature':
|
|
191
|
+
{
|
|
192
|
+
const typeNode =
|
|
193
|
+
/**
|
|
194
|
+
* @type {import('jsdoc-type-pratt-parser').FunctionResult|
|
|
195
|
+
* import('jsdoc-type-pratt-parser').CallSignatureResult|
|
|
196
|
+
* import('jsdoc-type-pratt-parser').ComputedMethodResult|
|
|
197
|
+
* import('jsdoc-type-pratt-parser').ConstructorSignatureResult|
|
|
198
|
+
* import('jsdoc-type-pratt-parser').MethodSignatureResult
|
|
199
|
+
* }
|
|
200
|
+
*/
|
|
201
|
+
nde;
|
|
202
|
+
if (typeNode.type === 'JsdocTypeMethodSignature' && (typeNode.meta?.postMethodNameSpacing ?? '') !== postMethodNameSpacing) {
|
|
203
|
+
typeNode.meta = {
|
|
204
|
+
quote: typeNode.meta.quote,
|
|
205
|
+
...conditionalAdds({
|
|
206
|
+
postMethodNameSpacing
|
|
207
|
+
})
|
|
208
|
+
};
|
|
209
|
+
errorMessage = `Post-method-name spacing should be "${postMethodNameSpacing}"`;
|
|
210
|
+
break;
|
|
211
|
+
} else if (typeNode.type === 'JsdocTypeMethodSignature' && typeNode.meta.quote !== undefined && typeNode.meta.quote !== methodQuotes) {
|
|
212
|
+
typeNode.meta = {
|
|
213
|
+
...conditionalAdds({
|
|
214
|
+
postMethodNameSpacing: typeNode.meta.postMethodNameSpacing ?? ''
|
|
215
|
+
}),
|
|
216
|
+
quote: methodQuotes
|
|
217
|
+
};
|
|
218
|
+
errorMessage = `Method quoting style should be "${methodQuotes}"`;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
if ((typeNode.meta?.parameterSpacing ?? ' ') !== functionOrClassParameterSpacing) {
|
|
222
|
+
typeNode.meta = conditionalAdds({
|
|
223
|
+
parameterSpacing: functionOrClassParameterSpacing
|
|
224
|
+
});
|
|
225
|
+
errorMessage = `Parameter spacing should be "${functionOrClassParameterSpacing}"`;
|
|
226
|
+
} else if ((typeNode.meta?.postGenericSpacing ?? '') !== functionOrClassPostGenericSpacing) {
|
|
227
|
+
typeNode.meta = conditionalAdds({
|
|
228
|
+
postGenericSpacing: functionOrClassPostGenericSpacing
|
|
229
|
+
});
|
|
230
|
+
errorMessage = `Post-generic spacing should be "${functionOrClassPostGenericSpacing}"`;
|
|
231
|
+
} else if ((typeNode.meta?.postReturnMarkerSpacing ?? ' ') !== functionOrClassPostReturnMarkerSpacing) {
|
|
232
|
+
typeNode.meta = conditionalAdds({
|
|
233
|
+
postReturnMarkerSpacing: functionOrClassPostReturnMarkerSpacing
|
|
234
|
+
});
|
|
235
|
+
errorMessage = `Post-return-marker spacing should be "${functionOrClassPostReturnMarkerSpacing}"`;
|
|
236
|
+
} else if ((typeNode.meta?.preReturnMarkerSpacing ?? '') !== functionOrClassPreReturnMarkerSpacing) {
|
|
237
|
+
typeNode.meta = conditionalAdds({
|
|
238
|
+
preReturnMarkerSpacing: functionOrClassPreReturnMarkerSpacing
|
|
239
|
+
});
|
|
240
|
+
errorMessage = `Pre-return-marker spacing should be "${functionOrClassPreReturnMarkerSpacing}"`;
|
|
241
|
+
} else if ((typeNode.meta?.typeParameterSpacing ?? ' ') !== functionOrClassTypeParameterSpacing) {
|
|
242
|
+
typeNode.meta = conditionalAdds({
|
|
243
|
+
typeParameterSpacing: functionOrClassTypeParameterSpacing
|
|
244
|
+
});
|
|
245
|
+
errorMessage = `Type parameter spacing should be "${functionOrClassTypeParameterSpacing}"`;
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
case 'JsdocTypeGeneric':
|
|
250
|
+
{
|
|
251
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').GenericResult} */nde;
|
|
252
|
+
if ('value' in typeNode.left && typeNode.left.value === 'Array') {
|
|
253
|
+
if (typeNode.meta.brackets !== arrayBrackets) {
|
|
254
|
+
typeNode.meta.brackets = arrayBrackets;
|
|
255
|
+
errorMessage = `Array bracket style should be ${arrayBrackets}`;
|
|
256
|
+
}
|
|
257
|
+
} else if (typeNode.meta.dot !== genericDot) {
|
|
258
|
+
typeNode.meta.dot = genericDot;
|
|
259
|
+
errorMessage = `Dot usage should be ${genericDot}`;
|
|
260
|
+
} else if ((typeNode.meta.elementSpacing ?? ' ') !== genericAndTupleElementSpacing) {
|
|
261
|
+
typeNode.meta.elementSpacing = genericAndTupleElementSpacing;
|
|
262
|
+
errorMessage = `Element spacing should be "${genericAndTupleElementSpacing}"`;
|
|
263
|
+
}
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
case 'JsdocTypeKeyValue':
|
|
267
|
+
{
|
|
268
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').KeyValueResult} */nde;
|
|
269
|
+
/* c8 ignore next -- Guard */
|
|
270
|
+
if ((typeNode.meta?.postKeySpacing ?? '') !== keyValuePostKeySpacing) {
|
|
271
|
+
typeNode.meta = {
|
|
272
|
+
/* c8 ignore next -- Guard */
|
|
273
|
+
postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
|
|
274
|
+
postKeySpacing: keyValuePostKeySpacing,
|
|
275
|
+
/* c8 ignore next 2 -- Guard */
|
|
276
|
+
postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
|
|
277
|
+
postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? ''
|
|
278
|
+
};
|
|
279
|
+
errorMessage = `Post key spacing should be "${keyValuePostKeySpacing}"`;
|
|
280
|
+
/* c8 ignore next -- Guard */
|
|
281
|
+
} else if ((typeNode.meta?.postColonSpacing ?? ' ') !== keyValuePostColonSpacing) {
|
|
282
|
+
typeNode.meta = {
|
|
283
|
+
postColonSpacing: keyValuePostColonSpacing,
|
|
284
|
+
/* c8 ignore next 3 -- Guard */
|
|
285
|
+
postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
|
|
286
|
+
postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
|
|
287
|
+
postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? ''
|
|
288
|
+
};
|
|
289
|
+
errorMessage = `Post colon spacing should be "${keyValuePostColonSpacing}"`;
|
|
290
|
+
/* c8 ignore next -- Guard */
|
|
291
|
+
} else if ((typeNode.meta?.postOptionalSpacing ?? '') !== keyValuePostOptionalSpacing) {
|
|
292
|
+
typeNode.meta = {
|
|
293
|
+
/* c8 ignore next 2 -- Guard */
|
|
294
|
+
postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
|
|
295
|
+
postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
|
|
296
|
+
postOptionalSpacing: keyValuePostOptionalSpacing,
|
|
297
|
+
/* c8 ignore next -- Guard */
|
|
298
|
+
postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? ''
|
|
299
|
+
};
|
|
300
|
+
errorMessage = `Post optional (\`?\`) spacing should be "${keyValuePostOptionalSpacing}"`;
|
|
301
|
+
/* c8 ignore next -- Guard */
|
|
302
|
+
} else if (typeNode.variadic && (typeNode.meta?.postVariadicSpacing ?? '') !== keyValuePostVariadicSpacing) {
|
|
303
|
+
typeNode.meta = {
|
|
304
|
+
/* c8 ignore next 3 -- Guard */
|
|
305
|
+
postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
|
|
306
|
+
postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
|
|
307
|
+
postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
|
|
308
|
+
postVariadicSpacing: keyValuePostVariadicSpacing
|
|
309
|
+
};
|
|
310
|
+
errorMessage = `Post variadic (\`...\`) spacing should be "${keyValuePostVariadicSpacing}"`;
|
|
311
|
+
}
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
case 'JsdocTypeObject':
|
|
315
|
+
{
|
|
316
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectResult} */nde;
|
|
317
|
+
/* c8 ignore next -- Guard */
|
|
318
|
+
const separator = typeNode.meta.separator ?? 'comma';
|
|
319
|
+
if (separator !== objectFieldSeparator && (!objectFieldSeparatorOptionalLinebreak || !(objectFieldSeparator.endsWith('-linebreak') && objectFieldSeparator.startsWith(separator))) || (typeNode.meta.separatorForSingleObjectField ?? false) !== separatorForSingleObjectField || (typeNode.meta.propertyIndent ?? '') !== objectFieldIndent && separator.endsWith('-linebreak') || (/* c8 ignore next 5 -- jsdoc-type-pratt-parser doesn't encode as should */
|
|
320
|
+
(typeNode.meta.trailingPunctuation ?? false) !== objectFieldSeparatorTrailingPunctuation && (typeNode.meta.trailingPunctuation && (!trailingPunctuationMultilineOnly || !(0, _jsdoccomment.stringify)(typeNode).includes('\n')) || !typeNode.meta.trailingPunctuation && (!trailingPunctuationMultilineOnly || (0, _jsdoccomment.stringify)(typeNode).includes('\n'))))) {
|
|
321
|
+
typeNode.meta.separator = objectFieldSeparatorOptionalLinebreak && !separator.endsWith('and-linebreak') ? objectFieldSeparator.replace(/-and-linebreak$/v, '') : objectFieldSeparator;
|
|
322
|
+
typeNode.meta.separatorForSingleObjectField = separatorForSingleObjectField;
|
|
323
|
+
typeNode.meta.propertyIndent = objectFieldIndent;
|
|
324
|
+
typeNode.meta.trailingPunctuation = objectFieldSeparatorTrailingPunctuation;
|
|
325
|
+
errorMessage = `Inconsistent ${objectFieldSeparator} separator usage`;
|
|
326
|
+
} else if ((typeNode.meta.bracketSpacing ?? '') !== objectTypeBracketSpacing) {
|
|
327
|
+
typeNode.meta.bracketSpacing = objectTypeBracketSpacing;
|
|
328
|
+
// This might not be the cause
|
|
329
|
+
// errorMessage = `Object type bracket spacing should be "${objectTypeBracketSpacing}"`;
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
case 'JsdocTypeObjectField':
|
|
334
|
+
{
|
|
335
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectFieldResult} */nde;
|
|
336
|
+
if ((objectFieldQuote || typeof typeNode.key === 'string' && (/^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/v.test(typeNode.key) || digitRegex.test(typeNode.key))) && typeNode.meta.quote !== (objectFieldQuote ?? undefined) && (typeof typeNode.key !== 'string' || !digitRegex.test(typeNode.key))) {
|
|
337
|
+
typeNode.meta.quote = objectFieldQuote ?? undefined;
|
|
338
|
+
errorMessage = `Inconsistent object field quotes ${objectFieldQuote}`;
|
|
339
|
+
} else if ((typeNode.meta?.postKeySpacing ?? '') !== keyValuePostKeySpacing) {
|
|
340
|
+
typeNode.meta.postKeySpacing = keyValuePostKeySpacing;
|
|
341
|
+
errorMessage = `Post key spacing should be "${keyValuePostKeySpacing}"`;
|
|
342
|
+
} else if ((typeNode.meta?.postColonSpacing ?? ' ') !== keyValuePostColonSpacing) {
|
|
343
|
+
typeNode.meta.postColonSpacing = keyValuePostColonSpacing;
|
|
344
|
+
errorMessage = `Post colon spacing should be "${keyValuePostColonSpacing}"`;
|
|
345
|
+
} else if ((typeNode.meta?.postOptionalSpacing ?? '') !== keyValuePostOptionalSpacing) {
|
|
346
|
+
typeNode.meta.postOptionalSpacing = keyValuePostOptionalSpacing;
|
|
347
|
+
errorMessage = `Post optional (\`?\`) spacing should be "${keyValuePostOptionalSpacing}"`;
|
|
348
|
+
}
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
case 'JsdocTypeStringValue':
|
|
352
|
+
{
|
|
353
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */nde;
|
|
354
|
+
if (typeNode.meta.quote !== stringQuotes) {
|
|
355
|
+
typeNode.meta.quote = stringQuotes;
|
|
356
|
+
errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;
|
|
357
|
+
}
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Only suitable for namepaths (and would need changes); see https://github.com/gajus/eslint-plugin-jsdoc/issues/1524
|
|
362
|
+
// case 'JsdocTypeProperty': {
|
|
363
|
+
// const typeNode = /** @type {import('jsdoc-type-pratt-parser').PropertyResult} */ (nde);
|
|
364
|
+
|
|
365
|
+
// if ((propertyQuotes ||
|
|
366
|
+
// (typeof typeNode.value === 'string' && !(/\s/v).test(typeNode.value))) &&
|
|
367
|
+
// typeNode.meta.quote !== (propertyQuotes ?? undefined)
|
|
368
|
+
// ) {
|
|
369
|
+
// typeNode.meta.quote = propertyQuotes ?? undefined;
|
|
370
|
+
// errorMessage = `Inconsistent ${propertyQuotes} property quotes usage`;
|
|
371
|
+
// }
|
|
372
|
+
|
|
373
|
+
// break;
|
|
374
|
+
// }
|
|
375
|
+
|
|
376
|
+
case 'JsdocTypeTuple':
|
|
377
|
+
{
|
|
378
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').TupleResult} */nde;
|
|
379
|
+
/* c8 ignore next -- Guard */
|
|
380
|
+
if ((typeNode.meta?.elementSpacing ?? ' ') !== genericAndTupleElementSpacing) {
|
|
381
|
+
typeNode.meta = {
|
|
382
|
+
elementSpacing: genericAndTupleElementSpacing
|
|
383
|
+
};
|
|
384
|
+
errorMessage = `Element spacing should be "${genericAndTupleElementSpacing}"`;
|
|
385
|
+
}
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
case 'JsdocTypeTypeParameter':
|
|
389
|
+
{
|
|
390
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').TypeParameterResult} */nde;
|
|
391
|
+
/* c8 ignore next -- Guard */
|
|
392
|
+
if (typeNode.defaultValue && (typeNode.meta?.defaultValueSpacing ?? ' ') !== parameterDefaultValueSpacing) {
|
|
393
|
+
typeNode.meta = {
|
|
394
|
+
defaultValueSpacing: parameterDefaultValueSpacing
|
|
395
|
+
};
|
|
396
|
+
errorMessage = `Default value spacing should be "${parameterDefaultValueSpacing}"`;
|
|
397
|
+
}
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
case 'JsdocTypeUnion':
|
|
401
|
+
{
|
|
402
|
+
const typeNode = /** @type {import('jsdoc-type-pratt-parser').UnionResult} */nde;
|
|
403
|
+
/* c8 ignore next -- Guard */
|
|
404
|
+
if ((typeNode.meta?.spacing ?? ' ') !== unionSpacing) {
|
|
405
|
+
typeNode.meta = {
|
|
406
|
+
spacing: unionSpacing
|
|
407
|
+
};
|
|
408
|
+
errorMessage = `Inconsistent "${unionSpacing}" union spacing usage`;
|
|
409
|
+
}
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
default:
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
if (errorMessage) {
|
|
416
|
+
errorMessages.push(errorMessage);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
const differentResult = tag.type !== typeBracketSpacing + (0, _jsdoccomment.stringify)(parsedType) + typeBracketSpacing;
|
|
420
|
+
if (errorMessages.length && differentResult) {
|
|
421
|
+
for (const errorMessage of errorMessages) {
|
|
422
|
+
utils.reportJSDoc(errorMessage, tag, enableFixer ? fix : null);
|
|
423
|
+
}
|
|
424
|
+
// Stringification may have been equal previously (and thus no error reported)
|
|
425
|
+
// because the stringification doesn't preserve everything
|
|
426
|
+
} else if (differentResult) {
|
|
427
|
+
utils.reportJSDoc('There was an error with type formatting', tag, enableFixer ? fix : null);
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
const tags = utils.getPresentTags(['param', 'property', 'returns', 'this', 'throws', 'type', 'typedef', 'yields']);
|
|
431
|
+
for (const tag of tags) {
|
|
432
|
+
if (tag.type) {
|
|
433
|
+
checkTypeFormats(tag);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}, {
|
|
437
|
+
iterateAllJsdocs: true,
|
|
438
|
+
meta: {
|
|
439
|
+
docs: {
|
|
440
|
+
description: 'Formats JSDoc type values.',
|
|
441
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/type-formatting.md#repos-sticky-header'
|
|
442
|
+
},
|
|
443
|
+
fixable: 'code',
|
|
444
|
+
schema: [{
|
|
445
|
+
additionalProperties: false,
|
|
446
|
+
properties: {
|
|
447
|
+
arrayBrackets: {
|
|
448
|
+
description: 'Determines how array generics are represented. Set to `angle` for the style `Array<type>` or `square` for the style `type[]`. Defaults to "square".',
|
|
449
|
+
enum: ['angle', 'square'],
|
|
450
|
+
type: 'string'
|
|
451
|
+
},
|
|
452
|
+
arrowFunctionPostReturnMarkerSpacing: {
|
|
453
|
+
description: 'The space character (if any) to use after return markers (`=>`). Defaults to " ".',
|
|
454
|
+
type: 'string'
|
|
455
|
+
},
|
|
456
|
+
arrowFunctionPreReturnMarkerSpacing: {
|
|
457
|
+
description: 'The space character (if any) to use before return markers (`=>`). Defaults to " ".',
|
|
458
|
+
type: 'string'
|
|
459
|
+
},
|
|
460
|
+
enableFixer: {
|
|
461
|
+
description: 'Whether to enable the fixer. Defaults to `true`.',
|
|
462
|
+
type: 'boolean'
|
|
463
|
+
},
|
|
464
|
+
functionOrClassParameterSpacing: {
|
|
465
|
+
description: 'The space character (if any) to use between function or class parameters. Defaults to " ".',
|
|
466
|
+
type: 'string'
|
|
467
|
+
},
|
|
468
|
+
functionOrClassPostGenericSpacing: {
|
|
469
|
+
description: 'The space character (if any) to use after a generic expression in a function or class. Defaults to "".',
|
|
470
|
+
type: 'string'
|
|
471
|
+
},
|
|
472
|
+
functionOrClassPostReturnMarkerSpacing: {
|
|
473
|
+
description: 'The space character (if any) to use after return markers (`:`). Defaults to "".',
|
|
474
|
+
type: 'string'
|
|
475
|
+
},
|
|
476
|
+
functionOrClassPreReturnMarkerSpacing: {
|
|
477
|
+
description: 'The space character (if any) to use before return markers (`:`). Defaults to "".',
|
|
478
|
+
type: 'string'
|
|
479
|
+
},
|
|
480
|
+
functionOrClassTypeParameterSpacing: {
|
|
481
|
+
description: 'The space character (if any) to use between type parameters in a function or class. Defaults to " ".',
|
|
482
|
+
type: 'string'
|
|
483
|
+
},
|
|
484
|
+
genericAndTupleElementSpacing: {
|
|
485
|
+
description: 'The space character (if any) to use between elements in generics and tuples. Defaults to " ".',
|
|
486
|
+
type: 'string'
|
|
487
|
+
},
|
|
488
|
+
genericDot: {
|
|
489
|
+
description: 'Boolean value of whether to use a dot before the angled brackets of a generic (e.g., `SomeType.<AnotherType>`). Defaults to `false`.',
|
|
490
|
+
type: 'boolean'
|
|
491
|
+
},
|
|
492
|
+
keyValuePostColonSpacing: {
|
|
493
|
+
description: 'The amount of spacing (if any) after the colon of a key-value or object-field pair. Defaults to " ".',
|
|
494
|
+
type: 'string'
|
|
495
|
+
},
|
|
496
|
+
keyValuePostKeySpacing: {
|
|
497
|
+
description: 'The amount of spacing (if any) immediately after keys in a key-value or object-field pair. Defaults to "".',
|
|
498
|
+
type: 'string'
|
|
499
|
+
},
|
|
500
|
+
keyValuePostOptionalSpacing: {
|
|
501
|
+
description: 'The amount of spacing (if any) after the optional operator (`?`) in a key-value or object-field pair. Defaults to "".',
|
|
502
|
+
type: 'string'
|
|
503
|
+
},
|
|
504
|
+
keyValuePostVariadicSpacing: {
|
|
505
|
+
description: 'The amount of spacing (if any) after a variadic operator (`...`) in a key-value pair. Defaults to "".',
|
|
506
|
+
type: 'string'
|
|
507
|
+
},
|
|
508
|
+
methodQuotes: {
|
|
509
|
+
description: 'The style of quotation mark for surrounding method names when quoted. Defaults to `double`',
|
|
510
|
+
enum: ['double', 'single'],
|
|
511
|
+
type: 'string'
|
|
512
|
+
},
|
|
513
|
+
objectFieldIndent: {
|
|
514
|
+
description: `A string indicating the whitespace to be added on each line preceding an
|
|
515
|
+
object property-value field. Defaults to the empty string.`,
|
|
516
|
+
type: 'string'
|
|
517
|
+
},
|
|
518
|
+
objectFieldQuote: {
|
|
519
|
+
description: `Whether and how object field properties should be quoted (e.g., \`{"a": string}\`).
|
|
520
|
+
Set to \`single\`, \`double\`, or \`null\`. Defaults to \`null\` (no quotes unless
|
|
521
|
+
required due to special characters within the field). Digits will be kept as is,
|
|
522
|
+
regardless of setting (they can either represent a digit or a string digit).`,
|
|
523
|
+
enum: ['double', 'single', null]
|
|
524
|
+
},
|
|
525
|
+
objectFieldSeparator: {
|
|
526
|
+
description: `For object properties, specify whether a "semicolon", "comma", "linebreak",
|
|
527
|
+
"semicolon-and-linebreak", or "comma-and-linebreak" should be used after
|
|
528
|
+
each object property-value pair.
|
|
529
|
+
|
|
530
|
+
Defaults to \`"comma"\`.`,
|
|
531
|
+
enum: ['comma', 'comma-and-linebreak', 'linebreak', 'semicolon', 'semicolon-and-linebreak'],
|
|
532
|
+
type: 'string'
|
|
533
|
+
},
|
|
534
|
+
objectFieldSeparatorOptionalLinebreak: {
|
|
535
|
+
description: `Whether \`objectFieldSeparator\` set to \`"semicolon-and-linebreak"\` or
|
|
536
|
+
\`"comma-and-linebreak"\` should be allowed to optionally drop the linebreak.
|
|
537
|
+
|
|
538
|
+
Defaults to \`true\`.`,
|
|
539
|
+
type: 'boolean'
|
|
540
|
+
},
|
|
541
|
+
objectFieldSeparatorTrailingPunctuation: {
|
|
542
|
+
description: `If \`separatorForSingleObjectField\` is not in effect (i.e., if it is \`false\`
|
|
543
|
+
or there are multiple property-value object fields present), this property
|
|
544
|
+
will determine whether to add punctuation corresponding to the
|
|
545
|
+
\`objectFieldSeparator\` (e.g., a semicolon) to the final object field.
|
|
546
|
+
Defaults to \`false\`.`,
|
|
547
|
+
type: 'boolean'
|
|
548
|
+
},
|
|
549
|
+
objectTypeBracketSpacing: {
|
|
550
|
+
description: 'The space character (if any) to add after an object\'s initial curly bracket and before its ending curly bracket',
|
|
551
|
+
type: 'string'
|
|
552
|
+
},
|
|
553
|
+
parameterDefaultValueSpacing: {
|
|
554
|
+
description: 'The space character (if any) to use between the equal signs of a default value. Defaults to " ".',
|
|
555
|
+
type: 'string'
|
|
556
|
+
},
|
|
557
|
+
postMethodNameSpacing: {
|
|
558
|
+
description: 'The space character (if any) to add after a method name. Defaults to "".',
|
|
559
|
+
type: 'string'
|
|
560
|
+
},
|
|
561
|
+
postNewSpacing: {
|
|
562
|
+
description: 'The space character (if any) to add after "new" in a constructor. Defaults to " ".',
|
|
563
|
+
type: 'string'
|
|
564
|
+
},
|
|
565
|
+
// propertyQuotes: {
|
|
566
|
+
// description: `Whether and how namepath properties should be quoted (e.g., \`ab."cd"."ef"\`).
|
|
567
|
+
// Set to \`single\`, \`double\`, or \`null\`. Defaults to \`null\` (no quotes unless
|
|
568
|
+
// required due to whitespace within the property).`,
|
|
569
|
+
// enum: [
|
|
570
|
+
// 'double',
|
|
571
|
+
// 'single',
|
|
572
|
+
// null,
|
|
573
|
+
// ],
|
|
574
|
+
// },
|
|
575
|
+
separatorForSingleObjectField: {
|
|
576
|
+
description: `Whether to apply the \`objectFieldSeparator\` (e.g., a semicolon) when there
|
|
577
|
+
is only one property-value object field present. Defaults to \`false\`.`,
|
|
578
|
+
type: 'boolean'
|
|
579
|
+
},
|
|
580
|
+
stringQuotes: {
|
|
581
|
+
description: `How string literals should be quoted (e.g., \`"abc"\`). Set to \`single\`
|
|
582
|
+
or \`double\`. Defaults to 'double'.`,
|
|
583
|
+
enum: ['double', 'single'],
|
|
584
|
+
type: 'string'
|
|
585
|
+
},
|
|
586
|
+
trailingPunctuationMultilineOnly: {
|
|
587
|
+
description: 'If `objectFieldSeparatorTrailingPunctuation` is set, this will determine whether the trailing puncutation is only added when the type is multiline',
|
|
588
|
+
type: 'boolean'
|
|
589
|
+
},
|
|
590
|
+
typeBracketSpacing: {
|
|
591
|
+
description: `A string of spaces that will be added immediately after the type's initial
|
|
592
|
+
curly bracket and immediately before its ending curly bracket. Defaults
|
|
593
|
+
to the empty string.`,
|
|
594
|
+
type: 'string'
|
|
595
|
+
},
|
|
596
|
+
unionSpacing: {
|
|
597
|
+
description: 'Determines the spacing to add to unions (`|`). Defaults to a single space (`" "`).',
|
|
598
|
+
type: 'string'
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
type: 'object'
|
|
602
|
+
}],
|
|
603
|
+
type: 'suggestion'
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
module.exports = exports.default;
|
|
607
|
+
//# sourceMappingURL=typeFormatting.cjs.map
|