eslint-plugin-jsdoc 63.3.3 → 64.0.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 (269) hide show
  1. package/package.json +23 -48
  2. package/src/index.js +3 -6
  3. package/dist/WarnSettings.cjs +0 -38
  4. package/dist/WarnSettings.cjs.map +0 -1
  5. package/dist/alignTransform.cjs +0 -402
  6. package/dist/alignTransform.cjs.map +0 -1
  7. package/dist/buildForbidRuleDefinition.cjs +0 -101
  8. package/dist/buildForbidRuleDefinition.cjs.map +0 -1
  9. package/dist/buildRejectOrPreferRuleDefinition.cjs +0 -352
  10. package/dist/buildRejectOrPreferRuleDefinition.cjs.map +0 -1
  11. package/dist/cjs/WarnSettings.d.ts +0 -16
  12. package/dist/cjs/alignTransform.d.ts +0 -33
  13. package/dist/cjs/buildForbidRuleDefinition.d.ts +0 -14
  14. package/dist/cjs/buildRejectOrPreferRuleDefinition.d.ts +0 -8
  15. package/dist/cjs/defaultTagOrder.d.ts +0 -4
  16. package/dist/cjs/exportParser.d.ts +0 -40
  17. package/dist/cjs/getDefaultTagStructureForMode.d.ts +0 -10
  18. package/dist/cjs/getJsdocProcessorPlugin.d.cts +0 -5
  19. package/dist/cjs/getJsdocProcessorPlugin.d.ts +0 -66
  20. package/dist/cjs/index-cjs.d.ts +0 -26
  21. package/dist/cjs/index.cjs.d.cts +0 -2
  22. package/dist/cjs/iterateJsdoc.d.cts +0 -7
  23. package/dist/cjs/iterateJsdoc.d.ts +0 -495
  24. package/dist/cjs/jsdocUtils.d.ts +0 -500
  25. package/dist/cjs/rules/checkAccess.d.ts +0 -2
  26. package/dist/cjs/rules/checkAlignment.d.ts +0 -2
  27. package/dist/cjs/rules/checkExamples.d.ts +0 -3
  28. package/dist/cjs/rules/checkIndentation.d.ts +0 -2
  29. package/dist/cjs/rules/checkLineAlignment.d.ts +0 -9
  30. package/dist/cjs/rules/checkParamNames.d.ts +0 -2
  31. package/dist/cjs/rules/checkPropertyNames.d.ts +0 -2
  32. package/dist/cjs/rules/checkSyntax.d.ts +0 -2
  33. package/dist/cjs/rules/checkTagNames.d.ts +0 -2
  34. package/dist/cjs/rules/checkTemplateNames.d.ts +0 -2
  35. package/dist/cjs/rules/checkTypes.d.ts +0 -7
  36. package/dist/cjs/rules/checkValues.d.ts +0 -2
  37. package/dist/cjs/rules/convertToJsdocComments.d.ts +0 -266
  38. package/dist/cjs/rules/emptyTags.d.ts +0 -2
  39. package/dist/cjs/rules/escapeInlineTags.d.ts +0 -2
  40. package/dist/cjs/rules/implementsOnClasses.d.ts +0 -2
  41. package/dist/cjs/rules/importsAsDependencies.d.ts +0 -2
  42. package/dist/cjs/rules/informativeDocs.d.ts +0 -2
  43. package/dist/cjs/rules/linesBeforeBlock.d.ts +0 -2
  44. package/dist/cjs/rules/matchDescription.d.ts +0 -2
  45. package/dist/cjs/rules/matchName.d.ts +0 -2
  46. package/dist/cjs/rules/multilineBlocks.d.ts +0 -2
  47. package/dist/cjs/rules/noBadBlocks.d.ts +0 -2
  48. package/dist/cjs/rules/noBlankBlockDescriptions.d.ts +0 -2
  49. package/dist/cjs/rules/noBlankBlocks.d.ts +0 -2
  50. package/dist/cjs/rules/noDefaults.d.ts +0 -2
  51. package/dist/cjs/rules/noMissingSyntax.d.ts +0 -9
  52. package/dist/cjs/rules/noMultiAsterisks.d.ts +0 -2
  53. package/dist/cjs/rules/noRestrictedSyntax.d.ts +0 -2
  54. package/dist/cjs/rules/noTypes.d.ts +0 -2
  55. package/dist/cjs/rules/noUndefinedTypes.d.ts +0 -2
  56. package/dist/cjs/rules/normalizeSeeLinks.d.ts +0 -2
  57. package/dist/cjs/rules/preferImportTag.d.ts +0 -2
  58. package/dist/cjs/rules/requireAsteriskPrefix.d.ts +0 -2
  59. package/dist/cjs/rules/requireDescription.d.ts +0 -2
  60. package/dist/cjs/rules/requireDescriptionCompleteSentence.d.ts +0 -2
  61. package/dist/cjs/rules/requireExample.d.ts +0 -2
  62. package/dist/cjs/rules/requireFileOverview.d.ts +0 -2
  63. package/dist/cjs/rules/requireHyphenBeforeParamDescription.d.ts +0 -2
  64. package/dist/cjs/rules/requireJsdoc.d.ts +0 -24
  65. package/dist/cjs/rules/requireParam.d.ts +0 -3
  66. package/dist/cjs/rules/requireParamDescription.d.ts +0 -2
  67. package/dist/cjs/rules/requireParamName.d.ts +0 -2
  68. package/dist/cjs/rules/requireParamType.d.ts +0 -2
  69. package/dist/cjs/rules/requireProperty.d.ts +0 -2
  70. package/dist/cjs/rules/requirePropertyDescription.d.ts +0 -2
  71. package/dist/cjs/rules/requirePropertyName.d.ts +0 -2
  72. package/dist/cjs/rules/requirePropertyType.d.ts +0 -2
  73. package/dist/cjs/rules/requireRejects.d.ts +0 -2
  74. package/dist/cjs/rules/requireReturns.d.ts +0 -2
  75. package/dist/cjs/rules/requireReturnsCheck.d.ts +0 -2
  76. package/dist/cjs/rules/requireReturnsDescription.d.ts +0 -2
  77. package/dist/cjs/rules/requireReturnsType.d.ts +0 -2
  78. package/dist/cjs/rules/requireTags.d.ts +0 -2
  79. package/dist/cjs/rules/requireTemplate.d.ts +0 -2
  80. package/dist/cjs/rules/requireThrows.d.ts +0 -2
  81. package/dist/cjs/rules/requireYields.d.ts +0 -2
  82. package/dist/cjs/rules/requireYieldsCheck.d.ts +0 -2
  83. package/dist/cjs/rules/sortTags.d.ts +0 -2
  84. package/dist/cjs/rules/tagLines.d.ts +0 -2
  85. package/dist/cjs/rules/textEscaping.d.ts +0 -2
  86. package/dist/cjs/rules/tsMethodSignatureStyle.d.ts +0 -2
  87. package/dist/cjs/rules/tsNoEmptyObjectType.d.ts +0 -2
  88. package/dist/cjs/rules/tsNoUnnecessaryTemplateExpression.d.ts +0 -2
  89. package/dist/cjs/rules/tsPreferFunctionType.d.ts +0 -2
  90. package/dist/cjs/rules/typeFormatting.d.ts +0 -2
  91. package/dist/cjs/rules/validTypes.d.ts +0 -2
  92. package/dist/cjs/tagNames.d.ts +0 -15
  93. package/dist/cjs/utils/hasReturnValue.d.ts +0 -19
  94. package/dist/defaultTagOrder.cjs +0 -46
  95. package/dist/defaultTagOrder.cjs.map +0 -1
  96. package/dist/exportParser.cjs +0 -732
  97. package/dist/exportParser.cjs.map +0 -1
  98. package/dist/generateDocs.cjs +0 -342
  99. package/dist/generateDocs.cjs.map +0 -1
  100. package/dist/generateOptions.cjs +0 -62
  101. package/dist/generateOptions.cjs.map +0 -1
  102. package/dist/generateRule.cjs +0 -248
  103. package/dist/generateRule.cjs.map +0 -1
  104. package/dist/generateRuleTypes.cjs +0 -24
  105. package/dist/generateRuleTypes.cjs.map +0 -1
  106. package/dist/getDefaultTagStructureForMode.cjs +0 -289
  107. package/dist/getDefaultTagStructureForMode.cjs.map +0 -1
  108. package/dist/getJsdocProcessorPlugin.cjs +0 -587
  109. package/dist/getJsdocProcessorPlugin.cjs.map +0 -1
  110. package/dist/getJsdocProcessorPlugin.cts +0 -5
  111. package/dist/index-cjs.cjs +0 -600
  112. package/dist/index-cjs.cjs.map +0 -1
  113. package/dist/index-cjs.d.ts +0 -27
  114. package/dist/index-esm.cjs +0 -162
  115. package/dist/index-esm.cjs.map +0 -1
  116. package/dist/index-esm.d.ts +0 -72
  117. package/dist/index.cjs +0 -748
  118. package/dist/index.cjs.cts +0 -3
  119. package/dist/index.cjs.map +0 -1
  120. package/dist/iterateJsdoc.cjs +0 -2150
  121. package/dist/iterateJsdoc.cjs.map +0 -1
  122. package/dist/iterateJsdoc.cts +0 -7
  123. package/dist/jsdocUtils.cjs +0 -1786
  124. package/dist/jsdocUtils.cjs.map +0 -1
  125. package/dist/rules/checkAccess.cjs +0 -40
  126. package/dist/rules/checkAccess.cjs.map +0 -1
  127. package/dist/rules/checkAlignment.cjs +0 -78
  128. package/dist/rules/checkAlignment.cjs.map +0 -1
  129. package/dist/rules/checkExamples.cjs +0 -521
  130. package/dist/rules/checkExamples.cjs.map +0 -1
  131. package/dist/rules/checkIndentation.cjs +0 -170
  132. package/dist/rules/checkIndentation.cjs.map +0 -1
  133. package/dist/rules/checkLineAlignment.cjs +0 -398
  134. package/dist/rules/checkLineAlignment.cjs.map +0 -1
  135. package/dist/rules/checkParamNames.cjs +0 -407
  136. package/dist/rules/checkParamNames.cjs.map +0 -1
  137. package/dist/rules/checkPropertyNames.cjs +0 -135
  138. package/dist/rules/checkPropertyNames.cjs.map +0 -1
  139. package/dist/rules/checkSyntax.cjs +0 -38
  140. package/dist/rules/checkSyntax.cjs.map +0 -1
  141. package/dist/rules/checkTagNames.cjs +0 -312
  142. package/dist/rules/checkTagNames.cjs.map +0 -1
  143. package/dist/rules/checkTemplateNames.cjs +0 -192
  144. package/dist/rules/checkTemplateNames.cjs.map +0 -1
  145. package/dist/rules/checkTypes.cjs +0 -111
  146. package/dist/rules/checkTypes.cjs.map +0 -1
  147. package/dist/rules/checkValues.cjs +0 -166
  148. package/dist/rules/checkValues.cjs.map +0 -1
  149. package/dist/rules/convertToJsdocComments.cjs +0 -356
  150. package/dist/rules/convertToJsdocComments.cjs.map +0 -1
  151. package/dist/rules/emptyTags.cjs +0 -98
  152. package/dist/rules/emptyTags.cjs.map +0 -1
  153. package/dist/rules/escapeInlineTags.cjs +0 -234
  154. package/dist/rules/escapeInlineTags.cjs.map +0 -1
  155. package/dist/rules/implementsOnClasses.cjs +0 -74
  156. package/dist/rules/implementsOnClasses.cjs.map +0 -1
  157. package/dist/rules/importsAsDependencies.cjs +0 -104
  158. package/dist/rules/importsAsDependencies.cjs.map +0 -1
  159. package/dist/rules/informativeDocs.cjs +0 -187
  160. package/dist/rules/informativeDocs.cjs.map +0 -1
  161. package/dist/rules/linesBeforeBlock.cjs +0 -120
  162. package/dist/rules/linesBeforeBlock.cjs.map +0 -1
  163. package/dist/rules/matchDescription.cjs +0 -356
  164. package/dist/rules/matchDescription.cjs.map +0 -1
  165. package/dist/rules/matchName.cjs +0 -160
  166. package/dist/rules/matchName.cjs.map +0 -1
  167. package/dist/rules/multilineBlocks.cjs +0 -431
  168. package/dist/rules/multilineBlocks.cjs.map +0 -1
  169. package/dist/rules/noBadBlocks.cjs +0 -100
  170. package/dist/rules/noBadBlocks.cjs.map +0 -1
  171. package/dist/rules/noBlankBlockDescriptions.cjs +0 -63
  172. package/dist/rules/noBlankBlockDescriptions.cjs.map +0 -1
  173. package/dist/rules/noBlankBlocks.cjs +0 -54
  174. package/dist/rules/noBlankBlocks.cjs.map +0 -1
  175. package/dist/rules/noDefaults.cjs +0 -102
  176. package/dist/rules/noDefaults.cjs.map +0 -1
  177. package/dist/rules/noMissingSyntax.cjs +0 -196
  178. package/dist/rules/noMissingSyntax.cjs.map +0 -1
  179. package/dist/rules/noMultiAsterisks.cjs +0 -126
  180. package/dist/rules/noMultiAsterisks.cjs.map +0 -1
  181. package/dist/rules/noRestrictedSyntax.cjs +0 -68
  182. package/dist/rules/noRestrictedSyntax.cjs.map +0 -1
  183. package/dist/rules/noTypes.cjs +0 -101
  184. package/dist/rules/noTypes.cjs.map +0 -1
  185. package/dist/rules/noUndefinedTypes.cjs +0 -616
  186. package/dist/rules/noUndefinedTypes.cjs.map +0 -1
  187. package/dist/rules/normalizeSeeLinks.cjs +0 -271
  188. package/dist/rules/normalizeSeeLinks.cjs.map +0 -1
  189. package/dist/rules/preferImportTag.cjs +0 -362
  190. package/dist/rules/preferImportTag.cjs.map +0 -1
  191. package/dist/rules/requireAsteriskPrefix.cjs +0 -190
  192. package/dist/rules/requireAsteriskPrefix.cjs.map +0 -1
  193. package/dist/rules/requireDescription.cjs +0 -164
  194. package/dist/rules/requireDescription.cjs.map +0 -1
  195. package/dist/rules/requireDescriptionCompleteSentence.cjs +0 -321
  196. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +0 -1
  197. package/dist/rules/requireExample.cjs +0 -136
  198. package/dist/rules/requireExample.cjs.map +0 -1
  199. package/dist/rules/requireFileOverview.cjs +0 -194
  200. package/dist/rules/requireFileOverview.cjs.map +0 -1
  201. package/dist/rules/requireHyphenBeforeParamDescription.cjs +0 -166
  202. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +0 -1
  203. package/dist/rules/requireJsdoc.cjs +0 -721
  204. package/dist/rules/requireJsdoc.cjs.map +0 -1
  205. package/dist/rules/requireParam.cjs +0 -772
  206. package/dist/rules/requireParam.cjs.map +0 -1
  207. package/dist/rules/requireParamDescription.cjs +0 -105
  208. package/dist/rules/requireParamDescription.cjs.map +0 -1
  209. package/dist/rules/requireParamName.cjs +0 -68
  210. package/dist/rules/requireParamName.cjs.map +0 -1
  211. package/dist/rules/requireParamType.cjs +0 -104
  212. package/dist/rules/requireParamType.cjs.map +0 -1
  213. package/dist/rules/requireProperty.cjs +0 -63
  214. package/dist/rules/requireProperty.cjs.map +0 -1
  215. package/dist/rules/requirePropertyDescription.cjs +0 -29
  216. package/dist/rules/requirePropertyDescription.cjs.map +0 -1
  217. package/dist/rules/requirePropertyName.cjs +0 -29
  218. package/dist/rules/requirePropertyName.cjs.map +0 -1
  219. package/dist/rules/requirePropertyType.cjs +0 -29
  220. package/dist/rules/requirePropertyType.cjs.map +0 -1
  221. package/dist/rules/requireRejects.cjs +0 -226
  222. package/dist/rules/requireRejects.cjs.map +0 -1
  223. package/dist/rules/requireReturns.cjs +0 -262
  224. package/dist/rules/requireReturns.cjs.map +0 -1
  225. package/dist/rules/requireReturnsCheck.cjs +0 -225
  226. package/dist/rules/requireReturnsCheck.cjs.map +0 -1
  227. package/dist/rules/requireReturnsDescription.cjs +0 -72
  228. package/dist/rules/requireReturnsDescription.cjs.map +0 -1
  229. package/dist/rules/requireReturnsType.cjs +0 -68
  230. package/dist/rules/requireReturnsType.cjs.map +0 -1
  231. package/dist/rules/requireTags.cjs +0 -74
  232. package/dist/rules/requireTags.cjs.map +0 -1
  233. package/dist/rules/requireTemplate.cjs +0 -220
  234. package/dist/rules/requireTemplate.cjs.map +0 -1
  235. package/dist/rules/requireThrows.cjs +0 -118
  236. package/dist/rules/requireThrows.cjs.map +0 -1
  237. package/dist/rules/requireYields.cjs +0 -224
  238. package/dist/rules/requireYields.cjs.map +0 -1
  239. package/dist/rules/requireYieldsCheck.cjs +0 -179
  240. package/dist/rules/requireYieldsCheck.cjs.map +0 -1
  241. package/dist/rules/sortTags.cjs +0 -656
  242. package/dist/rules/sortTags.cjs.map +0 -1
  243. package/dist/rules/tagLines.cjs +0 -374
  244. package/dist/rules/tagLines.cjs.map +0 -1
  245. package/dist/rules/textEscaping.cjs +0 -141
  246. package/dist/rules/textEscaping.cjs.map +0 -1
  247. package/dist/rules/tsMethodSignatureStyle.cjs +0 -240
  248. package/dist/rules/tsMethodSignatureStyle.cjs.map +0 -1
  249. package/dist/rules/tsNoEmptyObjectType.cjs +0 -62
  250. package/dist/rules/tsNoEmptyObjectType.cjs.map +0 -1
  251. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs +0 -104
  252. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs.map +0 -1
  253. package/dist/rules/tsPreferFunctionType.cjs +0 -110
  254. package/dist/rules/tsPreferFunctionType.cjs.map +0 -1
  255. package/dist/rules/typeFormatting.cjs +0 -607
  256. package/dist/rules/typeFormatting.cjs.map +0 -1
  257. package/dist/rules/validTypes.cjs +0 -324
  258. package/dist/rules/validTypes.cjs.map +0 -1
  259. package/dist/tagNames.cjs +0 -244
  260. package/dist/tagNames.cjs.map +0 -1
  261. package/dist/to-valid-identifier.cjs +0 -263
  262. package/dist/utils/hasReturnValue.cjs +0 -495
  263. package/dist/utils/hasReturnValue.cjs.map +0 -1
  264. package/rollup.config.js +0 -16
  265. package/src/getJsdocProcessorPlugin.cts +0 -5
  266. package/src/index-cjs.js +0 -760
  267. package/src/index-esm.js +0 -196
  268. package/src/index.cjs.cts +0 -3
  269. package/src/iterateJsdoc.cts +0 -7
@@ -1,98 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- const defaultEmptyTags = new Set(['abstract', 'async', 'generator', 'global', 'hideconstructor',
10
- // jsdoc doesn't use this form in its docs, but allow for compatibility with
11
- // TypeScript which allows and Closure which requires
12
- 'ignore',
13
- // jsdoc doesn't use but allow for TypeScript
14
- 'inheritDoc', 'inner', 'instance', 'internal', 'overload', 'override', 'readonly']);
15
- const emptyIfNotClosure = new Set([
16
- // Closure doesn't allow with this casing
17
- 'inheritdoc', 'package', 'private', 'protected', 'public', 'static']);
18
- const emptyIfClosure = new Set(['interface']);
19
- var _default = exports.default = (0, _iterateJsdoc.default)(({
20
- jsdoc,
21
- settings,
22
- utils
23
- }) => {
24
- const emptyTags = utils.filterTags(({
25
- tag: tagName
26
- }) => {
27
- return defaultEmptyTags.has(tagName) || utils.hasOptionTag(tagName) && jsdoc.tags.some(({
28
- tag
29
- }) => {
30
- return tag === tagName;
31
- }) || settings.mode === 'closure' && emptyIfClosure.has(tagName) || settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);
32
- });
33
- for (const [key, tag] of emptyTags.entries()) {
34
- const content = tag.name || tag.description || tag.type;
35
- if (content.trim() && (
36
- // Allow for JSDoc-block final asterisks
37
- key !== emptyTags.length - 1 || !/^\s*\*+$/v.test(content))) {
38
- const {
39
- tokens: {
40
- delimiter,
41
- end,
42
- postName,
43
- start
44
- }
45
- } = tag.source[0];
46
- const fix = () => {
47
- // By time of call in fixer, `tag` will have `line` added
48
- utils.setTag(
49
- /**
50
- * @type {import('comment-parser').Spec & {
51
- * line: import('../iterateJsdoc.js').Integer
52
- * }}
53
- */
54
- tag, {
55
- delimiter,
56
- end,
57
- postName: end ? postName : '',
58
- start
59
- });
60
- };
61
- utils.reportJSDoc(`@${tag.tag} should be empty.`, tag, fix, true);
62
- }
63
- }
64
- }, {
65
- checkInternal: true,
66
- checkPrivate: true,
67
- iterateAllJsdocs: true,
68
- meta: {
69
- docs: {
70
- description: 'Checks tags that are expected to be empty (e.g., `@abstract` or `@async`), reporting if they have content',
71
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md#repos-sticky-header'
72
- },
73
- fixable: 'code',
74
- schema: [{
75
- additionalProperties: false,
76
- properties: {
77
- tags: {
78
- description: `If you want additional tags to be checked for their descriptions, you may
79
- add them within this option.
80
-
81
- \`\`\`js
82
- {
83
- 'jsdoc/empty-tags': ['error', {tags: ['event']}]
84
- }
85
- \`\`\``,
86
- items: {
87
- type: 'string'
88
- },
89
- type: 'array'
90
- }
91
- },
92
- type: 'object'
93
- }],
94
- type: 'suggestion'
95
- }
96
- });
97
- module.exports = exports.default;
98
- //# sourceMappingURL=emptyTags.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emptyTags.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/emptyTags.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst defaultEmptyTags = new Set([\n 'abstract', 'async', 'generator', 'global', 'hideconstructor',\n\n // jsdoc doesn't use this form in its docs, but allow for compatibility with\n // TypeScript which allows and Closure which requires\n 'ignore',\n\n // jsdoc doesn't use but allow for TypeScript\n 'inheritDoc', 'inner', 'instance',\n 'internal',\n\n 'overload',\n\n 'override',\n 'readonly',\n]);\n\nconst emptyIfNotClosure = new Set([\n // Closure doesn't allow with this casing\n 'inheritdoc', 'package', 'private', 'protected', 'public',\n\n 'static',\n]);\n\nconst emptyIfClosure = new Set([\n 'interface',\n]);\n\nexport default iterateJsdoc(({\n jsdoc,\n settings,\n utils,\n}) => {\n const emptyTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return defaultEmptyTags.has(tagName) ||\n utils.hasOptionTag(tagName) && jsdoc.tags.some(({\n tag,\n }) => {\n return tag === tagName;\n }) ||\n settings.mode === 'closure' && emptyIfClosure.has(tagName) ||\n settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);\n });\n\n for (const [\n key,\n tag,\n ] of emptyTags.entries()) {\n const content = tag.name || tag.description || tag.type;\n if (content.trim() && (\n // Allow for JSDoc-block final asterisks\n key !== emptyTags.length - 1 || !(/^\\s*\\*+$/v).test(content)\n )) {\n const {\n tokens: {\n delimiter,\n end,\n postName,\n start,\n },\n } = tag.source[0];\n const fix = () => {\n // By time of call in fixer, `tag` will have `line` added\n utils.setTag(\n /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }}\n */ (tag),\n {\n delimiter,\n end,\n postName: end ? postName : '',\n start,\n },\n );\n };\n\n utils.reportJSDoc(`@${tag.tag} should be empty.`, tag, fix, true);\n }\n }\n}, {\n checkInternal: true,\n checkPrivate: true,\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Checks tags that are expected to be empty (e.g., `@abstract` or `@async`), reporting if they have content',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n description: `If you want additional tags to be checked for their descriptions, you may\nadd them within this option.\n\n\\`\\`\\`js\n{\n 'jsdoc/empty-tags': ['error', {tags: ['event']}]\n}\n\\`\\`\\``,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAC/B,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB;AAE7D;AACA;AACA,QAAQ;AAER;AACA,YAAY,EAAE,OAAO,EAAE,UAAU,EACjC,UAAU,EAEV,UAAU,EAEV,UAAU,EACV,UAAU,CACX,CAAC;AAEF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;AAChC;AACA,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAEzD,QAAQ,CACT,CAAC;AAEF,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,C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F,CACF,CAAC;MACH,CAAC;MAED,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,GAAG,mBAAmB,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC;IACnE;EACF;AACF,CAAC,EAAE;EACD,aAAa,EAAE,IAAI;EACnB,YAAY,EAAE,IAAI;EAClB,gBAAgB,EAAE,IAAI;EACtB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,2GAA2G;MACxH,GAAG,EAAE;IACP,CAAC;IACD,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,IAAI,EAAE;UACJ,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACK,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,234 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- var _default = exports.default = (0, _iterateJsdoc.default)(({
10
- context,
11
- jsdoc,
12
- settings,
13
- utils
14
- }) => {
15
- const {
16
- mode
17
- } = settings;
18
- if (mode !== 'typescript') {
19
- return;
20
- }
21
- const {
22
- allowedInlineTags = [],
23
- enableFixer = false,
24
- fixType = 'backslash'
25
- } = context.options[0] || {};
26
- const {
27
- description
28
- } = utils.getDescription();
29
-
30
- /** @type {string[]} */
31
- const tagNames = [];
32
-
33
- /** @type {number[]} */
34
- const indexes = [];
35
- const unescapedInlineTagRegex = /(?:^|\s)@(\w+)/gv;
36
- const scopedPackageNameRegex = /^@[\w.\-]+\/[\w.\-]+/v;
37
- const declarationReferenceInlineTags = new Set(['inheritDoc', 'link', 'linkcode', 'linkplain']);
38
- const markdownCodeSpanRegex = /(?<!\\)(`+)(?!`)[\s\S]*?(?<!`)\1(?!`)/gv;
39
-
40
- /**
41
- * @param {string} desc
42
- * @param {number} index
43
- * @returns {boolean}
44
- */
45
- const isInsideMarkdownCodeSpan = (desc, index) => {
46
- markdownCodeSpanRegex.lastIndex = 0;
47
- let match;
48
- while ((match = markdownCodeSpanRegex.exec(desc)) !== null) {
49
- const delimiterLength = match[1].length;
50
- const contentStart = match.index + delimiterLength;
51
- const contentEnd = match.index + match[0].length - delimiterLength;
52
- if (index < contentStart) {
53
- return false;
54
- }
55
- if (index < contentEnd) {
56
- return true;
57
- }
58
- }
59
- return false;
60
- };
61
-
62
- /**
63
- * @param {string} desc
64
- * @param {number} atSignIndex
65
- * @returns {string}
66
- */
67
- const getInlineTagName = (desc, atSignIndex) => {
68
- const inlineTagStart = desc.lastIndexOf('{@', atSignIndex);
69
- if (inlineTagStart === -1) {
70
- return '';
71
- }
72
- const inlineTagEnd = desc.indexOf('}', inlineTagStart);
73
- if (inlineTagEnd === -1 || inlineTagEnd <= atSignIndex) {
74
- return '';
75
- }
76
- return desc.slice(inlineTagStart + 2).match(/^\w+/v)?.[0] || '';
77
- };
78
-
79
- /**
80
- * @param {string} desc
81
- * @param {string} match
82
- * @param {number} offset
83
- * @returns {boolean}
84
- */
85
- const shouldIgnoreMatch = (desc, match, offset) => {
86
- const atSignIndex = offset + match.lastIndexOf('@');
87
- const inlineTagName = getInlineTagName(desc, atSignIndex);
88
- return isInsideMarkdownCodeSpan(desc, atSignIndex) || declarationReferenceInlineTags.has(inlineTagName) && scopedPackageNameRegex.test(desc.slice(atSignIndex));
89
- };
90
-
91
- /**
92
- * @param {string} tagName
93
- * @returns {[
94
- * RegExp,
95
- * (description: string) => string
96
- * ]}
97
- */
98
- const escapeInlineTags = tagName => {
99
- const regex = new RegExp(`(^|\\s)@${
100
- // No need to escape, as contains only safe characters
101
- tagName}`, 'gv');
102
- return [regex,
103
- /**
104
- * @param {string} desc
105
- */
106
- desc => {
107
- return desc.replaceAll(regex, (match, prefix, offset) => {
108
- if (shouldIgnoreMatch(desc, match, offset)) {
109
- return match;
110
- }
111
- return fixType === 'backticks' ? prefix + '`@' + tagName + '`' : prefix + '\\@' + tagName;
112
- });
113
- }];
114
- };
115
-
116
- /**
117
- * @param {string} desc
118
- * @returns {string}
119
- */
120
- const getUnescapedInlineTagName = desc => {
121
- unescapedInlineTagRegex.lastIndex = 0;
122
- let match;
123
- while ((match = unescapedInlineTagRegex.exec(desc)) !== null) {
124
- const [fullMatch, tagName] = match;
125
- if (allowedInlineTags.includes(tagName) || shouldIgnoreMatch(desc, fullMatch, match.index)) {
126
- continue;
127
- }
128
- return tagName;
129
- }
130
- return '';
131
- };
132
- const normalizedDescription = description.startsWith('\n') ? description.slice(1) : description;
133
- let nextLineStartOffset = 0;
134
- for (const [idx, descLine] of normalizedDescription.split('\n').entries()) {
135
- const lineStartOffset = nextLineStartOffset;
136
-
137
- // +1 for the `\n` removed by split.
138
- nextLineStartOffset += descLine.length + 1;
139
- descLine.replaceAll(unescapedInlineTagRegex, (match, tagName, offset) => {
140
- if (allowedInlineTags.includes(tagName) ||
141
- // Run ignore-detection against the full description text so that
142
- // multi-line inline tags (e.g. `{@link` on one line and
143
- // `@scope/pkg#Member}` on the next) are recognized as being inside an
144
- // inline tag rather than scanned per-line.
145
- shouldIgnoreMatch(normalizedDescription, match, lineStartOffset + offset)) {
146
- return match;
147
- }
148
- tagNames.push(tagName);
149
- indexes.push(idx);
150
- return match;
151
- });
152
- }
153
- for (const [idx, tagName] of tagNames.entries()) {
154
- utils.reportJSDoc(`Unexpected inline JSDoc tag. Did you mean to use {@${tagName}}, \\@${tagName}, or \`@${tagName}\`?`, {
155
- line: indexes[idx] + 1
156
- }, enableFixer ? () => {
157
- // `tagName` and `fixType` are constant here, so compute the escaper
158
- // once rather than rebuilding the RegExp + closure for every line.
159
- const [, escapeInlineTag] = escapeInlineTags(tagName);
160
- utils.setBlockDescription((info, seedTokens, descLines) => {
161
- return descLines.map(desc => {
162
- const newDesc = escapeInlineTag(desc);
163
- return {
164
- number: 0,
165
- source: '',
166
- tokens: seedTokens({
167
- ...info,
168
- description: newDesc,
169
- postDelimiter: newDesc.trim() ? ' ' : ''
170
- })
171
- };
172
- });
173
- });
174
- } : null);
175
- }
176
- for (const tag of jsdoc.tags) {
177
- if (tag.tag === 'example') {
178
- continue;
179
- }
180
-
181
- /** @type {string} */
182
- let tagName = '';
183
- while (/** @type {string[]} */utils.getTagDescription(tag, true)
184
- // eslint-disable-next-line no-loop-func -- Safe
185
- .some(desc => {
186
- tagName = getUnescapedInlineTagName(desc);
187
- return tagName;
188
- })) {
189
- const line = utils.setTagDescription(tag, ...escapeInlineTags(tagName)) + tag.source[0].number;
190
- utils.reportJSDoc(`Unexpected inline JSDoc tag. Did you mean to use {@${tagName}}, \\@${tagName}, or \`@${tagName}\`?`, {
191
- line
192
- }, enableFixer ? () => {} : null, true);
193
- }
194
- }
195
- }, {
196
- iterateAllJsdocs: true,
197
- meta: {
198
- docs: {
199
- description: 'Reports use of JSDoc tags in non-tag positions (in the default "typescript" mode).',
200
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/escape-inline-tags.md#repos-sticky-header'
201
- },
202
- fixable: 'code',
203
- schema: [{
204
- additionalProperties: false,
205
- properties: {
206
- allowedInlineTags: {
207
- description: 'A listing of tags you wish to allow unescaped. Defaults to an empty array.',
208
- items: {
209
- type: 'string'
210
- },
211
- type: 'array'
212
- },
213
- enableFixer: {
214
- description: 'Whether to enable the fixer. Defaults to `false`.',
215
- type: 'boolean'
216
- },
217
- fixType: {
218
- description: `How to escape the inline tag.
219
-
220
- May be "backticks" to enclose tags in backticks (treating as code segments), or
221
- "backslash" to escape tags with a backslash, i.e., \`\\@\`
222
-
223
- Defaults to "backslash".`,
224
- enum: ['backticks', 'backslash'],
225
- type: 'string'
226
- }
227
- },
228
- type: 'object'
229
- }],
230
- type: 'suggestion'
231
- }
232
- });
233
- module.exports = exports.default;
234
- //# sourceMappingURL=escapeInlineTags.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"escapeInlineTags.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/escapeInlineTags.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n settings,\n utils,\n}) => {\n const {\n mode,\n } = settings;\n\n if (mode !== 'typescript') {\n return;\n }\n\n const {\n allowedInlineTags = [],\n enableFixer = false,\n fixType = 'backslash',\n } = context.options[0] || {};\n\n const {\n description,\n } = utils.getDescription();\n\n /** @type {string[]} */\n const tagNames = [];\n\n /** @type {number[]} */\n const indexes = [];\n\n const unescapedInlineTagRegex = /(?:^|\\s)@(\\w+)/gv;\n\n const scopedPackageNameRegex = /^@[\\w.\\-]+\\/[\\w.\\-]+/v;\n\n const declarationReferenceInlineTags = new Set([\n 'inheritDoc',\n 'link',\n 'linkcode',\n 'linkplain',\n ]);\n\n const markdownCodeSpanRegex = /(?<!\\\\)(`+)(?!`)[\\s\\S]*?(?<!`)\\1(?!`)/gv;\n\n /**\n * @param {string} desc\n * @param {number} index\n * @returns {boolean}\n */\n const isInsideMarkdownCodeSpan = (desc, index) => {\n markdownCodeSpanRegex.lastIndex = 0;\n\n let match;\n while ((match = markdownCodeSpanRegex.exec(desc)) !== null) {\n const delimiterLength = match[1].length;\n const contentStart = match.index + delimiterLength;\n const contentEnd = match.index + match[0].length - delimiterLength;\n\n if (index < contentStart) {\n return false;\n }\n\n if (index < contentEnd) {\n return true;\n }\n }\n\n return false;\n };\n\n /**\n * @param {string} desc\n * @param {number} atSignIndex\n * @returns {string}\n */\n const getInlineTagName = (desc, atSignIndex) => {\n const inlineTagStart = desc.lastIndexOf('{@', atSignIndex);\n\n if (inlineTagStart === -1) {\n return '';\n }\n\n const inlineTagEnd = desc.indexOf('}', inlineTagStart);\n\n if (inlineTagEnd === -1 || inlineTagEnd <= atSignIndex) {\n return '';\n }\n\n return desc.slice(inlineTagStart + 2).match(/^\\w+/v)?.[0] || '';\n };\n\n /**\n * @param {string} desc\n * @param {string} match\n * @param {number} offset\n * @returns {boolean}\n */\n const shouldIgnoreMatch = (desc, match, offset) => {\n const atSignIndex = offset + match.lastIndexOf('@');\n const inlineTagName = getInlineTagName(desc, atSignIndex);\n\n return isInsideMarkdownCodeSpan(desc, atSignIndex) ||\n declarationReferenceInlineTags.has(inlineTagName) &&\n scopedPackageNameRegex.test(desc.slice(atSignIndex));\n };\n\n /**\n * @param {string} tagName\n * @returns {[\n * RegExp,\n * (description: string) => string\n * ]}\n */\n const escapeInlineTags = (tagName) => {\n const regex = new RegExp(`(^|\\\\s)@${\n // No need to escape, as contains only safe characters\n tagName\n }`, 'gv');\n\n return [\n regex,\n /**\n * @param {string} desc\n */\n (desc) => {\n return desc.replaceAll(\n regex,\n (match, prefix, offset) => {\n if (shouldIgnoreMatch(desc, match, offset)) {\n return match;\n }\n\n return fixType === 'backticks' ?\n prefix + '`@' + tagName + '`' :\n prefix + '\\\\@' + tagName;\n },\n );\n },\n ];\n };\n\n /**\n * @param {string} desc\n * @returns {string}\n */\n const getUnescapedInlineTagName = (desc) => {\n unescapedInlineTagRegex.lastIndex = 0;\n\n let match;\n while ((match = unescapedInlineTagRegex.exec(desc)) !== null) {\n const [\n fullMatch,\n tagName,\n ] = match;\n\n if (\n allowedInlineTags.includes(tagName) ||\n shouldIgnoreMatch(desc, fullMatch, match.index)\n ) {\n continue;\n }\n\n return tagName;\n }\n\n return '';\n };\n\n const normalizedDescription = description.startsWith('\\n') ?\n description.slice(1) :\n description;\n\n let nextLineStartOffset = 0;\n for (const [\n idx,\n descLine,\n ] of normalizedDescription.split('\\n').entries()\n ) {\n const lineStartOffset = nextLineStartOffset;\n\n // +1 for the `\\n` removed by split.\n nextLineStartOffset += descLine.length + 1;\n\n descLine.replaceAll(unescapedInlineTagRegex, (match, tagName, offset) => {\n if (\n allowedInlineTags.includes(tagName) ||\n // Run ignore-detection against the full description text so that\n // multi-line inline tags (e.g. `{@link` on one line and\n // `@scope/pkg#Member}` on the next) are recognized as being inside an\n // inline tag rather than scanned per-line.\n shouldIgnoreMatch(\n normalizedDescription,\n match,\n lineStartOffset + offset,\n )\n ) {\n return match;\n }\n\n tagNames.push(tagName);\n indexes.push(idx);\n\n return match;\n });\n }\n\n for (const [\n idx,\n tagName,\n ] of tagNames.entries()) {\n utils.reportJSDoc(\n `Unexpected inline JSDoc tag. Did you mean to use {@${tagName}}, \\\\@${tagName}, or \\`@${tagName}\\`?`,\n {\n line: indexes[idx] + 1,\n },\n enableFixer ?\n () => {\n // `tagName` and `fixType` are constant here, so compute the escaper\n // once rather than rebuilding the RegExp + closure for every line.\n const [\n ,\n escapeInlineTag,\n ] = escapeInlineTags(tagName);\n\n utils.setBlockDescription((info, seedTokens, descLines) => {\n return descLines.map((desc) => {\n const newDesc = escapeInlineTag(desc);\n\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: newDesc,\n postDelimiter: newDesc.trim() ? ' ' : '',\n }),\n };\n });\n });\n } :\n null,\n );\n }\n\n for (const tag of jsdoc.tags) {\n if (tag.tag === 'example') {\n continue;\n }\n\n /** @type {string} */\n let tagName = '';\n while (/** @type {string[]} */ (\n utils.getTagDescription(tag, true)\n // eslint-disable-next-line no-loop-func -- Safe\n ).some((desc) => {\n tagName = getUnescapedInlineTagName(desc);\n\n return tagName;\n })) {\n const line = utils.setTagDescription(tag, ...escapeInlineTags(tagName)) +\n tag.source[0].number;\n utils.reportJSDoc(\n `Unexpected inline JSDoc tag. Did you mean to use {@${tagName}}, \\\\@${tagName}, or \\`@${tagName}\\`?`,\n {\n line,\n },\n enableFixer ? () => {} : null,\n true,\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports use of JSDoc tags in non-tag positions (in the default \"typescript\" mode).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/escape-inline-tags.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedInlineTags: {\n description: 'A listing of tags you wish to allow unescaped. Defaults to an empty array.',\n items: {\n type: 'string',\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Whether to enable the fixer. Defaults to `false`.',\n type: 'boolean',\n },\n fixType: {\n description: `How to escape the inline tag.\n\nMay be \"backticks\" to enclose tags in backticks (treating as code segments), or\n\"backslash\" to escape tags with a backslash, i.e., \\`\\\\@\\`\n\nDefaults to \"backslash\".`,\n enum: [\n 'backticks',\n 'backslash',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAAA,iCAE/B,IAAAA,qBAAY,EAAC,CAAC;EAC3B,OAAO;EACP,KAAK;EACL,QAAQ;EACR;AACF,CAAC,KAAK;EACJ,MAAM;IACJ;EACF,CAAC,GAAG,QAAQ;EAEZ,IAAI,IAAI,KAAK,YAAY,EAAE;IACzB;EACF;EAEA,MAAM;IACJ,iBAAiB,GAAG,EAAE;IACtB,WAAW,GAAG,KAAK;IACnB,OAAO,GAAG;EACZ,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,MAAM;IACJ;EACF,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;;EAE1B;EACA,MAAM,QAAQ,GAAG,EAAE;;EAEnB;EACA,MAAM,OAAO,GAAG,EAAE;EAElB,MAAM,uBAAuB,GAAG,kBAAkB;EAElD,MAAM,sBAAsB,GAAG,uBAAuB;EAEtD,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC,CAC7C,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,CACZ,CAAC;EAEF,MAAM,qBAAqB,GAAG,yCAAyC;;EAEvE;AACF;AACA;AACA;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,EAAE,4EAA4E;UACzF,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,WAAW,EAAE;UACX,WAAW,EAAE,mDAAmD;UAChE,IAAI,EAAE;QACR,CAAC;QACD,OAAO,EAAE;UACP,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,yBAAyB;UACb,IAAI,EAAE,CACJ,WAAW,EACX,WAAW,CACZ;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- var _default = exports.default = (0, _iterateJsdoc.default)(({
10
- report,
11
- utils
12
- }) => {
13
- const iteratingFunction = utils.isIteratingFunctionOrVariable();
14
- if (iteratingFunction) {
15
- if (utils.hasATag(['class', 'constructor']) || utils.isConstructor()) {
16
- return;
17
- }
18
- } else if (!utils.isVirtualFunction()) {
19
- return;
20
- }
21
- utils.forEachPreferredTag('implements', tag => {
22
- report('@implements used on a non-constructor function', null, tag);
23
- });
24
- }, {
25
- contextDefaults: true,
26
- meta: {
27
- docs: {
28
- description: 'Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors).',
29
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/implements-on-classes.md#repos-sticky-header'
30
- },
31
- schema: [{
32
- additionalProperties: false,
33
- properties: {
34
- contexts: {
35
- description: `Set this to an array of strings representing the AST context (or an object with
36
- \`context\` and \`comment\` properties) where you wish the rule to be applied.
37
-
38
- \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
39
-
40
- Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
41
- \`FunctionExpression\`). Set to \`"any"\` if you want
42
- the rule to apply to any JSDoc block throughout your files (as is necessary
43
- for finding function blocks not attached to a function declaration or
44
- expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
45
- \`@method\`) (including those associated with an \`@interface\`).
46
-
47
- See the ["AST and Selectors"](../advanced.md#ast-and-selectors)
48
- section of our Advanced docs for more on the expected format.`,
49
- items: {
50
- anyOf: [{
51
- type: 'string'
52
- }, {
53
- additionalProperties: false,
54
- properties: {
55
- comment: {
56
- type: 'string'
57
- },
58
- context: {
59
- type: 'string'
60
- }
61
- },
62
- type: 'object'
63
- }]
64
- },
65
- type: 'array'
66
- }
67
- },
68
- type: 'object'
69
- }],
70
- type: 'suggestion'
71
- }
72
- });
73
- module.exports = exports.default;
74
- //# sourceMappingURL=implementsOnClasses.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"implementsOnClasses.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/implementsOnClasses.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n const iteratingFunction = utils.isIteratingFunctionOrVariable();\n\n if (iteratingFunction) {\n if (utils.hasATag([\n 'class',\n 'constructor',\n ]) ||\n utils.isConstructor()\n ) {\n return;\n }\n } else if (!utils.isVirtualFunction()) {\n return;\n }\n\n utils.forEachPreferredTag('implements', (tag) => {\n report('@implements used on a non-constructor function', null, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/implements-on-classes.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\n\\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAAA,iCAE/B,IAAAA,qBAAY,EAAC,CAAC;EAC3B,MAAM;EACN;AACF,CAAC,KAAK;EACJ,MAAM,iBAAiB,GAAG,KAAK,CAAC,6BAA6B,CAAC,CAAC;EAE/D,IAAI,iBAAiB,EAAE;IACrB,IAAI,KAAK,CAAC,OAAO,CAAC,CAChB,OAAO,EACP,aAAa,CACd,CAAC,IACA,KAAK,CAAC,aAAa,CAAC,CAAC,EACrB;MACA;IACF;EACF,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE;IACrC;EACF;EAEA,KAAK,CAAC,mBAAmB,CAAC,YAAY,EAAG,GAAG,IAAK;IAC/C,MAAM,CAAC,gDAAgD,EAAE,IAAI,EAAE,GAAG,CAAC;EACrE,CAAC,CAAC;AACJ,CAAC,EAAE;EACD,eAAe,EAAE,IAAI;EACrB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,2HAA2H;MACxI,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,QAAQ,EAAE;UACR,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClD,KAAK,EAAE;YACL,KAAK,EAAE,CACL;cACE,IAAI,EAAE;YACR,CAAC,EACD;cACE,oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,104 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
- var _jsdoccomment = require("@es-joy/jsdoccomment");
9
- var resolve = _interopRequireWildcard(require("@es-joy/resolve.exports"));
10
- var _nodeFs = require("node:fs");
11
- var _nodeModule = require("node:module");
12
- var _nodePath = require("node:path");
13
- 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); }
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- /**
16
- * @type {Set<string>|null}
17
- */
18
- let deps;
19
- const setDeps = function () {
20
- try {
21
- const pkg = JSON.parse((0, _nodeFs.readFileSync)((0, _nodePath.join)(process.cwd(), './package.json'), 'utf8'));
22
- deps = new Set([...(pkg.dependencies ? /* c8 ignore next 2 */
23
- Object.keys(pkg.dependencies) : []), ...(pkg.devDependencies ? /* c8 ignore next 2 */
24
- Object.keys(pkg.devDependencies) : [])]);
25
- /* c8 ignore next -- our package.json exists */
26
- } catch (error) {
27
- /* c8 ignore next -- our package.json exists */
28
- deps = null;
29
- /* c8 ignore next 4 -- our package.json exists */
30
- /* eslint-disable no-console -- Inform user */
31
- console.log(error);
32
- /* eslint-enable no-console -- Inform user */
33
- }
34
- };
35
- const moduleCheck = new Map();
36
- var _default = exports.default = (0, _iterateJsdoc.default)(({
37
- jsdoc,
38
- settings,
39
- utils
40
- }) => {
41
- if (deps === undefined) {
42
- setDeps();
43
- }
44
-
45
- /* c8 ignore next 3 -- our package.json exists */
46
- if (deps === null) {
47
- return;
48
- }
49
- const {
50
- mode
51
- } = settings;
52
- for (const tag of jsdoc.tags) {
53
- let typeAst;
54
- try {
55
- typeAst = mode === 'permissive' ? (0, _jsdoccomment.tryParse)(tag.type) : (0, _jsdoccomment.parse)(tag.type, mode);
56
- } catch {
57
- continue;
58
- }
59
-
60
- // eslint-disable-next-line no-loop-func -- Safe
61
- (0, _jsdoccomment.traverse)(typeAst, nde => {
62
- /* c8 ignore next 3 -- TS guard */
63
- if (deps === null) {
64
- return;
65
- }
66
- if (nde.type === 'JsdocTypeImport') {
67
- let mod = nde.element.value.replace(/^(@[^\/]+\/[^\/]+|[^\/]+).*$/v, '$1');
68
- if (/^[.\/]/v.test(mod)) {
69
- return;
70
- }
71
- if ((0, _nodeModule.isBuiltin)(mod)) {
72
- // mod = '@types/node';
73
- // moduleCheck.set(mod, !deps.has(mod));
74
- return;
75
- } else if (!moduleCheck.has(mod)) {
76
- let pkg;
77
- try {
78
- pkg = JSON.parse((0, _nodeFs.readFileSync)((0, _nodePath.join)(process.cwd(), 'node_modules', mod, './package.json'), 'utf8'));
79
- } catch {
80
- // Ignore
81
- }
82
- if (!pkg || !pkg.types && !pkg.typings && !resolve.types(pkg)) {
83
- mod = `@types/${mod}`;
84
- }
85
- moduleCheck.set(mod, !deps.has(mod));
86
- }
87
- if (moduleCheck.get(mod)) {
88
- utils.reportJSDoc('import points to package which is not found in dependencies', tag);
89
- }
90
- }
91
- });
92
- }
93
- }, {
94
- iterateAllJsdocs: true,
95
- meta: {
96
- docs: {
97
- description: 'Reports if JSDoc `import()` statements point to a package which is not listed in `dependencies` or `devDependencies`',
98
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/imports-as-dependencies.md#repos-sticky-header'
99
- },
100
- type: 'suggestion'
101
- }
102
- });
103
- module.exports = exports.default;
104
- //# sourceMappingURL=importsAsDependencies.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"importsAsDependencies.cjs","names":["readFileSync","join","iterateJsdoc","tryParse","parse","traverse","isBuiltinModule"],"sources":["../../src/rules/importsAsDependencies.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse,\n traverse,\n tryParse,\n} from '@es-joy/jsdoccomment';\nimport * as resolve from '@es-joy/resolve.exports';\nimport {\n readFileSync,\n} from 'node:fs';\nimport {\n isBuiltin as isBuiltinModule,\n} from 'node:module';\nimport {\n join,\n} from 'node:path';\n\n/**\n * @type {Set<string>|null}\n */\nlet deps;\n\nconst setDeps = function () {\n try {\n const pkg = JSON.parse(\n readFileSync(join(process.cwd(), './package.json'), 'utf8'),\n );\n deps = new Set([\n ...(pkg.dependencies ?\n /* c8 ignore next 2 */\n Object.keys(pkg.dependencies) :\n []),\n ...(pkg.devDependencies ?\n /* c8 ignore next 2 */\n Object.keys(pkg.devDependencies) :\n []),\n ]);\n /* c8 ignore next -- our package.json exists */\n } catch (error) {\n /* c8 ignore next -- our package.json exists */\n deps = null;\n /* c8 ignore next 4 -- our package.json exists */\n /* eslint-disable no-console -- Inform user */\n console.log(error);\n /* eslint-enable no-console -- Inform user */\n }\n};\n\nconst moduleCheck = new Map();\n\nexport default iterateJsdoc(({\n jsdoc,\n settings,\n utils,\n}) => {\n if (deps === undefined) {\n setDeps();\n }\n\n /* c8 ignore next 3 -- our package.json exists */\n if (deps === null) {\n return;\n }\n\n const {\n mode,\n } = settings;\n\n for (const tag of jsdoc.tags) {\n let typeAst;\n try {\n typeAst = mode === 'permissive' ? tryParse(tag.type) : parse(tag.type, mode);\n } catch {\n continue;\n }\n\n // eslint-disable-next-line no-loop-func -- Safe\n traverse(typeAst, (nde) => {\n /* c8 ignore next 3 -- TS guard */\n if (deps === null) {\n return;\n }\n\n if (nde.type === 'JsdocTypeImport') {\n let mod = nde.element.value.replace(\n /^(@[^\\/]+\\/[^\\/]+|[^\\/]+).*$/v, '$1',\n );\n\n if ((/^[.\\/]/v).test(mod)) {\n return;\n }\n\n if (isBuiltinModule(mod)) {\n // mod = '@types/node';\n // moduleCheck.set(mod, !deps.has(mod));\n return;\n } else if (!moduleCheck.has(mod)) {\n let pkg;\n try {\n pkg = JSON.parse(\n readFileSync(join(process.cwd(), 'node_modules', mod, './package.json'), 'utf8'),\n );\n } catch {\n // Ignore\n }\n\n if (!pkg || (!pkg.types && !pkg.typings && !resolve.types(pkg))) {\n mod = `@types/${mod}`;\n }\n\n moduleCheck.set(mod, !deps.has(mod));\n }\n\n if (moduleCheck.get(mod)) {\n utils.reportJSDoc(\n 'import points to package which is not found in dependencies',\n tag,\n );\n }\n }\n });\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports if JSDoc `import()` statements point to a package which is not listed in `dependencies` or `devDependencies`',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/imports-as-dependencies.md#repos-sticky-header',\n },\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAKA;AACA;AAGA;AAGA;AAEmB;AAAA;AAEnB;AACA;AACA;AACA,IAAI,IAAI;AAER,MAAM,OA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