eslint-plugin-jsdoc 60.5.0 → 60.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/jsdocUtils.d.ts +1 -0
  3. package/dist/cjs/rules/escapeInlineTags.d.ts +2 -0
  4. package/dist/generateDocs.cjs +5 -6
  5. package/dist/generateDocs.cjs.map +1 -1
  6. package/dist/index-cjs.cjs +4 -1
  7. package/dist/index-cjs.cjs.map +1 -1
  8. package/dist/index.cjs +4 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/jsdocUtils.cjs +3 -2
  11. package/dist/jsdocUtils.cjs.map +1 -1
  12. package/dist/jsdocUtils.d.ts +1 -0
  13. package/dist/rules/checkLineAlignment.cjs +1 -2
  14. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  15. package/dist/rules/checkTypes.cjs +2 -3
  16. package/dist/rules/checkTypes.cjs.map +1 -1
  17. package/dist/rules/convertToJsdocComments.cjs +2 -4
  18. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  19. package/dist/rules/emptyTags.cjs +1 -2
  20. package/dist/rules/emptyTags.cjs.map +1 -1
  21. package/dist/rules/escapeInlineTags.cjs +149 -0
  22. package/dist/rules/escapeInlineTags.cjs.map +1 -0
  23. package/dist/rules/escapeInlineTags.d.ts +3 -0
  24. package/dist/rules/informativeDocs.cjs +3 -6
  25. package/dist/rules/informativeDocs.cjs.map +1 -1
  26. package/dist/rules/linesBeforeBlock.cjs +4 -8
  27. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  28. package/dist/rules/matchDescription.cjs +2 -4
  29. package/dist/rules/matchDescription.cjs.map +1 -1
  30. package/dist/rules/matchName.cjs +1 -2
  31. package/dist/rules/matchName.cjs.map +1 -1
  32. package/dist/rules/multilineBlocks.cjs +3 -6
  33. package/dist/rules/multilineBlocks.cjs.map +1 -1
  34. package/dist/rules/noBadBlocks.cjs +1 -2
  35. package/dist/rules/noBadBlocks.cjs.map +1 -1
  36. package/dist/rules/noTypes.cjs +1 -2
  37. package/dist/rules/noTypes.cjs.map +1 -1
  38. package/dist/rules/preferImportTag.cjs +6 -2
  39. package/dist/rules/preferImportTag.cjs.map +1 -1
  40. package/dist/rules/requireAsteriskPrefix.cjs +1 -2
  41. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  42. package/dist/rules/requireDescriptionCompleteSentence.cjs +1 -2
  43. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  44. package/dist/rules/requireFileOverview.cjs +1 -3
  45. package/dist/rules/requireFileOverview.cjs.map +1 -1
  46. package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -2
  47. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  48. package/dist/rules/requireJsdoc.cjs +3 -6
  49. package/dist/rules/requireJsdoc.cjs.map +1 -1
  50. package/dist/rules/requireParam.cjs +6 -12
  51. package/dist/rules/requireParam.cjs.map +1 -1
  52. package/dist/rules/requireParamName.cjs +1 -2
  53. package/dist/rules/requireParamName.cjs.map +1 -1
  54. package/dist/rules/requireReturns.cjs +1 -2
  55. package/dist/rules/requireReturns.cjs.map +1 -1
  56. package/dist/rules/requireReturnsCheck.cjs +13 -1
  57. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  58. package/dist/rules/requireTemplate.cjs +1 -2
  59. package/dist/rules/requireTemplate.cjs.map +1 -1
  60. package/dist/rules/sortTags.cjs +1 -2
  61. package/dist/rules/sortTags.cjs.map +1 -1
  62. package/dist/rules.d.ts +30 -37
  63. package/package.json +9 -9
  64. package/src/index-cjs.js +4 -0
  65. package/src/index.js +4 -0
  66. package/src/jsdocUtils.js +17 -1
  67. package/src/rules/checkLineAlignment.js +1 -2
  68. package/src/rules/checkTypes.js +3 -15
  69. package/src/rules/convertToJsdocComments.js +2 -4
  70. package/src/rules/emptyTags.js +1 -2
  71. package/src/rules/escapeInlineTags.js +189 -0
  72. package/src/rules/informativeDocs.js +3 -6
  73. package/src/rules/linesBeforeBlock.js +4 -8
  74. package/src/rules/matchDescription.js +2 -4
  75. package/src/rules/matchName.js +1 -2
  76. package/src/rules/multilineBlocks.js +3 -6
  77. package/src/rules/noBadBlocks.js +1 -2
  78. package/src/rules/noTypes.js +1 -2
  79. package/src/rules/preferImportTag.js +8 -3
  80. package/src/rules/requireAsteriskPrefix.js +1 -2
  81. package/src/rules/requireDescriptionCompleteSentence.js +1 -2
  82. package/src/rules/requireFileOverview.js +1 -3
  83. package/src/rules/requireHyphenBeforeParamDescription.js +1 -2
  84. package/src/rules/requireJsdoc.js +3 -6
  85. package/src/rules/requireParam.js +6 -12
  86. package/src/rules/requireParamName.js +1 -2
  87. package/src/rules/requireReturns.js +1 -2
  88. package/src/rules/requireReturnsCheck.js +16 -1
  89. package/src/rules/requireTemplate.js +1 -2
  90. package/src/rules/sortTags.js +1 -2
  91. package/src/rules.d.ts +30 -37
@@ -1 +1 @@
1
- {"version":3,"file":"matchDescription.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","matchDescriptionDefault","stringOrDefault","value","userDefault","_default","exports","iterateJsdoc","context","jsdoc","report","utils","mainDescription","matchDescription","message","nonemptyTags","tags","options","validateDescription","desc","tag","mainDescriptionMatch","errorMessage","match","Object","hasOwn","tagValue","tagName","regex","getRegexFromString","test","line","source","number","description","getDescription","hasNoTag","forEachPreferredTag","matchingJsdocTag","targetTagName","name","getTagDescription","trim","keys","length","hasOptionTag","Boolean","whitelistedTags","filterTags","tagsWithNames","tagsWithoutNames","getTagsByType","some","replace","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","oneOf","format","patternProperties","enum","module"],"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-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.\n`,\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`,\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,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA,MAAMG,uBAAuB,GAAG,qDAAqD;;AAErF;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAGA,CAACC,KAAK,EAAEC,WAAW,KAAK;EAC9C,OAAO,OAAOD,KAAK,KAAK,QAAQ,GAC9BA,KAAK,GACLC,WAAW,IAAIH,uBAAuB;AAC1C,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEa,IAAAO,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,eAAe;IACfC,gBAAgB;IAChBC,OAAO;IACPC,YAAY,GAAG,IAAI;IACnBC,IAAI,GAAG,CAAC;EACV,CAAC,GAAGR,OAAO,CAACS,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;;EAE5B;AACF;AACA;AACA;AACA;EACE,MAAMC,mBAAmB,GAAGA,CAACC,IAAI,EAAEC,GAAG,KAAK;IACzC,IAAIC,oBAAoB,GAAGT,eAAe;IAC1C,IAAIU,YAAY,GAAGR,OAAO;IAC1B,IAAI,OAAOF,eAAe,KAAK,QAAQ,EAAE;MACvCS,oBAAoB,GAAGT,eAAe,CAACW,KAAK;MAC5CD,YAAY,GAAGV,eAAe,CAACE,OAAO;IACxC;IAEA,IAAIO,oBAAoB,KAAK,KAAK,KAChC,CAACD,GAAG,IAAI,CAACI,MAAM,CAACC,MAAM,CAACT,IAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKgC,KAAK,EAAE,CACL;YACEC,MAAM,EAAE,OAAO;YACfH,IAAI,EAAE;UACR,CAAC,EACD;YACEA,IAAI,EAAE;UACR,CAAC,EACD;YACEL,oBAAoB,EAAE,KAAK;YAC3BC,UAAU,EAAE;cACVrC,KAAK,EAAE;gBACL2C,KAAK,EAAE,CACL;kBACEC,MAAM,EAAE,OAAO;kBACfH,IAAI,EAAE;gBACR,CAAC,EACD;kBACEA,IAAI,EAAE;gBACR,CAAC;cAEL,CAAC;cACDlD,OAAO,EAAE;gBACPkD,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACDnD,gBAAgB,EAAE;UAChBqB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,MAAM,EAAE,OAAO;UACfH,IAAI,EAAE;QACR,CAAC;QACDlD,OAAO,EAAE;UACPoB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACW8B,IAAI,EAAE;QACR,CAAC;QACDjD,YAAY,EAAE;UACZmB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3B8B,IAAI,EAAE;QACR,CAAC;QACDhD,IAAI,EAAE;UACJkB,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;UACDkC,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJF,KAAK,EAAE,CACL;gBACEC,MAAM,EAAE,OAAO;gBACfH,IAAI,EAAE;cACR,CAAC,EACD;gBACEK,IAAI,EAAE,CACJ,IAAI,CACL;gBACDL,IAAI,EAAE;cACR,CAAC,EACD;gBACEL,oBAAoB,EAAE,KAAK;gBAC3BC,UAAU,EAAE;kBACVrC,KAAK,EAAE;oBACL2C,KAAK,EAAE,CACL;sBACEC,MAAM,EAAE,OAAO;sBACfH,IAAI,EAAE;oBACR,CAAC,EACD;sBACEK,IAAI,EAAE,CACJ,IAAI,CACL;sBACDL,IAAI,EAAE;oBACR,CAAC;kBAEL,CAAC;kBACDlD,OAAO,EAAE;oBACPkD,IAAI,EAAE;kBACR;gBACF,CAAC;gBACDA,IAAI,EAAE;cACR,CAAC;YAEL;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAAhE,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"matchDescription.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","matchDescriptionDefault","stringOrDefault","value","userDefault","_default","exports","iterateJsdoc","context","jsdoc","report","utils","mainDescription","matchDescription","message","nonemptyTags","tags","options","validateDescription","desc","tag","mainDescriptionMatch","errorMessage","match","Object","hasOwn","tagValue","tagName","regex","getRegexFromString","test","line","source","number","description","getDescription","hasNoTag","forEachPreferredTag","matchingJsdocTag","targetTagName","name","getTagDescription","trim","keys","length","hasOptionTag","Boolean","whitelistedTags","filterTags","tagsWithNames","tagsWithoutNames","getTagsByType","some","replace","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","oneOf","format","patternProperties","enum","module"],"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-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,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA,MAAMG,uBAAuB,GAAG,qDAAqD;;AAErF;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAGA,CAACC,KAAK,EAAEC,WAAW,KAAK;EAC9C,OAAO,OAAOD,KAAK,KAAK,QAAQ,GAC9BA,KAAK,GACLC,WAAW,IAAIH,uBAAuB;AAC1C,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEa,IAAAO,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,eAAe;IACfC,gBAAgB;IAChBC,OAAO;IACPC,YAAY,GAAG,IAAI;IACnBC,IAAI,GAAG,CAAC;EACV,CAAC,GAAGR,OAAO,CAACS,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;;EAE5B;AACF;AACA;AACA;AACA;EACE,MAAMC,mBAAmB,GAAGA,CAACC,IAAI,EAAEC,GAAG,KAAK;IACzC,IAAIC,oBAAoB,GAAGT,eAAe;IAC1C,IAAIU,YAAY,GAAGR,OAAO;IAC1B,IAAI,OAAOF,eAAe,KAAK,QAAQ,EAAE;MACvCS,oBAAoB,GAAGT,eAAe,CAACW,KAAK;MAC5CD,YAAY,GAAGV,eAAe,CAACE,OAAO;IACxC;IAEA,IAAIO,oBAAoB,KAAK,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;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;UACKgC,KAAK,EAAE,CACL;YACEC,MAAM,EAAE,OAAO;YACfH,IAAI,EAAE;UACR,CAAC,EACD;YACEA,IAAI,EAAE;UACR,CAAC,EACD;YACEL,oBAAoB,EAAE,KAAK;YAC3BC,UAAU,EAAE;cACVrC,KAAK,EAAE;gBACL2C,KAAK,EAAE,CACL;kBACEC,MAAM,EAAE,OAAO;kBACfH,IAAI,EAAE;gBACR,CAAC,EACD;kBACEA,IAAI,EAAE;gBACR,CAAC;cAEL,CAAC;cACDlD,OAAO,EAAE;gBACPkD,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACDnD,gBAAgB,EAAE;UAChBqB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,MAAM,EAAE,OAAO;UACfH,IAAI,EAAE;QACR,CAAC;QACDlD,OAAO,EAAE;UACPoB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;UACtD8B,IAAI,EAAE;QACR,CAAC;QACDjD,YAAY,EAAE;UACZmB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;UAC3B8B,IAAI,EAAE;QACR,CAAC;QACDhD,IAAI,EAAE;UACJkB,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;UACDkC,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJF,KAAK,EAAE,CACL;gBACEC,MAAM,EAAE,OAAO;gBACfH,IAAI,EAAE;cACR,CAAC,EACD;gBACEK,IAAI,EAAE,CACJ,IAAI,CACL;gBACDL,IAAI,EAAE;cACR,CAAC,EACD;gBACEL,oBAAoB,EAAE,KAAK;gBAC3BC,UAAU,EAAE;kBACVrC,KAAK,EAAE;oBACL2C,KAAK,EAAE,CACL;sBACEC,MAAM,EAAE,OAAO;sBACfH,IAAI,EAAE;oBACR,CAAC,EACD;sBACEK,IAAI,EAAE,CACJ,IAAI,CACL;sBACDL,IAAI,EAAE;oBACR,CAAC;kBAEL,CAAC;kBACDlD,OAAO,EAAE;oBACPkD,IAAI,EAAE;kBACR;gBACF,CAAC;gBACDA,IAAI,EAAE;cACR,CAAC;YAEL;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAM,MAAA,CAAAhE,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
@@ -100,8 +100,7 @@ fixes found by the likes of \`disallowName\` even when a different tag has the
100
100
  disallowed name. An alternative is to ensure that \`comment\` finds the specific
101
101
  tag of the desired tag and/or name and no \`disallowName\` (or \`allowName\`) is
102
102
  supplied. In such a case, only one error will be reported, but no fixer will
103
- be applied, however.
104
- `,
103
+ be applied, however.`,
105
104
  items: {
106
105
  additionalProperties: false,
107
106
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"matchName.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","info","lastIndex","jsdoc","report","utils","match","options","allowName","disallowName","replacement","tags","allowNameRegex","getRegexFromString","disallowNameRegex","applicableTags","includes","getPresentTags","reported","tag","tagName","name","replace","allowed","test","disallowed","hasRegex","fixer","src","source","tokens","message","reportJSDoc","undefined","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","comment","required","module"],"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`,\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-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,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI,EAAE;IACJC;EACF,CAAC;EACDC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC;EACF,CAAC,GAAGN,OAAO,CAACO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAC5B,IAAI,CAACD,KAAK,EAAE;IACVF,MAAM,CAAC,0DAA0D,CAAC;IAElE;EACF;EAEA,MAAM;IACJI,SAAS;IACTC,YAAY;IACZC,WAAW;IACXC,IAAI,GAAG,CACL,GAAG;EAEP,CAAC,GAAGL,KAAK,EAAC,mDAAqDJ,SAAS,EAAE;EAE1E,MAAMU,cAAc,GAAGJ,SAAS,IAAIH,KAAK,CAACQ,kBAAkB,CAACL,SAAS,CAAC;EACvE,MAAMM,iBAAiB,GAAGL,YAAY,IAAIJ,KAAK,CAACQ,kBAAkB,CAACJ,YAAY,CAAC;EAEhF,IAAIM,cAAc,GAAGZ,KAAK,CAACQ,IAAI;EAC/B,IAAI,CAACA,IAAI,CAACK,QAAQ,CAAC,GAAG,CAAC,EAAE;IACvBD,cAAc,GAAGV,KAAK,CAACY,cAAc,CAACN,IAAI,CAAC;EAC7C;EAEA,IAAIO,QAAQ,GAAG,KAAK;EACpB,KAAK,MAAMC,GAAG,IAAIJ,cAAc,EAAE;IAChC,MAAMK,OAAO,G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I,EAAE;QACR;MACF,CAAC;MACDE,QAAQ,EAAE,CACR,OAAO,CACR;MACDF,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAG,MAAA,CAAAjD,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"matchName.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","info","lastIndex","jsdoc","report","utils","match","options","allowName","disallowName","replacement","tags","allowNameRegex","getRegexFromString","disallowNameRegex","applicableTags","includes","getPresentTags","reported","tag","tagName","name","replace","allowed","test","disallowed","hasRegex","fixer","src","source","tokens","message","reportJSDoc","undefined","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","comment","required","module"],"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-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,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI,EAAE;IACJC;EACF,CAAC;EACDC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC;EACF,CAAC,GAAGN,OAAO,CAACO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAC5B,IAAI,CAACD,KAAK,EAAE;IACVF,MAAM,CAAC,0DAA0D,CAAC;IAElE;EACF;EAEA,MAAM;IACJI,SAAS;IACTC,YAAY;IACZC,WAAW;IACXC,IAAI,GAAG,CACL,GAAG;EAEP,CAAC,GAAGL,KAAK,EAAC,mDAAqDJ,SAAS,EAAE;EAE1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,YAAY,EAAE;gBACZ4B,WAAW,EAAE,+DAA+D;gBAC5EO,IAAI,EAAE;cACR,CAAC;cACDb,OAAO,EAAE;gBACPM,WAAW,EAAE,0DAA0D;gBACvEO,IAAI,EAAE;cACR,CAAC;cACDlC,WAAW,EAAE;gBACX2B,WAAW,EAAE;AAC/B,gDAAgD;gBAC9BO,IAAI,EAAE;cACR,CAAC;cACDjC,IAAI,EAAE;gBACJ0B,WAAW,EAAE;AAC/B;AACA;AACA,qEAAqE;gBACnDM,KAAK,EAAE;kBACLC,IAAI,EAAE;gBACR,CAAC;gBACDA,IAAI,EAAE;cACR;YACF,CAAC;YACDA,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDE,QAAQ,EAAE,CACR,OAAO,CACR;MACDF,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAG,MAAA,CAAAjD,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
@@ -362,8 +362,7 @@ such a tag will cause multiline blocks to be allowed.
362
362
  You may set this to an empty array to prevent any tag from permitting multiple
363
363
  lines.
364
364
 
365
- Defaults to \`['*']\`.
366
- `
365
+ Defaults to \`['*']\`.`
367
366
  },
368
367
  noFinalLineText: {
369
368
  description: `For multiline blocks, any non-whitespace text preceding the \`*/\` on the final
@@ -386,8 +385,7 @@ Defaults to \`false\`.`,
386
385
  description: `If this is \`true\`, any single line blocks will be reported, except those which
387
386
  are whitelisted in \`singleLineTags\`.
388
387
 
389
- Defaults to \`false\`.
390
- `,
388
+ Defaults to \`false\`.`,
391
389
  type: 'boolean'
392
390
  },
393
391
  noZeroLineText: {
@@ -407,8 +405,7 @@ for such cases. Blocks are not reported which have multi-line descriptions,
407
405
  multiple tags, a block description and tag, or tags with multi-line types or
408
406
  descriptions.
409
407
 
410
- Defaults to \`null\`.
411
- `,
408
+ Defaults to \`null\`.`,
412
409
  type: 'number'
413
410
  },
414
411
  singleLineTags: {
@@ -1 +1 @@
1
- {"version":3,"file":"multilineBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","checkForShortTags","jsdoc","utils","requireSingleLineUnderCount","tags","length","lastLineWithTag","isUnderCountLimit","hasMultiDescOrType","tagLines","source","reduce","acc","tokens","delimiter","description","desc","name","postDelimiter","postName","postTag","postType","start","tag","type","idx","fixer","number","seedTokens","trimEnd","end","reportJSDoc","checkForShortDescriptions","lastLineWithDesc","descLines","_default","exports","iterateJsdoc","context","allowMultipleTags","minimumLengthForMultiline","Number","POSITIVE_INFINITY","multilineTags","noFinalLineText","noMultilineBlocks","noSingleLineBlocks","noZeroLineText","singleLineTags","options","sourceLength","isInvalidSingleLine","tagName","includes","slice","makeMultiline","lineChecks","line","emptyTokens","addLine","finalLine","finalLineTokens","trim","prop","hasATag","filterTags","tg","obj","lineEnd","nme","typ","nameOrDescription","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","anyOf","enum","items","module"],"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 },\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`,\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`,\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,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAMG,iBAAiB,GAAGA,CAACC,KAAK,EAAEC,KAAK,EAAEC,2BAA2B,KAAK;EACvE,IAAI,CAACA,2BAA2B,IAAI,CAACF,KAAK,CAACG,IAAI,CAACC,MAAM,EAAE;IACtD,OAAO,KAAK;EACd;EAEA,IAAIC,eAAe,GAAG,CAAC;EACvB,IAAIC,iBAAiB,GAAG,KAAK;EAC7B,IAAIC,kBAAkB,GAAG,KAAK;EAC9B,MAAMC,QAAQ,GAAGR,KAAK,CAACS,MAAM,CAACC,MAAM,CAAC,CAACC,GAAG,EAAE;IACzCC,MAAM,EAAE;MACNC,SAAS;MACTC,WAAW,EAAEC,IAAI;MACjBC,IAAI;MACJC,aAAa;MACbC,QAAQ;MACRC,OAAO;MACPC,QAAQ;MACRC,KAAK;MACLC,GAAG;MACHC;IACF;EACF,CAAC,EAAEC,GAAG,KAAK;IACT,IAAIF,GAAG,CAAClB,MAAM,EAAE;MACdC,eAAe,GAAGmB,GAAG;MACrB,IACEH,KAAK,CAACjB,MAAM,GAAGS,SAAS,CAACT,MAAM,GAAGa,aAAa,CAACb,MAAM,GACtDmB,IAAI,CAACnB,MAAM,GAAGgB,QAAQ,CAAChB,MAAM,GAAGY,IAAI,CAACZ,MAAM,GAAGc,QAAQ,CAACd,MAAM,GAC7DkB,GAAG,CAAClB,MAAM,GAAGe,OAAO,CAACf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I,EAAE,CACJ,GAAG,CACJ;YACDzD,IAAI,EAAE;UACR,CAAC,EAAE;YACD0D,KAAK,EAAE;cACL1D,IAAI,EAAE;YACR,CAAC;YACDA,IAAI,EAAE;UACR,CAAC,CACF;UACDT,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;QACU,CAAC;QACD6B,eAAe,EAAE;UACf7B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACVS,IAAI,EAAE;QACR,CAAC;QACDqB,iBAAiB,EAAE;UACjB9B,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXS,IAAI,EAAE;QACR,CAAC;QACDsB,kBAAkB,EAAE;UAClB/B,WAAW,EAAE;AACzB;AACA;AACA;AACA,CAAC;UACWS,IAAI,EAAE;QACR,CAAC;QACDuB,cAAc,EAAE;UACdhC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACVS,IAAI,EAAE;QACR,CAAC;QACDrB,2BAA2B,EAAE;UAC3BY,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWS,IAAI,EAAE;QACR,CAAC;QACDwB,cAAc,EAAE;UACdjC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,mCAAmC;UACvBmE,KAAK,EAAE;YACL1D,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA2D,MAAA,CAAA/C,OAAA,GAAAA,OAAA,CAAArC,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"multilineBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","checkForShortTags","jsdoc","utils","requireSingleLineUnderCount","tags","length","lastLineWithTag","isUnderCountLimit","hasMultiDescOrType","tagLines","source","reduce","acc","tokens","delimiter","description","desc","name","postDelimiter","postName","postTag","postType","start","tag","type","idx","fixer","number","seedTokens","trimEnd","end","reportJSDoc","checkForShortDescriptions","lastLineWithDesc","descLines","_default","exports","iterateJsdoc","context","allowMultipleTags","minimumLengthForMultiline","Number","POSITIVE_INFINITY","multilineTags","noFinalLineText","noMultilineBlocks","noSingleLineBlocks","noZeroLineText","singleLineTags","options","sourceLength","isInvalidSingleLine","tagName","includes","slice","makeMultiline","lineChecks","line","emptyTokens","addLine","finalLine","finalLineTokens","trim","prop","hasATag","filterTags","tg","obj","lineEnd","nme","typ","nameOrDescription","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","anyOf","enum","items","module"],"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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ACA;AACA;AACA;AACA;AACA;AACA;QACU,CAAC;QACD6B,eAAe,EAAE;UACf7B,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACVS,IAAI,EAAE;QACR,CAAC;QACDqB,iBAAiB,EAAE;UACjB9B,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXS,IAAI,EAAE;QACR,CAAC;QACDsB,kBAAkB,EAAE;UAClB/B,WAAW,EAAE;AACzB;AACA;AACA,uBAAuB;UACXS,IAAI,EAAE;QACR,CAAC;QACDuB,cAAc,EAAE;UACdhC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,sBAAsB;UACVS,IAAI,EAAE;QACR,CAAC;QACDrB,2BAA2B,EAAE;UAC3BY,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACVS,IAAI,EAAE;QACR,CAAC;QACDwB,cAAc,EAAE;UACdjC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,mCAAmC;UACvBmE,KAAK,EAAE;YACL1D,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA2D,MAAA,CAAA/C,OAAA,GAAAA,OAAA,CAAArC,OAAA","ignoreList":[]}
@@ -78,8 +78,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
78
78
  a multi-comment block and at-sign \`/* @\`.
79
79
 
80
80
  Defaults to \`['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']\`
81
- (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
82
- `,
81
+ (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).`,
83
82
  items: {
84
83
  type: 'string'
85
84
  },
@@ -1 +1 @@
1
- {"version":3,"file":"noBadBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_commentParser","e","__esModule","default","commentRegexp","extraAsteriskCommentRegexp","_default","exports","iterateJsdoc","allComments","context","makeReport","sourceCode","ignore","preventAllMultiAsteriskBlocks","options","extraAsterisks","nonJsdocNodes","filter","comment","commentText","getText","initialText","replace","trimStart","some","directive","startsWith","sliceIndex","test","multiline","exec","length","tags","commentParser","slice","tag","includes","node","report","fix","fixer","text","replaceText","checkFile","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","module"],"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`,\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,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEwB,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExB;AACA;AACA,MAAMG,aAAa,GAAG,cAAc;AACpC,MAAMC,0BAA0B,GAAG,YAAY;AAAC,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B;AACA,sBAAsB;UACVO,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,MAAA,CAAAhD,OAAA,GAAAA,OAAA,CAAAJ,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"noBadBlocks.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_commentParser","e","__esModule","default","commentRegexp","extraAsteriskCommentRegexp","_default","exports","iterateJsdoc","allComments","context","makeReport","sourceCode","ignore","preventAllMultiAsteriskBlocks","options","extraAsterisks","nonJsdocNodes","filter","comment","commentText","getText","initialText","replace","trimStart","some","directive","startsWith","sliceIndex","test","multiline","exec","length","tags","commentParser","slice","tag","includes","node","report","fix","fixer","text","replaceText","checkFile","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","type","module"],"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,IAAAA,aAAA,GAAAC,sBAAA,CAAAC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B,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVvC,MAAM,EAAE;UACNkC,WAAW,EAAE;AACzB;AACA;AACA;AACA,mHAAmH;UACvGM,KAAK,EAAE;YACLC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDxC,6BAA6B,EAAE;UAC7BiC,WAAW,EAAE;AACzB;AACA,sBAAsB;UACVO,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,MAAA,CAAAhD,OAAA,GAAAA,OAAA,CAAAJ,OAAA","ignoreList":[]}
@@ -72,8 +72,7 @@ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
72
72
  \`@method\`) (including those associated with an \`@interface\`).
73
73
 
74
74
  See the ["AST and Selectors"](../#advanced-ast-and-selectors)
75
- section of our Advanced docs for more on the expected format.
76
- `,
75
+ section of our Advanced docs for more on the expected format.`,
77
76
  items: {
78
77
  anyOf: [{
79
78
  type: 'string'
@@ -1 +1 @@
1
- {"version":3,"file":"noTypes.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","removeType","tokens","postTag","type","_default","exports","iterateJsdoc","node","utils","isIteratingFunctionOrVariable","isVirtualFunction","tags","getPresentTags","tag","reportJSDoc","source","propertyTags","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","contexts","items","anyOf","comment","context","module"],"sources":["../../src/rules/noTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('comment-parser').Line} line\n */\nconst removeType = ({\n tokens,\n}) => {\n tokens.postTag = '';\n tokens.type = '';\n};\n\nexport default iterateJsdoc(({\n node,\n utils,\n}) => {\n if (!utils.isIteratingFunctionOrVariable() && !utils.isVirtualFunction()) {\n return;\n }\n\n const tags = utils.getPresentTags([\n 'param', 'arg', 'argument', 'returns', 'return',\n ]);\n\n for (const tag of tags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n\n if (node?.type === 'ClassDeclaration') {\n const propertyTags = utils.getPresentTags([\n 'prop', 'property',\n ]);\n for (const tag of propertyTags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag} in the supplied context.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n }\n}, {\n contextDefaults: [\n 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',\n // Add this to above defaults\n 'TSMethodSignature', 'ClassDeclaration',\n ],\n meta: {\n docs: {\n description: 'This rule reports types being used on `@param` or `@returns` (redundant with TypeScript).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.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\\`, \\`TSDeclareFunction\\`, \\`TSMethodSignature\\`,\n\\`ClassDeclaration\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.\n`,\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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EAAE;QACZK,KAAK,CAACM,WAAW,CAAC,+BAA+BD,GAAG,CAACA,GAAG,2BAA2B,EAAEA,GAAG,EAAE,MAAM;UAC9F,KAAK,MAAME,MAAM,IAAIF,GAAG,CAACE,MAAM,EAAE;YAC/Bf,UAAU,CAACe,MAAM,CAAC;UACpB;QACF,CAAC,CAAC;MACJ;IACF;EACF;AACF,CAAC,EAAE;EACDE,eAAe,EAAE,CACf,yBAAyB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB;EAC3F;EACA,mBAAmB,EAAE,kBAAkB,CACxC;EACDC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,2FAA2F;MACxGC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,QAAQ,EAAE;UACRN,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWO,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEzB,IAAI,EAAE;YACR,CAAC,EACD;cACEqB,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVI,OAAO,EAAE;kBACP1B,IAAI,EAAE;gBACR,CAAC;gBACD2B,OAAO,EAAE;kBACP3B,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA4B,MAAA,CAAA1B,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"noTypes.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","removeType","tokens","postTag","type","_default","exports","iterateJsdoc","node","utils","isIteratingFunctionOrVariable","isVirtualFunction","tags","getPresentTags","tag","reportJSDoc","source","propertyTags","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","contexts","items","anyOf","comment","context","module"],"sources":["../../src/rules/noTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('comment-parser').Line} line\n */\nconst removeType = ({\n tokens,\n}) => {\n tokens.postTag = '';\n tokens.type = '';\n};\n\nexport default iterateJsdoc(({\n node,\n utils,\n}) => {\n if (!utils.isIteratingFunctionOrVariable() && !utils.isVirtualFunction()) {\n return;\n }\n\n const tags = utils.getPresentTags([\n 'param', 'arg', 'argument', 'returns', 'return',\n ]);\n\n for (const tag of tags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n\n if (node?.type === 'ClassDeclaration') {\n const propertyTags = utils.getPresentTags([\n 'prop', 'property',\n ]);\n for (const tag of propertyTags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag} in the supplied context.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n }\n}, {\n contextDefaults: [\n 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',\n // Add this to above defaults\n 'TSMethodSignature', 'ClassDeclaration',\n ],\n meta: {\n docs: {\n description: 'This rule reports types being used on `@param` or `@returns` (redundant with TypeScript).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.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\\`, \\`TSDeclareFunction\\`, \\`TSMethodSignature\\`,\n\\`ClassDeclaration\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA,MAAMG,UAAU,GAAGA,CAAC;EAClBC;AACF,CAAC,KAAK;EACJA,MAAM,CAACC,OAAO,GAAG,EAAE;EACnBD,MAAM,CAACE,IAAI,GAAG,EAAE;AAClB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEa,IAAAO,qBAAY,EAAC,CAAC;EAC3BC,IAAI;EACJC;AACF,CAAC,KAAK;EACJ,IAAI,CAACA,KAAK,CAACC,6BAA6B,CAAC,CAAC,IAAI,CAACD,KAAK,CAACE,iBAAiB,CAAC,CAAC,EAAE;IACxE;EACF;EAEA,MAAMC,IAAI,GAAGH,KAAK,CAACI,cAAc,CAAC,CAChC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,CAChD,CAAC;EAEF,KAAK,MAAMC,GAAG,IAAIF,IAAI,EAAE;IACtB,IAAIE,GAAG,CAACV,IAAI,E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AAE;kBACP1B,IAAI,EAAE;gBACR,CAAC;gBACD2B,OAAO,EAAE;kBACP3B,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA4B,MAAA,CAAA1B,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
@@ -10,6 +10,7 @@ var _parseImportsExports = require("parse-imports-exports");
10
10
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
11
  var _default = exports.default = (0, _iterateJsdoc.default)(({
12
12
  context,
13
+ indent,
13
14
  jsdoc,
14
15
  settings,
15
16
  sourceCode,
@@ -253,8 +254,11 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
253
254
  if (!pathSegments.length) {
254
255
  utils.reportJSDoc('Inline `import()` found; prefer `@import`', tag, enableFixer ? fixer => {
255
256
  getFixer(element.value, [])();
256
- const programNode = sourceCode.getNodeByRangeIndex(0);
257
- return fixer.insertTextBefore(/** @type {import('estree').Program} */programNode, `/** @import * as ${element.value} from '${element.value}'; */`);
257
+ const programNode = sourceCode.ast;
258
+ const commentNodes = sourceCode.getCommentsBefore(programNode);
259
+ return fixer.insertTextBefore(
260
+ // @ts-expect-error Ok
261
+ commentNodes[0] ?? programNode, `/** @import * as ${element.value} from '${element.value}'; */${commentNodes[0] ? '\n' + indent : ''}`);
258
262
  } : null);
259
263
  return;
260
264
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preferImportTag.cjs","names":["_iterateJsdoc","_interopRequireWildcard","require","_jsdoccomment","_parseImportsExports","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_default","exports","iterateJsdoc","context","jsdoc","settings","sourceCode","utils","mode","enableFixer","exemptTypedefs","outputType","options","allComments","getAllComments","comments","filter","comment","test","value","map","commentNode","commentParserToESTree","parseComment","typedefs","flatMap","doc","tags","tag","isNamepathDefiningTag","imports","delimiter","iterateInlineImports","potentialType","type","parsedType","tryParseType","parseType","traverse","nde","parentNode","element","currentNode","pathSegments","nodes","extraPathSegments","quotes","propertyOrBrackets","unshift","right","stringify","pathType","undefined","meta","quote","getFixer","matchingName","extrPathSegments","node","at","keys","key","length","newNode","shift","left","nameNode","src","source","tokens","unusedPathSegments","findMatchingTypedef","pthSegments","find","typedef","typedefNode","namepathMatch","pathSegment","push","matchingTypedef","reportJSDoc","name","slice","findMatchingImport","imprt","parsedImport","parseImportsExports","estreeToString","replace","trim","namedImportsModuleSpecifier","namedImports","values","namedImportNames","names","namespaceImports","namespaceImportsDefault","namespaceImportsNamespace","namespace","namespaceImportsModuleSpecifier","lastPathSegment","includes","matchingImport","lastPthSegment","fixer","programNode","getNodeByRangeIndex","insertTextBefore","lstPathSegment","mightHaveTypePosition","tagMightHaveTypePosition","hasTypePosition","Boolean","iterateAllJsdocs","docs","description","url","fixable","schema","additionalProperties","properties","enum","module"],"sources":["../../src/rules/preferImportTag.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc.js';\nimport {\n commentParserToESTree,\n estreeToString,\n // getJSDocComment,\n parse as parseType,\n stringify,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\nimport {\n parseImportsExports,\n} from 'parse-imports-exports';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n settings,\n sourceCode,\n utils,\n}) => {\n const {\n mode,\n } = settings;\n\n const {\n enableFixer = true,\n exemptTypedefs = true,\n outputType = 'namespaced-import',\n } = context.options[0] || {};\n\n const allComments = sourceCode.getAllComments();\n const comments = allComments\n .filter((comment) => {\n return (/^\\*(?!\\*)/v).test(comment.value);\n })\n .map((commentNode) => {\n return commentParserToESTree(\n parseComment(commentNode, ''), mode === 'permissive' ? 'typescript' : mode,\n );\n });\n\n const typedefs = comments\n .flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return utils.isNamepathDefiningTag(tag);\n });\n });\n\n const imports = comments\n .flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return tag === 'import';\n });\n }).map((tag) => {\n // Causes problems with stringification otherwise\n tag.delimiter = '';\n return tag;\n });\n\n /**\n * @param {import('@es-joy/jsdoccomment').JsdocTagWithInline} tag\n */\n const iterateInlineImports = (tag) => {\n const potentialType = tag.type;\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde, parentNode) => {\n // @ts-expect-error Adding our own property for use below\n nde.parentNode = parentNode;\n });\n\n traverse(parsedType, (nde) => {\n const {\n element,\n type,\n } = /** @type {import('jsdoc-type-pratt-parser').ImportResult} */ (nde);\n if (type !== 'JsdocTypeImport') {\n return;\n }\n\n let currentNode = nde;\n\n /** @type {string[]} */\n const pathSegments = [];\n\n /** @type {import('jsdoc-type-pratt-parser').NamePathResult[]} */\n const nodes = [];\n\n /** @type {string[]} */\n const extraPathSegments = [];\n\n /** @type {(import('jsdoc-type-pratt-parser').QuoteStyle|undefined)[]} */\n const quotes = [];\n\n const propertyOrBrackets = /** @type {import('jsdoc-type-pratt-parser').NamePathResult['pathType'][]} */ ([]);\n\n // @ts-expect-error Referencing our own property added above\n while (currentNode && currentNode.parentNode) {\n // @ts-expect-error Referencing our own property added above\n currentNode = currentNode.parentNode;\n /* c8 ignore next 3 -- Guard */\n if (currentNode.type !== 'JsdocTypeNamePath') {\n break;\n }\n\n pathSegments.unshift(\n currentNode.right.type === 'JsdocTypeIndexedAccessIndex' ?\n stringify(currentNode.right.right) :\n currentNode.right.value,\n );\n nodes.unshift(currentNode);\n propertyOrBrackets.unshift(currentNode.pathType);\n quotes.unshift(\n currentNode.right.type === 'JsdocTypeIndexedAccessIndex' ?\n undefined :\n currentNode.right.meta.quote,\n );\n }\n\n /**\n * @param {string} matchingName\n * @param {string[]} extrPathSegments\n */\n const getFixer = (matchingName, extrPathSegments) => {\n return () => {\n /** @type {import('jsdoc-type-pratt-parser').NamePathResult|undefined} */\n let node = nodes.at(0);\n if (!node) {\n // Not really a NamePathResult, but will be converted later anyways\n node = /** @type {import('jsdoc-type-pratt-parser').NamePathResult} */ (\n /** @type {unknown} */\n (nde)\n );\n }\n\n const keys = /** @type {(keyof import('jsdoc-type-pratt-parser').NamePathResult)[]} */ (\n Object.keys(node)\n );\n\n for (const key of keys) {\n delete node[key];\n }\n\n if (extrPathSegments.length) {\n let newNode = /** @type {import('jsdoc-type-pratt-parser').NamePathResult} */ (\n /** @type {unknown} */\n (node)\n );\n while (extrPathSegments.length && newNode) {\n newNode.type = 'JsdocTypeNamePath';\n newNode.right = {\n meta: {\n quote: quotes.shift(),\n },\n type: 'JsdocTypeProperty',\n value: /** @type {string} */ (extrPathSegments.shift()),\n };\n\n newNode.pathType = /** @type {import('jsdoc-type-pratt-parser').NamePathResult['pathType']} */ (\n propertyOrBrackets.shift()\n );\n // @ts-expect-error Temporary\n newNode.left = {};\n newNode = /** @type {import('jsdoc-type-pratt-parser').NamePathResult} */ (\n newNode.left\n );\n }\n\n const nameNode = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (\n /** @type {unknown} */\n (newNode)\n );\n nameNode.type = 'JsdocTypeName';\n nameNode.value = matchingName;\n } else {\n const newNode = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (\n /** @type {unknown} */\n (node)\n );\n newNode.type = 'JsdocTypeName';\n newNode.value = matchingName;\n }\n\n for (const src of tag.source) {\n if (src.tokens.type) {\n src.tokens.type = `{${stringify(parsedType)}}`;\n break;\n }\n }\n };\n };\n\n /** @type {string[]} */\n let unusedPathSegments = [];\n\n const findMatchingTypedef = () => {\n // Don't want typedefs to find themselves\n if (!exemptTypedefs) {\n return undefined;\n }\n\n const pthSegments = [\n ...pathSegments,\n ];\n return typedefs.find((typedef) => {\n let typedefNode = typedef.parsedType;\n let namepathMatch;\n while (typedefNode && typedefNode.type === 'JsdocTypeNamePath') {\n const pathSegment = pthSegments.shift();\n if (!pathSegment) {\n namepathMatch = false;\n break;\n }\n\n if (\n (typedefNode.right.type === 'JsdocTypeIndexedAccessIndex' &&\n stringify(typedefNode.right.right) !== pathSegment) ||\n (typedefNode.right.type !== 'JsdocTypeIndexedAccessIndex' &&\n typedefNode.right.value !== pathSegment)\n ) {\n if (namepathMatch === true) {\n // It stopped matching, so stop\n break;\n }\n\n extraPathSegments.push(pathSegment);\n namepathMatch = false;\n continue;\n }\n\n namepathMatch = true;\n\n unusedPathSegments = pthSegments;\n\n typedefNode = typedefNode.left;\n }\n\n return namepathMatch &&\n // `import('eslint')` matches\n typedefNode &&\n typedefNode.type === 'JsdocTypeImport' &&\n typedefNode.element.value === element.value;\n });\n };\n\n // Check @typedef's first as should be longest match, allowing\n // for shorter abbreviations\n const matchingTypedef = findMatchingTypedef();\n if (matchingTypedef) {\n utils.reportJSDoc(\n 'Inline `import()` found; using `@typedef`',\n tag,\n enableFixer ? getFixer(matchingTypedef.name, [\n ...extraPathSegments,\n ...unusedPathSegments.slice(-1),\n ...unusedPathSegments.slice(0, -1),\n ]) : null,\n );\n return;\n }\n\n const findMatchingImport = () => {\n for (const imprt of imports) {\n const parsedImport = parseImportsExports(\n estreeToString(imprt).replace(/^\\s*@/v, '').trim(),\n );\n\n const namedImportsModuleSpecifier = Object.keys(parsedImport.namedImports || {})[0];\n\n const namedImports = Object.values(parsedImport.namedImports || {})[0]?.[0];\n const namedImportNames = (namedImports && namedImports.names && Object.keys(namedImports.names)) ?? [];\n\n const namespaceImports = Object.values(parsedImport.namespaceImports || {})[0]?.[0];\n\n const namespaceImportsDefault = namespaceImports && namespaceImports.default;\n const namespaceImportsNamespace = namespaceImports && namespaceImports.namespace;\n const namespaceImportsModuleSpecifier = Object.keys(parsedImport.namespaceImports || {})[0];\n\n const lastPathSegment = pathSegments.at(-1);\n\n if (\n (namespaceImportsDefault &&\n namespaceImportsModuleSpecifier === element.value) ||\n (element.value === namedImportsModuleSpecifier && (\n (lastPathSegment && namedImportNames.includes(lastPathSegment)) ||\n lastPathSegment === 'default'\n )) ||\n (namespaceImportsNamespace &&\n namespaceImportsModuleSpecifier === element.value)\n ) {\n return {\n namedImportNames,\n namedImports,\n namedImportsModuleSpecifier,\n namespaceImports,\n namespaceImportsDefault,\n namespaceImportsModuleSpecifier,\n namespaceImportsNamespace,\n };\n }\n }\n\n return undefined;\n };\n\n const matchingImport = findMatchingImport();\n if (matchingImport) {\n const {\n namedImportNames,\n namedImports,\n namedImportsModuleSpecifier,\n namespaceImportsNamespace,\n } = matchingImport;\n if (!namedImportNames.length && namedImportsModuleSpecifier && namedImports.default) {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? getFixer(namedImports.default, []) : null,\n );\n return;\n }\n\n const lastPthSegment = pathSegments.at(-1);\n if (lastPthSegment && namedImportNames.includes(lastPthSegment)) {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? getFixer(lastPthSegment, pathSegments.slice(0, -1)) : null,\n );\n return;\n }\n\n if (namespaceImportsNamespace) {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? getFixer(namespaceImportsNamespace, [\n ...pathSegments,\n ]) : null,\n );\n return;\n }\n }\n\n if (!pathSegments.length) {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? (fixer) => {\n getFixer(element.value, [])();\n\n const programNode = sourceCode.getNodeByRangeIndex(0);\n return fixer.insertTextBefore(\n /** @type {import('estree').Program} */ (programNode),\n `/** @import * as ${element.value} from '${element.value}'; */`,\n );\n } : null,\n );\n return;\n }\n\n const lstPathSegment = pathSegments.at(-1);\n if (lstPathSegment && lstPathSegment === 'default') {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? (fixer) => {\n getFixer(element.value, [])();\n\n const programNode = sourceCode.getNodeByRangeIndex(0);\n return fixer.insertTextBefore(\n /** @type {import('estree').Program} */ (programNode),\n `/** @import ${element.value} from '${element.value}'; */`,\n );\n } : null,\n );\n return;\n }\n\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? (fixer) => {\n if (outputType === 'namespaced-import') {\n getFixer(element.value, [\n ...pathSegments,\n ])();\n } else {\n getFixer(\n /** @type {string} */ (pathSegments.at(-1)),\n pathSegments.slice(0, -1),\n )();\n }\n\n const programNode = sourceCode.getNodeByRangeIndex(0);\n return fixer.insertTextBefore(\n /** @type {import('estree').Program} */ (programNode),\n outputType === 'namespaced-import' ?\n `/** @import * as ${element.value} from '${element.value}'; */` :\n `/** @import { ${pathSegments.at(-1)} } from '${element.value}'; */`,\n );\n } : null,\n );\n });\n };\n\n for (const tag of jsdoc.tags) {\n const mightHaveTypePosition = utils.tagMightHaveTypePosition(tag.tag);\n const hasTypePosition = mightHaveTypePosition === true && Boolean(tag.type);\n if (hasTypePosition && (!exemptTypedefs || !utils.isNamepathDefiningTag(tag.tag))) {\n iterateInlineImports(tag);\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Prefer `@import` tags to inline `import()` statements.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/prefer-import-tag.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n enableFixer: {\n description: 'Whether or not to enable the fixer to add `@import` tags.',\n type: 'boolean',\n },\n exemptTypedefs: {\n description: 'Whether to allow `import()` statements within `@typedef`',\n type: 'boolean',\n },\n\n // We might add `typedef` and `typedef-local-only`, but also raises\n // question of how deep the generated typedef should be\n outputType: {\n description: 'What kind of `@import` to generate when no matching `@typedef` or `@import` is found',\n enum: [\n 'named-import',\n 'namespaced-import',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AASA,IAAAE,oBAAA,GAAAF,OAAA;AAE+B,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAA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F;UACnGM,IAAI,EAAE,CACJ,cAAc,EACd,mBAAmB,CACpB;UACDvF,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAwF,MAAA,CAAAzH,OAAA,GAAAA,OAAA,CAAAV,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"preferImportTag.cjs","names":["_iterateJsdoc","_interopRequireWildcard","require","_jsdoccomment","_parseImportsExports","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_default","exports","iterateJsdoc","context","indent","jsdoc","settings","sourceCode","utils","mode","enableFixer","exemptTypedefs","outputType","options","allComments","getAllComments","comments","filter","comment","test","value","map","commentNode","commentParserToESTree","parseComment","typedefs","flatMap","doc","tags","tag","isNamepathDefiningTag","imports","delimiter","iterateInlineImports","potentialType","type","parsedType","tryParseType","parseType","traverse","nde","parentNode","element","currentNode","pathSegments","nodes","extraPathSegments","quotes","propertyOrBrackets","unshift","right","stringify","pathType","undefined","meta","quote","getFixer","matchingName","extrPathSegments","node","at","keys","key","length","newNode","shift","left","nameNode","src","source","tokens","unusedPathSegments","findMatchingTypedef","pthSegments","find","typedef","typedefNode","namepathMatch","pathSegment","push","matchingTypedef","reportJSDoc","name","slice","findMatchingImport","imprt","parsedImport","parseImportsExports","estreeToString","replace","trim","namedImportsModuleSpecifier","namedImports","values","namedImportNames","names","namespaceImports","namespaceImportsDefault","namespaceImportsNamespace","namespace","namespaceImportsModuleSpecifier","lastPathSegment","includes","matchingImport","lastPthSegment","fixer","programNode","ast","commentNodes","getCommentsBefore","insertTextBefore","lstPathSegment","getNodeByRangeIndex","mightHaveTypePosition","tagMightHaveTypePosition","hasTypePosition","Boolean","iterateAllJsdocs","docs","description","url","fixable","schema","additionalProperties","properties","enum","module"],"sources":["../../src/rules/preferImportTag.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc.js';\nimport {\n commentParserToESTree,\n estreeToString,\n // getJSDocComment,\n parse as parseType,\n stringify,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\nimport {\n parseImportsExports,\n} from 'parse-imports-exports';\n\nexport default iterateJsdoc(({\n context,\n indent,\n jsdoc,\n settings,\n sourceCode,\n utils,\n}) => {\n const {\n mode,\n } = settings;\n\n const {\n enableFixer = true,\n exemptTypedefs = true,\n outputType = 'namespaced-import',\n } = context.options[0] || {};\n\n const allComments = sourceCode.getAllComments();\n const comments = allComments\n .filter((comment) => {\n return (/^\\*(?!\\*)/v).test(comment.value);\n })\n .map((commentNode) => {\n return commentParserToESTree(\n parseComment(commentNode, ''), mode === 'permissive' ? 'typescript' : mode,\n );\n });\n\n const typedefs = comments\n .flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return utils.isNamepathDefiningTag(tag);\n });\n });\n\n const imports = comments\n .flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return tag === 'import';\n });\n }).map((tag) => {\n // Causes problems with stringification otherwise\n tag.delimiter = '';\n return tag;\n });\n\n /**\n * @param {import('@es-joy/jsdoccomment').JsdocTagWithInline} tag\n */\n const iterateInlineImports = (tag) => {\n const potentialType = tag.type;\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde, parentNode) => {\n // @ts-expect-error Adding our own property for use below\n nde.parentNode = parentNode;\n });\n\n traverse(parsedType, (nde) => {\n const {\n element,\n type,\n } = /** @type {import('jsdoc-type-pratt-parser').ImportResult} */ (nde);\n if (type !== 'JsdocTypeImport') {\n return;\n }\n\n let currentNode = nde;\n\n /** @type {string[]} */\n const pathSegments = [];\n\n /** @type {import('jsdoc-type-pratt-parser').NamePathResult[]} */\n const nodes = [];\n\n /** @type {string[]} */\n const extraPathSegments = [];\n\n /** @type {(import('jsdoc-type-pratt-parser').QuoteStyle|undefined)[]} */\n const quotes = [];\n\n const propertyOrBrackets = /** @type {import('jsdoc-type-pratt-parser').NamePathResult['pathType'][]} */ ([]);\n\n // @ts-expect-error Referencing our own property added above\n while (currentNode && currentNode.parentNode) {\n // @ts-expect-error Referencing our own property added above\n currentNode = currentNode.parentNode;\n /* c8 ignore next 3 -- Guard */\n if (currentNode.type !== 'JsdocTypeNamePath') {\n break;\n }\n\n pathSegments.unshift(\n currentNode.right.type === 'JsdocTypeIndexedAccessIndex' ?\n stringify(currentNode.right.right) :\n currentNode.right.value,\n );\n nodes.unshift(currentNode);\n propertyOrBrackets.unshift(currentNode.pathType);\n quotes.unshift(\n currentNode.right.type === 'JsdocTypeIndexedAccessIndex' ?\n undefined :\n currentNode.right.meta.quote,\n );\n }\n\n /**\n * @param {string} matchingName\n * @param {string[]} extrPathSegments\n */\n const getFixer = (matchingName, extrPathSegments) => {\n return () => {\n /** @type {import('jsdoc-type-pratt-parser').NamePathResult|undefined} */\n let node = nodes.at(0);\n if (!node) {\n // Not really a NamePathResult, but will be converted later anyways\n node = /** @type {import('jsdoc-type-pratt-parser').NamePathResult} */ (\n /** @type {unknown} */\n (nde)\n );\n }\n\n const keys = /** @type {(keyof import('jsdoc-type-pratt-parser').NamePathResult)[]} */ (\n Object.keys(node)\n );\n\n for (const key of keys) {\n delete node[key];\n }\n\n if (extrPathSegments.length) {\n let newNode = /** @type {import('jsdoc-type-pratt-parser').NamePathResult} */ (\n /** @type {unknown} */\n (node)\n );\n while (extrPathSegments.length && newNode) {\n newNode.type = 'JsdocTypeNamePath';\n newNode.right = {\n meta: {\n quote: quotes.shift(),\n },\n type: 'JsdocTypeProperty',\n value: /** @type {string} */ (extrPathSegments.shift()),\n };\n\n newNode.pathType = /** @type {import('jsdoc-type-pratt-parser').NamePathResult['pathType']} */ (\n propertyOrBrackets.shift()\n );\n // @ts-expect-error Temporary\n newNode.left = {};\n newNode = /** @type {import('jsdoc-type-pratt-parser').NamePathResult} */ (\n newNode.left\n );\n }\n\n const nameNode = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (\n /** @type {unknown} */\n (newNode)\n );\n nameNode.type = 'JsdocTypeName';\n nameNode.value = matchingName;\n } else {\n const newNode = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (\n /** @type {unknown} */\n (node)\n );\n newNode.type = 'JsdocTypeName';\n newNode.value = matchingName;\n }\n\n for (const src of tag.source) {\n if (src.tokens.type) {\n src.tokens.type = `{${stringify(parsedType)}}`;\n break;\n }\n }\n };\n };\n\n /** @type {string[]} */\n let unusedPathSegments = [];\n\n const findMatchingTypedef = () => {\n // Don't want typedefs to find themselves\n if (!exemptTypedefs) {\n return undefined;\n }\n\n const pthSegments = [\n ...pathSegments,\n ];\n return typedefs.find((typedef) => {\n let typedefNode = typedef.parsedType;\n let namepathMatch;\n while (typedefNode && typedefNode.type === 'JsdocTypeNamePath') {\n const pathSegment = pthSegments.shift();\n if (!pathSegment) {\n namepathMatch = false;\n break;\n }\n\n if (\n (typedefNode.right.type === 'JsdocTypeIndexedAccessIndex' &&\n stringify(typedefNode.right.right) !== pathSegment) ||\n (typedefNode.right.type !== 'JsdocTypeIndexedAccessIndex' &&\n typedefNode.right.value !== pathSegment)\n ) {\n if (namepathMatch === true) {\n // It stopped matching, so stop\n break;\n }\n\n extraPathSegments.push(pathSegment);\n namepathMatch = false;\n continue;\n }\n\n namepathMatch = true;\n\n unusedPathSegments = pthSegments;\n\n typedefNode = typedefNode.left;\n }\n\n return namepathMatch &&\n // `import('eslint')` matches\n typedefNode &&\n typedefNode.type === 'JsdocTypeImport' &&\n typedefNode.element.value === element.value;\n });\n };\n\n // Check @typedef's first as should be longest match, allowing\n // for shorter abbreviations\n const matchingTypedef = findMatchingTypedef();\n if (matchingTypedef) {\n utils.reportJSDoc(\n 'Inline `import()` found; using `@typedef`',\n tag,\n enableFixer ? getFixer(matchingTypedef.name, [\n ...extraPathSegments,\n ...unusedPathSegments.slice(-1),\n ...unusedPathSegments.slice(0, -1),\n ]) : null,\n );\n return;\n }\n\n const findMatchingImport = () => {\n for (const imprt of imports) {\n const parsedImport = parseImportsExports(\n estreeToString(imprt).replace(/^\\s*@/v, '').trim(),\n );\n\n const namedImportsModuleSpecifier = Object.keys(parsedImport.namedImports || {})[0];\n\n const namedImports = Object.values(parsedImport.namedImports || {})[0]?.[0];\n const namedImportNames = (namedImports && namedImports.names && Object.keys(namedImports.names)) ?? [];\n\n const namespaceImports = Object.values(parsedImport.namespaceImports || {})[0]?.[0];\n\n const namespaceImportsDefault = namespaceImports && namespaceImports.default;\n const namespaceImportsNamespace = namespaceImports && namespaceImports.namespace;\n const namespaceImportsModuleSpecifier = Object.keys(parsedImport.namespaceImports || {})[0];\n\n const lastPathSegment = pathSegments.at(-1);\n\n if (\n (namespaceImportsDefault &&\n namespaceImportsModuleSpecifier === element.value) ||\n (element.value === namedImportsModuleSpecifier && (\n (lastPathSegment && namedImportNames.includes(lastPathSegment)) ||\n lastPathSegment === 'default'\n )) ||\n (namespaceImportsNamespace &&\n namespaceImportsModuleSpecifier === element.value)\n ) {\n return {\n namedImportNames,\n namedImports,\n namedImportsModuleSpecifier,\n namespaceImports,\n namespaceImportsDefault,\n namespaceImportsModuleSpecifier,\n namespaceImportsNamespace,\n };\n }\n }\n\n return undefined;\n };\n\n const matchingImport = findMatchingImport();\n if (matchingImport) {\n const {\n namedImportNames,\n namedImports,\n namedImportsModuleSpecifier,\n namespaceImportsNamespace,\n } = matchingImport;\n if (!namedImportNames.length && namedImportsModuleSpecifier && namedImports.default) {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? getFixer(namedImports.default, []) : null,\n );\n return;\n }\n\n const lastPthSegment = pathSegments.at(-1);\n if (lastPthSegment && namedImportNames.includes(lastPthSegment)) {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? getFixer(lastPthSegment, pathSegments.slice(0, -1)) : null,\n );\n return;\n }\n\n if (namespaceImportsNamespace) {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? getFixer(namespaceImportsNamespace, [\n ...pathSegments,\n ]) : null,\n );\n return;\n }\n }\n\n if (!pathSegments.length) {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? (fixer) => {\n getFixer(element.value, [])();\n\n const programNode = sourceCode.ast;\n const commentNodes = sourceCode.getCommentsBefore(programNode);\n return fixer.insertTextBefore(\n // @ts-expect-error Ok\n commentNodes[0] ?? programNode,\n `/** @import * as ${element.value} from '${element.value}'; */${\n commentNodes[0] ? '\\n' + indent : ''\n }`,\n );\n } : null,\n );\n return;\n }\n\n const lstPathSegment = pathSegments.at(-1);\n if (lstPathSegment && lstPathSegment === 'default') {\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? (fixer) => {\n getFixer(element.value, [])();\n\n const programNode = sourceCode.getNodeByRangeIndex(0);\n return fixer.insertTextBefore(\n /** @type {import('estree').Program} */ (programNode),\n `/** @import ${element.value} from '${element.value}'; */`,\n );\n } : null,\n );\n return;\n }\n\n utils.reportJSDoc(\n 'Inline `import()` found; prefer `@import`',\n tag,\n enableFixer ? (fixer) => {\n if (outputType === 'namespaced-import') {\n getFixer(element.value, [\n ...pathSegments,\n ])();\n } else {\n getFixer(\n /** @type {string} */ (pathSegments.at(-1)),\n pathSegments.slice(0, -1),\n )();\n }\n\n const programNode = sourceCode.getNodeByRangeIndex(0);\n return fixer.insertTextBefore(\n /** @type {import('estree').Program} */ (programNode),\n outputType === 'namespaced-import' ?\n `/** @import * as ${element.value} from '${element.value}'; */` :\n `/** @import { ${pathSegments.at(-1)} } from '${element.value}'; */`,\n );\n } : null,\n );\n });\n };\n\n for (const tag of jsdoc.tags) {\n const mightHaveTypePosition = utils.tagMightHaveTypePosition(tag.tag);\n const hasTypePosition = mightHaveTypePosition === true && Boolean(tag.type);\n if (hasTypePosition && (!exemptTypedefs || !utils.isNamepathDefiningTag(tag.tag))) {\n iterateInlineImports(tag);\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Prefer `@import` tags to inline `import()` statements.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/prefer-import-tag.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n enableFixer: {\n description: 'Whether or not to enable the fixer to add `@import` tags.',\n type: 'boolean',\n },\n exemptTypedefs: {\n description: 'Whether to allow `import()` statements within `@typedef`',\n type: 'boolean',\n },\n\n // We might add `typedef` and `typedef-local-only`, but also raises\n // question of how deep the generated typedef should be\n outputType: {\n description: 'What kind of `@import` to generate when no matching `@typedef` or `@import` is found',\n enum: [\n 'named-import',\n 'namespaced-import',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AASA,IAAAE,oBAAA,GAAAF,OAAA;AAE+B,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO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