eslint-plugin-jsdoc 63.0.11 → 63.0.13
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/dist/WarnSettings.cjs +8 -1
- package/dist/WarnSettings.cjs.map +1 -1
- package/dist/alignTransform.cjs +10 -6
- package/dist/alignTransform.cjs.map +1 -1
- package/dist/buildForbidRuleDefinition.cjs +10 -3
- package/dist/buildForbidRuleDefinition.cjs.map +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.cjs +14 -7
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
- package/dist/defaultTagOrder.cjs +8 -1
- package/dist/defaultTagOrder.cjs.map +1 -1
- package/dist/exportParser.cjs +14 -6
- package/dist/exportParser.cjs.map +1 -1
- package/dist/generateDocs.cjs +44 -36
- package/dist/generateDocs.cjs.map +1 -1
- package/dist/generateOptions.cjs +18 -15
- package/dist/generateOptions.cjs.map +1 -1
- package/dist/generateRule.cjs +24 -24
- package/dist/generateRule.cjs.map +1 -1
- package/dist/generateRuleTypes.cjs +9 -6
- package/dist/generateRuleTypes.cjs.map +1 -1
- package/dist/getDefaultTagStructureForMode.cjs +8 -1
- package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.cjs +28 -20
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
- package/dist/index-cjs.cjs +159 -152
- package/dist/index-cjs.cjs.map +1 -1
- package/dist/index-esm.cjs +27 -16
- package/dist/index-esm.cjs.map +1 -1
- package/dist/index.cjs +172 -159
- package/dist/index.cjs.map +1 -1
- package/dist/iterateJsdoc.cjs +32 -22
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/jsdocUtils.cjs +86 -18
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkAccess.cjs +10 -2
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +10 -2
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +15 -6
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +9 -2
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +14 -6
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +9 -2
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +9 -2
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkSyntax.cjs +10 -2
- package/dist/rules/checkSyntax.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +11 -4
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTemplateNames.cjs +20 -12
- package/dist/rules/checkTemplateNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +10 -4
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +17 -9
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +19 -13
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/emptyTags.cjs +10 -2
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/escapeInlineTags.cjs +10 -2
- package/dist/rules/escapeInlineTags.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.cjs +10 -2
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/importsAsDependencies.cjs +20 -12
- package/dist/rules/importsAsDependencies.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +12 -4
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +9 -2
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +9 -2
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +10 -2
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +9 -2
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +11 -4
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs +10 -2
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.cjs +10 -2
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noDefaults.cjs +10 -2
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.cjs +9 -2
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +10 -2
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +9 -2
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +9 -2
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +21 -13
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/preferImportTag.cjs +28 -21
- package/dist/rules/preferImportTag.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +10 -2
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +9 -2
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +15 -7
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireExample.cjs +10 -2
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +10 -2
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +10 -2
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +24 -17
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +9 -2
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamDescription.cjs +10 -2
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +10 -2
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamType.cjs +10 -2
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requireProperty.cjs +10 -2
- package/dist/rules/requireProperty.cjs.map +1 -1
- package/dist/rules/requirePropertyDescription.cjs +10 -2
- package/dist/rules/requirePropertyDescription.cjs.map +1 -1
- package/dist/rules/requirePropertyName.cjs +10 -2
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyType.cjs +10 -2
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requireRejects.cjs +9 -2
- package/dist/rules/requireRejects.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +11 -4
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +15 -8
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +10 -2
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsType.cjs +10 -2
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireTags.cjs +9 -2
- package/dist/rules/requireTags.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +13 -5
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireThrows.cjs +9 -2
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +9 -2
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +9 -2
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +12 -4
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +9 -2
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +9 -2
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/tsMethodSignatureStyle.cjs +18 -10
- package/dist/rules/tsMethodSignatureStyle.cjs.map +1 -1
- package/dist/rules/tsNoEmptyObjectType.cjs +13 -5
- package/dist/rules/tsNoEmptyObjectType.cjs.map +1 -1
- package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs +16 -8
- package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs.map +1 -1
- package/dist/rules/tsPreferFunctionType.cjs +16 -8
- package/dist/rules/tsPreferFunctionType.cjs.map +1 -1
- package/dist/rules/typeFormatting.cjs +17 -9
- package/dist/rules/typeFormatting.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +18 -10
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/tagNames.cjs +9 -4
- package/dist/tagNames.cjs.map +1 -1
- package/dist/utils/hasReturnValue.cjs +8 -1
- package/dist/utils/hasReturnValue.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchDescription.cjs","names":[],"sources":["../../src/rules/matchDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n// If supporting Node >= 10, we could loosen the default to this for the\n// initial letter: \\\\p{Upper}\nconst matchDescriptionDefault = '^\\n?([A-Z`\\\\d_][\\\\s\\\\S]*[.?!`\\\\p{RGI_Emoji}]\\\\s*)?$';\n\n/**\n * @param {string} value\n * @param {string} userDefault\n * @returns {string}\n */\nconst stringOrDefault = (value, userDefault) => {\n return typeof value === 'string' ?\n value :\n userDefault || matchDescriptionDefault;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n utils,\n}) => {\n const {\n mainDescription,\n matchDescription,\n message,\n nonemptyTags = true,\n tags = {},\n } = context.options[0] || {};\n\n /**\n * @param {string} desc\n * @param {import('comment-parser').Spec} [tag]\n * @returns {void}\n */\n const validateDescription = (desc, tag) => {\n let mainDescriptionMatch = mainDescription;\n let errorMessage = message;\n if (typeof mainDescription === 'object') {\n mainDescriptionMatch = mainDescription.match;\n errorMessage = mainDescription.message;\n }\n\n if (mainDescriptionMatch === false && (\n !tag || !Object.hasOwn(tags, tag.tag))\n ) {\n return;\n }\n\n let tagValue = mainDescriptionMatch;\n if (tag) {\n const tagName = tag.tag;\n if (typeof tags[tagName] === 'object') {\n tagValue = tags[tagName].match;\n errorMessage = tags[tagName].message;\n } else {\n tagValue = tags[tagName];\n }\n }\n\n const regex = utils.getRegexFromString(\n stringOrDefault(tagValue, matchDescription),\n );\n\n if (!regex.test(desc)) {\n report(\n errorMessage || 'JSDoc description does not satisfy the regex pattern.',\n null,\n tag || {\n // Add one as description would typically be into block\n line: jsdoc.source[0].number + 1,\n },\n );\n }\n };\n\n const {\n description,\n } = utils.getDescription();\n if (description) {\n validateDescription(description);\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasNoTag = (tagName) => {\n return !tags[tagName];\n };\n\n for (const tag of [\n 'description',\n 'summary',\n 'file',\n 'classdesc',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n if (hasNoTag(targetTagName)) {\n validateDescription(desc, matchingJsdocTag);\n }\n }, true);\n }\n\n if (nonemptyTags) {\n for (const tag of [\n 'copyright',\n 'example',\n 'see',\n 'todo',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n\n if (hasNoTag(targetTagName) && !(/.+/v).test(desc)) {\n report(\n 'JSDoc description must not be empty.',\n null,\n matchingJsdocTag,\n );\n }\n });\n }\n }\n\n if (!Object.keys(tags).length) {\n return;\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasOptionTag = (tagName) => {\n return Boolean(tags[tagName]);\n };\n\n const whitelistedTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return hasOptionTag(tagName);\n });\n const {\n tagsWithNames,\n tagsWithoutNames,\n } = utils.getTagsByType(whitelistedTags);\n\n tagsWithNames.some((tag) => {\n const desc = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(/^[\\- ]*/v, '')\n .trim();\n\n return validateDescription(desc, tag);\n });\n\n tagsWithoutNames.some((tag) => {\n const desc = (tag.name + ' ' + utils.getTagDescription(tag)).trim();\n\n return validateDescription(desc, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Enforces a regular expression pattern on descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied (e.g.,\n\\`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.md#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 mainDescription: {\n description: `If you wish to override the main block description without changing the\ndefault \\`match-description\\` (which can cascade to the \\`tags\\` with \\`true\\`),\nyou may use \\`mainDescription\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: '[A-Z].*\\\\\\\\.',\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\`\n\nThere is no need to add \\`mainDescription: true\\`, as by default, the main\nblock description (and only the main block description) is linted, though you\nmay disable checking it by setting it to \\`false\\`.\n\nYou may also provide an object with \\`message\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: {\n message: 'Capitalize first word of JSDoc block descriptions',\n match: '[A-Z].*\\\\\\\\.'\n },\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\``,\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n matchDescription: {\n description: `You can supply your own expression to override the default, passing a\n\\`matchDescription\\` string on the options object.\n\nDefaults to using (only) the \\`v\\` flag, so\nto add your own flags, encapsulate your expression as a string, but like a\nliteral, e.g., \\`/[A-Z].*\\\\./vi\\`.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\\\\\\\.'}]\n}\n\\`\\`\\``,\n format: 'regex',\n type: 'string',\n },\n message: {\n description: `You may provide a custom default message by using the following format:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n message: 'The default description should begin with a capital letter.'\n }]\n}\n\\`\\`\\`\n\nThis can be overridden per tag or for the main block description by setting\n\\`message\\` within \\`tags\\` or \\`mainDescription\\`, respectively.`,\n type: 'string',\n },\n nonemptyTags: {\n description: `If not set to \\`false\\`, will enforce that the following tags have at least\nsome content:\n\n- \\`@copyright\\`\n- \\`@example\\`\n- \\`@see\\`\n- \\`@todo\\`\n\nIf you supply your own tag description for any of the above tags in \\`tags\\`,\nyour description will take precedence.`,\n type: 'boolean',\n },\n tags: {\n description: `If you want different regular expressions to apply to tags, you may use\nthe \\`tags\\` option object:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: '\\\\\\\\- [A-Z].*\\\\\\\\.',\n returns: '[A-Z].*\\\\\\\\.'\n }}]\n}\n\\`\\`\\`\n\nIn place of a string, you can also add \\`true\\` to indicate that a particular\ntag should be linted with the \\`matchDescription\\` value (or the default).\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: true,\n returns: true\n }}]\n}\n\\`\\`\\`\n\nAlternatively, you may supply an object with a \\`message\\` property to indicate\nthe error message for that tag.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: {message: 'Begin with a hyphen', match: '\\\\\\\\- [A-Z].*\\\\\\\\.'},\n returns: {message: 'Capitalize for returns (the default)', match: true}\n }}]\n}\n\\`\\`\\`\n\nThe tags \\`@param\\`/\\`@arg\\`/\\`@argument\\` and \\`@property\\`/\\`@prop\\` will be properly\nparsed to ensure that the matched \"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 patternProperties: {\n '.*': {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;;AAE7C;AACA;AACA,MAAM,uBAAuB,GAAG,qDAAqD;;AAErF;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK;EAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,GAC9B,KAAK,GACL,WAAW,IAAI,uBAAu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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClD,KAAK,EAAE;YACL,KAAK,EAAE,CACL;cACE,IAAI,EAAE;YACR,CAAC,EACD;cACE,oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,eAAe,EAAE;UACf,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACK,KAAK,EAAE,CACL;YACE,MAAM,EAAE,OAAO;YACf,IAAI,EAAE;UACR,CAAC,EACD;YACE,IAAI,EAAE;UACR,CAAC,EACD;YACE,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;cACV,KAAK,EAAE;gBACL,KAAK,EAAE,CACL;kBACE,MAAM,EAAE,OAAO;kBACf,IAAI,EAAE;gBACR,CAAC,EACD;kBACE,IAAI,EAAE;gBACR,CAAC;cAEL,CAAC;cACD,OAAO,EAAE;gBACP,IAAI,EAAE;cACR;YACF,CAAC;YACD,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACD,gBAAgB,EAAE;UAChB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACK,MAAM,EAAE,OAAO;UACf,IAAI,EAAE;QACR,CAAC;QACD,OAAO,EAAE;UACP,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;UACtD,IAAI,EAAE;QACR,CAAC;QACD,YAAY,EAAE;UACZ,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3B,IAAI,EAAE;QACR,CAAC;QACD,IAAI,EAAE;UACJ,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;UACD,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJ,KAAK,EAAE,CACL;gBACE,MAAM,EAAE,OAAO;gBACf,IAAI,EAAE;cACR,CAAC,EACD;gBACE,IAAI,EAAE,CACJ,IAAI,CACL;gBACD,IAAI,EAAE;cACR,CAAC,EACD;gBACE,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE;kBACV,KAAK,EAAE;oBACL,KAAK,EAAE,CACL;sBACE,MAAM,EAAE,OAAO;sBACf,IAAI,EAAE;oBACR,CAAC,EACD;sBACE,IAAI,EAAE,CACJ,IAAI,CACL;sBACD,IAAI,EAAE;oBACR,CAAC;kBAEL,CAAC;kBACD,OAAO,EAAE;oBACP,IAAI,EAAE;kBACR;gBACF,CAAC;gBACD,IAAI,EAAE;cACR,CAAC;YAEL;UACF,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"matchDescription.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/matchDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n// If supporting Node >= 10, we could loosen the default to this for the\n// initial letter: \\\\p{Upper}\nconst matchDescriptionDefault = '^\\n?([A-Z`\\\\d_][\\\\s\\\\S]*[.?!`\\\\p{RGI_Emoji}]\\\\s*)?$';\n\n/**\n * @param {string} value\n * @param {string} userDefault\n * @returns {string}\n */\nconst stringOrDefault = (value, userDefault) => {\n return typeof value === 'string' ?\n value :\n userDefault || matchDescriptionDefault;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n report,\n utils,\n}) => {\n const {\n mainDescription,\n matchDescription,\n message,\n nonemptyTags = true,\n tags = {},\n } = context.options[0] || {};\n\n /**\n * @param {string} desc\n * @param {import('comment-parser').Spec} [tag]\n * @returns {void}\n */\n const validateDescription = (desc, tag) => {\n let mainDescriptionMatch = mainDescription;\n let errorMessage = message;\n if (typeof mainDescription === 'object') {\n mainDescriptionMatch = mainDescription.match;\n errorMessage = mainDescription.message;\n }\n\n if (mainDescriptionMatch === false && (\n !tag || !Object.hasOwn(tags, tag.tag))\n ) {\n return;\n }\n\n let tagValue = mainDescriptionMatch;\n if (tag) {\n const tagName = tag.tag;\n if (typeof tags[tagName] === 'object') {\n tagValue = tags[tagName].match;\n errorMessage = tags[tagName].message;\n } else {\n tagValue = tags[tagName];\n }\n }\n\n const regex = utils.getRegexFromString(\n stringOrDefault(tagValue, matchDescription),\n );\n\n if (!regex.test(desc)) {\n report(\n errorMessage || 'JSDoc description does not satisfy the regex pattern.',\n null,\n tag || {\n // Add one as description would typically be into block\n line: jsdoc.source[0].number + 1,\n },\n );\n }\n };\n\n const {\n description,\n } = utils.getDescription();\n if (description) {\n validateDescription(description);\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasNoTag = (tagName) => {\n return !tags[tagName];\n };\n\n for (const tag of [\n 'description',\n 'summary',\n 'file',\n 'classdesc',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n if (hasNoTag(targetTagName)) {\n validateDescription(desc, matchingJsdocTag);\n }\n }, true);\n }\n\n if (nonemptyTags) {\n for (const tag of [\n 'copyright',\n 'example',\n 'see',\n 'todo',\n ]) {\n utils.forEachPreferredTag(tag, (matchingJsdocTag, targetTagName) => {\n const desc = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n\n if (hasNoTag(targetTagName) && !(/.+/v).test(desc)) {\n report(\n 'JSDoc description must not be empty.',\n null,\n matchingJsdocTag,\n );\n }\n });\n }\n }\n\n if (!Object.keys(tags).length) {\n return;\n }\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const hasOptionTag = (tagName) => {\n return Boolean(tags[tagName]);\n };\n\n const whitelistedTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return hasOptionTag(tagName);\n });\n const {\n tagsWithNames,\n tagsWithoutNames,\n } = utils.getTagsByType(whitelistedTags);\n\n tagsWithNames.some((tag) => {\n const desc = /** @type {string} */ (\n utils.getTagDescription(tag)\n ).replace(/^[\\- ]*/v, '')\n .trim();\n\n return validateDescription(desc, tag);\n });\n\n tagsWithoutNames.some((tag) => {\n const desc = (tag.name + ' ' + utils.getTagDescription(tag)).trim();\n\n return validateDescription(desc, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Enforces a regular expression pattern on descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied (e.g.,\n\\`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.md#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 mainDescription: {\n description: `If you wish to override the main block description without changing the\ndefault \\`match-description\\` (which can cascade to the \\`tags\\` with \\`true\\`),\nyou may use \\`mainDescription\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: '[A-Z].*\\\\\\\\.',\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\`\n\nThere is no need to add \\`mainDescription: true\\`, as by default, the main\nblock description (and only the main block description) is linted, though you\nmay disable checking it by setting it to \\`false\\`.\n\nYou may also provide an object with \\`message\\`:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n mainDescription: {\n message: 'Capitalize first word of JSDoc block descriptions',\n match: '[A-Z].*\\\\\\\\.'\n },\n tags: {\n param: true,\n returns: true\n }\n }]\n}\n\\`\\`\\``,\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n matchDescription: {\n description: `You can supply your own expression to override the default, passing a\n\\`matchDescription\\` string on the options object.\n\nDefaults to using (only) the \\`v\\` flag, so\nto add your own flags, encapsulate your expression as a string, but like a\nliteral, e.g., \\`/[A-Z].*\\\\./vi\\`.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\\\\\\\.'}]\n}\n\\`\\`\\``,\n format: 'regex',\n type: 'string',\n },\n message: {\n description: `You may provide a custom default message by using the following format:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {\n message: 'The default description should begin with a capital letter.'\n }]\n}\n\\`\\`\\`\n\nThis can be overridden per tag or for the main block description by setting\n\\`message\\` within \\`tags\\` or \\`mainDescription\\`, respectively.`,\n type: 'string',\n },\n nonemptyTags: {\n description: `If not set to \\`false\\`, will enforce that the following tags have at least\nsome content:\n\n- \\`@copyright\\`\n- \\`@example\\`\n- \\`@see\\`\n- \\`@todo\\`\n\nIf you supply your own tag description for any of the above tags in \\`tags\\`,\nyour description will take precedence.`,\n type: 'boolean',\n },\n tags: {\n description: `If you want different regular expressions to apply to tags, you may use\nthe \\`tags\\` option object:\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: '\\\\\\\\- [A-Z].*\\\\\\\\.',\n returns: '[A-Z].*\\\\\\\\.'\n }}]\n}\n\\`\\`\\`\n\nIn place of a string, you can also add \\`true\\` to indicate that a particular\ntag should be linted with the \\`matchDescription\\` value (or the default).\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: true,\n returns: true\n }}]\n}\n\\`\\`\\`\n\nAlternatively, you may supply an object with a \\`message\\` property to indicate\nthe error message for that tag.\n\n\\`\\`\\`js\n{\n 'jsdoc/match-description': ['error', {tags: {\n param: {message: 'Begin with a hyphen', match: '\\\\\\\\- [A-Z].*\\\\\\\\.'},\n returns: {message: 'Capitalize for returns (the default)', match: true}\n }}]\n}\n\\`\\`\\`\n\nThe tags \\`@param\\`/\\`@arg\\`/\\`@argument\\` and \\`@property\\`/\\`@prop\\` will be properly\nparsed to ensure that the matched \"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 patternProperties: {\n '.*': {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C;AACA;AACA,MAAM,uBAAuB,GAAG,qDAAqD;;AAErF;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK;EAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,GAC9B,KAAK,GACL,WAAW,IAAI,uBAAuB;AAC1C,CAAC;AAAC,iCAEa,IAAAA,qBAAY,EAAC,CAAC;EAC3B,OAAO;EACP,KAAK;EACL,MAAM;EACN;AACF,CAAC,KAAK;EACJ,MAAM;IACJ,eAAe;IACf,gBAAgB;IAChB,OAAO;IACP,YAAY,GAAG,IAAI;IACnB,IAAI,GAAG,CAAC;EACV,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;;EAE5B;AACF;AACA;AACA;AACA;EACE,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK;IACzC,IAAI,oBAAoB,GAAG,eAAe;IAC1C,IAAI,YAAY,GAAG,OAAO;IAC1B,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;MACvC,oBAAoB,GAAG,eAAe,CAAC,KAAK;MAC5C,YAAY,GAAG,eAAe,CAAC,OAAO;IACxC;IAEA,IAAI,oBAAoB,KAAK,KAAK,KAChC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,EACtC;MACA;IACF;IAEA,IAAI,QAAQ,GAAG,oBAAoB;IACnC,IAAI,GAAG,EAAE;MACP,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG;MACvB,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;QACrC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CA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;YACD,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACD,gBAAgB,EAAE;UAChB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACK,MAAM,EAAE,OAAO;UACf,IAAI,EAAE;QACR,CAAC;QACD,OAAO,EAAE;UACP,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;UACtD,IAAI,EAAE;QACR,CAAC;QACD,YAAY,EAAE;UACZ,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3B,IAAI,EAAE;QACR,CAAC;QACD,IAAI,EAAE;UACJ,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;UACD,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJ,KAAK,EAAE,CACL;gBACE,MAAM,EAAE,OAAO;gBACf,IAAI,EAAE;cACR,CAAC,EACD;gBACE,IAAI,EAAE,CACJ,IAAI,CACL;gBACD,IAAI,EAAE;cACR,CAAC,EACD;gBACE,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE;kBACV,KAAK,EAAE;oBACL,KAAK,EAAE,CACL;sBACE,MAAM,EAAE,OAAO;sBACf,IAAI,EAAE;oBACR,CAAC,EACD;sBACE,IAAI,EAAE,CACJ,IAAI,CACL;sBACD,IAAI,EAAE;oBACR,CAAC;kBAEL,CAAC;kBACD,OAAO,EAAE;oBACP,IAAI,EAAE;kBACR;gBACF,CAAC;gBACD,IAAI,EAAE;cACR,CAAC;YAEL;UACF,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
package/dist/rules/matchName.cjs
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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)(({
|
|
3
10
|
context,
|
|
4
11
|
info: {
|
|
5
12
|
lastIndex
|
|
@@ -149,4 +156,5 @@ will replace the matched \`disallowName\` text.`,
|
|
|
149
156
|
type: 'suggestion'
|
|
150
157
|
}
|
|
151
158
|
});
|
|
159
|
+
module.exports = exports.default;
|
|
152
160
|
//# sourceMappingURL=matchName.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchName.cjs","names":[],"sources":["../../src/rules/matchName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n info: {\n lastIndex,\n },\n jsdoc,\n report,\n utils,\n}) => {\n const {\n match,\n } = context.options[0] || {};\n if (!match) {\n report('Rule `no-restricted-syntax` is missing a `match` option.');\n\n return;\n }\n\n const {\n allowName,\n disallowName,\n replacement,\n tags = [\n '*',\n ],\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n\n const allowNameRegex = allowName && utils.getRegexFromString(allowName);\n const disallowNameRegex = disallowName && utils.getRegexFromString(disallowName);\n\n let applicableTags = jsdoc.tags;\n if (!tags.includes('*')) {\n applicableTags = utils.getPresentTags(tags);\n }\n\n let reported = false;\n for (const tag of applicableTags) {\n const tagName = tag.name.replace(/^\\[/v, '').replace(/(=.*)?\\]$/v, '');\n const allowed = !allowNameRegex || allowNameRegex.test(tagName);\n const disallowed = disallowNameRegex && disallowNameRegex.test(tagName);\n const hasRegex = allowNameRegex || disallowNameRegex;\n if (hasRegex && allowed && !disallowed) {\n continue;\n }\n\n if (!hasRegex && reported) {\n continue;\n }\n\n const fixer = () => {\n for (const src of tag.source) {\n if (src.tokens.name) {\n src.tokens.name = src.tokens.name.replace(\n disallowNameRegex, replacement,\n );\n break;\n }\n }\n };\n\n let {\n message,\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n if (!message) {\n if (hasRegex) {\n message = disallowed ?\n `Only allowing names not matching \\`${disallowNameRegex}\\` but found \"${tagName}\".` :\n `Only allowing names matching \\`${allowNameRegex}\\` but found \"${tagName}\".`;\n } else {\n message = `Prohibited context for \"${tagName}\".`;\n }\n }\n\n utils.reportJSDoc(\n message,\n hasRegex ? tag : null,\n\n // We could match up\n disallowNameRegex && replacement !== undefined ?\n fixer :\n null,\n false,\n {\n // Could also supply `context`, `comment`, `tags`\n allowName,\n disallowName,\n name: tagName,\n },\n );\n if (!hasRegex) {\n reported = true;\n }\n }\n}, {\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports the name portion of a JSDoc tag if matching or not matching a given regular expression.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-name.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n match: {\n description: `\\`match\\` is a required option containing an array of objects which determine\nthe conditions whereby a name is reported as being problematic.\n\nThese objects can have any combination of the following groups of optional\nproperties, all of which act to confine one another.\n\nNote that \\`comment\\`, even if targeting a specific tag, is used to match the\nwhole block. So if a \\`comment\\` finds its specific tag, it may still apply\nfixes found by the likes of \\`disallowName\\` even when a different tag has the\ndisallowed name. An alternative is to ensure that \\`comment\\` finds the specific\ntag of the desired tag and/or name and no \\`disallowName\\` (or \\`allowName\\`) is\nsupplied. In such a case, only one error will be reported, but no fixer will\nbe applied, however.`,\n items: {\n additionalProperties: false,\n properties: {\n allowName: {\n description: `Indicates which names are allowed for the given tag (or \\`*\\`).\nAccepts a string regular expression (optionally wrapped between two\n\\`/\\` delimiters followed by optional flags) used to match the name.`,\n type: 'string',\n },\n comment: {\n description: 'As with `context` but AST for the JSDoc block comment and types.',\n type: 'string',\n },\n context: {\n description: `AST to confine the allowing or disallowing to JSDoc blocks\nassociated with a particular context. See the\n[\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n type: 'string',\n },\n disallowName: {\n description: 'As with `allowName` but indicates names that are not allowed.',\n type: 'string',\n },\n message: {\n description: 'An optional custom message to use when there is a match.',\n type: 'string',\n },\n replacement: {\n description: `If \\`disallowName\\` is supplied and this value is present, it\nwill replace the matched \\`disallowName\\` text.`,\n type: 'string',\n },\n tags: {\n description: `This array should include tag names or \\`*\\` to indicate the\n match will apply for all tags (except as confined by any context\n properties). If \\`*\\` is not used, then these rules will only apply to\n the specified tags. If \\`tags\\` is omitted, then \\`*\\` is assumed.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n },\n required: [\n 'match',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"matchName.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/matchName.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n info: {\n lastIndex,\n },\n jsdoc,\n report,\n utils,\n}) => {\n const {\n match,\n } = context.options[0] || {};\n if (!match) {\n report('Rule `no-restricted-syntax` is missing a `match` option.');\n\n return;\n }\n\n const {\n allowName,\n disallowName,\n replacement,\n tags = [\n '*',\n ],\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n\n const allowNameRegex = allowName && utils.getRegexFromString(allowName);\n const disallowNameRegex = disallowName && utils.getRegexFromString(disallowName);\n\n let applicableTags = jsdoc.tags;\n if (!tags.includes('*')) {\n applicableTags = utils.getPresentTags(tags);\n }\n\n let reported = false;\n for (const tag of applicableTags) {\n const tagName = tag.name.replace(/^\\[/v, '').replace(/(=.*)?\\]$/v, '');\n const allowed = !allowNameRegex || allowNameRegex.test(tagName);\n const disallowed = disallowNameRegex && disallowNameRegex.test(tagName);\n const hasRegex = allowNameRegex || disallowNameRegex;\n if (hasRegex && allowed && !disallowed) {\n continue;\n }\n\n if (!hasRegex && reported) {\n continue;\n }\n\n const fixer = () => {\n for (const src of tag.source) {\n if (src.tokens.name) {\n src.tokens.name = src.tokens.name.replace(\n disallowNameRegex, replacement,\n );\n break;\n }\n }\n };\n\n let {\n message,\n } = match[/** @type {import('../iterateJsdoc.js').Integer} */ (lastIndex)];\n if (!message) {\n if (hasRegex) {\n message = disallowed ?\n `Only allowing names not matching \\`${disallowNameRegex}\\` but found \"${tagName}\".` :\n `Only allowing names matching \\`${allowNameRegex}\\` but found \"${tagName}\".`;\n } else {\n message = `Prohibited context for \"${tagName}\".`;\n }\n }\n\n utils.reportJSDoc(\n message,\n hasRegex ? tag : null,\n\n // We could match up\n disallowNameRegex && replacement !== undefined ?\n fixer :\n null,\n false,\n {\n // Could also supply `context`, `comment`, `tags`\n allowName,\n disallowName,\n name: tagName,\n },\n );\n if (!hasRegex) {\n reported = true;\n }\n }\n}, {\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports the name portion of a JSDoc tag if matching or not matching a given regular expression.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/match-name.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n match: {\n description: `\\`match\\` is a required option containing an array of objects which determine\nthe conditions whereby a name is reported as being problematic.\n\nThese objects can have any combination of the following groups of optional\nproperties, all of which act to confine one another.\n\nNote that \\`comment\\`, even if targeting a specific tag, is used to match the\nwhole block. So if a \\`comment\\` finds its specific tag, it may still apply\nfixes found by the likes of \\`disallowName\\` even when a different tag has the\ndisallowed name. An alternative is to ensure that \\`comment\\` finds the specific\ntag of the desired tag and/or name and no \\`disallowName\\` (or \\`allowName\\`) is\nsupplied. In such a case, only one error will be reported, but no fixer will\nbe applied, however.`,\n items: {\n additionalProperties: false,\n properties: {\n allowName: {\n description: `Indicates which names are allowed for the given tag (or \\`*\\`).\nAccepts a string regular expression (optionally wrapped between two\n\\`/\\` delimiters followed by optional flags) used to match the name.`,\n type: 'string',\n },\n comment: {\n description: 'As with `context` but AST for the JSDoc block comment and types.',\n type: 'string',\n },\n context: {\n description: `AST to confine the allowing or disallowing to JSDoc blocks\nassociated with a particular context. See the\n[\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n type: 'string',\n },\n disallowName: {\n description: 'As with `allowName` but indicates names that are not allowed.',\n type: 'string',\n },\n message: {\n description: 'An optional custom message to use when there is a match.',\n type: 'string',\n },\n replacement: {\n description: `If \\`disallowName\\` is supplied and this value is present, it\nwill replace the matched \\`disallowName\\` text.`,\n type: 'string',\n },\n tags: {\n description: `This array should include tag names or \\`*\\` to indicate the\n match will apply for all tags (except as confined by any context\n properties). If \\`*\\` is not used, then these rules will only apply to\n the specified tags. If \\`tags\\` is omitted, then \\`*\\` is assumed.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n type: 'array',\n },\n },\n required: [\n 'match',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAAA,iCAE/B,IAAAA,qBAAY,EAAC,CAAC;EAC3B,OAAO;EACP,IAAI,EAAE;IACJ;EACF,CAAC;EACD,KAAK;EACL,MAAM;EACN;AACF,CAAC,KAAK;EACJ,MAAM;IACJ;EACF,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAC5B,IAAI,CAAC,KAAK,EAAE;IACV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AC5C,IAAI,EAAE;cACR,CAAC;cACD,YAAY,EAAE;gBACZ,WAAW,EAAE,+DAA+D;gBAC5E,IAAI,EAAE;cACR,CAAC;cACD,OAAO,EAAE;gBACP,WAAW,EAAE,0DAA0D;gBACvE,IAAI,EAAE;cACR,CAAC;cACD,WAAW,EAAE;gBACX,WAAW,EAAE;AAC/B,gDAAgD;gBAC9B,IAAI,EAAE;cACR,CAAC;cACD,IAAI,EAAE;gBACJ,WAAW,EAAE;AAC/B;AACA;AACA,qEAAqE;gBACnD,KAAK,EAAE;kBACL,IAAI,EAAE;gBACR,CAAC;gBACD,IAAI,EAAE;cACR;YACF,CAAC;YACD,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,QAAQ,EAAE,CACR,OAAO,CACR;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
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 }; }
|
|
3
9
|
/**
|
|
4
10
|
* @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc
|
|
5
11
|
* @param {import('../iterateJsdoc.js').Utils} utils
|
|
@@ -115,7 +121,7 @@ const checkForShortDescriptions = (jsdoc, utils, requireSingleLineUnderCount) =>
|
|
|
115
121
|
}
|
|
116
122
|
return false;
|
|
117
123
|
};
|
|
118
|
-
|
|
124
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
119
125
|
context,
|
|
120
126
|
jsdoc,
|
|
121
127
|
utils
|
|
@@ -421,4 +427,5 @@ Defaults to \`['lends', 'type']\`.`,
|
|
|
421
427
|
type: 'suggestion'
|
|
422
428
|
}
|
|
423
429
|
});
|
|
430
|
+
module.exports = exports.default;
|
|
424
431
|
//# sourceMappingURL=multilineBlocks.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multilineBlocks.cjs","names":[],"sources":["../../src/rules/multilineBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {number} requireSingleLineUnderCount\n */\nconst checkForShortTags = (jsdoc, utils, requireSingleLineUnderCount) => {\n if (!requireSingleLineUnderCount || !jsdoc.tags.length) {\n return false;\n }\n\n let lastLineWithTag = 0;\n let isUnderCountLimit = false;\n let hasMultiDescOrType = false;\n const tagLines = jsdoc.source.reduce((acc, {\n tokens: {\n delimiter,\n description: desc,\n name,\n postDelimiter,\n postName,\n postTag,\n postType,\n start,\n tag,\n type,\n },\n }, idx) => {\n if (tag.length) {\n lastLineWithTag = idx;\n if (\n start.length + delimiter.length + postDelimiter.length +\n type.length + postType.length + name.length + postName.length +\n tag.length + postTag.length + desc.length <\n requireSingleLineUnderCount\n ) {\n isUnderCountLimit = true;\n }\n\n return acc + 1;\n } else if (desc.length || type.length) {\n hasMultiDescOrType = true;\n return acc;\n }\n\n return acc;\n }, 0);\n // Could be tagLines > 1\n if (!hasMultiDescOrType && isUnderCountLimit && tagLines === 1) {\n const fixer = () => {\n const tokens = jsdoc.source[lastLineWithTag].tokens;\n jsdoc.source = [\n {\n number: 0,\n source: '',\n tokens: utils.seedTokens({\n delimiter: '/**',\n description: tokens.description.trimEnd() + ' ',\n end: '*/',\n name: tokens.name,\n postDelimiter: ' ',\n postName: tokens.postName,\n postTag: tokens.postTag,\n postType: tokens.postType,\n start: jsdoc.source[0].tokens.start,\n tag: tokens.tag,\n type: tokens.type,\n }),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Description is too short to be multi-line.',\n null,\n fixer,\n );\n return true;\n }\n\n return false;\n};\n\n/**\n * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {number} requireSingleLineUnderCount\n */\nconst checkForShortDescriptions = (jsdoc, utils, requireSingleLineUnderCount) => {\n if (!requireSingleLineUnderCount || jsdoc.tags.length) {\n return false;\n }\n\n let lastLineWithDesc = 0;\n let isUnderCountLimit = false;\n const descLines = jsdoc.source.reduce((acc, {\n tokens: {\n delimiter,\n description: desc,\n postDelimiter,\n start,\n },\n }, idx) => {\n if (desc.length) {\n lastLineWithDesc = idx;\n if (\n start.length + delimiter.length + postDelimiter.length + desc.length <\n requireSingleLineUnderCount\n ) {\n isUnderCountLimit = true;\n }\n\n return acc + 1;\n }\n\n return acc;\n }, 0);\n // Could be descLines > 1\n if (isUnderCountLimit && descLines === 1) {\n const fixer = () => {\n const desc = jsdoc.source[lastLineWithDesc].tokens.description;\n jsdoc.source = [\n {\n number: 0,\n source: '',\n tokens: utils.seedTokens({\n delimiter: '/**',\n description: desc.trimEnd() + ' ',\n end: '*/',\n postDelimiter: ' ',\n start: jsdoc.source[0].tokens.start,\n }),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Description is too short to be multi-line.',\n null,\n fixer,\n );\n return true;\n }\n\n return false;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n allowMultipleTags = true,\n minimumLengthForMultiline = Number.POSITIVE_INFINITY,\n multilineTags = [\n '*',\n ],\n noFinalLineText = true,\n noMultilineBlocks = false,\n noSingleLineBlocks = false,\n noZeroLineText = true,\n requireSingleLineUnderCount = null,\n singleLineTags = [\n 'lends', 'type',\n ],\n } = context.options[0] || {};\n\n const {\n source: [\n {\n tokens,\n },\n ],\n } = jsdoc;\n const {\n description,\n tag,\n } = tokens;\n const sourceLength = jsdoc.source.length;\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const isInvalidSingleLine = (tagName) => {\n return noSingleLineBlocks &&\n (!tagName ||\n !singleLineTags.includes(tagName) && !singleLineTags.includes('*'));\n };\n\n if (sourceLength === 1) {\n if (!isInvalidSingleLine(tag.slice(1))) {\n return;\n }\n\n const fixer = () => {\n utils.makeMultiline();\n };\n\n utils.reportJSDoc(\n 'Single line blocks are not permitted by your configuration.',\n null,\n fixer,\n true,\n );\n\n return;\n }\n\n if (checkForShortDescriptions(jsdoc, utils, requireSingleLineUnderCount)\n ) {\n return;\n }\n\n if (checkForShortTags(jsdoc, utils, requireSingleLineUnderCount)\n ) {\n return;\n }\n\n const lineChecks = () => {\n if (\n noZeroLineText &&\n (tag || description)\n ) {\n const fixer = () => {\n const line = {\n ...tokens,\n };\n utils.emptyTokens(tokens);\n const {\n tokens: {\n delimiter,\n start,\n },\n } = jsdoc.source[1];\n utils.addLine(1, {\n ...line,\n delimiter,\n start,\n });\n };\n\n utils.reportJSDoc(\n 'Should have no text on the \"0th\" line (after the `/**`).',\n null,\n fixer,\n );\n\n return;\n }\n\n const finalLine = jsdoc.source[jsdoc.source.length - 1];\n const finalLineTokens = finalLine.tokens;\n if (\n noFinalLineText &&\n finalLineTokens.description.trim()\n ) {\n const fixer = () => {\n const line = {\n ...finalLineTokens,\n };\n line.description = line.description.trimEnd();\n\n const {\n delimiter,\n } = line;\n\n for (const prop of [\n 'delimiter',\n 'postDelimiter',\n 'tag',\n 'type',\n 'lineEnd',\n 'postType',\n 'postTag',\n 'name',\n 'postName',\n 'description',\n ]) {\n finalLineTokens[\n /**\n * @type {\"delimiter\"|\"postDelimiter\"|\"tag\"|\"type\"|\n * \"lineEnd\"|\"postType\"|\"postTag\"|\"name\"|\n * \"postName\"|\"description\"}\n */ (\n prop\n )\n ] = '';\n }\n\n utils.addLine(jsdoc.source.length - 1, {\n ...line,\n delimiter,\n end: '',\n });\n };\n\n utils.reportJSDoc(\n 'Should have no text on the final line (before the `*/`).',\n null,\n fixer,\n );\n }\n };\n\n if (noMultilineBlocks) {\n if (\n jsdoc.tags.length &&\n (multilineTags.includes('*') || utils.hasATag(multilineTags))\n ) {\n lineChecks();\n\n return;\n }\n\n if (jsdoc.description.length >= minimumLengthForMultiline) {\n lineChecks();\n\n return;\n }\n\n if (\n noSingleLineBlocks &&\n (!jsdoc.tags.length ||\n !utils.filterTags(({\n tag: tg,\n }) => {\n return !isInvalidSingleLine(tg);\n }).length)\n ) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but fixing would result in a single ' +\n 'line block which you have prohibited with `noSingleLineBlocks`.',\n );\n\n return;\n }\n\n if (jsdoc.tags.length > 1) {\n if (!allowMultipleTags) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but the block has multiple tags.',\n );\n\n return;\n }\n } else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {\n if (!allowMultipleTags) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but the block has a description with a tag.',\n );\n\n return;\n }\n } else {\n const fixer = () => {\n jsdoc.source = [\n {\n number: 1,\n source: '',\n tokens: jsdoc.source.reduce((obj, {\n tokens: {\n description: desc,\n lineEnd,\n name: nme,\n postName,\n postTag,\n postType,\n tag: tg,\n type: typ,\n },\n }) => {\n if (typ) {\n obj.type = typ;\n }\n\n if (tg && typ && nme) {\n obj.postType = postType;\n }\n\n if (nme) {\n obj.name += nme;\n }\n\n if (nme && desc) {\n obj.postName = postName;\n }\n\n obj.description += desc;\n\n const nameOrDescription = obj.description || obj.name;\n if (\n nameOrDescription && nameOrDescription.slice(-1) !== ' '\n ) {\n obj.description += ' ';\n }\n\n obj.lineEnd = lineEnd;\n\n // Already filtered for multiple tags\n obj.tag += tg;\n if (tg) {\n obj.postTag = postTag || ' ';\n }\n\n return obj;\n }, utils.seedTokens({\n delimiter: '/**',\n end: '*/',\n postDelimiter: ' ',\n })),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration.',\n null,\n fixer,\n );\n\n return;\n }\n }\n\n lineChecks();\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowMultipleTags: {\n description: `If \\`noMultilineBlocks\\` is set to \\`true\\` with this option and multiple tags are\nfound in a block, an error will not be reported.\n\nSince multiple-tagged lines cannot be collapsed into a single line, this option\nprevents them from being reported. Set to \\`false\\` if you really want to report\nany blocks.\n\nThis option will also be applied when there is a block description and a single\ntag (since a description cannot precede a tag on a single line, and also\ncannot be reliably added after the tag either).\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n minimumLengthForMultiline: {\n description: `If \\`noMultilineBlocks\\` is set with this numeric option, multiline blocks will\nbe permitted if containing at least the given amount of text.\n\nIf not set, multiline blocks will not be permitted regardless of length unless\na relevant tag is present and \\`multilineTags\\` is set.\n\nDefaults to not being in effect.`,\n type: 'integer',\n },\n multilineTags: {\n anyOf: [\n {\n enum: [\n '*',\n ],\n type: 'string',\n }, {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ],\n description: `If \\`noMultilineBlocks\\` is set with this option, multiline blocks may be allowed\nregardless of length as long as a tag or a tag of a certain type is present.\n\nIf \\`*\\` is included in the array, the presence of a tags will allow for\nmultiline blocks (but not when without any tags unless the amount of text is\nover an amount specified by \\`minimumLengthForMultiline\\`).\n\nIf the array does not include \\`*\\` but lists certain tags, the presence of\nsuch a tag will cause multiline blocks to be allowed.\n\nYou may set this to an empty array to prevent any tag from permitting multiple\nlines.\n\nDefaults to \\`['*']\\`.`,\n },\n noFinalLineText: {\n description: `For multiline blocks, any non-whitespace text preceding the \\`*/\\` on the final\nline will be reported. (Text preceding a newline is not reported.)\n\n\\`noMultilineBlocks\\` will have priority over this rule if it applies.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n noMultilineBlocks: {\n description: `Requires that JSDoc blocks are restricted to single lines only unless impacted\nby the options \\`minimumLengthForMultiline\\`, \\`multilineTags\\`, or\n\\`allowMultipleTags\\`.\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n noSingleLineBlocks: {\n description: `If this is \\`true\\`, any single line blocks will be reported, except those which\nare whitelisted in \\`singleLineTags\\`.\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n noZeroLineText: {\n description: `For multiline blocks, any non-whitespace text immediately after the \\`/**\\` and\nspace will be reported. (Text after a newline is not reported.)\n\n\\`noMultilineBlocks\\` will have priority over this rule if it applies.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n requireSingleLineUnderCount: {\n description: `If this number is set, it indicates a minimum line width for a single line of\nJSDoc content spread over a multi-line comment block. If a single line is under\nthe minimum length, it will be reported so as to enforce single line JSDoc blocks\nfor such cases. Blocks are not reported which have multi-line descriptions,\nmultiple tags, a block description and tag, or tags with multi-line types or\ndescriptions.\n\nDefaults to \\`null\\`.`,\n type: 'number',\n },\n singleLineTags: {\n description: `An array of tags which can nevertheless be allowed as single line blocks when\n\\`noSingleLineBlocks\\` is set. You may set this to a empty array to\ncause all single line blocks to be reported. If \\`'*'\\` is present, then\nthe presence of a tag will allow single line blocks (but not if a tag is\nmissing).\n\nDefaults to \\`['lends', 'type']\\`.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;;AAE7C;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,2BAA2B,KAAK;EACvE,IAAI,CAAC,2BAA2B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;IACtD,OAAO,K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L;YACE,IAAI,EAAE,CACJ,GAAG,CACJ;YACD,IAAI,EAAE;UACR,CAAC,EAAE;YACD,KAAK,EAAE;cACL,IAAI,EAAE;YACR,CAAC;YACD,IAAI,EAAE;UACR,CAAC,CACF;UACD,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;QACU,CAAC;QACD,eAAe,EAAE;UACf,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,iBAAiB,EAAE;UACjB,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACX,IAAI,EAAE;QACR,CAAC;QACD,kBAAkB,EAAE;UAClB,WAAW,EAAE;AACzB;AACA;AACA,uBAAuB;UACX,IAAI,EAAE;QACR,CAAC;QACD,cAAc,EAAE;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,2BAA2B,EAAE;UAC3B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,cAAc,EAAE;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,mCAAmC;UACvB,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"multilineBlocks.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/multilineBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {number} requireSingleLineUnderCount\n */\nconst checkForShortTags = (jsdoc, utils, requireSingleLineUnderCount) => {\n if (!requireSingleLineUnderCount || !jsdoc.tags.length) {\n return false;\n }\n\n let lastLineWithTag = 0;\n let isUnderCountLimit = false;\n let hasMultiDescOrType = false;\n const tagLines = jsdoc.source.reduce((acc, {\n tokens: {\n delimiter,\n description: desc,\n name,\n postDelimiter,\n postName,\n postTag,\n postType,\n start,\n tag,\n type,\n },\n }, idx) => {\n if (tag.length) {\n lastLineWithTag = idx;\n if (\n start.length + delimiter.length + postDelimiter.length +\n type.length + postType.length + name.length + postName.length +\n tag.length + postTag.length + desc.length <\n requireSingleLineUnderCount\n ) {\n isUnderCountLimit = true;\n }\n\n return acc + 1;\n } else if (desc.length || type.length) {\n hasMultiDescOrType = true;\n return acc;\n }\n\n return acc;\n }, 0);\n // Could be tagLines > 1\n if (!hasMultiDescOrType && isUnderCountLimit && tagLines === 1) {\n const fixer = () => {\n const tokens = jsdoc.source[lastLineWithTag].tokens;\n jsdoc.source = [\n {\n number: 0,\n source: '',\n tokens: utils.seedTokens({\n delimiter: '/**',\n description: tokens.description.trimEnd() + ' ',\n end: '*/',\n name: tokens.name,\n postDelimiter: ' ',\n postName: tokens.postName,\n postTag: tokens.postTag,\n postType: tokens.postType,\n start: jsdoc.source[0].tokens.start,\n tag: tokens.tag,\n type: tokens.type,\n }),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Description is too short to be multi-line.',\n null,\n fixer,\n );\n return true;\n }\n\n return false;\n};\n\n/**\n * @param {import('@es-joy/jsdoccomment').JsdocBlockWithInline} jsdoc\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {number} requireSingleLineUnderCount\n */\nconst checkForShortDescriptions = (jsdoc, utils, requireSingleLineUnderCount) => {\n if (!requireSingleLineUnderCount || jsdoc.tags.length) {\n return false;\n }\n\n let lastLineWithDesc = 0;\n let isUnderCountLimit = false;\n const descLines = jsdoc.source.reduce((acc, {\n tokens: {\n delimiter,\n description: desc,\n postDelimiter,\n start,\n },\n }, idx) => {\n if (desc.length) {\n lastLineWithDesc = idx;\n if (\n start.length + delimiter.length + postDelimiter.length + desc.length <\n requireSingleLineUnderCount\n ) {\n isUnderCountLimit = true;\n }\n\n return acc + 1;\n }\n\n return acc;\n }, 0);\n // Could be descLines > 1\n if (isUnderCountLimit && descLines === 1) {\n const fixer = () => {\n const desc = jsdoc.source[lastLineWithDesc].tokens.description;\n jsdoc.source = [\n {\n number: 0,\n source: '',\n tokens: utils.seedTokens({\n delimiter: '/**',\n description: desc.trimEnd() + ' ',\n end: '*/',\n postDelimiter: ' ',\n start: jsdoc.source[0].tokens.start,\n }),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Description is too short to be multi-line.',\n null,\n fixer,\n );\n return true;\n }\n\n return false;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n allowMultipleTags = true,\n minimumLengthForMultiline = Number.POSITIVE_INFINITY,\n multilineTags = [\n '*',\n ],\n noFinalLineText = true,\n noMultilineBlocks = false,\n noSingleLineBlocks = false,\n noZeroLineText = true,\n requireSingleLineUnderCount = null,\n singleLineTags = [\n 'lends', 'type',\n ],\n } = context.options[0] || {};\n\n const {\n source: [\n {\n tokens,\n },\n ],\n } = jsdoc;\n const {\n description,\n tag,\n } = tokens;\n const sourceLength = jsdoc.source.length;\n\n /**\n * @param {string} tagName\n * @returns {boolean}\n */\n const isInvalidSingleLine = (tagName) => {\n return noSingleLineBlocks &&\n (!tagName ||\n !singleLineTags.includes(tagName) && !singleLineTags.includes('*'));\n };\n\n if (sourceLength === 1) {\n if (!isInvalidSingleLine(tag.slice(1))) {\n return;\n }\n\n const fixer = () => {\n utils.makeMultiline();\n };\n\n utils.reportJSDoc(\n 'Single line blocks are not permitted by your configuration.',\n null,\n fixer,\n true,\n );\n\n return;\n }\n\n if (checkForShortDescriptions(jsdoc, utils, requireSingleLineUnderCount)\n ) {\n return;\n }\n\n if (checkForShortTags(jsdoc, utils, requireSingleLineUnderCount)\n ) {\n return;\n }\n\n const lineChecks = () => {\n if (\n noZeroLineText &&\n (tag || description)\n ) {\n const fixer = () => {\n const line = {\n ...tokens,\n };\n utils.emptyTokens(tokens);\n const {\n tokens: {\n delimiter,\n start,\n },\n } = jsdoc.source[1];\n utils.addLine(1, {\n ...line,\n delimiter,\n start,\n });\n };\n\n utils.reportJSDoc(\n 'Should have no text on the \"0th\" line (after the `/**`).',\n null,\n fixer,\n );\n\n return;\n }\n\n const finalLine = jsdoc.source[jsdoc.source.length - 1];\n const finalLineTokens = finalLine.tokens;\n if (\n noFinalLineText &&\n finalLineTokens.description.trim()\n ) {\n const fixer = () => {\n const line = {\n ...finalLineTokens,\n };\n line.description = line.description.trimEnd();\n\n const {\n delimiter,\n } = line;\n\n for (const prop of [\n 'delimiter',\n 'postDelimiter',\n 'tag',\n 'type',\n 'lineEnd',\n 'postType',\n 'postTag',\n 'name',\n 'postName',\n 'description',\n ]) {\n finalLineTokens[\n /**\n * @type {\"delimiter\"|\"postDelimiter\"|\"tag\"|\"type\"|\n * \"lineEnd\"|\"postType\"|\"postTag\"|\"name\"|\n * \"postName\"|\"description\"}\n */ (\n prop\n )\n ] = '';\n }\n\n utils.addLine(jsdoc.source.length - 1, {\n ...line,\n delimiter,\n end: '',\n });\n };\n\n utils.reportJSDoc(\n 'Should have no text on the final line (before the `*/`).',\n null,\n fixer,\n );\n }\n };\n\n if (noMultilineBlocks) {\n if (\n jsdoc.tags.length &&\n (multilineTags.includes('*') || utils.hasATag(multilineTags))\n ) {\n lineChecks();\n\n return;\n }\n\n if (jsdoc.description.length >= minimumLengthForMultiline) {\n lineChecks();\n\n return;\n }\n\n if (\n noSingleLineBlocks &&\n (!jsdoc.tags.length ||\n !utils.filterTags(({\n tag: tg,\n }) => {\n return !isInvalidSingleLine(tg);\n }).length)\n ) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but fixing would result in a single ' +\n 'line block which you have prohibited with `noSingleLineBlocks`.',\n );\n\n return;\n }\n\n if (jsdoc.tags.length > 1) {\n if (!allowMultipleTags) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but the block has multiple tags.',\n );\n\n return;\n }\n } else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {\n if (!allowMultipleTags) {\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration but the block has a description with a tag.',\n );\n\n return;\n }\n } else {\n const fixer = () => {\n jsdoc.source = [\n {\n number: 1,\n source: '',\n tokens: jsdoc.source.reduce((obj, {\n tokens: {\n description: desc,\n lineEnd,\n name: nme,\n postName,\n postTag,\n postType,\n tag: tg,\n type: typ,\n },\n }) => {\n if (typ) {\n obj.type = typ;\n }\n\n if (tg && typ && nme) {\n obj.postType = postType;\n }\n\n if (nme) {\n obj.name += nme;\n }\n\n if (nme && desc) {\n obj.postName = postName;\n }\n\n obj.description += desc;\n\n const nameOrDescription = obj.description || obj.name;\n if (\n nameOrDescription && nameOrDescription.slice(-1) !== ' '\n ) {\n obj.description += ' ';\n }\n\n obj.lineEnd = lineEnd;\n\n // Already filtered for multiple tags\n obj.tag += tg;\n if (tg) {\n obj.postTag = postTag || ' ';\n }\n\n return obj;\n }, utils.seedTokens({\n delimiter: '/**',\n end: '*/',\n postDelimiter: ' ',\n })),\n },\n ];\n };\n\n utils.reportJSDoc(\n 'Multiline JSDoc blocks are prohibited by ' +\n 'your configuration.',\n null,\n fixer,\n );\n\n return;\n }\n }\n\n lineChecks();\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowMultipleTags: {\n description: `If \\`noMultilineBlocks\\` is set to \\`true\\` with this option and multiple tags are\nfound in a block, an error will not be reported.\n\nSince multiple-tagged lines cannot be collapsed into a single line, this option\nprevents them from being reported. Set to \\`false\\` if you really want to report\nany blocks.\n\nThis option will also be applied when there is a block description and a single\ntag (since a description cannot precede a tag on a single line, and also\ncannot be reliably added after the tag either).\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n minimumLengthForMultiline: {\n description: `If \\`noMultilineBlocks\\` is set with this numeric option, multiline blocks will\nbe permitted if containing at least the given amount of text.\n\nIf not set, multiline blocks will not be permitted regardless of length unless\na relevant tag is present and \\`multilineTags\\` is set.\n\nDefaults to not being in effect.`,\n type: 'integer',\n },\n multilineTags: {\n anyOf: [\n {\n enum: [\n '*',\n ],\n type: 'string',\n }, {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ],\n description: `If \\`noMultilineBlocks\\` is set with this option, multiline blocks may be allowed\nregardless of length as long as a tag or a tag of a certain type is present.\n\nIf \\`*\\` is included in the array, the presence of a tags will allow for\nmultiline blocks (but not when without any tags unless the amount of text is\nover an amount specified by \\`minimumLengthForMultiline\\`).\n\nIf the array does not include \\`*\\` but lists certain tags, the presence of\nsuch a tag will cause multiline blocks to be allowed.\n\nYou may set this to an empty array to prevent any tag from permitting multiple\nlines.\n\nDefaults to \\`['*']\\`.`,\n },\n noFinalLineText: {\n description: `For multiline blocks, any non-whitespace text preceding the \\`*/\\` on the final\nline will be reported. (Text preceding a newline is not reported.)\n\n\\`noMultilineBlocks\\` will have priority over this rule if it applies.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n noMultilineBlocks: {\n description: `Requires that JSDoc blocks are restricted to single lines only unless impacted\nby the options \\`minimumLengthForMultiline\\`, \\`multilineTags\\`, or\n\\`allowMultipleTags\\`.\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n noSingleLineBlocks: {\n description: `If this is \\`true\\`, any single line blocks will be reported, except those which\nare whitelisted in \\`singleLineTags\\`.\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n noZeroLineText: {\n description: `For multiline blocks, any non-whitespace text immediately after the \\`/**\\` and\nspace will be reported. (Text after a newline is not reported.)\n\n\\`noMultilineBlocks\\` will have priority over this rule if it applies.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n requireSingleLineUnderCount: {\n description: `If this number is set, it indicates a minimum line width for a single line of\nJSDoc content spread over a multi-line comment block. If a single line is under\nthe minimum length, it will be reported so as to enforce single line JSDoc blocks\nfor such cases. Blocks are not reported which have multi-line descriptions,\nmultiple tags, a block description and tag, or tags with multi-line types or\ndescriptions.\n\nDefaults to \\`null\\`.`,\n type: 'number',\n },\n singleLineTags: {\n description: `An array of tags which can nevertheless be allowed as single line blocks when\n\\`noSingleLineBlocks\\` is set. You may set this to a empty array to\ncause all single line blocks to be reported. If \\`'*'\\` is present, then\nthe presence of a tag will allow single line blocks (but not if a tag is\nmissing).\n\nDefaults to \\`['lends', 'type']\\`.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,2BAA2B,KAAK;EACvE,IAAI,CAAC,2BAA2B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;IACtD,OAAO,KAAK;EACd;EAEA,IAAI,eAAe,GAAG,CAAC;EACvB,IAAI,iBAAiB,GAAG,KAAK;EAC7B,IAAI,kBAAkB,GAAG,KAAK;EAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE;IACzC,MAAM,EAAE;MACN,SAAS;MACT,WAAW,EAAE,IAAI;MACjB,IAAI;MACJ,aAAa;MACb,QAAQ;MACR,OAAO;MACP,QAAQ;MACR,KAAK;MACL,GAAG;MACH;IACF;EACF,CAAC,EAAE,GAAG,KAAK;IACT,IAAI,GAAG,CAAC,MAAM,EAAE;MACd,eAAe,GAAG,GAAG;MACrB,IACE,KAAK,CAAC,MAAM,G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BAAkB,EAAE;UAClB,WAAW,EAAE;AACzB;AACA;AACA,uBAAuB;UACX,IAAI,EAAE;QACR,CAAC;QACD,cAAc,EAAE;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,2BAA2B,EAAE;UAC3B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACV,IAAI,EAAE;QACR,CAAC;QACD,cAAc,EAAE;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,mCAAmC;UACvB,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import { parse as commentParser } from 'comment-parser';
|
|
1
|
+
"use strict";
|
|
3
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
|
|
8
|
+
var _commentParser = require("comment-parser");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
4
10
|
// Neither a single nor 3+ asterisks are valid JSDoc per
|
|
5
11
|
// https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code
|
|
6
12
|
const commentRegexp = /^\/\*(?!\*)/v;
|
|
7
13
|
const extraAsteriskCommentRegexp = /^\/\*{3,}/v;
|
|
8
|
-
|
|
14
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
9
15
|
allComments,
|
|
10
16
|
context,
|
|
11
17
|
makeReport,
|
|
@@ -36,7 +42,7 @@ export default iterateJsdoc(({
|
|
|
36
42
|
return true;
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
|
-
const tags = (
|
|
45
|
+
const tags = ((0, _commentParser.parse)(`${commentText.slice(0, 2)}*${commentText.slice(sliceIndex)}`)[0] || {}).tags ?? [];
|
|
40
46
|
return tags.length && !tags.some(({
|
|
41
47
|
tag
|
|
42
48
|
}) => {
|
|
@@ -90,4 +96,5 @@ apparent tag content.`,
|
|
|
90
96
|
type: 'layout'
|
|
91
97
|
}
|
|
92
98
|
});
|
|
99
|
+
module.exports = exports.default;
|
|
93
100
|
//# sourceMappingURL=noBadBlocks.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noBadBlocks.cjs","names":[],"sources":["../../src/rules/noBadBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as commentParser,\n} from 'comment-parser';\n\n// Neither a single nor 3+ asterisks are valid JSDoc per\n// https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code\nconst commentRegexp = /^\\/\\*(?!\\*)/v;\nconst extraAsteriskCommentRegexp = /^\\/\\*{3,}/v;\n\nexport default iterateJsdoc(({\n allComments,\n context,\n makeReport,\n sourceCode,\n}) => {\n const [\n {\n ignore = [\n 'ts-check',\n 'ts-expect-error',\n 'ts-ignore',\n 'ts-nocheck',\n ],\n preventAllMultiAsteriskBlocks = false,\n } = {},\n ] = context.options;\n\n let extraAsterisks = false;\n const nonJsdocNodes = /** @type {import('estree').Node[]} */ (\n allComments\n ).filter((comment) => {\n const commentText = sourceCode.getText(comment);\n\n const initialText = commentText.replace(commentRegexp, '').trimStart();\n if ([\n 'eslint',\n ].some((directive) => {\n return initialText.startsWith(directive);\n })) {\n return false;\n }\n\n let sliceIndex = 2;\n if (!commentRegexp.test(commentText)) {\n const multiline = extraAsteriskCommentRegexp.exec(commentText)?.[0];\n if (!multiline) {\n return false;\n }\n\n sliceIndex = multiline.length;\n extraAsterisks = true;\n if (preventAllMultiAsteriskBlocks) {\n return true;\n }\n }\n\n const tags = (commentParser(\n `${commentText.slice(0, 2)}*${commentText.slice(sliceIndex)}`,\n )[0] || {}).tags ?? [];\n\n return tags.length && !tags.some(({\n tag,\n }) => {\n return ignore.includes(tag);\n });\n });\n\n if (!nonJsdocNodes.length) {\n return;\n }\n\n for (const node of nonJsdocNodes) {\n const report = /** @type {import('../iterateJsdoc.js').MakeReport} */ (\n makeReport\n )(context, node);\n\n // eslint-disable-next-line no-loop-func\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n const text = sourceCode.getText(node);\n\n return fixer.replaceText(\n node,\n extraAsterisks ?\n text.replace(extraAsteriskCommentRegexp, '/**') :\n text.replace('/*', '/**'),\n );\n };\n\n report('Expected JSDoc-like comment to begin with two asterisks.', fix);\n }\n}, {\n checkFile: true,\n meta: {\n docs: {\n description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n ignore: {\n description: `An array of directives that will not be reported if present at the beginning of\na multi-comment block and at-sign \\`/* @\\`.\n\nDefaults to \\`['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']\\`\n(some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n preventAllMultiAsteriskBlocks: {\n description: `A boolean (defaulting to \\`false\\`) which if \\`true\\` will prevent all\nJSDoc-like blocks with more than two initial asterisks even those without\napparent tag content.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"noBadBlocks.cjs","names":["iterateJsdoc","commentParser"],"sources":["../../src/rules/noBadBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as commentParser,\n} from 'comment-parser';\n\n// Neither a single nor 3+ asterisks are valid JSDoc per\n// https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code\nconst commentRegexp = /^\\/\\*(?!\\*)/v;\nconst extraAsteriskCommentRegexp = /^\\/\\*{3,}/v;\n\nexport default iterateJsdoc(({\n allComments,\n context,\n makeReport,\n sourceCode,\n}) => {\n const [\n {\n ignore = [\n 'ts-check',\n 'ts-expect-error',\n 'ts-ignore',\n 'ts-nocheck',\n ],\n preventAllMultiAsteriskBlocks = false,\n } = {},\n ] = context.options;\n\n let extraAsterisks = false;\n const nonJsdocNodes = /** @type {import('estree').Node[]} */ (\n allComments\n ).filter((comment) => {\n const commentText = sourceCode.getText(comment);\n\n const initialText = commentText.replace(commentRegexp, '').trimStart();\n if ([\n 'eslint',\n ].some((directive) => {\n return initialText.startsWith(directive);\n })) {\n return false;\n }\n\n let sliceIndex = 2;\n if (!commentRegexp.test(commentText)) {\n const multiline = extraAsteriskCommentRegexp.exec(commentText)?.[0];\n if (!multiline) {\n return false;\n }\n\n sliceIndex = multiline.length;\n extraAsterisks = true;\n if (preventAllMultiAsteriskBlocks) {\n return true;\n }\n }\n\n const tags = (commentParser(\n `${commentText.slice(0, 2)}*${commentText.slice(sliceIndex)}`,\n )[0] || {}).tags ?? [];\n\n return tags.length && !tags.some(({\n tag,\n }) => {\n return ignore.includes(tag);\n });\n });\n\n if (!nonJsdocNodes.length) {\n return;\n }\n\n for (const node of nonJsdocNodes) {\n const report = /** @type {import('../iterateJsdoc.js').MakeReport} */ (\n makeReport\n )(context, node);\n\n // eslint-disable-next-line no-loop-func\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n const text = sourceCode.getText(node);\n\n return fixer.replaceText(\n node,\n extraAsterisks ?\n text.replace(extraAsteriskCommentRegexp, '/**') :\n text.replace('/*', '/**'),\n );\n };\n\n report('Expected JSDoc-like comment to begin with two asterisks.', fix);\n }\n}, {\n checkFile: true,\n meta: {\n docs: {\n description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n ignore: {\n description: `An array of directives that will not be reported if present at the beginning of\na multi-comment block and at-sign \\`/* @\\`.\n\nDefaults to \\`['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']\\`\n(some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n preventAllMultiAsteriskBlocks: {\n description: `A boolean (defaulting to \\`false\\`) which if \\`true\\` will prevent all\nJSDoc-like blocks with more than two initial asterisks even those without\napparent tag content.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAEwB;AAExB;AACA;AACA,MAAM,aAAa,GAAG,cAAc;AACpC,MAAM,0BAA0B,GAAG,YAAY;AAAC,iCAEjC,IAAAA,qBAAY,EAAC,CAAC;EAC3B,WAAW;EACX,OAAO;EACP,UAAU;EACV;AACF,CAAC,KAAK;EACJ,MAAM,CACJ;IACE,MAAM,GAAG,CACP,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,YAAY,CACb;IACD,6BAA6B,GAAG;EAClC,CAAC,GAAG,CAAC,CAAC,CACP,GAAG,OAAO,CAAC,OAAO;EAEnB,IAAI,cAAc,GAAG,KAAK;EAC1B,MAAM,aAAa,GAAG,sCACpB,WAAW,CACX,MAAM,CAAE,OAAO,IAAK;IACpB,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IAE/C,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;IACtE,IAAI,CACF,QAAQ,CACT,CAAC,IAAI,CAAE,SAAS,IAAK;MACpB,O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AAO,CAAC,IAAI,EAAE,KAAK,CAC5B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,0DAA0D,EAAE,GAAG,CAAC;EACzE;AACF,CAAC,EAAE;EACD,SAAS,EAAE,IAAI;EACf,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,kGAAkG;MAC/G,GAAG,EAAE;IACP,CAAC;IACD,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,MAAM,EAAE;UACN,WAAW,EAAE;AACzB;AACA;AACA;AACA,mHAAmH;UACvG,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,6BAA6B,EAAE;UAC7B,WAAW,EAAE;AACzB;AACA,sBAAsB;UACV,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
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 }; }
|
|
2
9
|
const anyWhitespaceLines = /^\s*$/v;
|
|
3
10
|
const atLeastTwoLinesWhitespace = /^[ \t]*\n[ \t]*\n\s*$/v;
|
|
4
|
-
|
|
11
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
5
12
|
jsdoc,
|
|
6
13
|
utils
|
|
7
14
|
}) => {
|
|
@@ -52,4 +59,5 @@ export default iterateJsdoc(({
|
|
|
52
59
|
type: 'layout'
|
|
53
60
|
}
|
|
54
61
|
});
|
|
62
|
+
module.exports = exports.default;
|
|
55
63
|
//# sourceMappingURL=noBlankBlockDescriptions.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noBlankBlockDescriptions.cjs","names":[],"sources":["../../src/rules/noBlankBlockDescriptions.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst anyWhitespaceLines = /^\\s*$/v;\nconst atLeastTwoLinesWhitespace = /^[ \\t]*\\n[ \\t]*\\n\\s*$/v;\n\nexport default iterateJsdoc(({\n jsdoc,\n utils,\n}) => {\n const {\n description,\n descriptions,\n lastDescriptionLine,\n } = utils.getDescription();\n\n const regex = jsdoc.tags.length ?\n anyWhitespaceLines :\n atLeastTwoLinesWhitespace;\n\n if (descriptions.length && regex.test(description)) {\n if (jsdoc.tags.length) {\n utils.reportJSDoc(\n 'There should be no blank lines in block descriptions followed by tags.',\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription(() => {\n // Remove all lines\n return [];\n });\n },\n );\n } else {\n utils.reportJSDoc(\n 'There should be no extra blank lines in block descriptions not followed by tags.',\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens) => {\n return [\n // Keep the starting line\n {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: '',\n }),\n },\n ];\n });\n },\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'If tags are present, this rule will prevent empty lines in the block description. If no tags are present, this rule will prevent extra empty lines in the block description.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header',\n },\n fixable: 'whitespace',\n schema: [],\n type: 'layout',\n },\n});\n"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"noBlankBlockDescriptions.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/noBlankBlockDescriptions.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst anyWhitespaceLines = /^\\s*$/v;\nconst atLeastTwoLinesWhitespace = /^[ \\t]*\\n[ \\t]*\\n\\s*$/v;\n\nexport default iterateJsdoc(({\n jsdoc,\n utils,\n}) => {\n const {\n description,\n descriptions,\n lastDescriptionLine,\n } = utils.getDescription();\n\n const regex = jsdoc.tags.length ?\n anyWhitespaceLines :\n atLeastTwoLinesWhitespace;\n\n if (descriptions.length && regex.test(description)) {\n if (jsdoc.tags.length) {\n utils.reportJSDoc(\n 'There should be no blank lines in block descriptions followed by tags.',\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription(() => {\n // Remove all lines\n return [];\n });\n },\n );\n } else {\n utils.reportJSDoc(\n 'There should be no extra blank lines in block descriptions not followed by tags.',\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens) => {\n return [\n // Keep the starting line\n {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: '',\n }),\n },\n ];\n });\n },\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'If tags are present, this rule will prevent empty lines in the block description. If no tags are present, this rule will prevent extra empty lines in the block description.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header',\n },\n fixable: 'whitespace',\n schema: [],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C,MAAM,kBAAkB,GAAG,QAAQ;AACnC,MAAM,yBAAyB,GAAG,wBAAwB;AAAC,iCAE5C,IAAAA,qBAAY,EAAC,CAAC;EAC3B,KAAK;EACL;AACF,CAAC,KAAK;EACJ,MAAM;IACJ,WAAW;IACX,YAAY;IACZ;EACF,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;EAE1B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,GAC7B,kBAAkB,GAClB,yBAAyB;EAE3B,IAAI,YAAY,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;IAClD,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;MACrB,KAAK,CAAC,WAAW,CACf,wEAAwE,EACxE;QACE,IAAI,EAAE;MACR,CAAC,EACD,MAAM;QACJ,KAAK,CAAC,mBAAmB,CAAC,MAAM;UAC9B;UACA,OAAO,EAAE;QACX,CAAC,CAAC;MACJ,CACF,CAAC;IACH,CAAC,MAAM;MACL,KAAK,CAAC,WAAW,CACf,kFAAkF,EAClF;QACE,IAAI,EAAE;MACR,CAAC,EACD,MAAM;QACJ,KAAK,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,UAAU,KAAK;UAC9C,OAAO;UACL;UACA;YACE,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,UAAU,CAAC;cACjB,GAAG,IAAI;cACP,WAAW,EAAE;YACf,CAAC;UACH,CAAC,CACF;QACH,CAAC,CAAC;MACJ,CACF,CAAC;IACH;EACF;AACF,CAAC,EAAE;EACD,gBAAgB,EAAE,IAAI;EACtB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,8KAA8K;MAC3L,GAAG,EAAE;IACP,CAAC;IACD,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,EAAE;IACV,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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)(({
|
|
3
10
|
context,
|
|
4
11
|
jsdoc,
|
|
5
12
|
utils
|
|
@@ -43,4 +50,5 @@ export default iterateJsdoc(({
|
|
|
43
50
|
type: 'suggestion'
|
|
44
51
|
}
|
|
45
52
|
});
|
|
53
|
+
module.exports = exports.default;
|
|
46
54
|
//# sourceMappingURL=noBlankBlocks.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noBlankBlocks.cjs","names":[],"sources":["../../src/rules/noBlankBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n if (jsdoc.tags.length) {\n return;\n }\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n if (description.trim()) {\n return;\n }\n\n const {\n enableFixer,\n } = context.options[0] || {};\n\n utils.reportJSDoc(\n 'No empty blocks',\n {\n line: lastDescriptionLine,\n },\n enableFixer ? () => {\n jsdoc.source.splice(0);\n } : null,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Removes empty blocks with nothing but possibly line breaks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n enableFixer: {\n description: 'Whether or not to auto-remove the blank block. Defaults to `false`.',\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"noBlankBlocks.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/noBlankBlocks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n if (jsdoc.tags.length) {\n return;\n }\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n if (description.trim()) {\n return;\n }\n\n const {\n enableFixer,\n } = context.options[0] || {};\n\n utils.reportJSDoc(\n 'No empty blocks',\n {\n line: lastDescriptionLine,\n },\n enableFixer ? () => {\n jsdoc.source.splice(0);\n } : null,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Removes empty blocks with nothing but possibly line breaks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-blocks.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n enableFixer: {\n description: 'Whether or not to auto-remove the blank block. Defaults to `false`.',\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAAA,iCAE/B,IAAAA,qBAAY,EAAC,CAAC;EAC3B,OAAO;EACP,KAAK;EACL;AACF,CAAC,KAAK;EACJ,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;IACrB;EACF;EAEA,MAAM;IACJ,WAAW;IACX;EACF,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;EAC1B,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE;IACtB;EACF;EAEA,MAAM;IACJ;EACF,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,KAAK,CAAC,WAAW,CACf,iBAAiB,EACjB;IACE,IAAI,EAAE;EACR,CAAC,EACD,WAAW,GAAG,MAAM;IAClB,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;EACxB,CAAC,GAAG,IACN,CAAC;AACH,CAAC,EAAE;EACD,gBAAgB,EAAE,IAAI;EACtB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,4DAA4D;MACzE,GAAG,EAAE;IACP,CAAC;IACD,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,WAAW,EAAE;UACX,WAAW,EAAE,qEAAqE;UAClF,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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)(({
|
|
3
10
|
context,
|
|
4
11
|
utils
|
|
5
12
|
}) => {
|
|
@@ -91,4 +98,5 @@ the presence of ES6 default parameters (bearing in mind that such
|
|
|
91
98
|
type: 'suggestion'
|
|
92
99
|
}
|
|
93
100
|
});
|
|
101
|
+
module.exports = exports.default;
|
|
94
102
|
//# sourceMappingURL=noDefaults.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noDefaults.cjs","names":[],"sources":["../../src/rules/noDefaults.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n const {\n noOptionalParamNames,\n } = context.options[0] || {};\n const paramTags = utils.getPresentTags([\n 'param', 'arg', 'argument',\n ]);\n for (const tag of paramTags) {\n if (noOptionalParamNames && tag.optional) {\n utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '$1'),\n });\n });\n } else if (tag.default) {\n utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '[$1]'),\n });\n });\n }\n }\n\n const defaultTags = utils.getPresentTags([\n 'default', 'defaultvalue',\n ]);\n for (const tag of defaultTags) {\n if (tag.description.trim()) {\n utils.reportJSDoc(`Default values are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n description: '',\n postTag: '',\n });\n });\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'This rule reports defaults being used on the relevant portion of `@param` or `@default`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-defaults.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#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 noOptionalParamNames: {\n description: `Set this to \\`true\\` to report the presence of optional parameters. May be\nused if the project is insisting on optionality being indicated by\nthe presence of ES6 default parameters (bearing in mind that such\n\"defaults\" are only applied when the supplied value is missing or\n\\`undefined\\` but not for \\`null\\` or other \"falsey\" values).`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"noDefaults.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/noDefaults.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n const {\n noOptionalParamNames,\n } = context.options[0] || {};\n const paramTags = utils.getPresentTags([\n 'param', 'arg', 'argument',\n ]);\n for (const tag of paramTags) {\n if (noOptionalParamNames && tag.optional) {\n utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '$1'),\n });\n });\n } else if (tag.default) {\n utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n name: tag.name.replace(/([^=]*)(=.+)?/v, '[$1]'),\n });\n });\n }\n }\n\n const defaultTags = utils.getPresentTags([\n 'default', 'defaultvalue',\n ]);\n for (const tag of defaultTags) {\n if (tag.description.trim()) {\n utils.reportJSDoc(`Default values are not permitted on @${tag.tag}.`, tag, () => {\n utils.changeTag(tag, {\n description: '',\n postTag: '',\n });\n });\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'This rule reports defaults being used on the relevant portion of `@param` or `@default`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-defaults.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#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 noOptionalParamNames: {\n description: `Set this to \\`true\\` to report the presence of optional parameters. May be\nused if the project is insisting on optionality being indicated by\nthe presence of ES6 default parameters (bearing in mind that such\n\"defaults\" are only applied when the supplied value is missing or\n\\`undefined\\` but not for \\`null\\` or other \"falsey\" values).`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAAA,iCAE/B,IAAAA,qBAAY,EAAC,CAAC;EAC3B,OAAO;EACP;AACF,CAAC,KAAK;EACJ,MAAM;IACJ;EACF,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAC5B,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,CACrC,OAAO,EAAE,KAAK,EAAE,UAAU,CAC3B,CAAC;EACF,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE;IAC3B,IAAI,oBAAoB,IAAI,GAAG,CAAC,QAAQ,EAAE;MACxC,KAAK,CAAC,WAAW,CAAC,8CAA8C,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM;QACrF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;UACnB,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI;QAC/C,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE;MACtB,KAAK,CAAC,WAAW,CAAC,kCAAkC,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM;QACzE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;UACnB,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,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E;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
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 }; }
|
|
3
9
|
/**
|
|
4
10
|
* @typedef {{
|
|
5
11
|
* comment: string,
|
|
@@ -38,7 +44,7 @@ const incrementSelector = (state, selector, comment) => {
|
|
|
38
44
|
}
|
|
39
45
|
state.selectorMap[selector][comment]++;
|
|
40
46
|
};
|
|
41
|
-
|
|
47
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
42
48
|
context,
|
|
43
49
|
info: {
|
|
44
50
|
comment
|
|
@@ -186,4 +192,5 @@ section of our Advanced docs for more on the expected format.`,
|
|
|
186
192
|
type: 'suggestion'
|
|
187
193
|
}
|
|
188
194
|
});
|
|
195
|
+
module.exports = exports.default;
|
|
189
196
|
//# sourceMappingURL=noMissingSyntax.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noMissingSyntax.cjs","names":[],"sources":["../../src/rules/noMissingSyntax.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {{\n * comment: string,\n * context: string,\n * message: string,\n * minimum: import('../iterateJsdoc.js').Integer\n * }} ContextObject\n */\n\n/**\n * @typedef {string|ContextObject} Context\n */\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @returns {void}\n */\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @param {string} selector\n * @param {string} comment\n * @returns {void}\n */\nconst incrementSelector = (state, selector, comment) => {\n if (!state.selectorMap[selector]) {\n state.selectorMap[selector] = {};\n }\n\n if (!state.selectorMap[selector][comment]) {\n state.selectorMap[selector][comment] = 0;\n }\n\n state.selectorMap[selector][comment]++;\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n state,\n utils,\n}) => {\n if (!context.options[0]) {\n // Handle error later\n return;\n }\n\n /**\n * @type {Context[]}\n */\n const contexts = context.options[0].contexts;\n\n const {\n contextStr,\n } = utils.findContext(contexts, comment);\n\n setDefaults(state);\n\n incrementSelector(state, contextStr, String(comment));\n}, {\n contextSelected: true,\n exit ({\n context,\n settings,\n state,\n }) {\n if (!context.options.length && !settings.contexts) {\n context.report({\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `contexts` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n\n /**\n * @type {Context[]}\n */\n const contexts = (context.options[0] ?? {}).contexts ?? settings?.contexts;\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = typeof cntxt === 'string' ? '' : cntxt?.comment ?? '';\n\n const contextKey = contextStr === 'any' ? 'undefined' : contextStr;\n\n if (\n (!state.selectorMap[contextKey] ||\n !state.selectorMap[contextKey][comment] ||\n state.selectorMap[contextKey][comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n )) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n );\n }))\n ) {\n const message = typeof cntxt === 'string' ?\n 'Syntax is required: {{context}}' :\n cntxt?.message ?? ('Syntax is required: {{context}}' +\n (comment ? ' with {{comment}}' : ''));\n context.report({\n data: {\n comment,\n context: contextStr,\n },\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message,\n });\n\n return true;\n }\n\n return false;\n });\n },\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are always expected.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nUse the \\`minimum\\` property (defaults to 1) to indicate how many are required\nfor the rule to be reported.\n\nUse the \\`message\\` property to indicate the specific error to be shown when an\nerror is reported for that context being found missing. You may use\n\\`{{context}}\\` and \\`{{comment}}\\` with such messages. Defaults to\n\\`\"Syntax is required: {{context}}\"\\`, or with a comment, to\n\\`\"Syntax is required: {{context}} with {{comment}}\"\\`.\n\nSet to \\`\"any\"\\` if you want the rule to apply to any JSDoc block throughout\nyour files (as is necessary for finding function blocks not attached to a\nfunction declaration or expression, i.e., \\`@callback\\` or \\`@function\\` (or its\naliases \\`@func\\` or \\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#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 message: {\n type: 'string',\n },\n minimum: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"noMissingSyntax.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/noMissingSyntax.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {{\n * comment: string,\n * context: string,\n * message: string,\n * minimum: import('../iterateJsdoc.js').Integer\n * }} ContextObject\n */\n\n/**\n * @typedef {string|ContextObject} Context\n */\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @returns {void}\n */\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @param {string} selector\n * @param {string} comment\n * @returns {void}\n */\nconst incrementSelector = (state, selector, comment) => {\n if (!state.selectorMap[selector]) {\n state.selectorMap[selector] = {};\n }\n\n if (!state.selectorMap[selector][comment]) {\n state.selectorMap[selector][comment] = 0;\n }\n\n state.selectorMap[selector][comment]++;\n};\n\nexport default iterateJsdoc(({\n context,\n info: {\n comment,\n },\n state,\n utils,\n}) => {\n if (!context.options[0]) {\n // Handle error later\n return;\n }\n\n /**\n * @type {Context[]}\n */\n const contexts = context.options[0].contexts;\n\n const {\n contextStr,\n } = utils.findContext(contexts, comment);\n\n setDefaults(state);\n\n incrementSelector(state, contextStr, String(comment));\n}, {\n contextSelected: true,\n exit ({\n context,\n settings,\n state,\n }) {\n if (!context.options.length && !settings.contexts) {\n context.report({\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `contexts` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n\n /**\n * @type {Context[]}\n */\n const contexts = (context.options[0] ?? {}).contexts ?? settings?.contexts;\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = typeof cntxt === 'string' ? '' : cntxt?.comment ?? '';\n\n const contextKey = contextStr === 'any' ? 'undefined' : contextStr;\n\n if (\n (!state.selectorMap[contextKey] ||\n !state.selectorMap[contextKey][comment] ||\n state.selectorMap[contextKey][comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n )) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n );\n }))\n ) {\n const message = typeof cntxt === 'string' ?\n 'Syntax is required: {{context}}' :\n cntxt?.message ?? ('Syntax is required: {{context}}' +\n (comment ? ' with {{comment}}' : ''));\n context.report({\n data: {\n comment,\n context: contextStr,\n },\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message,\n });\n\n return true;\n }\n\n return false;\n });\n },\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are always expected.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nUse the \\`minimum\\` property (defaults to 1) to indicate how many are required\nfor the rule to be reported.\n\nUse the \\`message\\` property to indicate the specific error to be shown when an\nerror is reported for that context being found missing. You may use\n\\`{{context}}\\` and \\`{{comment}}\\` with such messages. Defaults to\n\\`\"Syntax is required: {{context}}\"\\`, or with a comment, to\n\\`\"Syntax is required: {{context}} with {{comment}}\"\\`.\n\nSet to \\`\"any\"\\` if you want the rule to apply to any JSDoc block throughout\nyour files (as is necessary for finding function blocks not attached to a\nfunction declaration or expression, i.e., \\`@callback\\` or \\`@function\\` (or its\naliases \\`@func\\` or \\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#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 message: {\n type: 'string',\n },\n minimum: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n 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BACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
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 }; }
|
|
2
9
|
const middleAsterisksBlockWS = /^([\t ]|\*(?!\*))+/v;
|
|
3
10
|
const middleAsterisksNoBlockWS = /^\*+/v;
|
|
4
11
|
const endAsterisksSingleLineBlockWS = /\*((?:\*|(?: |\t))*)\*$/v;
|
|
5
12
|
const endAsterisksMultipleLineBlockWS = /((?:\*|(?: |\t))*)\*$/v;
|
|
6
13
|
const endAsterisksSingleLineNoBlockWS = /\*(\**)\*$/v;
|
|
7
14
|
const endAsterisksMultipleLineNoBlockWS = /(\**)\*$/v;
|
|
8
|
-
|
|
15
|
+
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
9
16
|
context,
|
|
10
17
|
jsdoc,
|
|
11
18
|
utils
|
|
@@ -115,4 +122,5 @@ Defaults to \`true\`.`,
|
|
|
115
122
|
type: 'suggestion'
|
|
116
123
|
}
|
|
117
124
|
});
|
|
125
|
+
module.exports = exports.default;
|
|
118
126
|
//# sourceMappingURL=noMultiAsterisks.cjs.map
|