eslint-plugin-jsdoc 55.3.0 → 56.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 (156) hide show
  1. package/dist/cjs/WarnSettings.d.ts +16 -0
  2. package/dist/cjs/WarnSettings.js +30 -0
  3. package/dist/cjs/alignTransform.d.ts +33 -0
  4. package/dist/cjs/alignTransform.js +285 -0
  5. package/dist/cjs/defaultTagOrder.d.ts +4 -0
  6. package/dist/cjs/defaultTagOrder.js +152 -0
  7. package/dist/cjs/exportParser.d.ts +40 -0
  8. package/dist/cjs/exportParser.js +754 -0
  9. package/dist/cjs/getDefaultTagStructureForMode.d.ts +10 -0
  10. package/dist/cjs/getDefaultTagStructureForMode.js +840 -0
  11. package/dist/cjs/getJsdocProcessorPlugin.cjs +4 -0
  12. package/dist/cjs/getJsdocProcessorPlugin.d.cts +1 -0
  13. package/dist/cjs/getJsdocProcessorPlugin.d.ts +66 -0
  14. package/dist/cjs/getJsdocProcessorPlugin.js +553 -0
  15. package/dist/cjs/index-cjs.d.ts +16 -0
  16. package/dist/cjs/index-cjs.js +492 -0
  17. package/dist/cjs/index.cjs.cjs +6 -0
  18. package/dist/cjs/index.cjs.d.cts +2 -0
  19. package/dist/cjs/iterateJsdoc.cjs +38 -0
  20. package/dist/cjs/iterateJsdoc.d.cts +2 -0
  21. package/dist/cjs/iterateJsdoc.d.ts +462 -0
  22. package/dist/cjs/iterateJsdoc.js +1981 -0
  23. package/dist/cjs/jsdocUtils.d.ts +454 -0
  24. package/dist/cjs/jsdocUtils.js +1470 -0
  25. package/dist/cjs/rules/checkAccess.d.ts +2 -0
  26. package/dist/cjs/rules/checkAccess.js +35 -0
  27. package/dist/cjs/rules/checkAlignment.d.ts +2 -0
  28. package/dist/cjs/rules/checkAlignment.js +63 -0
  29. package/dist/cjs/rules/checkExamples.d.ts +3 -0
  30. package/dist/cjs/rules/checkExamples.js +486 -0
  31. package/dist/cjs/rules/checkIndentation.d.ts +2 -0
  32. package/dist/cjs/rules/checkIndentation.js +66 -0
  33. package/dist/cjs/rules/checkLineAlignment.d.ts +9 -0
  34. package/dist/cjs/rules/checkLineAlignment.js +297 -0
  35. package/dist/cjs/rules/checkParamNames.d.ts +2 -0
  36. package/dist/cjs/rules/checkParamNames.js +320 -0
  37. package/dist/cjs/rules/checkPropertyNames.d.ts +2 -0
  38. package/dist/cjs/rules/checkPropertyNames.js +105 -0
  39. package/dist/cjs/rules/checkSyntax.d.ts +2 -0
  40. package/dist/cjs/rules/checkSyntax.js +27 -0
  41. package/dist/cjs/rules/checkTagNames.d.ts +2 -0
  42. package/dist/cjs/rules/checkTagNames.js +252 -0
  43. package/dist/cjs/rules/checkTemplateNames.d.ts +2 -0
  44. package/dist/cjs/rules/checkTemplateNames.js +189 -0
  45. package/dist/cjs/rules/checkTypes.d.ts +2 -0
  46. package/dist/cjs/rules/checkTypes.js +421 -0
  47. package/dist/cjs/rules/checkValues.d.ts +2 -0
  48. package/dist/cjs/rules/checkValues.js +163 -0
  49. package/dist/cjs/rules/convertToJsdocComments.d.ts +251 -0
  50. package/dist/cjs/rules/convertToJsdocComments.js +313 -0
  51. package/dist/cjs/rules/emptyTags.d.ts +2 -0
  52. package/dist/cjs/rules/emptyTags.js +79 -0
  53. package/dist/cjs/rules/implementsOnClasses.d.ts +2 -0
  54. package/dist/cjs/rules/implementsOnClasses.js +63 -0
  55. package/dist/cjs/rules/importsAsDependencies.d.ts +2 -0
  56. package/dist/cjs/rules/importsAsDependencies.js +105 -0
  57. package/dist/cjs/rules/informativeDocs.d.ts +2 -0
  58. package/dist/cjs/rules/informativeDocs.js +153 -0
  59. package/dist/cjs/rules/linesBeforeBlock.d.ts +2 -0
  60. package/dist/cjs/rules/linesBeforeBlock.js +106 -0
  61. package/dist/cjs/rules/matchDescription.d.ts +2 -0
  62. package/dist/cjs/rules/matchDescription.js +240 -0
  63. package/dist/cjs/rules/matchName.d.ts +2 -0
  64. package/dist/cjs/rules/matchName.js +122 -0
  65. package/dist/cjs/rules/multilineBlocks.d.ts +2 -0
  66. package/dist/cjs/rules/multilineBlocks.js +339 -0
  67. package/dist/cjs/rules/noBadBlocks.d.ts +2 -0
  68. package/dist/cjs/rules/noBadBlocks.js +88 -0
  69. package/dist/cjs/rules/noBlankBlockDescriptions.d.ts +2 -0
  70. package/dist/cjs/rules/noBlankBlockDescriptions.js +56 -0
  71. package/dist/cjs/rules/noBlankBlocks.d.ts +2 -0
  72. package/dist/cjs/rules/noBlankBlocks.js +41 -0
  73. package/dist/cjs/rules/noDefaults.d.ts +2 -0
  74. package/dist/cjs/rules/noDefaults.js +84 -0
  75. package/dist/cjs/rules/noMissingSyntax.d.ts +9 -0
  76. package/dist/cjs/rules/noMissingSyntax.js +164 -0
  77. package/dist/cjs/rules/noMultiAsterisks.d.ts +2 -0
  78. package/dist/cjs/rules/noMultiAsterisks.js +83 -0
  79. package/dist/cjs/rules/noRestrictedSyntax.d.ts +2 -0
  80. package/dist/cjs/rules/noRestrictedSyntax.js +75 -0
  81. package/dist/cjs/rules/noTypes.d.ts +2 -0
  82. package/dist/cjs/rules/noTypes.js +88 -0
  83. package/dist/cjs/rules/noUndefinedTypes.d.ts +2 -0
  84. package/dist/cjs/rules/noUndefinedTypes.js +451 -0
  85. package/dist/cjs/rules/requireAsteriskPrefix.d.ts +2 -0
  86. package/dist/cjs/rules/requireAsteriskPrefix.js +144 -0
  87. package/dist/cjs/rules/requireDescription.d.ts +2 -0
  88. package/dist/cjs/rules/requireDescription.js +136 -0
  89. package/dist/cjs/rules/requireDescriptionCompleteSentence.d.ts +2 -0
  90. package/dist/cjs/rules/requireDescriptionCompleteSentence.js +258 -0
  91. package/dist/cjs/rules/requireExample.d.ts +2 -0
  92. package/dist/cjs/rules/requireExample.js +103 -0
  93. package/dist/cjs/rules/requireFileOverview.d.ts +2 -0
  94. package/dist/cjs/rules/requireFileOverview.js +117 -0
  95. package/dist/cjs/rules/requireHyphenBeforeParamDescription.d.ts +2 -0
  96. package/dist/cjs/rules/requireHyphenBeforeParamDescription.js +144 -0
  97. package/dist/cjs/rules/requireJsdoc.d.ts +25 -0
  98. package/dist/cjs/rules/requireJsdoc.js +629 -0
  99. package/dist/cjs/rules/requireParam.d.ts +3 -0
  100. package/dist/cjs/rules/requireParam.js +480 -0
  101. package/dist/cjs/rules/requireParamDescription.d.ts +2 -0
  102. package/dist/cjs/rules/requireParamDescription.js +77 -0
  103. package/dist/cjs/rules/requireParamName.d.ts +2 -0
  104. package/dist/cjs/rules/requireParamName.js +52 -0
  105. package/dist/cjs/rules/requireParamType.d.ts +2 -0
  106. package/dist/cjs/rules/requireParamType.js +77 -0
  107. package/dist/cjs/rules/requireProperty.d.ts +2 -0
  108. package/dist/cjs/rules/requireProperty.js +44 -0
  109. package/dist/cjs/rules/requirePropertyDescription.d.ts +2 -0
  110. package/dist/cjs/rules/requirePropertyDescription.js +22 -0
  111. package/dist/cjs/rules/requirePropertyName.d.ts +2 -0
  112. package/dist/cjs/rules/requirePropertyName.js +22 -0
  113. package/dist/cjs/rules/requirePropertyType.d.ts +2 -0
  114. package/dist/cjs/rules/requirePropertyType.js +22 -0
  115. package/dist/cjs/rules/requireReturns.d.ts +2 -0
  116. package/dist/cjs/rules/requireReturns.js +197 -0
  117. package/dist/cjs/rules/requireReturnsCheck.d.ts +2 -0
  118. package/dist/cjs/rules/requireReturnsCheck.js +108 -0
  119. package/dist/cjs/rules/requireReturnsDescription.d.ts +2 -0
  120. package/dist/cjs/rules/requireReturnsDescription.js +58 -0
  121. package/dist/cjs/rules/requireReturnsType.d.ts +2 -0
  122. package/dist/cjs/rules/requireReturnsType.js +52 -0
  123. package/dist/cjs/rules/requireTemplate.d.ts +2 -0
  124. package/dist/cjs/rules/requireTemplate.js +173 -0
  125. package/dist/cjs/rules/requireThrows.d.ts +2 -0
  126. package/dist/cjs/rules/requireThrows.js +101 -0
  127. package/dist/cjs/rules/requireYields.d.ts +2 -0
  128. package/dist/cjs/rules/requireYields.js +172 -0
  129. package/dist/cjs/rules/requireYieldsCheck.d.ts +2 -0
  130. package/dist/cjs/rules/requireYieldsCheck.js +164 -0
  131. package/dist/cjs/rules/sortTags.d.ts +2 -0
  132. package/dist/cjs/rules/sortTags.js +392 -0
  133. package/dist/cjs/rules/tagLines.d.ts +2 -0
  134. package/dist/cjs/rules/tagLines.js +259 -0
  135. package/dist/cjs/rules/textEscaping.d.ts +2 -0
  136. package/dist/cjs/rules/textEscaping.js +125 -0
  137. package/dist/cjs/rules/typeFormatting.d.ts +2 -0
  138. package/dist/cjs/rules/typeFormatting.js +328 -0
  139. package/dist/cjs/rules/validTypes.d.ts +2 -0
  140. package/dist/cjs/rules/validTypes.js +333 -0
  141. package/dist/cjs/tagNames.d.ts +15 -0
  142. package/dist/cjs/tagNames.js +209 -0
  143. package/dist/cjs/utils/hasReturnValue.d.ts +19 -0
  144. package/dist/cjs/utils/hasReturnValue.js +469 -0
  145. package/dist/getJsdocProcessorPlugin.cts +3 -0
  146. package/dist/index.cjs.cts +3 -0
  147. package/dist/iterateJsdoc.cts +6 -0
  148. package/dist/rules/typeFormatting.cjs +82 -38
  149. package/dist/rules/typeFormatting.cjs.map +1 -1
  150. package/dist/rules.d.ts +4 -7
  151. package/package.json +24 -13
  152. package/src/getJsdocProcessorPlugin.cts +3 -0
  153. package/src/index.cjs.cts +3 -0
  154. package/src/iterateJsdoc.cts +6 -0
  155. package/src/rules/typeFormatting.js +104 -40
  156. package/src/rules.d.ts +4 -7
@@ -0,0 +1,16 @@
1
+ export default WarnSettings;
2
+ declare function WarnSettings(): {
3
+ /**
4
+ * Warn only once for each context and setting
5
+ * @param {{}} context
6
+ * @param {string} setting
7
+ * @returns {boolean}
8
+ */
9
+ hasBeenWarned(context: {}, setting: string): boolean;
10
+ /**
11
+ * @param {{}} context
12
+ * @param {string} setting
13
+ * @returns {void}
14
+ */
15
+ markSettingAsWarned(context: {}, setting: string): void;
16
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const WarnSettings = function () {
4
+ /** @type {WeakMap<object, Set<string>>} */
5
+ const warnedSettings = new WeakMap();
6
+ return {
7
+ /**
8
+ * Warn only once for each context and setting
9
+ * @param {{}} context
10
+ * @param {string} setting
11
+ * @returns {boolean}
12
+ */
13
+ hasBeenWarned(context, setting) {
14
+ return warnedSettings.has(context) && /** @type {Set<string>} */ (warnedSettings.get(context)).has(setting);
15
+ },
16
+ /**
17
+ * @param {{}} context
18
+ * @param {string} setting
19
+ * @returns {void}
20
+ */
21
+ markSettingAsWarned(context, setting) {
22
+ // c8 ignore else
23
+ if (!warnedSettings.has(context)) {
24
+ warnedSettings.set(context, new Set());
25
+ }
26
+ /** @type {Set<string>} */ (warnedSettings.get(context)).add(setting);
27
+ },
28
+ };
29
+ };
30
+ exports.default = WarnSettings;
@@ -0,0 +1,33 @@
1
+ export default alignTransform;
2
+ export type TypelessInfo = {
3
+ hasNoTypes: boolean;
4
+ maxNamedTagLength: import("./iterateJsdoc.js").Integer;
5
+ maxUnnamedTagLength: import("./iterateJsdoc.js").Integer;
6
+ };
7
+ export type Width = {
8
+ name: import("./iterateJsdoc.js").Integer;
9
+ start: import("./iterateJsdoc.js").Integer;
10
+ tag: import("./iterateJsdoc.js").Integer;
11
+ type: import("./iterateJsdoc.js").Integer;
12
+ };
13
+ /**
14
+ * @param {{
15
+ * customSpacings: import('../src/rules/checkLineAlignment.js').CustomSpacings,
16
+ * tags: string[],
17
+ * indent: string,
18
+ * preserveMainDescriptionPostDelimiter: boolean,
19
+ * wrapIndent: string,
20
+ * disableWrapIndent: boolean,
21
+ * }} cfg
22
+ * @returns {(
23
+ * block: import('comment-parser').Block
24
+ * ) => import('comment-parser').Block}
25
+ */
26
+ declare function alignTransform({ customSpacings, disableWrapIndent, indent, preserveMainDescriptionPostDelimiter, tags, wrapIndent, }: {
27
+ customSpacings: import("../src/rules/checkLineAlignment.js").CustomSpacings;
28
+ tags: string[];
29
+ indent: string;
30
+ preserveMainDescriptionPostDelimiter: boolean;
31
+ wrapIndent: string;
32
+ disableWrapIndent: boolean;
33
+ }): (block: import("comment-parser").Block) => import("comment-parser").Block;
@@ -0,0 +1,285 @@
1
+ "use strict";
2
+ /**
3
+ * Transform based on https://github.com/syavorsky/comment-parser/blob/master/src/transforms/align.ts
4
+ *
5
+ * It contains some customizations to align based on the tags, and some custom options.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ const comment_parser_1 = require("comment-parser");
9
+ /**
10
+ * @typedef {{
11
+ * hasNoTypes: boolean,
12
+ * maxNamedTagLength: import('./iterateJsdoc.js').Integer,
13
+ * maxUnnamedTagLength: import('./iterateJsdoc.js').Integer
14
+ * }} TypelessInfo
15
+ */
16
+ const { rewireSource, } = comment_parser_1.util;
17
+ /**
18
+ * @typedef {{
19
+ * name: import('./iterateJsdoc.js').Integer,
20
+ * start: import('./iterateJsdoc.js').Integer,
21
+ * tag: import('./iterateJsdoc.js').Integer,
22
+ * type: import('./iterateJsdoc.js').Integer
23
+ * }} Width
24
+ */
25
+ /** @type {Width} */
26
+ const zeroWidth = {
27
+ name: 0,
28
+ start: 0,
29
+ tag: 0,
30
+ type: 0,
31
+ };
32
+ /**
33
+ * @param {string[]} tags
34
+ * @param {import('./iterateJsdoc.js').Integer} index
35
+ * @param {import('comment-parser').Line[]} source
36
+ * @returns {boolean}
37
+ */
38
+ const shouldAlign = (tags, index, source) => {
39
+ const tag = source[index].tokens.tag.replace('@', '');
40
+ const includesTag = tags.includes(tag);
41
+ if (includesTag) {
42
+ return true;
43
+ }
44
+ if (tag !== '') {
45
+ return false;
46
+ }
47
+ for (let iterator = index; iterator >= 0; iterator--) {
48
+ const previousTag = source[iterator].tokens.tag.replace('@', '');
49
+ if (previousTag !== '') {
50
+ if (tags.includes(previousTag)) {
51
+ return true;
52
+ }
53
+ return false;
54
+ }
55
+ }
56
+ return true;
57
+ };
58
+ /**
59
+ * @param {string[]} tags
60
+ * @returns {(
61
+ * width: Width,
62
+ * line: {
63
+ * tokens: import('comment-parser').Tokens
64
+ * },
65
+ * index: import('./iterateJsdoc.js').Integer,
66
+ * source: import('comment-parser').Line[]
67
+ * ) => Width}
68
+ */
69
+ const getWidth = (tags) => {
70
+ return (width, { tokens, }, index, source) => {
71
+ if (!shouldAlign(tags, index, source)) {
72
+ return width;
73
+ }
74
+ return {
75
+ name: Math.max(width.name, tokens.name.length),
76
+ start: tokens.delimiter === '/**' ? tokens.start.length : width.start,
77
+ tag: Math.max(width.tag, tokens.tag.length),
78
+ type: Math.max(width.type, tokens.type.length),
79
+ };
80
+ };
81
+ };
82
+ /**
83
+ * @param {{
84
+ * description: string;
85
+ * tags: import('comment-parser').Spec[];
86
+ * problems: import('comment-parser').Problem[];
87
+ * }} fields
88
+ * @returns {TypelessInfo}
89
+ */
90
+ const getTypelessInfo = (fields) => {
91
+ const hasNoTypes = fields.tags.every(({ type, }) => {
92
+ return !type;
93
+ });
94
+ const maxNamedTagLength = Math.max(...fields.tags.map(({ name, tag, }) => {
95
+ return name.length === 0 ? -1 : tag.length;
96
+ }).filter((length) => {
97
+ return length !== -1;
98
+ })) + 1;
99
+ const maxUnnamedTagLength = Math.max(...fields.tags.map(({ name, tag, }) => {
100
+ return name.length === 0 ? tag.length : -1;
101
+ }).filter((length) => {
102
+ return length !== -1;
103
+ })) + 1;
104
+ return {
105
+ hasNoTypes,
106
+ maxNamedTagLength,
107
+ maxUnnamedTagLength,
108
+ };
109
+ };
110
+ /**
111
+ * @param {import('./iterateJsdoc.js').Integer} len
112
+ * @returns {string}
113
+ */
114
+ const space = (len) => {
115
+ return ''.padStart(len, ' ');
116
+ };
117
+ /**
118
+ * @param {{
119
+ * customSpacings: import('../src/rules/checkLineAlignment.js').CustomSpacings,
120
+ * tags: string[],
121
+ * indent: string,
122
+ * preserveMainDescriptionPostDelimiter: boolean,
123
+ * wrapIndent: string,
124
+ * disableWrapIndent: boolean,
125
+ * }} cfg
126
+ * @returns {(
127
+ * block: import('comment-parser').Block
128
+ * ) => import('comment-parser').Block}
129
+ */
130
+ const alignTransform = ({ customSpacings, disableWrapIndent, indent, preserveMainDescriptionPostDelimiter, tags, wrapIndent, }) => {
131
+ let intoTags = false;
132
+ /** @type {Width} */
133
+ let width;
134
+ /**
135
+ * @param {import('comment-parser').Tokens} tokens
136
+ * @param {TypelessInfo} typelessInfo
137
+ * @returns {import('comment-parser').Tokens}
138
+ */
139
+ const alignTokens = (tokens, typelessInfo) => {
140
+ const nothingAfter = {
141
+ delim: false,
142
+ name: false,
143
+ tag: false,
144
+ type: false,
145
+ };
146
+ if (tokens.description === '') {
147
+ nothingAfter.name = true;
148
+ tokens.postName = '';
149
+ if (tokens.name === '') {
150
+ nothingAfter.type = true;
151
+ tokens.postType = '';
152
+ if (tokens.type === '') {
153
+ nothingAfter.tag = true;
154
+ tokens.postTag = '';
155
+ /* c8 ignore next: Never happens because the !intoTags return. But it's here for consistency with the original align transform */
156
+ if (tokens.tag === '') {
157
+ nothingAfter.delim = true;
158
+ }
159
+ }
160
+ }
161
+ }
162
+ let untypedNameAdjustment = 0;
163
+ let untypedTypeAdjustment = 0;
164
+ if (typelessInfo.hasNoTypes) {
165
+ nothingAfter.tag = true;
166
+ tokens.postTag = '';
167
+ if (tokens.name === '') {
168
+ untypedNameAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;
169
+ }
170
+ else {
171
+ untypedNameAdjustment = typelessInfo.maxNamedTagLength > typelessInfo.maxUnnamedTagLength ? 0 :
172
+ Math.max(0, typelessInfo.maxUnnamedTagLength - (tokens.tag.length + tokens.name.length + 1));
173
+ untypedTypeAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;
174
+ }
175
+ }
176
+ // Todo: Avoid fixing alignment of blocks with multiline wrapping of type
177
+ if (tokens.tag === '' && tokens.type) {
178
+ return tokens;
179
+ }
180
+ const spacings = {
181
+ postDelimiter: customSpacings?.postDelimiter || 1,
182
+ postName: customSpacings?.postName || 1,
183
+ postTag: customSpacings?.postTag || 1,
184
+ postType: customSpacings?.postType || 1,
185
+ };
186
+ tokens.postDelimiter = nothingAfter.delim ? '' : space(spacings.postDelimiter);
187
+ if (!nothingAfter.tag) {
188
+ tokens.postTag = space(width.tag - tokens.tag.length + spacings.postTag);
189
+ }
190
+ if (!nothingAfter.type) {
191
+ tokens.postType = space(width.type - tokens.type.length + spacings.postType + untypedTypeAdjustment);
192
+ }
193
+ if (!nothingAfter.name) {
194
+ // If post name is empty for all lines (name width 0), don't add post name spacing.
195
+ tokens.postName = width.name === 0 ? '' : space(width.name - tokens.name.length + spacings.postName + untypedNameAdjustment);
196
+ }
197
+ return tokens;
198
+ };
199
+ /**
200
+ * @param {import('comment-parser').Line} line
201
+ * @param {import('./iterateJsdoc.js').Integer} index
202
+ * @param {import('comment-parser').Line[]} source
203
+ * @param {TypelessInfo} typelessInfo
204
+ * @param {string|false} indentTag
205
+ * @returns {import('comment-parser').Line}
206
+ */
207
+ const update = (line, index, source, typelessInfo, indentTag) => {
208
+ /** @type {import('comment-parser').Tokens} */
209
+ const tokens = {
210
+ ...line.tokens,
211
+ };
212
+ if (tokens.tag !== '') {
213
+ intoTags = true;
214
+ }
215
+ const isEmpty = tokens.tag === '' &&
216
+ tokens.name === '' &&
217
+ tokens.type === '' &&
218
+ tokens.description === '';
219
+ // dangling '*/'
220
+ if (tokens.end === '*/' && isEmpty) {
221
+ tokens.start = indent + ' ';
222
+ return {
223
+ ...line,
224
+ tokens,
225
+ };
226
+ }
227
+ switch (tokens.delimiter) {
228
+ case '*':
229
+ tokens.start = indent + ' ';
230
+ break;
231
+ case '/**':
232
+ tokens.start = indent;
233
+ break;
234
+ default:
235
+ tokens.delimiter = '';
236
+ // compensate delimiter
237
+ tokens.start = indent + ' ';
238
+ }
239
+ if (!intoTags) {
240
+ if (tokens.description === '') {
241
+ tokens.postDelimiter = '';
242
+ }
243
+ else if (!preserveMainDescriptionPostDelimiter) {
244
+ tokens.postDelimiter = ' ';
245
+ }
246
+ return {
247
+ ...line,
248
+ tokens,
249
+ };
250
+ }
251
+ const postHyphenSpacing = customSpacings?.postHyphen ?? 1;
252
+ const hyphenSpacing = /^\s*-\s+/v;
253
+ tokens.description = tokens.description.replace(hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '));
254
+ // Not align.
255
+ if (shouldAlign(tags, index, source)) {
256
+ alignTokens(tokens, typelessInfo);
257
+ if (!disableWrapIndent && indentTag) {
258
+ tokens.postDelimiter += wrapIndent;
259
+ }
260
+ }
261
+ return {
262
+ ...line,
263
+ tokens,
264
+ };
265
+ };
266
+ return ({ source, ...fields }) => {
267
+ width = source.reduce(getWidth(tags), {
268
+ ...zeroWidth,
269
+ });
270
+ const typelessInfo = getTypelessInfo(fields);
271
+ let tagIndentMode = false;
272
+ return rewireSource({
273
+ ...fields,
274
+ source: source.map((line, index) => {
275
+ const indentTag = !disableWrapIndent && tagIndentMode && !line.tokens.tag && line.tokens.description;
276
+ const ret = update(line, index, source, typelessInfo, indentTag);
277
+ if (!disableWrapIndent && line.tokens.tag) {
278
+ tagIndentMode = true;
279
+ }
280
+ return ret;
281
+ }),
282
+ });
283
+ };
284
+ };
285
+ exports.default = alignTransform;
@@ -0,0 +1,4 @@
1
+ export default defaultTagOrder;
2
+ declare const defaultTagOrder: {
3
+ tags: string[];
4
+ }[];
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const defaultTagOrder = [
4
+ {
5
+ tags: [
6
+ // Brief descriptions
7
+ 'summary',
8
+ 'typeSummary',
9
+ // Module/file-level
10
+ 'module',
11
+ 'exports',
12
+ 'file',
13
+ 'fileoverview',
14
+ 'overview',
15
+ 'import',
16
+ // Identifying (name, type)
17
+ 'template',
18
+ 'typedef',
19
+ 'interface',
20
+ 'record',
21
+ 'name',
22
+ 'kind',
23
+ 'type',
24
+ 'alias',
25
+ 'external',
26
+ 'host',
27
+ 'callback',
28
+ 'func',
29
+ 'function',
30
+ 'method',
31
+ 'class',
32
+ 'constructor',
33
+ // Relationships
34
+ 'modifies',
35
+ 'mixes',
36
+ 'mixin',
37
+ 'mixinClass',
38
+ 'mixinFunction',
39
+ 'namespace',
40
+ 'borrows',
41
+ 'constructs',
42
+ 'lends',
43
+ 'implements',
44
+ 'requires',
45
+ // Long descriptions
46
+ 'desc',
47
+ 'description',
48
+ 'classdesc',
49
+ 'tutorial',
50
+ 'copyright',
51
+ 'license',
52
+ // Simple annotations
53
+ // TypeScript
54
+ 'internal',
55
+ 'overload',
56
+ 'const',
57
+ 'constant',
58
+ 'final',
59
+ 'global',
60
+ 'readonly',
61
+ 'abstract',
62
+ 'virtual',
63
+ 'var',
64
+ 'member',
65
+ 'memberof',
66
+ 'memberof!',
67
+ 'inner',
68
+ 'instance',
69
+ 'inheritdoc',
70
+ 'inheritDoc',
71
+ 'override',
72
+ 'hideconstructor',
73
+ // Core function/object info
74
+ 'param',
75
+ 'arg',
76
+ 'argument',
77
+ 'prop',
78
+ 'property',
79
+ 'return',
80
+ 'returns',
81
+ // Important behavior details
82
+ 'async',
83
+ 'generator',
84
+ 'default',
85
+ 'defaultvalue',
86
+ 'enum',
87
+ 'augments',
88
+ 'extends',
89
+ 'throws',
90
+ 'exception',
91
+ 'yield',
92
+ 'yields',
93
+ 'event',
94
+ 'fires',
95
+ 'emits',
96
+ 'listens',
97
+ 'this',
98
+ // TypeScript
99
+ 'satisfies',
100
+ // Access
101
+ 'static',
102
+ 'private',
103
+ 'protected',
104
+ 'public',
105
+ 'access',
106
+ 'package',
107
+ '-other',
108
+ // Supplementary descriptions
109
+ 'see',
110
+ 'example',
111
+ // METADATA
112
+ // Other Closure (undocumented) metadata
113
+ 'closurePrimitive',
114
+ 'customElement',
115
+ 'expose',
116
+ 'hidden',
117
+ 'idGenerator',
118
+ 'meaning',
119
+ 'ngInject',
120
+ 'owner',
121
+ 'wizaction',
122
+ // Other Closure (documented) metadata
123
+ 'define',
124
+ 'dict',
125
+ 'export',
126
+ 'externs',
127
+ 'implicitCast',
128
+ 'noalias',
129
+ 'nocollapse',
130
+ 'nocompile',
131
+ 'noinline',
132
+ 'nosideeffects',
133
+ 'polymer',
134
+ 'polymerBehavior',
135
+ 'preserve',
136
+ 'struct',
137
+ 'suppress',
138
+ 'unrestricted',
139
+ // @homer0/prettier-plugin-jsdoc metadata
140
+ 'category',
141
+ // Non-Closure metadata
142
+ 'ignore',
143
+ 'author',
144
+ 'version',
145
+ 'variation',
146
+ 'since',
147
+ 'deprecated',
148
+ 'todo',
149
+ ],
150
+ },
151
+ ];
152
+ exports.default = defaultTagOrder;
@@ -0,0 +1,40 @@
1
+ declare namespace _default {
2
+ export { isUncommentedExport };
3
+ export { parse };
4
+ }
5
+ export default _default;
6
+ export type ValueObject = {
7
+ value: string;
8
+ };
9
+ export type CreatedNode = {
10
+ type?: string;
11
+ value?: ValueObject | import("eslint").Rule.Node | import("@typescript-eslint/types").TSESTree.Node;
12
+ props: {
13
+ [key: string]: CreatedNode | null;
14
+ };
15
+ special?: true;
16
+ globalVars?: CreatedNode;
17
+ exported?: boolean;
18
+ ANONYMOUS_DEFAULT?: import("eslint").Rule.Node;
19
+ };
20
+ export type CreateSymbol = (node: import("eslint").Rule.Node | null, globals: CreatedNode, value: import("eslint").Rule.Node | import("@typescript-eslint/types").TSESTree.Node | null, scope?: CreatedNode | undefined, isGlobal?: boolean | SymbolOptions | undefined) => CreatedNode | null;
21
+ export type SymbolOptions = {
22
+ simpleIdentifier?: boolean;
23
+ };
24
+ /**
25
+ *
26
+ * @param {import('eslint').Rule.Node} node
27
+ * @param {import('eslint').SourceCode} sourceCode
28
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
29
+ * @param {import('./iterateJsdoc.js').Settings} settings
30
+ * @returns {boolean}
31
+ */
32
+ declare function isUncommentedExport(node: import("eslint").Rule.Node, sourceCode: import("eslint").SourceCode, opt: import("./rules/requireJsdoc.js").RequireJsdocOpts, settings: import("./iterateJsdoc.js").Settings): boolean;
33
+ /**
34
+ *
35
+ * @param {import('eslint').Rule.Node} ast
36
+ * @param {import('eslint').Rule.Node} node
37
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
38
+ * @returns {CreatedNode}
39
+ */
40
+ declare function parse(ast: import("eslint").Rule.Node, node: import("eslint").Rule.Node, opt: import("./rules/requireJsdoc.js").RequireJsdocOpts): CreatedNode;